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

[feature]: initial attempt at caching songs #337

Closed
wants to merge 5 commits into from

Conversation

kgarner7
Copy link
Collaborator

@kgarner7 kgarner7 commented Oct 30, 2023

This is a rough draft of supporting caching songs.

Notes:

  • The custom feishin-cache protocol can be avoided entirely by disabling web security (allowing loading file:// URLs). I'd rather not force this. It should be safe from directory traversal attempts, but not confident there...
  • The content type is application/octet-stream. Somehow this still appears to work for web player (MPV is completely fine it seems)

TODO:

  • Essential
    • Cache when using MPV backend. I'm not actually sure the correct place to fetch the download...
    • When using web backend, support seeking. Using the custom protocol, attempting to seek just moves the track back to 0. Could this be resolved by disabling web security and just using file://? Probably.
    • Safe cache clearing mechanism. This would need to invalidate MPV/web queue.
    • Proper directory chooser. The current version of Mantine doesn't support directory chooser. I guess a manual <input> would also work here
  • Nice to have
    • Show the size of the cache
    • Enable background fetch of multiple tracks (ideally using Web Workers; would require node in web worker probably...)
  • Nice to have but hard to do (probably)
    • Cache status. This would probably require file system watching as well (if the user deletes one/more files).
    • Caching in the browser (Service Workers). This is probably possible, since it appears that fetch can in fact get the entire file (when done properly?). Would also want to request persistent storage, so the quotas could be much higher.

@vercel
Copy link

vercel bot commented Oct 30, 2023

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

Name Status Preview Comments Updated (UTC)
feishin ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 4, 2023 7:31am

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.

1 participant