mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
154 lines
3.8 KiB
TypeScript
154 lines
3.8 KiB
TypeScript
import * as lib from "@clusterio/lib";
|
|
//%if multi_context
|
|
import * as Messages from "./messages";
|
|
|
|
lib.definePermission({
|
|
name: "__plugin_name__.example.permission.event",
|
|
title: "Example permission event",
|
|
description: "Example Description. Event. Change me in index.ts",
|
|
grantByDefault: true,
|
|
});
|
|
|
|
lib.definePermission({
|
|
name: "__plugin_name__.example.permission.request",
|
|
title: "Example permission request",
|
|
description: "Example Description. Request. Change me in index.ts",
|
|
grantByDefault: true,
|
|
});
|
|
//%endif
|
|
//%if controller & web // Subscribing requires web content and the controller
|
|
|
|
lib.definePermission({
|
|
name: "__plugin_name__.example.permission.subscribe",
|
|
title: "Example permission subscribe",
|
|
description: "Example Description. Subscribe. Change me in index.ts",
|
|
grantByDefault: true,
|
|
});
|
|
//%endif
|
|
//%if web
|
|
|
|
lib.definePermission({
|
|
name: "__plugin_name__.page.view",
|
|
title: "Example page view permission",
|
|
description: "Example Description. View. Change me in index.ts",
|
|
grantByDefault: true,
|
|
});
|
|
//%endif
|
|
//%if config
|
|
|
|
declare module "@clusterio/lib" {
|
|
//%endif
|
|
//%if controller & config
|
|
export interface ControllerConfigFields {
|
|
"__plugin_name__.myControllerField": string;
|
|
}
|
|
//%endif
|
|
//%if host & config
|
|
export interface HostConfigFields {
|
|
"__plugin_name__.myHostField": string;
|
|
}
|
|
//%endif
|
|
//%if instance & config
|
|
export interface InstanceConfigFields {
|
|
"__plugin_name__.myInstanceField": string;
|
|
}
|
|
//%endif
|
|
//%if ctl & config
|
|
export interface ControlConfigFields {
|
|
"__plugin_name__.myControlField": string;
|
|
}
|
|
//%endif
|
|
//%if config
|
|
}
|
|
//%endif
|
|
|
|
export const plugin: lib.PluginDeclaration = {
|
|
name: "__plugin_name__",
|
|
title: "__plugin_name__",
|
|
description: "Example Description. Plugin. Change me in index.ts",
|
|
//%// There are a lot of statements here to make the formatting look good with and without 'config'
|
|
//%if controller | host & !config | instance & !config | ctl & !config // Blank line for formatting
|
|
|
|
//%endif
|
|
//%if controller
|
|
controllerEntrypoint: "./dist/node/controller",
|
|
//%endif
|
|
//%if controller & config
|
|
controllerConfigFields: {
|
|
"__plugin_name__.myControllerField": {
|
|
title: "My Controller Field",
|
|
description: "This should be removed from index.js",
|
|
type: "string",
|
|
initialValue: "Remove Me",
|
|
},
|
|
},
|
|
//%endif
|
|
//%if host & config // Blank line for formatting
|
|
|
|
//%endif
|
|
//%if host
|
|
hostEntrypoint: "./dist/node/host",
|
|
//%endif
|
|
//%if host & config
|
|
hostConfigFields: {
|
|
"__plugin_name__.myHostField": {
|
|
title: "My Host Field",
|
|
description: "This should be removed from index.js",
|
|
type: "string",
|
|
initialValue: "Remove Me",
|
|
},
|
|
},
|
|
//%endif
|
|
//%if instance & config | module & config // Blank line for formatting
|
|
|
|
//%endif
|
|
//%if instance | module // Modules load an empty instance plugin
|
|
instanceEntrypoint: "./dist/node/instance",
|
|
//%endif
|
|
//%if instance & config
|
|
instanceConfigFields: {
|
|
"__plugin_name__.myInstanceField": {
|
|
title: "My Instance Field",
|
|
description: "This should be removed from index.js",
|
|
type: "string",
|
|
initialValue: "Remove Me",
|
|
},
|
|
},
|
|
//%endif
|
|
//%if ctl & config // Blank line for formatting
|
|
|
|
//%endif
|
|
//%if ctl
|
|
ctlEntrypoint: "./dist/node/ctl",
|
|
//%endif
|
|
//%if ctl & config
|
|
controlConfigFields: {
|
|
"__plugin_name__.myControlField": {
|
|
title: "My Control Field",
|
|
description: "This should be removed from index.js",
|
|
type: "string",
|
|
initialValue: "Remove Me",
|
|
},
|
|
},
|
|
//%endif
|
|
//%if multi_context // Subscribing requires multi context
|
|
|
|
messages: [
|
|
Messages.PluginExampleEvent,
|
|
Messages.PluginExampleRequest,
|
|
//%endif
|
|
//%if controller & web // Subscribing requires web content and the controller
|
|
Messages.ExampleSubscribableUpdate,
|
|
//%endif
|
|
//%if multi_context // Subscribing requires multi context
|
|
],
|
|
//%endif
|
|
//%if web // Web content template has an example route which is the plugin name
|
|
|
|
webEntrypoint: "./web",
|
|
routes: [
|
|
"/__plugin_name__",
|
|
],
|
|
//%endif
|
|
};
|