diff --git a/docs/QUICKSTART.md b/docs/QUICKSTART.md index 8b694888e..4b69ddf21 100644 --- a/docs/QUICKSTART.md +++ b/docs/QUICKSTART.md @@ -27,7 +27,7 @@ for all your websites, programs, etc. * In **Browser Integration**, check **Enable KeePassXC browser integration** * Right below that, click the checkbox for the browser(s) you use Leave the other options at their defaults. -* *In your default web browser,* install the KeePassXC Browser extension/add-on. Instructions for [Firefox](https://addons.mozilla.org/en-US/firefox/addon/keepassxc-browser/) or [Chrome](https://chrome.google.com/webstore/detail/keepassxc-browser/oboonakemofpalcgghocfoadofidjkkk) +* *In your default web browser,* install the KeePassXC Browser extension/add-on. Instructions for [Firefox or Tor Browser](https://addons.mozilla.org/en-US/firefox/addon/keepassxc-browser/) or [Chrome](https://chrome.google.com/webstore/detail/keepassxc-browser/oboonakemofpalcgghocfoadofidjkkk) * Click the KeePassXC icon in the upper-right corner. You'll see the dialog below. * Click the blue Connect button to make the browser extension connect to the KeePassXC application. KeePassXC Connect dialog diff --git a/src/browser/BrowserOptionDialog.cpp b/src/browser/BrowserOptionDialog.cpp index 41194e9b6..6dcbd3263 100644 --- a/src/browser/BrowserOptionDialog.cpp +++ b/src/browser/BrowserOptionDialog.cpp @@ -60,6 +60,9 @@ BrowserOptionDialog::BrowserOptionDialog(QWidget* parent) // Vivaldi uses Chrome's registry settings m_ui->vivaldiSupport->setHidden(true); m_ui->chromeSupport->setText("Chrome and Vivaldi"); + // Tor Browser uses Firefox's registry settings + m_ui->torBrowserSupport->setHidden(true); + m_ui->firefoxSupport->setText("Firefox and Tor Browser"); #endif m_ui->browserGlobalWarningWidget->setVisible(false); } @@ -99,7 +102,10 @@ void BrowserOptionDialog::loadSettings() m_ui->chromeSupport->setChecked(settings->chromeSupport()); m_ui->chromiumSupport->setChecked(settings->chromiumSupport()); m_ui->firefoxSupport->setChecked(settings->firefoxSupport()); +#ifndef Q_OS_WIN m_ui->vivaldiSupport->setChecked(settings->vivaldiSupport()); + m_ui->torBrowserSupport->setChecked(settings->torBrowserSupport()); +#endif #if defined(KEEPASSXC_DIST_APPIMAGE) m_ui->supportBrowserProxy->setChecked(true); @@ -149,7 +155,10 @@ void BrowserOptionDialog::saveSettings() settings->setChromeSupport(m_ui->chromeSupport->isChecked()); settings->setChromiumSupport(m_ui->chromiumSupport->isChecked()); settings->setFirefoxSupport(m_ui->firefoxSupport->isChecked()); +#ifndef Q_OS_WIN settings->setVivaldiSupport(m_ui->vivaldiSupport->isChecked()); + settings->setTorBrowserSupport(m_ui->torBrowserSupport->isChecked()); +#endif } void BrowserOptionDialog::showProxyLocationFileDialog() diff --git a/src/browser/BrowserOptionDialog.ui b/src/browser/BrowserOptionDialog.ui index 9a951b33d..c01be920b 100755 --- a/src/browser/BrowserOptionDialog.ui +++ b/src/browser/BrowserOptionDialog.ui @@ -60,8 +60,7 @@ - - + @@ -88,6 +87,19 @@ 40 + + + + Qt::Horizontal + + + + 179 + 20 + + + + @@ -108,19 +120,6 @@ - - - - Qt::Horizontal - - - - 179 - 20 - - - - @@ -141,6 +140,16 @@ + + + + &Tor Browser + + + false + + + @@ -214,22 +223,6 @@ - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - diff --git a/src/browser/BrowserSettings.cpp b/src/browser/BrowserSettings.cpp index dc92f5dc8..630d0ff18 100644 --- a/src/browser/BrowserSettings.cpp +++ b/src/browser/BrowserSettings.cpp @@ -228,6 +228,17 @@ void BrowserSettings::setVivaldiSupport(bool enabled) HostInstaller::SupportedBrowsers::VIVALDI, enabled, supportBrowserProxy(), customProxyLocation()); } +bool BrowserSettings::torBrowserSupport() +{ + return m_hostInstaller.checkIfInstalled(HostInstaller::SupportedBrowsers::TOR_BROWSER); +} + +void BrowserSettings::setTorBrowserSupport(bool enabled) +{ + m_hostInstaller.installBrowser( + HostInstaller::SupportedBrowsers::TOR_BROWSER, enabled, supportBrowserProxy(), customProxyLocation()); +} + bool BrowserSettings::passwordUseNumbers() { return config()->get("generator/Numbers", PasswordGenerator::DefaultNumbers).toBool(); diff --git a/src/browser/BrowserSettings.h b/src/browser/BrowserSettings.h index e501a1201..2e7c55ec6 100644 --- a/src/browser/BrowserSettings.h +++ b/src/browser/BrowserSettings.h @@ -70,7 +70,9 @@ public: void setFirefoxSupport(bool enabled); bool vivaldiSupport(); void setVivaldiSupport(bool enabled); - + bool torBrowserSupport(); + void setTorBrowserSupport(bool enabled); + bool passwordUseNumbers(); void setPasswordUseNumbers(bool useNumbers); bool passwordUseLowercase(); diff --git a/src/browser/HostInstaller.cpp b/src/browser/HostInstaller.cpp index 5d7eb3b3b..a3ad608d4 100644 --- a/src/browser/HostInstaller.cpp +++ b/src/browser/HostInstaller.cpp @@ -38,16 +38,19 @@ HostInstaller::HostInstaller() , TARGET_DIR_CHROMIUM("/Library/Application Support/Chromium/NativeMessagingHosts") , TARGET_DIR_FIREFOX("/Library/Application Support/Mozilla/NativeMessagingHosts") , TARGET_DIR_VIVALDI("/Library/Application Support/Vivaldi/NativeMessagingHosts") + , TARGET_DIR_TOR_BROWSER("/Library/Application Support/TorBrowser-Data/Browser/Mozilla/NativeMessagingHosts") #elif defined(Q_OS_LINUX) , TARGET_DIR_CHROME("/.config/google-chrome/NativeMessagingHosts") , TARGET_DIR_CHROMIUM("/.config/chromium/NativeMessagingHosts") , TARGET_DIR_FIREFOX("/.mozilla/native-messaging-hosts") , TARGET_DIR_VIVALDI("/.config/vivaldi/NativeMessagingHosts") + , TARGET_DIR_TOR_BROWSER("/.tor-browser/app/Browser/TorBrowser/Data/Browser/.mozilla/native-messaging-hosts") #elif defined(Q_OS_WIN) , TARGET_DIR_CHROME("HKEY_CURRENT_USER\\Software\\Google\\Chrome\\NativeMessagingHosts\\org.keepassxc.keepassxc_browser") , TARGET_DIR_CHROMIUM("HKEY_CURRENT_USER\\Software\\Chromium\\NativeMessagingHosts\\org.keepassxc.keepassxc_browser") , TARGET_DIR_FIREFOX("HKEY_CURRENT_USER\\Software\\Mozilla\\NativeMessagingHosts\\org.keepassxc.keepassxc_browser") - , TARGET_DIR_VIVALDI("HKEY_CURRENT_USER\\Software\\Vivaldi\\NativeMessagingHosts\\org.keepassxc.keepassxc_browser") + , TARGET_DIR_VIVALDI(TARGET_DIR_CHROME) + , TARGET_DIR_TOR_BROWSER(TARGET_DIR_FIREFOX) #endif { } @@ -159,6 +162,8 @@ QString HostInstaller::getTargetPath(SupportedBrowsers browser) const return TARGET_DIR_FIREFOX; case SupportedBrowsers::VIVALDI: return TARGET_DIR_VIVALDI; + case SupportedBrowsers::TOR_BROWSER: + return TARGET_DIR_TOR_BROWSER; default: return QString(); } @@ -182,6 +187,8 @@ QString HostInstaller::getBrowserName(SupportedBrowsers browser) const return "firefox"; case SupportedBrowsers::VIVALDI: return "vivaldi"; + case SupportedBrowsers::TOR_BROWSER: + return "tor-browser"; default: return QString(); } @@ -287,7 +294,7 @@ QJsonObject HostInstaller::constructFile(SupportedBrowsers browser, const bool& script["type"] = "stdio"; QJsonArray arr; - if (browser == SupportedBrowsers::FIREFOX) { + if (browser == SupportedBrowsers::FIREFOX || browser == SupportedBrowsers::TOR_BROWSER) { for (const QString& extension : ALLOWED_EXTENSIONS) { arr.append(extension); } diff --git a/src/browser/HostInstaller.h b/src/browser/HostInstaller.h index 204c3d982..77d1ffca5 100644 --- a/src/browser/HostInstaller.h +++ b/src/browser/HostInstaller.h @@ -33,7 +33,8 @@ public: CHROME = 0, CHROMIUM = 1, FIREFOX = 2, - VIVALDI = 3 + VIVALDI = 3, + TOR_BROWSER = 4 }; public: @@ -64,6 +65,7 @@ private: const QString TARGET_DIR_CHROMIUM; const QString TARGET_DIR_FIREFOX; const QString TARGET_DIR_VIVALDI; + const QString TARGET_DIR_TOR_BROWSER; }; #endif // HOSTINSTALLER_H