Skip to content

Commit b85bb81

Browse files
committed
one production proxy (only https)
1 parent b0b2c14 commit b85bb81

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

src/assets/config.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"minecraftProduction": "185.228.139.97:25564",
33
"minecraftDevelopment":"185.228.139.97:25564",
4-
"proxyHTTPS": "wss:web-minecraft-proxy.herokuapp.com:443",
5-
"proxyHTTP": "ws:web-minecraft-proxy.herokuapp.com:80"
4+
"proxy": "web-minecraft-proxy.herokuapp.com:443"
65
}

src/scripts/UrlParams.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ function UrlParams (game) {
1616
if (game.proxy === '' || game.proxy === null) {
1717
reload = true
1818
if (game.production) {
19-
if (document.location.protocol === 'https:') {
20-
game.proxy = game.al.get('config').proxyHTTPS
21-
} else {
22-
game.proxy = game.al.get('config').proxyHTTP
23-
}
19+
game.proxy = 'production'
2420
} else {
2521
game.proxy = 'local'
2622
}
2723
}
24+
if (document.location.protocol !== 'https:' && game.proxy === 'production') {
25+
console.error('Web-minecraft in production mode needs https!')
26+
}
2827
if (reload) {
2928
document.location.href = `?server=${game.server}&nick=${game.nick}&proxy=${game.proxy}`
3029
}

src/scripts/proxy/Proxy.worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ addEventListener('message', function (e) {
2121
case 'init':
2222
data = data[0]
2323
console.log(data)
24-
bot = self.mineflayer(data.connection, data.hostname, data.port, {
24+
bot = self.mineflayer(null, data.hostname, data.port, {
2525
host: data.server,
2626
port: data.serverPort,
2727
username: data.nick

src/scripts/proxy/Socket.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,24 @@ class Socket {
55
this.game = game
66
this.worker = new Proxy()
77
this.handlers = new Map()
8-
let connection, hostname, port
8+
let hostname, port, pars
99
if (this.game.proxy === 'local') {
10-
connection = document.location.protocol === 'https:' ? 'wss' : 'ws'
1110
hostname = document.location.hostname
1211
port = document.location.port
12+
} else if (this.game.proxy === 'production') {
13+
pars = game.al.get('config').proxy.split(':')
14+
hostname = pars[0]
15+
port = pars[1]
1316
} else {
14-
const pars = this.game.proxy.split(':')
15-
connection = pars[0]
16-
hostname = pars[1]
17-
port = pars[2]
17+
pars = this.game.proxy.split(':')
18+
hostname = pars[0]
19+
port = pars[1]
1820
}
1921
let server = this.game.server.split(':')
2022
if (server.length === 1) {
2123
server = [server[0], null]
2224
}
2325
this.emit('init', {
24-
connection,
2526
hostname,
2627
port,
2728
nick: this.game.nick,

0 commit comments

Comments
 (0)