import type { FlashAirFileEntry, ThumbnailMeta } from './types'; /** Parse a 16-bit FAT date + time into a JS Date. */ function parseFatDateTime(fatDate: number, fatTime: number): Date { const year = ((fatDate >> 9) & 0x7f) + 1980; const month = (fatDate >> 5) & 0x0f; const day = fatDate & 0x1f; const hour = (fatTime >> 11) & 0x1f; const minute = (fatTime >> 5) & 0x3f; const second = (fatTime & 0x1f) * 2; return new Date(year, month - 1, day, hour, minute, second); } /** Attribute bit 4 indicates a directory. */ function isDirectory(attribute: number): boolean { return (attribute & 0x10) !== 0; } /** * Resolve the base URL for FlashAir API requests. * * In production (served from the card), all requests go to the same origin. * In development, we use the Vite dev server origin (which can proxy if configured). */ function getBaseUrl(): string { return ''; } /** * Parse the text response from command.cgi op=100 into structured entries. * * First line is the header "WLANSD_FILELIST" and is skipped. * Each subsequent line: ,,,,,