Morning improvements

This commit is contained in:
Andras Schmelczer 2026-03-17 13:29:03 +00:00
parent 3e9fba5303
commit 53fff3efaa
41 changed files with 2438 additions and 637 deletions

View file

@ -57,7 +57,12 @@ app.get('/screenshot', async (req, res) => {
const pagePath = typeof req.query.path === 'string' && req.query.path ? req.query.path : '/';
if (pagePath !== '/') qs.set('path', pagePath);
// Include auth status in cache key so authenticated screenshots
// (with hexagons outside free zone) are cached separately
const authHeader = req.headers.authorization;
if (authHeader) qs.set('_auth', '1');
const cacheKey = cache.buildKey(qs);
qs.delete('_auth');
qs.delete('path');
// Check cache first
@ -74,8 +79,8 @@ app.get('/screenshot', async (req, res) => {
qs.set('screenshot', '1');
const url = `${APP_URL}${pagePath}?${qs}`;
console.log(`Taking screenshot: ${url}`);
const jpeg = await takeScreenshot(url);
console.log(`Taking screenshot: ${url}${authHeader ? ' (authenticated)' : ''}`);
const jpeg = await takeScreenshot(url, authHeader);
// Cache it
cache.set(cacheKey, jpeg);