CI / Typecheck, lint, tests, e2e (push) Failing after 3m51s
- Title screen over a real-time voxel office rendered at low resolution and quantized to a rotating 32-colour palette with Bayer dithering; day part and season re-light the scene and every surface. - 16-bit UI kit: name-plate dialogs, menu cursor, inventory, XP bar, badges, NPC speech, GAME OVER with CONTINUE, hand-placed 12x12 icons, Fusion Pixel font (Latin subset preloaded). - Sections as a game: quest log (onboarding), character select (AI CEO / AI Co-Founder), inventory (features), party roster (providers), live download XP, save point (all v1.5.1 builds), FAQ as NPC dialog, credits. - Downloads and source point to the Gitea release; the download function only redirects to git.zacharyzhang.com. - Tailwind and the old components removed; unit tests for platform/downloads, rewritten e2e suite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import type { CounterDatabase, PagesHandler } from "../types";
|
|
import { DOWNLOAD_COUNT_SEED } from "../../lib/downloads";
|
|
|
|
interface Env {
|
|
DOWNLOAD_COUNTER_DB: CounterDatabase;
|
|
}
|
|
|
|
async function readDownloadCount(db: CounterDatabase) {
|
|
const result = await db
|
|
.prepare(`
|
|
SELECT
|
|
COALESCE(
|
|
(SELECT value FROM download_counter_settings WHERE key = 'base_downloads'),
|
|
?
|
|
) + COUNT(*) AS downloads
|
|
FROM unique_download_windows
|
|
`)
|
|
.bind(DOWNLOAD_COUNT_SEED)
|
|
.first<{ downloads: number }>();
|
|
|
|
if (!result) {
|
|
throw new Error("Download count query returned no row.");
|
|
}
|
|
return result.downloads;
|
|
}
|
|
|
|
export const onRequestGet: PagesHandler<Env> = async (context) => {
|
|
if (!context.env.DOWNLOAD_COUNTER_DB) {
|
|
throw new Error("DOWNLOAD_COUNTER_DB binding is missing.");
|
|
}
|
|
const downloads = await readDownloadCount(context.env.DOWNLOAD_COUNTER_DB);
|
|
return Response.json(
|
|
{ downloads },
|
|
{
|
|
headers: {
|
|
"Cache-Control": "no-store",
|
|
},
|
|
},
|
|
);
|
|
};
|