Download src/app/api/version/update/route.js from heyeyydss/api9nin: direct link, hf CLI and curl.
- Browser
- Download file 727 Bytes
-
https://huggingface.co/spaces/heyeyydss/api9nin/resolve/main/src/app/api/version/update/route.js
- Command line
-
hf download hf://spaces/heyeyydss/api9nin/src/app/api/version/update/route.js
-
curl -L -o route.js https://huggingface.co/spaces/heyeyydss/api9nin/resolve/main/src/app/api/version/update/route.js
727 Bytes
| import { NextResponse } from "next/server"; | |
| import { killAppProcesses, spawnUpdaterAndExit } from "@/lib/appUpdater"; | |
| export async function POST() { | |
| if (process.env.NODE_ENV !== "production") { | |
| return NextResponse.json( | |
| { success: false, message: "Update is only available in production build (9router CLI)" }, | |
| { status: 403 } | |
| ); | |
| } | |
| try { | |
| // Kill sibling processes (cloudflared, MITM, stray next-server) to release file locks on Windows | |
| await killAppProcesses(); | |
| } catch { /* best effort */ } | |
| // Schedule detached updater then exit current server process | |
| spawnUpdaterAndExit(); | |
| return NextResponse.json({ success: true, message: "Updater started. This app will exit shortly." }); | |
| } | |