Merge pull request #15402 from nextcloud/refactor/oc-appswebroots-bundle

Move OC.appswebroots to the bundle and deprecate oc_appswebroots
pull/13929/head
Morris Jobke 6 years ago committed by GitHub
commit 2cfe4fdd4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      apps/files_sharing/js/public.js
  2. 60
      core/js/dist/main.js
  3. 2
      core/js/dist/main.js.map
  4. 2
      core/js/dist/share_backend.js
  5. 2
      core/js/dist/share_backend.js.map
  6. 1
      core/js/js.js
  7. 2
      core/js/sharedialoglinkshareview.js
  8. 2
      core/js/sharedialogshareelistview.js
  9. 2
      core/js/tests/specHelper.js
  10. 4
      core/js/tests/specs/sharedialoglinkshareview.js
  11. 24
      core/src/OC/appswebroots.js
  12. 2
      core/src/OC/index.js
  13. 3
      core/src/globals.js
  14. 2
      lib/private/Template/JSConfigHelper.php

@ -152,7 +152,7 @@ OCA.Sharing.PublicApp = {
img.attr('src', $('#downloadURL').val());
imgcontainer.appendTo('#imgframe');
} else if (mimetype.substr(0, mimetype.indexOf('/')) === 'text' && window.btoa) {
if (oc_appswebroots['files_texteditor'] !== undefined) {
if (OC.appswebroots['files_texteditor'] !== undefined) {
// the text editor handles the previewing
return;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -24,7 +24,6 @@ Object.assign(window.OC, {
*/
_capabilities: window.oc_capabilities || null,
appswebroots:(typeof oc_appswebroots !== 'undefined') ? oc_appswebroots:false,
/**
* Currently logged in user or null if none
*

@ -878,7 +878,7 @@
expireDate = moment(share.expiration, 'YYYY-MM-DD').format('DD-MM-YYYY');
}
var isTalkEnabled = oc_appswebroots['spreed'] !== undefined;
var isTalkEnabled = OC.appswebroots['spreed'] !== undefined;
var sendPasswordByTalk = share.sendPasswordByTalk;
var hideDownload = share.hideDownload;

@ -164,7 +164,7 @@
isFileSharedByMail: shareType === OC.Share.SHARE_TYPE_EMAIL && !this.model.isFolder(),
isPasswordSet: hasPassword && !sendPasswordByTalk,
isPasswordByTalkSet: hasPassword && sendPasswordByTalk,
isTalkEnabled: oc_appswebroots['spreed'] !== undefined,
isTalkEnabled: OC.appswebroots['spreed'] !== undefined,
secureDropMode: !this.model.hasReadPermission(shareIndex),
hasExpireDate: this.model.getExpireDate(shareIndex) !== null,
shareNote: shareNote,

@ -88,7 +88,7 @@ window.firstDay = 0;
window.oc_debug = true;
// FIXME: OC.webroot is supposed to be only the path!!!
OC.webroot = location.href + '/';
window.oc_appswebroots = {
OC.appswebroots = {
"files": window.webroot + '/apps/files/',
"files_sharing": window.webroot + '/apps/files_sharing/'
};

@ -243,7 +243,7 @@ describe('OC.Share.ShareDialogLinkShareView', function () {
configModel.isShareWithLinkAllowed.returns(true);
// "Enable" Talk
window.oc_appswebroots['spreed'] = OC.getRootPath() + '/apps/files/';
OC.appswebroots['spreed'] = OC.getRootPath() + '/apps/files/';
shareModel.set({
linkShares: [{
@ -284,7 +284,7 @@ describe('OC.Share.ShareDialogLinkShareView', function () {
it('is not shown if there is a password set but Talk is not enabled', function() {
// "Disable" Talk
delete window.oc_appswebroots['spreed'];
delete OC.appswebroots['spreed'];
view.render();

@ -0,0 +1,24 @@
/*
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const appswebroots = (window._oc_appswebroots !== undefined) ? window._oc_appswebroots : false
export default appswebroots

@ -21,6 +21,7 @@
import Apps from './apps'
import {AppConfig, appConfig} from './appconfig'
import appswebroots from './appswebroots'
import Backbone from './backbone'
import Config from './config'
import ContactsMenu from './contactsmenu'
@ -53,6 +54,7 @@ export default {
Apps,
AppConfig,
appConfig,
appswebroots,
Backbone,
ContactsMenu,
config: Config,

@ -19,6 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import appswebroots from "./OC/appswebroots";
/**
*
* @param {Function} func the library to deprecate
@ -107,6 +109,7 @@ window['md5'] = md5
window['moment'] = moment
window['OC'] = OC
setDeprecatedProp('oc_appswebroots', OC.appswebroots, 'use OC.appswebroots instead')
setDeprecatedProp('oc_config', OC.config, 'use OC.config instead')
setDeprecatedProp('oc_debug', OC.debug, 'use OC.debug instead')
setDeprecatedProp('oc_isadmin', OC.isUserAdmin(), 'use OC.isUserAdmin() instead')

@ -171,7 +171,7 @@ class JSConfigHelper {
"backendAllowsPasswordConfirmation" => $userBackendAllowsPasswordConfirmation ? 'true' : 'false',
"oc_dataURL" => is_string($dataLocation) ? "\"".$dataLocation."\"" : 'false',
"_oc_webroot" => "\"".\OC::$WEBROOT."\"",
"oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution
"_oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution
"datepickerFormatDate" => json_encode($this->l->l('jsdate', null)),
'nc_lastLogin' => $lastConfirmTimestamp,
'nc_pageLoad' => time(),

Loading…
Cancel
Save