last update
This commit is contained in:
31
server.js
31
server.js
@@ -33,6 +33,7 @@ const activity = require('./lib/activity')
|
||||
const itch = require('./lib/itch')
|
||||
const create = require('./lib/create')
|
||||
const archive = require('./lib/archive')
|
||||
const itchpack = require('./lib/itchpack')
|
||||
const scheduler = require('./lib/scheduler')
|
||||
|
||||
// The projects folder comes from the settings (lib/settings.js) and can be
|
||||
@@ -460,6 +461,35 @@ app.post('/api/projects/:name/archive/open', (req, res) => {
|
||||
openDetached('explorer.exe', [dir])
|
||||
res.json({ ok: true })
|
||||
})
|
||||
// itch.io package (<project>\docs\itchio, lib/itchpack.js): read for the copy
|
||||
// view, its images, open in Explorer, and Claude Code with the itchiocreater skill.
|
||||
app.get('/api/projects/:name/itch', (req, res) => {
|
||||
const projectPath = resolveProject(req.params.name)
|
||||
if (!projectPath) return res.status(404).json({ error: 'unknown project' })
|
||||
res.json(itchpack.read(projectPath))
|
||||
})
|
||||
app.get('/api/projects/:name/itch/file', (req, res) => {
|
||||
const projectPath = resolveProject(req.params.name)
|
||||
const f = projectPath && itchpack.file(projectPath, String(req.query.f ?? ''))
|
||||
if (!f || !/\.(png|jpe?g|gif|webp)$/i.test(f)) return res.status(404).end()
|
||||
res.setHeader('Cache-Control', 'no-cache')
|
||||
res.sendFile(f, (err) => { if (err && !res.headersSent) res.status(404).end() })
|
||||
})
|
||||
app.post('/api/projects/:name/itch/open', (req, res) => {
|
||||
const projectPath = resolveProject(req.params.name)
|
||||
if (!projectPath) return res.status(404).json({ error: 'unknown project' })
|
||||
const d = itchpack.dir(projectPath)
|
||||
if (!d) return res.status(404).json({ error: 'Kein itch.io-Ordner im Projekt' })
|
||||
const f = req.body?.f ? itchpack.file(projectPath, String(req.body.f)) : null
|
||||
// explorer wants "/select,<path>" as one argument
|
||||
openDetached('explorer.exe', f ? [`/select,${f}`] : [d])
|
||||
res.json({ ok: true })
|
||||
})
|
||||
app.post('/api/projects/:name/itch/generate', handle(async (req, res) => {
|
||||
const projectPath = resolveProject(req.params.name)
|
||||
if (!projectPath) return res.status(404).json({ error: 'unknown project' })
|
||||
try { res.json(await itchpack.launch(projectPath, req.params.name)) } catch (e) { res.status(400).json({ error: String(e.message ?? e) }) }
|
||||
}))
|
||||
// Rename a project and/or move it into another projects folder (lib/create.js).
|
||||
// body: { name, root (folder id, default: its own) }
|
||||
app.post('/api/projects/:name/move', handle(async (req, res) => {
|
||||
@@ -585,6 +615,7 @@ app.get('/api/projects/:name/details', handle(async (req, res) => {
|
||||
sshKey: sshKey(),
|
||||
releaseDirs: archive.findReleaseDirs(projectPath),
|
||||
archives: archive.listArchives(projectPath),
|
||||
itchPack: itchpack.summary(projectPath),
|
||||
})
|
||||
}))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user