feat: continued post qa for servers in app (#5818)

* fix: intercom in app

* feat: Logs.vue dynamic console resizing with window + padding problem

* fix: search highlight with decorator + change to be better

* fix: qa

* fix: allow paper+purpur into app csp

* fix: lint
This commit is contained in:
Calum H.
2026-04-15 21:16:05 +02:00
committed by GitHub
parent 37b0f7ff98
commit 3d5f29a7a2
15 changed files with 379 additions and 86 deletions

View File

@@ -63,6 +63,9 @@ const appendGraphData = (dataArray: number[], newValue: number): number[] => {
return updated
}
const STALE_STATS_THRESHOLD_MS = 5000
const STALE_STATS_PUSH_INTERVAL_MS = 1000
const mapPowerStateFromStateEvent = (
data: Archon.Websocket.v0.WSStateEvent,
): Archon.Websocket.v0.PowerState => {
@@ -101,6 +104,8 @@ export function useServerManageCoreRuntime(options: UseServerManageCoreRuntimeOp
const ramData = ref<number[]>([])
let uptimeIntervalId: ReturnType<typeof setInterval> | null = null
let staleStatsTimeoutId: ReturnType<typeof setTimeout> | null = null
let staleStatsIntervalId: ReturnType<typeof setInterval> | null = null
const markBackupCancelled =
options.markBackupCancelled ??
@@ -183,6 +188,43 @@ export function useServerManageCoreRuntime(options: UseServerManageCoreRuntimeOp
}
}
const clearStaleStatsTimers = () => {
if (staleStatsTimeoutId) {
clearTimeout(staleStatsTimeoutId)
staleStatsTimeoutId = null
}
if (staleStatsIntervalId) {
clearInterval(staleStatsIntervalId)
staleStatsIntervalId = null
}
}
const pushZeroStats = () => {
if (!shouldProcessEvent()) return
cpuData.value = appendGraphData(cpuData.value, 0)
ramData.value = appendGraphData(ramData.value, 0)
stats.value = {
current: {
...stats.value.current,
cpu_percent: 0,
ram_usage_bytes: 0,
},
past: { ...stats.value.current },
graph: {
cpu: cpuData.value,
ram: ramData.value,
},
}
}
const armStaleStatsWatchdog = () => {
clearStaleStatsTimers()
staleStatsTimeoutId = setTimeout(() => {
pushZeroStats()
staleStatsIntervalId = setInterval(pushZeroStats, STALE_STATS_PUSH_INTERVAL_MS)
}, STALE_STATS_THRESHOLD_MS)
}
const updatePowerState = (
state: Archon.Websocket.v0.PowerState,
details?: { oom_killed?: boolean; exit_code?: number },
@@ -209,6 +251,7 @@ export function useServerManageCoreRuntime(options: UseServerManageCoreRuntimeOp
}
const handleStats = (data: Archon.Websocket.v0.WSStatsEvent) => {
armStaleStatsWatchdog()
updateStats({
cpu_percent: data.cpu_percent,
ram_usage_bytes: data.ram_usage_bytes,
@@ -280,6 +323,7 @@ export function useServerManageCoreRuntime(options: UseServerManageCoreRuntimeOp
}
stopUptimeTicker()
clearStaleStatsTimers()
connectedSocketServerId.value = null
isConnected.value = false
isWsAuthIncorrect.value = false

View File

@@ -193,6 +193,17 @@ export function useTerminal(options: UseTerminalOptions): UseTerminalReturn {
term.options.disableStdin = true
term.write('\x1b[?25l')
// term.attachCustomKeyEventHandler((e) => {
// if (e.type !== 'keydown') return true
// const mod = e.ctrlKey || e.metaKey
// if (!mod) return true
// const key = e.key.toLowerCase()
// if (key === 'c' || key === 'insert' || key === 'a') {
// return false
// }
// return true
// })
wheelHandler = (e: WheelEvent) => {
e.preventDefault()
}

View File

@@ -60,8 +60,8 @@ export function useServerImage(
const { data: remoteImage, refetch } = useQuery({
queryKey,
queryFn: async (): Promise<string | null | undefined> => {
if (!serverId) return undefined
queryFn: async (): Promise<string | null> => {
if (!serverId) return null
try {
const fsAuth = await client.archon.servers_v0.getFilesystemAuth(serverId)
@@ -84,21 +84,21 @@ export function useServerImage(
}
} catch (error) {
console.debug('Server image fetch failed:', error)
return undefined
return null
}
if (!includeProjectFallback || !upstream.value?.project_id) return undefined
if (!includeProjectFallback || !upstream.value?.project_id) return null
try {
const project = await client.labrinth.projects_v2.get(upstream.value.project_id)
if (!project.icon_url) return undefined
if (!project.icon_url) return null
const response = await fetch(project.icon_url)
if (!response.ok) return undefined
if (!response.ok) return null
const blob = await response.blob()
return await processImageBlob(blob, iconSize)
} catch (error) {
console.debug('Project icon fallback failed:', error)
return undefined
return null
}
},
enabled: isEnabled,