Merge pull request #1003 from puuu/baseurl

Fix sub path support
This commit is contained in:
Jonas Winkler
2021-05-15 15:12:00 +02:00
committed by GitHub
11 changed files with 40 additions and 19 deletions

View File

@@ -18,7 +18,7 @@ export class AppComponent implements OnInit, OnDestroy {
constructor (private settings: SettingsService, private consumerStatusService: ConsumerStatusService, private toastService: ToastService, private router: Router) {
let anyWindow = (window as any)
anyWindow.pdfWorkerSrc = '/assets/js/pdf.worker.min.js';
anyWindow.pdfWorkerSrc = 'assets/js/pdf.worker.min.js';
this.settings.updateDarkModeSettings()
}

View 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'])

View 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/",
};

View File

@@ -9,7 +9,8 @@ export const environment = {
appTitle: "Paperless-ng",
version: "DEVELOPMENT",
webSocketHost: "localhost:8000",
webSocketProtocol: "ws:"
webSocketProtocol: "ws:",
webSocketBaseUrl: "/ws/",
};
/*