feat: add zip abilities

This commit is contained in:
TrèsAbhi committed 2025-12-10 17:13:12 -06:00
1 parent 51226c8503
commit 1aec1b2885
2 files changed
+15 -10

No files matched your search

+4 -3
View File
@@ -16,10 +16,11 @@ on:
- blitzkit/assets-dev
default: blitzkit/assets
archive_url:
asset_source:
type: string
required: false
description: Archive URL to download instead of Steam client
description: "Archive URL or Steam to download (example: steam:APP_ID/DEPOT_ID or zip:URL_TO_ZIP)"
default: "steam:444200/444202"
schedule:
- cron: "0 2 * * *"
@@ -78,4 +79,4 @@ jobs:
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- name: Build assets
run: bun run build:assets --all-targets --manual
run: bun run build:assets --all-targets --source=${{ github.event.inputs.asset_source }}
+11 -7
View File
@@ -3,24 +3,28 @@ import { AbstractVFS } from "../core/vfs/abstract";
import { SteamVFS } from "../core/vfs/steam";
import { ZipVFS } from "../core/vfs/zip";
const steamPattern = /steam:(\d+)\/(\d+)/;
const zipPattern = /zip:(.+)/;
const source = Bun.argv
.find((arg) => arg.startsWith("--source="))
?.split("=")[1];
let resolved: AbstractVFS;
if (source === "steam") {
const APP = 444200;
const DEPOT = 444202;
if (!source) {
throw new Error("No source specified");
} else if (steamPattern.test(source)) {
const [, app, depot] = source.match(steamPattern)!.map(Number);
resolved = await new SteamVFS(
assertSecret(import.meta.env.STEAM_USERNAME),
assertSecret(import.meta.env.STEAM_PASSWORD),
APP,
DEPOT
app,
depot
).init();
} else if (source === "zip") {
const url = assertSecret(import.meta.env.ZIP_URL);
} else if (zipPattern.test(source)) {
const [, url] = source.match(zipPattern)!;
resolved = await new ZipVFS(url).init();
} else {
throw new Error("No valid source specified");