mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-05-31 20:44:42 +00:00
Update AppImage
This commit is contained in:
@@ -35,8 +35,8 @@ import { DialogHeader, DialogDescription } from "@/components/ui/dialog"
|
||||
import { Input } from "@/components/ui/input"
|
||||
import { Dialog as SearchDialog, DialogContent as SearchDialogContent, DialogTitle as SearchDialogTitle } from "@/components/ui/dialog"
|
||||
import "xterm/css/xterm.css"
|
||||
import { API_PORT, fetchApi } from "@/lib/api-config"
|
||||
import { getTicketedWsUrl } from "@/lib/terminal-ws"
|
||||
import { fetchApi } from "@/lib/api-config"
|
||||
import { getTicketedWsUrl, getWsUrl } from "@/lib/terminal-ws"
|
||||
|
||||
interface LxcTerminalModalProps {
|
||||
open: boolean
|
||||
@@ -80,19 +80,7 @@ const proxmoxCommands = [
|
||||
]
|
||||
|
||||
function getWebSocketUrl(): string {
|
||||
if (typeof window === "undefined") {
|
||||
return "ws://localhost:8008/ws/terminal"
|
||||
}
|
||||
|
||||
const { protocol, hostname, port } = window.location
|
||||
const isStandardPort = port === "" || port === "80" || port === "443"
|
||||
const wsProtocol = protocol === "https:" ? "wss:" : "ws:"
|
||||
|
||||
if (isStandardPort) {
|
||||
return `${wsProtocol}//${hostname}/ws/terminal`
|
||||
} else {
|
||||
return `${wsProtocol}//${hostname}:${API_PORT}/ws/terminal`
|
||||
}
|
||||
return getWsUrl("/ws/terminal")
|
||||
}
|
||||
|
||||
export function LxcTerminalModal({
|
||||
|
||||
@@ -29,8 +29,7 @@ import {
|
||||
DropdownMenuLabel,
|
||||
} from "@/components/ui/dropdown-menu"
|
||||
import "xterm/css/xterm.css"
|
||||
import { API_PORT } from "@/lib/api-config"
|
||||
import { getTicketedWsUrl } from "@/lib/terminal-ws"
|
||||
import { getTicketedWsUrl, getWsUrl } from "@/lib/terminal-ws"
|
||||
|
||||
interface WebInteraction {
|
||||
type: "yesno" | "menu" | "msgbox" | "input" | "inputbox"
|
||||
@@ -530,21 +529,8 @@ const initMessage = {
|
||||
}
|
||||
}, [isOpen, isComplete, attemptReconnect])
|
||||
|
||||
const getScriptWebSocketUrl = (sid: string): string => {
|
||||
if (typeof window === "undefined") {
|
||||
return `ws://localhost:${API_PORT}/ws/script/${sid}`
|
||||
}
|
||||
|
||||
const { protocol, hostname, port } = window.location
|
||||
const isStandardPort = port === "" || port === "80" || port === "443"
|
||||
const wsProtocol = protocol === "https:" ? "wss:" : "ws:"
|
||||
|
||||
if (isStandardPort) {
|
||||
return `${wsProtocol}//${hostname}/ws/script/${sid}`
|
||||
} else {
|
||||
return `${wsProtocol}//${hostname}:${API_PORT}/ws/script/${sid}`
|
||||
}
|
||||
}
|
||||
const getScriptWebSocketUrl = (sid: string): string =>
|
||||
getWsUrl(`/ws/script/${sid}`)
|
||||
|
||||
const handleInteractionResponse = (value: string) => {
|
||||
if (!wsRef.current || !currentInteraction) {
|
||||
|
||||
@@ -411,9 +411,27 @@ export function Settings() {
|
||||
// available version, and updating doesn't need to ask which flavour
|
||||
// to install in. The user can always re-install via the
|
||||
// customizable post-install flow if they want different parameters.
|
||||
// Resolve which flow (auto vs custom) actually has an implementation
|
||||
// for this tool. Some tools live only in the customizable flow (e.g.
|
||||
// fastfetch, which needs an interactive menu and has no auto
|
||||
// variant). When the recorded source is "auto" but the auto flow has
|
||||
// no function for this tool, the bash wrapper aborts with
|
||||
// "Function '<x>' is not defined in the auto flow". This helper
|
||||
// silently routes to the only available flow instead.
|
||||
const resolveEffectiveSource = (tool: ProxMenuxTool): string => {
|
||||
const recorded = tool.source || "auto"
|
||||
if (recorded === "auto" && !tool.function_auto && tool.function_custom) {
|
||||
return "custom"
|
||||
}
|
||||
if (recorded === "custom" && !tool.function_custom && tool.function_auto) {
|
||||
return "auto"
|
||||
}
|
||||
return recorded
|
||||
}
|
||||
|
||||
const handleSingleToolUpdate = (tool: ProxMenuxTool) => {
|
||||
if (!tool.has_update) return
|
||||
const source = tool.source || "auto"
|
||||
const source = resolveEffectiveSource(tool)
|
||||
runPostInstallUpdates([{
|
||||
source,
|
||||
function: deriveFunctionName(tool, source),
|
||||
@@ -1534,12 +1552,15 @@ export function Settings() {
|
||||
onClick={() => {
|
||||
const entries = proxmenuxTools
|
||||
.filter(t => selectedUpdates.has(t.key))
|
||||
.map(t => ({
|
||||
source: t.source || 'auto',
|
||||
function: deriveFunctionName(t, t.source || 'auto'),
|
||||
key: t.key,
|
||||
name: t.name,
|
||||
}))
|
||||
.map(t => {
|
||||
const source = resolveEffectiveSource(t)
|
||||
return {
|
||||
source,
|
||||
function: deriveFunctionName(t, source),
|
||||
key: t.key,
|
||||
name: t.name,
|
||||
}
|
||||
})
|
||||
.filter(e => !!e.function)
|
||||
setUpdateModalOpen(false)
|
||||
setSelectedUpdates(new Set())
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import type React from "react"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
import { API_PORT, fetchApi } from "@/lib/api-config" // Unificando importaciones de api-config en una sola línea con alias @/
|
||||
import { getTicketedWsUrl } from "@/lib/terminal-ws"
|
||||
import { getTicketedWsUrl, getWsUrl } from "@/lib/terminal-ws"
|
||||
import {
|
||||
Activity,
|
||||
Trash2,
|
||||
@@ -51,20 +51,7 @@ interface TerminalInstance {
|
||||
}
|
||||
|
||||
function getWebSocketUrl(): string {
|
||||
if (typeof window === "undefined") {
|
||||
return "ws://localhost:8008/ws/terminal"
|
||||
}
|
||||
|
||||
const { protocol, hostname, port } = window.location
|
||||
const isStandardPort = port === "" || port === "80" || port === "443"
|
||||
|
||||
const wsProtocol = protocol === "https:" ? "wss:" : "ws:"
|
||||
|
||||
if (isStandardPort) {
|
||||
return `${wsProtocol}//${hostname}/ws/terminal`
|
||||
} else {
|
||||
return `${wsProtocol}//${hostname}:${API_PORT}/ws/terminal`
|
||||
}
|
||||
return getWsUrl("/ws/terminal")
|
||||
}
|
||||
|
||||
function getApiUrl(endpoint?: string): string {
|
||||
|
||||
Reference in New Issue
Block a user