From 80b526d1af2623541d832e0e4f8f99610a9b5e84 Mon Sep 17 00:00:00 2001 From: racam Date: Sat, 11 Apr 2015 22:30:11 +0200 Subject: [PATCH 1/2] add qbittorrent-nox to the .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2332d0f85..b2dd959fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ src/geoip/GeoIP.dat src/geoip/GeoIP.dat.gz src/qbittorrent +src/qbittorrent-nox qbittorrent.pro.user* conf.pri Makefile From d7ac142885fa4c304aacb83bef4155acfccff595 Mon Sep 17 00:00:00 2001 From: racam Date: Mon, 27 Apr 2015 20:44:12 +0200 Subject: [PATCH 2/2] Enhancement of the webui preference and of the quote escape for javascript --- src/app/application.cpp | 18 ++++++++---------- src/core/preferences.cpp | 4 ++++ src/webui/abstractwebapplication.cpp | 4 ++++ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/app/application.cpp b/src/app/application.cpp index 73470159f..44ee8126b 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -157,16 +157,14 @@ int Application::exec(const QStringList ¶ms) #ifdef DISABLE_GUI #ifndef DISABLE_WEBUI Preferences* const pref = Preferences::instance(); - if (pref->isWebUiEnabled()) { - // Display some information to the user - std::cout << std::endl << "******** " << qPrintable(tr("Information")) << " ********" << std::endl; - std::cout << qPrintable(tr("To control qBittorrent, access the Web UI at http://localhost:%1").arg(QString::number(pref->getWebUiPort()))) << std::endl; - std::cout << qPrintable(tr("The Web UI administrator user name is: %1").arg(pref->getWebUiUsername())) << std::endl; - qDebug() << "Password:" << pref->getWebUiPassword(); - if (pref->getWebUiPassword() == "f6fdffe48c908deb0f4c3bd36c032e72") { - std::cout << qPrintable(tr("The Web UI administrator password is still the default one: %1").arg("adminadmin")) << std::endl; - std::cout << qPrintable(tr("This is a security risk, please consider changing your password from program preferences.")) << std::endl; - } + // Display some information to the user + std::cout << std::endl << "******** " << qPrintable(tr("Information")) << " ********" << std::endl; + std::cout << qPrintable(tr("To control qBittorrent, access the Web UI at http://localhost:%1").arg(QString::number(pref->getWebUiPort()))) << std::endl; + std::cout << qPrintable(tr("The Web UI administrator user name is: %1").arg(pref->getWebUiUsername())) << std::endl; + qDebug() << "Password:" << pref->getWebUiPassword(); + if (pref->getWebUiPassword() == "f6fdffe48c908deb0f4c3bd36c032e72") { + std::cout << qPrintable(tr("The Web UI administrator password is still the default one: %1").arg("adminadmin")) << std::endl; + std::cout << qPrintable(tr("This is a security risk, please consider changing your password from program preferences.")) << std::endl; } #endif // DISABLE_WEBUI #else diff --git a/src/core/preferences.cpp b/src/core/preferences.cpp index caae7ab23..12a788227 100644 --- a/src/core/preferences.cpp +++ b/src/core/preferences.cpp @@ -1076,7 +1076,11 @@ void Preferences::setIgnoreSlowTorrentsForQueueing(bool ignore) bool Preferences::isWebUiEnabled() const { +#ifdef DISABLE_GUI + return true; +#else return value("Preferences/WebUI/Enabled", false).toBool(); +#endif } void Preferences::setWebUiEnabled(bool enabled) diff --git a/src/webui/abstractwebapplication.cpp b/src/webui/abstractwebapplication.cpp index 1e13e1318..ed25891ea 100644 --- a/src/webui/abstractwebapplication.cpp +++ b/src/webui/abstractwebapplication.cpp @@ -270,6 +270,10 @@ void AbstractWebApplication::translateDocument(QString& data) // Remove keyboard shortcuts translation.replace(mnemonic, ""); + // Use HTML code for quotes to prevent issues with JS + translation.replace("'", "'"); + translation.replace("\"", """); + data.replace(i, regex.matchedLength(), translation); i += translation.length(); }