Files
tmail-flutter/web/flutter_bootstrap.js
T
Dat VuandDat H. Pham d043c98431 Move inline web scripts to files and enforce the nginx page policy (#5115)
* Move inline web scripts to files and enforce the nginx page policy

* Render CSP_* through the nginx image entrypoint and allow blob: in connect-src

* Allow CSP_IMG_SRC and document nginx add_header inheritance and connect-src ports

* Keep a read-only logo mount from stopping nginx and add optional CSP_REPORT_URI

* fix: start nginx when the root or a logo mount is read-only

* docs: document the web CSP variables and upgrade steps

---------

Co-authored-by: Dat H. Pham <dphamhoang@linagora.com>
2026-11-08 10:54:57 +07:00

46 lines
1.6 KiB
JavaScript

const closeSmartBannerButton = document.querySelector('.smart-banner button.close');
if (closeSmartBannerButton) closeSmartBannerButton.addEventListener('click', closeSmartBanner);
const openTwakeMailAppButton = document.getElementById('open-button-id');
if (openTwakeMailAppButton) openTwakeMailAppButton.addEventListener('click', openTwakeMailApp);
{{flutter_js}}
{{flutter_build_config}}
loadLanguageResources().finally(initialTmailApp);
if ('serviceWorker' in navigator) {
navigator
.serviceWorker
.getRegistrations()
.then(async function(registrations) {
try {
await Promise.all(registrations.map(function(registration) {
return registration.unregister();
}));
} catch (error) {
console.log('[Twake Mail] Error unregistering service worker: ', error);
}
_flutter.loader.load({
onEntrypointLoaded: async function(engineInitializer) {
const appRunner = await engineInitializer.initializeEngine({
fontFallbackBaseUrl: ''
});
await setTimeout( async function () {
await appRunner.runApp();
}, 2000);
}
});
});
} else {
_flutter.loader.load({
onEntrypointLoaded: async function(engineInitializer) {
const appRunner = await engineInitializer.initializeEngine({
fontFallbackBaseUrl: ''
});
await setTimeout( async function () {
await appRunner.runApp();
}, 2000);
}
});
}