Apply location fix only when using Ingress (#267)

This commit is contained in:
Franck Nijhof 2021-12-20 13:59:14 +01:00 committed by GitHub
parent 15ca097a0b
commit 7cc3aa3d19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,15 +1,16 @@
diff --git a/views/layout/default.blade.php b/views/layout/default.blade.php 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 --- a/views/layout/default.blade.php
+++ b/views/layout/default.blade.php +++ b/views/layout/default.blade.php
@@ -87,7 +87,7 @@ @@ -88,7 +88,10 @@
Grocy.Components = { }; Grocy.Version = '{{ $version }}';
Grocy.Mode = '{{ GROCY_MODE }}'; 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) { + if(Grocy.BaseUrl.indexOf('http') != 0 || Grocy.BaseUrl.indexOf('hassio_ingress') >= 0) {
+ Grocy.BaseUrl = window.location.origin + '{{ $U('/') }}'; + 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.ActiveNav = '@yield('activeNav', '')';
Grocy.Culture = '{{ GROCY_LOCALE }}'; Grocy.Culture = '{{ GROCY_LOCALE }}';
Grocy.Currency = '{{ GROCY_CURRENCY }}'; Grocy.Currency = '{{ GROCY_CURRENCY }}';