Add Docker Registry AIO with Nuxt Token Auth and admin UI.
Compose brings up registry:3 plus a Prisma/SQLite Nuxt app for docker login, ACL management, and image browsing with shadcn-vue. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
0fd00bfa37
120 files changed
+17094
No files matched your search
@@ -0,0 +1,25 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
const session = await requireAdmin(event)
|
||||
await ensureBootstrap()
|
||||
|
||||
const id = getRouterParam(event, 'id')
|
||||
if (!id) {
|
||||
throw createError({ statusCode: 400, statusMessage: 'Missing id' })
|
||||
}
|
||||
|
||||
if (session.id === id) {
|
||||
throw createError({ statusCode: 400, statusMessage: 'Cannot delete yourself' })
|
||||
}
|
||||
|
||||
const existing = await prisma.user.findUnique({ where: { id } })
|
||||
if (!existing) {
|
||||
throw createError({ statusCode: 404, statusMessage: 'User not found' })
|
||||
}
|
||||
|
||||
if (existing.username === (process.env.ADMIN_USERNAME || 'admin')) {
|
||||
throw createError({ statusCode: 400, statusMessage: 'Cannot delete bootstrap admin' })
|
||||
}
|
||||
|
||||
await prisma.user.delete({ where: { id } })
|
||||
return { ok: true }
|
||||
})
|
||||
Reference in new issue
Block a user