poke/html/layouts/error-video.ejs
2025-09-13 11:01:01 +02:00

174 lines
5.8 KiB
Plaintext

<!--
This Source Code Form is subject to the terms of the GNU General Public License:
Copyright (C) 2021-2025 PokeTube Of Poke Project, a part of The Poke Project Initiative (initiative.poketube.fun)
source code :https://codeberg.org/ashley/poke
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<title>Poke - <%= error %> !!!</title>
<meta content="#111111" name="theme-color" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover" />
<meta name="darkreader-lock" />
<link href="/css/yt-ukraine.svg?v=3" rel="icon" />
<link rel="manifest" href="/manifest.json" />
<style>
body {
margin: auto;
background: #111111;
color: white;
font-family: arial;
max-width: 600px;
}
body::before {
background: linear-gradient(0deg, rgba(115, 32, 67, 1), rgba(17, 17, 17, 1));
background-repeat: no-repeat;
content: "";
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
height: 100%;
z-index: -1;
pointer-events: none;
transition: 1s height;
}
h2 { font-size: 40px; }
p#abstract {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 500px;
margin: 0px;
font-weight: bold;
opacity: 0.005;
pointer-events: none;
transition: 1s transform;
}
@media only screen and (max-width: 790px) {
p#abstract {
transform: translate(-50%, -50%) rotate(90deg) !important;
}
}
.error {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
cursor: default;
max-width: 600px;
width: 100%;
}
.error-footer {
position: fixed;
bottom: 24px;
width: 100%;
max-width: 600px;
text-align: center;
}
.error-footer a {
color: #ac8fa5;
text-decoration: none;
margin: 0px 12px;
}
.error-footer a:hover { color: #d69cc8; }
.countdown {
margin-top: 16px;
color: #ccc;
font-size: 14px;
}
</style>
<% const RESTART_MSG = "there could be few reasons why this could happen. see https://codeberg.org/ashley/poke/src/branch/main/why-error.md for info "; %>
<% if (description === RESTART_MSG) { %>
<script>
// Alternating delay: 5s -> 10s -> 5s -> 10s -> ...
const PHASE_KEY = 'reloadPhase'; // 0 or 1
const COUNT_KEY = 'reloadCount'; // simple counter
const DELAYS = [5, 10];
// Pick delay for this attempt, then advance the phase for next time
const currentPhase = parseInt(localStorage.getItem(PHASE_KEY) || '0', 10) % DELAYS.length;
let seconds = DELAYS[currentPhase];
localStorage.setItem(PHASE_KEY, ((currentPhase + 1) % DELAYS.length).toString());
function hardReload() {
// Hard reload to bypass cache if possible
location.reload();
}
function updateCountdown() {
const el = document.getElementById('countdown');
if (el) el.textContent = "Trying again in " + seconds + " seconds...";
if (seconds <= 0) {
hardReload();
} else {
seconds--;
setTimeout(updateCountdown, 1000);
}
}
window.addEventListener('DOMContentLoaded', () => {
updateCountdown();
// Wire up footer refresh link (if present)
const refreshLink = document.getElementById('refresh-link');
if (refreshLink) {
refreshLink.addEventListener('click', (e) => {
e.preventDefault();
hardReload();
});
}
});
</script>
<% } else { %>
<script>
// Clear counters on non-restart errors
localStorage.removeItem('reloadCount');
localStorage.removeItem('reloadPhase');
</script>
<% } %>
</head>
<body>
<% if (description === RESTART_MSG) { %>
<p id="abstract">502</p>
<% } else { %>
<p id="abstract">404</p>
<% } %>
<div class="error">
<h2><%= error %></h2>
<p><%= description %></p>
<% if (description === RESTART_MSG) { %>
<div class="countdown" id="countdown"></div>
<% } %>
</div>
<div class="error-footer">
<a href="https://codeberg.org/ashley/poke/issues/new/choose">Create issue</a>
<a href="https://discord.poketube.fun">Report on our Discord</a>
<% if (description === RESTART_MSG) { %>
<a href="https://github.com/iv-org/invidious/issues">See Invidious issues</a>
<a href="#" id="refresh-link">Refresh Page</a>
<% } %>
</div>
</body>
</html>