rhythia-api 233.0.0 → 234.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/.codex +0 -0
- package/.env +1 -12
- package/README.md +4 -4
- package/api/acceptInvite.ts +1 -1
- package/api/addCollectionMap.ts +1 -1
- package/api/chartPublicStats.ts +1 -1
- package/api/checkQualified.ts +93 -93
- package/api/createBeatmap.ts +53 -62
- package/api/createBeatmapPage.ts +1 -1
- package/api/createClan.ts +1 -1
- package/api/createCollection.ts +1 -1
- package/api/createInvite.ts +1 -1
- package/api/createSupporter.ts +1 -1
- package/api/deleteBeatmapPage.ts +2 -5
- package/api/deleteCollection.ts +1 -1
- package/api/deleteCollectionMap.ts +1 -1
- package/api/editAboutMe.ts +1 -1
- package/api/editClan.ts +1 -1
- package/api/editCollection.ts +1 -2
- package/api/editProfile.ts +1 -1
- package/api/enhancedSearch.ts +113 -113
- package/api/executeAdminOperation.ts +1 -22
- package/api/getAvatarUploadUrl.ts +1 -1
- package/api/getBadgeLeaders.ts +1 -1
- package/api/getBadgedUsers.ts +1 -1
- package/api/getBeatmapComments.ts +1 -1
- package/api/getBeatmapPage.ts +74 -106
- package/api/getBeatmapPageById.ts +70 -109
- package/api/getBeatmapStarRating.ts +1 -1
- package/api/getBeatmaps.ts +1 -1
- package/api/getClan.ts +1 -1
- package/api/getClans.ts +1 -1
- package/api/getCollection.ts +1 -1
- package/api/getCollections.ts +1 -1
- package/api/getInventory.ts +1 -1
- package/api/getLeaderboard.ts +1 -1
- package/api/getMapUploadUrl.ts +2 -2
- package/api/getOnlinePlayers.ts +1 -1
- package/api/getPassToken.ts +1 -1
- package/api/getProfile.ts +51 -31
- package/api/getPublicStats.ts +5 -5
- package/api/getRawStarRating.ts +1 -1
- package/api/getScore.ts +1 -1
- package/api/getStoryBeatmaps.ts +1 -1
- package/api/getTimestamp.ts +1 -1
- package/api/getUserScores.ts +19 -19
- package/api/getVerified.ts +1 -1
- package/api/getVideoUploadUrl.ts +1 -1
- package/api/postBeatmapComment.ts +1 -1
- package/api/qualifyMap.ts +97 -92
- package/api/rankMapsArchive.ts +20 -20
- package/api/searchUsers.ts +1 -1
- package/api/setPasskey.ts +1 -1
- package/api/submitScore.ts +1 -6
- package/api/submitScoreInternal.ts +461 -449
- package/api/updateBeatmapPage.ts +1 -1
- package/api/vetoMap.ts +101 -101
- package/index.ts +165 -153
- package/package.json +7 -12
- package/queries/admin_delete_user.sql +39 -39
- package/queries/admin_exclude_user.sql +21 -21
- package/queries/admin_invalidate_ranked_scores.sql +18 -18
- package/queries/admin_log_action.sql +10 -10
- package/queries/admin_profanity_clear.sql +29 -29
- package/queries/admin_remove_all_scores.sql +29 -29
- package/queries/admin_restrict_user.sql +21 -21
- package/queries/admin_search_users.sql +24 -24
- package/queries/admin_silence_user.sql +21 -21
- package/queries/admin_unban_user.sql +21 -21
- package/queries/enhanced_search.sql +217 -217
- package/queries/get_badge_leaderboard.sql +50 -50
- package/queries/get_clan_leaderboard.sql +68 -68
- package/queries/get_collections_v4.sql +109 -109
- package/queries/get_top_scores_for_beatmap.sql +44 -44
- package/queries/get_top_scores_for_beatmap3.sql +38 -0
- package/queries/get_user_by_email.sql +32 -32
- package/queries/get_user_scores_lastday.sql +47 -47
- package/queries/get_user_scores_reign.sql +31 -31
- package/queries/get_user_scores_top_and_stats.sql +84 -84
- package/queries/grant_special_badges.sql +69 -69
- package/types/database.ts +1288 -1248
- package/utils/beatmapTopScores.ts +84 -0
- package/utils/mapLifecycleWebhook.ts +287 -277
- package/utils/requestGeo.ts +13 -0
- package/utils/requestUtils.ts +127 -127
- package/utils/response.ts +11 -0
- package/worker.ts +189 -0
- package/wrangler.jsonc +10 -0
- package/index.html +0 -3
- package/vercel.json +0 -13
package/api/updateBeatmapPage.ts
CHANGED
package/api/vetoMap.ts
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
import { NextResponse } from "
|
|
2
|
-
import z from "zod";
|
|
3
|
-
import { protectedApi, validUser } from "../utils/requestUtils";
|
|
4
|
-
import { supabase } from "../utils/supabase";
|
|
5
|
-
import { getUserBySession } from "../utils/getUserBySession";
|
|
6
|
-
import { User } from "@supabase/supabase-js";
|
|
7
|
-
import { postMapLifecycleWebhook } from "../utils/mapLifecycleWebhook";
|
|
8
|
-
|
|
9
|
-
const VETO_BADGES = ["Team Ranked"];
|
|
10
|
-
|
|
11
|
-
export const Schema = {
|
|
12
|
-
input: z.strictObject({
|
|
13
|
-
session: z.string(),
|
|
14
|
-
mapId: z.number(),
|
|
15
|
-
reason: z.string().min(1).max(1000),
|
|
16
|
-
}),
|
|
17
|
-
output: z.object({
|
|
18
|
-
error: z.string().optional(),
|
|
19
|
-
}),
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export async function POST(request: Request) {
|
|
23
|
-
return protectedApi({
|
|
24
|
-
request,
|
|
25
|
-
schema: Schema,
|
|
26
|
-
authorization: validUser,
|
|
27
|
-
activity: handler,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export async function handler(data: (typeof Schema)["input"]["_type"]) {
|
|
32
|
-
const user = (await getUserBySession(data.session)) as User;
|
|
33
|
-
const { data: queryUserData } = await supabase
|
|
34
|
-
.from("profiles")
|
|
35
|
-
.select("*")
|
|
36
|
-
.eq("uid", user.id)
|
|
37
|
-
.single();
|
|
38
|
-
|
|
39
|
-
if (!queryUserData) {
|
|
40
|
-
return NextResponse.json({ error: "Can't find user" });
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const tags = (queryUserData?.badges || []) as string[];
|
|
44
|
-
const hasVetoAccess = VETO_BADGES.some((badge) => tags.includes(badge));
|
|
45
|
-
|
|
46
|
-
if (!hasVetoAccess) {
|
|
47
|
-
return NextResponse.json({ error: "Only management can veto maps!" });
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const { data: mapData } = await supabase
|
|
51
|
-
.from("beatmapPages")
|
|
52
|
-
.select("id,qualified")
|
|
53
|
-
.eq("id", data.mapId)
|
|
54
|
-
.single();
|
|
55
|
-
|
|
56
|
-
if (!mapData) {
|
|
57
|
-
return NextResponse.json({ error: "Bad map" });
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (!mapData.qualified) {
|
|
61
|
-
return NextResponse.json({
|
|
62
|
-
error: "Only qualified maps can be vetoed",
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const { data: vetoData, error: vetoError } = await supabase
|
|
67
|
-
.from("vetos")
|
|
68
|
-
.insert({
|
|
69
|
-
beatmapPage: data.mapId,
|
|
70
|
-
user: queryUserData.id,
|
|
71
|
-
veto_reason: data.reason,
|
|
72
|
-
})
|
|
73
|
-
.select("id")
|
|
74
|
-
.single();
|
|
75
|
-
|
|
76
|
-
if (vetoError) {
|
|
77
|
-
return NextResponse.json({ error: vetoError.message });
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const { error: updateError } = await supabase.from("beatmapPages").upsert({
|
|
81
|
-
id: data.mapId,
|
|
82
|
-
qualified: false,
|
|
83
|
-
qualifiedAt: null,
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
if (updateError) {
|
|
87
|
-
if (vetoData?.id) {
|
|
88
|
-
await supabase.from("vetos").delete().eq("id", vetoData.id);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return NextResponse.json({ error: updateError.message });
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
await postMapLifecycleWebhook({
|
|
95
|
-
mapId: data.mapId,
|
|
96
|
-
event: "vetoed",
|
|
97
|
-
vetoReason: data.reason,
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
return NextResponse.json({});
|
|
101
|
-
}
|
|
1
|
+
import { NextResponse } from "../utils/response";
|
|
2
|
+
import z from "zod";
|
|
3
|
+
import { protectedApi, validUser } from "../utils/requestUtils";
|
|
4
|
+
import { supabase } from "../utils/supabase";
|
|
5
|
+
import { getUserBySession } from "../utils/getUserBySession";
|
|
6
|
+
import { User } from "@supabase/supabase-js";
|
|
7
|
+
import { postMapLifecycleWebhook } from "../utils/mapLifecycleWebhook";
|
|
8
|
+
|
|
9
|
+
const VETO_BADGES = ["Team Ranked"];
|
|
10
|
+
|
|
11
|
+
export const Schema = {
|
|
12
|
+
input: z.strictObject({
|
|
13
|
+
session: z.string(),
|
|
14
|
+
mapId: z.number(),
|
|
15
|
+
reason: z.string().min(1).max(1000),
|
|
16
|
+
}),
|
|
17
|
+
output: z.object({
|
|
18
|
+
error: z.string().optional(),
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export async function POST(request: Request) {
|
|
23
|
+
return protectedApi({
|
|
24
|
+
request,
|
|
25
|
+
schema: Schema,
|
|
26
|
+
authorization: validUser,
|
|
27
|
+
activity: handler,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function handler(data: (typeof Schema)["input"]["_type"]) {
|
|
32
|
+
const user = (await getUserBySession(data.session)) as User;
|
|
33
|
+
const { data: queryUserData } = await supabase
|
|
34
|
+
.from("profiles")
|
|
35
|
+
.select("*")
|
|
36
|
+
.eq("uid", user.id)
|
|
37
|
+
.single();
|
|
38
|
+
|
|
39
|
+
if (!queryUserData) {
|
|
40
|
+
return NextResponse.json({ error: "Can't find user" });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const tags = (queryUserData?.badges || []) as string[];
|
|
44
|
+
const hasVetoAccess = VETO_BADGES.some((badge) => tags.includes(badge));
|
|
45
|
+
|
|
46
|
+
if (!hasVetoAccess) {
|
|
47
|
+
return NextResponse.json({ error: "Only management can veto maps!" });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const { data: mapData } = await supabase
|
|
51
|
+
.from("beatmapPages")
|
|
52
|
+
.select("id,qualified")
|
|
53
|
+
.eq("id", data.mapId)
|
|
54
|
+
.single();
|
|
55
|
+
|
|
56
|
+
if (!mapData) {
|
|
57
|
+
return NextResponse.json({ error: "Bad map" });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!mapData.qualified) {
|
|
61
|
+
return NextResponse.json({
|
|
62
|
+
error: "Only qualified maps can be vetoed",
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const { data: vetoData, error: vetoError } = await supabase
|
|
67
|
+
.from("vetos")
|
|
68
|
+
.insert({
|
|
69
|
+
beatmapPage: data.mapId,
|
|
70
|
+
user: queryUserData.id,
|
|
71
|
+
veto_reason: data.reason,
|
|
72
|
+
})
|
|
73
|
+
.select("id")
|
|
74
|
+
.single();
|
|
75
|
+
|
|
76
|
+
if (vetoError) {
|
|
77
|
+
return NextResponse.json({ error: vetoError.message });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const { error: updateError } = await supabase.from("beatmapPages").upsert({
|
|
81
|
+
id: data.mapId,
|
|
82
|
+
qualified: false,
|
|
83
|
+
qualifiedAt: null,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
if (updateError) {
|
|
87
|
+
if (vetoData?.id) {
|
|
88
|
+
await supabase.from("vetos").delete().eq("id", vetoData.id);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return NextResponse.json({ error: updateError.message });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
await postMapLifecycleWebhook({
|
|
95
|
+
mapId: data.mapId,
|
|
96
|
+
event: "vetoed",
|
|
97
|
+
vetoReason: data.reason,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return NextResponse.json({});
|
|
101
|
+
}
|
package/index.ts
CHANGED
|
@@ -47,14 +47,14 @@ export const chartPublicStats = handleApi({url:"/api/chartPublicStats",...ChartP
|
|
|
47
47
|
// ./api/checkQualified.ts API
|
|
48
48
|
|
|
49
49
|
/*
|
|
50
|
-
export const Schema = {
|
|
51
|
-
input: z.strictObject({
|
|
52
|
-
secret: z.string(),
|
|
53
|
-
}),
|
|
54
|
-
output: z.object({
|
|
55
|
-
error: z.string().optional(),
|
|
56
|
-
updated: z.number(),
|
|
57
|
-
}),
|
|
50
|
+
export const Schema = {
|
|
51
|
+
input: z.strictObject({
|
|
52
|
+
secret: z.string(),
|
|
53
|
+
}),
|
|
54
|
+
output: z.object({
|
|
55
|
+
error: z.string().optional(),
|
|
56
|
+
updated: z.number(),
|
|
57
|
+
}),
|
|
58
58
|
};*/
|
|
59
59
|
import { Schema as CheckQualified } from "./api/checkQualified"
|
|
60
60
|
export { Schema as SchemaCheckQualified } from "./api/checkQualified"
|
|
@@ -63,7 +63,17 @@ export const checkQualified = handleApi({url:"/api/checkQualified",...CheckQuali
|
|
|
63
63
|
// ./api/createBeatmap.ts API
|
|
64
64
|
|
|
65
65
|
/*
|
|
66
|
-
|
|
66
|
+
export const Schema = {
|
|
67
|
+
input: z.strictObject({
|
|
68
|
+
url: z.string(),
|
|
69
|
+
session: z.string(),
|
|
70
|
+
updateFlag: z.boolean().optional(),
|
|
71
|
+
}),
|
|
72
|
+
output: z.strictObject({
|
|
73
|
+
hash: z.string().optional(),
|
|
74
|
+
error: z.string().optional(),
|
|
75
|
+
}),
|
|
76
|
+
};*/
|
|
67
77
|
import { Schema as CreateBeatmap } from "./api/createBeatmap"
|
|
68
78
|
export { Schema as SchemaCreateBeatmap } from "./api/createBeatmap"
|
|
69
79
|
export const createBeatmap = handleApi({url:"/api/createBeatmap",...CreateBeatmap})
|
|
@@ -311,39 +321,39 @@ export const editProfile = handleApi({url:"/api/editProfile",...EditProfile})
|
|
|
311
321
|
// ./api/enhancedSearch.ts API
|
|
312
322
|
|
|
313
323
|
/*
|
|
314
|
-
export const Schema = {
|
|
315
|
-
input: z.strictObject({
|
|
316
|
-
text: z.string().trim().min(1),
|
|
317
|
-
limit: z.number().int().min(1).max(25).default(10),
|
|
318
|
-
}),
|
|
319
|
-
output: z.object({
|
|
320
|
-
error: z.string().optional(),
|
|
321
|
-
users: z.array(
|
|
322
|
-
z.object({
|
|
323
|
-
id: z.number(),
|
|
324
|
-
username: z.string().nullable(),
|
|
325
|
-
avatar_url: z.string().nullable(),
|
|
326
|
-
about_me: z.string().nullable(),
|
|
327
|
-
flag: z.string().nullable(),
|
|
328
|
-
})
|
|
329
|
-
),
|
|
330
|
-
beatmaps: z.array(
|
|
331
|
-
z.object({
|
|
332
|
-
id: z.number(),
|
|
333
|
-
mapId: z.string().nullable(),
|
|
334
|
-
title: z.string().nullable(),
|
|
335
|
-
description: z.string().nullable(),
|
|
336
|
-
image: z.string().nullable(),
|
|
337
|
-
starRating: z.number().nullable(),
|
|
338
|
-
length: z.number().nullable(),
|
|
339
|
-
status: z.string().nullable(),
|
|
340
|
-
tags: z.string().nullable(),
|
|
341
|
-
owner: z.number().nullable(),
|
|
342
|
-
ownerUsername: z.string().nullable(),
|
|
343
|
-
ownerAvatar: z.string().nullable(),
|
|
344
|
-
})
|
|
345
|
-
),
|
|
346
|
-
}),
|
|
324
|
+
export const Schema = {
|
|
325
|
+
input: z.strictObject({
|
|
326
|
+
text: z.string().trim().min(1),
|
|
327
|
+
limit: z.number().int().min(1).max(25).default(10),
|
|
328
|
+
}),
|
|
329
|
+
output: z.object({
|
|
330
|
+
error: z.string().optional(),
|
|
331
|
+
users: z.array(
|
|
332
|
+
z.object({
|
|
333
|
+
id: z.number(),
|
|
334
|
+
username: z.string().nullable(),
|
|
335
|
+
avatar_url: z.string().nullable(),
|
|
336
|
+
about_me: z.string().nullable(),
|
|
337
|
+
flag: z.string().nullable(),
|
|
338
|
+
})
|
|
339
|
+
),
|
|
340
|
+
beatmaps: z.array(
|
|
341
|
+
z.object({
|
|
342
|
+
id: z.number(),
|
|
343
|
+
mapId: z.string().nullable(),
|
|
344
|
+
title: z.string().nullable(),
|
|
345
|
+
description: z.string().nullable(),
|
|
346
|
+
image: z.string().nullable(),
|
|
347
|
+
starRating: z.number().nullable(),
|
|
348
|
+
length: z.number().nullable(),
|
|
349
|
+
status: z.string().nullable(),
|
|
350
|
+
tags: z.string().nullable(),
|
|
351
|
+
owner: z.number().nullable(),
|
|
352
|
+
ownerUsername: z.string().nullable(),
|
|
353
|
+
ownerAvatar: z.string().nullable(),
|
|
354
|
+
})
|
|
355
|
+
),
|
|
356
|
+
}),
|
|
347
357
|
};*/
|
|
348
358
|
import { Schema as EnhancedSearch } from "./api/enhancedSearch"
|
|
349
359
|
export { Schema as SchemaEnhancedSearch } from "./api/enhancedSearch"
|
|
@@ -510,30 +520,30 @@ export const Schema = {
|
|
|
510
520
|
image: z.string().nullable().optional(),
|
|
511
521
|
imageLarge: z.string().nullable().optional(),
|
|
512
522
|
starRating: z.number().nullable().optional(),
|
|
513
|
-
owner: z.number().nullable().optional(),
|
|
514
|
-
ownerUsername: z.string().nullable().optional(),
|
|
515
|
-
ownerAvatar: z.string().nullable().optional(),
|
|
516
|
-
status: z.string().nullable().optional(),
|
|
517
|
-
qualified: z.boolean().nullable().optional(),
|
|
518
|
-
qualifiedAt: z.string().nullable().optional(),
|
|
519
|
-
description: z.string().nullable().optional(),
|
|
520
|
-
tags: z.string().nullable().optional(),
|
|
521
|
-
videoUrl: z.string().nullable().optional(),
|
|
522
|
-
vetos: z
|
|
523
|
-
.array(
|
|
524
|
-
z.object({
|
|
525
|
-
id: z.number(),
|
|
526
|
-
userId: z.number().nullable().optional(),
|
|
527
|
-
username: z.string().nullable().optional(),
|
|
528
|
-
avatar_url: z.string().nullable().optional(),
|
|
529
|
-
veto_reason: z.string().nullable().optional(),
|
|
530
|
-
created_at: z.string().nullable().optional(),
|
|
531
|
-
})
|
|
532
|
-
)
|
|
533
|
-
.optional(),
|
|
534
|
-
})
|
|
535
|
-
.optional(),
|
|
536
|
-
}),
|
|
523
|
+
owner: z.number().nullable().optional(),
|
|
524
|
+
ownerUsername: z.string().nullable().optional(),
|
|
525
|
+
ownerAvatar: z.string().nullable().optional(),
|
|
526
|
+
status: z.string().nullable().optional(),
|
|
527
|
+
qualified: z.boolean().nullable().optional(),
|
|
528
|
+
qualifiedAt: z.string().nullable().optional(),
|
|
529
|
+
description: z.string().nullable().optional(),
|
|
530
|
+
tags: z.string().nullable().optional(),
|
|
531
|
+
videoUrl: z.string().nullable().optional(),
|
|
532
|
+
vetos: z
|
|
533
|
+
.array(
|
|
534
|
+
z.object({
|
|
535
|
+
id: z.number(),
|
|
536
|
+
userId: z.number().nullable().optional(),
|
|
537
|
+
username: z.string().nullable().optional(),
|
|
538
|
+
avatar_url: z.string().nullable().optional(),
|
|
539
|
+
veto_reason: z.string().nullable().optional(),
|
|
540
|
+
created_at: z.string().nullable().optional(),
|
|
541
|
+
})
|
|
542
|
+
)
|
|
543
|
+
.optional(),
|
|
544
|
+
})
|
|
545
|
+
.optional(),
|
|
546
|
+
}),
|
|
537
547
|
};*/
|
|
538
548
|
import { Schema as GetBeatmapPage } from "./api/getBeatmapPage"
|
|
539
549
|
export { Schema as SchemaGetBeatmapPage } from "./api/getBeatmapPage"
|
|
@@ -565,6 +575,7 @@ export const Schema = {
|
|
|
565
575
|
userId: z.number().nullable(),
|
|
566
576
|
username: z.string().nullable(),
|
|
567
577
|
avatar_url: z.string().nullable(),
|
|
578
|
+
accuracy: z.number().nullable(),
|
|
568
579
|
})
|
|
569
580
|
)
|
|
570
581
|
.optional(),
|
|
@@ -583,28 +594,28 @@ export const Schema = {
|
|
|
583
594
|
beatmapFile: z.string().nullable().optional(),
|
|
584
595
|
image: z.string().nullable().optional(),
|
|
585
596
|
starRating: z.number().nullable().optional(),
|
|
586
|
-
owner: z.number().nullable().optional(),
|
|
587
|
-
ownerUsername: z.string().nullable().optional(),
|
|
588
|
-
ownerAvatar: z.string().nullable().optional(),
|
|
589
|
-
status: z.string().nullable().optional(),
|
|
590
|
-
qualified: z.boolean().nullable().optional(),
|
|
591
|
-
qualifiedAt: z.string().nullable().optional(),
|
|
592
|
-
videoUrl: z.string().nullable(),
|
|
593
|
-
vetos: z
|
|
594
|
-
.array(
|
|
595
|
-
z.object({
|
|
596
|
-
id: z.number(),
|
|
597
|
-
userId: z.number().nullable().optional(),
|
|
598
|
-
username: z.string().nullable().optional(),
|
|
599
|
-
avatar_url: z.string().nullable().optional(),
|
|
600
|
-
veto_reason: z.string().nullable().optional(),
|
|
601
|
-
created_at: z.string().nullable().optional(),
|
|
602
|
-
})
|
|
603
|
-
)
|
|
604
|
-
.optional(),
|
|
605
|
-
})
|
|
606
|
-
.optional(),
|
|
607
|
-
}),
|
|
597
|
+
owner: z.number().nullable().optional(),
|
|
598
|
+
ownerUsername: z.string().nullable().optional(),
|
|
599
|
+
ownerAvatar: z.string().nullable().optional(),
|
|
600
|
+
status: z.string().nullable().optional(),
|
|
601
|
+
qualified: z.boolean().nullable().optional(),
|
|
602
|
+
qualifiedAt: z.string().nullable().optional(),
|
|
603
|
+
videoUrl: z.string().nullable(),
|
|
604
|
+
vetos: z
|
|
605
|
+
.array(
|
|
606
|
+
z.object({
|
|
607
|
+
id: z.number(),
|
|
608
|
+
userId: z.number().nullable().optional(),
|
|
609
|
+
username: z.string().nullable().optional(),
|
|
610
|
+
avatar_url: z.string().nullable().optional(),
|
|
611
|
+
veto_reason: z.string().nullable().optional(),
|
|
612
|
+
created_at: z.string().nullable().optional(),
|
|
613
|
+
})
|
|
614
|
+
)
|
|
615
|
+
.optional(),
|
|
616
|
+
})
|
|
617
|
+
.optional(),
|
|
618
|
+
}),
|
|
608
619
|
};*/
|
|
609
620
|
import { Schema as GetBeatmapPageById } from "./api/getBeatmapPageById"
|
|
610
621
|
export { Schema as SchemaGetBeatmapPageById } from "./api/getBeatmapPageById"
|
|
@@ -981,15 +992,16 @@ export const Schema = {
|
|
|
981
992
|
verified: z.boolean().nullable(),
|
|
982
993
|
verificationDeadline: z.number().nullable(),
|
|
983
994
|
play_count: z.number().nullable(),
|
|
984
|
-
skill_points: z.number().nullable(),
|
|
985
|
-
squares_hit: z.number().nullable(),
|
|
986
|
-
total_score: z.number().nullable(),
|
|
987
|
-
position: z.number().nullable(),
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
995
|
+
skill_points: z.number().nullable(),
|
|
996
|
+
squares_hit: z.number().nullable(),
|
|
997
|
+
total_score: z.number().nullable(),
|
|
998
|
+
position: z.number().nullable(),
|
|
999
|
+
country_position: z.number().nullable(),
|
|
1000
|
+
activity_status: z.enum(["active", "inactive"]),
|
|
1001
|
+
is_online: z.boolean(),
|
|
1002
|
+
clans: z
|
|
1003
|
+
.object({
|
|
1004
|
+
id: z.number(),
|
|
993
1005
|
acronym: z.string(),
|
|
994
1006
|
})
|
|
995
1007
|
.optional()
|
|
@@ -1185,12 +1197,12 @@ export const Schema = {
|
|
|
1185
1197
|
awarded_sp: z.number().nullable(),
|
|
1186
1198
|
beatmapHash: z.string().nullable(),
|
|
1187
1199
|
created_at: z.string(),
|
|
1188
|
-
id: z.number(),
|
|
1189
|
-
misses: z.number().nullable(),
|
|
1190
|
-
passed: z.boolean().nullable(),
|
|
1191
|
-
replay_url: z.string().nullable().optional(),
|
|
1192
|
-
songId: z.string().nullable(),
|
|
1193
|
-
userId: z.number().nullable(),
|
|
1200
|
+
id: z.number(),
|
|
1201
|
+
misses: z.number().nullable(),
|
|
1202
|
+
passed: z.boolean().nullable(),
|
|
1203
|
+
replay_url: z.string().nullable().optional(),
|
|
1204
|
+
songId: z.string().nullable(),
|
|
1205
|
+
userId: z.number().nullable(),
|
|
1194
1206
|
beatmapDifficulty: z.number().optional().nullable(),
|
|
1195
1207
|
beatmapNotes: z.number().optional().nullable(),
|
|
1196
1208
|
beatmapTitle: z.string().optional().nullable(),
|
|
@@ -1205,12 +1217,12 @@ export const Schema = {
|
|
|
1205
1217
|
id: z.number(),
|
|
1206
1218
|
awarded_sp: z.number().nullable(),
|
|
1207
1219
|
created_at: z.string(),
|
|
1208
|
-
misses: z.number().nullable(),
|
|
1209
|
-
mods: z.record(z.unknown()),
|
|
1210
|
-
passed: z.boolean().nullable(),
|
|
1211
|
-
replay_url: z.string().nullable().optional(),
|
|
1212
|
-
songId: z.string().nullable(),
|
|
1213
|
-
speed: z.number().nullable(),
|
|
1220
|
+
misses: z.number().nullable(),
|
|
1221
|
+
mods: z.record(z.unknown()),
|
|
1222
|
+
passed: z.boolean().nullable(),
|
|
1223
|
+
replay_url: z.string().nullable().optional(),
|
|
1224
|
+
songId: z.string().nullable(),
|
|
1225
|
+
speed: z.number().nullable(),
|
|
1214
1226
|
spin: z.boolean(),
|
|
1215
1227
|
beatmapHash: z.string().nullable(),
|
|
1216
1228
|
beatmapTitle: z.string().nullable(),
|
|
@@ -1225,12 +1237,12 @@ export const Schema = {
|
|
|
1225
1237
|
awarded_sp: z.number().nullable(),
|
|
1226
1238
|
beatmapHash: z.string().nullable(),
|
|
1227
1239
|
created_at: z.string(),
|
|
1228
|
-
id: z.number(),
|
|
1229
|
-
misses: z.number().nullable(),
|
|
1230
|
-
passed: z.boolean().nullable(),
|
|
1231
|
-
replay_url: z.string().nullable().optional(),
|
|
1232
|
-
rank: z.string().nullable(),
|
|
1233
|
-
songId: z.string().nullable(),
|
|
1240
|
+
id: z.number(),
|
|
1241
|
+
misses: z.number().nullable(),
|
|
1242
|
+
passed: z.boolean().nullable(),
|
|
1243
|
+
replay_url: z.string().nullable().optional(),
|
|
1244
|
+
rank: z.string().nullable(),
|
|
1245
|
+
songId: z.string().nullable(),
|
|
1234
1246
|
userId: z.number().nullable(),
|
|
1235
1247
|
beatmapDifficulty: z.number().optional().nullable(),
|
|
1236
1248
|
beatmapNotes: z.number().optional().nullable(),
|
|
@@ -1305,15 +1317,15 @@ export const postBeatmapComment = handleApi({url:"/api/postBeatmapComment",...Po
|
|
|
1305
1317
|
// ./api/qualifyMap.ts API
|
|
1306
1318
|
|
|
1307
1319
|
/*
|
|
1308
|
-
export const Schema = {
|
|
1309
|
-
input: z.strictObject({
|
|
1310
|
-
session: z.string(),
|
|
1311
|
-
mapId: z.number(),
|
|
1312
|
-
}),
|
|
1313
|
-
output: z.object({
|
|
1314
|
-
error: z.string().optional(),
|
|
1315
|
-
qualifiedAt: z.string().optional(),
|
|
1316
|
-
}),
|
|
1320
|
+
export const Schema = {
|
|
1321
|
+
input: z.strictObject({
|
|
1322
|
+
session: z.string(),
|
|
1323
|
+
mapId: z.number(),
|
|
1324
|
+
}),
|
|
1325
|
+
output: z.object({
|
|
1326
|
+
error: z.string().optional(),
|
|
1327
|
+
qualifiedAt: z.string().optional(),
|
|
1328
|
+
}),
|
|
1317
1329
|
};*/
|
|
1318
1330
|
import { Schema as QualifyMap } from "./api/qualifyMap"
|
|
1319
1331
|
export { Schema as SchemaQualifyMap } from "./api/qualifyMap"
|
|
@@ -1408,26 +1420,26 @@ export const submitScore = handleApi({url:"/api/submitScore",...SubmitScore})
|
|
|
1408
1420
|
// ./api/submitScoreInternal.ts API
|
|
1409
1421
|
|
|
1410
1422
|
/*
|
|
1411
|
-
export const Schema = {
|
|
1412
|
-
input: z.strictObject({
|
|
1413
|
-
session: z.string(),
|
|
1414
|
-
secret: z.string(),
|
|
1415
|
-
token: z.string(),
|
|
1416
|
-
data: z.strictObject({
|
|
1417
|
-
onlineMapId: z.number(),
|
|
1418
|
-
misses: z.number(),
|
|
1419
|
-
hits: z.number(),
|
|
1420
|
-
speed: z.number(),
|
|
1421
|
-
mods: z.array(z.string()),
|
|
1422
|
-
spin: z.boolean(),
|
|
1423
|
-
replayBytes: z.string().nullable().optional(),
|
|
1424
|
-
pauses: z.number().nullable().optional(),
|
|
1425
|
-
failTime: z.number().nullable().optional(),
|
|
1426
|
-
}),
|
|
1427
|
-
}),
|
|
1428
|
-
output: z.object({
|
|
1429
|
-
error: z.string().optional(),
|
|
1430
|
-
}),
|
|
1423
|
+
export const Schema = {
|
|
1424
|
+
input: z.strictObject({
|
|
1425
|
+
session: z.string(),
|
|
1426
|
+
secret: z.string(),
|
|
1427
|
+
token: z.string(),
|
|
1428
|
+
data: z.strictObject({
|
|
1429
|
+
onlineMapId: z.number(),
|
|
1430
|
+
misses: z.number(),
|
|
1431
|
+
hits: z.number(),
|
|
1432
|
+
speed: z.number(),
|
|
1433
|
+
mods: z.array(z.string()),
|
|
1434
|
+
spin: z.boolean(),
|
|
1435
|
+
replayBytes: z.string().nullable().optional(),
|
|
1436
|
+
pauses: z.number().nullable().optional(),
|
|
1437
|
+
failTime: z.number().nullable().optional(),
|
|
1438
|
+
}),
|
|
1439
|
+
}),
|
|
1440
|
+
output: z.object({
|
|
1441
|
+
error: z.string().optional(),
|
|
1442
|
+
}),
|
|
1431
1443
|
};*/
|
|
1432
1444
|
import { Schema as SubmitScoreInternal } from "./api/submitScoreInternal"
|
|
1433
1445
|
export { Schema as SchemaSubmitScoreInternal } from "./api/submitScoreInternal"
|
|
@@ -1456,15 +1468,15 @@ export const updateBeatmapPage = handleApi({url:"/api/updateBeatmapPage",...Upda
|
|
|
1456
1468
|
// ./api/vetoMap.ts API
|
|
1457
1469
|
|
|
1458
1470
|
/*
|
|
1459
|
-
export const Schema = {
|
|
1460
|
-
input: z.strictObject({
|
|
1461
|
-
session: z.string(),
|
|
1462
|
-
mapId: z.number(),
|
|
1463
|
-
reason: z.string().min(1).max(1000),
|
|
1464
|
-
}),
|
|
1465
|
-
output: z.object({
|
|
1466
|
-
error: z.string().optional(),
|
|
1467
|
-
}),
|
|
1471
|
+
export const Schema = {
|
|
1472
|
+
input: z.strictObject({
|
|
1473
|
+
session: z.string(),
|
|
1474
|
+
mapId: z.number(),
|
|
1475
|
+
reason: z.string().min(1).max(1000),
|
|
1476
|
+
}),
|
|
1477
|
+
output: z.object({
|
|
1478
|
+
error: z.string().optional(),
|
|
1479
|
+
}),
|
|
1468
1480
|
};*/
|
|
1469
1481
|
import { Schema as VetoMap } from "./api/vetoMap"
|
|
1470
1482
|
export { Schema as SchemaVetoMap } from "./api/vetoMap"
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rhythia-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "234.0.0",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"author": "online-contributors-cunev",
|
|
6
6
|
"scripts": {
|
|
7
|
+
"dev": "wrangler dev",
|
|
8
|
+
"deploy": "wrangler deploy",
|
|
7
9
|
"update": "bun ./scripts/update.ts",
|
|
8
|
-
"ci-deploy": "tsx ./scripts/ci-deploy.ts",
|
|
9
10
|
"test": "tsx ./scripts/test.ts",
|
|
10
11
|
"cache:clear-user-scores": "bun run scripts/clear-user-score-cache.ts",
|
|
11
12
|
"db:optimize-user-scores": "bun run scripts/optimize-user-scores-indexes.ts",
|
|
@@ -13,28 +14,20 @@
|
|
|
13
14
|
"query-push": "bun run scripts/deploy-queries.ts",
|
|
14
15
|
"queries:pull": "bun run scripts/pull-queries.ts",
|
|
15
16
|
"queries:deploy": "bun run scripts/deploy-queries.ts",
|
|
16
|
-
"sync": "npx supabase gen types typescript --project-id \"pfkajngbllcbdzoylrvp\" --schema public > types/database.ts"
|
|
17
|
-
"pipeline:build-api": "tsx ./scripts/build.ts",
|
|
18
|
-
"pipeline:deploy-testing": "tsx ./scripts/build.ts"
|
|
17
|
+
"sync": "npx supabase gen types typescript --project-id \"pfkajngbllcbdzoylrvp\" --schema public > types/database.ts"
|
|
19
18
|
},
|
|
20
19
|
"license": "MIT",
|
|
21
20
|
"dependencies": {
|
|
22
21
|
"@2toad/profanity": "^3.0.0",
|
|
23
22
|
"@aws-sdk/client-s3": "^3.637.0",
|
|
24
|
-
"@aws-sdk/node-http-handler": "^3.374.0",
|
|
25
23
|
"@aws-sdk/s3-request-presigner": "^3.637.0",
|
|
26
|
-
"@netlify/zip-it-and-ship-it": "^9.37.9",
|
|
27
24
|
"@noble/ciphers": "^1.0.0",
|
|
28
25
|
"@supabase/supabase-js": "^2.45.1",
|
|
29
|
-
"@types/aws-lambda": "^8.10.143",
|
|
30
26
|
"@types/bun": "^1.1.6",
|
|
31
27
|
"@types/lodash": "^4.17.7",
|
|
32
28
|
"@types/node": "^22.2.0",
|
|
33
29
|
"@types/pg": "^8.15.5",
|
|
34
30
|
"@types/validator": "^13.12.2",
|
|
35
|
-
"@vercel/edge": "^1.1.2",
|
|
36
|
-
"@vercel/node": "^3.2.8",
|
|
37
|
-
"aws-lambda": "^1.0.7",
|
|
38
31
|
"bad-words": "^4.0.0",
|
|
39
32
|
"badwords-list": "^2.0.1-4",
|
|
40
33
|
"bufferutil": "^4.0.8",
|
|
@@ -43,7 +36,6 @@
|
|
|
43
36
|
"esbuild": "^0.23.0",
|
|
44
37
|
"isomorphic-git": "^1.27.1",
|
|
45
38
|
"lodash": "^4.17.21",
|
|
46
|
-
"next": "^14.2.5",
|
|
47
39
|
"osu-classes": "^3.1.0",
|
|
48
40
|
"osu-parsers": "^4.1.7",
|
|
49
41
|
"osu-standard-stable": "^5.0.0",
|
|
@@ -61,5 +53,8 @@
|
|
|
61
53
|
"zero-width": "^1.0.29",
|
|
62
54
|
"zod": "^3.24.2"
|
|
63
55
|
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"wrangler": "^4.12.0"
|
|
58
|
+
},
|
|
64
59
|
"packageManager": "yarn@1.22.22"
|
|
65
60
|
}
|