mirror of
https://github.com/misenhower/splatoon3.ink.git
synced 2026-11-18 16:58:18 -06:00
Replace the remaining Node-only dependencies so the updaters and social posters bundle and run in workerd, while the Node runner keeps working: - Replace nxapi with app/splatnet/coral.mjs (fetch + WebCrypto), aligned with nxapi 1.6.1-next.257: znca compatibility 3.5.0, the current client version, and the slimmer Login parameter. Use one znca-api client per Nintendo account, since its token binds to the first account it serves. Cache the remote config in private storage instead of restarting daily. Sessions cached by the nxapi package trigger a fresh login. - Convert images through #image-converter: sharp in Node, the Images binding in Workers. Read Bluesky aspect ratios from the PNG header. - Replace twitter-api-v2 with OAuth 1.0a signed fetch; TwitterClient now only updates the seasonal X profile (posts go through Buffer). - Load avatars through #avatars (bundled as Data modules in Workers) and keep the local Chrome driver out of Worker bundles via #local-screenshot-driver. - prefixedConsole forwards to the global console; shared code reports to Sentry through @sentry/core. Verified live: full credential refresh for all four regions in Node, and the complete Coral → bullet token → GraphQL chain for EU inside workerd. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17 lines
549 B
JavaScript
17 lines
549 B
JavaScript
/**
|
|
* Width and height from a PNG's IHDR chunk.
|
|
* @param {Uint8Array} bytes
|
|
* @returns {{ width: number, height: number }|null} The size, or null if the bytes are not a PNG
|
|
*/
|
|
export function pngSize(bytes) {
|
|
let signature = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
|
|
|
|
if (!bytes || bytes.length < 24 || !signature.every((byte, index) => bytes[index] === byte)) {
|
|
return null;
|
|
}
|
|
|
|
let view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
|
|
return { width: view.getUint32(16), height: view.getUint32(20) };
|
|
}
|