Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix spacedrive:// custom protocol on Windows #550

Merged
merged 41 commits into from
Feb 14, 2023
Merged

Conversation

oscartbeaumont
Copy link
Contributor

@oscartbeaumont oscartbeaumont commented Jan 25, 2023

Changes:

  • Hopefully fixes ERR_UNKNOWN_URL_SCHEME - Windows #520
  • Move the handle_custom_uri function to use primitives from the http crate instead of my old janky tuple. Required for steaming and is probably how I should have built this system originally.
  • Streaming the response for files using the protocol. This is so we don't need to load the whole thing into memory.
    • Streaming the response for any arbitrary file format requires chunked encoding. Support chunked encoding is hard so this PR only deals with chunking of video files which use a whole different system composed of multiple HTTP requests for the same resource which is way easier to implement.
  • Add a new part to the protocol for loading in files (spacedrive://file/{library_id}/{location_id}/{filepath_id})
  • LRU cache for video file metadata in spacedrive://file/* proto
  • JS helpers for generating the URL on web, desktop Unix and desktop Windows.
  • Replace enums with string unions in Typescript. Enum's have many footguns!
  • To fix Linux I had to upgrade Tauri. This then necessitated updating both rspc and PCR for it all to work.

@vercel
Copy link

vercel bot commented Jan 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated
spacedrive-landing ⬜️ Ignored (Inspect) Visit Preview Feb 13, 2023 at 5:33AM (UTC)
spacedrive-web ⬜️ Ignored (Inspect) Visit Preview Feb 13, 2023 at 5:33AM (UTC)

@oscartbeaumont
Copy link
Contributor Author

@jamiepine this works and is ready for use.

I would appreciate it if @brxken128 could give it a shot on Linux because I am concerned about if video files will work on Linux. I don't think it will stream video files on Linux and as far as I'm aware this is a Tauri limitation. It should instead, I am hoping, just load it all into memory and sends it to the webview. We could build a custom protocol to work around this limitation but that is a future concern.

@james-elicx I would appreciate a test of preview media loading on Windows (although don't feel obligated to). I was unable to use the Rust code snippet you sent as it was causing issues on macOS. The system I designed converts the spacedrive:// (Linux/macOS style) to http://spacedrive.localhost (Windows style) and then the code works on that. This choice was because the URL parser in the http crate expects a full URL. Thanks for reporting the Windows issue!

Right now I added a button to the right-click menu on an explorer item to test this feature. It does a full webview redirect which is something that @jamiepine is going to improve when the UI he is working on is ready.

@james-elicx
Copy link

This PR should be working now and it would be great if @brxken128 could check if video playback is working on Linux when he gets a minute. I would also appreciate a Windows test by @james-elicx if you can find the time.

Looks like the protocol and thumbnails are working correctly on Windows now! I appreciate all the work you've done to fix this :)

@brxken128
Copy link
Contributor

I've already spoken to @oscartbeaumont about this, but on Linux (Gentoo) it's a mixed bag. Thumbnails work, and opening images work, but video playback does not. It could either be a Tauri thing, or something to do with our protocol - I'm not too sure here.

We're making progress though as only thumbnails worked before.

Brendonovich
Brendonovich previously approved these changes Feb 3, 2023
crates/crypto/src/crypto/stream.rs Show resolved Hide resolved
apps/desktop/src-tauri/src/main.rs Outdated Show resolved Hide resolved
@fogodev fogodev requested a review from Brendonovich February 12, 2023 01:24
@oscartbeaumont oscartbeaumont merged commit a9fceae into main Feb 14, 2023
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.

ERR_UNKNOWN_URL_SCHEME - Windows
5 participants