feat: add Files tab backed by the managed-files endpoint (#727)

* feat: add Files tab backed by the managed-files endpoint

Add a Hermes Mobile tab that browses the gateway's managed-files root via the
existing /api/files* backend routes: list/navigate folders, breadcrumb path,
create folder, upload (streaming multipart), delete, and open files via the
authenticated GatewayFileClient download URL.

- data/model/ManagedFile: entry + list/read/upload/mkdir/delete models
- HermesApiService: list/read/upload(+stream)/mkdir/delete endpoints
- FilesViewModel: state, navigation, per-row busy, transient-state cleanup
- FilesScreen: folder list, breadcrumb, FAB new folder, upload picker,
  delete confirm, open via system viewer
- NavigationKeys + ScreenRegistry + strings: register in Inspect drawer section

* fix(files): open files in-app via FileProvider instead of browser URL

The previous file-open path handed a ?token=-authenticated URL to the system
browser, but /api/files/download only accepts the ephemeral in-process session
token as ?token=, not the mobile's Bearer token — so the request failed and the
browser rendered the JSON error body instead of the file.

Fix: download the file in-app through the authenticated client (Bearer/
session-cookie, same path as the rest of the app), decode the base64 data_url,
write it to cacheDir, and open it via FileProvider.getUriForFile + ACTION_VIEW
(mirrors the existing ChatScreen/SystemViewModel open-from-cache pattern).
Works on a remote phone since the file is materialized locally first.

---------

Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
M57andM57 authored and GitHub committed 2026-07-26 22:46:36 +03:00
1 parent 439ae9fcba
commit 6aee02c4da
8 files changed
+1024

No files matched your search

+16
View File
@@ -91,6 +91,7 @@
<string name="screen_providers">Providers</string>
<string name="screen_analytics">Analytics</string>
<string name="screen_billing">Billing</string>
<string name="screen_files">Files</string>
<!-- Notifications -->
<string name="notif_title">Hermes</string>
@@ -760,6 +761,21 @@
<string name="keys_action_open_url">Open provider documentation</string>
<string name="keys_filter_all">All</string>
<!-- Files Screen -->
<string name="files_root_label">Managed files root</string>
<string name="files_empty_title">No files here</string>
<string name="files_empty_desc">This folder is empty. Create a folder or upload a file to get started.</string>
<string name="files_action_up">Go up</string>
<string name="files_action_upload">Upload file</string>
<string name="files_action_new_folder">New folder</string>
<string name="files_action_create">Create</string>
<string name="files_action_delete">Delete</string>
<string name="files_dialog_new_folder_title">New Folder</string>
<string name="files_new_folder_label">Folder name</string>
<string name="files_new_folder_placeholder">my-folder</string>
<string name="files_dialog_delete_title">Delete?</string>
<string name="files_dialog_delete_message">Are you sure you want to delete \"%1$s\"? This cannot be undone.</string>
<!-- Channels Screen -->
<string name="channels_empty_title">No channels configured</string>
<string name="channels_empty_desc">Add messaging platforms in Hermes to see them here.</string>