feat(webterm): 配置测速时长上限

This commit is contained in:
Codex
2026-07-11 14:16:38 +02:00
parent 2729656237
commit ddccb416c0
2 changed files with 4 additions and 1 deletions
+1
View File
@@ -250,6 +250,7 @@ targets:
publicUrl: "http://{hostname}:7783"
downloadBytes: 16777216
uploadBytes: 8388608
maxDurationMs: 10000
autoStartSessions:
- title: 决策中心
cwd: /root/unidesk
+3 -1
View File
@@ -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)