Custom error pages
このコミットが含まれているのは:
コミット
35ce606d64
|
@ -1,6 +1,7 @@
|
||||||
# SPDX-FileCopyrightText: 2022 n9k <https://git.076.ne.jp/ninya9k>
|
# SPDX-FileCopyrightText: 2022 n9k <https://git.076.ne.jp/ninya9k>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
import anonstream.routes.errors
|
||||||
import anonstream.routes.core
|
import anonstream.routes.core
|
||||||
import anonstream.routes.websocket
|
import anonstream.routes.websocket
|
||||||
import anonstream.routes.nojs
|
import anonstream.routes.nojs
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
from quart import current_app, render_template
|
||||||
|
|
||||||
|
from werkzeug.exceptions import default_exceptions
|
||||||
|
|
||||||
|
for error in default_exceptions:
|
||||||
|
async def handle(error):
|
||||||
|
return await render_template('error.html', error=error), error.code
|
||||||
|
current_app.register_error_handler(error, handle)
|
|
@ -0,0 +1,27 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>{{ error.code }} {{ error.name }}</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #18181a;
|
||||||
|
color: #ddd;
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 14pt;
|
||||||
|
margin: 24pt 16pt;
|
||||||
|
text-align: center;
|
||||||
|
text-shadow: 2px 0px 1px orangered;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-size: 32pt;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: #42a5d7;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>{{ error.code }} {{ error.name }}</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
読み込み中…
新しいイシューから参照