Newsletter: social bar and event countdown parts, full-width builder
- Social bar: a colored band of the site's platform icons, linked;
no links added shows the footer's (src/data/socialLinks.ts, shared)
- Icons are white and ink PNGs in public/email/, made from
PlatformIcon.tsx by scripts/email-icons.mjs (no SVG in Gmail/Outlook)
- Event countdown: a picture drawn by /api/countdown/<id>.png when the
email is opened (days, hours, minutes to local midnight in
America/Chicago; then happening now; then over), with a fixed line
under it as of copying
- The builder takes the whole window (useWideAdminPage('full'))
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a943ecd3a3
commit
00170ca912
29 changed files with 322 additions and 27 deletions
|
|
@ -39,6 +39,7 @@ import media from "./routes/media.js";
|
|||
import clips from "./routes/clips.js";
|
||||
import imports from "./routes/import.js";
|
||||
import files from "./routes/files.js";
|
||||
import countdown from "./routes/countdown.js";
|
||||
import { CLIPS_DIR, startClipWorker } from "./clips.js";
|
||||
import { UPLOADS_DIR, writeMissingThumbs } from "./media.js";
|
||||
import { logSafe, startSessionSweeper } from "./auth.js";
|
||||
|
|
@ -74,6 +75,14 @@ const app = new Hono();
|
|||
// loop a synchronous write each.
|
||||
app.use("/api/admin/*", logger());
|
||||
|
||||
/* A newsletter's countdown picture is shown inside other sites'
|
||||
webmail, which the same-origin resource policy set below would
|
||||
refuse. Registered first so it runs last, after secureHeaders. */
|
||||
app.use("/api/countdown/*", async (c, next) => {
|
||||
await next();
|
||||
c.res.headers.set("Cross-Origin-Resource-Policy", "cross-origin");
|
||||
});
|
||||
|
||||
/* Headers for every response. Referrer kept to the origin (YouTube
|
||||
embeds refuse to play without one). No HSTS here: nginx sends it on
|
||||
everything, including the files it serves from disk
|
||||
|
|
@ -178,6 +187,11 @@ app.route("/api", home);
|
|||
app.route("/api", directory);
|
||||
app.route("/api", blog);
|
||||
app.route("/api", sitePages);
|
||||
// Opened by everyone a newsletter goes to, often through one mail
|
||||
// proxy's address, so looser than the rest; each picture is kept for
|
||||
// its minute (routes/countdown.js).
|
||||
app.use("/api/countdown/*", rateLimit({ windowMs: 60_000, max: 600 }));
|
||||
app.route("/api", countdown);
|
||||
|
||||
// Tighter limit on the write path than anything else gets.
|
||||
app.use("/api/feedback", rateLimit({ windowMs: 60_000, max: 5 }));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue