diff --git a/customize.dist/loading.js b/customize.dist/loading.js index 1db0b64ed..29e5ac92b 100644 --- a/customize.dist/loading.js +++ b/customize.dist/loading.js @@ -324,25 +324,36 @@ button.primary:hover{ return bar; }; + var hasErrored = false; var updateLoadingProgress = function (data) { - if (!built) { return; } + if (!built || !data) { return; } var c = types.indexOf(data.type); if (c < current) { return console.error(data); } try { document.querySelector('.cp-loading-spinner-container').style.display = 'none'; document.querySelector('.cp-loading-progress-list').innerHTML = makeList(data); document.querySelector('.cp-loading-progress-container').innerHTML = makeBar(data); - } catch (e) { console.error(e); } + } catch (e) { + if (!hasErrored) { console.error(e); } + } }; window.CryptPad_updateLoadingProgress = updateLoadingProgress; + window.CryptPad_loadingError = function (err) { if (!built) { return; } + hasErrored = true; + var err2; + if (err === 'Script error.') { + err2 = Messages.error_unhelpfulScriptError; + } + try { var node = document.querySelector('.cp-loading-progress'); + if (!node) { return; } if (node.parentNode) { node.parentNode.removeChild(node); } document.querySelector('.cp-loading-spinner-container').setAttribute('style', 'display:none;'); document.querySelector('#cp-loading-message').setAttribute('style', 'display:block;'); - document.querySelector('#cp-loading-message').innerText = err; + document.querySelector('#cp-loading-message').innerText = err2 || err; } catch (e) { console.error(e); } }; return function () { diff --git a/customize.dist/messages.js b/customize.dist/messages.js index 40dbbfb95..303375e4e 100755 --- a/customize.dist/messages.js +++ b/customize.dist/messages.js @@ -26,7 +26,9 @@ var getStoredLanguage = function () { return localStorage && localStorage.getIte var getBrowserLanguage = function () { return navigator.language || navigator.userLanguage || ''; }; var getLanguage = messages._getLanguage = function () { if (window.cryptpadLanguage) { return window.cryptpadLanguage; } - if (getStoredLanguage()) { return getStoredLanguage(); } + try { + if (getStoredLanguage()) { return getStoredLanguage(); } + } catch (e) { console.log(e); } var l = getBrowserLanguage(); // Edge returns 'fr-FR' --> transform it to 'fr' and check again return map[l] ? l : @@ -65,7 +67,9 @@ define(req, function(AppConfig, Default, Language) { if (AppConfig.availableLanguages.indexOf(language) === -1) { language = defaultLanguage; Language = Default; - localStorage.setItem(LS_LANG, language); + try { + localStorage.setItem(LS_LANG, language); + } catch (e) { console.log(e); } } Object.keys(map).forEach(function (l) { if (l === defaultLanguage) { return; } diff --git a/customize.dist/pages.js b/customize.dist/pages.js index 0dd518089..00efd1677 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -62,14 +62,14 @@ define([ var imprintUrl = AppConfig.imprint && (typeof(AppConfig.imprint) === "boolean" ? '/imprint.html' : AppConfig.imprint); - Pages.versionString = "v3.23.2 (XerusDaamsi reloaded)"; - Msg.docs_link = "Documentation"; // XXX breaks the about menu // XXX Remove FAQ from translations and remove FAQ page // XXX Add FAQ to docs Msg.footer_team = "Contributors" // XXX existing key Msg.footer_tos = "Terms of Service" // XXX existing key + Pages.versionString = "CryptPad v3.24.0 (YunnanLakeNewt)"; + // used for the about menu Pages.imprintLink = AppConfig.imprint ? footLink(imprintUrl, 'imprint') : undefined; Pages.privacyLink = footLink(AppConfig.privacy, 'privacy'); diff --git a/package-lock.json b/package-lock.json index a9ee6e5e7..775f42f68 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cryptpad", - "version": "3.23.2", + "version": "3.24.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6ac26512d..c3994cc5e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cryptpad", "description": "realtime collaborative visual editor with zero knowlege server", - "version": "3.23.2", + "version": "3.24.0", "license": "AGPL-3.0+", "repository": { "type": "git", diff --git a/www/admin/inner.html b/www/admin/inner.html index 01bda5fab..eeb234d0c 100644 --- a/www/admin/inner.html +++ b/www/admin/inner.html @@ -2,7 +2,7 @@ - + diff --git a/www/admin/main.js b/www/admin/main.js index 817d2bd2e..8a6ec7a70 100644 --- a/www/admin/main.js +++ b/www/admin/main.js @@ -3,38 +3,14 @@ define([ '/bower_components/nthen/index.js', '/api/config', '/common/dom-ready.js', - '/common/requireconfig.js', '/common/sframe-common-outer.js', -], function (nThen, ApiConfig, DomReady, RequireConfig, SFCommonO) { - var requireConfig = RequireConfig(); +], function (nThen, ApiConfig, DomReady, SFCommonO) { // Loaded in load #2 nThen(function (waitFor) { DomReady.onReady(waitFor()); }).nThen(function (waitFor) { - var req = { - cfg: requireConfig, - req: [ '/common/loading.js' ], - pfx: window.location.origin - }; - window.rc = requireConfig; - window.apiconf = ApiConfig; - document.getElementById('sbox-iframe').setAttribute('src', - ApiConfig.httpSafeOrigin + '/admin/inner.html?' + requireConfig.urlArgs + - '#' + encodeURIComponent(JSON.stringify(req))); - - // This is a cheap trick to avoid loading sframe-channel in parallel with the - // loading screen setup. - var done = waitFor(); - var onMsg = function (msg) { - var data = JSON.parse(msg.data); - if (data.q !== 'READY') { return; } - window.removeEventListener('message', onMsg); - var _done = done; - done = function () { }; - _done(); - }; - window.addEventListener('message', onMsg); + SFCommonO.initIframe(waitFor); }).nThen(function (/*waitFor*/) { var addRpc = function (sframeChan, Cryptpad/*, Utils*/) { // Adding a new avatar from the profile: pin it and store it in the object diff --git a/www/code/inner.html b/www/code/inner.html index a4ea56206..b25534297 100644 --- a/www/code/inner.html +++ b/www/code/inner.html @@ -2,7 +2,7 @@ - + diff --git a/www/contacts/main.js b/www/contacts/main.js index 38d6c5e71..faf92f94e 100644 --- a/www/contacts/main.js +++ b/www/contacts/main.js @@ -3,38 +3,14 @@ define([ '/bower_components/nthen/index.js', '/api/config', '/common/dom-ready.js', - '/common/requireconfig.js', '/common/sframe-common-outer.js' -], function (nThen, ApiConfig, DomReady, RequireConfig, SFCommonO) { - var requireConfig = RequireConfig(); +], function (nThen, ApiConfig, DomReady, SFCommonO) { // Loaded in load #2 nThen(function (waitFor) { DomReady.onReady(waitFor()); }).nThen(function (waitFor) { - var req = { - cfg: requireConfig, - req: [ '/common/loading.js' ], - pfx: window.location.origin - }; - window.rc = requireConfig; - window.apiconf = ApiConfig; - document.getElementById('sbox-iframe').setAttribute('src', - ApiConfig.httpSafeOrigin + '/contacts/inner.html?' + requireConfig.urlArgs + - '#' + encodeURIComponent(JSON.stringify(req))); - - // This is a cheap trick to avoid loading sframe-channel in parallel with the - // loading screen setup. - var done = waitFor(); - var onMsg = function (msg) { - var data = JSON.parse(msg.data); - if (data.q !== 'READY') { return; } - window.removeEventListener('message', onMsg); - var _done = done; - done = function () { }; - _done(); - }; - window.addEventListener('message', onMsg); + SFCommonO.initIframe(waitFor); }).nThen(function (/*waitFor*/) { SFCommonO.start({ noRealtime: true, diff --git a/www/debug/inner.html b/www/debug/inner.html index 2ac53948c..7936c04f2 100644 --- a/www/debug/inner.html +++ b/www/debug/inner.html @@ -2,7 +2,7 @@ - + diff --git a/www/notifications/main.js b/www/notifications/main.js index 20c8653f9..785fb3b5d 100644 --- a/www/notifications/main.js +++ b/www/notifications/main.js @@ -3,38 +3,14 @@ define([ '/bower_components/nthen/index.js', '/api/config', '/common/dom-ready.js', - '/common/requireconfig.js', '/common/sframe-common-outer.js', -], function (nThen, ApiConfig, DomReady, RequireConfig, SFCommonO) { - var requireConfig = RequireConfig(); +], function (nThen, ApiConfig, DomReady, SFCommonO) { // Loaded in load #2 nThen(function (waitFor) { DomReady.onReady(waitFor()); }).nThen(function (waitFor) { - var req = { - cfg: requireConfig, - req: [ '/common/loading.js' ], - pfx: window.location.origin - }; - window.rc = requireConfig; - window.apiconf = ApiConfig; - document.getElementById('sbox-iframe').setAttribute('src', - ApiConfig.httpSafeOrigin + '/notifications/inner.html?' + requireConfig.urlArgs + - '#' + encodeURIComponent(JSON.stringify(req))); - - // This is a cheap trick to avoid loading sframe-channel in parallel with the - // loading screen setup. - var done = waitFor(); - var onMsg = function (msg) { - var data = JSON.parse(msg.data); - if (data.q !== 'READY') { return; } - window.removeEventListener('message', onMsg); - var _done = done; - done = function () { }; - _done(); - }; - window.addEventListener('message', onMsg); + SFCommonO.initIframe(waitFor); }).nThen(function (/*waitFor*/) { var category; if (window.location.hash) { diff --git a/www/oodoc/inner.html b/www/oodoc/inner.html index 529c5a8d9..884ae5a00 100644 --- a/www/oodoc/inner.html +++ b/www/oodoc/inner.html @@ -2,7 +2,7 @@ - + diff --git a/www/ooslide/inner.html b/www/ooslide/inner.html index d06820db2..e7c4e111f 100644 --- a/www/ooslide/inner.html +++ b/www/ooslide/inner.html @@ -2,7 +2,7 @@ - + diff --git a/www/pad/app-pad.less b/www/pad/app-pad.less index b413eed6a..489cbb17d 100644 --- a/www/pad/app-pad.less +++ b/www/pad/app-pad.less @@ -27,6 +27,7 @@ body.cp-app-pad { #cp-app-pad-toc { @toc-level-indent: 15px; + overflow-y: auto; margin-top: 10px; margin-left: 10px; width: 200px; diff --git a/www/pad/inner.html b/www/pad/inner.html index e4dbcdf95..17bfec308 100644 --- a/www/pad/inner.html +++ b/www/pad/inner.html @@ -2,7 +2,7 @@ - + diff --git a/www/profile/main.js b/www/profile/main.js index 92b24b3fc..b041d926a 100644 --- a/www/profile/main.js +++ b/www/profile/main.js @@ -3,38 +3,14 @@ define([ '/bower_components/nthen/index.js', '/api/config', '/common/dom-ready.js', - '/common/requireconfig.js', '/common/sframe-common-outer.js', -], function (nThen, ApiConfig, DomReady, RequireConfig, SFCommonO) { - var requireConfig = RequireConfig(); +], function (nThen, ApiConfig, DomReady, SFCommonO) { // Loaded in load #2 nThen(function (waitFor) { DomReady.onReady(waitFor()); }).nThen(function (waitFor) { - var req = { - cfg: requireConfig, - req: [ '/common/loading.js' ], - pfx: window.location.origin - }; - window.rc = requireConfig; - window.apiconf = ApiConfig; - document.getElementById('sbox-iframe').setAttribute('src', - ApiConfig.httpSafeOrigin + '/profile/inner.html?' + requireConfig.urlArgs + - '#' + encodeURIComponent(JSON.stringify(req))); - - // This is a cheap trick to avoid loading sframe-channel in parallel with the - // loading screen setup. - var done = waitFor(); - var onMsg = function (msg) { - var data = JSON.parse(msg.data); - if (data.q !== 'READY') { return; } - window.removeEventListener('message', onMsg); - var _done = done; - done = function () { }; - _done(); - }; - window.addEventListener('message', onMsg); + SFCommonO.initIframe(waitFor); }).nThen(function (/*waitFor*/) { var getSecrets = function (Cryptpad, Utils, cb) { var Hash = Utils.Hash; diff --git a/www/secureiframe/inner.html b/www/secureiframe/inner.html index 29c3cf797..97bfb3930 100644 --- a/www/secureiframe/inner.html +++ b/www/secureiframe/inner.html @@ -2,7 +2,7 @@ - + diff --git a/www/settings/main.js b/www/settings/main.js index bbc0f87d3..750423a1d 100644 --- a/www/settings/main.js +++ b/www/settings/main.js @@ -3,38 +3,14 @@ define([ '/bower_components/nthen/index.js', '/api/config', '/common/dom-ready.js', - '/common/requireconfig.js', '/common/sframe-common-outer.js' -], function (nThen, ApiConfig, DomReady, RequireConfig, SFCommonO) { - var requireConfig = RequireConfig(); +], function (nThen, ApiConfig, DomReady, SFCommonO) { // Loaded in load #2 nThen(function (waitFor) { DomReady.onReady(waitFor()); }).nThen(function (waitFor) { - var req = { - cfg: requireConfig, - req: [ '/common/loading.js' ], - pfx: window.location.origin - }; - window.rc = requireConfig; - window.apiconf = ApiConfig; - document.getElementById('sbox-iframe').setAttribute('src', - ApiConfig.httpSafeOrigin + '/settings/inner.html?' + requireConfig.urlArgs + - '#' + encodeURIComponent(JSON.stringify(req))); - - // This is a cheap trick to avoid loading sframe-channel in parallel with the - // loading screen setup. - var done = waitFor(); - var onMsg = function (msg) { - var data = JSON.parse(msg.data); - if (data.q !== 'READY') { return; } - window.removeEventListener('message', onMsg); - var _done = done; - done = function () { }; - _done(); - }; - window.addEventListener('message', onMsg); + SFCommonO.initIframe(waitFor); }).nThen(function (/*waitFor*/) { var addRpc = function (sframeChan, Cryptpad, Utils) { sframeChan.on('Q_THUMBNAIL_CLEAR', function (d, cb) { diff --git a/www/sheet/inner.html b/www/sheet/inner.html index 07d21904d..68949568f 100644 --- a/www/sheet/inner.html +++ b/www/sheet/inner.html @@ -2,7 +2,7 @@ - + diff --git a/www/slide/inner.html b/www/slide/inner.html index c04091cf7..f067e8a2f 100644 --- a/www/slide/inner.html +++ b/www/slide/inner.html @@ -2,7 +2,7 @@ - + diff --git a/www/support/main.js b/www/support/main.js index b5ca65126..1dc8c0e56 100644 --- a/www/support/main.js +++ b/www/support/main.js @@ -3,40 +3,16 @@ define([ '/bower_components/nthen/index.js', '/api/config', '/common/dom-ready.js', - '/common/requireconfig.js', '/common/sframe-common-outer.js', '/common/outer/local-store.js', '/common/outer/login-block.js', -], function (nThen, ApiConfig, DomReady, RequireConfig, SFCommonO, LocalStore, Block) { - var requireConfig = RequireConfig(); +], function (nThen, ApiConfig, DomReady, SFCommonO, LocalStore, Block) { // Loaded in load #2 nThen(function (waitFor) { DomReady.onReady(waitFor()); }).nThen(function (waitFor) { - var req = { - cfg: requireConfig, - req: [ '/common/loading.js' ], - pfx: window.location.origin - }; - window.rc = requireConfig; - window.apiconf = ApiConfig; - document.getElementById('sbox-iframe').setAttribute('src', - ApiConfig.httpSafeOrigin + '/support/inner.html?' + requireConfig.urlArgs + - '#' + encodeURIComponent(JSON.stringify(req))); - - // This is a cheap trick to avoid loading sframe-channel in parallel with the - // loading screen setup. - var done = waitFor(); - var onMsg = function (msg) { - var data = JSON.parse(msg.data); - if (data.q !== 'READY') { return; } - window.removeEventListener('message', onMsg); - var _done = done; - done = function () { }; - _done(); - }; - window.addEventListener('message', onMsg); + SFCommonO.initIframe(waitFor); }).nThen(function (/*waitFor*/) { var category; if (window.location.hash) { diff --git a/www/teams/inner.html b/www/teams/inner.html index 243a74edf..5ec12c287 100644 --- a/www/teams/inner.html +++ b/www/teams/inner.html @@ -2,7 +2,7 @@ - + diff --git a/www/whiteboard/inner.html b/www/whiteboard/inner.html index 533b4568f..4b56440e3 100644 --- a/www/whiteboard/inner.html +++ b/www/whiteboard/inner.html @@ -2,7 +2,7 @@ - + diff --git a/www/worker/main.js b/www/worker/main.js index 04dffa748..633982146 100644 --- a/www/worker/main.js +++ b/www/worker/main.js @@ -3,38 +3,14 @@ define([ '/bower_components/nthen/index.js', '/api/config', '/common/dom-ready.js', - '/common/requireconfig.js', '/common/sframe-common-outer.js' -], function (nThen, ApiConfig, DomReady, RequireConfig, SFCommonO) { - var requireConfig = RequireConfig(); +], function (nThen, ApiConfig, DomReady, SFCommonO) { // Loaded in load #2 nThen(function (waitFor) { DomReady.onReady(waitFor()); }).nThen(function (waitFor) { - var req = { - cfg: requireConfig, - req: [ '/common/loading.js' ], - pfx: window.location.origin - }; - window.rc = requireConfig; - window.apiconf = ApiConfig; - document.getElementById('sbox-iframe').setAttribute('src', - ApiConfig.httpSafeOrigin + '/worker/inner.html?' + requireConfig.urlArgs + - '#' + encodeURIComponent(JSON.stringify(req))); - - // This is a cheap trick to avoid loading sframe-channel in parallel with the - // loading screen setup. - var done = waitFor(); - var onMsg = function (msg) { - var data = JSON.parse(msg.data); - if (data.q !== 'READY') { return; } - window.removeEventListener('message', onMsg); - var _done = done; - done = function () { }; - _done(); - }; - window.addEventListener('message', onMsg); + SFCommonO.initIframe(waitFor); }).nThen(function (/*waitFor*/) { SFCommonO.start({ noRealtime: true,