mirror of
https://github.com/misenhower/splatoon3.ink.git
synced 2026-11-18 16:58:18 -06:00
Groundwork for running the existing updaters and social posters in a Worker: - Derive IDs with @noble/hashes shake256; the Workers runtime's node:crypto lacks shake256. A test pins an ID produced by node:crypto. - Split updaters into fast (schedules, gear, co-op, festivals, stages; run concurrently) and slow (X-Rank, Splatfest rankings; run one at a time). The cron posts after the fast updaters, before the slow ones. - Fetch X-Rank seasons and detail types sequentially, cutting peak heap per division from ~85 MB to ~38 MB. - Move Splatfest rankings into FestivalRankingsUpdater, driven by the published festivals data, so results never wait on ranking pagination. - Coalesce concurrent downloads of the same SplatNet image. - Bring over the Browser-binding screenshot work from develop (f7293b6): Cloudflare captures use the BROWSER binding with retries, Browserless is removed, and workers/screenshots offers capture-only local testing. The local driver keeps puppeteer-core with an installed Chrome, always serves dist/, and fails on page-reported screenshot errors. - Remove the Docker image, compose files, and GHCR deploy workflow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
import CloudflareScreenshotDriver from '../../app/screenshots/drivers/CloudflareScreenshotDriver.mjs';
|
|
import { defaultScreenshotViewport } from '../../src/common/screenshot.mjs';
|
|
|
|
// Local capture-only entry point. The browser runs remotely; this endpoint stays on loopback.
|
|
export default {
|
|
async fetch(request, env) {
|
|
if (request.method !== 'GET') {
|
|
return new Response('Use GET with a route query parameter.', {
|
|
status: 405,
|
|
headers: { Allow: 'GET' },
|
|
});
|
|
}
|
|
|
|
let route = new URL(request.url).searchParams.get('route') || 'schedules';
|
|
let driver = new CloudflareScreenshotDriver({ browser: env.BROWSER, env });
|
|
|
|
try {
|
|
await driver.open();
|
|
|
|
let image = await driver.capture(route, defaultScreenshotViewport);
|
|
|
|
return new Response(image, {
|
|
headers: {
|
|
'Content-Type': 'image/png',
|
|
'Cache-Control': 'no-store',
|
|
},
|
|
});
|
|
} catch (error) {
|
|
console.error(error);
|
|
|
|
return new Response(error.message, { status: 502 });
|
|
} finally {
|
|
await driver.close();
|
|
}
|
|
},
|
|
};
|