From 604f80d784b0a511cc18563ea434bd5fa068d4f2 Mon Sep 17 00:00:00 2001 From: Artain Date: Sat, 20 Nov 2021 03:01:33 +0100 Subject: [PATCH] Fix issue #208 Differentiates between ingress and direct http access by checking the origin url and sets the baseUrl accordingly. --- grocy/rootfs/patches/fix_braindamage.patch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grocy/rootfs/patches/fix_braindamage.patch b/grocy/rootfs/patches/fix_braindamage.patch index f0c814c..72186d4 100644 --- a/grocy/rootfs/patches/fix_braindamage.patch +++ b/grocy/rootfs/patches/fix_braindamage.patch @@ -5,9 +5,10 @@ index fceaaa0..bfc76e6 100644 @@ -87,7 +87,7 @@ Grocy.Components = { }; Grocy.Mode = '{{ GROCY_MODE }}'; -- Grocy.BaseUrl = '{{ $U('/') }}'; - Grocy.CurrentUrlRelative = "/" + window.location.href.split('?')[0].replace(Grocy.BaseUrl, ""); -+ Grocy.BaseUrl = window.location.origin + '{{ $U('/') }}'; ++ if(Grocy.BaseUrl.indexOf('http') != 0 || Grocy.BaseUrl.indexOf('hassio_ingress') >= 0) { ++ Grocy.BaseUrl = window.location.origin + '{{ $U('/') }}'; ++ }; + Grocy.CurrentUrlRelative = "/" + window.location.pathname.replace(Grocy.BaseUrl, ""); Grocy.ActiveNav = '@yield('activeNav', '')'; Grocy.Culture = '{{ GROCY_LOCALE }}';