feat(plugins): replace the shop with drag-and-drop .fwspacm packages
The shop was a catalogue served over HTTP that the application fetched and listed, which put a network round trip between a user and a plugin that was almost always one file they already had. It also had to keep its catalogue URLs in step with every release, since an entry that pointed at a missing asset was indistinguishable from one that never worked. A plugin is now distributed as a .fwspacm package: a ZIP archive holding a plugin.json manifest and the shared library, which the user drops anywhere on the window. The file is the distribution, so there is no catalogue to publish, no network, and no catalogue URL setting to explain. The manifest tells the user what they are about to run, and its checksum is verified before anything is written, so a package whose library is not the one it declares never reaches the plugin directory. Qt exposes no public ZIP API, so the archive is read directly (central directory plus zlib for the deflated entries) rather than through a private header that could move between toolchains. The reader stays in the logic layer: app-core-test still links no QtWidgets, and a unit test builds its own archives to check both compression methods and every refusal path.
This commit is contained in:
29 files changed
+2105
-1046
No files matched your search
+22
-24
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "app-logging.h"
|
||||
#include "log-manager.h"
|
||||
#include "plugin-shop.h"
|
||||
#include "plugin-package.h"
|
||||
#include "workers.h"
|
||||
|
||||
namespace {
|
||||
@@ -110,20 +110,20 @@ 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,
|
||||
// Plugin packages: a .fwspacm archive dropped on the window, and the
|
||||
// bookkeeping of what was installed from one. What a package carries lands
|
||||
// in the directory the registry scans, so a successful install only needs
|
||||
// that registry reloaded.
|
||||
m_packages = new PluginPackage(this);
|
||||
connect(m_packages, &PluginPackage::installFinished, this,
|
||||
[this](const QString& id, bool success, const QString& message) {
|
||||
if (success) reloadPlugins();
|
||||
emit shopInstallFinished(id, success, message);
|
||||
emit pluginPackageInstalled(id, success, message);
|
||||
});
|
||||
connect(m_shop, &PluginShop::removeFinished, this,
|
||||
connect(m_packages, &PluginPackage::removeFinished, this,
|
||||
[this](const QString& id, bool success, const QString& message) {
|
||||
if (success) reloadPlugins();
|
||||
emit shopInstallFinished(id, success, message);
|
||||
emit pluginPackageRemoved(id, success, message);
|
||||
});
|
||||
|
||||
m_history = new HistoryManager();
|
||||
@@ -523,6 +523,10 @@ bool AppCore::canInstallFile(const QString& path) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AppCore::isPluginPackage(const QString& path) const {
|
||||
return PluginPackage::isPackagePath(path);
|
||||
}
|
||||
|
||||
AppCore::StartResult AppCore::removePackages(const std::vector<PackageInfo>& packages,
|
||||
const QString& description) { Request request;
|
||||
request.action = QStringLiteral("cleanup");
|
||||
@@ -1083,26 +1087,20 @@ void AppCore::reloadPlugins() {
|
||||
emit statusMessage(QStringLiteral("Plugins rechargés."));
|
||||
}
|
||||
|
||||
void AppCore::loadPluginCatalog() {
|
||||
LogManager::instance().logEvent(QStringLiteral("plugin"),
|
||||
QStringLiteral("chargement du catalogue"));
|
||||
emit statusMessage(QStringLiteral("Chargement du catalogue de plugins..."));
|
||||
m_shop->refresh();
|
||||
}
|
||||
|
||||
void AppCore::installShopPlugin(const QString& id) {
|
||||
void AppCore::installPluginPackage(const QString& path) {
|
||||
LogManager::instance().logEvent(
|
||||
QStringLiteral("plugin"),
|
||||
QStringLiteral("installation depuis la boutique : %1").arg(id));
|
||||
emit statusMessage(QStringLiteral("Téléchargement du plugin %1...").arg(id));
|
||||
m_shop->install(id);
|
||||
QStringLiteral("installation du paquet : %1").arg(QFileInfo(path).fileName()));
|
||||
emit statusMessage(
|
||||
QStringLiteral("Installation du paquet %1...").arg(QFileInfo(path).fileName()));
|
||||
m_packages->install(path);
|
||||
}
|
||||
|
||||
void AppCore::removeShopPlugin(const QString& id) {
|
||||
void AppCore::removePluginPackage(const QString& id) {
|
||||
LogManager::instance().logEvent(
|
||||
QStringLiteral("plugin"),
|
||||
QStringLiteral("suppression depuis la boutique : %1").arg(id));
|
||||
m_shop->remove(id);
|
||||
QStringLiteral("suppression du paquet : %1").arg(id));
|
||||
m_packages->remove(id);
|
||||
}
|
||||
|
||||
void AppCore::clearHistory() {
|
||||
|
||||
Reference in new issue
Block a user