mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-23 08:23:12 +09:00
Add Factorio version management and download functionality
Co-authored-by: danielv <danielv@danielv.no>
This commit is contained in:
1 parent
02d14bd98d
commit
f6424c5411
4 files changed
+209
No files matched your search
@@ -288,3 +288,51 @@ export class HostRevokeTokensRequest {
|
||||
return new this(json.hostId);
|
||||
}
|
||||
}
|
||||
|
||||
export class HostFactorioVersionsRequest {
|
||||
declare ["constructor"]: typeof HostFactorioVersionsRequest;
|
||||
static type = "request" as const;
|
||||
static src = ["control", "controller"] as const;
|
||||
static dst = "host" as const;
|
||||
static permission = "core.host.list" as const;
|
||||
|
||||
static Response = class Response {
|
||||
constructor(
|
||||
public versions: string[],
|
||||
) { }
|
||||
|
||||
static jsonSchema = Type.Object({
|
||||
"versions": Type.Array(Type.String()),
|
||||
});
|
||||
|
||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
||||
return new this(json.versions);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export class HostDownloadFactorioRequest {
|
||||
declare ["constructor"]: typeof HostDownloadFactorioRequest;
|
||||
static type = "request" as const;
|
||||
static src = ["control", "controller"] as const;
|
||||
static dst = "host" as const;
|
||||
static permission = "core.host.update" as const;
|
||||
|
||||
static Response = class Response {
|
||||
constructor(
|
||||
public success: boolean,
|
||||
public version?: string,
|
||||
public error?: string,
|
||||
) { }
|
||||
|
||||
static jsonSchema = Type.Object({
|
||||
"success": Type.Boolean(),
|
||||
"version": Type.Optional(Type.String()),
|
||||
"error": Type.Optional(Type.String()),
|
||||
});
|
||||
|
||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
||||
return new this(json.success, json.version, json.error);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -52,6 +52,8 @@ export const dataClasses: (RequestClass<unknown, unknown> | EventClass<unknown>)
|
||||
host.PrepareControllerDisconnectRequest,
|
||||
host.SyncUserListsEvent,
|
||||
host.HostRevokeTokensRequest,
|
||||
host.HostFactorioVersionsRequest,
|
||||
host.HostDownloadFactorioRequest,
|
||||
|
||||
instance.InstanceDetailsGetRequest,
|
||||
instance.InstanceDetailsListRequest,
|
||||
|
||||
Reference in new issue
Block a user