From da2c701b148002d3dd0fce37b9fdfe0d25ad2a64 Mon Sep 17 00:00:00 2001 From: Zachary Knight Date: Sat, 24 Jul 2021 21:03:49 -0400 Subject: [PATCH] Fix issue with external port base url --- grocy/rootfs/patches/fix_braindamage.patch | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/grocy/rootfs/patches/fix_braindamage.patch b/grocy/rootfs/patches/fix_braindamage.patch index bd76ccd..4d0a2d6 100644 --- a/grocy/rootfs/patches/fix_braindamage.patch +++ b/grocy/rootfs/patches/fix_braindamage.patch @@ -7,8 +7,13 @@ index fceaaa0..bfc76e6 100644 Grocy.Mode = '{{ GROCY_MODE }}'; - Grocy.BaseUrl = '{{ $U('/') }}'; - Grocy.CurrentUrlRelative = "/" + window.location.href.split('?')[0].replace(Grocy.BaseUrl, ""); -+ Grocy.BaseUrl = window.location.origin + '{{ $U('/') }}'; -+ Grocy.CurrentUrlRelative = "/" + window.location.pathname.replace((new URL(Grocy.BaseUrl)).pathname, ""); ++ if('{{ $U('/') }}'.includes('http')) { ++ Grocy.BaseUrl = '{{ $U('/') }}'; ++ Grocy.CurrentUrlRelative = "/" + window.location.href.split('?')[0].replace(Grocy.BaseUrl, ""); ++ } else { ++ Grocy.BaseUrl = window.location.origin + '{{ $U('/') }}'; ++ Grocy.CurrentUrlRelative = "/" + window.location.pathname.replace((new URL(Grocy.BaseUrl)).pathname, ""); ++ } Grocy.ActiveNav = '@yield('activeNav', '')'; Grocy.Culture = '{{ GROCY_LOCALE }}'; Grocy.Currency = '{{ GROCY_CURRENCY }}';