make socket url dynamic
This commit is contained in:
parent
2728be796e
commit
fbb7e58f3c
@ -1,11 +1,8 @@
|
|||||||
const toast = require('izitoast');
|
const toast = require('izitoast');
|
||||||
const cbor = require('borc');
|
const cbor = require('borc');
|
||||||
|
|
||||||
const socketUrl = () => {
|
const SOCKET_URL =
|
||||||
if (process.env.NODE_ENV === 'production') return 'wss://mnml.gg/api/ws';
|
`${window.location.protocol === 'https:' ? 'wss://' : 'ws://'}${window.location.host}/api/ws`;
|
||||||
if (process.env.NODE_ENV === 'staging') return 'wss://sixtysix.pro/api/ws';
|
|
||||||
return 'ws://localhost/api/ws';
|
|
||||||
};
|
|
||||||
|
|
||||||
function errorToast(err) {
|
function errorToast(err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
@ -299,7 +296,7 @@ function createSocket(events) {
|
|||||||
ws = null;
|
ws = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ws = new WebSocket(socketUrl());
|
ws = new WebSocket(SOCKET_URL);
|
||||||
ws.binaryType = 'arraybuffer';
|
ws.binaryType = 'arraybuffer';
|
||||||
|
|
||||||
// Listen for messages
|
// Listen for messages
|
||||||
|
|||||||
@ -12,8 +12,9 @@ map $http_upgrade $connection_upgrade {
|
|||||||
'' close;
|
'' close;
|
||||||
}
|
}
|
||||||
|
|
||||||
# DEV
|
|
||||||
server {
|
server {
|
||||||
|
server_name sixtysix.pro;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
root /var/lib/mnml/public/current;
|
root /var/lib/mnml/public/current;
|
||||||
index index.html;
|
index index.html;
|
||||||
@ -40,8 +41,8 @@ server {
|
|||||||
|
|
||||||
listen [::]:443 ssl ipv6only=on; # managed by Certbot
|
listen [::]:443 ssl ipv6only=on; # managed by Certbot
|
||||||
listen 443 ssl; # managed by Certbot
|
listen 443 ssl; # managed by Certbot
|
||||||
ssl_certificate /etc/letsencrypt/live/mnml.gg/fullchain.pem; # managed by Certbot
|
ssl_certificate /etc/letsencrypt/live/sixtysix.pro/fullchain.pem; # managed by Certbot
|
||||||
ssl_certificate_key /etc/letsencrypt/live/mnml.gg/privkey.pem; # managed by Certbot
|
ssl_certificate_key /etc/letsencrypt/live/sixtysix.pro/privkey.pem; # managed by Certbot
|
||||||
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
||||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user