Commit 85f049d5 authored by Cristian Greco's avatar Cristian Greco

Imported Upstream version 2.0.0

parent 0ca36770
......@@ -67,10 +67,10 @@ Translations authors:
- Finnish: Niklas Laxström (nikerabbit@users.sourceforge.net)
- French: Christophe Dumez (chris@qbittorrent.org)
- German: Niels Hoffmann (zentralmaschine@users.sourceforge.net)
- Greek: Tsvetan Bankov (emerge_life@users.sourceforge.net)
- Greek: Tsvetan Bankov (emerge_life@users.sourceforge.net) and Stephanos Antaris (santaris@csd.auth.gr)
- Hungarian: Majoros Péter (majoros.j.p@t-online.hu)
- Italian: Mirko Ferrari (mirkoferrari@gmail.com) and Ferraro Luciano (luciano.ferraro@gmail.com)
- Japanese: Nardog (nardog@e2umail.com)
- Japanese: Nardog (alphisation@gmail.com)
- Korean: Jin Woo Sin (jin828sin@users.sourceforge.net)
- Norwegian: Lars-Erik Labori (hamil@users.sourceforge.net)
- Polish: Mariusz Fik (fisiu@opensuse.org)
......@@ -81,6 +81,6 @@ Translations authors:
- Slovak: helix84
- Spanish: Vicente Raul Plata Fonseca (silverxnt@users.sourceforge.net)
- Swedish: Daniel Nylander (po@danielnylander.se)
- Turkish: Erdem Bingöl (erdem84@gmail.com)
- Turkish: Hasan Yilmaz (iletisim@hedefturkce.com)
- Ukrainian: Andrey Shpachenko (masterfix@users.sourceforge.net)
license: GPLv2
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v2.0.0
* Thu Dec 10 2009 - Christophe Dumez <chris@qbittorrent.org> - v2.0.0
- FEATURE: Added program option to disable splash screen
- FEATURE: Dropped dependency on libcurl and libzzip
- FEATURE: Display more information regarding the torrent in its properties
......@@ -38,10 +38,14 @@
- FEATURE: Support for bitcomet padding files (libtorrent >= v0.15 only)
- FEATURE: Option to skip file checking and start seeding immediately in torrent addition dialog (Stephanos Antaris) (libtorrent >= v0.15 only)
- BUGFIX: Made sure qBittorrent does not scrape the tracker too frequently (libtorrent >= 0.15 only)
- BUGFIX: Fix Paste action in search engine field
- BUGFIX: Fix possible double free in search engine destructor
- BUGFIX: Properly handle trackers error messages
- WEB UI: Remodeled Web UI to match new qBittorrent UI (Properties and preferences available)
- WEB UI: Added internationalization support
- WEB UI: Reduced computation in Javascript (do this one server side instead)
- WEB UI: Fixed Transfer list flickering
- WEB UI: Password is now stored as md5
- I18N: Added Serbian translation (By Anaximandar Milet)
- COSMETIC: Merged download / upload lists
- COSMETIC: Torrents can be filtered based on their status
......@@ -55,6 +59,49 @@
- COSMETIC: New torrent status icons by Mateusz Tolola
- COSMETIC: Make use of libnotify if available for system notifications (Ubuntu, ...)
* Tue Nov 17 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.5.6
- BUGFIX: RSS feed articles can now be displayed using keyboard arrows
- BUGFIX: RSS feed downloader can only process unread articles now
- BUGFIX: Fixed memory leak in RSS parser
- BUGFIX: Fixed possible crash in search autocompletion
- BUGFIX: Improved ETA calculation for big torrents
- BUGFIX: Fixed per-torrent speed limiting
* Wed Nov 4 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.5.5
- BUGFIX: Fixed man page
- BUGFIX: Fix crash on torrent addition (if libtorrent-rasterbar has debug enabled)
- BUGFIX: Fix trackers addition to torrents (bug introduced in v1.5.4)
- BUGFIX: Suppress compilation warning regarding sortNewsList() not being used
- BUGFIX: Make sure scan folder is different than qBittorrent backup directory to avoid torrents deletion
- BUGFIX: Added safety mecanism which adds the torrents back to the list in case qbittorrent-resume.conf gets deleted or corrupted.
* Sun Oct 25 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.5.4
- BUGFIX: Updated man page
- BUGFIX: Fixed possible crash with torrents containing unicode characters
- BUGFIX: Fixed problem when disabling systray integration and starting minimized
- BUGFIX: Fixed PirateBay search plugin
- BUGFIX: Using Download button in search results list now downloads the right torrents
- BUGFIX: The search results list is no longer sorted automatically when a row color is updated
* Wed Sep 30 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.5.3
- BUGFIX: Fix a possible crash when pausing then deleting a torrent quickly
- BUGFIX: Fix a race condition in folder scanning and torrent downloader
- BUGFIX: Hide download url column in search results
- BUGFIX: Fix a crash when scanned directory does not exist
- BUGFIX: Fix compilation on Mac OS
- BUGFIX: Added a command line parameter to disable splash screen
- BUGFIX: Ignore permanent deletion button when no torrent is selected
- BUGFIX: When a selected torrent is deleted, select next suitable torrent
* Sun Sep 20 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.5.2
- BUGFIX: Some torrents were pausing for no reason
- I18N: Updated Korean translation
* Thu Sep 7 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.5.1
- BUGFIX: Fix crash in torrent addition dialog when save path does not exist (closes #425227)
- BUGFIX: Fix downloading from URL (broken in v1.5.0)
- BUGFIX: Pause torrents in error state
* Thu Sep 3 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.5.0
- FEATURE: Added Magnet URI support
- FEATURE: Search engine supports category-based requests
......
......@@ -18,6 +18,7 @@ Dependencies:
- libboost: libboost-filesystem, libboost-date-time, libboost-thread, libboost-serialization
- python >= 2.3 (needed by search engine)
* Run time only dependency
- libnotify >= 0.4.2, glib-2.0 (optional)
* Can be used for system notifications to replace standard Qt notifications
......@@ -25,6 +26,7 @@ Dependencies:
- geoip-database (optional)
* If qBittorrent cannot find this database, it will try to resolve countries using the Internet but it will be a lot slower.
* Run time only dependency
DOCUMENTATION:
Please note that there is a documentation with a "compiling howto" at http://wiki.qbittorrent.org.
......
......@@ -461,9 +461,9 @@ public:
return true;
#ifdef Q_WS_X11
}
if(QFile::exists("/usr/share/GeoIP/GeoIP.dat") || QFile::exists("/usr/local/share/GeoIP/GeoIP.dat"))
if(QFile::exists("/usr/share/GeoIP/GeoIP.dat") || QFile::exists("/usr/local/share/GeoIP/GeoIP.dat") || QFile::exists("/var/lib/GeoIP/GeoIP.dat"))
return true;
printf("\nWarning: GeoIP database was not found at /usr/share/GeoIP/GeoIP.dat\nCountry resolution will be slow.");
printf("\nWarning: GeoIP database was not found at /usr/share/GeoIP/GeoIP.dat or /var/lib/GeoIP/GeoIP.dat\nCountry resolution will be slow.");
return false;
#endif
}
......
......@@ -20,9 +20,9 @@ public:
return true;
#ifdef Q_WS_X11
}
if(QFile::exists("/usr/share/GeoIP/GeoIP.dat") || QFile::exists("/usr/local/share/GeoIP/GeoIP.dat"))
if(QFile::exists("/usr/share/GeoIP/GeoIP.dat") || QFile::exists("/usr/local/share/GeoIP/GeoIP.dat") || QFile::exists("/var/lib/GeoIP/GeoIP.dat"))
return true;
printf("\nWarning: GeoIP database was not found at /usr/share/GeoIP/GeoIP.dat\nCountry resolution will be slow.");
printf("\nWarning: GeoIP database was not found at /usr/share/GeoIP/GeoIP.dat or /var/lib/GeoIP/GeoIP.dat\nCountry resolution will be slow.");
return false;
#endif
}
......
......@@ -749,7 +749,7 @@ void GUI::loadPreferences(bool configure_session) {
// RSS
if(Preferences::isRSSEnabled()) {
displayRSSTab(true);
rssWidget->updateRefreshInterval(Preferences::getRefreshInterval());
rssWidget->updateRefreshInterval(Preferences::getRSSRefreshInterval());
} else {
displayRSSTab(false);
}
......@@ -913,6 +913,6 @@ void GUI::on_actionOptions_triggered() {
// an url
void GUI::on_actionDownload_from_URL_triggered() {
downloadFromURL *downloadFromURLDialog = new downloadFromURL(this);
connect(downloadFromURLDialog, SIGNAL(urlsReadyToBeDownloaded(const QStringList&)), BTSession, SLOT(downloadFromURLList(const QStringList&)));
connect(downloadFromURLDialog, SIGNAL(urlsReadyToBeDownloaded(const QStringList&)), this, SLOT(downloadFromURLList(const QStringList&)));
}
This diff was suppressed by a .gitattributes entry.
......@@ -21,7 +21,7 @@ GenericName[pt_BR]=Cliente Bittorrent
GenericName[ro]=Client Bittorrent
GenericName[ru]=клиент Bittorrent
GenericName[sk]=Klient siete Bittorrent
GenericName[sr]=БитТоррент клијент
GenericName[sr]=Bittorrent-клијент
GenericName[sv]=Bittorrent-klient
GenericName[tr]=Bittorrent istemcisi
GenericName[uk]=Bittorrent-клієнт
......
......@@ -75,7 +75,7 @@ class about : public QDialog, private Ui::AboutDlg{
- <u>Greek:</u> Tsvetan Bankov (emerge_life@users.sourceforge.net)<br>\
- <u>Hungarian:</u> Majoros Péter (majoros.peterj@gmail.com)<br>\
- <u>Italian:</u> Mirko Ferrari (mirkoferrari@gmail.com) and Ferraro Luciano (luciano.ferraro@gmail.com)<br>\
- <u>Japanese:</u> Nardog (nardog@e2umail.com)<br>\
- <u>Japanese:</u> Nardog (alphisation@gmail.com)<br>\
- <u>Korean:</u> Jin Woo Sin (jin828sin@users.sourceforge.net)<br>\
- <u>Norwegian:</u> Lars-Erik Labori (hamil@users.sourceforge.net)<br>\
- <u>Polish:</u> Mariusz Fik (fisiu@opensuse.org)<br>\
......
......@@ -893,12 +893,7 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
if(!from_url.isNull()) QFile::remove(file);
return h;
}
// FIXME: Remove this debug
std::vector<announce_entry> trackers = h.trackers();
std::vector<announce_entry>::iterator it;
for(it=trackers.begin(); it!=trackers.end(); it++) {
qDebug("* Tracker: %s", it->url.c_str());
}
// Connections limit per torrent
h.set_max_connections(Preferences::getMaxConnecsPerTorrent());
// Uploads limit per torrent
......@@ -910,6 +905,7 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
// Sequential download
if(TorrentTempData::hasTempData(hash)) {
qDebug("addTorrent: Setting download as sequential (from tmp data)");
h.prioritize_files(TorrentTempData::getFilesPriority(hash));
h.set_sequential_download(TorrentTempData::isSequential(hash));
}
// Save persistent data for new torrent
......
......@@ -42,14 +42,17 @@ using namespace libtorrent;
class GeoIP {
protected:
static QString geoipFolder(bool embedded=false) {
#ifdef WITH_GEOIP_EMBEDDED
static QString geoipFolder(bool embedded=false) {
if(embedded)
return ":/geoip/";
return misc::qBittorrentPath()+"geoip"+QDir::separator();
#else
static QString geoipFolder(bool) {
if(QFile::exists("/usr/local/share/GeoIP/GeoIP.dat"))
return "/usr/local/share/GeoIP/";
if(QFile::exists("/var/lib/GeoIP/GeoIP.dat"))
return "/var/lib/GeoIP/";
return "/usr/share/GeoIP/";
#endif
}
......
......@@ -309,6 +309,11 @@ void HttpConnection::respondCommand(QString command)
torrent.close();
}
emit torrentReadyToBeDownloaded(filePath, false, QString(), false);
// Prepare response
generator.setStatusLine(200, "OK");
generator.setContentTypeByExt("html");
generator.setMessage(QString("<script type=\"text/javascript\">window.parent.hideAll();</script>"));
write();
return;
}
if(command == "resumeall") {
......
......@@ -33,95 +33,103 @@
#include "httpconnection.h"
#include "eventmanager.h"
#include "bittorrent.h"
#include "preferences.h"
#include <QTimer>
#include <QCryptographicHash>
HttpServer::HttpServer(Bittorrent *_BTSession, int msec, QObject* parent) : QTcpServer(parent)
{
base64 = QByteArray(":").toBase64();
connect(this, SIGNAL(newConnection()), this, SLOT(newHttpConnection()));
BTSession = _BTSession;
manager = new EventManager(this, BTSession);
//add torrents
std::vector<torrent_handle> torrents = BTSession->getTorrents();
std::vector<torrent_handle>::iterator torrentIT;
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT);
if(h.is_valid())
manager->addedTorrent(h);
}
//connect BTSession to manager
connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), manager, SLOT(addedTorrent(QTorrentHandle&)));
connect(BTSession, SIGNAL(deletedTorrent(QString)), manager, SLOT(deletedTorrent(QString)));
//set timer
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(onTimer()));
timer->start(msec);
// Additional translations for Web UI
QString a = tr("File");
a = tr("Edit");
a = tr("Help");
a = tr("Delete from HD");
a = tr("Download Torrents from their URL or Magnet link");
a = tr("Only one link per line");
a = tr("Download local torrent");
a = tr("Torrent files were correctly added to download list.");
a = tr("Point to torrent file");
a = tr("Download");
a = tr("Are you sure you want to delete the selected torrents from the transfer list and hard disk?");
a = tr("Download rate limit must be greater than 0 or disabled.");
a = tr("Upload rate limit must be greater than 0 or disabled.");
a = tr("Maximum number of connections limit must be greater than 0 or disabled.");
a = tr("Maximum number of connections per torrent limit must be greater than 0 or disabled.");
a = tr("Maximum number of upload slots per torrent limit must be greater than 0 or disabled.");
a = tr("Unable to save program preferences, qBittorrent is probably unreachable.");
HttpServer::HttpServer(Bittorrent *_BTSession, int msec, QObject* parent) : QTcpServer(parent) {
username = Preferences::getWebUiUsername().toLocal8Bit();
password_md5 = Preferences::getWebUiPassword().toLocal8Bit();
connect(this, SIGNAL(newConnection()), this, SLOT(newHttpConnection()));
BTSession = _BTSession;
manager = new EventManager(this, BTSession);
//add torrents
std::vector<torrent_handle> torrents = BTSession->getTorrents();
std::vector<torrent_handle>::iterator torrentIT;
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT);
if(h.is_valid())
manager->addedTorrent(h);
}
//connect BTSession to manager
connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), manager, SLOT(addedTorrent(QTorrentHandle&)));
connect(BTSession, SIGNAL(deletedTorrent(QString)), manager, SLOT(deletedTorrent(QString)));
//set timer
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(onTimer()));
timer->start(msec);
// Additional translations for Web UI
QString a = tr("File");
a = tr("Edit");
a = tr("Help");
a = tr("Delete from HD");
a = tr("Download Torrents from their URL or Magnet link");
a = tr("Only one link per line");
a = tr("Download local torrent");
a = tr("Torrent files were correctly added to download list.");
a = tr("Point to torrent file");
a = tr("Download");
a = tr("Are you sure you want to delete the selected torrents from the transfer list and hard disk?");
a = tr("Download rate limit must be greater than 0 or disabled.");
a = tr("Upload rate limit must be greater than 0 or disabled.");
a = tr("Maximum number of connections limit must be greater than 0 or disabled.");
a = tr("Maximum number of connections per torrent limit must be greater than 0 or disabled.");
a = tr("Maximum number of upload slots per torrent limit must be greater than 0 or disabled.");
a = tr("Unable to save program preferences, qBittorrent is probably unreachable.");
}
HttpServer::~HttpServer()
{
delete timer;
delete manager;
delete timer;
delete manager;
}
void HttpServer::newHttpConnection()
{
QTcpSocket *socket;
while((socket = nextPendingConnection()))
{
HttpConnection *connection = new HttpConnection(socket, BTSession, this);
//connect connection to BTSession
connect(connection, SIGNAL(UrlReadyToBeDownloaded(QString)), BTSession, SLOT(downloadUrlAndSkipDialog(QString)));
connect(connection, SIGNAL(MagnetReadyToBeDownloaded(QString)), BTSession, SLOT(addMagnetSkipAddDlg(QString)));
connect(connection, SIGNAL(torrentReadyToBeDownloaded(QString, bool, QString, bool)), BTSession, SLOT(addTorrent(QString, bool, QString, bool)));
connect(connection, SIGNAL(deleteTorrent(QString, bool)), BTSession, SLOT(deleteTorrent(QString, bool)));
connect(connection, SIGNAL(pauseTorrent(QString)), BTSession, SLOT(pauseTorrent(QString)));
connect(connection, SIGNAL(resumeTorrent(QString)), BTSession, SLOT(resumeTorrent(QString)));
connect(connection, SIGNAL(pauseAllTorrents()), BTSession, SLOT(pauseAllTorrents()));
connect(connection, SIGNAL(resumeAllTorrents()), BTSession, SLOT(resumeAllTorrents()));
}
QTcpSocket *socket;
while((socket = nextPendingConnection()))
{
HttpConnection *connection = new HttpConnection(socket, BTSession, this);
//connect connection to BTSession
connect(connection, SIGNAL(UrlReadyToBeDownloaded(QString)), BTSession, SLOT(downloadUrlAndSkipDialog(QString)));
connect(connection, SIGNAL(MagnetReadyToBeDownloaded(QString)), BTSession, SLOT(addMagnetSkipAddDlg(QString)));
connect(connection, SIGNAL(torrentReadyToBeDownloaded(QString, bool, QString, bool)), BTSession, SLOT(addTorrent(QString, bool, QString, bool)));
connect(connection, SIGNAL(deleteTorrent(QString, bool)), BTSession, SLOT(deleteTorrent(QString, bool)));
connect(connection, SIGNAL(pauseTorrent(QString)), BTSession, SLOT(pauseTorrent(QString)));
connect(connection, SIGNAL(resumeTorrent(QString)), BTSession, SLOT(resumeTorrent(QString)));
connect(connection, SIGNAL(pauseAllTorrents()), BTSession, SLOT(pauseAllTorrents()));
connect(connection, SIGNAL(resumeAllTorrents()), BTSession, SLOT(resumeAllTorrents()));
}
}
void HttpServer::onTimer() {
std::vector<torrent_handle> torrents = BTSession->getTorrents();
std::vector<torrent_handle>::iterator torrentIT;
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT);
if(h.is_valid())
manager->modifiedTorrent(h);
}
std::vector<torrent_handle> torrents = BTSession->getTorrents();
std::vector<torrent_handle>::iterator torrentIT;
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT);
if(h.is_valid())
manager->modifiedTorrent(h);
}
}
void HttpServer::setAuthorization(QString username, QString password)
{
QString cat = username + ":" + password;
base64 = QByteArray(cat.toLocal8Bit()).toBase64();
void HttpServer::setAuthorization(QString _username, QString _password_md5) {
username = _username.toLocal8Bit();
password_md5 = _password_md5.toLocal8Bit();
}
bool HttpServer::isAuthorized(QByteArray auth) const
{
return (auth == base64);
bool HttpServer::isAuthorized(QByteArray auth) const {
// Decode Auth
QByteArray decoded = QByteArray::fromBase64(auth);
QList<QByteArray> creds = decoded.split(':');
if(creds.size() != 2) return false;
QByteArray prop_username = creds.first();
if(prop_username != username) return false;
QCryptographicHash md5(QCryptographicHash::Md5);
md5.addData(creds.last());
return (password_md5 == md5.result().toHex());
}
EventManager* HttpServer::eventManager() const
{
return manager;
return manager;
}
......@@ -44,7 +44,8 @@ class HttpServer : public QTcpServer {
Q_OBJECT
private:
QByteArray base64;
QByteArray username;
QByteArray password_md5;
Bittorrent *BTSession;
EventManager *manager;
QTimer *timer;
......@@ -52,7 +53,7 @@ class HttpServer : public QTcpServer {
public:
HttpServer(Bittorrent *BTSession, int msec, QObject* parent = 0);
~HttpServer();
void setAuthorization(QString username, QString password);
void setAuthorization(QString username, QString password_md5);
bool isAuthorized(QByteArray auth) const;
EventManager *eventManager() const;
......
......@@ -20,6 +20,7 @@
<file>lang/qbittorrent_pt_BR.qm</file>
<file>lang/qbittorrent_el.qm</file>
<file>lang/qbittorrent_ca.qm</file>
<file>lang/qbittorrent_sr.qm</file>
<file>lang/qbittorrent_hu.qm</file>
<file>lang/qbittorrent_da.qm</file>
<file>lang/qbittorrent_de.qm</file>
......
This diff was suppressed by a .gitattributes entry.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff was suppressed by a .gitattributes entry.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff was suppressed by a .gitattributes entry.
This diff is collapsed.
This diff was suppressed by a .gitattributes entry.
This diff is collapsed.
This diff is collapsed.
This diff was suppressed by a .gitattributes entry.
This diff is collapsed.
This diff is collapsed.
This diff was suppressed by a .gitattributes entry.
This diff is collapsed.
......@@ -104,9 +104,9 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
comboI18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/czech.png"))), QString::fromUtf8("Čeština"));
locales << "cs_CZ";
comboI18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/slovakia.png"))), QString::fromUtf8("Slovenčina"));
locales << "sr_CS";
comboI18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/serbia.png"))), QString::fromUtf8("Србин"));
locales << "sk_SK";
comboI18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/serbia.png"))), QString::fromUtf8("Српски"));
locales << "sr_CS";
comboI18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/romania.png"))), QString::fromUtf8("Română"));
locales << "ro_RO";
comboI18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/turkey.png"))), QString::fromUtf8("Türkçe"));
......@@ -465,7 +465,8 @@ void options_imp::saveOptions(){
{
settings.setValue("Port", webUiPort());
settings.setValue("Username", webUiUsername());
settings.setValue("Password", webUiPassword());
// FIXME: Check that the password is valid (not empty at least)
Preferences::setWebUiPassword(webUiPassword());
}
// End Web UI
settings.endGroup();
......
......@@ -32,6 +32,7 @@
#define PREFERENCES_H
#include <QSettings>
#include <QCryptographicHash>
#include <QPair>
#include <QDir>
......@@ -456,12 +457,40 @@ public:
static QString getWebUiUsername() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value("Preferences/WebUI/Username", "user").toString();
return settings.value("Preferences/WebUI/Username", "admin").toString();
}
static void setWebUiPassword(QString new_password) {
// Get current password md5
QString current_pass_md5 = getWebUiPassword();
// Check if password did not change
if(current_pass_md5 == new_password) return;
// Encode to md5 and save
QCryptographicHash md5(QCryptographicHash::Md5);
md5.addData(new_password.toLocal8Bit());
QSettings settings("qBittorrent", "qBittorrent");
settings.setValue("Preferences/WebUI/Password_md5", md5.result().toHex());
}
static QString getWebUiPassword() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value("Preferences/WebUI/Password", "").toString();
// Here for backward compatiblity
if(settings.contains("Preferences/WebUI/Password")) {
QString clear_pass = settings.value("Preferences/WebUI/Password", "adminadmin").toString();
settings.remove("Preferences/WebUI/Password");
QCryptographicHash md5(QCryptographicHash::Md5);
md5.addData(clear_pass.toLocal8Bit());
QString pass_md5(md5.result().toHex());
settings.setValue("Preferences/WebUI/Password_md5", pass_md5);
return pass_md5;
}
QString pass_md5 = settings.value("Preferences/WebUI/Password_md5", "").toString();
if(pass_md5.isEmpty()) {
QCryptographicHash md5(QCryptographicHash::Md5);
md5.addData("adminadmin");
pass_md5 = md5.result().toHex();
}
return pass_md5;
}
};
......
......@@ -472,7 +472,8 @@ void QTorrentHandle::set_max_connections(int val) {
void QTorrentHandle::prioritize_files(std::vector<int> v) {
// Does not do anything for seeding torrents
Q_ASSERT(h.is_valid());
Q_ASSERT(v.size() == (unsigned int)h.get_torrent_info().num_files());
if(v.size() != (unsigned int)h.get_torrent_info().num_files())
return;
h.prioritize_files(v);
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment