mirror of
https://github.com/djdevin/recflare.git
synced 2026-10-25 23:18:51 -07:00
[api] add influencer badges
This commit is contained in:
@@ -28,6 +28,7 @@ import type { D1ExecResult } from '../d1'
|
||||
* runx admin clear-password --username alice [--remote]
|
||||
* runx admin lookup --username alice [--remote]
|
||||
* runx admin grant-developer --account 1 [--revoke] [--remote]
|
||||
* runx admin grant-influencer --account 1 [--revoke] [--remote]
|
||||
* runx admin grant-plus --username alice [--revoke] [--remote]
|
||||
* runx admin reload-plus <amount> [--dry-run] [--remote]
|
||||
* runx admin cai-load [--file <export.json>] [--dry-run] [--remote]
|
||||
@@ -169,6 +170,11 @@ function grantRoleCommand(name: string, jsonKey: string, roleLabel: string, noun
|
||||
|
||||
const grantDeveloper = grantRoleCommand('grant-developer', 'isDeveloper', 'developer')
|
||||
const grantModerator = grantRoleCommand('grant-moderator', 'isModerator', 'moderator')
|
||||
/**
|
||||
* The influencer role, the account's `isInfluencer` flag. `auth` stamps it into the token's
|
||||
* `role` claim as `influencer` on the next login; nothing else reads the flag.
|
||||
*/
|
||||
const grantInfluencer = grantRoleCommand('grant-influencer', 'isInfluencer', 'influencer')
|
||||
|
||||
/**
|
||||
* Rec Room Plus, the account's `hasPlus` flag. Players normally get it themselves by
|
||||
@@ -394,6 +400,7 @@ const lookup = new Command('lookup')
|
||||
(json_extract(data, '$.passwordHash') IS NOT NULL) AS hasPassword,
|
||||
(json_extract(data, '$.isDeveloper') = 1) AS isDeveloper,
|
||||
(json_extract(data, '$.isModerator') = 1) AS isModerator,
|
||||
(json_extract(data, '$.isInfluencer') = 1) AS isInfluencer,
|
||||
(json_extract(data, '$.hasStudio') = 1) AS hasStudio
|
||||
FROM account WHERE ${where}`
|
||||
const res = await execSql(sql, remote)
|
||||
@@ -408,7 +415,13 @@ const lookup = new Command('lookup')
|
||||
: typeof v === 'object'
|
||||
? JSON.stringify(v)
|
||||
: String(v as number | string | boolean)
|
||||
const boolKeys = new Set(['hasPassword', 'isDeveloper', 'isModerator', 'hasStudio'])
|
||||
const boolKeys = new Set([
|
||||
'hasPassword',
|
||||
'isDeveloper',
|
||||
'isModerator',
|
||||
'isInfluencer',
|
||||
'hasStudio',
|
||||
])
|
||||
const table = new Table()
|
||||
for (const [key, value] of Object.entries(row)) {
|
||||
const shown = boolKeys.has(key) ? (value === 1 ? 'yes' : 'no') : asText(value)
|
||||
@@ -426,6 +439,7 @@ export const adminCmd = new Command('admin')
|
||||
.addCommand(clearPassword)
|
||||
.addCommand(grantDeveloper)
|
||||
.addCommand(grantModerator)
|
||||
.addCommand(grantInfluencer)
|
||||
.addCommand(grantPlus)
|
||||
.addCommand(grantStudio)
|
||||
.addCommand(reloadPlus)
|
||||
|
||||
Reference in New Issue
Block a user