mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-12-15 00:26:23 +00:00
Update AppImage
This commit is contained in:
@@ -1,38 +1,37 @@
|
|||||||
import { NextResponse } from "next/server"
|
import { NextResponse } from "next/server"
|
||||||
import { executeScript } from "@/lib/script-executor"
|
import { exec } from "child_process"
|
||||||
|
import { promisify } from "util"
|
||||||
|
|
||||||
|
const execAsync = promisify(exec)
|
||||||
|
|
||||||
export async function POST() {
|
export async function POST() {
|
||||||
try {
|
try {
|
||||||
// Execute the NVIDIA installer script
|
const scriptPath = "/usr/local/share/proxmenux/scripts/gpu_tpu/nvidia_installer.sh"
|
||||||
const result = await executeScript("/usr/local/share/proxmenux/scripts/gpu_tpu/nvidia_installer.sh", {
|
const webLogPath = "/tmp/nvidia_web_install.log"
|
||||||
|
|
||||||
|
const { stdout, stderr } = await execAsync(`EXECUTION_MODE=web WEB_LOG=${webLogPath} bash ${scriptPath}`, {
|
||||||
env: {
|
env: {
|
||||||
|
...process.env,
|
||||||
EXECUTION_MODE: "web",
|
EXECUTION_MODE: "web",
|
||||||
WEB_LOG: "/tmp/nvidia_web_install.log",
|
WEB_LOG: webLogPath,
|
||||||
},
|
},
|
||||||
|
maxBuffer: 10 * 1024 * 1024, // 10MB buffer
|
||||||
})
|
})
|
||||||
|
|
||||||
if (result.exitCode === 0) {
|
return NextResponse.json({
|
||||||
return NextResponse.json({
|
success: true,
|
||||||
success: true,
|
message: "NVIDIA drivers installation completed",
|
||||||
message: "NVIDIA drivers installed successfully",
|
output: stdout,
|
||||||
output: result.stdout,
|
log_file: webLogPath,
|
||||||
})
|
})
|
||||||
} else {
|
} catch (error: any) {
|
||||||
return NextResponse.json(
|
console.error("[v0] NVIDIA installation error:", error)
|
||||||
{
|
|
||||||
success: false,
|
|
||||||
error: "Installation failed",
|
|
||||||
output: result.stderr || result.stdout,
|
|
||||||
},
|
|
||||||
{ status: 500 },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error("NVIDIA installation error:", error)
|
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
success: false,
|
success: false,
|
||||||
error: error instanceof Error ? error.message : "Unknown error",
|
error: error.message || "Installation failed",
|
||||||
|
output: error.stdout || "",
|
||||||
|
stderr: error.stderr || "",
|
||||||
},
|
},
|
||||||
{ status: 500 },
|
{ status: 500 },
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -255,6 +255,27 @@ export default function Hardware() {
|
|||||||
revalidateOnFocus: false,
|
revalidateOnFocus: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const handleInstallNvidiaDriver = async () => {
|
||||||
|
setInstallingNvidiaDriver(true)
|
||||||
|
try {
|
||||||
|
const response = await fetch("/api/gpu/nvidia/install", {
|
||||||
|
method: "POST",
|
||||||
|
})
|
||||||
|
const data = await response.json()
|
||||||
|
|
||||||
|
if (data.success) {
|
||||||
|
// Refresh hardware data after installation
|
||||||
|
mutateHardware()
|
||||||
|
} else {
|
||||||
|
console.error("[v0] Failed to install NVIDIA drivers:", data.error)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("[v0] Error installing NVIDIA drivers:", error)
|
||||||
|
} finally {
|
||||||
|
setInstallingNvidiaDriver(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!selectedGPU) return
|
if (!selectedGPU) return
|
||||||
|
|
||||||
@@ -314,34 +335,6 @@ export default function Hardware() {
|
|||||||
return pciDevice || null
|
return pciDevice || null
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleInstallNvidiaDriver = async () => {
|
|
||||||
setInstallingNvidiaDriver(true)
|
|
||||||
try {
|
|
||||||
const response = await fetch("/api/gpu/nvidia/install", {
|
|
||||||
method: "POST",
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error("Failed to start NVIDIA driver installation")
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = await response.json()
|
|
||||||
|
|
||||||
// Show success message (you might want to add a toast notification here)
|
|
||||||
alert("NVIDIA driver installation started. Please check the terminal for progress.")
|
|
||||||
|
|
||||||
// Refresh GPU data after installation
|
|
||||||
setTimeout(() => {
|
|
||||||
mutateHardware()
|
|
||||||
}, 2000)
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error installing NVIDIA driver:", error)
|
|
||||||
alert("Failed to start NVIDIA driver installation. Please try manually.")
|
|
||||||
} finally {
|
|
||||||
setInstallingNvidiaDriver(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const hasRealtimeData = (): boolean => {
|
const hasRealtimeData = (): boolean => {
|
||||||
if (!realtimeGPUData) return false
|
if (!realtimeGPUData) return false
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user