Allow manual editing of browser extension connection keys
This commit is contained in:
committed by
Jonathan White
parent
d5de042529
commit
287e822e02
@@ -187,6 +187,18 @@ QString BrowserSettings::proxyLocation()
|
||||
return m_nativeMessageInstaller.getProxyPath();
|
||||
}
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
QString BrowserSettings::customExtensionId()
|
||||
{
|
||||
return config()->get(Config::Browser_CustomExtensionId).toString();
|
||||
}
|
||||
|
||||
void BrowserSettings::setCustomExtensionId(const QString& id)
|
||||
{
|
||||
config()->set(Config::Browser_CustomExtensionId, id);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool BrowserSettings::updateBinaryPath()
|
||||
{
|
||||
return config()->get(Config::Browser_UpdateBinaryPath).toBool();
|
||||
|
||||
@@ -64,6 +64,10 @@ public:
|
||||
QString customProxyLocation();
|
||||
void setCustomProxyLocation(const QString& location);
|
||||
QString proxyLocation();
|
||||
#ifdef QT_DEBUG
|
||||
QString customExtensionId();
|
||||
void setCustomExtensionId(const QString& id);
|
||||
#endif
|
||||
bool updateBinaryPath();
|
||||
void setUpdateBinaryPath(bool enabled);
|
||||
bool allowExpiredCredentials();
|
||||
|
||||
@@ -80,6 +80,11 @@ BrowserSettingsWidget::BrowserSettingsWidget(QWidget* parent)
|
||||
m_ui->firefoxSupport->setText("Firefox and Tor Browser");
|
||||
#endif
|
||||
m_ui->browserGlobalWarningWidget->setVisible(false);
|
||||
|
||||
#ifndef QT_DEBUG
|
||||
m_ui->customExtensionId->setVisible(false);
|
||||
m_ui->customExtensionLabel->setVisible(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
BrowserSettingsWidget::~BrowserSettingsWidget()
|
||||
@@ -152,6 +157,10 @@ void BrowserSettingsWidget::loadSettings()
|
||||
m_ui->browserGlobalWarningWidget->setAutoHideTimeout(-1);
|
||||
#endif
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
m_ui->customExtensionId->setText(settings->customExtensionId());
|
||||
#endif
|
||||
|
||||
validateCustomProxyLocation();
|
||||
}
|
||||
|
||||
@@ -190,6 +199,10 @@ void BrowserSettingsWidget::saveSettings()
|
||||
settings->setSupportKphFields(m_ui->supportKphFields->isChecked());
|
||||
settings->setNoMigrationPrompt(m_ui->noMigrationPrompt->isChecked());
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
settings->setCustomExtensionId(m_ui->customExtensionId->text());
|
||||
#endif
|
||||
|
||||
settings->setBrowserSupport(BrowserShared::CHROME, m_ui->chromeSupport->isChecked());
|
||||
settings->setBrowserSupport(BrowserShared::CHROMIUM, m_ui->chromiumSupport->isChecked());
|
||||
settings->setBrowserSupport(BrowserShared::FIREFOX, m_ui->firefoxSupport->isChecked());
|
||||
|
||||
@@ -378,6 +378,33 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="customExtensionBox">
|
||||
<property name="topMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="customExtensionLabel">
|
||||
<property name="text">
|
||||
<string>Custom extension ID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="customExtensionId">
|
||||
<property name="accessibleName">
|
||||
<string>Custom extension ID</string>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>999</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
|
||||
@@ -276,6 +276,12 @@ QJsonObject NativeMessageInstaller::constructFile(SupportedBrowsers browser)
|
||||
for (const QString& origin : ALLOWED_ORIGINS) {
|
||||
arr.append(origin);
|
||||
}
|
||||
#ifdef QT_DEBUG
|
||||
auto customId = browserSettings()->customExtensionId();
|
||||
if (!customId.isEmpty()) {
|
||||
arr.append(QString("chrome-extension://%1/").arg(customId));
|
||||
}
|
||||
#endif
|
||||
script["allowed_origins"] = arr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user