Skip to content

Commit

Permalink
Implement helios-core and use Server List Ping protocol.
Browse files Browse the repository at this point in the history
  • Loading branch information
dscalzi committed Oct 31, 2021
1 parent a2168da commit 9c6d75f
Show file tree
Hide file tree
Showing 5 changed files with 5,360 additions and 791 deletions.
62 changes: 0 additions & 62 deletions app/assets/js/assetguard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 7 additions & 6 deletions app/assets/js/scripts/landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// Requirements
const cp = require('child_process')
const crypto = require('crypto')
const {URL} = require('url')
const { URL } = require('url')
const { getServerStatus } = require('helios-core')

// Internal Requirements
const DiscordWrapper = require('./assets/js/discordwrapper')
Expand Down Expand Up @@ -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){
pLabel = 'PLAYERS'
pVal = servStat.onlinePlayers + '/' + servStat.maxPlayers
}

const servStat = await getServerStatus(47, serverURL.hostname, Number(serverURL.port))
console.log(servStat)
pLabel = 'PLAYERS'
pVal = servStat.players.online + '/' + servStat.players.max

} catch (err) {
loggerLanding.warn('Unable to refresh server status, assuming offline.')
Expand Down
2 changes: 1 addition & 1 deletion app/assets/js/scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Loading

0 comments on commit 9c6d75f

Please sign in to comment.