From 3d9c125d2f310a4f73b3b6a074da650cd3f3ac7e Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Mon, 20 Dec 2021 13:52:15 +0100 Subject: [PATCH] Apply location fix only when using Ingress --- grocy/rootfs/patches/fix_braindamage.patch | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/grocy/rootfs/patches/fix_braindamage.patch b/grocy/rootfs/patches/fix_braindamage.patch index 72186d4..d1fc4f9 100644 --- a/grocy/rootfs/patches/fix_braindamage.patch +++ b/grocy/rootfs/patches/fix_braindamage.patch @@ -1,15 +1,16 @@ diff --git a/views/layout/default.blade.php b/views/layout/default.blade.php -index fceaaa0..bfc76e6 100644 +index 4eb3fb8d..d4e5e007 100644 --- a/views/layout/default.blade.php +++ b/views/layout/default.blade.php -@@ -87,7 +87,7 @@ - Grocy.Components = { }; +@@ -88,7 +88,10 @@ + Grocy.Version = '{{ $version }}'; Grocy.Mode = '{{ GROCY_MODE }}'; -- Grocy.CurrentUrlRelative = "/" + window.location.href.split('?')[0].replace(Grocy.BaseUrl, ""); + Grocy.BaseUrl = '{{ $U('/') }}'; + Grocy.CurrentUrlRelative = "/" + window.location.href.split('?')[0].replace(Grocy.BaseUrl, ""); + 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.CurrentUrlRelative = "/" + window.location.pathname.replace(Grocy.BaseUrl, ""); Grocy.ActiveNav = '@yield('activeNav', '')'; Grocy.Culture = '{{ GROCY_LOCALE }}'; - Grocy.Currency = '{{ GROCY_CURRENCY }}'; + Grocy.Currency = '{{ GROCY_CURRENCY }}'; \ No newline at end of file