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

Add support for exporting .torrent from WebUI #16968

Merged
merged 1 commit into from
May 4, 2022

Conversation

Piccirello
Copy link
Member

@Piccirello Piccirello commented May 1, 2022

This PR adds the new "Export .torrent" (#16886) functionality to the WebAPI/WebUI. Props to @Chocobo1 for making this as easy as possible. This has been tested in Firefox, Safari, and Chrome.

Screen Shot 2022-05-01 at 13 01 23

@Piccirello Piccirello requested a review from a team May 1, 2022 20:01
@xavier2k6 xavier2k6 added the WebUI WebUI-related issues/changes label May 1, 2022
Chocobo1
Chocobo1 previously approved these changes May 2, 2022
src/webui/api/torrentscontroller.cpp Outdated Show resolved Hide resolved
@Chocobo1 Chocobo1 added this to the 4.5.0 milestone May 2, 2022
@Chocobo1
Copy link
Member

Chocobo1 commented May 2, 2022

inline const Utils::Version<int, 3, 2> API_VERSION {2, 8, 10};

Almost forgot, this should be bumped to {2, 8, 11}.

element.setAttribute("href", url);
element.setAttribute("download", name + ".torrent");
document.body.appendChild(element);
element.click();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there really no direct way to do this without creating some element behind the scenes and emulating the impact on it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially looked into sending the Content-Disposition header, which indicates to the browser that the response should be downloaded, but it doesn't appear that there's plumbing yet to allow setting arbitrary headers from API routes.

@Chocobo1 Chocobo1 merged commit fb7f7d0 into qbittorrent:master May 4, 2022
@Chocobo1
Copy link
Member

Chocobo1 commented May 4, 2022

@Piccirello
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebUI WebUI-related issues/changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants