71 lines
1.5 KiB
Lua
71 lines
1.5 KiB
Lua
ngx.header.content_type = 'text/html';
|
|
local backend_num = ngx.shared.servers:get("inv-backends");
|
|
|
|
local function generate_backend_list()
|
|
local html = ""
|
|
for i=1, backend_num do
|
|
html = html .. "<p><a href='/switchbackend?backend_id=" .. i .. "'>Backend " .. i .. "</a></p>"
|
|
end
|
|
return html
|
|
end
|
|
|
|
ngx.say([[
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="refresh" content="2">
|
|
<style>
|
|
html {
|
|
background-color: #111111;
|
|
color: #FFFFFF;
|
|
font-family: sans-serif;
|
|
}
|
|
|
|
a:link {
|
|
color: rgb(255, 180, 255);
|
|
}
|
|
|
|
a:visited {
|
|
color: rgb(255, 180, 255);
|
|
}
|
|
|
|
.content {
|
|
padding: 20px 20px;
|
|
margin: 0 auto;
|
|
max-width: 780px;
|
|
width: 70%;
|
|
min-height: 60vh;
|
|
word-wrap: break-word;
|
|
line-height: 1.5em;
|
|
}
|
|
|
|
h1 {
|
|
color: #ffc642;
|
|
}
|
|
</style>
|
|
<title>503 Service Unavailable</title>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="content">
|
|
<h1>503 Service Unavailable</h1>
|
|
<p>Invidious is currently restarting</p>
|
|
<p>If you don't get an alive backend after 1 minute, it's because something is wrong...</p>
|
|
<p><b>Refreshing automatically in 2 seconds</b></p>
|
|
<p>Do you want to switch to another backend?</p>
|
|
]] .. generate_backend_list() .. [[
|
|
<div style="max-width: 60%;">
|
|
<p>
|
|
<i>If this page doesn't redirect you to any alive backend
|
|
then there is no available backends alive.
|
|
</i>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|
|
]])
|