mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: add zip abilities
This commit is contained in:
1 parent
51226c8503
commit
1aec1b2885
2 files changed
+15
-10
No files matched your search
@@ -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 }}
|
||||
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user