Move OC.appswebroots to the bundle and deprecate oc_appswebroots

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2019-05-07 09:03:14 +02:00
parent 22f3306fd0
commit acf0ca1541
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
14 changed files with 79 additions and 31 deletions

View File

@ -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;
}

60
core/js/dist/main.js vendored

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

View File

@ -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
*

View File

@ -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;

View File

@ -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,

View File

@ -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/'
};

View File

@ -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();

View File

@ -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

View File

@ -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,

View File

@ -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')

View File

@ -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(),