mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-06-02 12:29:44 +08:00
✨ Feature: add local plugin support && npm registry/proxy support
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
<el-button type="primary" round size="mini" @click="customLinkVisible = true">点击设置</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="设置代理"
|
||||
label="设置代理和镜像地址"
|
||||
>
|
||||
<el-button type="primary" round size="mini" @click="proxyVisible = true">点击设置</el-button>
|
||||
</el-form-item>
|
||||
@@ -183,19 +183,20 @@
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
title="设置代理"
|
||||
title="设置代理和镜像地址"
|
||||
:visible.sync="proxyVisible"
|
||||
:modal-append-to-body="false"
|
||||
width="70%"
|
||||
>
|
||||
<el-form
|
||||
label-position="right"
|
||||
:model="customLink"
|
||||
ref="customLink"
|
||||
:rules="rules"
|
||||
label-width="80px"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-form-item
|
||||
label="代理地址"
|
||||
label="上传代理"
|
||||
>
|
||||
<el-input
|
||||
v-model="proxy"
|
||||
@@ -203,6 +204,24 @@
|
||||
placeholder="例如:http://127.0.0.1:1080"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="插件安装代理"
|
||||
>
|
||||
<el-input
|
||||
v-model="npmProxy"
|
||||
:autofocus="true"
|
||||
placeholder="例如:http://127.0.0.1:1080"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="插件镜像地址"
|
||||
>
|
||||
<el-input
|
||||
v-model="npmRegistry"
|
||||
:autofocus="true"
|
||||
placeholder="例如:https://registry.npm.taobao.org/"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer">
|
||||
<el-button @click="cancelProxy" round>取消</el-button>
|
||||
@@ -375,6 +394,8 @@ export default class extends Vue {
|
||||
upload: db.get('settings.shortKey.upload')
|
||||
}
|
||||
proxy = db.get('picBed.proxy') || ''
|
||||
npmRegistry = db.get('settings.registry') || ''
|
||||
npmProxy = db.get('settings.proxy') || ''
|
||||
rules = {
|
||||
value: [
|
||||
{ validator: customLinkRule, trigger: 'blur' }
|
||||
@@ -452,7 +473,9 @@ export default class extends Vue {
|
||||
confirmProxy () {
|
||||
this.proxyVisible = false
|
||||
this.letPicGoSaveData({
|
||||
'picBed.proxy': this.proxy
|
||||
'picBed.proxy': this.proxy,
|
||||
'settings.proxy': this.npmProxy,
|
||||
'settings.registry': this.npmRegistry
|
||||
})
|
||||
const successNotification = new Notification('设置代理', {
|
||||
body: '设置成功'
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
<template>
|
||||
<div id="plugin-view">
|
||||
<div class="view-title">
|
||||
插件设置 - <i class="el-icon-goods" @click="goAwesomeList"></i>
|
||||
插件设置 -
|
||||
<el-tooltip :content="pluginListToolTip" placement="right">
|
||||
<i class="el-icon-goods" @click="goAwesomeList"></i>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="importLocalPluginToolTip" placement="left">
|
||||
<i class="el-icon-download" @click="handleImportLocalPlugin"/>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<el-row class="handle-bar" :class="{ 'cut-width': pluginList.length > 6 }">
|
||||
<el-input
|
||||
@@ -126,6 +132,8 @@ export default class extends Vue {
|
||||
pluginNameList: string[] = []
|
||||
loading = true
|
||||
needReload = false
|
||||
pluginListToolTip = '插件列表'
|
||||
importLocalPluginToolTip = '导入本地插件'
|
||||
id = ''
|
||||
os = ''
|
||||
defaultLogo: string = 'this.src="https://cdn.jsdelivr.net/gh/Molunerfinn/PicGo@dev/public/roundLogo.png"'
|
||||
@@ -158,6 +166,9 @@ export default class extends Vue {
|
||||
}
|
||||
created () {
|
||||
this.os = process.platform
|
||||
ipcRenderer.on('hideLoading', () => {
|
||||
this.loading = false
|
||||
})
|
||||
ipcRenderer.on('pluginList', (evt: IpcRendererEvent, list: IPicGoPlugin[]) => {
|
||||
this.pluginList = list
|
||||
this.pluginNameList = list.map(item => item.fullName)
|
||||
@@ -319,6 +330,7 @@ export default class extends Vue {
|
||||
item.ing = true
|
||||
}
|
||||
})
|
||||
this.loading = true
|
||||
ipcRenderer.send('uninstallPlugin', val)
|
||||
}
|
||||
updatePlugin (val: string) {
|
||||
@@ -327,6 +339,7 @@ export default class extends Vue {
|
||||
item.ing = true
|
||||
}
|
||||
})
|
||||
this.loading = true
|
||||
ipcRenderer.send('updatePlugin', val)
|
||||
}
|
||||
reloadApp () {
|
||||
@@ -460,11 +473,16 @@ export default class extends Vue {
|
||||
letPicGoSaveData (data: IObj) {
|
||||
ipcRenderer.send('picgoSaveData', data)
|
||||
}
|
||||
handleImportLocalPlugin () {
|
||||
ipcRenderer.send('importLocalPlugin')
|
||||
this.loading = true
|
||||
}
|
||||
beforeDestroy () {
|
||||
ipcRenderer.removeAllListeners('pluginList')
|
||||
ipcRenderer.removeAllListeners('installSuccess')
|
||||
ipcRenderer.removeAllListeners('uninstallSuccess')
|
||||
ipcRenderer.removeAllListeners('updateSuccess')
|
||||
ipcRenderer.removeAllListeners('hideLoading')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -494,6 +512,7 @@ $darwinBg = #172426
|
||||
font-size 20px
|
||||
text-align center
|
||||
margin 10px auto
|
||||
position relative
|
||||
i.el-icon-goods
|
||||
font-size 20px
|
||||
vertical-align middle
|
||||
@@ -501,6 +520,16 @@ $darwinBg = #172426
|
||||
transition color .2s ease-in-out
|
||||
&:hover
|
||||
color #49B1F5
|
||||
i.el-icon-download
|
||||
position absolute
|
||||
right 0
|
||||
top 8px
|
||||
font-size 20px
|
||||
vertical-align middle
|
||||
cursor pointer
|
||||
transition color .2s ease-in-out
|
||||
&:hover
|
||||
color #49B1F5
|
||||
.handle-bar
|
||||
margin-bottom 20px
|
||||
&.cut-width
|
||||
|
||||
Reference in New Issue
Block a user