Remove manual runtime controls from server detail
This commit is contained in:
@@ -114,55 +114,61 @@
|
||||
},
|
||||
"pages": [
|
||||
{
|
||||
"key": "overview",
|
||||
"title": "MC 概览",
|
||||
"path": "/overview",
|
||||
"key": "files",
|
||||
"title": "文件管理",
|
||||
"path": "/files",
|
||||
"bundleKey": "minecraft-server-plugin",
|
||||
"bundleVersion": "1.0.0",
|
||||
"bundleIntegritySha256": "sha256:2222222222222222222222222222222222222222222222222222222222222222",
|
||||
"permissions": [
|
||||
"server.read",
|
||||
"server.lifecycle"
|
||||
],
|
||||
"bridgeActions": [
|
||||
"server.instances.read",
|
||||
"jobs.dispatch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "remote",
|
||||
"title": "MC 远程",
|
||||
"path": "/remote",
|
||||
"bundleKey": "minecraft-server-plugin",
|
||||
"bundleVersion": "1.0.0",
|
||||
"bundleIntegritySha256": "sha256:2222222222222222222222222222222222222222222222222222222222222222",
|
||||
"permissions": [
|
||||
"server.remote.access",
|
||||
"server.files.read",
|
||||
"server.files.write",
|
||||
"server.logs.read"
|
||||
],
|
||||
"bridgeActions": [
|
||||
"remote.access.request",
|
||||
"server.instances.read",
|
||||
"files.request",
|
||||
"logs.query"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "rcon",
|
||||
"title": "MC RCON",
|
||||
"path": "/rcon",
|
||||
"key": "mods-market",
|
||||
"title": "mod/插件市场",
|
||||
"path": "/mods-market",
|
||||
"bundleKey": "minecraft-server-plugin",
|
||||
"bundleVersion": "1.0.0",
|
||||
"bundleIntegritySha256": "sha256:2222222222222222222222222222222222222222222222222222222222222222",
|
||||
"permissions": [
|
||||
"server.remote.access"
|
||||
"server.read",
|
||||
"server.artifacts.read",
|
||||
"server.files.read"
|
||||
],
|
||||
"bridgeActions": [
|
||||
"remote.access.request"
|
||||
"server.instances.read",
|
||||
"artifacts.open"
|
||||
]
|
||||
}
|
||||
],
|
||||
"fileWorkspace": {
|
||||
"defaultDirectoryKey": "minecraft-config",
|
||||
"directories": [
|
||||
{ "key": "minecraft-config", "label": "服务器配置", "scope": "config" },
|
||||
{ "key": "minecraft-logs", "label": "日志文件", "scope": "logs" }
|
||||
],
|
||||
"files": [
|
||||
{ "key": "server-properties", "directoryKey": "minecraft-config", "label": "server.properties", "kind": "config", "editable": true },
|
||||
{ "key": "ops-json", "directoryKey": "minecraft-config", "label": "ops.json", "kind": "config", "editable": true },
|
||||
{ "key": "whitelist-json", "directoryKey": "minecraft-config", "label": "whitelist.json", "kind": "config", "editable": true },
|
||||
{ "key": "minecraft-latest-log", "directoryKey": "minecraft-logs", "label": "latest.log", "kind": "log", "streamKey": "minecraft.latest" }
|
||||
],
|
||||
"configFields": [
|
||||
{ "key": "motd", "fileKey": "server-properties", "configKey": "motd", "label": "服务器名称", "description": "显示在 Minecraft 服务器列表中的 MOTD。", "control": "text", "defaultValue": "Minecraft Server", "restartImpact": "restart-required" },
|
||||
{ "key": "server-port", "fileKey": "server-properties", "configKey": "server-port", "label": "游戏端口", "description": "Minecraft Java 客户端连接端口。", "control": "port", "minimum": 1, "maximum": 65535, "defaultValue": "25565", "restartImpact": "restart-required" },
|
||||
{ "key": "max-players", "fileKey": "server-properties", "configKey": "max-players", "label": "最大玩家数", "description": "允许同时进入服务器的玩家上限。", "control": "number", "minimum": 1, "maximum": 200, "defaultValue": "20", "restartImpact": "restart-required" },
|
||||
{ "key": "online-mode", "fileKey": "server-properties", "configKey": "online-mode", "label": "正版验证", "description": "是否启用 Mojang 在线身份验证。", "control": "boolean", "defaultValue": "true", "restartImpact": "restart-required" }
|
||||
]
|
||||
},
|
||||
"ai": {
|
||||
"purposes": [
|
||||
"config.suggest",
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
export const pluginPageBundle = { key: "minecraft-server-plugin", version: "1.0.0", integritySha256: "sha256:2222222222222222222222222222222222222222222222222222222222222222" };
|
||||
|
||||
type ReactLike = { createElement: (...args: any[]) => any };
|
||||
|
||||
export function renderPluginPage(react: ReactLike, input: any) {
|
||||
const e = react.createElement;
|
||||
const pageKey = input.page?.key ?? "files";
|
||||
const workspace = input.workspace;
|
||||
if (pageKey === "mods-market") return renderModsMarket(e, input);
|
||||
return renderFiles(e, input, workspace);
|
||||
}
|
||||
|
||||
function renderFiles(e: ReactLike["createElement"], input: any, workspace: any) {
|
||||
const files = workspace?.files ?? [];
|
||||
return e("section", { className: "console-panel", "aria-label": "Minecraft 文件管理" },
|
||||
e("div", { className: "panel-header" },
|
||||
e("div", null, e("h2", null, "文件管理"), e("p", { className: "provider-id" }, "server.properties、白名单、OP 列表和日志由 Minecraft 插件声明。")),
|
||||
e("span", { className: "page-status" }, input.context?.serverInstanceId ? "已绑定服务器" : "未绑定服务器")
|
||||
),
|
||||
e("div", { className: "console-row-list" },
|
||||
files.length ? files.map((file: any) => e("div", { key: file.key, className: "console-row" }, e("span", null, file.label), e("strong", null, file.kind === "config" ? file.editable === false ? "配置只读" : "配置可写" : "日志只读"))) : e("div", { className: "console-row" }, e("span", null, "声明文件"), e("strong", null, "等待插件工作区"))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function renderModsMarket(e: ReactLike["createElement"], input: any) {
|
||||
return e("section", { className: "console-panel", "aria-label": "Minecraft mod 插件市场" },
|
||||
e("div", { className: "panel-header" },
|
||||
e("div", null, e("h2", null, "mod/插件市场"), e("p", { className: "provider-id" }, "Minecraft 插件拥有自己的 mod/插件入口;平台只提供安全托管上下文。")),
|
||||
e("span", { className: "page-status" }, input.availability?.available ? "运行端可用" : input.availability?.reason ?? "等待运行端")
|
||||
),
|
||||
e("div", { className: "console-row-list" },
|
||||
e("div", { className: "console-row" }, e("span", null, "服务器"), e("strong", null, input.context?.serverInstanceId ?? "未绑定")),
|
||||
e("div", { className: "console-row" }, e("span", null, "权限"), e("strong", null, (input.context?.permissions ?? []).join(" / ") || "未声明")),
|
||||
e("div", { className: "console-row" }, e("span", null, "安装策略"), e("strong", null, "由 Minecraft 插件声明和审核"))
|
||||
)
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user