add secure protocol
Some checks reported errors
continuous-integration/drone/pr Build was killed
continuous-integration/drone/push Build is passing

Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
Christian Richter
2022-07-19 11:19:05 +02:00
parent 4e13c78c5a
commit fa5216c8d4
3 changed files with 8 additions and 2 deletions

View File

@@ -112,7 +112,7 @@
}
console.log("Connecting to socket");
socketSemaphore = true;
let socket = new WebSocket("ws://" + wsBaseUrl);
let socket = new WebSocket(wsBaseUrl);
socket.onopen = function (e) {
clearInterval(socketConnector);
socketConnector = null;

View File

@@ -3,6 +3,7 @@
"accessToken": "youraccesstokencanbeobtainedthroughriot",
"domain": "yourdomain.tld",
"webSocketDomain": "ws.yourdomain.tld",
"secure":true,
"storage": "config/bot.json",
"assetDir": "assets/",
"webServerPort": "8080",

View File

@@ -21,9 +21,14 @@ const client = new MatrixClient(
);
// write javascript for baseurl
if (config.secure) {
urlConfigData = `var baseUrl = "https://${config.domain}";\nvar wsBaseUrl = "wss://${config.webSocketDomain}";\n`;
} else {
urlConfigData = `var baseUrl = "http://${config.domain}";\nvar wsBaseUrl = "ws://${config.webSocketDomain}";\n`;
}
fs.writeFileSync(
config.assetDir + "/baseurl.js",
`var baseUrl = "${config.domain}";\nvar wsBaseUrl = "${config.webSocketDomain}";\n`,
urlConfigData,
function (err) {
if (err) return console.log(err);
}