feat: unified abstraction

This commit is contained in:
TrèsAbhi committed 2025-11-25 22:14:09 -06:00
1 parent 7cb67bd44b
commit d3bdbc39d2
2 files changed
+51 -16

No files matched your search

+1
View File
@@ -112,6 +112,7 @@
"leaderboards", "leaderboards",
"lerp", "lerp",
"LINEARSIZE", "LINEARSIZE",
"linktarget",
"lmao", "lmao",
"loadouts", "loadouts",
"loddist", "loddist",
+50 -16
View File
@@ -1,23 +1,57 @@
import SteamUser from "steam-user"; import SteamUser, { EConnectionProtocol } from "steam-user";
export class Steam extends SteamUser { interface SteamManifest {
// call me master hacker the way i be cheesing this up files: {
async logOn(...parameters: Parameters<SteamUser["logOn"]>) { chunks: {
let loggedOn = false; sha: string;
const self = this; crc: number;
offset: string;
cb_original: number;
cb_compressed: number;
}[];
filename: string;
size: string;
flags: number;
sha_filename: string;
sha_content: string;
linktarget: unknown;
}[];
}
this.on("loggedOn", () => { export class SteamVFS {
console.log(`Logged onto ${self.steamID!.steam3()}`); private steam = new SteamUser({ protocol: EConnectionProtocol.TCP });
loggedOn = true;
private manifest: SteamManifest;
constructor(
private username: string,
private password: string,
private app: number,
private depot: number
) {}
async init() {
this.steam.logOn({
accountName: this.username,
password: this.password,
}); });
while (!loggedOn) { await new Promise((resolve) => this.steam.once("loggedOn", resolve));
// @ts-ignore
this._connectionClosed = false;
console.log("Attempting to log on..."); const productInfo = await this.steam.getProductInfo([this.app], []);
super.logOn(...parameters); const manifest = await new Promise((resolve) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); this.steam.getManifest(
} this.app,
this.depot,
productInfo.apps[this.app].appinfo.depots[this.depot].manifests.public
.gid,
"public",
(_, response) => {
resolve(response);
}
);
});
console.log(JSON.stringify(manifest.files[0], null, 2));
} }
} }