feat: check for and apply plugin updates from the marketplace#9
Open
aguung wants to merge 4 commits into
Open
Conversation
Extract refuses to run if the plugin folder already exists, so there was no way to apply a newer bundle over an already-installed plugin. Update mirrors Extract's per-entry logic but requires the plugin to already exist and never deletes the folder first, so any local-only file the plugin wrote at runtime survives the upgrade.
Mirrors Install's cloud-metadata + bundle-download flow, but stops the plugin first and calls the new Manager.Update instead of Extract, so it works on an already-installed plugin instead of erroring.
Cross-references the already-installed plugin list against an unfiltered marketplace catalog fetch (both client-side, no new backend query) to badge outdated plugins in My Plugins and fix the Marketplace browse view, which previously always showed "Install" even for an already-installed plugin.
Both ran 3-4 lines; compressed to 1-2 lines per the codebase's comment-brevity convention.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem
core/plugins/bundle.go'sExtract(used byInstall) refuses to run if the plugin's folder already exists, so there was no reusable path for updating an installed plugin in place.PluginsApp.tsxalways rendered "Install" regardless of whether the plugin was already installed — clicking it on an installed plugin just failed with an "already exists" error.Solution
Manager.Update(id, zipBytes): mirrorsExtract's per-entry loop, but requires the plugin to already exist and never deletes the destination folder first, so any local-only file a plugin wrote at runtime (outside the published bundle) survives an update.POST /api/market/update/{id}: same cloud-metadata + bundle-download flow asInstall, but stops the plugin first and callsUpdateinstead ofExtract.PluginsAppfetches the unfiltered marketplace catalog once and cross-references it against the already-loaded installed-plugins list, purely client-side (compareVersions, a small hand-rolled dot-version comparator — no new dependency). This drives the My Plugins badge and is passed down to the Marketplace view to pick Install vs. Installed vs. Update per listing.Changed files
core/plugins/bundle.goUpdate.core/plugins/bundle_test.goUpdate(nonexistent plugin, overwrite, local-file preservation, path-escape rejection).server/handlers/api_market.goUpdatehandler.server/server.goPOST /api/market/update/{id}.web/src/lib/semver.tscompareVersionshelper.web/src/lib/api.tsmarketApi.update.web/src/apps/PluginsApp.tsxTest plan
go test ./core/plugins/... -run TestUpdate -vpasses (4/4)go build ./...andgo test ./...pass with no regressionsManager.Updateend-to-end: version bumps correctly, a local-only file survives the updatetsc -b --noEmitandoxlintpass on the changed frontend files