Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history

legal.tsx

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

legal.tsxBlame48 lines · 1 contributor
36b4cbdClaude1/**
2 * Legal pages — Terms, Privacy, AUP served from the website.
3 */
4
5import { Hono } from "hono";
6import { readFileSync } from "fs";
7import { join } from "path";
8import { Layout } from "../views/layout";
9import { renderMarkdown, markdownCss } from "../lib/markdown";
10import { softAuth } from "../middleware/auth";
11import type { AuthEnv } from "../middleware/auth";
12import { html } from "hono/html";
13
14const legal = new Hono<AuthEnv>();
15
16legal.use("*", softAuth);
17
18function serveLegalPage(title: string, filename: string) {
19 return async (c: any) => {
20 const user = c.get("user");
21 let content: string;
22 try {
23 content = readFileSync(
24 join(process.cwd(), "legal", filename),
25 "utf-8"
26 );
27 } catch {
28 content = `# ${title}\n\nThis page is being prepared. Check back soon.`;
29 }
30
31 const rendered = renderMarkdown(content);
32
33 return c.html(
34 <Layout title={title} user={user}>
35 <style>{markdownCss}</style>
36 <div class="markdown-body" style="max-width: 800px; margin: 0 auto">
37 {html([rendered] as unknown as TemplateStringsArray)}
38 </div>
39 </Layout>
40 );
41 };
42}
43
44legal.get("/terms", serveLegalPage("Terms of Service", "TERMS.md"));
45legal.get("/privacy", serveLegalPage("Privacy Policy", "PRIVACY.md"));
46legal.get("/acceptable-use", serveLegalPage("Acceptable Use Policy", "AUP.md"));
47
48export default legal;