diff --git a/config/platform-infra/webterm.yaml b/config/platform-infra/webterm.yaml index b7c84924..7979dbf3 100644 --- a/config/platform-infra/webterm.yaml +++ b/config/platform-infra/webterm.yaml @@ -250,6 +250,7 @@ targets: publicUrl: "http://{hostname}:7783" downloadBytes: 16777216 uploadBytes: 8388608 + maxDurationMs: 10000 autoStartSessions: - title: 决策中心 cwd: /root/unidesk diff --git a/scripts/src/platform-infra-webterm.ts b/scripts/src/platform-infra-webterm.ts index 21fd29f8..9a59593e 100644 --- a/scripts/src/platform-infra-webterm.ts +++ b/scripts/src/platform-infra-webterm.ts @@ -79,7 +79,7 @@ interface WebtermTarget { privileged: boolean; pid: "host" | "container"; sourceMounts: Array<{ source: string; target: string; readOnly: boolean }>; - networkSpeedTest: { enabled: boolean; containerName: string; hostPort: number; containerPort: number; publicUrl: string; downloadBytes: number; uploadBytes: number } | null; + networkSpeedTest: { enabled: boolean; containerName: string; hostPort: number; containerPort: number; publicUrl: string; downloadBytes: number; uploadBytes: number; maxDurationMs: number } | null; autoStartSessions: Array<{ title: string; cwd: string; command: string; cols: number; rows: number; resumePrompt: boolean; fallbackShell: boolean }>; sessionStartModes: SessionStartModes; autoResumePrompt: AutoResumePrompt; @@ -361,6 +361,7 @@ function parseTarget( publicUrl: stringField(speedRaw, "publicUrl", `${path}.runtime.networkSpeedTest`), downloadBytes: integerField(speedRaw, "downloadBytes", `${path}.runtime.networkSpeedTest`), uploadBytes: integerField(speedRaw, "uploadBytes", `${path}.runtime.networkSpeedTest`), + maxDurationMs: integerField(speedRaw, "maxDurationMs", `${path}.runtime.networkSpeedTest`), }; const target: WebtermTarget = { id: stringField(record, "id", path), @@ -437,6 +438,7 @@ function renderCompose(target: WebtermTarget): string { NETWORK_SPEED_TEST_PUBLIC_URL: target.runtime.networkSpeedTest.publicUrl, NETWORK_SPEED_TEST_DOWNLOAD_BYTES: String(target.runtime.networkSpeedTest.downloadBytes), NETWORK_SPEED_TEST_UPLOAD_BYTES: String(target.runtime.networkSpeedTest.uploadBytes), + NETWORK_SPEED_TEST_MAX_DURATION_MS: String(target.runtime.networkSpeedTest.maxDurationMs), } : {}), }; const envLines = Object.entries(environment)