rhythia-api 198.0.0 → 200.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/executeAdminOperation.ts +13 -6
- package/api/submitScore.ts +3 -0
- package/index.ts +1 -0
- package/package.json +1 -1
- package/types/database.ts +22 -6
|
@@ -12,6 +12,7 @@ const adminOperations = {
|
|
|
12
12
|
excludeUser: z.object({ userId: z.number() }),
|
|
13
13
|
restrictUser: z.object({ userId: z.number() }),
|
|
14
14
|
silenceUser: z.object({ userId: z.number() }),
|
|
15
|
+
profanityClear: z.object({ userId: z.number() }),
|
|
15
16
|
searchUsers: z.object({ searchText: z.string() }),
|
|
16
17
|
removeAllScores: z.object({ userId: z.number() }),
|
|
17
18
|
invalidateRankedScores: z.object({ userId: z.number() }),
|
|
@@ -40,6 +41,10 @@ const OperationParam = z.discriminatedUnion("operation", [
|
|
|
40
41
|
operation: z.literal("searchUsers"),
|
|
41
42
|
params: adminOperations.searchUsers,
|
|
42
43
|
}),
|
|
44
|
+
z.object({
|
|
45
|
+
operation: z.literal("profanityClear"),
|
|
46
|
+
params: adminOperations.profanityClear,
|
|
47
|
+
}),
|
|
43
48
|
z.object({
|
|
44
49
|
operation: z.literal("removeAllScores"),
|
|
45
50
|
params: adminOperations.removeAllScores,
|
|
@@ -97,13 +102,9 @@ export async function handler(
|
|
|
97
102
|
{ status: 404 }
|
|
98
103
|
);
|
|
99
104
|
}
|
|
100
|
-
|
|
105
|
+
const tags = (queryUserData?.badges || []) as string[];
|
|
101
106
|
// Check if user has "Global Moderator" badge
|
|
102
|
-
const
|
|
103
|
-
const isGlobalModerator =
|
|
104
|
-
badges &&
|
|
105
|
-
Array.isArray(badges.badges) &&
|
|
106
|
-
badges.badges.some((badge: any) => badge === "Global Moderator");
|
|
107
|
+
const isGlobalModerator = tags.includes("Global Moderator");
|
|
107
108
|
|
|
108
109
|
if (!isGlobalModerator) {
|
|
109
110
|
return NextResponse.json(
|
|
@@ -152,6 +153,12 @@ export async function handler(
|
|
|
152
153
|
});
|
|
153
154
|
break;
|
|
154
155
|
|
|
156
|
+
case "profanityClear":
|
|
157
|
+
result = await supabase.rpc("admin_profanity_clear", {
|
|
158
|
+
user_id: params.userId,
|
|
159
|
+
});
|
|
160
|
+
break;
|
|
161
|
+
|
|
155
162
|
case "removeAllScores":
|
|
156
163
|
result = await supabase.rpc("admin_remove_all_scores", {
|
|
157
164
|
user_id: params.userId,
|
package/api/submitScore.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { User } from "@supabase/supabase-js";
|
|
|
10
10
|
export const Schema = {
|
|
11
11
|
input: z.strictObject({
|
|
12
12
|
session: z.string(),
|
|
13
|
+
version: z.string().optional(),
|
|
13
14
|
data: z.strictObject({
|
|
14
15
|
token: z.string(),
|
|
15
16
|
relayHwid: z.string(),
|
|
@@ -60,6 +61,7 @@ export async function POST(request: Request): Promise<NextResponse> {
|
|
|
60
61
|
|
|
61
62
|
export async function handler({
|
|
62
63
|
data,
|
|
64
|
+
version,
|
|
63
65
|
session,
|
|
64
66
|
}: (typeof Schema)["input"]["_type"]): Promise<
|
|
65
67
|
NextResponse<(typeof Schema)["output"]["_type"]>
|
|
@@ -268,6 +270,7 @@ export async function handler({
|
|
|
268
270
|
// Only spin scores
|
|
269
271
|
const spinTotalSp = weightCalculate(spinHashMap);
|
|
270
272
|
|
|
273
|
+
console.log("VERSION: " + version);
|
|
271
274
|
await supabase.from("profiles").upsert({
|
|
272
275
|
id: userData.id,
|
|
273
276
|
play_count: (userData.play_count || 0) + 1,
|
package/index.ts
CHANGED
|
@@ -1181,6 +1181,7 @@ export const setPasskey = handleApi({url:"/api/setPasskey",...SetPasskey})
|
|
|
1181
1181
|
export const Schema = {
|
|
1182
1182
|
input: z.strictObject({
|
|
1183
1183
|
session: z.string(),
|
|
1184
|
+
version: z.string().optional(),
|
|
1184
1185
|
data: z.strictObject({
|
|
1185
1186
|
token: z.string(),
|
|
1186
1187
|
relayHwid: z.string(),
|
package/package.json
CHANGED
package/types/database.ts
CHANGED
|
@@ -615,14 +615,30 @@ export type Database = {
|
|
|
615
615
|
}
|
|
616
616
|
Returns: number
|
|
617
617
|
}
|
|
618
|
-
admin_log_action:
|
|
618
|
+
admin_log_action:
|
|
619
|
+
| {
|
|
620
|
+
Args: {
|
|
621
|
+
admin_id: number
|
|
622
|
+
action_type: string
|
|
623
|
+
target_id: number
|
|
624
|
+
details?: Json
|
|
625
|
+
}
|
|
626
|
+
Returns: undefined
|
|
627
|
+
}
|
|
628
|
+
| {
|
|
629
|
+
Args: {
|
|
630
|
+
admin_id: number
|
|
631
|
+
action_type: string
|
|
632
|
+
target_id: string
|
|
633
|
+
details?: Json
|
|
634
|
+
}
|
|
635
|
+
Returns: undefined
|
|
636
|
+
}
|
|
637
|
+
admin_profanity_clear: {
|
|
619
638
|
Args: {
|
|
620
|
-
|
|
621
|
-
action_type: string
|
|
622
|
-
target_id: string
|
|
623
|
-
details?: Json
|
|
639
|
+
user_id: number
|
|
624
640
|
}
|
|
625
|
-
Returns:
|
|
641
|
+
Returns: boolean
|
|
626
642
|
}
|
|
627
643
|
admin_remove_all_scores: {
|
|
628
644
|
Args: {
|