Skip to content

Commit

Permalink
Remove cookie field from WebUI torrent download form
Browse files Browse the repository at this point in the history
The cookie manager should now be used.
  • Loading branch information
Piccirello committed Sep 24, 2024
1 parent b27015b commit 1b21aa7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
21 changes: 0 additions & 21 deletions src/webui/api/torrentscontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <QJsonArray>
#include <QJsonObject>
#include <QList>
#include <QNetworkCookie>
#include <QRegularExpression>
#include <QUrl>

Expand All @@ -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"
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -818,23 +815,6 @@ void TorrentsController::addAction()
? Utils::String::toEnum(contentLayoutParam, BitTorrent::TorrentContentLayout::Original)
: std::optional<BitTorrent::TorrentContentLayout> {});

QList<QNetworkCookie> 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
Expand Down Expand Up @@ -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);
}
}
Expand Down
8 changes: 0 additions & 8 deletions src/webui/www/private/download.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ <h2><label for="urls">QBT_TR(Add torrent links)QBT_TR[CONTEXT=AddNewTorrentDialo
<input type="text" id="savepath" name="savepath" class="pathDirectory" style="width: 16em;">
</td>
</tr>
<tr>
<td>
<label for="cookie">QBT_TR(Cookie:)QBT_TR[CONTEXT=HttpServer]</label>
</td>
<td>
<input type="text" id="cookie" name="cookie" style="width: 16em;">
</td>
</tr>
<tr>
<td>
<label for="rename">QBT_TR(Rename torrent)QBT_TR[CONTEXT=HttpServer]</label>
Expand Down

0 comments on commit 1b21aa7

Please sign in to comment.