Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesPull RequestsActionsSecurityInsightsSettings
✨ AI
More
Blame · Line-by-line history

app.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.

app.tsxBlame113 lines · 1 contributor
79136bbClaude1import { Hono } from "hono";
2import { logger } from "hono/logger";
3import { cors } from "hono/cors";
05b973eClaude4import { compress } from "hono/compress";
79136bbClaude5import { Layout } from "./views/layout";
6import gitRoutes from "./routes/git";
7import apiRoutes from "./routes/api";
8import authRoutes from "./routes/auth";
9import settingsRoutes from "./routes/settings";
10import issueRoutes from "./routes/issues";
11import repoSettings from "./routes/repo-settings";
12import compareRoutes from "./routes/compare";
0074234Claude13import pullRoutes from "./routes/pulls";
14import editorRoutes from "./routes/editor";
c81ab7aClaude15import forkRoutes from "./routes/fork";
16import webhookRoutes from "./routes/webhooks";
17import exploreRoutes from "./routes/explore";
18import tokenRoutes from "./routes/tokens";
43de941Claude19import contributorRoutes from "./routes/contributors";
79136bbClaude20import webRoutes from "./routes/web";
21
22const app = new Hono();
23
05b973eClaude24// Middleware — compression first (wraps all responses)
25app.use("*", compress());
26// Logger only on non-git routes to avoid overhead on clone/push
27app.use("*", async (c, next) => {
28 if (c.req.path.includes(".git/")) return next();
29 return logger()(c, next);
30});
79136bbClaude31app.use("/api/*", cors());
32
33// Git Smart HTTP protocol routes (must be before web routes)
34app.route("/", gitRoutes);
35
36// REST API
37app.route("/", apiRoutes);
38
39// Auth routes (register, login, logout)
40app.route("/", authRoutes);
41
42// Settings routes (profile, SSH keys)
43app.route("/", settingsRoutes);
44
c81ab7aClaude45// API tokens
46app.route("/", tokenRoutes);
47
79136bbClaude48// Repo settings (description, visibility, delete)
49app.route("/", repoSettings);
50
c81ab7aClaude51// Webhooks management
52app.route("/", webhookRoutes);
53
79136bbClaude54// Compare view (branch diffs)
55app.route("/", compareRoutes);
56
57// Issue tracker
58app.route("/", issueRoutes);
59
0074234Claude60// Pull requests
61app.route("/", pullRoutes);
62
c81ab7aClaude63// Fork
64app.route("/", forkRoutes);
65
0074234Claude66// Web file editor
67app.route("/", editorRoutes);
68
43de941Claude69// Contributors
70app.route("/", contributorRoutes);
71
c81ab7aClaude72// Explore page
73app.route("/", exploreRoutes);
74
79136bbClaude75// Web UI (catch-all, must be last)
76app.route("/", webRoutes);
77
78// Global 404
79app.notFound((c) => {
80 return c.html(
81 <Layout title="Not Found">
82 <div class="empty-state">
83 <h2>404</h2>
84 <p>Page not found.</p>
85 <a href="/" style="margin-top: 12px; display: inline-block">
86 Go home
87 </a>
88 </div>
89 </Layout>,
90 404
91 );
92});
93
94// Global error handler
95app.onError((err, c) => {
96 console.error("[error]", err);
97 return c.html(
98 <Layout title="Error">
99 <div class="empty-state">
100 <h2>Something went wrong</h2>
101 <p>An unexpected error occurred.</p>
102 {process.env.NODE_ENV !== "production" && (
103 <pre style="margin-top: 16px; text-align: left; font-size: 12px; color: var(--red)">
104 {err.message}
105 </pre>
106 )}
107 </div>
108 </Layout>,
109 500
110 );
111});
112
113export default app;