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

Provide torrent creation feature via WebAPI #20366

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

glassez
Copy link
Member

@glassez glassez commented Feb 3, 2024

Closes #5614.

Based on original PR #19498.

@glassez glassez added Core WebAPI WebAPI-related issues/changes labels Feb 3, 2024
@glassez glassez added this to the 5.0 milestone Feb 3, 2024
src/base/bittorrent/torrentcreationmanager.h Outdated Show resolved Hide resolved
src/base/bittorrent/torrentcreationmanager.cpp Outdated Show resolved Hide resolved
src/base/bittorrent/torrentcreator.cpp Outdated Show resolved Hide resolved
src/base/utils/io.cpp Outdated Show resolved Hide resolved
src/webui/api/torrentcreatorcontroller.cpp Outdated Show resolved Hide resolved
@glassez glassez force-pushed the create-torrent branch 4 times, most recently from 1503c3f to 31d8be3 Compare February 4, 2024 11:13
@glassez glassez requested a review from a team February 4, 2024 11:24
@glassez glassez marked this pull request as ready for review February 4, 2024 11:24
const QList<std::shared_ptr<BitTorrent::TorrentCreationTask>> tasks = id.isEmpty()
? m_torrentCreationManager->tasks()
: QList<std::shared_ptr<BitTorrent::TorrentCreationTask>> {singleTask};
QJsonArray statusArray;
Copy link
Member Author

Choose a reason for hiding this comment

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

Wouldn't it be better to return them as a map (JSON object) with task IDs as keys?

Copy link
Member Author

Choose a reason for hiding this comment

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

Wouldn't it be better to return them as a map (JSON object) with task IDs as keys?

@rcarpa
What do you think about this?

Copy link
Contributor

@rcarpa rcarpa left a comment

Choose a reason for hiding this comment

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

I did some manual testing. Everything seems to work correctly.

src/webui/webapplication.h Outdated Show resolved Hide resolved
@glassez glassez force-pushed the create-torrent branch 2 times, most recently from 0821418 to 1e6c25e Compare February 12, 2024 06:13
@glassez glassez requested review from a team and removed request for a team February 12, 2024 06:16
@glassez
Copy link
Member Author

glassez commented Feb 15, 2024

@qbittorrent/bug-handlers
Is there anything else that needs to be fixed in order for this PR to be approved?

Copy link
Member

@Chocobo1 Chocobo1 left a comment

Choose a reason for hiding this comment

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

last few comments

src/webui/webapplication.h Outdated Show resolved Hide resolved
src/gui/torrentcreatordialog.cpp Outdated Show resolved Hide resolved
src/base/bittorrent/torrentcreator.cpp Show resolved Hide resolved
@glassez glassez merged commit 0114610 into qbittorrent:master Feb 27, 2024
13 checks passed
@glassez glassez deleted the create-torrent branch February 27, 2024 12:57
Comment on lines +133 to +134
.trackers = params()[KEY_TRACKERS].split(u'|'),
.urlSeeds = params()[KEY_URL_SEEDS].split(u'|')
Copy link
Member

Choose a reason for hiding this comment

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

@glassez FYI it appears this new API endpoint is also using a pipe to delimit URLs. This might be worth changing before 5.0 ships.

Copy link
Member Author

Choose a reason for hiding this comment

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

@glassez FYI it appears this new API endpoint is also using a pipe to delimit URLs. This might be worth changing before 5.0 ships.

I've been thinking about this problem. Honestly, it doesn't occur to me what other character could be used instead of | to avoid this problem. It seems to me that this is impossible to find one. Whichever character we use, it may be inside one of the URLs of the list.
Maybe it would make sense to percent encode each URL before combining it into an array when sending, and first split the array and then percent decode each URL when receiving?

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

Successfully merging this pull request may close these issues.

Support creating new torrents using the WebUI
4 participants