erweiterte ansicht

This commit is contained in:
2026-11-12 20:58:18 +01:00
parent 0a38884eac
commit d6f5b1672c
5 changed files with 215 additions and 37 deletions

View File

@@ -311,12 +311,12 @@ async function describeProject(p, target) {
lastBackup: backup.lastFor(p.root.path, p.folder, target),
storage: storageSummary(p),
...meta,
published: itch.forProject(path.basename(p.folder), meta.itch),
published: settings.itchOn() ? itch.forProject(path.basename(p.folder), meta.itch) : null,
}
}
async function listProjects(target) {
await itch.ensure()
if (settings.itchOn()) await itch.ensure() // switched off: no request to itch.io
const list = await pool(projectList(), 8, (p) => describeProject(p, target))
return list.sort((a, b) => new Date(b.mtime) - new Date(a.mtime))
}
@@ -393,6 +393,7 @@ app.get('/api/projects', handle(async (req, res) => {
cleanAvailable: storage.cleanupAvailable(),
activityPending: activity.pending(),
// projects in subfolders found but not yet chosen/dismissed (lib/nested.js)
features: s.features ?? { itch: false },
nestedHint: ROOTS.length ? nested.hint(s.roots.filter((r) => fs.existsSync(r.path))) : 0,
})
}))
@@ -403,6 +404,9 @@ async function itchStatus() {
const claimed = projectList().map((p) => itch.forProject(path.basename(p.folder), readStatusFile(path.join(p.root.path, p.folder)).itch)?.url).filter(Boolean)
return { profile: s.profile, at: s.at, error: s.error, games: s.games, unmatched: itch.unmatched(claimed) }
}
// everything itch.io only works while it is switched on (Einstellungen → Allgemein)
const itchOnly = (req, res, next) => (settings.itchOn() ? next() : res.status(404).json({ error: 'itch.io ist in den Einstellungen ausgeschaltet' }))
app.use(['/api/itch', '/api/projects/:name/itch'], itchOnly)
app.get('/api/itch', handle(async (req, res) => { await itch.ensure(); res.json(await itchStatus()) }))
app.post('/api/itch/refresh', handle(async (req, res) => { await itch.refresh(); res.json(await itchStatus()) }))
@@ -720,7 +724,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),
itchPack: settings.itchOn() ? itchpack.summary(projectPath) : null,
readme: readmeIntro(projectPath),
})
}))