rhythia-api 199.0.0 → 201.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 +15 -0
- package/api/submitScore.ts +3 -0
- package/index.ts +1 -0
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ import { User } from "@supabase/supabase-js";
|
|
|
9
9
|
// Define supported admin operations and their parameter types
|
|
10
10
|
const adminOperations = {
|
|
11
11
|
deleteUser: z.object({ userId: z.number() }),
|
|
12
|
+
changeFlag: z.object({ userId: z.number(), flag: z.string() }),
|
|
12
13
|
excludeUser: z.object({ userId: z.number() }),
|
|
13
14
|
restrictUser: z.object({ userId: z.number() }),
|
|
14
15
|
silenceUser: z.object({ userId: z.number() }),
|
|
@@ -57,6 +58,10 @@ const OperationParam = z.discriminatedUnion("operation", [
|
|
|
57
58
|
operation: z.literal("unbanUser"),
|
|
58
59
|
params: adminOperations.unbanUser,
|
|
59
60
|
}),
|
|
61
|
+
z.object({
|
|
62
|
+
operation: z.literal("changeFlag"),
|
|
63
|
+
params: adminOperations.changeFlag,
|
|
64
|
+
}),
|
|
60
65
|
]);
|
|
61
66
|
|
|
62
67
|
export const Schema = {
|
|
@@ -176,6 +181,16 @@ export async function handler(
|
|
|
176
181
|
user_id: params.userId,
|
|
177
182
|
});
|
|
178
183
|
break;
|
|
184
|
+
|
|
185
|
+
case "changeFlag":
|
|
186
|
+
await supabase
|
|
187
|
+
.from("profiles")
|
|
188
|
+
.upsert({
|
|
189
|
+
id: params.userId,
|
|
190
|
+
flag: params.flag,
|
|
191
|
+
})
|
|
192
|
+
.select();
|
|
193
|
+
break;
|
|
179
194
|
}
|
|
180
195
|
|
|
181
196
|
// Log the admin action
|
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(),
|