Skip to content

Commit 89fc24f

Browse files
committed
server=ip:port in param
1 parent fea2535 commit 89fc24f

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

src/scripts/UrlParams.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ function UrlParams (game) {
66
const finalName = nameList[Math.floor(Math.random() * nameList.length)]
77
game.nick = new URL(document.location).searchParams.get('nick')
88
game.server = new URL(document.location).searchParams.get('server')
9-
game.serverPort = new URL(document.location).searchParams.get('port')
109
game.premium = new URL(document.location).searchParams.get('premium')
1110
game.proxy = new URL(document.location).searchParams.get('proxy')
1211
let reload = false
@@ -16,15 +15,7 @@ function UrlParams (game) {
1615
}
1716
if (game.server === '' || game.server === null) {
1817
reload = true
19-
game.server = game.production
20-
? game.servers.production[0]
21-
: game.servers.development[0]
22-
}
23-
if (game.serverPort === '' || game.serverPort === null) {
24-
reload = true
25-
game.serverPort = game.production
26-
? game.servers.production[1]
27-
: game.servers.development[1]
18+
game.server = game.production ? game.servers.production : game.servers.development
2819
}
2920
if (game.premium === '' || game.premium === null) {
3021
reload = true
@@ -43,7 +34,7 @@ function UrlParams (game) {
4334
}
4435
}
4536
if (reload) {
46-
document.location.href = `?server=${game.server}&port=${game.serverPort}&nick=${game.nick}&premium=${game.premium}&proxy=${game.proxy}`
37+
document.location.href = `?server=${game.server}&nick=${game.nick}&premium=${game.premium}&proxy=${game.proxy}`
4738
} else {
4839
if (game.premium === 'true') {
4940
swal({

src/scripts/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class Game {
1414
console.log('Running in development mode')
1515
}
1616
this.servers = {
17-
production: ['185.228.139.97', '25564'],
18-
development: ['localhost', '25565']
17+
production: '185.228.139.97:25564',
18+
development: 'localhost:25565'
1919
}
2020
this.fov = {
2121
normal: 70,

src/scripts/proxy/Socket.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ class Socket {
1616
hostname = pars[1]
1717
port = pars[2]
1818
}
19+
const server = this.game.server.split(':')
1920
this.emit('init', {
2021
connection,
2122
hostname,
2223
port,
2324
nick: this.game.nick,
24-
server: this.game.server,
25-
serverPort: this.game.serverPort,
25+
server: server[0],
26+
serverPort: server[1],
2627
password: this.game.password
2728
})
2829
this.worker.onmessage = (msg) => {

0 commit comments

Comments
 (0)