From 2497369f825f0d5362f835430ad92a38fa53dfcd Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 21 Oct 2021 07:19:49 -0500 Subject: fix relative urls in production --- src/web/src/config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/web/src/config.js b/src/web/src/config.js index bd05aea5..3ffd4107 100644 --- a/src/web/src/config.js +++ b/src/web/src/config.js @@ -1,5 +1,5 @@ -const rootUrl = process.env.NODE_ENV === 'production' ? '' : 'http://localhost:5000'; -const baseUrl = `${rootUrl}/api/v0`; +const rootUrl = process.env.NODE_ENV === 'production' ? window.location.href : 'http://localhost:5000/'; +const baseUrl = `${rootUrl}api/v0`; const tokenKey = 'slskd-token'; const tokenPassthroughValue = 'n/a'; const activeChatKey = 'slskd-active-chat'; -- cgit v1.2.3 From e594fccddc44c695f199340c35ada8b4c80c0922 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 21 Oct 2021 07:37:57 -0500 Subject: take only the first segment --- src/web/src/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/src/config.js b/src/web/src/config.js index 3ffd4107..7164e594 100644 --- a/src/web/src/config.js +++ b/src/web/src/config.js @@ -1,4 +1,4 @@ -const rootUrl = process.env.NODE_ENV === 'production' ? window.location.href : 'http://localhost:5000/'; +const rootUrl = process.env.NODE_ENV === 'production' ? window.location.href.split('/')[1] : 'http://localhost:5000/'; const baseUrl = `${rootUrl}api/v0`; const tokenKey = 'slskd-token'; const tokenPassthroughValue = 'n/a'; -- cgit v1.2.3 From b2f97267016178577f13f2c460174259042fd37f Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 21 Oct 2021 08:25:16 -0500 Subject: actually fix the problem --- src/web/src/config.js | 2 +- src/web/src/lib/hubFactory.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/web/src/config.js b/src/web/src/config.js index 7164e594..ea71e9dd 100644 --- a/src/web/src/config.js +++ b/src/web/src/config.js @@ -1,4 +1,4 @@ -const rootUrl = process.env.NODE_ENV === 'production' ? window.location.href.split('/')[1] : 'http://localhost:5000/'; +const rootUrl = process.env.NODE_ENV === 'production' ? '' : 'http://localhost:5000/'; const baseUrl = `${rootUrl}api/v0`; const tokenKey = 'slskd-token'; const tokenPassthroughValue = 'n/a'; diff --git a/src/web/src/lib/hubFactory.js b/src/web/src/lib/hubFactory.js index b57faa25..8ccd62ff 100644 --- a/src/web/src/lib/hubFactory.js +++ b/src/web/src/lib/hubFactory.js @@ -17,6 +17,6 @@ export const createHubConnection = ({ url }) => .configureLogging(LogLevel.Warning) .build(); -export const createApplicationHubConnection = () => createHubConnection({ url: `${rootUrl}/hub/application` }); +export const createApplicationHubConnection = () => createHubConnection({ url: `${rootUrl}hub/application` }); -export const createLogsHubConnection = () => createHubConnection({ url: `${rootUrl}/hub/logs` }); \ No newline at end of file +export const createLogsHubConnection = () => createHubConnection({ url: `${rootUrl}hub/logs` }); \ No newline at end of file -- cgit v1.2.3