feat(plugins): add a plugin shop fed by a JSON catalogue

Installing a plugin meant compiling a shared library and dropping it in a
directory by hand. The shop reads a catalogue (plugins/catalog.json, one
entry per plugin with its description and download URL), lists what can be
installed next to what already is, and installs an entry into
~/.local/share/PacManager/plugins — the directory the registry already
scans — so a plugin becomes usable without root rights and without a
restart. Installing runs third-party code in this process, so the shop only
fetches what the user picked, checks the announced sha256 before writing
anything, and a removal deletes only the files the shop wrote itself.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
BlackAngelTV committed 2026-09-16 22:41:11 +02:00
1 parent b26e907221
commit 5033c4e940
9 files changed
+872 -6

No files matched your search

+31
View File
@@ -12,6 +12,7 @@
#include <sstream>
#include "app-logging.h"
#include "plugin-shop.h"
#include "workers.h"
namespace {
@@ -94,6 +95,22 @@ AppCore::AppCore(QObject* parent) : QObject(parent) {
// Non-owning handle kept for sudo credentials and the database lock.
m_pacman = dynamic_cast<PacmanManager*>(m_plugins->managerFor("pacman"));
// Plugin shop: the catalogue, the downloads and the bookkeeping of what it
// installed. What it fetches lands in the directory the registry scans, so
// a successful install only needs that registry reloaded.
m_shop = new PluginShop(this);
connect(m_shop, &PluginShop::catalogChanged, this, &AppCore::pluginCatalogChanged);
connect(m_shop, &PluginShop::installFinished, this,
[this](const QString& id, bool success, const QString& message) {
if (success) reloadPlugins();
emit shopInstallFinished(id, success, message);
});
connect(m_shop, &PluginShop::removeFinished, this,
[this](const QString& id, bool success, const QString& message) {
if (success) reloadPlugins();
emit shopInstallFinished(id, success, message);
});
m_history = new HistoryManager();
m_update = new UpdateManager(this);
m_credentialMode =
@@ -888,6 +905,20 @@ void AppCore::reloadPlugins() {
emit statusMessage(QStringLiteral("Plugins rechargés."));
}
void AppCore::loadPluginCatalog() {
emit statusMessage(QStringLiteral("Chargement du catalogue de plugins..."));
m_shop->refresh();
}
void AppCore::installShopPlugin(const QString& id) {
emit statusMessage(QStringLiteral("Téléchargement du plugin %1...").arg(id));
m_shop->install(id);
}
void AppCore::removeShopPlugin(const QString& id) {
m_shop->remove(id);
}
void AppCore::clearHistory() {
m_history->clear();
emit historyChanged();