Differentiates between ingress and direct http access by checking the origin url and sets
the baseUrl accordingly.
This commit is contained in:
Artain 2021-11-20 03:01:33 +01:00 committed by Franck Nijhof
parent 68439cf6db
commit 604f80d784
No known key found for this signature in database
GPG key ID: D62583BA8AB11CA3

View file

@ -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 }}';