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

Enhancement: Add .torrent file to upload automatically #64

Closed
2 of 3 tasks
bdbenim opened this issue Oct 20, 2023 · 0 comments · Fixed by #96
Closed
2 of 3 tasks

Enhancement: Add .torrent file to upload automatically #64

bdbenim opened this issue Oct 20, 2023 · 0 comments · Fixed by #96
Labels
enhancement New feature or request
Milestone

Comments

@bdbenim
Copy link
Owner

bdbenim commented Oct 20, 2023

As mentioned in #63, this would allow the userscript to attach the generated .torrent file to the upload without requiring the user to navigate to it.

For security reasons, it is normally not possible for a script running on the page to attach a file without user interaction, as this would make it trivial for any malicious webpage to steal files from the user's computer without their knowledge. However, since we are actually generating the contents of this file ourselves, we don't actually care what file it comes from as long as we can somehow upload it to EMP. As such, here is how I see this feature eventually working:

  • After filling out the presentation on the page, the script downloads the .torrent file directly from the backend server and stores the data in memory
  • The script overrides the check for dupes and Upload torrent buttons to use this data stored in memory instead of the file referenced by the normal file chooser input
  • These buttons send requests that mimic what the buttons normally send to EMP, using this in-memory data

Although complex, this ought to succeed in circumventing the limitations of how scripts can interact with file inputs. The main issue will be maintainability, as this creates another possible breaking point of the script if the process of uploading to EMP ever changes. If the script is not updated at that time, it will cease to work entirely for uploading torrents. To prevent this, it should be easy for the user to disable this functionality if necessary. It also might be possible for the script to hijack existing code for submitting the upload instead of reverse engineering it. This would both save effort and reduce likelihood of the feature breaking in some future update to EMP.

@bdbenim bdbenim added the enhancement New feature or request label Oct 20, 2023
@bdbenim bdbenim added this to the Version 1 milestone Oct 28, 2023
@bdbenim bdbenim linked a pull request Oct 28, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant