Gitea Test

First Push to giTea
This commit is contained in:
2026-05-14 10:41:14 +02:00
parent 90de2c1674
commit 89fd54b3dc
10 changed files with 417 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
import { Router } from 'express'
import axios from 'axios'
const router = Router()
router.get('/status', async (_req, res) => {
const host = process.env.ROMM_HOST
const user = process.env.ROMM_USER
const pass = process.env.ROMM_PASSWORD
if (!host || !user || !pass) return res.status(503).json({ error: 'RomM not configured' })
const auth = { username: user, password: pass }
try {
const [statsRes, platformsRes] = await Promise.all([
axios.get(`${host}/api/stats`, { auth }),
axios.get(`${host}/api/platforms`, { auth }),
])
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const stats: any = statsRes.data ?? {}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const platforms: any[] = platformsRes.data ?? []
res.json({
platformCount: stats.PLATFORMS ?? platforms.length,
romCount: stats.ROMS ?? 0,
platforms: platforms.map((p: any) => ({
name: p.name ?? p.fs_slug ?? p.slug ?? '',
romCount: p.rom_count ?? p.roms_count ?? null,
})),
})
} catch (err: any) {
res.status(502).json({ error: err.message ?? 'RomM error' })
}
})
export default router