Implement helios-core and use Server List Ping protocol.
This commit is contained in:
parent
a2168da999
commit
9c6d75f812
@ -1627,68 +1627,6 @@ class AssetGuard extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
// _enqueueOracleJRE(dataDir){
|
||||
// return new Promise((resolve, reject) => {
|
||||
// JavaGuard._latestJREOracle().then(verData => {
|
||||
// if(verData != null){
|
||||
|
||||
// const combined = verData.uri + PLATFORM_MAP[process.platform]
|
||||
|
||||
// const opts = {
|
||||
// url: combined,
|
||||
// headers: {
|
||||
// 'Cookie': 'oraclelicense=accept-securebackup-cookie'
|
||||
// }
|
||||
// }
|
||||
|
||||
// request.head(opts, (err, resp, body) => {
|
||||
// if(err){
|
||||
// resolve(false)
|
||||
// } else {
|
||||
// dataDir = path.join(dataDir, 'runtime', 'x64')
|
||||
// const name = combined.substring(combined.lastIndexOf('/')+1)
|
||||
// const fDir = path.join(dataDir, name)
|
||||
// const jre = new Asset(name, null, parseInt(resp.headers['content-length']), opts, fDir)
|
||||
// this.java = new DLTracker([jre], jre.size, (a, self) => {
|
||||
// let h = null
|
||||
// fs.createReadStream(a.to)
|
||||
// .on('error', err => console.log(err))
|
||||
// .pipe(zlib.createGunzip())
|
||||
// .on('error', err => console.log(err))
|
||||
// .pipe(tar.extract(dataDir, {
|
||||
// map: (header) => {
|
||||
// if(h == null){
|
||||
// h = header.name
|
||||
// }
|
||||
// }
|
||||
// }))
|
||||
// .on('error', err => console.log(err))
|
||||
// .on('finish', () => {
|
||||
// fs.unlink(a.to, err => {
|
||||
// if(err){
|
||||
// console.log(err)
|
||||
// }
|
||||
// if(h.indexOf('/') > -1){
|
||||
// h = h.substring(0, h.indexOf('/'))
|
||||
// }
|
||||
// const pos = path.join(dataDir, h)
|
||||
// self.emit('complete', 'java', JavaGuard.javaExecFromRoot(pos))
|
||||
// })
|
||||
// })
|
||||
|
||||
// })
|
||||
// resolve(true)
|
||||
// }
|
||||
// })
|
||||
|
||||
// } else {
|
||||
// resolve(false)
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
|
||||
// }
|
||||
|
||||
// _enqueueMojangJRE(dir){
|
||||
// return new Promise((resolve, reject) => {
|
||||
// // Mojang does not host the JRE for linux.
|
||||
|
@ -5,6 +5,7 @@
|
||||
const cp = require('child_process')
|
||||
const crypto = require('crypto')
|
||||
const { URL } = require('url')
|
||||
const { getServerStatus } = require('helios-core')
|
||||
|
||||
// Internal Requirements
|
||||
const DiscordWrapper = require('./assets/js/discordwrapper')
|
||||
@ -225,11 +226,11 @@ const refreshServerStatus = async function(fade = false){
|
||||
|
||||
try {
|
||||
const serverURL = new URL('my://' + serv.getAddress())
|
||||
const servStat = await ServerStatus.getStatus(serverURL.hostname, serverURL.port)
|
||||
if(servStat.online){
|
||||
|
||||
const servStat = await getServerStatus(47, serverURL.hostname, Number(serverURL.port))
|
||||
console.log(servStat)
|
||||
pLabel = 'PLAYERS'
|
||||
pVal = servStat.onlinePlayers + '/' + servStat.maxPlayers
|
||||
}
|
||||
pVal = servStat.players.online + '/' + servStat.players.max
|
||||
|
||||
} catch (err) {
|
||||
loggerLanding.warn('Unable to refresh server status, assuming offline.')
|
||||
|
@ -85,7 +85,7 @@ bindFileSelectors()
|
||||
/**
|
||||
* Bind value validators to the settings UI elements. These will
|
||||
* validate against the criteria defined in the ConfigManager (if
|
||||
* and). If the value is invalid, the UI will reflect this and saving
|
||||
* any). If the value is invalid, the UI will reflect this and saving
|
||||
* will be disabled until the value is corrected. This is an automated
|
||||
* process. More complex UI may need to be bound separately.
|
||||
*/
|
||||
|
6045
package-lock.json
generated
6045
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -32,6 +32,7 @@
|
||||
"electron-updater": "^4.3.9",
|
||||
"fs-extra": "^10.0.0",
|
||||
"github-syntax-dark": "^0.5.0",
|
||||
"helios-core": "^0.1.0-alpha.3",
|
||||
"jquery": "^3.6.0",
|
||||
"node-stream-zip": "^1.15.0",
|
||||
"request": "^2.88.2",
|
||||
|
Loading…
Reference in New Issue
Block a user