Add version and connect button to player auth

This commit is contained in:
Cooldude2606 committed 2026-05-31 23:55:43 +01:00
1 parent f2ca465ec6
commit f2ccde0dd6
3 files changed
+111 -18

No files matched your search

+27
View File
@@ -1,5 +1,32 @@
import { Type, Static } from "@sinclair/typebox";
export class PlayerAuthServer {
declare ["constructor"]: typeof PlayerAuthServer;
static jsonSchema = Type.Object({
name: Type.String(),
address: Type.String(),
factorioVersion: Type.Optional(Type.String()),
});
constructor(
public name: string,
public address: string,
public factorioVersion?: string,
) {}
toJSON(): Static<typeof PlayerAuthServer.jsonSchema> {
if (this.factorioVersion === undefined) {
return { name: this.name, address: this.address };
}
return { name: this.name, address: this.address, factorioVersion: this.factorioVersion };
}
static fromJSON(json: Static<typeof PlayerAuthServer.jsonSchema>) {
return new this(json.name, json.address, json.factorioVersion);
}
}
class FetchPlayerCodeResponse {
constructor(
public playerCode: string,