Simplify Threads captions and capture five minutes after sunrise

This commit is contained in:
2026-11-02 04:14:11 +09:00
parent 6ce32d33fe
commit 39374cea05
8 changed files with 37 additions and 22 deletions
+5 -1
View File
@@ -7,7 +7,11 @@ import { THREADS } from '../../src/constants/threads.ts';
export function dailySchedule(now: Date) {
const sunrise = calculateSun(now, observer).sunrise;
if (!sunrise || !Number.isFinite(+sunrise)) throw new Error('No sunrise for this date');
return { date: kstFields(now).date, sunrise, prepareAt: new Date(+sunrise - THREADS.prepareMs) };
return { date: kstFields(now).date, sunrise, captureAt: sunriseCaptureTime(sunrise), prepareAt: new Date(+sunrise - THREADS.prepareMs) };
}
export function sunriseCaptureTime(sunrise: Date): Date {
return new Date(+sunrise + THREADS.captureDelayMs);
}
export async function threadsRequest(token: string, path: string, params: Record<string, string>, method = 'GET', request: typeof fetch = fetch) {