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
+24
-16
@@ -22,6 +22,10 @@ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
|
||||
# Find Qt6
|
||||
find_package(Qt6 REQUIRED COMPONENTS Widgets Network)
|
||||
|
||||
# zlib reads the deflated entries of a .fwspacm package. Qt links it anyway, so
|
||||
# it is present on any system this builds on; there is no public Qt API for ZIP.
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
# Main executable
|
||||
set(SOURCES
|
||||
src/main.cpp
|
||||
@@ -32,10 +36,11 @@ set(SOURCES
|
||||
src/package-model.cpp
|
||||
src/update-manager.cpp
|
||||
src/app-logging.cpp
|
||||
# Logic layer: background workers, the plugin shop and the controller the
|
||||
# screens delegate to.
|
||||
# Logic layer: background workers, the plugin package installer and the
|
||||
# controller the screens delegate to.
|
||||
src/workers.cpp
|
||||
src/plugin-shop.cpp
|
||||
src/zip-archive.cpp
|
||||
src/plugin-package.cpp
|
||||
src/app-core.cpp
|
||||
# Interface: one file per screen under pages/, on top of the logic layer.
|
||||
pages/page.cpp
|
||||
@@ -62,7 +67,8 @@ set(HEADERS
|
||||
include/app-logging.h
|
||||
include/workers.h
|
||||
include/progress-tracker.h
|
||||
include/plugin-shop.h
|
||||
include/zip-archive.h
|
||||
include/plugin-package.h
|
||||
include/app-core.h
|
||||
include/log-manager.h
|
||||
pages/page.h
|
||||
@@ -78,7 +84,7 @@ set(HEADERS
|
||||
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE include pages)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets Qt6::Network)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets Qt6::Network ZLIB::ZLIB)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
FWSPACMANAGE_VERSION="${PACMANAGER_VERSION}")
|
||||
|
||||
@@ -165,14 +171,16 @@ add_executable(progress-tracker-test tests/progress-tracker.test.cpp)
|
||||
target_include_directories(progress-tracker-test PRIVATE include)
|
||||
add_test(NAME progress-tracker-test COMMAND progress-tracker-test)
|
||||
|
||||
# PluginShop: catalogue parsing and the install/uninstall bookkeeping. The
|
||||
# network half is exercised through the catalogue parser; the file half runs in
|
||||
# a temporary directory, and the settings go to a temporary INI too.
|
||||
add_executable(plugin-shop-test tests/plugin-shop.test.cpp
|
||||
src/plugin-shop.cpp src/app-logging.cpp include/plugin-shop.h)
|
||||
target_include_directories(plugin-shop-test PRIVATE include)
|
||||
target_link_libraries(plugin-shop-test PRIVATE Qt6::Core Qt6::Network)
|
||||
add_test(NAME plugin-shop-test COMMAND plugin-shop-test)
|
||||
# PluginPackage: the .fwspacm format. The archives are built in the test itself
|
||||
# (a stored and a deflated entry, so both compression methods are exercised),
|
||||
# the file half runs in a temporary directory, and the settings go to a
|
||||
# temporary INI too, so nothing touches the user's real plugin directory.
|
||||
add_executable(plugin-package-test tests/plugin-package.test.cpp
|
||||
src/plugin-package.cpp src/zip-archive.cpp src/app-logging.cpp
|
||||
include/plugin-package.h include/zip-archive.h)
|
||||
target_include_directories(plugin-package-test PRIVATE include)
|
||||
target_link_libraries(plugin-package-test PRIVATE Qt6::Core ZLIB::ZLIB)
|
||||
add_test(NAME plugin-package-test COMMAND plugin-package-test)
|
||||
|
||||
add_executable(aur-manager-test tests/aur-manager.test.cpp
|
||||
plugins/aur-provider/aur-manager.cpp)
|
||||
@@ -188,12 +196,12 @@ add_test(NAME aur-manager-test COMMAND aur-manager-test)
|
||||
add_executable(app-core-test tests/app-core.test.cpp
|
||||
src/app-core.cpp src/workers.cpp src/pacman-manager.cpp
|
||||
src/plugin-manager.cpp src/history-manager.cpp src/update-manager.cpp
|
||||
src/plugin-shop.cpp
|
||||
src/plugin-package.cpp src/zip-archive.cpp
|
||||
src/app-logging.cpp src/log-manager.cpp
|
||||
include/app-core.h include/workers.h include/update-manager.h
|
||||
include/plugin-shop.h include/log-manager.h)
|
||||
include/plugin-package.h include/zip-archive.h include/log-manager.h)
|
||||
target_include_directories(app-core-test PRIVATE include)
|
||||
target_link_libraries(app-core-test PRIVATE Qt6::Core Qt6::Network)
|
||||
target_link_libraries(app-core-test PRIVATE Qt6::Core Qt6::Network ZLIB::ZLIB)
|
||||
target_compile_definitions(app-core-test PRIVATE
|
||||
FWSPACMANAGE_VERSION="${PACMANAGER_VERSION}")
|
||||
add_test(NAME app-core-test COMMAND app-core-test)
|
||||
|
||||
Reference in new issue
Block a user