attach extension to opera/vivaldi or all windows

This commit is contained in:
fourtf 2019-10-07 20:23:28 +02:00
parent 2fc799f85a
commit f25e52b218
3 changed files with 22 additions and 8 deletions

View file

@ -214,6 +214,8 @@ public:
QStringSetting cachePath = {"/cache/path", ""}; QStringSetting cachePath = {"/cache/path", ""};
BoolSetting restartOnCrash = {"/misc/restartOnCrash", false}; BoolSetting restartOnCrash = {"/misc/restartOnCrash", false};
BoolSetting attachExtensionToAnyProcess = {
"/misc/attachExtensionToAnyProcess", false};
/// Debug /// Debug
BoolSetting showUnhandledIrcMessages = {"/debug/showUnhandledIrcMessages", BoolSetting showUnhandledIrcMessages = {"/debug/showUnhandledIrcMessages",

View file

@ -180,13 +180,19 @@ void AttachedWindow::attachToHwnd(void *_attachedPtr)
QString qfilename = QString qfilename =
QString::fromWCharArray(filename.get(), int(filenameLength)); QString::fromWCharArray(filename.get(), int(filenameLength));
if (!qfilename.endsWith("chrome.exe") && if (!getSettings()->attachExtensionToAnyProcess)
!qfilename.endsWith("firefox.exe"))
{ {
qDebug() << "NM Illegal caller" << qfilename; // We don't attach to non-browser processes by default.
this->timer_.stop(); if (!qfilename.endsWith("chrome.exe") &&
this->deleteLater(); !qfilename.endsWith("firefox.exe") &&
return; !qfilename.endsWith("vivaldi.exe") &&
!qfilename.endsWith("opera.exe"))
{
qDebug() << "NM Illegal caller" << qfilename;
this->timer_.stop();
this->deleteLater();
return;
}
} }
this->validProcessName_ = true; this->validProcessName_ = true;
} }

View file

@ -439,10 +439,16 @@ void GeneralPage::initLayout(SettingsLayout &layout)
layout.addDescription("The browser extension replaces the default " layout.addDescription("The browser extension replaces the default "
"Twitch.tv chat with chatterino."); "Twitch.tv chat with chatterino.");
layout.addDescription(formatRichNamedLink(CHROME_EXTENSION_LINK, layout.addDescription(formatRichNamedLink(
"Download for Google Chrome")); CHROME_EXTENSION_LINK,
"Download for Google Chrome and similar browsers."));
layout.addDescription( layout.addDescription(
formatRichNamedLink(FIREFOX_EXTENSION_LINK, "Download for Firefox")); formatRichNamedLink(FIREFOX_EXTENSION_LINK, "Download for Firefox"));
layout.addDescription("Chatterino only attaches to known browsers to avoid "
"attaching to other windows by accident.");
layout.addCheckbox("Attach to any browser (may cause issues).",
s.attachExtensionToAnyProcess);
#endif #endif
layout.addTitle("Miscellaneous"); layout.addTitle("Miscellaneous");