fix: the duke can not be used as the default role

This commit is contained in:
beilunyang
2025-06-06 00:04:23 +08:00
parent 7a04a8165c
commit 9d55564073

View File

@@ -21,7 +21,16 @@ const ROLE_DESCRIPTIONS: Record<Role, string> = {
const getDefaultRole = async (): Promise<Role> => {
const defaultRole = await getRequestContext().env.SITE_CONFIG.get("DEFAULT_ROLE")
return defaultRole === ROLES.KNIGHT ? ROLES.KNIGHT : ROLES.CIVILIAN
if (
defaultRole === ROLES.DUKE ||
defaultRole === ROLES.KNIGHT ||
defaultRole === ROLES.CIVILIAN
) {
return defaultRole as Role
}
return ROLES.CIVILIAN
}
async function findOrCreateRole(db: Db, roleName: Role) {