release: PicHost v1.0.0
Publish Docker image / build-and-push (push) Canceled after 0s
ci / ci (22, ubuntu-latest) (push) Canceled after 0s
Publish Docker image / build-and-push (push) Canceled after 0s
ci / ci (22, ubuntu-latest) (push) Canceled after 0s
Multi-user image hosting with RBAC, upload preferences, and admin settings.
This commit is contained in:
commit
bc4cba7e52
115 files changed
+26508
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { isAllowRegistration } from '../../utils/db'
|
||||
import { isAdminSecretConfigured } from '../../utils/env'
|
||||
import {
|
||||
getCurrentUser,
|
||||
isInitialized
|
||||
} from '../../utils/auth'
|
||||
import { verifyLegacyAuth } from '../../utils/access'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const initialized = isInitialized()
|
||||
const user = await getCurrentUser(event)
|
||||
const legacyMode = !initialized && isAdminSecretConfigured(event)
|
||||
const needsMigration = legacyMode && (await verifyLegacyAuth(event))
|
||||
|
||||
return {
|
||||
initialized,
|
||||
allowRegistration: isAllowRegistration(),
|
||||
legacyMode,
|
||||
needsMigration,
|
||||
user: user
|
||||
? { id: user.id, username: user.username, role: user.role }
|
||||
: null
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user