mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-31 09:13:33 +02:00
fix(filebrowser_quantum): navigate in place instead of opening a new tab under ingress (#3026)
The tool views (Tools -> File Size Analyzer, Duplicate Finder, the file list
panel) always pass showLimitedOptions to the context menu, and the context
menu's openParentFolder() hands that same flag to goToItem() as its newTab
argument. The parent folder is therefore opened with
window.open(<absolute url>, '_blank'). Behind Home Assistant ingress that
popup lands on the raw /api/hassio_ingress/<token>/ URL with no Home
Assistant frontend around it to keep the ingress session alive, so the new
tab answers 401 instead of showing the folder.
The ingress vhost now injects the same window.open shim the komga add-on
uses, scoped to the two SPA route prefixes goToItem() builds ('files/' and
'public/share/'), so download and preview popups keep their own tab.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
|
||||
## 1.5.3.1 (2026-08-29)
|
||||
- Fix "open parent directory" in Tools -> File Size Analyzer under Home
|
||||
Assistant ingress. FileBrowser opened the parent folder in a new tab, which
|
||||
lands on the raw ingress URL with no Home Assistant frontend around it to
|
||||
keep the ingress session alive, so the new tab answered 401 instead of
|
||||
showing the folder. The ingress vhost now turns that popup into a navigation
|
||||
of the panel itself. The same fix covers the other tool views and the "go to
|
||||
item" action on search results, which open a new tab the same way. Download
|
||||
and preview popups, links pointing out of the add-on, and direct access on
|
||||
port 8071 are unchanged.
|
||||
|
||||
## 1.5.3 (2026-08-29)
|
||||
- Update to latest version from gtsteffaniak/filebrowser (changelog : https://github.com/gtsteffaniak/filebrowser/releases)
|
||||
|
||||
|
||||
@@ -118,4 +118,4 @@ schema:
|
||||
slug: filebrowser_quantum
|
||||
udev: true
|
||||
url: https://github.com/alexbelgium/hassio-addons
|
||||
version: "1.5.3"
|
||||
version: "1.5.3.1"
|
||||
|
||||
@@ -3,7 +3,7 @@ server {
|
||||
|
||||
include /etc/nginx/includes/server_params.conf;
|
||||
include /etc/nginx/includes/proxy_params.conf;
|
||||
|
||||
|
||||
client_max_body_size 0;
|
||||
|
||||
location / {
|
||||
@@ -12,6 +12,35 @@ server {
|
||||
proxy_send_timeout 30m;
|
||||
proxy_read_timeout 30m;
|
||||
proxy_pass %%protocol%%://backend%%subpath%%;
|
||||
|
||||
# Tools -> File Size Analyzer (and the other tool views) open a result's
|
||||
# parent folder with window.open(<absolute url>, '_blank'), because
|
||||
# goToItem() takes its newTab argument from the context menu's
|
||||
# showLimitedOptions flag, which those views always set. Behind ingress
|
||||
# that popup lands on the raw /api/hassio_ingress/<token>/ url with no
|
||||
# Home Assistant frontend around it to keep the ingress session alive,
|
||||
# so the new tab answers 401 instead of showing the folder. Turn that
|
||||
# popup into a navigation of the panel itself.
|
||||
#
|
||||
# The context menu's "go to item" action, which search results and the
|
||||
# tool views also offer, hardcodes the same new tab and is fixed too.
|
||||
#
|
||||
# Scoped to the two prefixes goToItem() builds, "files/" and
|
||||
# "public/share/", so the window.open calls that download or preview a
|
||||
# file (they go to api/resources/download) keep their own tab: sending
|
||||
# an inline raw file to location.assign would replace the whole app.
|
||||
# A link out of the add-on keeps its own tab as well, unless a user
|
||||
# points a sidebar link (or a link inside a file open in the editor) at
|
||||
# this same instance's files/ or public/share/ route, which then also
|
||||
# opens in the panel. Same shape as the komga add-on's ingress filter.
|
||||
#
|
||||
# Injected into the page's existing nonce-carrying inline script rather
|
||||
# than next to <div id="app">: FileBrowser sends
|
||||
# script-src 'self' 'nonce-<random>', so a standalone inline <script>
|
||||
# would be blocked. If upstream ever drops that
|
||||
# window.__pwaDeferredPrompt line the filter simply stops matching and
|
||||
# the popup behaviour returns, which is the pre-fix state.
|
||||
sub_filter "window.__pwaDeferredPrompt = null;" "window.__pwaDeferredPrompt = null;(function(){var o=window.open;window.open=function(u,n,f){try{var b=(window.globalVars||{}).baseURL;if(u&&n==='_blank'&&!f&&b){if(b.slice(-1)!=='/')b+='/';var t=new URL(u,location.href);if((t.protocol==='http:'||t.protocol==='https:')&&t.origin===location.origin&&(t.pathname.indexOf(b+'files/')===0||t.pathname.indexOf(b+'public/share/')===0)){location.assign(t.href);return window}}}catch(e){}return o.apply(window,arguments)}})();";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user