Remove pre-1.0 audit and protected request scaffolding
This commit is contained in:
@@ -19,7 +19,7 @@ function renderOverviewPage(e: ReactLike["createElement"], input: any) {
|
||||
}
|
||||
|
||||
function renderConfigPage(e: ReactLike["createElement"], input: any) {
|
||||
return renderPanel(e, "配置工作台", "配置入口由插件页面声明,平台只提供受控上下文。", input, [
|
||||
return renderPanel(e, "配置工作台", "配置入口由插件页面声明,平台只提供运行上下文。", input, [
|
||||
["文件权限", (input.context?.permissions ?? []).filter((value: string) => value.includes("files")).join(" / ") || "未声明"],
|
||||
["AI 能力", (input.context?.permissions ?? []).includes("ai.invoke") ? "可请求平台 AI" : "未声明"],
|
||||
["写入策略", "平台审查后派发"]
|
||||
|
||||
@@ -14,7 +14,7 @@ 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("div", null, e("h2", null, "文件管理"), e("p", { className: "provider-id" }, "server.properties、whitelist.json、OP 列表和日志由 Minecraft 插件声明。")),
|
||||
e("span", { className: "page-status" }, input.context?.serverInstanceId ? "已绑定服务器" : "未绑定服务器")
|
||||
),
|
||||
e("div", { className: "console-row-list" },
|
||||
|
||||
@@ -14,4 +14,4 @@ access.
|
||||
Semantic events come from bounded Run stdout/stderr console records. Unknown
|
||||
records create diagnostics and never produce fabricated events. DSNs, rows,
|
||||
connections, and credentials do not leave Run; request text is protected and
|
||||
redacted from browser and audit projections.
|
||||
redacted from browser and platform projections.
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
var errAdapterUnsupported = errors.New("runtime capability is unavailable")
|
||||
|
||||
// AuthorizedConfigPort is supplied through the platform-authorized Run channel.
|
||||
// It exposes logical, allowlisted configuration values only; it never exposes a
|
||||
// It exposes logical, declared configuration values only; it never exposes a
|
||||
// path, DSN, credential, arbitrary command, or database handle.
|
||||
type AuthorizedConfigPort interface {
|
||||
ReadConfig(context.Context) (map[string]string, error)
|
||||
@@ -25,7 +25,7 @@ type ConfigFieldPatch struct {
|
||||
}
|
||||
|
||||
// AuthorizedGameDataPort is a typed, Run-owned read/patch boundary. Implementations
|
||||
// must probe their local schema, use field allowlists and safe windows, and return
|
||||
// must probe their local schema, use declared fields and safe windows, and return
|
||||
// bounded snapshots rather than rows or connection details.
|
||||
type AuthorizedGameDataPort interface {
|
||||
ReadPlayerState(context.Context, string, []string) (PlayerStateSnapshot, error)
|
||||
@@ -109,11 +109,11 @@ type UE4SSNotificationPort interface {
|
||||
}
|
||||
type UE4SSNotificationReceipt struct{ Accepted bool }
|
||||
type ue4SSPlayerNotification struct {
|
||||
ServerID string
|
||||
RecipientSteamID string
|
||||
Message string
|
||||
chatType int
|
||||
protectedAuditCommand string
|
||||
ServerID string
|
||||
RecipientSteamID string
|
||||
Message string
|
||||
chatType int
|
||||
localCommandPreview string
|
||||
}
|
||||
type UE4SSVehicleSpawnPort interface {
|
||||
SpawnVehicle(context.Context, ue4SSVehicleSpawn) (UE4SSVehicleSpawnReceipt, error)
|
||||
@@ -128,9 +128,9 @@ const (
|
||||
|
||||
type UE4SSVehicleSpawnReceipt struct{ Outcome UE4SSVehicleSpawnOutcome }
|
||||
type ue4SSVehicleSpawn struct {
|
||||
ServerID string
|
||||
VehicleCode string
|
||||
protectedAuditCommand string
|
||||
ServerID string
|
||||
VehicleCode string
|
||||
localCommandPreview string
|
||||
}
|
||||
|
||||
// RuntimeAdapter is bound to one server. Availability is discovered from its
|
||||
@@ -312,13 +312,13 @@ func newUE4SSPlayerNotification(serverID, playerID, message string) (ue4SSPlayer
|
||||
if strings.TrimSpace(serverID) == "" || !steamID64(playerID) || !validNotificationMessage(message) {
|
||||
return ue4SSPlayerNotification{}, fmt.Errorf("invalid typed notification")
|
||||
}
|
||||
return ue4SSPlayerNotification{ServerID: serverID, RecipientSteamID: playerID, Message: message, chatType: fixedNotificationType, protectedAuditCommand: "SendChat 4 \"" + escapeUE4SSChatMessage(message) + "\" " + playerID}, nil
|
||||
return ue4SSPlayerNotification{ServerID: serverID, RecipientSteamID: playerID, Message: message, chatType: fixedNotificationType, localCommandPreview: "SendChat 4 \"" + escapeUE4SSChatMessage(message) + "\" " + playerID}, nil
|
||||
}
|
||||
func newUE4SSVehicleSpawn(serverID, vehicleCode string) (ue4SSVehicleSpawn, error) {
|
||||
if strings.TrimSpace(serverID) == "" || !supportedVehicleSpawnCode(vehicleCode) {
|
||||
return ue4SSVehicleSpawn{}, fmt.Errorf("invalid typed vehicle spawn")
|
||||
}
|
||||
return ue4SSVehicleSpawn{ServerID: serverID, VehicleCode: vehicleCode, protectedAuditCommand: "#spawnvehicle " + vehicleCode}, nil
|
||||
return ue4SSVehicleSpawn{ServerID: serverID, VehicleCode: vehicleCode, localCommandPreview: "#spawnvehicle " + vehicleCode}, nil
|
||||
}
|
||||
func steamID64(value string) bool {
|
||||
if len(value) != 17 {
|
||||
|
||||
@@ -105,13 +105,13 @@ func TestSupportedAdaptersDispatchThroughIsolatedTypedPorts(t *testing.T) {
|
||||
if err := dispatcher.DispatchOnce(context.Background()); err != nil {
|
||||
t.Fatalf("dispatch supported adapters: %v", err)
|
||||
}
|
||||
if len(port.notifications) != 1 || port.notifications[0].ServerID != "server-1" || port.notifications[0].protectedAuditCommand == "" {
|
||||
if len(port.notifications) != 1 || port.notifications[0].ServerID != "server-1" || port.notifications[0].localCommandPreview == "" {
|
||||
t.Fatalf("notification did not remain server-bound and idempotent: %+v", port.notifications)
|
||||
}
|
||||
if len(port.patches) != 1 || gateway.completed["config-read"][0].Payload["fields"].(map[string]string)["ServerName"] != "Moonlight" || gateway.completed["config-patch"][0].Payload["appliedFields"].(map[string]string)["ServerName"] != "Moonlight" || gateway.completed["notify"][0].Payload["accepted"] != true {
|
||||
t.Fatalf("supported adapters did not return their bounded successful results: patches=%+v completed=%+v", port.patches, gateway.completed)
|
||||
}
|
||||
if len(port.spawns) != 3 || port.spawns[0].protectedAuditCommand != "#spawnvehicle BPC_Laika_C" || port.spawns[1].protectedAuditCommand != "#spawnvehicle BPC_WolfsWagen_C" || port.spawns[2].protectedAuditCommand != "#spawnvehicle BPC_Laika_C" {
|
||||
if len(port.spawns) != 3 || port.spawns[0].localCommandPreview != "#spawnvehicle BPC_Laika_C" || port.spawns[1].localCommandPreview != "#spawnvehicle BPC_WolfsWagen_C" || port.spawns[2].localCommandPreview != "#spawnvehicle BPC_Laika_C" {
|
||||
t.Fatalf("vehicle adapter did not use only fixed private templates: %+v", port.spawns)
|
||||
}
|
||||
if gateway.completed["spawn-success"][0].Payload["outcome"] != "succeeded" || gateway.completed["spawn-failed"][0].Payload["outcome"] != "failed" || gateway.completed["spawn-unknown"][0].Payload["outcome"] != "unknown" {
|
||||
@@ -173,8 +173,8 @@ func TestSupportedAdapterTransportFailuresCompleteWithoutProtectedOutput(t *test
|
||||
t.Fatalf("%s did not redact failed typed-port output: %+v", id, result)
|
||||
}
|
||||
}
|
||||
if len(port.notifications) != 1 || port.notifications[0].protectedAuditCommand == "" {
|
||||
t.Fatalf("notification fixture did not receive one protected typed request: %+v", port.notifications)
|
||||
if len(port.notifications) != 1 || port.notifications[0].localCommandPreview == "" {
|
||||
t.Fatalf("notification fixture did not receive one typed request: %+v", port.notifications)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -197,10 +197,10 @@ func TestUE4SSNotificationIsTypedAndRedacted(t *testing.T) {
|
||||
t.Fatalf("typed notification was not delivered: result=%+v err=%v deliveries=%+v", result, err, port.deliveries)
|
||||
}
|
||||
delivery := port.deliveries[0]
|
||||
if delivery.ServerID != "server-1" || delivery.chatType != fixedNotificationType || delivery.protectedAuditCommand != "SendChat 4 \"Moon \\\"gift\\\"\" 76561198000000001" {
|
||||
if delivery.ServerID != "server-1" || delivery.chatType != fixedNotificationType || delivery.localCommandPreview != "SendChat 4 \"Moon \\\"gift\\\"\" 76561198000000001" {
|
||||
t.Fatalf("notification did not use the fixed UE4SS contract: %+v", delivery)
|
||||
}
|
||||
if result["message"] == delivery.protectedAuditCommand || result["command"] != nil || result["rcon"] != nil {
|
||||
if result["message"] == delivery.localCommandPreview || result["command"] != nil || result["rcon"] != nil {
|
||||
t.Fatalf("notification leaked protected transport details: %+v", result)
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ func TestNotificationFailureIsCachedWithoutInvokingRewardDelivery(t *testing.T)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVersionedVehicleSpawnUsesFixedTemplateAndPrivateAuditOnly(t *testing.T) {
|
||||
func TestVersionedVehicleSpawnUsesFixedTemplateAndPrivatePreviewOnly(t *testing.T) {
|
||||
port := &nonProductionVehicleSpawnPortFixture{receipt: UE4SSVehicleSpawnReceipt{Outcome: UE4SSVehicleSpawnAccepted}}
|
||||
adapter := RuntimeAdapter{BoundServerID: "server-1", VehicleSpawn: port}
|
||||
result, err := adapter.SpawnVehicle(context.Background(), map[string]any{"vehicleCode": "BPC_Laika_C"})
|
||||
@@ -238,10 +238,10 @@ func TestVersionedVehicleSpawnUsesFixedTemplateAndPrivateAuditOnly(t *testing.T)
|
||||
t.Fatalf("fixed vehicle spawn was not delivered: result=%+v err=%v requests=%+v", result, err, port.requests)
|
||||
}
|
||||
request := port.requests[0]
|
||||
if request.ServerID != "server-1" || request.VehicleCode != "BPC_Laika_C" || request.protectedAuditCommand != "#spawnvehicle BPC_Laika_C" {
|
||||
if request.ServerID != "server-1" || request.VehicleCode != "BPC_Laika_C" || request.localCommandPreview != "#spawnvehicle BPC_Laika_C" {
|
||||
t.Fatalf("vehicle spawn did not use the fixed template: %+v", request)
|
||||
}
|
||||
if result["command"] != nil || result["rcon"] != nil || result["audit"] != nil || result["outcome"] == request.protectedAuditCommand {
|
||||
if result["command"] != nil || result["rcon"] != nil || result["outcome"] == request.localCommandPreview {
|
||||
t.Fatalf("vehicle spawn leaked protected transport details: %+v", result)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ func TestRunOneShotSmokeLeavesUnsupportedCommandUnackedAndUnexecuted(t *testing.
|
||||
return jsonHTTPResponse(http.StatusOK, heartbeatResponse{Accepted: true, InstallationID: config.Component.InstallationID, Status: "online", Health: "healthy", NextHeartbeatSeconds: 30, SessionExpiresAt: sessionExpiry, ServerTime: stamp}), nil
|
||||
case 2:
|
||||
step++
|
||||
return jsonHTTPResponse(http.StatusOK, claimResponse{Items: []ClaimedCommand{{ID: "unsupported-1", ProfileKey: ProfileKey, CommandType: "announcement.send", Payload: map[string]any{"message": "must not execute"}, FencingToken: 18, LeaseExpiresAt: stamp.Add(time.Minute), ExpiresAt: stamp.Add(5 * time.Minute)}}, Count: 1}), nil
|
||||
return jsonHTTPResponse(http.StatusOK, claimResponse{Items: []ClaimedCommand{{ID: "unsupported-1", ProfileKey: ProfileKey, CommandType: "diagnostic.unsupported", Payload: map[string]any{"message": "must not execute"}, FencingToken: 18, LeaseExpiresAt: stamp.Add(time.Minute), ExpiresAt: stamp.Add(5 * time.Minute)}}, Count: 1}), nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported command triggered transport: %s", request.URL.Path)
|
||||
}
|
||||
|
||||
@@ -24,5 +24,5 @@ export function createSCUMFeatureAPI(bridge: PluginFeatureBridge, availableFeatu
|
||||
};
|
||||
}
|
||||
|
||||
function commandResult(result: { status: string; result?: Record<string, string>; error?: { message: string } }): SCUMCommandResult { if (result.status === "queued") return { status: "queued", summary: result.result?.summary ?? "已进入受控队列。" }; if (result.status === "unsupported") return { status: "unsupported", summary: result.error?.message ?? "当前运行时不支持此操作。" }; return { status: "failed", summary: result.error?.message ?? "受控操作未被接受。" }; }
|
||||
function commandResult(result: { status: string; result?: Record<string, string>; error?: { message: string } }): SCUMCommandResult { if (result.status === "queued") return { status: "queued", summary: result.result?.summary ?? "已进入任务队列。" }; if (result.status === "unsupported") return { status: "unsupported", summary: result.error?.message ?? "当前运行时不支持此操作。" }; return { status: "failed", summary: result.error?.message ?? "操作未被接受。" }; }
|
||||
function decode<T>(result: Record<string, string> | undefined): T | null { const payload = result?.payload; if (!payload) return null; try { return JSON.parse(payload) as T; } catch { return null; } }
|
||||
|
||||
@@ -6,7 +6,7 @@ export type SCUMMigrationProvenance = "plugin" | "transitional-read-only";
|
||||
export type SCUMMigrationRecord<T = Record<string, unknown>> = { provenance: SCUMMigrationProvenance; readOnly: boolean; payload: T; recordedAt: string; sourceRecordId?: string };
|
||||
export type SCUMFeatureMigrationAuthority = { serverInstanceId: string; feature: SCUMFeatureKey; authority: "plugin" | "transitional-read-only"; reason?: string };
|
||||
export type SCUMFeatureMigrationStatus = { authority: "plugin" | "transitional-read-only"; readOnlyHistory: true; pluginWritesEnabled: boolean; reason?: string };
|
||||
export type SCUMCommandResult = { status: "delivered" | "failed" | "unknown" | "unsupported" | "validation-failed" | "queued"; summary: string; audit?: Record<string, unknown> };
|
||||
export type SCUMCommandResult = { status: "delivered" | "failed" | "unknown" | "unsupported" | "validation-failed" | "queued"; summary: string };
|
||||
export type SCUMVehicleSpawn = { vehicleCode: string };
|
||||
export type SCUMVehicleSpawnOption = { code: string; label: string };
|
||||
export type SCUMLogicalDirectory = { key: string; label: string; scope: "config" | "logs" };
|
||||
|
||||
@@ -23,7 +23,7 @@ export function migratePlayerRecord(record: Record<string, unknown>): SCUMMigrat
|
||||
}
|
||||
|
||||
export function migrateConfigurationRecord(record: Record<string, unknown>): SCUMMigrationRecord<SCUMConfigRead> | null {
|
||||
const fields = allowlistedConfigFields(record.fields); const observedAt = timestamp(record.observedAt) ?? timestamp(record.updatedAt); if (!fields || !observedAt) return null;
|
||||
const fields = declaredConfigFields(record.fields); const observedAt = timestamp(record.observedAt) ?? timestamp(record.updatedAt); if (!fields || !observedAt) return null;
|
||||
return transitionalReadOnly({ fields, observedAt }, observedAt, text(record.id));
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ function migratePoint(value: unknown, defaultSubjectId: string, defaultSubjectTy
|
||||
function migrateSession(value: unknown, defaultPlayerId: string): SCUMPlayerSession | null { const record = object(value); const id = record && text(record.id); const playerId = record && (text(record.gamePlayerRecordId) ?? text(record.playerId) ?? defaultPlayerId); const startedAt = record && timestamp(record.startedAt); if (!id || !playerId || !startedAt) return null; const endedAt = timestamp(record.endedAt); return { id, playerId, kind: endedAt ? "logout" : "login", occurredAt: endedAt ?? startedAt }; }
|
||||
function migrateRisk(value: unknown): SCUMPlayerRisk | null { const record = object(value); const observedAt = record && (timestamp(record.occurredAt) ?? timestamp(record.lastObservedAt)); const kind = record && (text(record.ruleKey) ?? text(record.outcome)); const summary = record && (text(record.summary) ?? text(record.reason)); if (!observedAt || !kind || !summary) return null; return { kind, level: "medium", observedAt, summary }; }
|
||||
function migrateStateChange(value: unknown): { fieldKey: string; before: number; after: number } | null { const record = object(value); if (!record) return null; const fieldKey = text(record.fieldKey); const before = number(record.before); const after = number(record.after); return fieldKey && before !== undefined && after !== undefined ? { fieldKey, before, after } : null; }
|
||||
function allowlistedConfigFields(value: unknown): Record<string, string> | null { const fields = object(value); const allowed = new Set(configurationCatalog.map((field) => field.configKey)); if (!fields || !allowed.size) return null; const result: Record<string, string> = {}; for (const [key, field] of Object.entries(fields)) { if (allowed.has(key) && (typeof field === "string" || typeof field === "number" || typeof field === "boolean")) result[key] = String(field); } return Object.keys(result).length ? result : null; }
|
||||
function declaredConfigFields(value: unknown): Record<string, string> | null { const fields = object(value); const allowed = new Set(configurationCatalog.map((field) => field.configKey)); if (!fields || !allowed.size) return null; const result: Record<string, string> = {}; for (const [key, field] of Object.entries(fields)) { if (allowed.has(key) && (typeof field === "string" || typeof field === "number" || typeof field === "boolean")) result[key] = String(field); } return Object.keys(result).length ? result : null; }
|
||||
function giftStatus(value: unknown): SCUMGiftGrant["status"] | null { return value === "pending-approval" || value === "queued" || value === "delivered" || value === "notification_failed" || value === "failed" || value === "unknown" ? value : null; }
|
||||
function stateStatus(value: unknown): SCUMStatePatch["status"] | null { if (value === "pending-approval" || value === "queued" || value === "unsupported" || value === "unknown" || value === "execution-unknown") return value === "execution-unknown" ? "unknown" : value; if (value === "confirmed") return "succeeded"; return value === "execution-failed" || value === "confirmation-failed" || value === "failed" ? "failed" : null; }
|
||||
function trajectorySubjectType(record: Record<string, unknown>): SCUMTrajectoryPoint["subjectType"] | null { if (record.kind === "player" || record.kind === "vehicle") return record.kind; return text(record.playerRecordId) || text(record.gamePlayerRecordId) ? "player" : text(record.vehicleId) ? "vehicle" : null; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { SCUMConfigField, SCUMConfigPatch, SCUMFeatureAvailability, SCUMStateField, SCUMVehicleSpawn, SCUMVehicleSpawnOption } from "./contracts.js";
|
||||
|
||||
// These are safe fallback allowlists. A Companion schema probe may narrow them
|
||||
// These are safe fallback plugin catalogs. A Companion schema probe may narrow them
|
||||
// per server, but a game version never enables or disables a feature.
|
||||
export const configurationCatalog: readonly SCUMConfigField[] = [
|
||||
{ key: "server-name", fileKey: "scum-server-settings", configKey: "ServerName", label: "服务器名称", description: "显示在服务器浏览器与玩家连接界面。", control: "text", defaultValue: "SCUM Server", restartImpact: "restart-required" },
|
||||
@@ -13,6 +13,6 @@ export const vehicleSpawnCatalog: readonly SCUMVehicleSpawnOption[] = [{ code: "
|
||||
export const stateFieldCatalog: readonly Omit<SCUMStateField, "value" | "editable" | "reason">[] = [{ key: "skills.running", label: "跑步技能", minimum: 0, maximum: 1000000 }, { key: "attributes.strength", label: "力量属性", minimum: 1, maximum: 8 }];
|
||||
export function supportsStateField(field: string): boolean { return stateFieldCatalog.some((candidate) => candidate.key === field); }
|
||||
export function featureUnavailable(reason: string): SCUMFeatureAvailability { return { feature: "configuration", available: false, reason }; }
|
||||
export function validateConfigPatch(patch: SCUMConfigPatch): string | null { if (!patch.idempotencyKey.trim() || !patch.reason.trim() || !patch.changes.length) return "配置修改必须包含原因、幂等键和至少一项变更。"; for (const change of patch.changes) { const field = configurationCatalog.find((candidate) => candidate.key === change.key); if (!field) return `字段 ${change.key} 不在受控目录中。`; if (!change.value.trim()) return `字段 ${field.label} 不能为空。`; if ((field.control === "number" || field.control === "port") && (!Number.isInteger(Number(change.value)) || (field.minimum !== undefined && Number(change.value) < field.minimum) || (field.maximum !== undefined && Number(change.value) > field.maximum))) return `字段 ${field.label} 超出允许范围。`; } return null; }
|
||||
export function validateStatePatch(fields: Array<{ fieldKey: string; before: number; after: number }>): string | null { if (!fields.length) return "状态修改至少需要一个字段。"; for (const field of fields) { const definition = stateFieldCatalog.find((candidate) => candidate.key === field.fieldKey); if (!definition) return `字段 ${field.fieldKey} 不在运行时字段白名单中。`; if (!Number.isFinite(field.before) || !Number.isFinite(field.after) || field.after < definition.minimum || field.after > definition.maximum) return `字段 ${definition.label} 超出允许范围。`; } return null; }
|
||||
export function validateVehicleSpawn(spawn: SCUMVehicleSpawn): string | null { if (!/^[A-Za-z][A-Za-z0-9_]{2,63}$/.test(spawn.vehicleCode)) return "载具代码格式无效。"; if (!vehicleSpawnCatalog.some((candidate) => candidate.code === spawn.vehicleCode)) return "载具代码未在受控目录中声明。"; return null; }
|
||||
export function validateConfigPatch(patch: SCUMConfigPatch): string | null { if (!patch.idempotencyKey.trim() || !patch.reason.trim() || !patch.changes.length) return "配置修改必须包含原因、幂等键和至少一项变更。"; for (const change of patch.changes) { const field = configurationCatalog.find((candidate) => candidate.key === change.key); if (!field) return `字段 ${change.key} 不在插件目录中。`; if (!change.value.trim()) return `字段 ${field.label} 不能为空。`; if ((field.control === "number" || field.control === "port") && (!Number.isInteger(Number(change.value)) || (field.minimum !== undefined && Number(change.value) < field.minimum) || (field.maximum !== undefined && Number(change.value) > field.maximum))) return `字段 ${field.label} 超出允许范围。`; } return null; }
|
||||
export function validateStatePatch(fields: Array<{ fieldKey: string; before: number; after: number }>): string | null { if (!fields.length) return "状态修改至少需要一个字段。"; for (const field of fields) { const definition = stateFieldCatalog.find((candidate) => candidate.key === field.fieldKey); if (!definition) return `字段 ${field.fieldKey} 未在插件运行时目录中声明。`; if (!Number.isFinite(field.before) || !Number.isFinite(field.after) || field.after < definition.minimum || field.after > definition.maximum) return `字段 ${definition.label} 超出允许范围。`; } return null; }
|
||||
export function validateVehicleSpawn(spawn: SCUMVehicleSpawn): string | null { if (!/^[A-Za-z][A-Za-z0-9_]{2,63}$/.test(spawn.vehicleCode)) return "载具代码格式无效。"; if (!vehicleSpawnCatalog.some((candidate) => candidate.code === spawn.vehicleCode)) return "载具代码未在插件目录中声明。"; return null; }
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
"remote.run.process.stop",
|
||||
"remote.run.logs.transfer",
|
||||
"remote.run.protected.sql",
|
||||
"remote.run.protected.rcon",
|
||||
"remote.run.rcon.command",
|
||||
"remote.run.program.command",
|
||||
"client-manager.deploy",
|
||||
"client-manager.control",
|
||||
@@ -100,7 +100,7 @@
|
||||
"remote.run.process.stop",
|
||||
"remote.run.logs.transfer",
|
||||
"remote.run.protected.sql",
|
||||
"remote.run.protected.rcon",
|
||||
"remote.run.rcon.command",
|
||||
"remote.run.program.command"
|
||||
],
|
||||
"databaseEngines": [
|
||||
@@ -123,23 +123,6 @@
|
||||
},
|
||||
"gameClientBridge": {
|
||||
"commands": [
|
||||
{
|
||||
"type": "announcement.send",
|
||||
"title": "Send SCUM announcement",
|
||||
"permission": "server.game-client.command",
|
||||
"approvalLevel": "operator",
|
||||
"payloadSchemaRef": "schemas/bridge/announcement.payload.schema.json",
|
||||
"resultSchemaRef": "schemas/bridge/announcement.result.schema.json",
|
||||
"timeoutSeconds": 60,
|
||||
"maxPayloadBytes": 4096,
|
||||
"protectedRequest": {
|
||||
"kind": "rcon",
|
||||
"transportKey": "scum-management",
|
||||
"targetKey": "scum-management",
|
||||
"textField": "requestText",
|
||||
"maxTextBytes": 2048
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "companion.diagnostics",
|
||||
"title": "Collect companion diagnostics",
|
||||
@@ -497,13 +480,6 @@
|
||||
"captureMappings": { "steamId": "steamId", "displayName": "displayName" },
|
||||
"fixedValues": { "eventType": "login", "source": "process.stdout" },
|
||||
"observedAtField": "observedAt"
|
||||
},
|
||||
"announcement": {
|
||||
"profileKey": "scum-client-manager",
|
||||
"commandType": "announcement.send",
|
||||
"textField": "requestText",
|
||||
"newTextTemplate": "#announce 欢迎新玩家 {{displayName}} 加入服务器!",
|
||||
"returningTextTemplate": "#announce 欢迎 {{displayName}} 继续游戏!"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -522,91 +498,66 @@
|
||||
"key": "player.fame.set",
|
||||
"title": "Set SCUM player fame through RCON",
|
||||
"permission": "server.game-client.command",
|
||||
"approvalLevel": "operator",
|
||||
"approvalLevel": "none",
|
||||
"kind": "rcon",
|
||||
"transportKey": "scum-management",
|
||||
"targetKey": "scum-management",
|
||||
"payloadSchemaRef": "schemas/bridge/player-fame-set.payload.schema.json",
|
||||
"resultSchemaRef": "schemas/bridge/player-rcon-set.result.schema.json",
|
||||
"confirmationSchemaRef": "schemas/bridge/player-fame-set.confirmation.schema.json",
|
||||
"timeoutSeconds": 60,
|
||||
"maxPayloadBytes": 2048,
|
||||
"safety": {
|
||||
"requiresApproval": true,
|
||||
"requiresConfirmation": true
|
||||
}
|
||||
"maxPayloadBytes": 2048
|
||||
},
|
||||
{
|
||||
"key": "player.currency.normal.set",
|
||||
"title": "Set SCUM normal currency through RCON",
|
||||
"permission": "server.game-client.command",
|
||||
"approvalLevel": "operator",
|
||||
"approvalLevel": "none",
|
||||
"kind": "rcon",
|
||||
"transportKey": "scum-management",
|
||||
"targetKey": "scum-management",
|
||||
"payloadSchemaRef": "schemas/bridge/player-currency-set.payload.schema.json",
|
||||
"resultSchemaRef": "schemas/bridge/player-rcon-set.result.schema.json",
|
||||
"confirmationSchemaRef": "schemas/bridge/player-currency-set.confirmation.schema.json",
|
||||
"timeoutSeconds": 60,
|
||||
"maxPayloadBytes": 2048,
|
||||
"safety": {
|
||||
"requiresApproval": true,
|
||||
"requiresConfirmation": true
|
||||
}
|
||||
"maxPayloadBytes": 2048
|
||||
},
|
||||
{
|
||||
"key": "player.currency.gold.set",
|
||||
"title": "Set SCUM gold currency through RCON",
|
||||
"permission": "server.game-client.command",
|
||||
"approvalLevel": "operator",
|
||||
"approvalLevel": "none",
|
||||
"kind": "rcon",
|
||||
"transportKey": "scum-management",
|
||||
"targetKey": "scum-management",
|
||||
"payloadSchemaRef": "schemas/bridge/player-currency-set.payload.schema.json",
|
||||
"resultSchemaRef": "schemas/bridge/player-rcon-set.result.schema.json",
|
||||
"confirmationSchemaRef": "schemas/bridge/player-currency-set.confirmation.schema.json",
|
||||
"timeoutSeconds": 60,
|
||||
"maxPayloadBytes": 2048,
|
||||
"safety": {
|
||||
"requiresApproval": true,
|
||||
"requiresConfirmation": true
|
||||
}
|
||||
"maxPayloadBytes": 2048
|
||||
},
|
||||
{
|
||||
"key": "player.notify",
|
||||
"title": "Notify SCUM player through RCON chat",
|
||||
"permission": "server.game-client.command",
|
||||
"approvalLevel": "operator",
|
||||
"approvalLevel": "none",
|
||||
"kind": "rcon",
|
||||
"transportKey": "scum-management",
|
||||
"targetKey": "scum-management",
|
||||
"payloadSchemaRef": "schemas/bridge/player-notify.payload.schema.json",
|
||||
"resultSchemaRef": "schemas/bridge/player-notify.result.schema.json",
|
||||
"confirmationSchemaRef": "schemas/bridge/player-notify.confirmation.schema.json",
|
||||
"timeoutSeconds": 60,
|
||||
"maxPayloadBytes": 2048,
|
||||
"safety": {
|
||||
"requiresApproval": true,
|
||||
"requiresConfirmation": true
|
||||
}
|
||||
"maxPayloadBytes": 2048
|
||||
},
|
||||
{
|
||||
"key": "reward.deliver",
|
||||
"title": "Deliver approved SCUM reward through typed command workflow",
|
||||
"title": "Deliver SCUM reward through typed command workflow",
|
||||
"permission": "server.game-client.command",
|
||||
"approvalLevel": "operator",
|
||||
"approvalLevel": "none",
|
||||
"kind": "rcon",
|
||||
"transportKey": "scum-management",
|
||||
"targetKey": "scum-management",
|
||||
"payloadSchemaRef": "schemas/bridge/reward-deliver.payload.schema.json",
|
||||
"resultSchemaRef": "schemas/bridge/reward-deliver.result.schema.json",
|
||||
"confirmationSchemaRef": "schemas/bridge/reward-deliver.confirmation.schema.json",
|
||||
"timeoutSeconds": 60,
|
||||
"maxPayloadBytes": 4096,
|
||||
"safety": {
|
||||
"requiresApproval": true,
|
||||
"requiresConfirmation": true
|
||||
}
|
||||
"maxPayloadBytes": 4096
|
||||
},
|
||||
{
|
||||
"key": "player.attribute.855.set",
|
||||
@@ -1072,7 +1023,8 @@
|
||||
"process.restart",
|
||||
"process.status",
|
||||
"remote.run.process.start",
|
||||
"remote.run.process.stop"
|
||||
"remote.run.process.stop",
|
||||
"remote.run.rcon.command"
|
||||
],
|
||||
"actionRefs": {
|
||||
"install": "actions/install.json",
|
||||
@@ -1082,7 +1034,11 @@
|
||||
"status": "actions/status.json"
|
||||
},
|
||||
"transportKeys": [
|
||||
"server-files"
|
||||
"server-files",
|
||||
"scum-management"
|
||||
],
|
||||
"dllExtensionRefs": [
|
||||
"scum-simple-rcon"
|
||||
],
|
||||
"platforms": [
|
||||
"windows"
|
||||
@@ -1412,7 +1368,7 @@
|
||||
"kind": "rcon",
|
||||
"targetKey": "scum-management",
|
||||
"capabilities": [
|
||||
"remote.run.protected.rcon"
|
||||
"remote.run.rcon.command"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1424,6 +1380,32 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"dllExtensions": [
|
||||
{
|
||||
"key": "scum-simple-rcon",
|
||||
"displayName": "SCUM Simple RCON",
|
||||
"kind": "ue4ss-dll",
|
||||
"activation": "server-start",
|
||||
"version": "0.1.0",
|
||||
"releaseState": "ready",
|
||||
"releaseUrl": "https://cdn.npc0.com/scum_simple_rcon_ue4s.dll",
|
||||
"checksum": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"sizeBytes": 1024,
|
||||
"targetKey": "ue4ss/scum-simple-rcon",
|
||||
"modKey": "scum_simple_rcon",
|
||||
"dllRef": "ue4ss/Mods/scum_simple_rcon/dlls/main.dll",
|
||||
"scumExecutableChecksum": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
||||
"ue4ssAbi": "ue4ss-3.0",
|
||||
"supportedTargets": [
|
||||
{
|
||||
"os": "windows",
|
||||
"arch": "amd64"
|
||||
}
|
||||
],
|
||||
"updateOnStart": true,
|
||||
"rconPort": 27015
|
||||
}
|
||||
],
|
||||
"clientManagers": [
|
||||
{
|
||||
"key": "scum-client-manager",
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"title": "SCUMAnnouncementPayload",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["requestText"],
|
||||
"properties": {
|
||||
"requestText": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 2048
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"title": "SCUMAnnouncementResult",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["accepted"],
|
||||
"properties": {
|
||||
"accepted": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"messageId": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 120
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user