Skip to content

Commit

Permalink
feat(market): add one-click update, fix #115
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed May 6, 2023
1 parent 2f9c3f0 commit 6fb6137
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
17 changes: 17 additions & 0 deletions plugins/market/client/deps/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,24 @@ const names = computed(() => {
.sort((a, b) => a > b ? 1 : -1)
})
const updates = computed(() => {
return names.value.filter(name => {
const local = store.dependencies[name]
return local.latest && local.latest !== local.resolved
})
})
const menu = computed(() => [{
icon: 'rocket',
label: '全部更新',
disabled: !updates.value.length,
async action() {
for (const name of updates.value) {
const local = store.dependencies[name]
config.value.override[name] = local.latest
}
},
}, {
icon: 'check',
label: '应用更改',
disabled: !Object.keys(config.value.override).length,
Expand Down
2 changes: 2 additions & 0 deletions plugins/market/client/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import NavMarket from './activity/market.vue'
import NavPlugin from './activity/plugin.vue'

import Refresh from './market/refresh.vue'
import Rocket from './market/rocket.vue'

import AddGroup from './settings/add-group.vue'
import AddPlugin from './settings/add-plugin.vue'
Expand All @@ -19,6 +20,7 @@ icons.register('activity:market', NavMarket)
icons.register('activity:plugin', NavPlugin)

icons.register('refresh', Refresh)
icons.register('rocket', Rocket)
icons.register('add-plugin', AddPlugin)
icons.register('add-group', AddGroup)
icons.register('trash-can', TrashCan)
Expand Down
5 changes: 5 additions & 0 deletions plugins/market/client/icons/market/rocket.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<path fill="currentColor" d="M424 143.1C424 174.9 398.9 199.1 368 199.1C337.1 199.1 312 174.9 312 143.1C312 113.1 337.1 87.1 368 87.1C398.9 87.1 424 113.1 424 143.1zM368 167.1C381.3 167.1 392 157.3 392 143.1C392 130.7 381.3 119.1 368 119.1C354.7 119.1 344 130.7 344 143.1C344 157.3 354.7 167.1 368 167.1zM118.5 287.1H16C10.45 287.1 5.305 285.1 2.39 280.4C-.5254 275.7-.7907 269.8 1.689 264.8L52.42 163.4C63.26 141.7 85.42 127.1 109.7 127.1H199.9C202.4 124 204.8 120.3 207.2 116.7C289.1-4.07 411.1-8.142 483.9 5.275C495.6 7.414 504.6 16.43 506.7 28.06C520.1 100.9 516.1 222.9 395.3 304.8C391.7 307.2 387.1 309.6 384 312.1V402.3C384 426.6 370.3 448.7 348.6 459.6L247.2 510.3C242.2 512.8 236.3 512.5 231.6 509.6C226.9 506.7 224 501.5 224 496V391.8C215.2 395.6 207.4 398.9 200.1 401.7C189.1 406.6 175.5 403.9 166.5 394.8L115.8 344.1C106.6 334.9 103.9 321.1 109.1 309.2C111.7 303.2 114.9 296 118.5 288L118.5 287.1zM188.9 371.1C231.8 353.9 327.9 311.8 377.3 278.3C481.9 207.4 487.4 103 475.7 36.3C408.1 24.6 304.6 30.08 233.7 134.7C200.3 183.1 157.2 278.1 138.6 321.6L188.9 371.1zM334.3 430.1C345.2 425.5 352 414.5 352 402.3V330.6C321.4 347.3 286.3 363.1 256 377.7V470.1L334.3 430.1zM81.04 177.7L41.89 255.1H133.1C147.1 225.8 164.2 190.7 181.1 159.1H109.7C97.54 159.1 86.46 166.8 81.04 177.7z"/>
</svg>
</template>
2 changes: 1 addition & 1 deletion plugins/market/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@koishijs/plugin-market",
"description": "Manage your bots and plugins with console",
"version": "1.13.3",
"version": "1.13.4",
"main": "lib/node/index.js",
"typings": "lib/index.d.ts",
"exports": {
Expand Down

0 comments on commit 6fb6137

Please sign in to comment.