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
+17
-14
@@ -20,7 +20,7 @@ class QThread;
|
||||
class SearchWorker;
|
||||
class ListWorker;
|
||||
class InstallWorker;
|
||||
class PluginShop;
|
||||
class PluginPackage;
|
||||
|
||||
// Logic layer: everything the application *does*. It owns the providers
|
||||
// (pacman, Flatpak, AUR, ...), the plugin registry, the history, the privileged
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
PluginManager* plugins() const { return m_plugins; }
|
||||
HistoryManager* history() const { return m_history; }
|
||||
UpdateManager* updateManager() const { return m_update; }
|
||||
PluginShop* shop() const { return m_shop; }
|
||||
PluginPackage* packages() const { return m_packages; }
|
||||
std::vector<IPackageManager*> availableProviders() const;
|
||||
QStringList availableProviderNames() const;
|
||||
bool hasAvailableProvider() const;
|
||||
@@ -111,6 +111,10 @@ public:
|
||||
// Whether any available provider knows that file, so the window only accepts
|
||||
// drops it can act on.
|
||||
bool canInstallFile(const QString& path) const;
|
||||
// Whether a file is a plugin package (.fwspacm). Packages are not installed
|
||||
// by a provider: they carry a plugin, they are not packages to install, so
|
||||
// they never take the sudo gate and never enter the file install queue.
|
||||
bool isPluginPackage(const QString& path) const;
|
||||
// Bulk removal: one command per provider, run one provider at a time
|
||||
// (pacman locks its database for the whole operation).
|
||||
StartResult removePackages(const std::vector<PackageInfo>& packages,
|
||||
@@ -147,13 +151,13 @@ public:
|
||||
void setPluginEnabled(const std::string& pluginId, bool enabled);
|
||||
void reloadPlugins();
|
||||
|
||||
// ---- Plugin shop ----
|
||||
// Fetches the catalogue the shop offers and installs/removes one of its
|
||||
// entries. Installing drops the shared library in the per-user plugin
|
||||
// directory and reloads the registry, so the plugin is usable right away.
|
||||
void loadPluginCatalog();
|
||||
void installShopPlugin(const QString& id);
|
||||
void removeShopPlugin(const QString& id);
|
||||
// ---- Plugin packages ----
|
||||
// Installs a .fwspacm package (the archive the packaging script builds) and
|
||||
// removes one that was installed this way. Installing writes the shared
|
||||
// library in the per-user plugin directory and reloads the registry, so the
|
||||
// plugin is usable right away.
|
||||
void installPluginPackage(const QString& path);
|
||||
void removePluginPackage(const QString& id);
|
||||
|
||||
// ---- Application self-update ----
|
||||
bool shouldCheckForAppUpdate() const;
|
||||
@@ -190,10 +194,9 @@ signals:
|
||||
void statusMessage(const QString& message);
|
||||
void historyChanged();
|
||||
void pluginsChanged();
|
||||
// The shop's catalogue was fetched (or failed to be), and an install or a
|
||||
// removal from it finished.
|
||||
void pluginCatalogChanged();
|
||||
void shopInstallFinished(const QString& id, bool success, const QString& message);
|
||||
// A plugin package was installed or removed (or the attempt was refused).
|
||||
void pluginPackageInstalled(const QString& id, bool success, const QString& message);
|
||||
void pluginPackageRemoved(const QString& id, bool success, const QString& message);
|
||||
void updateCheckFinished(bool hasUpdate, const QString& latestVersion,
|
||||
const QString& errorMessage);
|
||||
void selfUpdateFinished(bool success, const QString& message);
|
||||
@@ -254,7 +257,7 @@ private:
|
||||
void clearCredentialsAfterUse();
|
||||
|
||||
PluginManager* m_plugins = nullptr;
|
||||
PluginShop* m_shop = nullptr;
|
||||
PluginPackage* m_packages = nullptr;
|
||||
PacmanManager* m_pacman = nullptr; // non-owning, for sudo credentials and the lock
|
||||
HistoryManager* m_history = nullptr;
|
||||
UpdateManager* m_update = nullptr;
|
||||
|
||||
Reference in new issue
Block a user