rustream/templates/
error.rs

1/// Get the HTML content to render the session unauthorized page.
2///
3/// # See Also
4///
5/// - This page is served as a response for all the entry points,
6/// when the user tries to access a page without valid authentication.
7///
8/// # Returns
9///
10/// A `String` version of the HTML, CSS and JS content.
11pub fn get_content() -> String {
12    r###"<!DOCTYPE html>
13<html lang="en">
14<head>
15    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
16    <title>RuStream - Self-hosted Streaming Engine - v{{ version }}</title>
17    <meta property="og:type" content="MediaStreaming">
18    <meta name="keywords" content="Python, streaming, fastapi, JavaScript, HTML, CSS">
19    <meta name="author" content="Vignesh Rao">
20    <meta content="width=device-width, initial-scale=1" name="viewport">
21    <!-- Favicon.ico and Apple Touch Icon -->
22    <link rel="icon" href="https://thevickypedia.github.io/open-source/images/logo/actix.ico">
23    <link rel="apple-touch-icon" href="https://thevickypedia.github.io/open-source/images/logo/actix.png">
24    <style>
25        /* Google fonts with a backup alternative */
26        @import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;500;700&display=swap');
27        * {
28            font-family: 'Ubuntu', 'PT Serif', sans-serif;
29        }
30        img {
31            display: block;
32            margin-left: auto;
33            margin-right: auto;
34        }
35        :is(h1, h2, h3, h4, h5, h6)
36        {
37            text-align: center;
38            color: #F0F0F0;
39        }
40        button {
41            width: 100px;
42            margin: 0 auto;
43            display: block;
44        }
45        body {
46            background-color: #151515;
47        }
48    </style>
49    <noscript>
50        <style>
51            body {
52                width: 100%;
53                height: 100%;
54                overflow: hidden;
55            }
56        </style>
57        <div style="position: fixed; text-align:center; height: 100%; width: 100%; background-color: #151515;">
58            <h2 style="margin-top:5%">This page requires JavaScript
59                to be enabled.
60                <br><br>
61                Please refer <a href="https://www.enable-javascript.com/">enable-javascript</a> for how to.
62            </h2>
63            <form>
64                <button type="submit" onClick="<meta httpEquiv='refresh' content='0'>">RETRY</button>
65            </form>
66        </div>
67    </noscript>
68</head>
69<body>
70<h2 style="margin-top:5%">{{ title }}</h2>
71<h3>{{ description }}</h3>
72<p>
73    <img src="https://thevickypedia.github.io/open-source/images/gif/lockscape.gif"
74        onerror="this.src='https://vigneshrao.com/open-source/images/gif/lockscape.gif'"
75        width="200" height="170" alt="Image" class="center">
76</p>
77<button style="text-align:center" onClick="window.location.href = '{{ button_link }}';">{{ button_text }}</button>
78<br>
79<button style="text-align:center" onClick="alert('{{ help }}');">HELP
80</button>
81<h4>Click <a href="https://vigneshrao.com/contact">HERE</a> to reach out.</h4>
82</body>
83{% if block_navigation %}
84    <!-- control the behavior of the browser's navigation without triggering a full page reload -->
85    <script>
86        document.addEventListener('DOMContentLoaded', function() {
87            history.pushState(null, document.title, location.href);
88            window.addEventListener('popstate', function (event) {
89                history.pushState(null, document.title, location.href);
90            });
91        });
92    </script>
93{% endif %}
94</html>
95"###.to_string()
96}