// Load #1, load as little as possible because we are in a race to get the loading screen up. define([ '/bower_components/nthen/index.js', '/api/config', '/common/requireconfig.js', '/customize/messages.js', 'jquery', ], function (nThen, ApiConfig, RequireConfig, Messages, $) { var common = {}; var embeddableApps = [ 'code', 'form', 'kanban', 'pad', 'slide', 'whiteboard', ].map(function (x) { return `/${x}/`; }); common.initIframe = function (waitFor, isRt, pathname) { if (window.top !== window) { // this is triggered if the intance's HTTP headers have permitted the app // to be loaded within an iframe, but the instance admin has not explicitly // enabled embedding via the admin panel. Their checkup page should tell them // how to correct this (Access-Control-Allow-Origin and CSP frame-ancestors). if (!ApiConfig.enableEmbedding) { return void window.alert(Messages.error_embeddingDisabled); } // even where embedding is not forbidden it should still be limited // to apps that are explicitly permitted if (!embeddableApps.includes(window.location.pathname)) { return void window.alert(Messages.error_embeddingDisabledSpecific); } } // this is triggered in two situations: // 1. a user has somehow loaded the page via an unexpected origin // 2. the admin has configured their httpUnsafeOrigin incorrectly // in case #2 the checkup page will advise them on correct configuration if (window.location.origin !== ApiConfig.httpUnsafeOrigin) { return void window.alert(Messages._getKey('error_incorrectAccess', [ApiConfig.httpUnsafeOrigin])); } var requireConfig = RequireConfig(); var lang = Messages._languageUsed; var themeKey = 'CRYPTPAD_STORE|colortheme'; var req = { cfg: requireConfig, req: [ '/common/loading.js' ], pfx: window.location.origin, theme: localStorage[themeKey], themeOS: localStorage[themeKey+'_default'], lang: lang }; window.rc = requireConfig; window.apiconf = ApiConfig; var hash, href; if (isRt) { // Hidden hash hash = window.location.hash; href = window.location.href; if (window.history && window.history.replaceState && hash) { window.history.replaceState({}, window.document.title, '#'); } } var $i = $('