feat: stabilize fnos lan delivery flow

This commit is contained in:
kris
2026-03-27 13:49:30 +08:00
parent 32bc94f924
commit b35d653610
10 changed files with 667 additions and 14 deletions

View File

@@ -135,7 +135,7 @@ const INTEGRATION_META = {
},
cutvideo: {
label: "自动剪辑",
hint: "Windows cutvideo",
hint: "cutvideo 直连",
impacts: ["实拍剪辑"]
},
huobao: {
@@ -2219,6 +2219,7 @@ function getIntegrationDetail(key) {
error: String(raw?.error || ""),
url: String(raw?.url || raw?.base_url || ""),
baseUrl: String(raw?.base_url || ""),
routeMode: String(raw?.route_mode || ""),
supportsUploads: raw?.supports_uploads !== undefined ? Boolean(raw?.supports_uploads) : true,
uploadStatusCode: Number(raw?.upload_status_code || 0),
uploadError: String(raw?.upload_error || ""),
@@ -2226,6 +2227,24 @@ function getIntegrationDetail(key) {
};
}
function isFnosTunnelCutvideo(detail) {
if (!detail || detail.key !== "cutvideo") return false;
if (detail.routeMode) return detail.routeMode === "fnos_tunnel";
const baseUrl = String(detail.baseUrl || detail.url || "");
return /:19186(?:\/|$)/.test(baseUrl);
}
function getCutvideoIntegrationHint(detail) {
if (isFnosTunnelCutvideo(detail)) {
return "fnOS NAS 隧道入口";
}
return "Windows 直连";
}
function getCutvideoIntegrationUrlLabel(detail) {
return isFnosTunnelCutvideo(detail) ? "fnOS NAS 隧道入口" : "Windows 直连";
}
function getIntegrationStatus(detail) {
if (!detail.available) {
return { tone: "blue", summary: "未拉取" };
@@ -2285,6 +2304,7 @@ function getIntegrationCards() {
const detail = getIntegrationDetail(key);
const status = getIntegrationStatus(detail);
const meta = INTEGRATION_META[key] || { label: key, hint: key, impacts: [] };
const metaHint = key === "cutvideo" ? getCutvideoIntegrationHint(detail) : meta.hint;
let note = "尚未获取健康检查数据";
if (detail.available) {
if (detail.reachable) {
@@ -2292,6 +2312,8 @@ function getIntegrationCards() {
note = detail.uploadStatusCode
? `主服务在线,但 /api/uploads 返回 HTTP ${detail.uploadStatusCode}`
: (detail.uploadError ? brief(detail.uploadError, 72) : "主服务在线,但缺少上传接口");
} else if (key === "cutvideo" && isFnosTunnelCutvideo(detail)) {
note = "当前走 fnOS NAS 隧道,不是 Windows 直连 cutvideo";
} else {
note = detail.statusCode
? `健康探测返回 HTTP ${detail.statusCode}`
@@ -2333,9 +2355,17 @@ function getIntegrationCards() {
: "当前还没有你的录制源";
actions = `<span class="tag clickable-tag" data-action="open-live-recorder">录制控制</span>`;
}
if (key === "cutvideo") {
extra = isFnosTunnelCutvideo(detail)
? `当前通过 fnOS NAS 隧道访问 ${detail.baseUrl || detail.url || "cutvideo"}`
: `当前直连 ${detail.baseUrl || detail.url || "cutvideo"}`;
}
return {
key,
meta,
meta: {
...meta,
hint: metaHint
},
detail,
status,
note,
@@ -3109,7 +3139,7 @@ function renderIntegrationOverviewPanel(options = {}) {
</div>
<div class="integration-note">${escapeHtml(item.note)}</div>
${item.extra ? `<div class="integration-note">${escapeHtml(item.extra)}</div>` : ""}
<div class="integration-url">${escapeHtml(item.key === "live_recorder" ? "仅通过当前租户的后端代理访问" : (item.detail.url || item.detail.baseUrl || "未提供探测地址"))}</div>
<div class="integration-url">${escapeHtml(item.key === "live_recorder" ? "仅通过当前租户的后端代理访问" : (item.key === "cutvideo" ? `${getCutvideoIntegrationUrlLabel(item.detail)}${item.detail.url || item.detail.baseUrl || "未提供探测地址"}` : (item.detail.url || item.detail.baseUrl || "未提供探测地址")))}</div>
${item.actions ? `<div class="task-meta integration-highlights" style="margin-top:12px;">${item.actions}</div>` : ""}
</div>
`).join("")}