mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Merge NoScript, NoCookie and BadBrowser pages in Index.html
This commit is contained in:
parent
860b7701f3
commit
4c8d84d07b
8 changed files with 38 additions and 89 deletions
|
|
@ -60,7 +60,7 @@ body#rl-app {
|
|||
width: 100vw;
|
||||
}
|
||||
|
||||
#rl-loading, #rl-loading-error {
|
||||
#rl-loading, #rl-loading-error, #rl-BadBrowser, #rl-NoCookie {
|
||||
color: var(--loading-color, #000);
|
||||
text-shadow: var(--loading-text-shadow);
|
||||
font-size: 30px;
|
||||
|
|
|
|||
16
dev/boot.js
16
dev/boot.js
|
|
@ -6,11 +6,10 @@ const
|
|||
app = eId('app'),
|
||||
admin = app && '1' == app.dataset.admin,
|
||||
layout = doc.cookie.match(/(^|;) ?rllayout=([^;]+)/) || '',
|
||||
redirect = path => doc.location.replace(qUri(path)),
|
||||
|
||||
showError = msg => {
|
||||
let div = eId('loading-error');
|
||||
div.append(' ' + msg);
|
||||
div.append(msg);
|
||||
eId('loading').hidden = true;
|
||||
div.hidden = false;
|
||||
},
|
||||
|
|
@ -29,9 +28,6 @@ const
|
|||
});
|
||||
};
|
||||
|
||||
navigator.cookieEnabled || redirect('NoCookie');
|
||||
[].flat || redirect('BadBrowser');
|
||||
|
||||
try {
|
||||
let smctoken = doc.cookie.match(/(^|;) ?smctoken=([^;]+)/);
|
||||
smctoken = smctoken ? smctoken[2] : localStorage.getItem('smctoken');
|
||||
|
|
@ -87,7 +83,15 @@ window.rl = {
|
|||
loadScript: loadScript
|
||||
};
|
||||
|
||||
loadScript(qUri(`${admin ? 'Admin' : ''}AppData/0/${Math.random().toString().slice(2)}/`))
|
||||
if (!navigator.cookieEnabled) {
|
||||
eId('loading').hidden = true;
|
||||
eId('NoCookie').hidden = false;
|
||||
} else if (![].flat) {
|
||||
eId('loading').hidden = true;
|
||||
eId('BadBrowser').hidden = false;
|
||||
} else {
|
||||
loadScript(qUri(`${admin ? 'Admin' : ''}AppData/0/${Math.random().toString().slice(2)}/`))
|
||||
.catch(e => showError(e));
|
||||
}
|
||||
|
||||
})(document);
|
||||
|
|
|
|||
|
|
@ -148,6 +148,8 @@ abstract class Service
|
|||
$sFaviconPngLink = $sFaviconUrl ?: Utils::WebStaticPath('apple-touch-icon.png');
|
||||
$sAppleTouchLink = $sFaviconUrl ? '' : Utils::WebStaticPath('apple-touch-icon.png');
|
||||
|
||||
$oActions = Api::Actions();
|
||||
|
||||
$aTemplateParameters = array(
|
||||
'{{BaseAppFaviconPngLinkTag}}' => $sFaviconPngLink ? '<link type="image/png" rel="shortcut icon" href="'.$sFaviconPngLink.'">' : '',
|
||||
'{{BaseAppFaviconTouchLinkTag}}' => $sAppleTouchLink ? '<link type="image/png" rel="apple-touch-icon" href="'.$sAppleTouchLink.'">' : '',
|
||||
|
|
@ -155,7 +157,13 @@ abstract class Service
|
|||
'{{BaseAppManifestLink}}' => Utils::WebStaticPath('manifest.json'),
|
||||
'{{BaseFavIconSvg}}' => $sFaviconUrl ? '' : Utils::WebStaticPath('favicon.svg'),
|
||||
'{{LoadingDescriptionEsc}}' => \htmlspecialchars($oConfig->Get('webmail', 'loading_description', 'SnappyMail'), ENT_QUOTES|ENT_IGNORE, 'UTF-8'),
|
||||
'{{BaseAppAdmin}}' => $bAdmin ? 1 : 0
|
||||
'{{BaseAppAdmin}}' => $bAdmin ? 1 : 0,
|
||||
|
||||
'{{NO_SCRIPT_DESC}}' => \nl2br($oActions->StaticI18N('NO_SCRIPT_TITLE') . "\n" . $oActions->StaticI18N('NO_SCRIPT_DESC')),
|
||||
'{{NO_COOKIE_TITLE}}' => $oActions->StaticI18N('NO_COOKIE_TITLE'),
|
||||
'{{NO_COOKIE_DESC}}' => $oActions->StaticI18N('NO_COOKIE_DESC'),
|
||||
'{{BAD_BROWSER_TITLE}}' => $oActions->StaticI18N('BAD_BROWSER_TITLE'),
|
||||
'{{BAD_BROWSER_DESC}}' => \nl2br($oActions->StaticI18N('BAD_BROWSER_DESC'))
|
||||
);
|
||||
|
||||
$sCacheFileName = '';
|
||||
|
|
|
|||
|
|
@ -540,29 +540,6 @@ class ServiceActions
|
|||
return $this->localAppData(true);
|
||||
}
|
||||
|
||||
public function ServiceNoScript() : string
|
||||
{
|
||||
return $this->localError($this->oActions->StaticI18N('NO_SCRIPT_TITLE'), $this->oActions->StaticI18N('NO_SCRIPT_DESC'));
|
||||
}
|
||||
|
||||
public function ServiceNoCookie() : string
|
||||
{
|
||||
return $this->localError($this->oActions->StaticI18N('NO_COOKIE_TITLE'), $this->oActions->StaticI18N('NO_COOKIE_DESC'));
|
||||
}
|
||||
|
||||
public function ServiceBadBrowser() : string
|
||||
{
|
||||
$sTitle = $this->oActions->StaticI18N('BAD_BROWSER_TITLE');
|
||||
$sDesc = \nl2br($this->oActions->StaticI18N('BAD_BROWSER_DESC'));
|
||||
|
||||
\header('Content-Type: text/html; charset=utf-8');
|
||||
return \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/BadBrowser.html'), array(
|
||||
'{{ErrorTitle}}' => $sTitle,
|
||||
'{{ErrorHeader}}' => $sTitle,
|
||||
'{{ErrorDesc}}' => $sDesc
|
||||
));
|
||||
}
|
||||
|
||||
public function ServiceMailto() : string
|
||||
{
|
||||
$this->oHttp->ServerNoCache();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"BACK_LINK": "Reload",
|
||||
"NO_SCRIPT_TITLE": "JavaScript is required for this application.",
|
||||
"NO_SCRIPT_DESC": "JavaScript support is not available in your browser.\nPlease enable JavaScript support in your browser settings and retry.\n",
|
||||
"NO_SCRIPT_DESC": "JavaScript support is not available in your browser.\nPlease enable JavaScript support in your browser settings and retry.",
|
||||
"NO_COOKIE_TITLE": "Cookies support is required for this application.",
|
||||
"NO_COOKIE_DESC": "Cookies support is not available in your browser.\nPlease enable Cookie support in your browser settings and retry.\n",
|
||||
"NO_COOKIE_DESC": "Cookies support is not available in your browser.\nPlease enable Cookie support in your browser settings and retry.",
|
||||
"BAD_BROWSER_TITLE": "Your browser is outdated.",
|
||||
"BAD_BROWSER_DESC": "To use all the features of the application,\ndownload and install one of these browsers:\n"
|
||||
"BAD_BROWSER_DESC": "To use all the features of the application,\ndownload and install one of the latest browsers."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"BACK_LINK": "Reload",
|
||||
"NO_SCRIPT_TITLE": "JavaScript is required for this application.",
|
||||
"NO_SCRIPT_DESC": "JavaScript support is not available in your browser.\nPlease enable JavaScript support in your browser settings and retry.\n",
|
||||
"NO_COOKIE_TITLE": "Cookies support is required for this application.",
|
||||
"NO_COOKIE_DESC": "Cookies support is not available in your browser.\nPlease enable Cookie support in your browser settings and retry.\n",
|
||||
"BAD_BROWSER_TITLE": "Your browser is outdated.",
|
||||
"BAD_BROWSER_DESC": "Om alle functies van deze applicatie te gebruiken,\ndownload en installeer een van de volgende browsers:\n"
|
||||
"NO_SCRIPT_DESC": "JavaScript support is not available in your browser.\nPlease enable JavaScript support in your browser settings and retry.",
|
||||
"NO_COOKIE_TITLE": "Cookie-ondersteuning is vereist voor deze applicatie.",
|
||||
"NO_COOKIE_DESC": "Cookie-ondersteuning is niet beschikbaar in uw browser.\nSchakel Cookie-ondersteuning in uw browserinstellingen in en probeer het opnieuw.",
|
||||
"BAD_BROWSER_TITLE": "Uw browser is te oud.",
|
||||
"BAD_BROWSER_DESC": "Om alle functies van deze applicatie te gebruiken,\ndownload en installeer een van de nieuwste browsers."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="robots" content="noindex, nofollow, noodp">
|
||||
<title>{{ErrorTitle}}</title>
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
font-family: arial, sans-serif;
|
||||
font-size: 14px;
|
||||
}
|
||||
.content {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
text-align: center;
|
||||
width: 600px;
|
||||
margin: -200px 0 0 -250px;
|
||||
background: #FFF;
|
||||
line-height: 150%;
|
||||
border-bottom: 1px solid #E4E4E4;
|
||||
}
|
||||
.error-desc {
|
||||
background-color: #eee;
|
||||
padding: 10px;
|
||||
}
|
||||
a {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="content">
|
||||
<h1>{{ErrorHeader}}</h1>
|
||||
<br>
|
||||
<div class="error-desc">
|
||||
<p>{{ErrorDesc}}</p>
|
||||
<a href="https://www.google.com/chrome/" target="_blank">Google Chrome</a>
|
||||
<a href="https://www.microsoft.com/edge/" target="_blank">Microsoft Edge</a>
|
||||
<a href="https://www.mozilla.org/firefox/" target="_blank">Mozilla Firefox</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,10 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="rl-started-trigger">
|
||||
|
||||
<head>
|
||||
<noscript>
|
||||
<meta http-equiv="refresh" content="0; URL=?/NoScript">
|
||||
</noscript>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
|
@ -20,13 +16,21 @@
|
|||
{{BaseAppFaviconPngLinkTag}}
|
||||
{{BaseAppFaviconTouchLinkTag}}
|
||||
</head>
|
||||
|
||||
<body id="rl-app" data-admin='{{BaseAppAdmin}}' spellcheck="false">
|
||||
<div id="rl-loading">
|
||||
<div id="rl-loading-desc">{{LoadingDescriptionEsc}}</div>
|
||||
<i class="icon-spinner"></i>
|
||||
<noscript><div class="error-desc">{{NO_SCRIPT_DESC}}</div></noscript>
|
||||
</div>
|
||||
<div id="rl-loading-error" hidden="">An error occurred.<br>Please refresh the page and try again.<br></div>
|
||||
<div id="rl-BadBrowser" hidden="">
|
||||
<h1>{{BAD_BROWSER_TITLE}}</h1>
|
||||
<div class="error-desc">{{BAD_BROWSER_DESC}}</div>
|
||||
</div>
|
||||
<div id="rl-NoCookie" hidden="">
|
||||
<h1>{{NO_COOKIE_TITLE}}</h1>
|
||||
<div class="error-desc">{{NO_COOKIE_DESC}}</div>
|
||||
</div>
|
||||
<div id="rl-loading-error" hidden="">An error occurred.<br>Please refresh the page and try again.</div>
|
||||
<div id="rl-content" hidden="">
|
||||
<div id="rl-left"></div>
|
||||
<div id="rl-right"></div>
|
||||
|
|
@ -35,5 +39,4 @@
|
|||
{{BaseTemplates}}
|
||||
<script nonce="" type="text/javascript">{{BaseAppBootScript}}{{BaseLanguage}}</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue