]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
use baseURI for websocket and api calls
authorpuuu <puuu@users.noreply.github.com>
Tue, 11 May 2021 08:28:06 +0000 (17:28 +0900)
committerpuuu <puuu@users.noreply.github.com>
Fri, 14 May 2021 05:44:13 +0000 (14:44 +0900)
src-ui/src/app/services/consumer-status.service.ts
src-ui/src/environments/environment.prod.ts
src-ui/src/environments/environment.ts

index e0328217568bd1c1438e6df10df16ba9219e5fec..4a729b29d223c3e7cad96c4e2f16d0e9d7c1826d 100644 (file)
@@ -125,7 +125,7 @@ export class ConsumerStatusService {
   connect() {
     this.disconnect()
 
-    this.statusWebSocket = new WebSocket(`${environment.webSocketProtocol}//${environment.webSocketHost}/ws/status/`);
+    this.statusWebSocket = new WebSocket(`${environment.webSocketProtocol}//${environment.webSocketHost}${environment.webSocketBaseUrl}status/`);
     this.statusWebSocket.onmessage = (ev) => {
       let statusMessage: WebsocketConsumerStatusMessage = JSON.parse(ev['data'])
 
index b60824248cfd8f415c858f46e4134c6abc838bf1..54c32d370c344c951c138e123f620e5b72958d90 100644 (file)
@@ -1,9 +1,12 @@
+const base_url = new URL(document.baseURI)
+
 export const environment = {
   production: true,
-  apiBaseUrl: "/api/",
+  apiBaseUrl: document.baseURI + "api/",
   apiVersion: "2",
   appTitle: "Paperless-ng",
   version: "1.4.2",
   webSocketHost: window.location.host,
-  webSocketProtocol: (window.location.protocol == "https:" ? "wss:" : "ws:")
+  webSocketProtocol: (window.location.protocol == "https:" ? "wss:" : "ws:"),
+  webSocketBaseUrl: base_url.pathname + "ws/",
 };
index 3d981b677e2665fdb1f4b0e679e3ffbb35b8c4ff..3b8a02e37abe490f67de300396dc9109c9e304a9 100644 (file)
@@ -9,7 +9,8 @@ export const environment = {
   appTitle: "Paperless-ng",
   version: "DEVELOPMENT",
   webSocketHost: "localhost:8000",
-  webSocketProtocol: "ws:"
+  webSocketProtocol: "ws:",
+  webSocketBaseUrl: "/ws/",
 };
 
 /*