mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-01-23 06:38:13 -05:00
✨ Feature: add update progress bar and some optimization
ISSUES CLOSED: #83
This commit is contained in:
parent
13852a5c1b
commit
517348886c
@ -32,9 +32,9 @@
|
|||||||
"sha256": "node ./scripts/gen-sha256.js"
|
"sha256": "node ./scripts/gen-sha256.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.272.0",
|
"@aws-sdk/client-s3": "^3.388.0",
|
||||||
"@aws-sdk/lib-storage": "^3.272.0",
|
"@aws-sdk/lib-storage": "^3.388.0",
|
||||||
"@aws-sdk/s3-request-presigner": "^3.272.0",
|
"@aws-sdk/s3-request-presigner": "^3.388.0",
|
||||||
"@element-plus/icons-vue": "^2.1.0",
|
"@element-plus/icons-vue": "^2.1.0",
|
||||||
"@highlightjs/vue-plugin": "^2.1.0",
|
"@highlightjs/vue-plugin": "^2.1.0",
|
||||||
"@octokit/rest": "^19.0.7",
|
"@octokit/rest": "^19.0.7",
|
||||||
@ -48,7 +48,7 @@
|
|||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"compare-versions": "^4.1.3",
|
"compare-versions": "^4.1.3",
|
||||||
"core-js": "^3.27.1",
|
"core-js": "^3.27.1",
|
||||||
"cos-nodejs-sdk-v5": "^2.12.3",
|
"cos-nodejs-sdk-v5": "^2.12.4",
|
||||||
"dexie": "^3.2.4",
|
"dexie": "^3.2.4",
|
||||||
"electron-updater": "^6.1.1",
|
"electron-updater": "^6.1.1",
|
||||||
"element-plus": "^2.3.9",
|
"element-plus": "^2.3.9",
|
||||||
|
@ -94,14 +94,16 @@ import { NodeHttpHandler } from '@smithy/node-http-handler'
|
|||||||
import http, { AgentOptions } from 'http'
|
import http, { AgentOptions } from 'http'
|
||||||
import https from 'https'
|
import https from 'https'
|
||||||
|
|
||||||
// 通用获取 Agent 函数
|
// 工具函数
|
||||||
import { getAgent } from '../manage/utils/common'
|
import { getAgent } from '../manage/utils/common'
|
||||||
|
import logger from '@core/picgo/logger'
|
||||||
|
|
||||||
const STORE_PATH = app.getPath('userData')
|
const STORE_PATH = app.getPath('userData')
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
listen () {
|
listen () {
|
||||||
picgoCoreIPC.listen()
|
picgoCoreIPC.listen()
|
||||||
|
// Upload Related IPC
|
||||||
// from macOS tray
|
// from macOS tray
|
||||||
ipcMain.on('uploadClipboardFiles', async () => {
|
ipcMain.on('uploadClipboardFiles', async () => {
|
||||||
const trayWindow = windowManager.get(IWindowList.TRAY_WINDOW)!
|
const trayWindow = windowManager.get(IWindowList.TRAY_WINDOW)!
|
||||||
@ -137,6 +139,7 @@ export default {
|
|||||||
return uploadChoosedFiles(evt.sender, files)
|
return uploadChoosedFiles(evt.sender, files)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// ShortKey Related IPC
|
||||||
ipcMain.on('updateShortKey', (evt: IpcMainEvent, item: IShortKeyConfig, oldKey: string, from: string) => {
|
ipcMain.on('updateShortKey', (evt: IpcMainEvent, item: IShortKeyConfig, oldKey: string, from: string) => {
|
||||||
const result = shortKeyHandler.updateShortKey(item, oldKey, from)
|
const result = shortKeyHandler.updateShortKey(item, oldKey, from)
|
||||||
evt.sender.send('updateShortKeyResponse', result)
|
evt.sender.send('updateShortKeyResponse', result)
|
||||||
@ -172,6 +175,7 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Gallery image cloud delete IPC
|
||||||
ipcMain.handle('delete-sftp-file', async (_evt: IpcMainInvokeEvent, config: ISftpPlistConfig, fileName: string) => {
|
ipcMain.handle('delete-sftp-file', async (_evt: IpcMainInvokeEvent, config: ISftpPlistConfig, fileName: string) => {
|
||||||
try {
|
try {
|
||||||
const client = SSHClient.instance
|
const client = SSHClient.instance
|
||||||
@ -190,7 +194,6 @@ export default {
|
|||||||
ipcMain.handle('delete-aws-s3-file', async (_evt: IpcMainInvokeEvent, configMap: IStringKeyMap) => {
|
ipcMain.handle('delete-aws-s3-file', async (_evt: IpcMainInvokeEvent, configMap: IStringKeyMap) => {
|
||||||
try {
|
try {
|
||||||
const { imgUrl, config: { accessKeyID, secretAccessKey, bucketName, region, endpoint, pathStyleAccess, rejectUnauthorized, proxy } } = configMap
|
const { imgUrl, config: { accessKeyID, secretAccessKey, bucketName, region, endpoint, pathStyleAccess, rejectUnauthorized, proxy } } = configMap
|
||||||
console.log(JSON.stringify(configMap, null, 2))
|
|
||||||
const url = new URL(!/^https?:\/\//.test(imgUrl) ? `http://${imgUrl}` : imgUrl)
|
const url = new URL(!/^https?:\/\//.test(imgUrl) ? `http://${imgUrl}` : imgUrl)
|
||||||
const fileKey = url.pathname.replace(/^\/+/, '')
|
const fileKey = url.pathname.replace(/^\/+/, '')
|
||||||
const endpointUrl: string | undefined = endpoint
|
const endpointUrl: string | undefined = endpoint
|
||||||
@ -242,11 +245,13 @@ export default {
|
|||||||
const result = await client.send(command)
|
const result = await client.send(command)
|
||||||
return result.$metadata.httpStatusCode === 204
|
return result.$metadata.httpStatusCode === 204
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error(err)
|
logger.error(err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// migrate from PicGo
|
||||||
|
|
||||||
ipcMain.handle('migrateFromPicGo', async () => {
|
ipcMain.handle('migrateFromPicGo', async () => {
|
||||||
const picGoConfigPath = STORE_PATH.replace('piclist', 'picgo')
|
const picGoConfigPath = STORE_PATH.replace('piclist', 'picgo')
|
||||||
const fileToMigration = [
|
const fileToMigration = [
|
||||||
@ -274,6 +279,8 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// PicList Setting page IPC
|
||||||
|
|
||||||
ipcMain.on('updateCustomLink', () => {
|
ipcMain.on('updateCustomLink', () => {
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: T('OPERATION_SUCCEED'),
|
title: T('OPERATION_SUCCEED'),
|
||||||
@ -339,6 +346,8 @@ export default {
|
|||||||
mainWindow.setAlwaysOnTop(!isAlwaysOnTop)
|
mainWindow.setAlwaysOnTop(!isAlwaysOnTop)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Window operation API
|
||||||
|
|
||||||
ipcMain.on('openSettingWindow', () => {
|
ipcMain.on('openSettingWindow', () => {
|
||||||
windowManager.get(IWindowList.SETTING_WINDOW)!.show()
|
windowManager.get(IWindowList.SETTING_WINDOW)!.show()
|
||||||
const autoCloseMiniWindow = db.get('settings.autoCloseMiniWindow') || false
|
const autoCloseMiniWindow = db.get('settings.autoCloseMiniWindow') || false
|
||||||
|
@ -62,9 +62,8 @@ const handleStartUpFiles = (argv: string[], cwd: string) => {
|
|||||||
uploadChoosedFiles(win.webContents, files)
|
uploadChoosedFiles(win.webContents, files)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
autoUpdater.setFeedURL({
|
autoUpdater.setFeedURL({
|
||||||
@ -90,9 +89,19 @@ autoUpdater.on('update-available', (info: UpdateInfo) => {
|
|||||||
autoUpdater.downloadUpdate()
|
autoUpdater.downloadUpdate()
|
||||||
}
|
}
|
||||||
db.set('settings.showUpdateTip', !result.checkboxChecked)
|
db.set('settings.showUpdateTip', !result.checkboxChecked)
|
||||||
|
}).catch((err) => {
|
||||||
|
logger.error(err)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
autoUpdater.on('download-progress', (progressObj) => {
|
||||||
|
const percent = {
|
||||||
|
progress: progressObj.percent
|
||||||
|
}
|
||||||
|
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
||||||
|
window.webContents.send('updateProgress', percent)
|
||||||
|
})
|
||||||
|
|
||||||
autoUpdater.on('update-downloaded', () => {
|
autoUpdater.on('update-downloaded', () => {
|
||||||
dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
@ -100,9 +109,13 @@ autoUpdater.on('update-downloaded', () => {
|
|||||||
buttons: ['Yes', 'No'],
|
buttons: ['Yes', 'No'],
|
||||||
message: T('TIPS_UPDATE_DOWNLOADED')
|
message: T('TIPS_UPDATE_DOWNLOADED')
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
|
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
||||||
|
window.webContents.send('updateProgress', { progress: 100 })
|
||||||
if (result.response === 0) {
|
if (result.response === 0) {
|
||||||
autoUpdater.quitAndInstall()
|
autoUpdater.quitAndInstall()
|
||||||
}
|
}
|
||||||
|
}).catch((err) => {
|
||||||
|
logger.error(err)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -47,6 +47,15 @@
|
|||||||
</el-icon>
|
</el-icon>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<el-progress
|
||||||
|
v-if="progressShow"
|
||||||
|
:percentage="progressPercentage"
|
||||||
|
:stroke-width="7"
|
||||||
|
:text-inside="true"
|
||||||
|
:show-text="false"
|
||||||
|
status="success"
|
||||||
|
class="progress-bar"
|
||||||
|
/>
|
||||||
<el-row
|
<el-row
|
||||||
style="padding-top: 22px;"
|
style="padding-top: 22px;"
|
||||||
class="main-content"
|
class="main-content"
|
||||||
@ -311,9 +320,11 @@ const qrcodeVisible = ref(false)
|
|||||||
const picBedConfigString = ref('')
|
const picBedConfigString = ref('')
|
||||||
const choosedPicBedForQRCode: Ref<string[]> = ref([])
|
const choosedPicBedForQRCode: Ref<string[]> = ref([])
|
||||||
const isAlwaysOnTop = ref(false)
|
const isAlwaysOnTop = ref(false)
|
||||||
|
|
||||||
const keepAlivePages = $router.getRoutes().filter(item => item.meta.keepAlive).map(item => item.name as string)
|
const keepAlivePages = $router.getRoutes().filter(item => item.meta.keepAlive).map(item => item.name as string)
|
||||||
|
|
||||||
|
const progressShow = ref(true)
|
||||||
|
const progressPercentage = ref(0)
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
os.value = process.platform
|
os.value = process.platform
|
||||||
sendToMain(GET_PICBEDS)
|
sendToMain(GET_PICBEDS)
|
||||||
@ -325,6 +336,10 @@ onBeforeMount(() => {
|
|||||||
ipcRenderer.on(SHOW_MAIN_PAGE_DONATION, () => {
|
ipcRenderer.on(SHOW_MAIN_PAGE_DONATION, () => {
|
||||||
visible.value = true
|
visible.value = true
|
||||||
})
|
})
|
||||||
|
ipcRenderer.on('updateProgress', (_event: IpcRendererEvent, data: { progress: number}) => {
|
||||||
|
progressShow.value = data.progress !== 100 && data.progress !== 0
|
||||||
|
progressPercentage.value = data.progress
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(() => choosedPicBedForQRCode, (val) => {
|
watch(() => choosedPicBedForQRCode, (val) => {
|
||||||
@ -420,6 +435,9 @@ onBeforeRouteUpdate(async (to) => {
|
|||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
ipcRenderer.removeListener(GET_PICBEDS, getPicBeds)
|
ipcRenderer.removeListener(GET_PICBEDS, getPicBeds)
|
||||||
|
ipcRenderer.removeAllListeners(SHOW_MAIN_PAGE_QRCODE)
|
||||||
|
ipcRenderer.removeAllListeners(SHOW_MAIN_PAGE_DONATION)
|
||||||
|
ipcRenderer.removeAllListeners('updateProgress')
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -1641,6 +1641,8 @@ function stopRefreshDownloadTask () {
|
|||||||
refreshDownloadTaskId.value && clearInterval(refreshDownloadTaskId.value)
|
refreshDownloadTaskId.value && clearInterval(refreshDownloadTaskId.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 界面相关
|
||||||
|
|
||||||
function handleViewChange (val: 'list' | 'grid') {
|
function handleViewChange (val: 'list' | 'grid') {
|
||||||
saveConfig('settings.isShowList', val === 'list')
|
saveConfig('settings.isShowList', val === 'list')
|
||||||
layoutStyle.value = val
|
layoutStyle.value = val
|
||||||
|
@ -294,90 +294,89 @@ import { formatEndpoint } from '~/main/manage/utils/common'
|
|||||||
// 国际化函数
|
// 国际化函数
|
||||||
import { T as $T } from '@/i18n'
|
import { T as $T } from '@/i18n'
|
||||||
|
|
||||||
|
const manageStore = useManageStore()
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const isLoading = ref(false)
|
||||||
const activeName = ref('login')
|
const activeName = ref('login')
|
||||||
|
|
||||||
const configResult:IStringKeyMap = reactive({})
|
const configResult:IStringKeyMap = reactive({})
|
||||||
const existingConfiguration = reactive({} as IStringKeyMap)
|
const existingConfiguration = reactive({} as IStringKeyMap)
|
||||||
const dataForTable = reactive([] as any[])
|
const dataForTable = reactive([] as any[])
|
||||||
const allConfigAliasMap = reactive({} as IStringKeyMap)
|
const allConfigAliasMap = reactive({} as IStringKeyMap)
|
||||||
const router = useRouter()
|
const currentAliasList = reactive([] as string[])
|
||||||
const manageStore = useManageStore()
|
const rules = ruleMap(supportedPicBedList)
|
||||||
const isLoading = ref(false)
|
|
||||||
|
|
||||||
const sortedAllConfigAliasMap = computed(() => {
|
const sortedAllConfigAliasMap = computed(() => {
|
||||||
const sorted = Object.values(allConfigAliasMap).sort((a, b) => {
|
return Object.values(allConfigAliasMap).sort((a, b) => {
|
||||||
return a.picBedName.localeCompare(b.picBedName)
|
return a.picBedName.localeCompare(b.picBedName)
|
||||||
})
|
})
|
||||||
return sorted
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const currentAliasList = reactive([] as string[])
|
const importedNewConfig: IStringKeyMap = {}
|
||||||
|
|
||||||
const ruleMap = (options: IStringKeyMap) => {
|
function ruleMap (options: IStringKeyMap) {
|
||||||
const rule:any = {}
|
const rule:any = {}
|
||||||
Object.keys(options).forEach((key) => {
|
for (const key in options) {
|
||||||
const item = options[key].options
|
const { options: itemOptions, configOptions } = options[key]
|
||||||
item.forEach((option: string) => {
|
|
||||||
const keyName = key + '.' + option
|
for (const option of itemOptions) {
|
||||||
if (options[key].configOptions[option].rule) {
|
const keyName = `${key}.${option}`
|
||||||
rule[keyName] = options[key].configOptions[option].rule
|
const configOption = configOptions[option]
|
||||||
|
|
||||||
|
if (configOption.rule) {
|
||||||
|
rule[keyName] = configOption.rule
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configOption.default) {
|
||||||
|
configResult[keyName] = configOption.default
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (options[key].configOptions[option].default) {
|
|
||||||
configResult[keyName] = options[key].configOptions[option].default
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
})
|
|
||||||
return rule
|
return rule
|
||||||
}
|
}
|
||||||
|
|
||||||
const rules = ruleMap(supportedPicBedList)
|
function getDataForTable () {
|
||||||
|
|
||||||
const getDataForTable = () => {
|
|
||||||
for (const key in existingConfiguration) {
|
for (const key in existingConfiguration) {
|
||||||
const obj = {} as IStringKeyMap
|
dataForTable.push({ ...existingConfiguration[key] as IStringKeyMap })
|
||||||
for (const option in existingConfiguration[key]) {
|
|
||||||
obj[option] = existingConfiguration[key][option]
|
|
||||||
}
|
|
||||||
dataForTable.push(obj)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getExistingConfig = async (name:string) => {
|
async function getExistingConfig (name:string) {
|
||||||
if (name === 'login') {
|
if (name === 'login') {
|
||||||
getAllConfigAliasArray()
|
getAllConfigAliasArray()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
currentAliasList.length = 0
|
currentAliasList.length = 0
|
||||||
const result = await getConfig<any>('picBed')
|
const result = await getConfig<any>('picBed')
|
||||||
if (!result) {
|
|
||||||
existingConfiguration[name] = { fail: '暂无配置' }
|
|
||||||
}
|
|
||||||
for (const key in existingConfiguration) {
|
for (const key in existingConfiguration) {
|
||||||
delete existingConfiguration[key]
|
delete existingConfiguration[key]
|
||||||
}
|
}
|
||||||
|
if (!result || typeof result !== 'object' || Object.keys(result).length === 0) {
|
||||||
|
existingConfiguration[name] = { fail: '暂无配置' }
|
||||||
|
} else {
|
||||||
for (const key in result) {
|
for (const key in result) {
|
||||||
if (result[key].picBedName === name) {
|
if (result[key].picBedName === name) {
|
||||||
existingConfiguration[key] = result[key]
|
existingConfiguration[key] = result[key]
|
||||||
currentAliasList.push(key)
|
currentAliasList.push(key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dataForTable.length = 0
|
dataForTable.length = 0
|
||||||
getDataForTable()
|
getDataForTable()
|
||||||
handleConfigImport(currentAliasList[0])
|
handleConfigImport(currentAliasList[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
const getAliasList = () => {
|
function getAliasList () {
|
||||||
const aliasList = [] as string[]
|
return Object.values(existingConfiguration).map(item => item.alias)
|
||||||
for (const key in existingConfiguration) {
|
|
||||||
aliasList.push(existingConfiguration[key].alias)
|
|
||||||
}
|
|
||||||
return aliasList
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleConfigChange = async (name: string) => {
|
async function handleConfigChange (name: string) {
|
||||||
const aliasList = getAliasList()
|
const aliasList = getAliasList()
|
||||||
const allKeys = Object.keys(supportedPicBedList[name].configOptions)
|
const allKeys = Object.keys(supportedPicBedList[name].configOptions)
|
||||||
const resultMap:IStringKeyMap = {}
|
const resultMap:IStringKeyMap = {}
|
||||||
const reg = /^[\u4e00-\u9fa5_a-zA-Z0-9-]+$/
|
const reg = /^[\u4e00-\u9fff_a-zA-Z0-9-]+$/
|
||||||
for (const key of allKeys) {
|
for (const key of allKeys) {
|
||||||
const resultKey = name + '.' + key
|
const resultKey = name + '.' + key
|
||||||
if (supportedPicBedList[name].configOptions[key].required) {
|
if (supportedPicBedList[name].configOptions[key].required) {
|
||||||
@ -472,10 +471,14 @@ const handleConfigChange = async (name: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleConfigReset = (name: string) => {
|
const handleConfigReset = (name: string) => {
|
||||||
let keys = Object.keys(configResult)
|
const keys = Object.keys(configResult).filter((key) => key.startsWith(name))
|
||||||
keys = keys.filter((key) => key.startsWith(name))
|
|
||||||
keys.forEach((key) => {
|
keys.forEach((key) => {
|
||||||
configResult[key] = supportedPicBedList[name].configOptions[key.split('.')[1]].default || ''
|
const optionKey = key.split('.')[1]
|
||||||
|
const configOption = supportedPicBedList[name]?.configOptions?.[optionKey]
|
||||||
|
|
||||||
|
if (configOption) {
|
||||||
|
configResult[key] = configOption.default || ''
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,14 +519,12 @@ const getAllConfigAliasArray = async () => {
|
|||||||
delete allConfigAliasMap[key]
|
delete allConfigAliasMap[key]
|
||||||
}
|
}
|
||||||
if (!result) return
|
if (!result) return
|
||||||
let i = 0
|
Object.entries(result).forEach(([, value]: [string, any], index) => {
|
||||||
Object.keys(result).forEach((key) => {
|
allConfigAliasMap[index] = {
|
||||||
allConfigAliasMap[i] = {
|
alias: value.alias,
|
||||||
alias: result[key].alias,
|
picBedName: value.picBedName,
|
||||||
picBedName: result[key].picBedName,
|
config: value
|
||||||
config: result[key]
|
|
||||||
}
|
}
|
||||||
i++
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -552,30 +553,22 @@ const handleConfigClick = async (item: any) => {
|
|||||||
|
|
||||||
function handleConfigImport (alias: string) {
|
function handleConfigImport (alias: string) {
|
||||||
const selectedConfig = existingConfiguration[alias]
|
const selectedConfig = existingConfiguration[alias]
|
||||||
if (selectedConfig) {
|
if (!selectedConfig) return
|
||||||
supportedPicBedList[selectedConfig.picBedName].options.forEach((option: any) => {
|
|
||||||
|
supportedPicBedList[selectedConfig.picBedName].forEach((option: any) => {
|
||||||
if (selectedConfig[option] !== undefined) {
|
if (selectedConfig[option] !== undefined) {
|
||||||
configResult[selectedConfig.picBedName + '.' + option] = selectedConfig[option]
|
configResult[selectedConfig.picBedName + '.' + option] = selectedConfig[option]
|
||||||
}
|
}
|
||||||
if (typeof selectedConfig[option] === 'boolean') {
|
|
||||||
configResult[selectedConfig.picBedName + '.' + option] = selectedConfig[option]
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const importedNewConfig: IStringKeyMap = {}
|
|
||||||
|
|
||||||
async function getCurrentConfigList () {
|
async function getCurrentConfigList () {
|
||||||
const configList = await getPicBedsConfig<any>('uploader') ?? {}
|
const configList = await getPicBedsConfig<any>('uploader') ?? {}
|
||||||
const pbList = ['aliyun', 'tcyun', 'upyun', 'qiniu', 'smms', 'qiniu', 'github', 'webdavplist', 'aws-s3', 'imgur', 'local']
|
const pbList = ['aliyun', 'aws-s3', 'github', 'imgur', 'local', 'qiniu', 'smms', 'tcyun', 'upyun', 'webdavplist']
|
||||||
|
|
||||||
const filteredConfigList = pbList.flatMap((pb) => {
|
const filteredConfigList = pbList.flatMap((pb) => {
|
||||||
const config = configList[pb]
|
const config = configList[pb]
|
||||||
if (config && config.configList.length > 0) {
|
return config?.configList?.length ? config.configList.map((item: any) => ({ ...item, type: pb })) : []
|
||||||
return config.configList.map((item: any) => ({ ...item, type: pb }))
|
|
||||||
} else {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
await getAllConfigAliasArray()
|
await getAllConfigAliasArray()
|
||||||
const autoImport = await getPicBedsConfig<boolean>('settings.autoImport') || false
|
const autoImport = await getPicBedsConfig<boolean>('settings.autoImport') || false
|
||||||
|
@ -306,17 +306,22 @@ import { T as $T } from '@/i18n'
|
|||||||
const manageStore = useManageStore() as any
|
const manageStore = useManageStore() as any
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const currentAlias = ref(route.query.alias as string)
|
const currentAlias = ref(route.query.alias as string)
|
||||||
const currentPicBedName = ref(route.query.picBedName as string)
|
const currentPicBedName = ref(route.query.picBedName as string)
|
||||||
|
|
||||||
let allPicBedConfigure = JSON.parse(route.query.allPicBedConfigure as string)
|
let allPicBedConfigure = JSON.parse(route.query.allPicBedConfigure as string)
|
||||||
let currentPagePicBedConfig = reactive(JSON.parse(route.query.config as string))
|
let currentPagePicBedConfig = reactive(JSON.parse(route.query.config as string))
|
||||||
const picBedSwitchDialogVisible = ref(false)
|
|
||||||
const newBucketConfigResult: IStringKeyMap = reactive({})
|
const newBucketConfigResult: IStringKeyMap = reactive({})
|
||||||
const bucketList = ref({} as IStringKeyMap)
|
const bucketList = ref({} as IStringKeyMap)
|
||||||
const currentSelectedBucket = ref('')
|
const currentSelectedBucket = ref('')
|
||||||
const isLoadingBucketList = ref(false)
|
|
||||||
const bucketNameList = ref([] as string[])
|
const bucketNameList = ref([] as string[])
|
||||||
|
|
||||||
|
const isLoadingBucketList = ref(false)
|
||||||
|
const nweBucketDrawerVisible = ref(false)
|
||||||
|
const picBedSwitchDialogVisible = ref(false)
|
||||||
|
|
||||||
watch(route, async (newRoute) => {
|
watch(route, async (newRoute) => {
|
||||||
if (newRoute.fullPath.split('?')[0] === '/main-page/manage-main-page') {
|
if (newRoute.fullPath.split('?')[0] === '/main-page/manage-main-page') {
|
||||||
currentAlias.value = newRoute.query.alias as string
|
currentAlias.value = newRoute.query.alias as string
|
||||||
@ -342,53 +347,66 @@ const urlMap : IStringKeyMap = {
|
|||||||
local: 'https://piclist.cn'
|
local: 'https://piclist.cn'
|
||||||
}
|
}
|
||||||
|
|
||||||
const openPicBedUrl = () => shell.openExternal(urlMap[currentPagePicBedConfig.picBedName])
|
const showNewIconList = ['aliyun', 'qiniu', 'tcyun']
|
||||||
|
|
||||||
const ruleMap = (options: IStringKeyMap) => {
|
const bucketT = $T('MANAGE_MAIN_PAGE_BUCKET')
|
||||||
const rule: IStringKeyMap = {}
|
const galleryT = $T('MANAGE_MAIN_PAGE_GALLERY')
|
||||||
Object.keys(options).forEach((key) => {
|
const repositoryT = $T('MANAGE_MAIN_PAGE_REPOSITORY')
|
||||||
const item = options[key].options
|
|
||||||
item.forEach((option: string) => {
|
const menuTitleMap:IStringKeyMap = {
|
||||||
const keyName = `${key}.${option}`
|
aliyun: bucketT,
|
||||||
if (options[key].configOptions[option].rule) {
|
qiniu: bucketT,
|
||||||
rule[keyName] = options[key].configOptions[option].rule
|
tcyun: bucketT,
|
||||||
}
|
upyun: bucketT,
|
||||||
if (options[key].configOptions[option].default) {
|
s3plist: bucketT,
|
||||||
newBucketConfigResult[keyName] = options[key].configOptions[option].default
|
smms: galleryT,
|
||||||
}
|
imgur: galleryT,
|
||||||
})
|
github: repositoryT,
|
||||||
})
|
webdavplist: '',
|
||||||
return rule
|
local: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
const rules = ruleMap(newBucketConfig)
|
const rules = ruleMap(newBucketConfig)
|
||||||
|
|
||||||
const openNewBucketDrawer = () => {
|
const openPicBedUrl = () => shell.openExternal(urlMap[currentPagePicBedConfig.picBedName])
|
||||||
|
|
||||||
|
function ruleMap (options: IStringKeyMap) {
|
||||||
|
return Object.keys(options).reduce((result, key) => {
|
||||||
|
options[key].options.forEach((option: string) => {
|
||||||
|
const keyName = `${key}.${option}`
|
||||||
|
const configOption = options[key].configOptions[option]
|
||||||
|
if (configOption.rule) {
|
||||||
|
result[keyName] = configOption.rule
|
||||||
|
}
|
||||||
|
if (configOption.default) {
|
||||||
|
newBucketConfigResult[keyName] = configOption.default
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
}, {} as IStringKeyMap)
|
||||||
|
}
|
||||||
|
|
||||||
|
function openNewBucketDrawer () {
|
||||||
nweBucketDrawerVisible.value = true
|
nweBucketDrawerVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const createNewBucket = (picBedName: string) => {
|
function createNewBucket (picBedName: string) {
|
||||||
const allKeys = Object.keys(newBucketConfig[picBedName].configOptions)
|
const configOptions = newBucketConfig[picBedName].configOptions
|
||||||
const resultMap: IStringKeyMap = {}
|
const resultMap: IStringKeyMap = Object.keys(configOptions).reduce((result, key) => {
|
||||||
for (const key of allKeys) {
|
|
||||||
const resultKey = `${picBedName}.${key}`
|
const resultKey = `${picBedName}.${key}`
|
||||||
if (newBucketConfig[picBedName].configOptions[key].default !== undefined && newBucketConfigResult[resultKey] === '') {
|
const defaultValue = configOptions[key].default
|
||||||
resultMap[key] = newBucketConfig[picBedName].configOptions[key].default
|
const resultValue = newBucketConfigResult[resultKey]
|
||||||
} else if (newBucketConfigResult[resultKey] === undefined) {
|
|
||||||
if (newBucketConfig[picBedName].configOptions[key].default !== undefined) {
|
result[key] = resultValue === '' && defaultValue !== undefined
|
||||||
resultMap[key] = newBucketConfig[picBedName].configOptions[key].default
|
? defaultValue
|
||||||
} else {
|
: resultValue === undefined ? defaultValue ?? '' : resultValue
|
||||||
resultMap[key] = ''
|
|
||||||
}
|
return result
|
||||||
} else {
|
}, {} as IStringKeyMap)
|
||||||
resultMap[key] = newBucketConfigResult[resultKey]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (currentPicBedName.value === 'tcyun') {
|
if (currentPicBedName.value === 'tcyun') {
|
||||||
resultMap.BucketName = resultMap.BucketName + '-' + currentPagePicBedConfig.appId
|
resultMap.BucketName = `${resultMap.BucketName}-${currentPagePicBedConfig.appId}`
|
||||||
}
|
}
|
||||||
const res = invokeToMain('createBucket', currentAlias, resultMap)
|
invokeToMain('createBucket', currentAlias, resultMap).then((result: any) => {
|
||||||
res.then((result: any) => {
|
|
||||||
if (result) {
|
if (result) {
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: $T('MANAGE_MAIN_PAGE_TIPS'),
|
title: $T('MANAGE_MAIN_PAGE_TIPS'),
|
||||||
@ -409,12 +427,14 @@ const createNewBucket = (picBedName: string) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const getBucketList = async () => {
|
async function getBucketList () {
|
||||||
bucketList.value = {}
|
bucketList.value = {}
|
||||||
bucketNameList.value = []
|
bucketNameList.value = []
|
||||||
isLoadingBucketList.value = true
|
isLoadingBucketList.value = true
|
||||||
|
|
||||||
const result = await invokeToMain('getBucketList', currentAlias.value)
|
const result = await invokeToMain('getBucketList', currentAlias.value)
|
||||||
isLoadingBucketList.value = false
|
isLoadingBucketList.value = false
|
||||||
|
|
||||||
if (result.length > 0) {
|
if (result.length > 0) {
|
||||||
result.forEach((item: any) => {
|
result.forEach((item: any) => {
|
||||||
bucketList.value[item.Name] = item
|
bucketList.value[item.Name] = item
|
||||||
@ -423,33 +443,27 @@ const getBucketList = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSelectMenu = (bucketName: string) => {
|
function handleSelectMenu (bucketName: string) {
|
||||||
const transformedConfig = JSON.parse(manageStore.config.picBed[currentAlias.value].transformedConfig ?? '{}')
|
const currentPicBedConfig = manageStore.config.picBed[currentAlias.value]
|
||||||
let prefix = transformedConfig[bucketName]?.baseDir
|
const transformedConfig = JSON.parse(currentPicBedConfig.transformedConfig ?? '{}')
|
||||||
if (prefix === '' || prefix === undefined) {
|
|
||||||
prefix = '/'
|
let prefix = transformedConfig[bucketName]?.baseDir || '/'
|
||||||
} else {
|
prefix = prefix.startsWith('/') ? prefix : `/${prefix}`
|
||||||
!prefix.startsWith('/') && (prefix = `/${prefix}`)
|
prefix = prefix.endsWith('/') ? prefix : `${prefix}/`
|
||||||
!prefix.endsWith('/') && (prefix = `${prefix}/`)
|
|
||||||
}
|
|
||||||
const customUrl = transformedConfig[bucketName]?.customUrl ?? ''
|
|
||||||
const picBedName = manageStore.config.picBed[currentAlias.value].picBedName ?? currentPicBedName.value
|
|
||||||
const alias = currentAlias.value
|
|
||||||
const cdnUrl = manageStore.config.picBed[currentAlias.value].customUrl
|
|
||||||
const bucketConfig = bucketList.value[bucketName]
|
|
||||||
const webPath = manageStore.config.picBed[currentAlias.value].webPath || ''
|
|
||||||
const configMap = {
|
const configMap = {
|
||||||
prefix,
|
prefix,
|
||||||
bucketName,
|
bucketName,
|
||||||
customUrl,
|
customUrl: transformedConfig[bucketName]?.customUrl ?? '',
|
||||||
picBedName,
|
picBedName: currentPicBedConfig.picBedName ?? currentPicBedName.value,
|
||||||
alias,
|
alias: currentAlias.value,
|
||||||
bucketConfig,
|
bucketConfig: bucketList.value[bucketName],
|
||||||
cdnUrl,
|
cdnUrl: currentPicBedConfig.customUrl,
|
||||||
baseDir: prefix,
|
baseDir: prefix,
|
||||||
webPath
|
webPath: currentPicBedConfig.webPath || ''
|
||||||
}
|
}
|
||||||
currentSelectedBucket.value = bucketName
|
currentSelectedBucket.value = bucketName
|
||||||
|
|
||||||
router.push({
|
router.push({
|
||||||
path: '/main-page/manage-main-page/manage-bucket-page',
|
path: '/main-page/manage-main-page/manage-bucket-page',
|
||||||
query: {
|
query: {
|
||||||
@ -458,33 +472,12 @@ const handleSelectMenu = (bucketName: string) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const nweBucketDrawerVisible = ref(false)
|
|
||||||
|
|
||||||
const bucketT = $T('MANAGE_MAIN_PAGE_BUCKET')
|
|
||||||
const galleryT = $T('MANAGE_MAIN_PAGE_GALLERY')
|
|
||||||
const repositoryT = $T('MANAGE_MAIN_PAGE_REPOSITORY')
|
|
||||||
|
|
||||||
const menuTitleMap:IStringKeyMap = {
|
|
||||||
aliyun: bucketT,
|
|
||||||
qiniu: bucketT,
|
|
||||||
tcyun: bucketT,
|
|
||||||
upyun: bucketT,
|
|
||||||
s3plist: bucketT,
|
|
||||||
smms: galleryT,
|
|
||||||
imgur: galleryT,
|
|
||||||
github: repositoryT,
|
|
||||||
webdavplist: '',
|
|
||||||
local: ''
|
|
||||||
}
|
|
||||||
|
|
||||||
const showNewIconList = ['aliyun', 'qiniu', 'tcyun']
|
|
||||||
|
|
||||||
function switchPicBed (picBedAlias:string) {
|
function switchPicBed (picBedAlias:string) {
|
||||||
if (picBedAlias === 'main') {
|
if (picBedAlias === 'main') {
|
||||||
router.push({
|
router.push({
|
||||||
path: '/main-page/manage-login-page'
|
path: '/main-page/manage-login-page'
|
||||||
})
|
})
|
||||||
} else {
|
}
|
||||||
if (route.fullPath.startsWith('/main-page/manage-main-page/manage-bucket-page') || route.fullPath.startsWith('/main-page/manage-main-page/manage-setting-page')
|
if (route.fullPath.startsWith('/main-page/manage-main-page/manage-bucket-page') || route.fullPath.startsWith('/main-page/manage-main-page/manage-setting-page')
|
||||||
) {
|
) {
|
||||||
picBedSwitchDialogVisible.value = false
|
picBedSwitchDialogVisible.value = false
|
||||||
@ -497,7 +490,7 @@ function switchPicBed (picBedAlias:string) {
|
|||||||
allPicBedConfigure: JSON.stringify(allPicBedConfigure)
|
allPicBedConfigure: JSON.stringify(allPicBedConfigure)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
}
|
||||||
currentAlias.value = picBedAlias
|
currentAlias.value = picBedAlias
|
||||||
currentPicBedName.value = allPicBedConfigure[picBedAlias].picBedName
|
currentPicBedName.value = allPicBedConfigure[picBedAlias].picBedName
|
||||||
currentPagePicBedConfig = allPicBedConfigure[picBedAlias]
|
currentPagePicBedConfig = allPicBedConfigure[picBedAlias]
|
||||||
@ -505,14 +498,12 @@ function switchPicBed (picBedAlias:string) {
|
|||||||
currentSelectedBucket.value = ''
|
currentSelectedBucket.value = ''
|
||||||
getBucketList()
|
getBucketList()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const changePicBed = () => {
|
function changePicBed () {
|
||||||
picBedSwitchDialogVisible.value = true
|
picBedSwitchDialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const openBucketPageSetting = () => {
|
function openBucketPageSetting () {
|
||||||
router.push({
|
router.push({
|
||||||
path: '/main-page/manage-main-page/manage-setting-page'
|
path: '/main-page/manage-main-page/manage-setting-page'
|
||||||
})
|
})
|
||||||
|
@ -612,21 +612,21 @@ async function initData () {
|
|||||||
form.timestampRename = config.settings.timestampRename ?? false
|
form.timestampRename = config.settings.timestampRename ?? false
|
||||||
form.randomStringRename = config.settings.randomStringRename ?? false
|
form.randomStringRename = config.settings.randomStringRename ?? false
|
||||||
form.customRename = config.settings.customRename ?? false
|
form.customRename = config.settings.customRename ?? false
|
||||||
customRenameFormat.value = config.settings.customRenameFormat ?? '{filename}'
|
|
||||||
customPasteFormat.value = config.settings.customPasteFormat ?? '$url'
|
|
||||||
pasteFormat.value = config.settings.pasteFormat ?? 'markdown'
|
|
||||||
downloadDir.value = config.settings.downloadDir ?? ''
|
|
||||||
form.isAutoRefresh = config.settings.isAutoRefresh ?? false
|
form.isAutoRefresh = config.settings.isAutoRefresh ?? false
|
||||||
form.isShowThumbnail = config.settings.isShowThumbnail ?? false
|
form.isShowThumbnail = config.settings.isShowThumbnail ?? false
|
||||||
form.isShowList = config.settings.isShowList ?? false
|
form.isShowList = config.settings.isShowList ?? false
|
||||||
form.isIgnoreCase = config.settings.isIgnoreCase ?? false
|
form.isIgnoreCase = config.settings.isIgnoreCase ?? false
|
||||||
form.isForceCustomUrlHttps = config.settings.isForceCustomUrlHttps ?? true
|
form.isForceCustomUrlHttps = config.settings.isForceCustomUrlHttps ?? true
|
||||||
form.isEncodeUrl = config.settings.isEncodeUrl ?? false
|
form.isEncodeUrl = config.settings.isEncodeUrl ?? false
|
||||||
PreSignedExpire.value = config.settings.PreSignedExpire ?? 14400
|
|
||||||
maxDownloadFileCount.value = config.settings.maxDownloadFileCount ?? 5
|
|
||||||
form.isUploadKeepDirStructure = config.settings.isUploadKeepDirStructure ?? true
|
form.isUploadKeepDirStructure = config.settings.isUploadKeepDirStructure ?? true
|
||||||
form.isDownloadFileKeepDirStructure = config.settings.isDownloadKeepDirStructure ?? false
|
form.isDownloadFileKeepDirStructure = config.settings.isDownloadKeepDirStructure ?? false
|
||||||
form.isDownloadFolderKeepDirStructure = config.settings.isDownloadFolderKeepDirStructure ?? true
|
form.isDownloadFolderKeepDirStructure = config.settings.isDownloadFolderKeepDirStructure ?? true
|
||||||
|
PreSignedExpire.value = config.settings.PreSignedExpire ?? 14400
|
||||||
|
maxDownloadFileCount.value = config.settings.maxDownloadFileCount ?? 5
|
||||||
|
customRenameFormat.value = config.settings.customRenameFormat ?? '{filename}'
|
||||||
|
customPasteFormat.value = config.settings.customPasteFormat ?? '$url'
|
||||||
|
pasteFormat.value = config.settings.pasteFormat ?? 'markdown'
|
||||||
|
downloadDir.value = config.settings.downloadDir ?? ''
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleDownloadDirClick () {
|
async function handleDownloadDirClick () {
|
||||||
|
@ -19,37 +19,38 @@ export interface IFileCache {
|
|||||||
* new picbed will add a plist suffix to distinguish from picgo
|
* new picbed will add a plist suffix to distinguish from picgo
|
||||||
*/
|
*/
|
||||||
export class FileCacheDb extends Dexie {
|
export class FileCacheDb extends Dexie {
|
||||||
tcyun: Table<IFileCache, string>
|
|
||||||
aliyun: Table<IFileCache, string>
|
aliyun: Table<IFileCache, string>
|
||||||
qiniu: Table<IFileCache, string>
|
|
||||||
github: Table<IFileCache, string>
|
github: Table<IFileCache, string>
|
||||||
smms: Table<IFileCache, string>
|
|
||||||
upyun: Table<IFileCache, string>
|
|
||||||
imgur: Table<IFileCache, string>
|
imgur: Table<IFileCache, string>
|
||||||
s3plist: Table<IFileCache, string>
|
|
||||||
webdavplist: Table<IFileCache, string>
|
|
||||||
local: Table<IFileCache, string>
|
local: Table<IFileCache, string>
|
||||||
|
tcyun: Table<IFileCache, string>
|
||||||
|
qiniu: Table<IFileCache, string>
|
||||||
|
smms: Table<IFileCache, string>
|
||||||
|
s3plist: Table<IFileCache, string>
|
||||||
sftpplist: Table<IFileCache, string>
|
sftpplist: Table<IFileCache, string>
|
||||||
|
upyun: Table<IFileCache, string>
|
||||||
|
webdavplist: Table<IFileCache, string>
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
super('bucketFileDb')
|
super('bucketFileDb')
|
||||||
const tableNames = ['tcyun', 'aliyun', 'qiniu', 'github', 'smms', 'upyun', 'imgur', 's3plist', 'webdavplist', 'local', 'sftpplist']
|
const tableNames = ['aliyun', 'github', 'imgur', 'local', 'qiniu', 's3plist', 'sftpplist', 'smms', 'tcyun', 'upyun', 'webdavplist']
|
||||||
|
|
||||||
const tableNamesMap = tableNames.reduce((acc, cur) => {
|
const tableNamesMap = tableNames.reduce((acc, cur) => {
|
||||||
acc[cur] = '&key, value'
|
acc[cur] = '&key, value'
|
||||||
return acc
|
return acc
|
||||||
}, {} as IStringKeyMap)
|
}, {} as IStringKeyMap)
|
||||||
this.version(4).stores(tableNamesMap)
|
this.version(4).stores(tableNamesMap)
|
||||||
this.tcyun = this.table('tcyun')
|
|
||||||
this.aliyun = this.table('aliyun')
|
this.aliyun = this.table('aliyun')
|
||||||
this.qiniu = this.table('qiniu')
|
|
||||||
this.github = this.table('github')
|
this.github = this.table('github')
|
||||||
|
this.imgur = this.table('imgur')
|
||||||
|
this.local = this.table('local')
|
||||||
|
this.qiniu = this.table('qiniu')
|
||||||
|
this.tcyun = this.table('tcyun')
|
||||||
|
this.s3plist = this.table('s3plist')
|
||||||
|
this.sftpplist = this.table('sftpplist')
|
||||||
this.smms = this.table('smms')
|
this.smms = this.table('smms')
|
||||||
this.upyun = this.table('upyun')
|
this.upyun = this.table('upyun')
|
||||||
this.imgur = this.table('imgur')
|
|
||||||
this.s3plist = this.table('s3plist')
|
|
||||||
this.webdavplist = this.table('webdavplist')
|
this.webdavplist = this.table('webdavplist')
|
||||||
this.local = this.table('local')
|
|
||||||
this.sftpplist = this.table('sftpplist')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1479,6 +1479,7 @@ import pkg from 'root/package.json'
|
|||||||
|
|
||||||
// 事件常量
|
// 事件常量
|
||||||
import { PICGO_OPEN_FILE, OPEN_URL, GET_PICBEDS, HIDE_DOCK } from '#/events/constants'
|
import { PICGO_OPEN_FILE, OPEN_URL, GET_PICBEDS, HIDE_DOCK } from '#/events/constants'
|
||||||
|
import { IRPCActionType } from '~/universal/types/enum'
|
||||||
|
|
||||||
// Electron 相关
|
// Electron 相关
|
||||||
import {
|
import {
|
||||||
@ -1492,13 +1493,12 @@ import { i18nManager, T as $T } from '@/i18n/index'
|
|||||||
import { enforceNumber } from '~/universal/utils/common'
|
import { enforceNumber } from '~/universal/utils/common'
|
||||||
import { getLatestVersion } from '#/utils/getLatestVersion'
|
import { getLatestVersion } from '#/utils/getLatestVersion'
|
||||||
import { compare } from 'compare-versions'
|
import { compare } from 'compare-versions'
|
||||||
import { STABLE_RELEASE_URL } from '#/utils/static'
|
|
||||||
|
|
||||||
// Vue 相关
|
// Vue 相关
|
||||||
import { computed, onBeforeMount, onBeforeUnmount, reactive, ref, toRaw } from 'vue'
|
import { computed, onBeforeMount, onBeforeUnmount, reactive, ref, toRaw } from 'vue'
|
||||||
|
|
||||||
// 数据发送工具函数
|
// 数据发送工具函数
|
||||||
import { getConfig, saveConfig, sendToMain } from '@/utils/dataSender'
|
import { getConfig, saveConfig, sendRPC, sendToMain } from '@/utils/dataSender'
|
||||||
|
|
||||||
// Vue Router 相关
|
// Vue Router 相关
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
@ -2049,7 +2049,7 @@ async function checkUpdate () {
|
|||||||
|
|
||||||
function confirmCheckVersion () {
|
function confirmCheckVersion () {
|
||||||
if (needUpdate.value) {
|
if (needUpdate.value) {
|
||||||
sendToMain(OPEN_URL, STABLE_RELEASE_URL)
|
sendRPC(IRPCActionType.RELOAD_APP)
|
||||||
}
|
}
|
||||||
checkUpdateVisible.value = false
|
checkUpdateVisible.value = false
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,9 @@ import { isReactive, isRef, toRaw, unref } from 'vue'
|
|||||||
* get raw data from reactive or ref
|
* get raw data from reactive or ref
|
||||||
*/
|
*/
|
||||||
export const getRawData = (args: any): any => {
|
export const getRawData = (args: any): any => {
|
||||||
if (isRef(args)) {
|
if (isRef(args)) return unref(args)
|
||||||
return unref(args)
|
if (isReactive(args)) return toRaw(args)
|
||||||
}
|
if (Array.isArray(args)) return args.map(getRawData)
|
||||||
if (isReactive(args)) {
|
|
||||||
return toRaw(args)
|
|
||||||
}
|
|
||||||
if (Array.isArray(args)) {
|
|
||||||
return args.map(getRawData)
|
|
||||||
}
|
|
||||||
if (typeof args === 'object' && args !== null) {
|
if (typeof args === 'object' && args !== null) {
|
||||||
const data = {} as Record<string, any>
|
const data = {} as Record<string, any>
|
||||||
for (const key in args) {
|
for (const key in args) {
|
||||||
|
@ -117,7 +117,8 @@ const config = {
|
|||||||
linux: {
|
linux: {
|
||||||
icon: 'build/icons/',
|
icon: 'build/icons/',
|
||||||
asarUnpack: [
|
asarUnpack: [
|
||||||
'**/node_modules/sharp/**'
|
'**/node_modules/sharp/**',
|
||||||
|
'**/node_modules/ssh2-no-cpu-features/**'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
snap: {
|
snap: {
|
||||||
|
Loading…
Reference in New Issue
Block a user