Skip to content

Commit 011431c

Browse files
committed
update
1 parent 25838f6 commit 011431c

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

src/data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const data: Category[] = [
4242
description: "A Russian recreation of Counter Strike with insane custom models and GUIs.",
4343
link: "https://cherry.pizza",
4444
version: "1.21.11",
45-
ip: "cherry.pizza"
45+
ip: "play.cherry.pizza"
4646
},
4747
{
4848
name: "kloon.io",

src/generator.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ export async function fetchLatestRelease(owner: string, repository: string): Pro
88
return (await response.json()).tag_name;
99
}
1010

11+
export async function fetchLatestMavenVersion(groupId: string, artifactId: string): Promise<string> {
12+
const response = await fetch(`/api/maven-version?group=${groupId}&artifact=${artifactId}`);
13+
return (await response.json()).version;
14+
}
15+
1116
export interface Repository {
1217
url: string;
1318
}
@@ -48,7 +53,7 @@ export const optionalDependencies: Record<string, Dependency> = {
4853
name: "MinestomPvP",
4954
group: "io.github.togar2",
5055
artifact: "MinestomPvP",
51-
version: "2025.12.29-1.21.11",
56+
version: () => fetchLatestMavenVersion("io.github.togar2", "MinestomPvP"),
5257
},
5358
polar: {
5459
name: "Polar",

src/pages/api/maven-version.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export async function GET({ url }: { url: URL }) {
2+
const groupId = url.searchParams.get('group');
3+
const artifactId = url.searchParams.get('artifact');
4+
5+
if (!groupId || !artifactId) {
6+
return new Response(JSON.stringify({ error: 'Missing parameters' }), { status: 400 });
7+
}
8+
9+
try {
10+
const response = await fetch(`https://repo1.maven.org/maven2/${groupId.replace(/\./g, '/')}/${artifactId}/maven-metadata.xml`);
11+
const text = await response.text();
12+
const version = (text.match(/<latest>(.*?)<\/latest>/) || text.match(/<release>(.*?)<\/release>/))?.[1];
13+
14+
if (!version) {
15+
return new Response(JSON.stringify({ error: 'Version not found' }), { status: 404 });
16+
}
17+
18+
return new Response(JSON.stringify({ version }), {
19+
headers: { 'Content-Type': 'application/json' }
20+
});
21+
} catch (error) {
22+
return new Response(JSON.stringify({ error: 'Failed to fetch version' }), { status: 500 });
23+
}
24+
}

0 commit comments

Comments
 (0)