diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 99e7abb5584143f0148ebd44b371e26e90f2af8b..d546186aff9f116d42f55b8ff122085766e52435 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1141,7 +1141,7 @@ } title += this.appName; // Sets the page title with the " - Nextcloud" suffix as in templates - window.document.title = title + ' - ' + oc_defaults.title; + window.document.title = title + ' - ' + OC.theme.title; return true; }, diff --git a/apps/oauth2/js/oauth2.js b/apps/oauth2/js/oauth2.js index c963e8e044786ad82414c01743aee28a1cf4ece9..c66c97fd7e08420fe139c1a1c8118638c0d49e4d 100644 Binary files a/apps/oauth2/js/oauth2.js and b/apps/oauth2/js/oauth2.js differ diff --git a/apps/oauth2/js/oauth2.js.map b/apps/oauth2/js/oauth2.js.map index 0f5ef5a7618368d37d68504ad87d28e92ba75832..68f55b219388f3ff78b90168ac7691f98dbbf63e 100644 Binary files a/apps/oauth2/js/oauth2.js.map and b/apps/oauth2/js/oauth2.js.map differ diff --git a/apps/oauth2/src/App.vue b/apps/oauth2/src/App.vue index 036af6ca25fd5e186f676123b025eb65c6afe9dd..58ea4b819a68cf5af7279b3a60d5459f62556030 100644 --- a/apps/oauth2/src/App.vue +++ b/apps/oauth2/src/App.vue @@ -22,7 +22,7 @@ <template> <div id="oauth2" class="section"> <h2>{{ t('oauth2', 'OAuth 2.0 clients') }}</h2> - <p class="settings-hint">{{ t('oauth2', 'OAuth 2.0 allows external services to request access to {instanceName}.', { instanceName: oc_defaults.name}) }}</p> + <p class="settings-hint">{{ t('oauth2', 'OAuth 2.0 allows external services to request access to {instanceName}.', { instanceName: OC.theme.name}) }}</p> <table class="grid" v-if="clients.length > 0"> <thead> <tr> diff --git a/apps/oauth2/src/main.js b/apps/oauth2/src/main.js index ff68f48593d96537a1c9816273acc3eb4f73932b..b200347d901b0d7f383987549c063e6774b1969f 100644 --- a/apps/oauth2/src/main.js +++ b/apps/oauth2/src/main.js @@ -24,7 +24,6 @@ import Vue from 'vue'; import App from './App.vue'; Vue.prototype.t = t; -Vue.prototype.oc_defaults = oc_defaults; Vue.prototype.OC = OC; const app = new Vue({ diff --git a/core/js/dist/login.js b/core/js/dist/login.js index 6b1557e1c0404f28fc23f7e944f30d5cd5f7b95c..4a1b9de83664c3d8accc594eb1f05910669f3eca 100644 Binary files a/core/js/dist/login.js and b/core/js/dist/login.js differ diff --git a/core/js/dist/login.js.map b/core/js/dist/login.js.map index 5a847320c199306218e525bb7ade28d21af9b246..072b4cce99e91ea118325c3111fcc784bdbe0196 100644 Binary files a/core/js/dist/login.js.map and b/core/js/dist/login.js.map differ diff --git a/core/js/dist/main.js b/core/js/dist/main.js index 8cbca33a554a33fe5aaff92194d21f4ddf2f8a98..f8d2b5c7ace935585b3a812cb655805bcf606777 100644 Binary files a/core/js/dist/main.js and b/core/js/dist/main.js differ diff --git a/core/js/dist/main.js.map b/core/js/dist/main.js.map index 667f92933b0d069178b8445dac9a964768068551..3cae82bd5a3e5542db203fb4ad32f37a6e4fd405 100644 Binary files a/core/js/dist/main.js.map and b/core/js/dist/main.js.map differ diff --git a/core/js/js.js b/core/js/js.js index 7896fdf43772c82318caf5d3ad72a7f197156cd8..4301298645e9e472533f132b180bf70fa40865d9 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -7,8 +7,6 @@ var OCP = Object.assign({}, window.OCP); Object.assign(window.OC, { /* jshint camelcase: false */ - theme: window.oc_defaults || {}, - /** * Parses a URL query string into a JS map * @param {string} queryString query string in the format param1=1234¶m2=abcde¶m3=xyz diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index 2e4901a10c5d9815d3a948aa6cee37d4a6316a8c..487d833db0aa60087cc1d3104e42164cf5c8a324 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -50,7 +50,7 @@ * Check whether the .well-known URLs works. * * @param url the URL to test - * @param placeholderUrl the placeholder URL - can be found at oc_defaults.docPlaceholderUrl + * @param placeholderUrl the placeholder URL - can be found at OC.theme.docPlaceholderUrl * @param {boolean} runCheck if this is set to false the check is skipped and no error is returned * @param {int|int[]} expectedStatus the expected HTTP status to be returned by the URL, 207 by default * @return $.Deferred object resolved with an array of error messages @@ -96,7 +96,7 @@ * Check whether the .well-known URLs works. * * @param url the URL to test - * @param placeholderUrl the placeholder URL - can be found at oc_defaults.docPlaceholderUrl + * @param placeholderUrl the placeholder URL - can be found at OC.theme.docPlaceholderUrl * @param {boolean} runCheck if this is set to false the check is skipped and no error is returned * * @return $.Deferred object resolved with an array of error messages @@ -135,7 +135,7 @@ * Check whether the WOFF2 URLs works. * * @param url the URL to test - * @param placeholderUrl the placeholder URL - can be found at oc_defaults.docPlaceholderUrl + * @param placeholderUrl the placeholder URL - can be found at OC.theme.docPlaceholderUrl * @return $.Deferred object resolved with an array of error messages */ checkWOFF2Loading: function(url, placeholderUrl) { @@ -179,7 +179,7 @@ 'core', 'Please check the <a target="_blank" rel="noreferrer noopener" href="{docLink}">installation documentation ↗</a> for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm.', { - docLink: oc_defaults.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-php-fpm') + docLink: OC.theme.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-php-fpm') } ), type: OC.SetupChecks.MESSAGE_TYPE_WARNING @@ -205,7 +205,7 @@ } if(!data.hasWorkingFileLocking) { messages.push({ - msg: t('core', 'Transactional file locking is disabled, this might lead to issues with race conditions. Enable "filelocking.enabled" in config.php to avoid these problems. See the <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation ↗</a> for more information.', {docLink: oc_defaults.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-transactional-locking')}), + msg: t('core', 'Transactional file locking is disabled, this might lead to issues with race conditions. Enable "filelocking.enabled" in config.php to avoid these problems. See the <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation ↗</a> for more information.', {docLink: OC.theme.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-transactional-locking')}), type: OC.SetupChecks.MESSAGE_TYPE_WARNING }); } @@ -379,7 +379,7 @@ 'core', 'Some columns in the database are missing a conversion to big int. Due to the fact that changing column types on big tables could take some time they were not changed automatically. By running \'occ db:convert-filecache-bigint\' those pending changes could be applied manually. This operation needs to be made while the instance is offline. For further details read <a target="_blank" rel="noreferrer noopener" href="{docLink}">the documentation page about this</a>.', { - docLink: oc_defaults.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-bigint-conversion'), + docLink: OC.theme.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-bigint-conversion'), } ) + "<ul>" + listOfPendingBigIntConversionColumns + "</ul>", type: OC.SetupChecks.MESSAGE_TYPE_INFO @@ -444,7 +444,7 @@ 'core', 'MySQL is used as database but does not support 4-byte characters. To be able to handle 4-byte characters (like emojis) without issues in filenames or comments for example it is recommended to enable the 4-byte support in MySQL. For further details read <a target="_blank" rel="noreferrer noopener" href="{docLink}">the documentation page about this</a>.', { - docLink: oc_defaults.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-mysql-utf8mb4'), + docLink: OC.theme.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-mysql-utf8mb4'), } ), type: OC.SetupChecks.MESSAGE_TYPE_WARNING @@ -612,7 +612,7 @@ var messages = []; if (xhr.status === 200) { - var tipsUrl = oc_defaults.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-security'); + var tipsUrl = OC.theme.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-security'); if(OC.getProtocol() === 'https') { // Extract the value of 'Strict-Transport-Security' var transportSecurityValidity = xhr.getResponseHeader('Strict-Transport-Security'); diff --git a/core/js/tests/specHelper.js b/core/js/tests/specHelper.js index caf96854e524bcce9911d43348df97879dab12d9..72d42dfc58ac1b60d3fc5d6ff8ce0e1f42373210 100644 --- a/core/js/tests/specHelper.js +++ b/core/js/tests/specHelper.js @@ -100,7 +100,7 @@ OC.config = { OC.appConfig = { core: {} }; -window.oc_defaults = { +OC.theme = { docPlaceholderUrl: 'https://docs.example.org/PLACEHOLDER' }; window.oc_capabilities = { diff --git a/core/src/OC/index.js b/core/src/OC/index.js index 6ba517028a244bc5ada8304e208573fef95321bc..ea217edaf8834bcfa7c08cdf7b7ae7ae4c4a1002 100644 --- a/core/src/OC/index.js +++ b/core/src/OC/index.js @@ -88,6 +88,7 @@ import Notification from './notification' import PasswordConfirmation from './password-confirmation' import Plugins from './plugins' import search from './search' +import {theme} from './theme' import Util from './util' import {debug} from './debug' import {redirect, reload} from './navigation' @@ -202,6 +203,7 @@ export default { PasswordConfirmation, Plugins, search, + theme, Util, debug, filePath, diff --git a/core/src/OC/theme.js b/core/src/OC/theme.js new file mode 100644 index 0000000000000000000000000000000000000000..8e49499f485ed5ca1cc178221c29f27c3f28776d --- /dev/null +++ b/core/src/OC/theme.js @@ -0,0 +1,22 @@ +/* + * @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/>. + */ + +export const theme = window._theme || {} diff --git a/core/src/globals.js b/core/src/globals.js index 2ec37c480cdf1582d472e55f96855d8748528118..e644af842486e4145e72870913c6d8e6f5e5fee8 100644 --- a/core/src/globals.js +++ b/core/src/globals.js @@ -123,6 +123,7 @@ setDeprecatedProp('oc_capabilities', OC.getCapabilities, 'use OC.getCapabilities setDeprecatedProp('oc_config', () => OC.config, 'use OC.config instead') setDeprecatedProp('oc_current_user', () => OC.getCurrentUser().uid, 'use OC.getCurrentUser().uid instead') setDeprecatedProp('oc_debug', () => OC.debug, 'use OC.debug instead') +setDeprecatedProp('oc_defaults', () => OC.theme, 'use OC.theme instead') setDeprecatedProp('oc_isadmin', OC.isUserAdmin, 'use OC.isUserAdmin() instead') setDeprecatedProp('oc_requesttoken', () => getRequestToken(), 'use OC.requestToken instead') setDeprecatedProp('oc_webroot', () => OC.webroot, 'use OC.getRootPath() instead') diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index 2f959ea113a084a581ade7cb8ec18ddb34794296..15e2fd76c488f2afd94be03084eca507f6831a6d 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -257,7 +257,7 @@ class JSConfigHelper { 'allowGroupSharing' => \OC::$server->getShareManager()->allowGroupSharing() ] ]), - "oc_defaults" => json_encode([ + "_theme" => json_encode([ 'entity' => $this->defaults->getEntity(), 'name' => $this->defaults->getName(), 'title' => $this->defaults->getTitle(), diff --git a/settings/js/admin.js b/settings/js/admin.js index ac95e4013461f5bd193c43e1bf525057e8268acf..6074a3ae2c975aafedcd36b4d4a7ac5b0c1d3639 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -248,14 +248,14 @@ $(document).ready(function(){ // run setup checks then gather error messages $.when( OC.SetupChecks.checkWebDAV(), - OC.SetupChecks.checkWellKnownUrl('/.well-known/webfinger', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true && !!OC.appConfig.core.public_webfinger, [200, 501]), - OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true), - OC.SetupChecks.checkWellKnownUrl('/.well-known/carddav', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true), - OC.SetupChecks.checkProviderUrl(OC.getRootPath() + '/ocm-provider/', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true), - OC.SetupChecks.checkProviderUrl(OC.getRootPath() + '/ocs-provider/', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true), + OC.SetupChecks.checkWellKnownUrl('/.well-known/webfinger', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true && !!OC.appConfig.core.public_webfinger, [200, 501]), + OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true), + OC.SetupChecks.checkWellKnownUrl('/.well-known/carddav', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true), + OC.SetupChecks.checkProviderUrl(OC.getRootPath() + '/ocm-provider/', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true), + OC.SetupChecks.checkProviderUrl(OC.getRootPath() + '/ocs-provider/', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true), OC.SetupChecks.checkSetup(), OC.SetupChecks.checkGeneric(), - OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/Nunito-Regular.woff2'), oc_defaults.docPlaceholderUrl), + OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/Nunito-Regular.woff2'), OC.theme.docPlaceholderUrl), OC.SetupChecks.checkDataProtected() ).then(function (check1, check2, check3, check4, check5, check6, check7, check8, check9, check10) { var messages = [].concat(check1, check2, check3, check4, check5, check6, check7, check8, check9, check10);