Restrict Studio 2 host cleanup to exact preview paths
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { createUpscaleHost } from './upscale-host.mjs'
|
||||
import { purgeStudio2Files } from './studio2-purge.mjs'
|
||||
import { stableMemoryArgs } from './comfy-memory-policy.mjs'
|
||||
import { createGpuReservation } from './gpu-reservation.mjs'
|
||||
import { createGpuProxy } from './gpu-proxy.mjs'
|
||||
@@ -989,6 +990,12 @@ async function handleControl(req, res) {
|
||||
markWork()
|
||||
return streamFile(res, path)
|
||||
}
|
||||
if (req.method === 'POST' && url.pathname === '/studio2/purge') {
|
||||
if (!gpuReservation.isOwner(String(req.headers['x-aigen-gpu-lease'] || ''))) return json(res, 409, { ok: false, error: 'GPU lease required' })
|
||||
const body = await readJson(req)
|
||||
try { return json(res, 200, purgeStudio2Files(body, rootsForType)) }
|
||||
catch (error) { return json(res, 400, { ok: false, error: String(error.message || error) }) }
|
||||
}
|
||||
if (req.method === 'POST' && url.pathname === '/purge') {
|
||||
const body = await readJson(req)
|
||||
return json(res, 200, purgeDesktopFiles(body))
|
||||
|
||||
Reference in New Issue
Block a user