mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-09 15:02:33 -04:00
Move port and hostname to the server object
This commit is contained in:
parent
d4f9acee6a
commit
5fa2fcb0d9
3 changed files with 49 additions and 23 deletions
|
@ -133,10 +133,13 @@ router.post("/api", headerAuthMiddleware, async (request, response) => {
|
|||
|
||||
const requestData = request.body;
|
||||
|
||||
console.log(requestData);
|
||||
let hostname = "localhost";
|
||||
if (server.hostname) {
|
||||
hostname = server.hostname;
|
||||
}
|
||||
const protocol = (server.isHTTPS) ? "wss" : "ws";
|
||||
|
||||
// TODO: should not hard coded
|
||||
let wsURL = "ws://localhost:3001";
|
||||
let wsURL = `${protocol}://${hostname}:${server.port}`;
|
||||
|
||||
const socket = ioClient(wsURL, {
|
||||
transports: [ "websocket" ],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue