Skip to content

fix: harden desktop file picker flows#1445

Open
SameDesu123 wants to merge 8 commits into
kwaroran:mainfrom
SameDesu123:fix/tauri-file-picker
Open

fix: harden desktop file picker flows#1445
SameDesu123 wants to merge 8 commits into
kwaroran:mainfrom
SameDesu123:fix/tauri-file-picker

Conversation

@SameDesu123
Copy link
Copy Markdown
Contributor

@SameDesu123 SameDesu123 commented May 13, 2026

PR Checklist

  • Required Checks
    • Have you added type definitions?
    • Have you tested your changes?
    • Have you checked that it won't break any existing features?
  • If your PR uses models1, check the following:
    • Have you checked if it works normally in all models?
    • Have you checked if it works normally in all web, local, and node-hosted versions? If it doesn't, have you blocked it in those versions?
  • If your PR is highly AI generated2, check the following:
    • Have you understood what the code does?
    • Have you cleaned up any unnecessary or redundant code?
    • Is it not a huge change?
      • We currently do not accept highly AI generated PRs that are large changes.

Summary

Refreshes the dropped file picker hardening work from #1324 by @tasoo-oos against current main.

The shared file picker helpers now use the Tauri native dialog on desktop, return consistent cancel values, and keep the DOM fallback safer for WebKit-style picker behavior.

Related Issues

Follows up on #1324.

Changes

  • Hardened selectSingleFile and selectMultipleFile so cancel handling is explicit and consistent.
  • Replaced remaining direct file input import flows with the shared file picker helpers.
  • Moved local backup file selection to the user click path while preserving current database, asset, and cold-storage restore behavior.
  • Added desktop file read scopes for common user directories and declared macOS bundle localizations.

Impact

Desktop users should get native file dialogs for import and local backup flows, including Tauri builds where the DOM picker can fail. Web users keep the DOM fallback, with safer cancel handling and offscreen input styling.

Cancelling a picker should no longer crash null-unsafe import paths.

Additional Notes

Validated with pnpm check, YAML parse check, and git diff --check.

Footnotes

  1. Modifies the behavior of prompting, requesting, or handling responses from AI models.

  2. Over 80% of the code is AI generated.

@SameDesu123 SameDesu123 force-pushed the fix/tauri-file-picker branch from c1b37c9 to c08cf14 Compare May 14, 2026 03:47
@SameDesu123 SameDesu123 marked this pull request as ready for review May 14, 2026 03:47
@SameDesu123
Copy link
Copy Markdown
Contributor Author

SameDesu123 commented May 14, 2026

It works successfully on macOS. Although I haven't been able to test it in a Linux environment, it is expected to function correctly.

If you want to test it, you can get bundled file in here: https://github.com/SameDesu123/Risuai/actions/runs/25807800518

@tasoo-oos
Copy link
Copy Markdown
Contributor

tasoo-oos commented May 14, 2026

Hello, Thank you for finishing the task I had given up on!

I ran the appimage build from Linux.
Persona, Character card, Prompt (.risup), module (.risum), and local backup (.bin) Export / Import jobs are tested and it worked just fine.

For context, here are the environment that this test was conducted:

  • OS: Arch Linux
  • Kernel: Linux 7.0.3-arch1-2
  • Architecture: x86_64
  • Device: Samsung 940XFG laptop
  • CPU/GPU platform: Intel Raptor Lake-P / Iris Xe Graphics
  • Desktop: KDE Plasma 6.6.4
  • Session: Wayland
  • Display env: XDG_SESSION_TYPE=wayland, XDG_CURRENT_DESKTOP=KDE, WAYLAND_DISPLAY=wayland-0, DISPLAY=:1
  • Graphics stack: Mesa 26.0.6, libglvnd 1.7.0
  • GTK/WebKit: gtk3 3.24.52, webkit2gtk-4.1 2.52.3
  • Portal packages: xdg-desktop-portal 1.20.4, xdg-desktop-portal-kde 6.6.4

Just a few minor issues that are not necessarily have to be included to this PR:

  1. Importing character card by external file dropdown does not work.
  2. The AppImage itself hit an EGL startup issue when using its bundled libraries Could not create default EGL display: EGL_BAD_PARAMETER.
    Running the extracted binary with system libraries worked: LD_LIBRARY_PATH=/usr/lib ./RisuAI.AppDir/usr/bin/RisuAI

@SameDesu123
Copy link
Copy Markdown
Contributor Author

SameDesu123 commented May 14, 2026

Thanks for testing this on Linux.

1st Issue seems related to the same import path handling problem, so I’ve fixed it together in this PR.
https://github.com/SameDesu123/Risuai/actions/runs/25860019091

For second (EGL_BAD_PARAMETER with the bundled AppImage libraries), I think it would be better to track it separately in another PR/issue since it looks more related to AppImage packaging/runtime behavior than the file picker changes themselves.

@tasoo-oos
Copy link
Copy Markdown
Contributor

Agreed on those choices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants