mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 15:33:12 +09:00
Fix types related to plugins and the web interface
This commit is contained in:
1 parent
8b5c66d900
commit
70d2b319b3
10 files changed
+17
-26
No files matched your search
@@ -19,7 +19,7 @@ export interface PluginLoginForm {
|
||||
* supplied the setToken function via its props which should be called
|
||||
* when an authentication token is aquired via this form.
|
||||
*/
|
||||
Component: typeof React.Component;
|
||||
Component: React.ComponentType<{ setToken(token: string): void }>;
|
||||
};
|
||||
|
||||
export type UserAccount = {
|
||||
|
||||
@@ -7,6 +7,7 @@ type Metadata = {
|
||||
x: number;
|
||||
y: number;
|
||||
size: number;
|
||||
localised_name?: any[];
|
||||
};
|
||||
let itemMetadataCache: Map<string, Metadata> | null = null;
|
||||
export function useItemMetadata() {
|
||||
|
||||
@@ -2,7 +2,7 @@ import type * as lib from "@clusterio/lib";
|
||||
|
||||
import { ChatEvent } from "./messages";
|
||||
|
||||
const info: lib.PluginDeclaration = {
|
||||
export default {
|
||||
name: "global_chat",
|
||||
title: "Global Chat",
|
||||
description: "Forwards chat between instances.",
|
||||
@@ -12,6 +12,4 @@ const info: lib.PluginDeclaration = {
|
||||
messages: [
|
||||
ChatEvent,
|
||||
],
|
||||
};
|
||||
|
||||
export default info;
|
||||
} satisfies lib.PluginDeclaration;
|
||||
@@ -40,7 +40,7 @@ lib.definePermission({
|
||||
grantByDefault: true,
|
||||
});
|
||||
|
||||
const info: lib.PluginDeclaration = {
|
||||
export default {
|
||||
name: "inventory_sync",
|
||||
title: "Inventory sync",
|
||||
description: "Synchronizes players inventories between instances",
|
||||
@@ -60,6 +60,4 @@ const info: lib.PluginDeclaration = {
|
||||
],
|
||||
webEntrypoint: "./web",
|
||||
routes: ["/inventory"],
|
||||
};
|
||||
|
||||
export default info;
|
||||
} satisfies lib.PluginDeclaration;
|
||||
@@ -139,7 +139,7 @@ export class DownloadRequest {
|
||||
}
|
||||
}
|
||||
|
||||
class DatabaseStatsResponse {
|
||||
export class DatabaseStatsResponse {
|
||||
constructor(
|
||||
public databaseSize: number,
|
||||
public databaseEntries: number,
|
||||
|
||||
@@ -46,10 +46,10 @@ export class ControllerPlugin extends BaseControllerPlugin {
|
||||
}, 60e3).unref();
|
||||
|
||||
this.controller.app.get("/api/player_auth/servers", (req: Request, res: Response) => {
|
||||
let servers = [];
|
||||
let servers: string[] = [];
|
||||
for (let instance of this.controller.instances!.values()) {
|
||||
if (instance.status === "running" && instance.config.get("player_auth.load_plugin")) {
|
||||
servers.push(instance.config.get("factorio.settings")["name"] || "unnamed server");
|
||||
servers.push(instance.config.get("factorio.settings")["name"] as string || "unnamed server");
|
||||
}
|
||||
}
|
||||
res.send(servers);
|
||||
|
||||
@@ -20,7 +20,7 @@ ControllerConfigGroup.define({
|
||||
});
|
||||
ControllerConfigGroup.finalize();
|
||||
|
||||
const info: lib.PluginDeclaration = {
|
||||
export default {
|
||||
name: "player_auth",
|
||||
title: "Player Auth",
|
||||
description: "Provides authentication to the cluster via logging into a Factorio server.",
|
||||
@@ -33,6 +33,4 @@ const info: lib.PluginDeclaration = {
|
||||
messages.FetchPlayerCodeRequest,
|
||||
messages.SetVerifyCodeRequest,
|
||||
],
|
||||
};
|
||||
|
||||
export default info;
|
||||
} satisfies lib.PluginDeclaration;
|
||||
@@ -2,7 +2,7 @@ import type * as lib from "@clusterio/lib";
|
||||
|
||||
import * as messages from "./messages";
|
||||
|
||||
const info: lib.PluginDeclaration = {
|
||||
export default {
|
||||
name: "research_sync",
|
||||
title: "Research Sync",
|
||||
description: "Synchronises technology research progress between instances.",
|
||||
@@ -15,6 +15,4 @@ const info: lib.PluginDeclaration = {
|
||||
messages.FinishedEvent,
|
||||
messages.SyncTechnologiesRequest,
|
||||
],
|
||||
};
|
||||
|
||||
export default info;
|
||||
} satisfies lib.PluginDeclaration;
|
||||
@@ -12,7 +12,7 @@ InstanceConfigGroup.define({
|
||||
});
|
||||
InstanceConfigGroup.finalize();
|
||||
|
||||
const info: lib.PluginDeclaration = {
|
||||
export default {
|
||||
name: "statistics_exporter",
|
||||
title: "Statistics Exporter",
|
||||
description:
|
||||
@@ -20,6 +20,4 @@ const info: lib.PluginDeclaration = {
|
||||
"statistics to the cluster's Prometheus endpoint.",
|
||||
instanceEntrypoint: "dist/plugin/instance",
|
||||
InstanceConfigGroup,
|
||||
};
|
||||
|
||||
export default info;
|
||||
} satisfies lib.PluginDeclaration;
|
||||
@@ -47,7 +47,7 @@ lib.definePermission({
|
||||
grantByDefault: true,
|
||||
});
|
||||
|
||||
module.exports.default = {
|
||||
export default {
|
||||
name: "subspace_storage",
|
||||
title: "Subspace Storage",
|
||||
description: "Provides shared storage across instances for the Subspace Storage mod",
|
||||
@@ -66,4 +66,4 @@ module.exports.default = {
|
||||
],
|
||||
webEntrypoint: "./web",
|
||||
routes: ["/storage"],
|
||||
};
|
||||
} satisfies lib.PluginDeclaration;
|
||||
Reference in new issue
Block a user