mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-21 07:57:22 -06:00
Added cookie support for RSS feeds (Needs testing)
This commit is contained in:
@@ -951,6 +951,28 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
static QList<QByteArray> getHostNameCookies(QString host_name) {
|
||||
QSettings qBTRSS("qBittorrent", "qBittorrent-rss");
|
||||
QList<QByteArray> ret;
|
||||
QMap<QString, QVariant> hosts_table = qBTRSS.value("hosts_cookies", QMap<QString, QVariant>()).toMap();
|
||||
if(!hosts_table.contains(host_name)) return ret;
|
||||
QByteArray raw_cookies = hosts_table.value(host_name).toByteArray();
|
||||
return raw_cookies.split(':');
|
||||
}
|
||||
|
||||
static void setHostNameCookies(QString host_name, const QList<QByteArray> &cookies) {
|
||||
QSettings qBTRSS("qBittorrent", "qBittorrent-rss");
|
||||
QMap<QString, QVariant> hosts_table = qBTRSS.value("hosts_cookies", QMap<QString, QVariant>()).toMap();
|
||||
QByteArray raw_cookies = "";
|
||||
foreach(const QByteArray& cookie, cookies) {
|
||||
raw_cookies += cookie + ":";
|
||||
}
|
||||
if(raw_cookies.endsWith(":"))
|
||||
raw_cookies.chop(1);
|
||||
hosts_table.insert(host_name, raw_cookies);
|
||||
qBTRSS.setValue("hosts_cookies", hosts_table);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // PREFERENCES_H
|
||||
|
||||
Reference in New Issue
Block a user