mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
Move OC.theme to the bundle and deprecate oc_defaults (#15525)
Move OC.theme to the bundle and deprecate oc_defaults
This commit is contained in:
commit
f08aed74d7
17 changed files with 101 additions and 39 deletions
|
|
@ -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;
|
||||
},
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
30
core/js/dist/login.js
vendored
30
core/js/dist/login.js
vendored
File diff suppressed because one or more lines are too long
2
core/js/dist/login.js.map
vendored
2
core/js/dist/login.js.map
vendored
File diff suppressed because one or more lines are too long
32
core/js/dist/main.js
vendored
32
core/js/dist/main.js
vendored
File diff suppressed because one or more lines are too long
2
core/js/dist/main.js.map
vendored
2
core/js/dist/main.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ OC.config = {
|
|||
OC.appConfig = {
|
||||
core: {}
|
||||
};
|
||||
window.oc_defaults = {
|
||||
OC.theme = {
|
||||
docPlaceholderUrl: 'https://docs.example.org/PLACEHOLDER'
|
||||
};
|
||||
window.oc_capabilities = {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
22
core/src/OC/theme.js
Normal file
22
core/src/OC/theme.js
Normal file
|
|
@ -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 || {}
|
||||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue