-
-
Notifications
You must be signed in to change notification settings - Fork 911
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
401d3b0
commit b279889
Showing
17 changed files
with
123 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). | ||
* Copyright (c) Meteor Development. | ||
*/ | ||
|
||
const { getMcVersion } = require("./mc_version") | ||
|
||
const mcVersion = await getMcVersion(); | ||
|
||
fetch("https://meteorclient.com/api/stats") | ||
.then(async res => { | ||
let stats = await res.json() | ||
let build = 0 | ||
|
||
if (mcVersion in stats.builds) { | ||
build = parseInt(stats.builds[mcVersion]) | ||
} | ||
|
||
console.log("number=" + (build + 1)) | ||
}) | ||
.catch(err => { | ||
console.log("Failed to fetch stats:") | ||
console.log(err) | ||
process.exit(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). | ||
* Copyright (c) Meteor Development. | ||
*/ | ||
|
||
const fs = require("fs") | ||
const readline = require("readline") | ||
|
||
export async function getMcVersion() { | ||
let lines = readline.createInterface({ | ||
input: fs.createReadStream("../../gradle.properties"), | ||
crlfDelay: Infinity | ||
}) | ||
|
||
let mcVersion = "" | ||
|
||
for await (const line of lines) { | ||
if (line.startsWith("minecraft_version")) { | ||
mcVersion = line.substring(0, line.indexOf("=")) | ||
break | ||
} | ||
} | ||
|
||
if (mcVersion === "") { | ||
console.log("Failed to read minecraft_version") | ||
process.exit(1) | ||
} | ||
|
||
return mcVersion | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,5 @@ | |
"scripts": { | ||
"get_number": "node get_number.js", | ||
"start": "node index.js" | ||
}, | ||
"dependencies": {} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.