Migrate settings to use a sandboxed iframe

This commit is contained in:
yflory
2017-11-09 14:23:40 +01:00
parent c1ba08cfc6
commit 101482b8cc
24 changed files with 2066 additions and 672 deletions

View File

@@ -15,6 +15,7 @@ define([
'/common/common-file.js',
'/file/file-crypto.js',
'/common/common-realtime.js',
'/common/common-language.js',
'/common/clipboard.js',
'/common/pinpad.js',
@@ -23,7 +24,7 @@ define([
'/bower_components/nthen/index.js',
'/bower_components/localforage/dist/localforage.min.js',
], function ($, Config, Messages, Store, Util, Hash, UI, History, UserList, Title, Metadata,
Messaging, CodeMirror, Files, FileCrypto, Realtime, Clipboard,
Messaging, CodeMirror, Files, FileCrypto, Realtime, Language, Clipboard,
Pinpad, AppConfig, MediaTag, Nthen, localForage) {
// Configure MediaTags to use our local viewer
@@ -188,6 +189,9 @@ define([
common.getLanguage = function () {
return Messages._languageUsed;
};
common.setLanguage = function (l, cb) {
Language.setLanguage(l, null, cb);
};
common.getUserlist = function () {
if (store) {
if (store.getProxy() && store.getProxy().info) {
@@ -225,7 +229,12 @@ define([
common.isFeedbackAllowed = function () {
try {
if (!getStore().getProxy().proxy.allowUserFeedback) { return false; }
var entry = common.find(getProxy(), [
'settings',
'general',
'allowUserFeedback'
]);
if (!entry) { return false; }
return true;
} catch (e) {
console.error(e);
@@ -499,7 +508,7 @@ define([
if (getProxy()) {
getProxy()[common.displayNameKey] = value;
}
if (typeof cb === "function") { cb(); }
if (typeof cb === "function") { whenRealtimeSyncs(getRealtime(), cb); }
};
common.setAttribute = function (attr, value, cb) {
getStore().setAttribute(attr, value, function (err, data) {
@@ -527,6 +536,9 @@ define([
common.getThumbnail = function (key, cb) {
localForage.getItem(key, cb);
};
common.clearThumbnail = function (cb) {
localForage.clear(cb);
};
/* this returns a reference to your proxy. changing it will change your drive.
*/
@@ -1901,7 +1913,7 @@ define([
$block.appendTo($container);
}
Messages._initSelector($block);
Language.initSelector($block);
return $block;
};
@@ -2315,7 +2327,7 @@ define([
// MAGIC that happens implicitly
$(function () {
Messages._applyTranslation();
Language.applyTranslation();
});
return common;