2025-11-26 19:27:58 -06:00
|
|
|
import { assertSecret } from "@blitzkit/core";
|
2025-11-29 15:16:09 -06:00
|
|
|
import { AbstractVFS } from "../core/vfs/abstract";
|
|
|
|
|
import { SteamVFS } from "../core/vfs/steam";
|
|
|
|
|
import { ZipVFS } from "../core/vfs/zip";
|
2024-02-20 11:21:01 -06:00
|
|
|
|
2025-11-29 15:16:09 -06:00
|
|
|
const source = Bun.argv
|
|
|
|
|
.find((arg) => arg.startsWith("--source="))
|
|
|
|
|
?.split("=")[1];
|
2025-01-14 19:22:41 -06:00
|
|
|
|
2025-11-29 15:16:09 -06:00
|
|
|
let resolved: AbstractVFS;
|
|
|
|
|
|
|
|
|
|
if (source === "steam") {
|
|
|
|
|
const APP = 444200;
|
|
|
|
|
const DEPOT = 444202;
|
|
|
|
|
|
|
|
|
|
resolved = await new SteamVFS(
|
|
|
|
|
assertSecret(import.meta.env.STEAM_USERNAME),
|
|
|
|
|
assertSecret(import.meta.env.STEAM_PASSWORD),
|
|
|
|
|
APP,
|
|
|
|
|
DEPOT
|
|
|
|
|
).init();
|
|
|
|
|
} else if (source === "zip") {
|
|
|
|
|
const url = assertSecret(import.meta.env.ZIP_URL);
|
|
|
|
|
resolved = await new ZipVFS(url).init();
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error("No valid source specified");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const vfs = resolved;
|