feat: allow extra user-defined extension IDs to interact with Chatterino (#5997)
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## Unversioned
|
## Unversioned
|
||||||
|
|
||||||
|
- Minor: Added an option to allow multiple user-selected extensions to interact with Chatterino. (#5997)
|
||||||
- Minor: Add `Set highlight sounds` and `Open subscription page` split hotkeys. (#5856)
|
- Minor: Add `Set highlight sounds` and `Open subscription page` split hotkeys. (#5856)
|
||||||
- Minor: `/clear` messages are now stacked like timeouts. (#5806)
|
- Minor: `/clear` messages are now stacked like timeouts. (#5806)
|
||||||
- Minor: Treat all browsers starting with `firefox` as a Firefox browser. (#5805)
|
- Minor: Treat all browsers starting with `firefox` as a Firefox browser. (#5805)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "debug/AssertInGuiThread.hpp"
|
#include "debug/AssertInGuiThread.hpp"
|
||||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||||
#include "singletons/Paths.hpp"
|
#include "singletons/Paths.hpp"
|
||||||
|
#include "singletons/Settings.hpp"
|
||||||
#include "util/IpcQueue.hpp"
|
#include "util/IpcQueue.hpp"
|
||||||
#include "util/PostToThread.hpp"
|
#include "util/PostToThread.hpp"
|
||||||
|
|
||||||
@@ -55,11 +56,26 @@ void registerNmHost(const Paths &paths)
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QStringList extensionIDs =
|
||||||
|
getSettings()->additionalExtensionIDs.getValue().split(
|
||||||
|
';', Qt::SkipEmptyParts);
|
||||||
|
|
||||||
// chrome
|
// chrome
|
||||||
{
|
{
|
||||||
auto obj = getBaseDocument();
|
auto obj = getBaseDocument();
|
||||||
QJsonArray allowedOriginsArr = {
|
QJsonArray allowedOriginsArr = {
|
||||||
u"chrome-extension://%1/"_s.arg(EXTENSION_ID)};
|
u"chrome-extension://%1/"_s.arg(EXTENSION_ID)};
|
||||||
|
|
||||||
|
for (const auto &id : extensionIDs)
|
||||||
|
{
|
||||||
|
QString trimmedID = id.trimmed();
|
||||||
|
if (!trimmedID.isEmpty())
|
||||||
|
{
|
||||||
|
allowedOriginsArr.append(
|
||||||
|
u"chrome-extension://%1/"_s.arg(trimmedID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
obj.insert("allowed_origins", allowedOriginsArr);
|
obj.insert("allowed_origins", allowedOriginsArr);
|
||||||
|
|
||||||
registerNmManifest(paths, "/native-messaging-manifest-chrome.json",
|
registerNmManifest(paths, "/native-messaging-manifest-chrome.json",
|
||||||
@@ -72,6 +88,16 @@ void registerNmHost(const Paths &paths)
|
|||||||
{
|
{
|
||||||
auto obj = getBaseDocument();
|
auto obj = getBaseDocument();
|
||||||
QJsonArray allowedExtensions = {"chatterino_native@chatterino.com"};
|
QJsonArray allowedExtensions = {"chatterino_native@chatterino.com"};
|
||||||
|
|
||||||
|
for (const auto &id : extensionIDs)
|
||||||
|
{
|
||||||
|
QString trimmedID = id.trimmed();
|
||||||
|
if (!trimmedID.isEmpty())
|
||||||
|
{
|
||||||
|
allowedExtensions.append(trimmedID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
obj.insert("allowed_extensions", allowedExtensions);
|
obj.insert("allowed_extensions", allowedExtensions);
|
||||||
|
|
||||||
registerNmManifest(paths, "/native-messaging-manifest-firefox.json",
|
registerNmManifest(paths, "/native-messaging-manifest-firefox.json",
|
||||||
|
|||||||
@@ -658,6 +658,8 @@ public:
|
|||||||
false,
|
false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QStringSetting additionalExtensionIDs{"/misc/additionalExtensionIDs", ""};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ChatterinoSetting<std::vector<HighlightPhrase>> highlightedMessagesSetting =
|
ChatterinoSetting<std::vector<HighlightPhrase>> highlightedMessagesSetting =
|
||||||
{"/highlighting/highlights"};
|
{"/highlighting/highlights"};
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QFontDialog>
|
#include <QFontDialog>
|
||||||
|
#include <QFormLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
|
|
||||||
@@ -876,6 +877,26 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
|||||||
s.attachExtensionToAnyProcess, false,
|
s.attachExtensionToAnyProcess, false,
|
||||||
"Attempt to force the Chatterino Browser Extension to work in certain "
|
"Attempt to force the Chatterino Browser Extension to work in certain "
|
||||||
"browsers that do not work automatically.\ne.g. Librewolf");
|
"browsers that do not work automatically.\ne.g. Librewolf");
|
||||||
|
|
||||||
|
{
|
||||||
|
auto *note = new QLabel(
|
||||||
|
"A semicolon-separated list of Chrome or Firefox extension IDs"
|
||||||
|
"allowed to interact with Chatterino's browser integration "
|
||||||
|
"(requires restart).\n"
|
||||||
|
"Using multiple extension IDs from different browsers may cause "
|
||||||
|
"issues.");
|
||||||
|
note->setWordWrap(true);
|
||||||
|
note->setStyleSheet("color: #bbb");
|
||||||
|
|
||||||
|
layout.addWidget(note);
|
||||||
|
auto *extraIDs = this->createLineEdit(s.additionalExtensionIDs);
|
||||||
|
extraIDs->setPlaceholderText("Extension;IDs;separated;by;semicolons");
|
||||||
|
|
||||||
|
auto form = new QFormLayout();
|
||||||
|
form->addRow("Extra extension IDs:", extraIDs);
|
||||||
|
|
||||||
|
layout.addLayout(form);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
layout.addTitle("AppData & Cache");
|
layout.addTitle("AppData & Cache");
|
||||||
|
|||||||
Reference in New Issue
Block a user