Add a dev mode to facilitate debugging

pull/1/head
yflory 6 years ago
parent 07cd0b21b6
commit 4abed38bb1

@ -49,6 +49,11 @@ define([
var CHECKPOINT_INTERVAL = 50;
var debug = function (x) {
if (!window.CP_DEV_MODE) { return; }
console.log(x);
};
var stringify = function (obj) {
return JSONSortify(obj);
};
@ -203,7 +208,7 @@ define([
cpIndex: 0
};
var getContent = APP.getContent = function () {
var getContent = function () {
try {
return window.frames[0].editor.asc_nativeGetFile();
} catch (e) {
@ -560,10 +565,12 @@ define([
APP.chan = chan;
var send = ooChannel.send = function (obj) {
debug(obj);
chan.event('CMD', obj);
};
chan.on('CMD', function (obj) {
debug(obj);
switch (obj.type) {
case "auth":
handleAuth(obj, send);

@ -302,6 +302,7 @@ define([
password: password,
channel: secret.channel,
enableSF: localStorage.CryptPad_SF === "1", // TODO to remove when enabled by default
devMode: localStorage.CryptPad_dev === "1",
};
if (window.CryptPad_newSharedFolder) {
additionalPriv.newSharedFolder = window.CryptPad_newSharedFolder;

@ -587,6 +587,10 @@ define([
console.error("Can't check permissions for the app");
}
try {
window.CP_DEV_MODE = ctx.metadataMgr.getPrivateData().devMode;
} catch (e) {}
ctx.sframeChan.on('EV_LOADING_ERROR', function (err) {
if (err === 'DELETED') {
var msg = Messages.deletedError + '<br>' + Messages.errorRedirectToHome;

Loading…
Cancel
Save