Merge branch 'disableApps' into staging
This commit is contained in:
commit
47fa7f29c9
@ -6,10 +6,19 @@
|
|||||||
define(function() {
|
define(function() {
|
||||||
var config = {};
|
var config = {};
|
||||||
|
|
||||||
/* Select the buttons displayed on the main page to create new collaborative sessions
|
/* Select the buttons displayed on the main page to create new collaborative sessions.
|
||||||
* Existing types : pad, code, poll, slide
|
* Removing apps from the list will prevent users from accessing them. They will instead be
|
||||||
|
* redirected to the drive.
|
||||||
|
* You should never remove the drive from this list.
|
||||||
*/
|
*/
|
||||||
config.availablePadTypes = ['drive', 'pad', 'code', 'slide', 'poll', 'kanban', 'whiteboard', 'file', 'todo', 'contacts'];
|
config.availablePadTypes = ['drive', 'pad', 'code', 'slide', 'poll', 'kanban', 'whiteboard', 'file', 'todo', 'contacts'];
|
||||||
|
/* The registered only types are apps restricted to registered users.
|
||||||
|
* You should never remove apps from this list unless you know what you're doing. The apps
|
||||||
|
* listed here by default can't work without a user account.
|
||||||
|
* You can however add apps to this list. The new apps won't be visible for unregistered
|
||||||
|
* users and these users will be redirected to the login page if they still try to access
|
||||||
|
* the app
|
||||||
|
*/
|
||||||
config.registeredOnlyTypes = ['file', 'contacts'];
|
config.registeredOnlyTypes = ['file', 'contacts'];
|
||||||
|
|
||||||
/* Cryptpad apps use a common API to display notifications to users
|
/* Cryptpad apps use a common API to display notifications to users
|
||||||
|
|||||||
@ -15,6 +15,8 @@ define(function () {
|
|||||||
displayPadCreationScreen: 'displayPadCreationScreen',
|
displayPadCreationScreen: 'displayPadCreationScreen',
|
||||||
deprecatedKey: 'deprecated',
|
deprecatedKey: 'deprecated',
|
||||||
// Sub
|
// Sub
|
||||||
plan: 'CryptPad_plan'
|
plan: 'CryptPad_plan',
|
||||||
|
// Apps
|
||||||
|
criticalApps: ['profile', 'settings', 'debug']
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -95,6 +95,7 @@ define([
|
|||||||
Cryptpad.loading.onDriveEvent.reg(function (data) {
|
Cryptpad.loading.onDriveEvent.reg(function (data) {
|
||||||
if (sframeChan) { sframeChan.event('EV_LOADING_INFO', data); }
|
if (sframeChan) { sframeChan.event('EV_LOADING_INFO', data); }
|
||||||
});
|
});
|
||||||
|
|
||||||
Cryptpad.ready(waitFor(function () {
|
Cryptpad.ready(waitFor(function () {
|
||||||
if (sframeChan) {
|
if (sframeChan) {
|
||||||
sframeChan.event('EV_LOADING_INFO', {
|
sframeChan.event('EV_LOADING_INFO', {
|
||||||
@ -279,6 +280,15 @@ define([
|
|||||||
if (window.CryptPad_newSharedFolder) {
|
if (window.CryptPad_newSharedFolder) {
|
||||||
additionalPriv.newSharedFolder = window.CryptPad_newSharedFolder;
|
additionalPriv.newSharedFolder = window.CryptPad_newSharedFolder;
|
||||||
}
|
}
|
||||||
|
if (Utils.Constants.criticalApps.indexOf(parsed.type) === -1 &&
|
||||||
|
AppConfig.availablePadTypes.indexOf(parsed.type) === -1) {
|
||||||
|
additionalPriv.disabledApp = true;
|
||||||
|
}
|
||||||
|
if (!Utils.LocalStore.isLoggedIn() &&
|
||||||
|
AppConfig.registeredOnlyTypes.indexOf(parsed.type) !== -1) {
|
||||||
|
additionalPriv.registeredOnly = true;
|
||||||
|
}
|
||||||
|
|
||||||
for (var k in additionalPriv) { metaObj.priv[k] = additionalPriv[k]; }
|
for (var k in additionalPriv) { metaObj.priv[k] = additionalPriv[k]; }
|
||||||
|
|
||||||
if (cfg.addData) {
|
if (cfg.addData) {
|
||||||
|
|||||||
@ -555,6 +555,27 @@ define([
|
|||||||
Feedback.init(feedback);
|
Feedback.init(feedback);
|
||||||
} catch (e) { Feedback.init(false); }
|
} catch (e) { Feedback.init(false); }
|
||||||
|
|
||||||
|
try {
|
||||||
|
var forbidden = ctx.metadataMgr.getPrivateData().disabledApp;
|
||||||
|
if (forbidden) {
|
||||||
|
UI.alert(Messages.disabledApp, function () {
|
||||||
|
funcs.gotoURL('/drive/');
|
||||||
|
}, {forefront: true});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var mustLogin = ctx.metadataMgr.getPrivateData().registeredOnly;
|
||||||
|
if (mustLogin) {
|
||||||
|
UI.alert(Messages.mustLogin, function () {
|
||||||
|
funcs.setLoginRedirect(function () {
|
||||||
|
funcs.gotoURL('/login/');
|
||||||
|
});
|
||||||
|
}, {forefront: true});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Can't check permissions for the app");
|
||||||
|
}
|
||||||
|
|
||||||
ctx.sframeChan.on('EV_LOADING_ERROR', function (err) {
|
ctx.sframeChan.on('EV_LOADING_ERROR', function (err) {
|
||||||
if (err === 'DELETED') {
|
if (err === 'DELETED') {
|
||||||
var msg = Messages.deletedError + '<br>' + Messages.errorRedirectToHome;
|
var msg = Messages.deletedError + '<br>' + Messages.errorRedirectToHome;
|
||||||
|
|||||||
@ -55,6 +55,9 @@ define(function () {
|
|||||||
out.deleted = "Pad deleted from your CryptDrive";
|
out.deleted = "Pad deleted from your CryptDrive";
|
||||||
out.deletedFromServer = "Pad deleted from the server";
|
out.deletedFromServer = "Pad deleted from the server";
|
||||||
|
|
||||||
|
out.mustLogin = "You must be logged in to access this page";
|
||||||
|
out.disabledApp = "This application has been disabled. Contact the administrator of this CryptPad to have more information.";
|
||||||
|
|
||||||
out.realtime_unrecoverableError = "An unrecoverable error has occured. Click OK to reload.";
|
out.realtime_unrecoverableError = "An unrecoverable error has occured. Click OK to reload.";
|
||||||
|
|
||||||
out.disconnected = 'Disconnected';
|
out.disconnected = 'Disconnected';
|
||||||
@ -374,6 +377,7 @@ define(function () {
|
|||||||
out.contacts_typeHere = "Type a message here...";
|
out.contacts_typeHere = "Type a message here...";
|
||||||
out.contacts_warning = "Everything you type here is persistent and available to all the existing and future users of this pad. Be careful with sensitive information!";
|
out.contacts_warning = "Everything you type here is persistent and available to all the existing and future users of this pad. Be careful with sensitive information!";
|
||||||
out.contacts_padTitle = "Chat";
|
out.contacts_padTitle = "Chat";
|
||||||
|
out.contacts_mustLogin = "You must be logged in to add contacts";
|
||||||
|
|
||||||
out.contacts_info1 = "These are your contacts. From here, you can:";
|
out.contacts_info1 = "These are your contacts. From here, you can:";
|
||||||
out.contacts_info2 = "Click your contact's icon to chat with them";
|
out.contacts_info2 = "Click your contact's icon to chat with them";
|
||||||
|
|||||||
@ -54,6 +54,16 @@ define([
|
|||||||
APP.toolbar = Toolbar.create(configTb);
|
APP.toolbar = Toolbar.create(configTb);
|
||||||
APP.toolbar.$rightside.hide();
|
APP.toolbar.$rightside.hide();
|
||||||
|
|
||||||
|
// we're in upload mode
|
||||||
|
if (!common.isLoggedIn()) {
|
||||||
|
UI.removeLoadingScreen();
|
||||||
|
return UI.alert(Messages.contacts_mustLogin, function () {
|
||||||
|
common.setLoginRedirect(function () {
|
||||||
|
common.gotoURL('/login/');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
MessengerUI.create($(appElement), common);
|
MessengerUI.create($(appElement), common);
|
||||||
|
|
||||||
UI.removeLoadingScreen();
|
UI.removeLoadingScreen();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user