website 1.0.1: thumbnails from the site, Calendar dates
- The messages' YouTube thumbnails are served from the site (/api/thumbnails/<id>.jpg): the backend fetches a message's thumbnail once and keeps it in uploads/.thumbnails (only the site's own videos, only a JPEG), so visitors ask nothing of YouTube before pressing play. The messages page preloads the first one (its LCP: Heritage 89 -> 95). - Calendar events' dates read "Sun · November", not "Sun (month: November)". - e2e: no request to YouTube or Spotify before play; the variant screenshots round section heights to whole pixels (a one-pixel flake); the e2e thumbnail is one of the demo's illustrations. - crosscode script: a Website's export leaves out uploads/.thumbnails. - docs: release checks on 1.0.1, VERSIONS, handover. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
* /api/health version and database, for monitoring, `crosscode deploy` and the Hub
|
||||
* /api/v1/site/… the public site (what visitors see: the latest published version)
|
||||
* /api/uploads/… the church's uploaded images
|
||||
* /api/thumbnails/<id>.jpg its messages' YouTube thumbnails, kept here (visitors never ask YouTube)
|
||||
* /api/auth/… signing in to the admin through the church's Accounts
|
||||
* /api/accounts/v1/events Accounts' signed calls (user.updated / export / deleted)
|
||||
* /api/links/v1/… Connect and Disconnect with the church's other products
|
||||
@@ -27,6 +28,7 @@ import { linksRouter } from './links/routes.js';
|
||||
import { defaultUploadDir } from './demo/demoChurch.js';
|
||||
import { previewContent, siteContent } from './site/content.js';
|
||||
import { siteStatus } from './site/status.js';
|
||||
import { thumbnail } from './site/thumbnails.js';
|
||||
|
||||
export function createApp(ctx: Ctx) {
|
||||
const app = express();
|
||||
@@ -75,6 +77,23 @@ export function createApp(ctx: Ctx) {
|
||||
},
|
||||
}));
|
||||
|
||||
// A message's YouTube thumbnail, fetched once by the backend and kept (site/thumbnails.ts).
|
||||
app.get('/api/thumbnails/:file', async (req, res, next) => {
|
||||
try {
|
||||
const id = /^([A-Za-z0-9_-]+)\.jpg$/.exec(req.params.file)?.[1];
|
||||
const body = id ? await thumbnail(ctx, id) : null;
|
||||
if (!body) {
|
||||
res.set('Cache-Control', 'no-store');
|
||||
return sendError(res, new ApiError(404, 'NOT_FOUND', 'There is no such file.'));
|
||||
}
|
||||
res.set('Content-Type', 'image/jpeg');
|
||||
res.set('Cache-Control', 'public, max-age=604800');
|
||||
res.send(body);
|
||||
} catch (err) {
|
||||
next(err);
|
||||
}
|
||||
});
|
||||
|
||||
app.use('/api', authRouter(ctx));
|
||||
app.use('/api', linksRouter(ctx));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user