mirror of https://github.com/xwiki-labs/cryptpad
Use default language for missing plugin translation keys
This commit is contained in:
parent
30e16bf0e4
commit
04ff20cee1
|
@ -15,7 +15,7 @@ www/accounts
|
|||
www/worker
|
||||
www/todo
|
||||
|
||||
lib/plugins/
|
||||
#lib/plugins/
|
||||
|
||||
www/common/hyperscript.js
|
||||
|
||||
|
|
|
@ -22,11 +22,13 @@ define([
|
|||
'/common/outer/login-block.js',
|
||||
'/common/common-hash.js',
|
||||
'/common/outer/http-command.js',
|
||||
'/api/config',
|
||||
|
||||
'/components/tweetnacl/nacl-fast.min.js',
|
||||
'/components/scrypt-async/scrypt-async.min.js', // better load speed
|
||||
], function ($, Listmap, Crypto, Util, NetConfig, Login, Cred, ChainPad, Realtime, Constants, UI,
|
||||
Feedback, h, LocalStore, Messages, nThen, Block, Hash, ServerCommand) {
|
||||
Feedback, h, LocalStore, Messages, nThen, Block, Hash, ServerCommand,
|
||||
ApiConfig) {
|
||||
var Exports = {
|
||||
Cred: Cred,
|
||||
Block: Block,
|
||||
|
@ -218,6 +220,11 @@ define([
|
|||
proxy.edPublic = result.edPublic;
|
||||
}
|
||||
|
||||
if (ApiConfig && Array.isArray(ApiConfig.adminKeys) &&
|
||||
ApiConfig.adminKeys.includes(proxy.edPublic)) {
|
||||
localStorage.CP_admin = "1";
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
Realtime.whenRealtimeSyncs(result.realtime, function () {
|
||||
proceed(result);
|
||||
|
|
|
@ -168,6 +168,7 @@ define([
|
|||
let popup = h('div.cp-extensions-popups');
|
||||
let utils = { h, Util, Hash };
|
||||
Extensions.getExtensions('HOMEPAGE_POPUP').forEach(ext => {
|
||||
if (typeof(ext.check) === "function" && !ext.check()) { return; }
|
||||
ext.getContent(utils, content => {
|
||||
$(popup).append(h('div.cp-extensions-popup', content));
|
||||
});
|
||||
|
|
|
@ -652,7 +652,7 @@ define(paths, function () {
|
|||
return args;
|
||||
}, function () {
|
||||
// ignore missing files
|
||||
});`
|
||||
});`;
|
||||
app.get('/extensions.js', (req, res) => {
|
||||
res.setHeader('Content-Type', 'text/javascript');
|
||||
res.send(js);
|
||||
|
@ -752,7 +752,7 @@ app.post('/api/auth', function (req, res, next) {
|
|||
});
|
||||
|
||||
app.use(function (req, res /*, next */) {
|
||||
if (/^(\/favicon\.ico\/|.*\.js\.map|.*\/translations\/.*\.json)$/.test(req.url)) {
|
||||
if (/^(\/favicon\.ico\/|.*\.js\.map|.*\/translations\/.*\.json)/.test(req.url)) {
|
||||
// ignore common 404s
|
||||
} else {
|
||||
Log.info('HTTP_404', req.url);
|
||||
|
|
|
@ -2822,6 +2822,15 @@ define([
|
|||
initFeedback(data.feedback);
|
||||
}
|
||||
|
||||
if (data.edPublic) {
|
||||
if (Array.isArray(Config.adminKeys) &&
|
||||
Config.adminKeys.includes(data.edPublic)) {
|
||||
// Doesn't provides extra-rights but may show
|
||||
// additional warnings in the UI
|
||||
localStorage.CP_admin = "1";
|
||||
}
|
||||
}
|
||||
|
||||
if (data.loggedIn) {
|
||||
window.CP_logged_in = true;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,14 @@ define([
|
|||
let defaultLang = current[1];
|
||||
let lang = current[2];
|
||||
if (!Object.keys(lang).length && Object.keys(defaultLang).length) {
|
||||
// If our language doesn't exists, use default
|
||||
lang = defaultLang;
|
||||
} else if (Object.keys(defaultLang).length) {
|
||||
// Otherwise fill our language with missing keys
|
||||
Object.keys(defaultLang).forEach(key => {
|
||||
if (typeof(lang[key]) !== "undefined") { return; }
|
||||
lang[key] = defaultLang[key];
|
||||
});
|
||||
}
|
||||
|
||||
lang._getKey = function (key, argArray) {
|
||||
|
|
|
@ -3014,6 +3014,8 @@ define([
|
|||
// Make sure we have a valid user object before emitting cacheready
|
||||
if (rt.proxy && !rt.proxy.drive) { return; }
|
||||
|
||||
returned.edPublic = rt.proxy.edPublic;
|
||||
|
||||
onCacheReady(clientId, function () {
|
||||
if (typeof(cb) === "function") { cb(returned); }
|
||||
onCacheReadyEvt.fire();
|
||||
|
@ -3047,6 +3049,8 @@ define([
|
|||
drive[Constants.oldStorageKey] = [];
|
||||
}
|
||||
*/
|
||||
|
||||
returned.edPublic = rt.proxy.edPublic;
|
||||
// Drive already exist: return the existing drive, don't load data from legacy store
|
||||
if (store.manager) {
|
||||
// If a cache is loading, make sure it is complete before calling onReady
|
||||
|
|
|
@ -145,6 +145,7 @@ define([
|
|||
edPublic: proxy.edPublic
|
||||
}, function (e) {
|
||||
if (e) { UI.alert(Messages.error); return console.error(e); }
|
||||
localStorage.CP_admin = "1";
|
||||
window.location.href = '/drive/';
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue