fix(plugin): retain bound source during updates (#726)

This commit is contained in:
InfinityPacer
2026-08-27 20:01:29 +08:00
committed by GitHub
parent d8a843d5eb
commit 42db5ab5a3
4 changed files with 5 additions and 1 deletions
+2 -1
View File
@@ -307,7 +307,7 @@ async function resetPlugin() {
}
// 更新插件
async function updatePlugin(releaseVersion?: string) {
async function updatePlugin(releaseVersion?: string, repoUrl?: string) {
if (!releaseVersion && props.plugin?.system_version_compatible === false) {
$toast.error(props.plugin?.system_version_message || t('plugin.incompatibleSystemVersion'))
return
@@ -338,6 +338,7 @@ async function updatePlugin(releaseVersion?: string) {
params: {
release_version: releaseVersion,
force: true,
...(repoUrl ? { repo_url: repoUrl } : {}),
},
})
@@ -189,6 +189,7 @@ describe('PluginCard lifecycle actions', () => {
params: {
force: true,
release_version: '0.9.0',
repo_url: 'https://github.com/example/releases',
},
})
expect(mocks.confirm).toHaveBeenCalledWith(expect.objectContaining({ content: expect.stringContaining('v0.9.0') }))
@@ -369,6 +369,7 @@ async function installPlugin(releaseVersion?: string, repoUrl?: string) {
params: {
release_version: releaseVersion,
force: isInstalled.value || props.plugin?.has_update || Boolean(releaseVersion),
...(selectedRepoUrl ? { repo_url: selectedRepoUrl } : {}),
},
feedback: 'silent',
})
@@ -655,6 +655,7 @@ describe('PluginMarketDetailDialog', () => {
params: {
force: true,
release_version: undefined,
repo_url: 'https://github.com/example/releases',
},
})
expect(mocks.toastSuccess).toHaveBeenCalledWith('插件 演示插件 更新成功!')