From cb44e8572f502b0f1d072bfd19304eaef526d37f Mon Sep 17 00:00:00 2001 From: David Valdez Date: Tue, 25 Apr 2023 02:20:29 +0000 Subject: [PATCH 1/5] Changes to support custom basepath in routing --- ui/public/manifest.json | 6 +++--- ui/src/index.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/public/manifest.json b/ui/public/manifest.json index 36ff4e94..dc8ab48d 100644 --- a/ui/public/manifest.json +++ b/ui/public/manifest.json @@ -8,15 +8,15 @@ "background_color": "white", "icons": [ { - "src": "/assets/logo192.png", + "src": "/photoview/logo192.png", "sizes": "192x192" }, { - "src": "/assets/logo512.png", + "src": "/photoview/logo512.png", "sizes": "512x512" }, { - "src": "/assets/photoview-logo.svg", + "src": "/photoview/photoview-logo.svg", "sizes": "150x150" } ] diff --git a/ui/src/index.tsx b/ui/src/index.tsx index 3c0d73f3..072b14ea 100644 --- a/ui/src/index.tsx +++ b/ui/src/index.tsx @@ -16,7 +16,7 @@ setupLocalization() const Main = () => ( - + From 31f1810e5e65ee23f2a761aaffb8cec2b69bc5e7 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Wed, 26 Apr 2023 04:41:08 +0000 Subject: [PATCH 2/5] Add support for custom base path to URL generator --- ui/src/components/photoGallery/ProtectedMedia.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/components/photoGallery/ProtectedMedia.tsx b/ui/src/components/photoGallery/ProtectedMedia.tsx index 305f16d6..326217da 100644 --- a/ui/src/components/photoGallery/ProtectedMedia.tsx +++ b/ui/src/components/photoGallery/ProtectedMedia.tsx @@ -13,7 +13,7 @@ const placeholder = const getProtectedUrl = (url?: string) => { if (url == undefined) return undefined - const imgUrl = new URL(url, location.origin) + const imgUrl = new URL(`${import.meta.env.BASE_URL}/${url}`, location.origin) const tokenRegex = location.pathname.match(/^\/share\/([\d\w]+)(\/?.*)$/) if (tokenRegex) { From d8bb69bbba2f8bd7c68c0b6d0c215b8cf217949b Mon Sep 17 00:00:00 2001 From: David Valdez Date: Sat, 29 Apr 2023 20:36:07 -0500 Subject: [PATCH 3/5] Remove hardcoded basepath --- ui/public/manifest.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/public/manifest.json b/ui/public/manifest.json index dc8ab48d..36ff4e94 100644 --- a/ui/public/manifest.json +++ b/ui/public/manifest.json @@ -8,15 +8,15 @@ "background_color": "white", "icons": [ { - "src": "/photoview/logo192.png", + "src": "/assets/logo192.png", "sizes": "192x192" }, { - "src": "/photoview/logo512.png", + "src": "/assets/logo512.png", "sizes": "512x512" }, { - "src": "/photoview/photoview-logo.svg", + "src": "/assets/photoview-logo.svg", "sizes": "150x150" } ] From 170f1ac59c33b9530be55c8ff2cc41e2d382f6b0 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Sun, 30 Apr 2023 01:37:36 +0000 Subject: [PATCH 4/5] Fix for login URL --- ui/src/Pages/LoginPage/loginUtilities.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/Pages/LoginPage/loginUtilities.tsx b/ui/src/Pages/LoginPage/loginUtilities.tsx index 4f754032..5b53b3bb 100644 --- a/ui/src/Pages/LoginPage/loginUtilities.tsx +++ b/ui/src/Pages/LoginPage/loginUtilities.tsx @@ -12,7 +12,7 @@ export const INITIAL_SETUP_QUERY = gql` export function login(token: string) { saveTokenCookie(token) - window.location.href = '/' + window.location.href = `${import.meta.env.BASE_URL}` } export const Container = styled.div.attrs({ className: 'mt-20' })`` From efda44a20b3713ba0fc2d324cc92cbbaa8a32ee6 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Sun, 30 Apr 2023 17:17:59 -0500 Subject: [PATCH 5/5] Fix case of double slash --- ui/src/components/photoGallery/ProtectedMedia.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/src/components/photoGallery/ProtectedMedia.tsx b/ui/src/components/photoGallery/ProtectedMedia.tsx index 326217da..5b50bdd3 100644 --- a/ui/src/components/photoGallery/ProtectedMedia.tsx +++ b/ui/src/components/photoGallery/ProtectedMedia.tsx @@ -13,7 +13,10 @@ const placeholder = const getProtectedUrl = (url?: string) => { if (url == undefined) return undefined - const imgUrl = new URL(`${import.meta.env.BASE_URL}/${url}`, location.origin) + const imgUrl = new URL( + `${import.meta.env.BASE_URL}${url}`.replace(/\/\//g, '/'), + location.origin + ) const tokenRegex = location.pathname.match(/^\/share\/([\d\w]+)(\/?.*)$/) if (tokenRegex) {