fix: nixclient SSL calls correct user-scoped route, not admin endpoint

- Add /api/nixclient/ssl (GET) — returns certs for authenticated user only
- Add /api/nixclient/ssl/:id/renew (POST) — validates cert belongs to user
- Register sslRoutes in nixclient index.ts
- nixclient SSL.tsx was calling /nixserver/ssl (requireAdminOrReseller)
  which would always 401 for regular users — fixed to /nixclient/ssl
This commit is contained in:
NixReaper
2026-04-11 05:39:01 -05:00
parent 8ff00c544c
commit d235d27fe3
3 changed files with 50 additions and 2 deletions
+2 -2
View File
@@ -10,14 +10,14 @@ export default function SSL() {
const fetch = async () => {
setLoading(true)
try { const r = await api.get('/nixserver/ssl'); setCerts(r.data.data) }
try { const r = await api.get('/nixclient/ssl'); setCerts(r.data.data) }
finally { setLoading(false) }
}
useEffect(() => { fetch() }, [])
const renew = async (id: number) => {
try { await api.post(`/nixserver/ssl/${id}/renew`); fetch() }
try { await api.post(`/nixclient/ssl/${id}/renew`); fetch() }
catch (err: unknown) { alert((err as { response?: { data?: { error?: string } } })?.response?.data?.error ?? 'Renewal failed') }
}