Force redirect from legacy URLs to /a

This commit is contained in:
Alexander Zinchuk 2023-05-05 15:53:20 +04:00
parent 4b96cc5bfe
commit 01ea087818

View File

@ -41,6 +41,18 @@
<link rel="icon" type="image/png" sizes="192x192" href="./<%= htmlWebpackPlugin.options.mainIcon %>.png">
<link rel="alternate icon" href="./favicon.ico" type="image/x-icon">
<link rel="manifest" id="the-manifest-placeholder" href="./<%= htmlWebpackPlugin.options.manifest %>">
<script>
const { pathname, hostname, href } = window.location;
if (pathname.startsWith('/z')) {
window.location.href = href.replace('/z', '/a');
}
if ((hostname === 'weba.telegram.org' || hostname === 'webz.telegram.org') && !localStorage.getItem('tt-global-state')) {
window.location.href = 'https://web.telegram.org/a';
}
</script>
</head>
<body id="root">