appconfig

This commit is contained in:
zuzanna-maria 2024-05-07 18:29:13 +01:00
parent 4f9a7031d6
commit 9231bb7ab8
8 changed files with 23 additions and 18 deletions

View File

@ -9,12 +9,19 @@
* If you want to check all the configurable values, you can open the internal configuration file
but you should not change it directly (/common/application_config_internal.js)
*/
define(['/common/application_config_internal.js'], function (AppConfig) {
define([
'/common/application_config_internal.js',
'/api/config'
], function (AppConfig, ApiConfig ) {
// const Path = require("path");
// Example: If you want to remove the survey link in the menu:
// AppConfig.surveyURL = "";
// To inform users of the support ticket panel which languages your admins speak:
//AppConfig.supportLanguages = [ 'en', 'fr' ];
AppConfig.availablePadTypes = ['drive', 'teams', 'file', 'contacts', 'convert'].concat(ApiConfig.availableApps)
return AppConfig;
});

View File

@ -468,7 +468,7 @@ var setLastEviction = function (Env, Server, cb, data, unsafeKey) {
var instanceStatus = function (Env, Server, cb) {
cb(void 0, {
disabledApps: Env.disabledApps,
availableApps: Env.availableApps,
restrictRegistration: Env.restrictRegistration,
restrictSsoRegistration: Env.restrictSsoRegistration,
dontStoreSSOUsers: Env.dontStoreSSOUsers,

View File

@ -226,13 +226,13 @@ commands.SET_SUPPORT_MAILBOX = makeGenericSetter('supportMailbox', function (arg
commands.DISABLE_APPS = function (Env, args) {
const appsToDisable = args;
const availableApps = args;
// let validated = typeof(curvePublic) === "string" &&
// (Core.isValidPublicKey(curvePublic) || !curvePublic) &&
// typeof(edPublic) === "string" &&
// (Core.isValidPublicKey(edPublic) || !edPublic);
// if (!validated) { throw new Error('INVALID_ARGS'); }
Env.disabledApps = appsToDisable;
Env.availableApps = availableApps;
return true;
};

View File

@ -583,7 +583,7 @@ var serveConfig = makeRouteCache(function () {
maxUploadSize: Env.maxUploadSize,
premiumUploadSize: Env.premiumUploadSize,
restrictRegistration: Env.restrictRegistration,
disabledApps: Env.disabledApps,
availableApps: Env.availableApps,
restrictSsoRegistration: Env.restrictSsoRegistration,
httpSafeOrigin: Env.httpSafeOrigin,
enableEmbedding: Env.enableEmbedding,

View File

@ -50,7 +50,7 @@ Stats.instanceData = function (Env) {
data.restrictRegistration = Boolean(Env.restrictRegistration);
//which apps have you disabled?
data.disabledApps = Env.disabledApps
data.availableApps = Env.availableApps
// have you removed the donate button?
data.removeDonateButton = Boolean(Env.removeDonateButton);
@ -85,7 +85,6 @@ Stats.instanceData = function (Env) {
// check how many instances provide stats before we put more work into it
data.providesAggregateStatistics = true;
}
return data;
};

View File

@ -631,22 +631,22 @@ define([
const grid = blocks.block([], 'cp-admin-customize-apps-grid');
const availableApps = ['pad', 'code', 'kanban', 'slide', 'sheet', 'form', 'whiteboard', 'diagram'];
const activeApps = []
const allApps = ['pad', 'code', 'kanban', 'slide', 'sheet', 'form', 'whiteboard', 'diagram'];
const availableApps = []
function select(app) {
if (activeApps.indexOf(app) === -1) {
activeApps.push(app);
if (availableApps.indexOf(app) === -1) {
availableApps.push(app);
$(`#${app}-block`).attr('class', 'active-app')
} else {
activeApps.splice(activeApps.indexOf(app), 1)
availableApps.splice(availableApps.indexOf(app), 1)
$(`#${app}-block`).attr('class', 'inactive-app')
}
}
availableApps.forEach(app => {
allApps.forEach(app => {
let appBlock = h('div', {class: 'inactive-app', id: `${app}-block`}, app)
$(appBlock).addClass('cp-app-drive-element-grid')
$(grid).append(appBlock);
@ -656,10 +656,9 @@ define([
Messages.admin_appSelection = 'App configuration saved'
var save = blocks.activeButton('primary', '', Messages.settings_save, function (done) {
const appsToDisable = availableApps.filter(x => !activeApps.includes(x)).concat(activeApps.filter(x => !availableApps.includes(x)));
sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE',
data: ['DISABLE_APPS', appsToDisable]
data: ['DISABLE_APPS', availableApps]
}, function (e, response) {
if (e || response.error) {
UI.warn(Messages.error);

View File

@ -14,7 +14,7 @@ define([
);
let availableTypes = AppConfig.availablePadTypes.filter(
(t) => ooEnabled || !OO_APPS.includes(t) && Env.disabledApps.indexOf(t) === -1,
(t) => ooEnabled || !OO_APPS.includes(t)
);
return {

View File

@ -2323,7 +2323,7 @@ Example
}, Messages.admin_diskUsageButton);
$(infoButton).click(() => {
console.log(key);
//console.log(key);
getAccountData(key, (err, data) => {
if (err) { return void console.error(err); }
console.log(data);