From 99991f543075e4f5cfb03a53e2a4bb039541056c Mon Sep 17 00:00:00 2001 From: Thomas Piccirello Date: Sat, 14 Sep 2024 16:37:49 -0700 Subject: [PATCH] Remove cookie field from WebUI torrent download form The cookie manager should now be used. --- src/webui/api/torrentscontroller.cpp | 21 --------------------- src/webui/www/private/download.html | 8 -------- 2 files changed, 29 deletions(-) diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp index 290cb21687fa..1a8eb93d3b29 100644 --- a/src/webui/api/torrentscontroller.cpp +++ b/src/webui/api/torrentscontroller.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -53,7 +52,6 @@ #include "base/interfaces/iapplication.h" #include "base/global.h" #include "base/logger.h" -#include "base/net/downloadmanager.h" #include "base/torrentfilter.h" #include "base/utils/datetime.h" #include "base/utils/fs.h" @@ -787,7 +785,6 @@ void TorrentsController::pieceStatesAction() void TorrentsController::addAction() { const QString urls = params()[u"urls"_s]; - const QString cookie = params()[u"cookie"_s]; const bool skipChecking = parseBool(params()[u"skip_checking"_s]).value_or(false); const bool seqDownload = parseBool(params()[u"sequentialDownload"_s]).value_or(false); @@ -818,23 +815,6 @@ void TorrentsController::addAction() ? Utils::String::toEnum(contentLayoutParam, BitTorrent::TorrentContentLayout::Original) : std::optional {}); - QList cookies; - if (!cookie.isEmpty()) - { - const QStringList cookiesStr = cookie.split(u"; "_s); - for (QString cookieStr : cookiesStr) - { - cookieStr = cookieStr.trimmed(); - int index = cookieStr.indexOf(u'='); - if (index > 1) - { - QByteArray name = cookieStr.left(index).toLatin1(); - QByteArray value = cookieStr.right(cookieStr.length() - index - 1).toLatin1(); - cookies += QNetworkCookie(name, value); - } - } - } - const BitTorrent::AddTorrentParams addTorrentParams { // TODO: Check if destination actually exists @@ -875,7 +855,6 @@ void TorrentsController::addAction() url = url.trimmed(); if (!url.isEmpty()) { - Net::DownloadManager::instance()->setCookiesFromUrl(cookies, QUrl::fromEncoded(url.toUtf8())); partialSuccess |= app()->addTorrentManager()->addTorrent(url, addTorrentParams); } } diff --git a/src/webui/www/private/download.html b/src/webui/www/private/download.html index a9ae77030dc1..d59d0e5abc77 100644 --- a/src/webui/www/private/download.html +++ b/src/webui/www/private/download.html @@ -44,14 +44,6 @@