Skip to content

Commit e11c17f

Browse files
committed
Update 404 html
1 parent 6613040 commit e11c17f

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

views/htmx.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,25 @@ async def fetch_paste(self, request: starlette_plus.Request) -> starlette_plus.R
153153
if resp := self.check_discord(request=request):
154154
return resp
155155

156+
not_found: str = """
157+
<div class="notFound">
158+
<h2>404 - This page or paste could not be found</h2>
159+
<a href="/">Return Home...</a>
160+
</div>
161+
"""
162+
156163
no_reload: bool = request.query_params.get("noReload", False) == "true"
157164
password: str = unquote(request.query_params.get("pastePassword", ""))
158165

159166
identifier_quoted: str | None = request.query_params.get("id", None)
160167
if not identifier_quoted:
161-
return starlette_plus.HTMLResponse("<h1>404 - That paste was not Found!</h1>")
168+
return starlette_plus.HTMLResponse(not_found)
162169

163170
identifier: str = unquote(identifier_quoted).replace("/", "")
164171
paste = await self.app.database.fetch_paste(identifier, password=password)
165172

166173
if not paste:
167-
return starlette_plus.HTMLResponse("<h1>404 - That paste was not Found!</h1>")
174+
return starlette_plus.HTMLResponse(not_found)
168175

169176
if paste.has_password and not paste.password_ok:
170177
error_headers: dict[str, str] = {"HX-Retarget": "#errorResponse", "HX-Reswap": "outerHTML"}

web/static/styles/global.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,13 @@ textarea {
458458
}
459459
}
460460

461+
.notFound {
462+
display: flex;
463+
flex-direction: column;
464+
gap: 0.5rem;
465+
align-self: center;
466+
}
467+
461468
@media screen and (max-width: 600px) {
462469
.savePaste {
463470
padding: 1rem;

0 commit comments

Comments
 (0)