Skip to content

Commit d14805d

Browse files
Merge pull request qbittorrent#2863 from racam/master
login.html escape quotes + add qbittorrent-nox to gitignore + bug with startup info with qbittorrent-nox
2 parents 452b643 + d7ac142 commit d14805d

4 files changed

Lines changed: 17 additions & 10 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
src/gui/geoip/GeoIP.dat
22
src/gui/geoip/GeoIP.dat.gz
33
src/qbittorrent
4+
src/qbittorrent-nox
45
qbittorrent.pro.user*
56
conf.pri
67
Makefile

src/app/application.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,14 @@ int Application::exec(const QStringList &params)
157157
#ifdef DISABLE_GUI
158158
#ifndef DISABLE_WEBUI
159159
Preferences* const pref = Preferences::instance();
160-
if (pref->isWebUiEnabled()) {
161-
// Display some information to the user
162-
std::cout << std::endl << "******** " << qPrintable(tr("Information")) << " ********" << std::endl;
163-
std::cout << qPrintable(tr("To control qBittorrent, access the Web UI at http://localhost:%1").arg(QString::number(pref->getWebUiPort()))) << std::endl;
164-
std::cout << qPrintable(tr("The Web UI administrator user name is: %1").arg(pref->getWebUiUsername())) << std::endl;
165-
qDebug() << "Password:" << pref->getWebUiPassword();
166-
if (pref->getWebUiPassword() == "f6fdffe48c908deb0f4c3bd36c032e72") {
167-
std::cout << qPrintable(tr("The Web UI administrator password is still the default one: %1").arg("adminadmin")) << std::endl;
168-
std::cout << qPrintable(tr("This is a security risk, please consider changing your password from program preferences.")) << std::endl;
169-
}
160+
// Display some information to the user
161+
std::cout << std::endl << "******** " << qPrintable(tr("Information")) << " ********" << std::endl;
162+
std::cout << qPrintable(tr("To control qBittorrent, access the Web UI at http://localhost:%1").arg(QString::number(pref->getWebUiPort()))) << std::endl;
163+
std::cout << qPrintable(tr("The Web UI administrator user name is: %1").arg(pref->getWebUiUsername())) << std::endl;
164+
qDebug() << "Password:" << pref->getWebUiPassword();
165+
if (pref->getWebUiPassword() == "f6fdffe48c908deb0f4c3bd36c032e72") {
166+
std::cout << qPrintable(tr("The Web UI administrator password is still the default one: %1").arg("adminadmin")) << std::endl;
167+
std::cout << qPrintable(tr("This is a security risk, please consider changing your password from program preferences.")) << std::endl;
170168
}
171169
#endif // DISABLE_WEBUI
172170
#else

src/core/preferences.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,11 @@ void Preferences::setIgnoreSlowTorrentsForQueueing(bool ignore)
10761076

10771077
bool Preferences::isWebUiEnabled() const
10781078
{
1079+
#ifdef DISABLE_GUI
1080+
return true;
1081+
#else
10791082
return value("Preferences/WebUI/Enabled", false).toBool();
1083+
#endif
10801084
}
10811085

10821086
void Preferences::setWebUiEnabled(bool enabled)

src/webui/abstractwebapplication.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,10 @@ void AbstractWebApplication::translateDocument(QString& data)
271271
// Remove keyboard shortcuts
272272
translation.replace(mnemonic, "");
273273

274+
// Use HTML code for quotes to prevent issues with JS
275+
translation.replace("'", "&#39;");
276+
translation.replace("\"", "&#34;");
277+
274278
data.replace(i, regex.matchedLength(), translation);
275279
i += translation.length();
276280
}

0 commit comments

Comments
 (0)