WIP! A BB-style forum, on the ATmosphere! We're still working... we'll be back soon when we have something to show off!
node typescript hono htmx atproto
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(web): POST /admin/themes/:rkey/reset-to-preset (ATB-59)

Malpercio 382d970e 59d8476d

+32
+32
apps/web/src/routes/admin-themes.tsx
··· 1081 1081 return c.redirect(`/admin/themes/${themeRkey}?success=1`, 302); 1082 1082 }); 1083 1083 1084 + // ── POST /admin/themes/:rkey/reset-to-preset ────────────────────────────── 1085 + 1086 + app.post("/admin/themes/:rkey/reset-to-preset", async (c) => { 1087 + const auth = await getSessionWithPermissions(appviewUrl, c.req.header("cookie")); 1088 + if (!auth.authenticated) return c.redirect("/login"); 1089 + if (!canManageThemes(auth)) { 1090 + return c.html( 1091 + <BaseLayout title="Access Denied" auth={auth}> 1092 + <p>Access denied.</p> 1093 + </BaseLayout>, 1094 + 403 1095 + ); 1096 + } 1097 + 1098 + const themeRkey = c.req.param("rkey"); 1099 + 1100 + let body: Record<string, string | File>; 1101 + try { 1102 + body = await c.req.parseBody(); 1103 + } catch (error) { 1104 + if (isProgrammingError(error)) throw error; 1105 + return c.json({ error: "Invalid form submission." }, 400); 1106 + } 1107 + 1108 + const preset = typeof body.preset === "string" ? body.preset : ""; 1109 + if (!(preset in THEME_PRESETS)) { 1110 + return c.json({ error: `Unknown preset: ${preset}` }, 400); 1111 + } 1112 + 1113 + return c.redirect(`/admin/themes/${themeRkey}?preset=${encodeURIComponent(preset)}`, 302); 1114 + }); 1115 + 1084 1116 return app; 1085 1117 } 1086 1118