rhythia-api 159.0.0 → 160.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/approveMap.ts +1 -0
- package/api/getBeatmapPage.ts +2 -0
- package/api/getBeatmapPageById.ts +2 -0
- package/api/getPublicStats.ts +1 -1
- package/api/getScore.ts +2 -0
- package/api/getUserScores.ts +4 -0
- package/api/submitScore.ts +18 -6
- package/api/updateBeatmapPage.ts +1 -0
- package/index.ts +7 -1
- package/package.json +2 -2
- package/types/database.ts +12 -0
package/api/approveMap.ts
CHANGED
package/api/getBeatmapPage.ts
CHANGED
|
@@ -16,6 +16,7 @@ export const Schema = {
|
|
|
16
16
|
nominations: z.array(z.number()).nullable().optional(),
|
|
17
17
|
playcount: z.number().nullable().optional(),
|
|
18
18
|
created_at: z.string().nullable().optional(),
|
|
19
|
+
updated_at: z.number().nullable().optional(),
|
|
19
20
|
difficulty: z.number().nullable().optional(),
|
|
20
21
|
noteCount: z.number().nullable().optional(),
|
|
21
22
|
length: z.number().nullable().optional(),
|
|
@@ -82,6 +83,7 @@ export async function handler(
|
|
|
82
83
|
beatmap: {
|
|
83
84
|
playcount: beatmapPage.beatmaps?.playcount,
|
|
84
85
|
created_at: beatmapPage.created_at,
|
|
86
|
+
updated_at: beatmapPage.updated_at,
|
|
85
87
|
difficulty: beatmapPage.beatmaps?.difficulty,
|
|
86
88
|
noteCount: beatmapPage.beatmaps?.noteCount,
|
|
87
89
|
length: beatmapPage.beatmaps?.length,
|
|
@@ -16,6 +16,7 @@ export const Schema = {
|
|
|
16
16
|
nominations: z.array(z.number()).nullable().optional(),
|
|
17
17
|
playcount: z.number().nullable().optional(),
|
|
18
18
|
created_at: z.string().nullable().optional(),
|
|
19
|
+
updated_at: z.number().nullable().optional(),
|
|
19
20
|
difficulty: z.number().nullable().optional(),
|
|
20
21
|
noteCount: z.number().nullable().optional(),
|
|
21
22
|
length: z.number().nullable().optional(),
|
|
@@ -78,6 +79,7 @@ export async function handler(
|
|
|
78
79
|
beatmap: {
|
|
79
80
|
playcount: beatmapPage.beatmaps?.playcount,
|
|
80
81
|
created_at: beatmapPage.created_at,
|
|
82
|
+
updated_at: beatmapPage.updated_at,
|
|
81
83
|
difficulty: beatmapPage.beatmaps?.difficulty,
|
|
82
84
|
noteCount: beatmapPage.beatmaps?.noteCount,
|
|
83
85
|
length: beatmapPage.beatmaps?.length,
|
package/api/getPublicStats.ts
CHANGED
|
@@ -91,7 +91,7 @@ export async function handler(data: (typeof Schema)["input"]["_type"]) {
|
|
|
91
91
|
`
|
|
92
92
|
)
|
|
93
93
|
.eq("status", "RANKED")
|
|
94
|
-
.order("
|
|
94
|
+
.order("ranked_at", { ascending: false })
|
|
95
95
|
.limit(4);
|
|
96
96
|
|
|
97
97
|
let { data: topUsers } = await supabase
|
package/api/getScore.ts
CHANGED
|
@@ -25,6 +25,7 @@ export const Schema = {
|
|
|
25
25
|
beatmapTitle: z.string().optional().nullable(),
|
|
26
26
|
username: z.string().optional().nullable(),
|
|
27
27
|
speed: z.number().optional().nullable(),
|
|
28
|
+
spin: z.boolean().optional().nullable(),
|
|
28
29
|
})
|
|
29
30
|
.optional(),
|
|
30
31
|
}),
|
|
@@ -78,6 +79,7 @@ export async function handler(
|
|
|
78
79
|
beatmapTitle: score.beatmaps?.title,
|
|
79
80
|
username: score.profiles?.username,
|
|
80
81
|
speed: score.speed,
|
|
82
|
+
spin: score.spin,
|
|
81
83
|
},
|
|
82
84
|
});
|
|
83
85
|
}
|
package/api/getUserScores.ts
CHANGED
|
@@ -25,6 +25,7 @@ export const Schema = {
|
|
|
25
25
|
beatmapNotes: z.number().optional().nullable(),
|
|
26
26
|
beatmapTitle: z.string().optional().nullable(),
|
|
27
27
|
speed: z.number().optional().nullable(),
|
|
28
|
+
spin: z.boolean().optional().nullable(),
|
|
28
29
|
})
|
|
29
30
|
)
|
|
30
31
|
.optional(),
|
|
@@ -44,6 +45,7 @@ export const Schema = {
|
|
|
44
45
|
beatmapNotes: z.number().optional().nullable(),
|
|
45
46
|
beatmapTitle: z.string().optional().nullable(),
|
|
46
47
|
speed: z.number().optional().nullable(),
|
|
48
|
+
spin: z.boolean().optional().nullable(),
|
|
47
49
|
})
|
|
48
50
|
)
|
|
49
51
|
.optional(),
|
|
@@ -131,6 +133,7 @@ export async function handler(
|
|
|
131
133
|
beatmapNotes: s.beatmaps?.noteCount,
|
|
132
134
|
beatmapTitle: s.beatmaps?.title,
|
|
133
135
|
speed: s.speed,
|
|
136
|
+
spin: s.spin,
|
|
134
137
|
})),
|
|
135
138
|
top: vals?.map((s) => ({
|
|
136
139
|
created_at: s.created_at,
|
|
@@ -146,6 +149,7 @@ export async function handler(
|
|
|
146
149
|
beatmapNotes: s.beatmaps?.noteCount,
|
|
147
150
|
beatmapTitle: s.beatmaps?.title,
|
|
148
151
|
speed: s.speed,
|
|
152
|
+
spin: s.spin,
|
|
149
153
|
})),
|
|
150
154
|
});
|
|
151
155
|
}
|
package/api/submitScore.ts
CHANGED
|
@@ -19,7 +19,8 @@ export const Schema = {
|
|
|
19
19
|
mapHash: z.string(),
|
|
20
20
|
speed: z.number(),
|
|
21
21
|
mods: z.array(z.string()),
|
|
22
|
-
additionalData: z.
|
|
22
|
+
additionalData: z.any(),
|
|
23
|
+
spin: z.boolean(),
|
|
23
24
|
}),
|
|
24
25
|
}),
|
|
25
26
|
output: z.object({
|
|
@@ -37,11 +38,13 @@ export function calculatePerformancePoints(
|
|
|
37
38
|
starRating: number,
|
|
38
39
|
accuracy: number
|
|
39
40
|
) {
|
|
40
|
-
return
|
|
41
|
-
Math.
|
|
42
|
-
(
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
return (
|
|
42
|
+
Math.round(
|
|
43
|
+
Math.pow(
|
|
44
|
+
(starRating * easeInExpoDeqHard(accuracy, starRating) * 100) / 2,
|
|
45
|
+
2
|
|
46
|
+
) / 1000
|
|
47
|
+
) * 2
|
|
45
48
|
);
|
|
46
49
|
}
|
|
47
50
|
|
|
@@ -71,6 +74,7 @@ export async function handler({
|
|
|
71
74
|
speed: data.speed,
|
|
72
75
|
mods: data.mods,
|
|
73
76
|
additionalData: data.additionalData,
|
|
77
|
+
spin: data.spin,
|
|
74
78
|
})
|
|
75
79
|
) {
|
|
76
80
|
return NextResponse.json(
|
|
@@ -180,6 +184,12 @@ export async function handler({
|
|
|
180
184
|
}
|
|
181
185
|
|
|
182
186
|
console.log("p1");
|
|
187
|
+
|
|
188
|
+
let parsed = [];
|
|
189
|
+
|
|
190
|
+
try {
|
|
191
|
+
parsed = JSON.parse(decryptString(data.additionalData));
|
|
192
|
+
} catch (error) {}
|
|
183
193
|
await supabase.from("scores").upsert({
|
|
184
194
|
beatmapHash: data.mapHash,
|
|
185
195
|
replayHwid: data.relayHwid,
|
|
@@ -190,6 +200,8 @@ export async function handler({
|
|
|
190
200
|
awarded_sp: Math.round(awarded_sp * 100) / 100,
|
|
191
201
|
speed: data.speed,
|
|
192
202
|
mods: data.mods,
|
|
203
|
+
additional_data: parsed,
|
|
204
|
+
spin: data.spin || false,
|
|
193
205
|
});
|
|
194
206
|
console.log("p2");
|
|
195
207
|
|
package/api/updateBeatmapPage.ts
CHANGED
package/index.ts
CHANGED
|
@@ -191,6 +191,7 @@ export const Schema = {
|
|
|
191
191
|
nominations: z.array(z.number()).nullable().optional(),
|
|
192
192
|
playcount: z.number().nullable().optional(),
|
|
193
193
|
created_at: z.string().nullable().optional(),
|
|
194
|
+
updated_at: z.number().nullable().optional(),
|
|
194
195
|
difficulty: z.number().nullable().optional(),
|
|
195
196
|
noteCount: z.number().nullable().optional(),
|
|
196
197
|
length: z.number().nullable().optional(),
|
|
@@ -230,6 +231,7 @@ export const Schema = {
|
|
|
230
231
|
nominations: z.array(z.number()).nullable().optional(),
|
|
231
232
|
playcount: z.number().nullable().optional(),
|
|
232
233
|
created_at: z.string().nullable().optional(),
|
|
234
|
+
updated_at: z.number().nullable().optional(),
|
|
233
235
|
difficulty: z.number().nullable().optional(),
|
|
234
236
|
noteCount: z.number().nullable().optional(),
|
|
235
237
|
length: z.number().nullable().optional(),
|
|
@@ -507,6 +509,7 @@ export const Schema = {
|
|
|
507
509
|
beatmapTitle: z.string().optional().nullable(),
|
|
508
510
|
username: z.string().optional().nullable(),
|
|
509
511
|
speed: z.number().optional().nullable(),
|
|
512
|
+
spin: z.boolean().optional().nullable(),
|
|
510
513
|
})
|
|
511
514
|
.optional(),
|
|
512
515
|
}),
|
|
@@ -553,6 +556,7 @@ export const Schema = {
|
|
|
553
556
|
beatmapNotes: z.number().optional().nullable(),
|
|
554
557
|
beatmapTitle: z.string().optional().nullable(),
|
|
555
558
|
speed: z.number().optional().nullable(),
|
|
559
|
+
spin: z.boolean().optional().nullable(),
|
|
556
560
|
})
|
|
557
561
|
)
|
|
558
562
|
.optional(),
|
|
@@ -572,6 +576,7 @@ export const Schema = {
|
|
|
572
576
|
beatmapNotes: z.number().optional().nullable(),
|
|
573
577
|
beatmapTitle: z.string().optional().nullable(),
|
|
574
578
|
speed: z.number().optional().nullable(),
|
|
579
|
+
spin: z.boolean().optional().nullable(),
|
|
575
580
|
})
|
|
576
581
|
)
|
|
577
582
|
.optional(),
|
|
@@ -686,7 +691,8 @@ export const Schema = {
|
|
|
686
691
|
mapHash: z.string(),
|
|
687
692
|
speed: z.number(),
|
|
688
693
|
mods: z.array(z.string()),
|
|
689
|
-
additionalData: z.
|
|
694
|
+
additionalData: z.any(),
|
|
695
|
+
spin: z.boolean(),
|
|
690
696
|
}),
|
|
691
697
|
}),
|
|
692
698
|
output: z.object({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rhythia-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "160.0.0",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update": "bun ./scripts/update.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"osu-standard-stable": "^5.0.0",
|
|
40
40
|
"sharp": "^0.33.5",
|
|
41
41
|
"simple-git": "^3.25.0",
|
|
42
|
-
"supabase": "^2.
|
|
42
|
+
"supabase": "^2.1.1",
|
|
43
43
|
"tsx": "^4.17.0",
|
|
44
44
|
"utf-8-validate": "^6.0.4",
|
|
45
45
|
"zod": "^3.23.8"
|
package/types/database.ts
CHANGED
|
@@ -57,9 +57,11 @@ export type Database = {
|
|
|
57
57
|
latestBeatmapHash: string | null
|
|
58
58
|
nominations: Json | null
|
|
59
59
|
owner: number | null
|
|
60
|
+
ranked_at: number
|
|
60
61
|
status: string | null
|
|
61
62
|
tags: string
|
|
62
63
|
title: string | null
|
|
64
|
+
updated_at: number | null
|
|
63
65
|
}
|
|
64
66
|
Insert: {
|
|
65
67
|
created_at?: string
|
|
@@ -69,9 +71,11 @@ export type Database = {
|
|
|
69
71
|
latestBeatmapHash?: string | null
|
|
70
72
|
nominations?: Json | null
|
|
71
73
|
owner?: number | null
|
|
74
|
+
ranked_at?: number
|
|
72
75
|
status?: string | null
|
|
73
76
|
tags?: string
|
|
74
77
|
title?: string | null
|
|
78
|
+
updated_at?: number | null
|
|
75
79
|
}
|
|
76
80
|
Update: {
|
|
77
81
|
created_at?: string
|
|
@@ -81,9 +85,11 @@ export type Database = {
|
|
|
81
85
|
latestBeatmapHash?: string | null
|
|
82
86
|
nominations?: Json | null
|
|
83
87
|
owner?: number | null
|
|
88
|
+
ranked_at?: number
|
|
84
89
|
status?: string | null
|
|
85
90
|
tags?: string
|
|
86
91
|
title?: string | null
|
|
92
|
+
updated_at?: number | null
|
|
87
93
|
}
|
|
88
94
|
Relationships: [
|
|
89
95
|
{
|
|
@@ -241,6 +247,7 @@ export type Database = {
|
|
|
241
247
|
}
|
|
242
248
|
scores: {
|
|
243
249
|
Row: {
|
|
250
|
+
additional_data: Json
|
|
244
251
|
awarded_sp: number | null
|
|
245
252
|
beatmapHash: string | null
|
|
246
253
|
created_at: string
|
|
@@ -251,9 +258,11 @@ export type Database = {
|
|
|
251
258
|
replayHwid: string | null
|
|
252
259
|
songId: string | null
|
|
253
260
|
speed: number | null
|
|
261
|
+
spin: boolean
|
|
254
262
|
userId: number | null
|
|
255
263
|
}
|
|
256
264
|
Insert: {
|
|
265
|
+
additional_data?: Json
|
|
257
266
|
awarded_sp?: number | null
|
|
258
267
|
beatmapHash?: string | null
|
|
259
268
|
created_at?: string
|
|
@@ -264,9 +273,11 @@ export type Database = {
|
|
|
264
273
|
replayHwid?: string | null
|
|
265
274
|
songId?: string | null
|
|
266
275
|
speed?: number | null
|
|
276
|
+
spin?: boolean
|
|
267
277
|
userId?: number | null
|
|
268
278
|
}
|
|
269
279
|
Update: {
|
|
280
|
+
additional_data?: Json
|
|
270
281
|
awarded_sp?: number | null
|
|
271
282
|
beatmapHash?: string | null
|
|
272
283
|
created_at?: string
|
|
@@ -277,6 +288,7 @@ export type Database = {
|
|
|
277
288
|
replayHwid?: string | null
|
|
278
289
|
songId?: string | null
|
|
279
290
|
speed?: number | null
|
|
291
|
+
spin?: boolean
|
|
280
292
|
userId?: number | null
|
|
281
293
|
}
|
|
282
294
|
Relationships: [
|