bewcloud/pages/404.ts
Bruno Bernardino c26cae625e
Remove fresh
This implements a huge change, where Fresh is removed as a framework and serving files, allowing more control over importing, bundling, and serving files and components.

The biggest challenge was to continue making sure that there weren't too many places to look into for import versions, and `PasswordlessPasskeyLogin.tsx` became a prototype in migrating a component to fully SSR, no need for frontend parsing (via Babel) or bundling (via a custom-script, downloading frontend dependencies from esm.sh). Still, there are too many components to migrate like that, and it's all working, so I likely won't even attempt it unless there's some bug, new feature, or security vulnerability to address that warrants a rewrite of those.

This also updates all dependencies (except `@libs/xml` because that still causes some breaking in DAV endpoints), including Deno!

All other advantages can be seen in the related issues, and the breaking change this (v4.0.0) introduces is related simply to `config.email.tlsMode` (which had a deprecation warning throughout v3), and because, while I tested many things exhaustively, it's not impossible something broke that I didn't see.

Closes #141
Closes #132
2026-02-20 10:54:31 +00:00

47 lines
1.1 KiB
TypeScript

import { basicLayoutResponse } from '/lib/utils/layout.tsx';
import { html } from '/public/ts/utils/misc.ts';
import page, { RequestHandlerParams } from '/lib/page.ts';
import { User } from '/lib/types.ts';
const titlePrefix = '404 - Page not found';
function get({ request, match, user, session, isRunningLocally }: RequestHandlerParams) {
const htmlContent = defaultHtmlContent(user);
return basicLayoutResponse(htmlContent, {
currentPath: match?.pathname.input || '/',
titlePrefix,
match,
request,
user,
session,
isRunningLocally,
});
}
function defaultHtmlContent(user?: User | null) {
const htmlContent = html`
<main>
<section class="max-w-3xl mx-auto flex flex-col items-center justify-center">
${!user
? (
html`
<h1>404 - Page not found</h1>
`
)
: ''}
<p class="my-4">
The page you were looking for doesn't exist.
</p>
<a href="/">Go back home</a>
</section>
</main>
`;
return htmlContent;
}
export default page({
get,
accessMode: 'public',
});