File tree Expand file tree Collapse file tree 4 files changed +25
-18
lines changed Expand file tree Collapse file tree 4 files changed +25
-18
lines changed Original file line number Diff line number Diff line change 1414 "@sveltejs/adapter-node" : " ^5.2.8" ,
1515 "@sveltejs/kit" : " ^2.7.2" ,
1616 "@sveltejs/vite-plugin-svelte" : " ^3.1.2" ,
17+ "@types/semver" : " ^7.5.8" ,
1718 "mdsvex" : " ^0.12.3" ,
1819 "postcss" : " ^8.4.47" ,
1920 "postcss-import" : " ^15.1.0" ,
2627 "unist-util-visit" : " ^4.1.2" ,
2728 "vite" : " ^5.4.9"
2829 },
29- "type" : " module"
30+ "type" : " module" ,
31+ "dependencies" : {
32+ "semver" : " ^7.6.3"
33+ }
3034}
Original file line number Diff line number Diff line change 11<script lang =" ts" >
22 import type { Stats } from " $lib/stats" ;
3+ import semver from " semver" ;
34
45 export let stats: Stats ;
56
67 function prettyNumber(x : number ) {
78 return x .toString ().replace (/ \B (?=(\d {3} )+ (?!\d ))/ g , " " );
89 }
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+ }
922 </script >
1023
1124<div class =" container" >
1528 <p >Online Players: {prettyNumber (stats .onlinePlayers )}</p >
1629
1730 <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 >
2032 <p >If you're looking for older versions of Meteor, read <a href =" /faq/old-versions" >this</a >.</p >
2133 <a href ="/api/downloadBaritone" target ="_blank" class ="button" ><img src ="/icons/download.svg" alt ="download" > *Baritone [{stats .baritoneMcVersion }]</a >
2234 </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+ }
44
5- mcVersion : string ;
6- devBuildMcVersion : string ;
5+ export interface Stats {
6+ builds : Builds ;
77 baritoneMcVersion : string ;
88
99 downloads : number ;
@@ -14,11 +14,7 @@ export async function fetchStats(fetch: any): Promise<Stats> {
1414 let stats = await ( await fetch ( "https://meteorclient.com/api/stats" ) ) . json ( ) ;
1515
1616 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 ,
2218 baritoneMcVersion : stats . baritone_mc_version ,
2319
2420 downloads : stats . downloads ,
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments