mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-07 18:26:37 +08:00
fix: resolve merge conflicts and fix monitoring bugs
- Add missing 'uptime' field to NodeMetricApiItem type definition - Fix WS message handling: non-UpgradeProgress typed messages now broadcast via broadcastInfo instead of being silently dropped - Strengthen looksLikeSystemInfoMessage heuristic to require ≥3 matching keys to avoid false positives - Fix tab/space indentation inconsistency in admin.tsx useEffect - Remove duplicate method declarations from merge (repository_control, mutations) - Update tunnel_entry_sqlite_test to use renamed Tx suffix function
This commit is contained in:
@@ -402,6 +402,7 @@ export interface NodeMetricApiItem {
|
||||
load15: number;
|
||||
tcpConns: number;
|
||||
udpConns: number;
|
||||
uptime: number;
|
||||
}
|
||||
|
||||
export interface TunnelMetricApiItem {
|
||||
|
||||
@@ -202,40 +202,40 @@ export default function AdminLayout({
|
||||
setUsername(name);
|
||||
setIsAdmin(adminFlag);
|
||||
|
||||
// Monitor permission is not strictly role-based; non-admin users may be
|
||||
// granted access explicitly. Fetch a lightweight capability flag so we can
|
||||
// avoid a confusing 403 navigation.
|
||||
if (adminFlag) {
|
||||
setMonitorAllowed(true);
|
||||
setMonitorAccessReason(null);
|
||||
return;
|
||||
}
|
||||
// Monitor permission is not strictly role-based; non-admin users may be
|
||||
// granted access explicitly. Fetch a lightweight capability flag so we can
|
||||
// avoid a confusing 403 navigation.
|
||||
if (adminFlag) {
|
||||
setMonitorAllowed(true);
|
||||
setMonitorAccessReason(null);
|
||||
return;
|
||||
}
|
||||
|
||||
let cancelled = false;
|
||||
(async () => {
|
||||
try {
|
||||
const res = await getMonitorAccess();
|
||||
if (cancelled) return;
|
||||
if (res.code === 0 && res.data) {
|
||||
setMonitorAllowed(Boolean(res.data.allowed));
|
||||
setMonitorAccessReason(
|
||||
res.data.allowed ? null : (res.data.reason || null),
|
||||
);
|
||||
return;
|
||||
}
|
||||
// Fail open to preserve legacy navigation behavior.
|
||||
setMonitorAllowed(true);
|
||||
setMonitorAccessReason(null);
|
||||
} catch {
|
||||
if (cancelled) return;
|
||||
setMonitorAllowed(true);
|
||||
setMonitorAccessReason(null);
|
||||
}
|
||||
})();
|
||||
let cancelled = false;
|
||||
(async () => {
|
||||
try {
|
||||
const res = await getMonitorAccess();
|
||||
if (cancelled) return;
|
||||
if (res.code === 0 && res.data) {
|
||||
setMonitorAllowed(Boolean(res.data.allowed));
|
||||
setMonitorAccessReason(
|
||||
res.data.allowed ? null : (res.data.reason || null),
|
||||
);
|
||||
return;
|
||||
}
|
||||
// Fail open to preserve legacy navigation behavior.
|
||||
setMonitorAllowed(true);
|
||||
setMonitorAccessReason(null);
|
||||
} catch {
|
||||
if (cancelled) return;
|
||||
setMonitorAllowed(true);
|
||||
setMonitorAccessReason(null);
|
||||
}
|
||||
})();
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user