File tree 4 files changed +25
-18
lines changed
4 files changed +25
-18
lines changed Original file line number Diff line number Diff line change 14
14
"@sveltejs/adapter-node" : " ^5.2.8" ,
15
15
"@sveltejs/kit" : " ^2.7.2" ,
16
16
"@sveltejs/vite-plugin-svelte" : " ^3.1.2" ,
17
+ "@types/semver" : " ^7.5.8" ,
17
18
"mdsvex" : " ^0.12.3" ,
18
19
"postcss" : " ^8.4.47" ,
19
20
"postcss-import" : " ^15.1.0" ,
26
27
"unist-util-visit" : " ^4.1.2" ,
27
28
"vite" : " ^5.4.9"
28
29
},
29
- "type" : " module"
30
+ "type" : " module" ,
31
+ "dependencies" : {
32
+ "semver" : " ^7.6.3"
33
+ }
30
34
}
Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
2
import type { Stats } from " $lib/stats" ;
3
+ import semver from " semver" ;
3
4
4
5
export let stats: Stats ;
5
6
6
7
function prettyNumber(x : number ) {
7
8
return x .toString ().replace (/ \B (?=(\d {3} )+ (?!\d ))/ g , " " );
8
9
}
10
+
11
+ function getLatestVersion(): string {
12
+ let latest = " 0.0.0" ;
13
+
14
+ for (const version of Object .keys (stats .builds )) {
15
+ if (semver .gt (version , latest )) {
16
+ latest = version ;
17
+ }
18
+ }
19
+
20
+ return latest ;
21
+ }
9
22
</script >
10
23
11
24
<div class =" container" >
15
28
<p >Online Players: {prettyNumber (stats .onlinePlayers )}</p >
16
29
17
30
<div class =" buttons" >
18
- <a href ="https://adfoc.us/81926897739205" target ="_blank" class ="button" ><img src ="/icons/download.svg" alt ="download" > Release {stats .version } [{stats .mcVersion }]</a >
19
- <a href ="https://adfoc.us/819268106314032" target ="_blank" class ="button" ><img src ="/icons/download.svg" alt ="download" > Dev Build {stats .devBuildVersion } [{stats .devBuildMcVersion }]</a >
31
+ <a href ="https://adfoc.us/81926897739205" target ="_blank" class ="button" ><img src ="/icons/download.svg" alt ="download" > Meteor Client [{getLatestVersion ()} - {stats .builds [getLatestVersion ()]}]</a >
20
32
<p >If you're looking for older versions of Meteor, read <a href =" /faq/old-versions" >this</a >.</p >
21
33
<a href ="/api/downloadBaritone" target ="_blank" class ="button" ><img src ="/icons/download.svg" alt ="download" > *Baritone [{stats .baritoneMcVersion }]</a >
22
34
</div >
Original file line number Diff line number Diff line change 1
- export interface Stats {
2
- version : string ;
3
- devBuildVersion : string ;
1
+ export interface Builds {
2
+ [ version : string ] : number ;
3
+ }
4
4
5
- mcVersion : string ;
6
- devBuildMcVersion : string ;
5
+ export interface Stats {
6
+ builds : Builds ;
7
7
baritoneMcVersion : string ;
8
8
9
9
downloads : number ;
@@ -14,11 +14,7 @@ export async function fetchStats(fetch: any): Promise<Stats> {
14
14
let stats = await ( await fetch ( "https://meteorclient.com/api/stats" ) ) . json ( ) ;
15
15
16
16
return {
17
- version : stats . version ,
18
- devBuildVersion : stats . dev_build_version ,
19
-
20
- mcVersion : stats . mc_version ,
21
- devBuildMcVersion : stats . dev_build_mc_version ,
17
+ builds : stats . builds ,
22
18
baritoneMcVersion : stats . baritone_mc_version ,
23
19
24
20
downloads : stats . downloads ,
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments