tangled
alpha
login
or
join now
seth.computer
/
sitebase
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
A bunch of type fixing
seth.computer
1 month ago
d321bf48
b419ff85
verified
This commit was signed with the committer's
known signature
.
seth.computer
SSH Key Fingerprint:
SHA256:utUtG8j2hgvZ0Rnm/rPJiqFu4NT5bjOnC26AUIBh500=
+27
-8
10 changed files
expand all
collapse all
unified
split
bun.lock
package.json
packages
core
src
atproto.ts
web
src
routes
auth.ts
documents.ts
publication.ts
server.ts
types.ts
views
layouts
main.ts
tsconfig.json
+1
bun.lock
···
7
7
"devDependencies": {
8
8
"@biomejs/biome": "^2.3.11",
9
9
"@types/node": "^25.0.9",
10
10
+
"bun-types": "^1.3.6",
10
11
"typescript": "^5",
11
12
},
12
13
},
+1
package.json
···
7
7
"devDependencies": {
8
8
"@biomejs/biome": "^2.3.11",
9
9
"@types/node": "^25.0.9",
10
10
+
"bun-types": "^1.3.6",
10
11
"typescript": "^5"
11
12
},
12
13
"scripts": {
+3
-3
packages/core/src/atproto.ts
···
19
19
throw new Error(`Invalid AT URI: ${uri}`);
20
20
}
21
21
return {
22
22
-
did: match[1],
23
23
-
collection: match[2],
24
24
-
rkey: match[3],
22
22
+
did: match[1] as string,
23
23
+
collection: match[2] as string,
24
24
+
rkey: match[3] as string,
25
25
};
26
26
}
27
27
+2
-1
packages/web/src/routes/auth.ts
···
9
9
} from "../lib/oauth";
10
10
import { layout } from "../views/layouts/main";
11
11
import { csrfField } from "../lib/csrf";
12
12
+
import type { AppVariables } from "../types";
12
13
13
13
-
export const authRoutes = new Hono();
14
14
+
export const authRoutes = new Hono<{ Variables: AppVariables }>();
14
15
15
16
// Client metadata endpoint (required for OAuth)
16
17
authRoutes.get("/client-metadata.json", async (c) => {
+2
-1
packages/web/src/routes/documents.ts
···
9
9
getDocumentContentText,
10
10
} from "../lib/content-types";
11
11
import { marked } from "marked";
12
12
+
import type { AppVariables } from "../types";
12
13
13
13
-
export const documentRoutes = new Hono();
14
14
+
export const documentRoutes = new Hono<{ Variables: AppVariables }>();
14
15
15
16
const DOCUMENT_COLLECTION = "site.standard.document";
16
17
const PUBLICATION_COLLECTION = "site.standard.publication";
+2
-1
packages/web/src/routes/publication.ts
···
3
3
import { layout } from "../views/layouts/main";
4
4
import { requireAuth, type Session } from "../lib/session";
5
5
import { csrfField } from "../lib/csrf";
6
6
+
import type { AppVariables } from "../types";
6
7
7
7
-
export const publicationRoutes = new Hono();
8
8
+
export const publicationRoutes = new Hono<{ Variables: AppVariables }>();
8
9
9
10
const PUBLICATION_COLLECTION = "site.standard.publication";
10
11
+2
-1
packages/web/src/server.ts
···
9
9
import { getSession } from "./lib/session";
10
10
import { getClientMetadata, getJwks } from "./lib/oauth";
11
11
import { csrfProtection, getCSRFToken } from "./lib/csrf";
12
12
+
import type { AppVariables } from "./types";
12
13
13
13
-
export const app = new Hono();
14
14
+
export const app = new Hono<{ Variables: AppVariables }>();
14
15
15
16
// Static files
16
17
app.use("/public/*", serveStatic({ root: "./" }));
+9
packages/web/src/types.ts
···
1
1
+
import type { Hono } from "hono";
2
2
+
import type { Session } from "./lib/session";
3
3
+
4
4
+
export type AppVariables = {
5
5
+
session: Session;
6
6
+
csrfToken: string;
7
7
+
};
8
8
+
9
9
+
export type App = Hono<{ Variables: AppVariables }>;
+4
-1
packages/web/src/views/layouts/main.ts
···
1
1
import { html } from "hono/html";
2
2
+
import type { HtmlEscapedString } from "hono/utils/html";
2
3
import type { Session } from "../../lib/session";
3
4
4
5
interface LayoutOptions {
···
7
8
csrfToken?: string;
8
9
}
9
10
10
10
-
export function layout(content: string, options: LayoutOptions = {}) {
11
11
+
type Content = string | HtmlEscapedString | Promise<HtmlEscapedString>;
12
12
+
13
13
+
export function layout(content: Content, options: LayoutOptions = {}) {
11
14
const { title = "sitebase", session } = options;
12
15
13
16
return html`
+1
tsconfig.json
···
2
2
"compilerOptions": {
3
3
// Environment setup & latest features
4
4
"lib": ["ESNext"],
5
5
+
"types": ["bun-types"],
5
6
"target": "ESNext",
6
7
"module": "Preserve",
7
8
"moduleDetection": "force",