mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-08-28 19:47:17 +08:00
✨ Feature: add update all plugins
This commit is contained in:
@@ -323,6 +323,7 @@ PLUGIN_INSTALLED: Installed
|
|||||||
PLUGIN_DOING_SOMETHING: Doing...
|
PLUGIN_DOING_SOMETHING: Doing...
|
||||||
PLUGIN_LIST: Plugin List
|
PLUGIN_LIST: Plugin List
|
||||||
PLUGIN_IMPORT_LOCAL: Import Local Plugins
|
PLUGIN_IMPORT_LOCAL: Import Local Plugins
|
||||||
|
PLUGIN_UPDATE_ALL: Update All Plugins
|
||||||
|
|
||||||
# tips
|
# tips
|
||||||
|
|
||||||
|
|||||||
@@ -325,6 +325,7 @@ PLUGIN_INSTALLED: 已安装
|
|||||||
PLUGIN_DOING_SOMETHING: 进行中
|
PLUGIN_DOING_SOMETHING: 进行中
|
||||||
PLUGIN_LIST: 插件列表
|
PLUGIN_LIST: 插件列表
|
||||||
PLUGIN_IMPORT_LOCAL: 导入本地插件
|
PLUGIN_IMPORT_LOCAL: 导入本地插件
|
||||||
|
PLUGIN_UPDATE_ALL: 更新全部插件
|
||||||
|
|
||||||
# tips
|
# tips
|
||||||
|
|
||||||
|
|||||||
@@ -323,6 +323,7 @@ PLUGIN_INSTALLED: 已安裝
|
|||||||
PLUGIN_DOING_SOMETHING: 進行中
|
PLUGIN_DOING_SOMETHING: 進行中
|
||||||
PLUGIN_LIST: 插件列表
|
PLUGIN_LIST: 插件列表
|
||||||
PLUGIN_IMPORT_LOCAL: 導入本地插件
|
PLUGIN_IMPORT_LOCAL: 導入本地插件
|
||||||
|
PLUGIN_UPDATE_ALL: 更新全部插件
|
||||||
|
|
||||||
# tips
|
# tips
|
||||||
|
|
||||||
|
|||||||
@@ -196,10 +196,10 @@ const handlePluginUninstall = async (fullName: string) => {
|
|||||||
dispose()
|
dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePluginUpdate = async (fullName: string) => {
|
const handlePluginUpdate = async (fullName: string | string[]) => {
|
||||||
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
||||||
const dispose = handleNPMError()
|
const dispose = handleNPMError()
|
||||||
const res = await picgo.pluginHandler.update([fullName])
|
const res = await picgo.pluginHandler.update(typeof fullName === 'string' ? [fullName] : fullName)
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
window.webContents.send('updateSuccess', res.body[0])
|
window.webContents.send('updateSuccess', res.body[0])
|
||||||
} else {
|
} else {
|
||||||
@@ -212,6 +212,13 @@ const handlePluginUpdate = async (fullName: string) => {
|
|||||||
dispose()
|
dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleUpdateAllPlugin = () => {
|
||||||
|
ipcMain.on('updateAllPlugin', async (event: IpcMainEvent, list: string[]) => {
|
||||||
|
console.log(list)
|
||||||
|
handlePluginUpdate(list)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const handleNPMError = (): IDispose => {
|
const handleNPMError = (): IDispose => {
|
||||||
const handler = (msg: string) => {
|
const handler = (msg: string) => {
|
||||||
if (msg === 'NPM is not installed') {
|
if (msg === 'NPM is not installed') {
|
||||||
@@ -419,6 +426,7 @@ export default {
|
|||||||
handlePicGoGetConfig()
|
handlePicGoGetConfig()
|
||||||
handlePicGoGalleryDB()
|
handlePicGoGalleryDB()
|
||||||
handleImportLocalPlugin()
|
handleImportLocalPlugin()
|
||||||
|
handleUpdateAllPlugin()
|
||||||
handleOpenFile()
|
handleOpenFile()
|
||||||
handleOpenWindow()
|
handleOpenWindow()
|
||||||
handleI18n()
|
handleI18n()
|
||||||
|
|||||||
@@ -13,6 +13,17 @@
|
|||||||
<Goods />
|
<Goods />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
<el-tooltip
|
||||||
|
:content="updateAllToolTip"
|
||||||
|
placement="left"
|
||||||
|
>
|
||||||
|
<el-icon
|
||||||
|
class="el-icon-update"
|
||||||
|
@click="handleUpdateAllPlugin"
|
||||||
|
>
|
||||||
|
<Refresh />
|
||||||
|
</el-icon>
|
||||||
|
</el-tooltip>
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
:content="importLocalPluginToolTip"
|
:content="importLocalPluginToolTip"
|
||||||
placement="left"
|
placement="left"
|
||||||
@@ -211,7 +222,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
// Element Plus 图标
|
// Element Plus 图标
|
||||||
import { Close, Download, Goods, Remove, Tools } from '@element-plus/icons-vue'
|
import { Close, Download, Refresh, Goods, Remove, Tools } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
// 国际化函数
|
// 国际化函数
|
||||||
import { T as $T } from '@/i18n/index'
|
import { T as $T } from '@/i18n/index'
|
||||||
@@ -243,7 +254,7 @@ import {
|
|||||||
} from '#/events/constants'
|
} from '#/events/constants'
|
||||||
|
|
||||||
// Vue 相关
|
// Vue 相关
|
||||||
import { computed, ref, onBeforeMount, onBeforeUnmount, watch, onMounted, reactive } from 'vue'
|
import { computed, ref, onBeforeMount, onBeforeUnmount, watch, onMounted, reactive, toRaw } from 'vue'
|
||||||
|
|
||||||
// 数据发送工具函数
|
// 数据发送工具函数
|
||||||
import { getConfig, saveConfig, sendRPC, sendToMain } from '@/utils/dataSender'
|
import { getConfig, saveConfig, sendRPC, sendToMain } from '@/utils/dataSender'
|
||||||
@@ -270,6 +281,7 @@ const needReload = ref(false)
|
|||||||
const latestVersionMap = reactive<{ [key: string]: string }>({})
|
const latestVersionMap = reactive<{ [key: string]: string }>({})
|
||||||
const pluginListToolTip = $T('PLUGIN_LIST')
|
const pluginListToolTip = $T('PLUGIN_LIST')
|
||||||
const importLocalPluginToolTip = $T('PLUGIN_IMPORT_LOCAL')
|
const importLocalPluginToolTip = $T('PLUGIN_IMPORT_LOCAL')
|
||||||
|
const updateAllToolTip = $T('PLUGIN_UPDATE_ALL')
|
||||||
// const id = ref('')
|
// const id = ref('')
|
||||||
const os = ref('')
|
const os = ref('')
|
||||||
const defaultLogo = ref(`this.src="file://${__static.replace(/\\/g, '/')}/roundLogo.png"`)
|
const defaultLogo = ref(`this.src="file://${__static.replace(/\\/g, '/')}/roundLogo.png"`)
|
||||||
@@ -591,6 +603,10 @@ function handleImportLocalPlugin () {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleUpdateAllPlugin () {
|
||||||
|
sendToMain('updateAllPlugin', toRaw(pluginNameList.value))
|
||||||
|
}
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
window.removeEventListener('resize', handleResize)
|
window.removeEventListener('resize', handleResize)
|
||||||
ipcRenderer.removeAllListeners('pluginList')
|
ipcRenderer.removeAllListeners('pluginList')
|
||||||
@@ -644,9 +660,19 @@ $darwinBg = #172426
|
|||||||
transition color .2s ease-in-out
|
transition color .2s ease-in-out
|
||||||
&:hover
|
&:hover
|
||||||
color #49B1F5
|
color #49B1F5
|
||||||
|
i.el-icon-update
|
||||||
|
position absolute
|
||||||
|
right 35px
|
||||||
|
top 8px
|
||||||
|
font-size 20px
|
||||||
|
vertical-align middle
|
||||||
|
cursor pointer
|
||||||
|
transition color .2s ease-in-out
|
||||||
|
&:hover
|
||||||
|
color #49B1F5
|
||||||
i.el-icon-download
|
i.el-icon-download
|
||||||
position absolute
|
position absolute
|
||||||
right 0
|
right 5px
|
||||||
top 8px
|
top 8px
|
||||||
font-size 20px
|
font-size 20px
|
||||||
vertical-align middle
|
vertical-align middle
|
||||||
|
|||||||
Vendored
+1
@@ -307,6 +307,7 @@ interface ILocales {
|
|||||||
PLUGIN_DOING_SOMETHING: string
|
PLUGIN_DOING_SOMETHING: string
|
||||||
PLUGIN_LIST: string
|
PLUGIN_LIST: string
|
||||||
PLUGIN_IMPORT_LOCAL: string
|
PLUGIN_IMPORT_LOCAL: string
|
||||||
|
PLUGIN_UPDATE_ALL: string
|
||||||
TIPS_REMOVE_LINK: string
|
TIPS_REMOVE_LINK: string
|
||||||
TIPS_WILL_REMOVE_CHOOSED_IMAGES: string
|
TIPS_WILL_REMOVE_CHOOSED_IMAGES: string
|
||||||
TIPS_MUST_CONTAINS_URL: string
|
TIPS_MUST_CONTAINS_URL: string
|
||||||
|
|||||||
Reference in New Issue
Block a user