mirror of
https://github.com/Molunerfinn/PicGo.git
synced 2024-04-21 10:31:33 +00:00
@@ -574,6 +574,3 @@
|
||||
### :package: Chore
|
||||
|
||||
* add picgo bump-version ([37f1d34](https://github.com/Molunerfinn/PicGo/commit/37f1d34))
|
||||
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
"postuninstall": "electron-builder install-app-deps",
|
||||
"release": "vue-cli-service electron:build --publish always",
|
||||
"upload-dist": "node ./scripts/upload-dist-to-cos.js"
|
||||
"upload-dist": "node ./scripts/upload-dist.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.0.10",
|
||||
|
||||
+28
-28
@@ -114,13 +114,14 @@ SETTINGS_NOT_CONFIG_OPTIONS: Not Config Options
|
||||
SETTINGS_USE_BUILTIN_CLIPBOARD_UPLOAD: Use Builtin Clipboard to Upload
|
||||
SETTINGS_CHOOSE_LANGUAGE: Choose Language
|
||||
UPLOADER_CONFIG_NAME: Configuration Name
|
||||
BUILTIN_CLIPBOARD_TIPS: Use builtin clipboard function to upload instead of using scripts
|
||||
UPLOADER_CONFIG_PLACEHOLDER: Please Enter Configuration Name
|
||||
SELECTED_SETTING_HINT: Selected
|
||||
SETTINGS_ENCODE_OUTPUT_URL: Encode Output(or Copyed) URL
|
||||
SETTINGS_SHOW_DOCK_ICON: Show Dock icon
|
||||
|
||||
# shortcut-page
|
||||
|
||||
BUILTIN_CLIPBOARD_TIPS: Use builtin clipboard function to upload instead of using scripts
|
||||
SHORTCUT_NAME: Shortcut Name
|
||||
SHORTCUT_BIND: Shortcut Binding
|
||||
SHORTCUT_STATUS: Status
|
||||
@@ -161,33 +162,6 @@ PLUGIN_DOING_SOMETHING: Doing...
|
||||
PLUGIN_LIST: Plugin List
|
||||
PLUGIN_IMPORT_LOCAL: Import Local Plugins
|
||||
|
||||
# toolbox
|
||||
TOOLBOX: Toolbox
|
||||
TOOLBOX_TITLE: Troubleshoot PicGo runtime issues
|
||||
TOOLBOX_SUB_TITLE: Scan the following items immediately to fix usage issues
|
||||
TOOLBOX_CHECK_CONFIG_FILE_BROKEN: Check if the configuration file is damaged
|
||||
TOOLBOX_CHECK_GALLERY_FILE_BROKEN: Check if the album file is damaged
|
||||
TOOLBOX_CHECK_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD: Check if there is a problem with clipboard picture upload
|
||||
TOOLBOX_CHECK_PROBLEM_WITH_PROXY: Check if the proxy settings are normal
|
||||
TOOLBOX_FIX_DONE_NEED_RELOAD: Repair completed, need to restart to take effect, restart or not
|
||||
TOOLBOX_CANT_AUTO_FIX: Unable to automatically repair, please repair the following problems yourself
|
||||
TOOLBOX_START_SCAN: Start scanning
|
||||
TOOLBOX_RE_SCAN: Re scanning
|
||||
TOOLBOX_START_FIX: Start fixing
|
||||
TOOLBOX_SUCCESS_TIPS: Congratulations, no problems were found
|
||||
TOOLBOX_CHECK_CONFIG_FILE_PATH_TIPS: "The configuration file path is: ${path}"
|
||||
TOOLBOX_CHECK_CONFIG_FILE_BROKEN_TIPS: The configuration file is damaged
|
||||
TOOLBOX_CHECK_GALLERY_FILE_PATH_TIPS: "The album file path is: ${path}"
|
||||
TOOLBOX_CHECK_GALLERY_FILE_BROKEN_TIPS: The album file is damaged
|
||||
TOOLBOX_CHECK_PROXY_SUCCESS_TIPS: Proxy settings normal
|
||||
TOOLBOX_CHECK_PROXY_NO_PROXY_TIPS: No proxy settings
|
||||
TOOLBOX_CHECK_PROXY_PROXY_IS_NOT_CORRECT: Proxy settings incorrect
|
||||
TOOLBOX_CHECK_PROXY_PROXY_IS_NOT_WORKING: Proxy settings unavailable
|
||||
TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_TIPS: "The temporary folder path for clipboard pictures is: ${path}"
|
||||
TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_NOT_EXIST_TIPS: "The temporary folder for clipboard pictures does not exist: ${path}"
|
||||
TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_ERROR_TIPS: "Please create the folder yourself: ${path}"
|
||||
|
||||
|
||||
# tips
|
||||
|
||||
TIPS_REMOVE_LINK: This operation will remove the picture from the album, continue?
|
||||
@@ -217,6 +191,32 @@ DISABLE_PLUGIN: Disable Plugin
|
||||
UNINSTALL_PLUGIN: Uninstall Plugin
|
||||
UPDATE_PLUGIN: Update Plugin
|
||||
|
||||
# toolbox
|
||||
TOOLBOX: Toolbox
|
||||
TOOLBOX_TITLE: Troubleshoot PicGo runtime issues
|
||||
TOOLBOX_SUB_TITLE: Scan the following items immediately to fix usage issues
|
||||
TOOLBOX_CHECK_CONFIG_FILE_BROKEN: Check if the configuration file is damaged
|
||||
TOOLBOX_CHECK_GALLERY_FILE_BROKEN: Check if the album file is damaged
|
||||
TOOLBOX_CHECK_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD: Check if there is a problem with clipboard picture upload
|
||||
TOOLBOX_CHECK_PROBLEM_WITH_PROXY: Check if the proxy settings are normal
|
||||
TOOLBOX_FIX_DONE_NEED_RELOAD: Repair completed, need to restart to take effect, restart or not
|
||||
TOOLBOX_CANT_AUTO_FIX: Unable to automatically repair, please repair the following problems yourself
|
||||
TOOLBOX_START_SCAN: Start scanning
|
||||
TOOLBOX_RE_SCAN: Re scanning
|
||||
TOOLBOX_START_FIX: Start fixing
|
||||
TOOLBOX_SUCCESS_TIPS: Congratulations, no problems were found
|
||||
TOOLBOX_CHECK_CONFIG_FILE_PATH_TIPS: "The configuration file path is: ${path}"
|
||||
TOOLBOX_CHECK_CONFIG_FILE_BROKEN_TIPS: The configuration file is damaged
|
||||
TOOLBOX_CHECK_GALLERY_FILE_PATH_TIPS: "The album file path is: ${path}"
|
||||
TOOLBOX_CHECK_GALLERY_FILE_BROKEN_TIPS: The album file is damaged
|
||||
TOOLBOX_CHECK_PROXY_SUCCESS_TIPS: Proxy settings normal
|
||||
TOOLBOX_CHECK_PROXY_NO_PROXY_TIPS: No proxy settings
|
||||
TOOLBOX_CHECK_PROXY_PROXY_IS_NOT_CORRECT: Proxy settings incorrect
|
||||
TOOLBOX_CHECK_PROXY_PROXY_IS_NOT_WORKING: Proxy settings unavailable
|
||||
TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_TIPS: "The temporary folder path for clipboard pictures is: ${path}"
|
||||
TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_NOT_EXIST_TIPS: "The temporary folder for clipboard pictures does not exist: ${path}"
|
||||
TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_ERROR_TIPS: "Please create the folder yourself: ${path}"
|
||||
|
||||
# tips
|
||||
TIPS_NOTICE: Tips
|
||||
TIPS_WARNING: Warning
|
||||
|
||||
@@ -118,6 +118,7 @@ UPLOADER_CONFIG_NAME: 图床配置名
|
||||
UPLOADER_CONFIG_PLACEHOLDER: 请输入配置名称
|
||||
SELECTED_SETTING_HINT: 已选中
|
||||
SETTINGS_ENCODE_OUTPUT_URL: 输出(复制) URL 时进行转义
|
||||
SETTINGS_SHOW_DOCK_ICON: 显示 Dock 栏图标
|
||||
|
||||
# shortcut-page
|
||||
|
||||
|
||||
+27
-27
@@ -118,6 +118,7 @@ UPLOADER_CONFIG_NAME: 圖床配置名
|
||||
UPLOADER_CONFIG_PLACEHOLDER: 請輸入配置名稱
|
||||
SELECTED_SETTING_HINT: 已選中
|
||||
SETTINGS_ENCODE_OUTPUT_URL: 輸出(複製) URL 時進行轉義
|
||||
SETTINGS_SHOW_DOCK_ICON: 顯示 Dock 欄圖示
|
||||
|
||||
# shortcut-page
|
||||
|
||||
@@ -161,33 +162,6 @@ PLUGIN_DOING_SOMETHING: 進行中
|
||||
PLUGIN_LIST: 插件列表
|
||||
PLUGIN_IMPORT_LOCAL: 導入本地插件
|
||||
|
||||
# toolbox
|
||||
TOOLBOX: 工具箱
|
||||
TOOLBOX_TITLE: 排查 PicGo 執行時問題
|
||||
TOOLBOX_SUB_TITLE: 立即掃描以下項目,修復使用問題
|
||||
TOOLBOX_CHECK_CONFIG_FILE_BROKEN: 檢查配置文件是否損壞
|
||||
TOOLBOX_CHECK_GALLERY_FILE_BROKEN: 檢查相冊文件是否損壞
|
||||
TOOLBOX_CHECK_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD: 檢查剪貼板圖片上傳是否存在問題
|
||||
TOOLBOX_CHECK_PROBLEM_WITH_PROXY: 檢查代理設置是否正常
|
||||
TOOLBOX_FIX_DONE_NEED_RELOAD: 修復完成,需要重啓生效,是否重啓
|
||||
TOOLBOX_CANT_AUTO_FIX: 無法自動修復,請自行修復以下問題
|
||||
TOOLBOX_START_SCAN: 開始掃描
|
||||
TOOLBOX_RE_SCAN: 重新掃描
|
||||
TOOLBOX_START_FIX: 開始修復
|
||||
TOOLBOX_SUCCESS_TIPS: 恭喜你,沒有檢查出問題
|
||||
TOOLBOX_CHECK_CONFIG_FILE_PATH_TIPS: 配置文件路徑是:${path}
|
||||
TOOLBOX_CHECK_CONFIG_FILE_BROKEN_TIPS: 配置文件已損壞
|
||||
TOOLBOX_CHECK_GALLERY_FILE_PATH_TIPS: 相冊文件路徑是:${path}
|
||||
TOOLBOX_CHECK_GALLERY_FILE_BROKEN_TIPS: 相冊文件已損壞
|
||||
TOOLBOX_CHECK_PROXY_SUCCESS_TIPS: 代理設置正常
|
||||
TOOLBOX_CHECK_PROXY_NO_PROXY_TIPS: 無代理設置
|
||||
TOOLBOX_CHECK_PROXY_PROXY_IS_NOT_CORRECT: 代理設置不正確
|
||||
TOOLBOX_CHECK_PROXY_PROXY_IS_NOT_WORKING: 代理設置不可用
|
||||
TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_TIPS: 剪貼板圖片臨時文件夾路徑是:${path}
|
||||
TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_NOT_EXIST_TIPS: 剪貼板圖片臨時文件夾不存在:${path}
|
||||
TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_ERROR_TIPS: 請自行創建文件夾:${path}
|
||||
|
||||
|
||||
# tips
|
||||
|
||||
TIPS_REMOVE_LINK: 此操作將在相簿中移除該圖片,是否繼續?
|
||||
@@ -217,6 +191,32 @@ DISABLE_PLUGIN: 禁用插件
|
||||
UNINSTALL_PLUGIN: 卸載插件
|
||||
UPDATE_PLUGIN: 更新插件
|
||||
|
||||
# toolbox
|
||||
TOOLBOX: 工具箱
|
||||
TOOLBOX_TITLE: 排查 PicGo 執行時問題
|
||||
TOOLBOX_SUB_TITLE: 立即掃描以下項目,修復使用問題
|
||||
TOOLBOX_CHECK_CONFIG_FILE_BROKEN: 檢查配置文件是否損壞
|
||||
TOOLBOX_CHECK_GALLERY_FILE_BROKEN: 檢查相冊文件是否損壞
|
||||
TOOLBOX_CHECK_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD: 檢查剪貼板圖片上傳是否存在問題
|
||||
TOOLBOX_CHECK_PROBLEM_WITH_PROXY: 檢查代理設置是否正常
|
||||
TOOLBOX_FIX_DONE_NEED_RELOAD: 修復完成,需要重啓生效,是否重啓
|
||||
TOOLBOX_CANT_AUTO_FIX: 無法自動修復,請自行修復以下問題
|
||||
TOOLBOX_START_SCAN: 開始掃描
|
||||
TOOLBOX_RE_SCAN: 重新掃描
|
||||
TOOLBOX_START_FIX: 開始修復
|
||||
TOOLBOX_SUCCESS_TIPS: 恭喜你,沒有檢查出問題
|
||||
TOOLBOX_CHECK_CONFIG_FILE_PATH_TIPS: 配置文件路徑是:${path}
|
||||
TOOLBOX_CHECK_CONFIG_FILE_BROKEN_TIPS: 配置文件已損壞
|
||||
TOOLBOX_CHECK_GALLERY_FILE_PATH_TIPS: 相冊文件路徑是:${path}
|
||||
TOOLBOX_CHECK_GALLERY_FILE_BROKEN_TIPS: 相冊文件已損壞
|
||||
TOOLBOX_CHECK_PROXY_SUCCESS_TIPS: 代理設置正常
|
||||
TOOLBOX_CHECK_PROXY_NO_PROXY_TIPS: 無代理設置
|
||||
TOOLBOX_CHECK_PROXY_PROXY_IS_NOT_CORRECT: 代理設置不正確
|
||||
TOOLBOX_CHECK_PROXY_PROXY_IS_NOT_WORKING: 代理設置不可用
|
||||
TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_TIPS: 剪貼板圖片臨時文件夾路徑是:${path}
|
||||
TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_NOT_EXIST_TIPS: 剪貼板圖片臨時文件夾不存在:${path}
|
||||
TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_ERROR_TIPS: 請自行創建文件夾:${path}
|
||||
|
||||
# tips
|
||||
TIPS_NOTICE: 注意
|
||||
TIPS_WARNING: 警告
|
||||
|
||||
+79
-80
@@ -2,24 +2,24 @@
|
||||
// upload version file to cos
|
||||
|
||||
require('dotenv').config()
|
||||
const crypto = require('crypto')
|
||||
// const crypto = require('crypto')
|
||||
// const axios = require('axios').default
|
||||
const fs = require('fs')
|
||||
const mime = require('mime-types')
|
||||
const pkg = require('../package.json')
|
||||
const configList = require('./config')
|
||||
const axios = require('axios').default
|
||||
const mime = require('mime-types')
|
||||
const path = require('path')
|
||||
const distPath = path.join(__dirname, '../dist_electron')
|
||||
const S3Client = require('@aws-sdk/client-s3').S3Client
|
||||
const Upload = require('@aws-sdk/lib-storage').Upload
|
||||
// const BUCKET = 'picgo-1251750343'
|
||||
// const COS_SECRET_ID = process.env.PICGO_ENV_COS_SECRET_ID
|
||||
// const COS_SECRET_KEY = process.env.PICGO_ENV_COS_SECRET_KEY
|
||||
|
||||
const BUCKET = 'picgo-1251750343'
|
||||
const S3_BUCKET = 'picgo'
|
||||
// const AREA = 'ap-chengdu'
|
||||
const VERSION = pkg.version
|
||||
const FILE_PATH = `${VERSION}/`
|
||||
const COS_SECRET_ID = process.env.PICGO_ENV_COS_SECRET_ID
|
||||
const COS_SECRET_KEY = process.env.PICGO_ENV_COS_SECRET_KEY
|
||||
const S3_SECRET_ID = process.env.PICGO_ENV_S3_SECRET_ID
|
||||
const S3_SECRET_KEY = process.env.PICGO_ENV_S3_SECRET_KEY
|
||||
const S3_ACCOUNT_ID = process.env.PICGO_ENV_S3_ACCOUNT_ID
|
||||
@@ -35,83 +35,83 @@ const S3Options = {
|
||||
}
|
||||
|
||||
// https://cloud.tencent.com/document/product/436/7778#signature
|
||||
/**
|
||||
* @param {string} fileName
|
||||
* @returns
|
||||
*/
|
||||
const generateSignature = (fileName, folder = FILE_PATH) => {
|
||||
const secretKey = COS_SECRET_ID
|
||||
// const area = AREA
|
||||
const bucket = BUCKET
|
||||
const path = folder
|
||||
const today = Math.floor(new Date().getTime() / 1000)
|
||||
const tomorrow = today + 86400
|
||||
const signTime = `${today};${tomorrow}`
|
||||
const signKey = crypto.createHmac('sha1', secretKey).update(signTime).digest('hex')
|
||||
const httpString = `put\n/${path}${fileName}\n\nhost=${bucket}.cos.accelerate.myqcloud.com\n`
|
||||
const sha1edHttpString = crypto.createHash('sha1').update(httpString).digest('hex')
|
||||
const stringToSign = `sha1\n${signTime}\n${sha1edHttpString}\n`
|
||||
const signature = crypto.createHmac('sha1', signKey).update(stringToSign).digest('hex')
|
||||
return {
|
||||
signature,
|
||||
signTime
|
||||
}
|
||||
}
|
||||
// /**
|
||||
// * @param {string} fileName
|
||||
// * @returns
|
||||
// */
|
||||
// const generateSignature = (fileName, folder = FILE_PATH) => {
|
||||
// const secretKey = COS_SECRET_ID
|
||||
// // const area = AREA
|
||||
// const bucket = BUCKET
|
||||
// const path = folder
|
||||
// const today = Math.floor(new Date().getTime() / 1000)
|
||||
// const tomorrow = today + 86400
|
||||
// const signTime = `${today};${tomorrow}`
|
||||
// const signKey = crypto.createHmac('sha1', secretKey).update(signTime).digest('hex')
|
||||
// const httpString = `put\n/${path}${fileName}\n\nhost=${bucket}.cos.accelerate.myqcloud.com\n`
|
||||
// const sha1edHttpString = crypto.createHash('sha1').update(httpString).digest('hex')
|
||||
// const stringToSign = `sha1\n${signTime}\n${sha1edHttpString}\n`
|
||||
// const signature = crypto.createHmac('sha1', signKey).update(stringToSign).digest('hex')
|
||||
// return {
|
||||
// signature,
|
||||
// signTime
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} fileName
|
||||
* @param {Buffer} fileBuffer
|
||||
* @param {{ signature: string, signTime: string }} signature
|
||||
* @returns
|
||||
*/
|
||||
const getReqOptions = (fileName, fileBuffer, signature, folder = FILE_PATH) => {
|
||||
return {
|
||||
method: 'PUT',
|
||||
url: `http://${BUCKET}.cos.accelerate.myqcloud.com/${encodeURI(folder)}${encodeURI(fileName)}`,
|
||||
headers: {
|
||||
Host: `${BUCKET}.cos.accelerate.myqcloud.com`,
|
||||
Authorization: `q-sign-algorithm=sha1&q-ak=${COS_SECRET_KEY}&q-sign-time=${signature.signTime}&q-key-time=${signature.signTime}&q-header-list=host&q-url-param-list=&q-signature=${signature.signature}`,
|
||||
contentType: mime.lookup(fileName),
|
||||
useAgent: `PicGo;${pkg.version};null;null`
|
||||
},
|
||||
maxContentLength: Infinity,
|
||||
maxBodyLength: Infinity,
|
||||
data: fileBuffer,
|
||||
resolveWithFullResponse: true
|
||||
}
|
||||
}
|
||||
// /**
|
||||
// *
|
||||
// * @param {string} fileName
|
||||
// * @param {Buffer} fileBuffer
|
||||
// * @param {{ signature: string, signTime: string }} signature
|
||||
// * @returns
|
||||
// */
|
||||
// const getReqOptions = (fileName, fileBuffer, signature, folder = FILE_PATH) => {
|
||||
// return {
|
||||
// method: 'PUT',
|
||||
// url: `http://${BUCKET}.cos.accelerate.myqcloud.com/${encodeURI(folder)}${encodeURI(fileName)}`,
|
||||
// headers: {
|
||||
// Host: `${BUCKET}.cos.accelerate.myqcloud.com`,
|
||||
// Authorization: `q-sign-algorithm=sha1&q-ak=${COS_SECRET_KEY}&q-sign-time=${signature.signTime}&q-key-time=${signature.signTime}&q-header-list=host&q-url-param-list=&q-signature=${signature.signature}`,
|
||||
// contentType: mime.lookup(fileName),
|
||||
// useAgent: `PicGo;${pkg.version};null;null`
|
||||
// },
|
||||
// maxContentLength: Infinity,
|
||||
// maxBodyLength: Infinity,
|
||||
// data: fileBuffer,
|
||||
// resolveWithFullResponse: true
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* a backup for version file
|
||||
*/
|
||||
const uploadVersionFile = async () => {
|
||||
try {
|
||||
const platform = process.platform
|
||||
if (configList[platform]) {
|
||||
let versionFileHasUploaded = false
|
||||
for (const [, config] of configList[platform].entries()) {
|
||||
const versionFilePath = path.join(distPath, config['version-file'])
|
||||
let versionFileName = config['version-file']
|
||||
if (VERSION.toLocaleLowerCase().includes('beta')) {
|
||||
versionFileName = versionFileName.replace('.yml', '.beta.yml')
|
||||
}
|
||||
// upload version file
|
||||
if (!versionFileHasUploaded) {
|
||||
const signature = generateSignature(versionFileName, '')
|
||||
const reqOptions = getReqOptions(versionFileName, fs.readFileSync(versionFilePath), signature, '')
|
||||
console.log('[PicGo Version File] Uploading...', versionFileName)
|
||||
await axios.request(reqOptions)
|
||||
versionFileHasUploaded = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.warn('platform not supported!', platform)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
// const uploadVersionFile = async () => {
|
||||
// try {
|
||||
// const platform = process.platform
|
||||
// if (configList[platform]) {
|
||||
// let versionFileHasUploaded = false
|
||||
// for (const [, config] of configList[platform].entries()) {
|
||||
// const versionFilePath = path.join(distPath, config['version-file'])
|
||||
// let versionFileName = config['version-file']
|
||||
// if (VERSION.toLocaleLowerCase().includes('beta')) {
|
||||
// versionFileName = versionFileName.replace('.yml', '.beta.yml')
|
||||
// }
|
||||
// // upload version file
|
||||
// if (!versionFileHasUploaded) {
|
||||
// const signature = generateSignature(versionFileName, '')
|
||||
// const reqOptions = getReqOptions(versionFileName, fs.readFileSync(versionFilePath), signature, '')
|
||||
// console.log('[PicGo Version File] Uploading...', versionFileName)
|
||||
// await axios.request(reqOptions)
|
||||
// versionFileHasUploaded = true
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// console.warn('platform not supported!', platform)
|
||||
// }
|
||||
// } catch (e) {
|
||||
// console.error(e)
|
||||
// }
|
||||
// }
|
||||
|
||||
const uploadDist = async () => {
|
||||
try {
|
||||
@@ -152,7 +152,7 @@ const uploadDist = async () => {
|
||||
Bucket: S3_BUCKET,
|
||||
Key: `${versionFileName}`,
|
||||
Body: fs.createReadStream(versionFilePath),
|
||||
ContentType: 'application/octet-stream'
|
||||
ContentType: mime.lookup(versionFileName)
|
||||
}
|
||||
})
|
||||
console.log('[PicGo Version File] Uploading...', versionFileName)
|
||||
@@ -169,7 +169,6 @@ const uploadDist = async () => {
|
||||
}
|
||||
|
||||
const main = async () => {
|
||||
await uploadVersionFile()
|
||||
await uploadDist()
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import { buildPicBedListMenu } from '~/main/events/remotes/menu'
|
||||
let contextMenu: Menu | null
|
||||
let menu: Menu | null
|
||||
let tray: Tray | null
|
||||
// need to build new menu
|
||||
export function createContextMenu () {
|
||||
if (process.platform === 'darwin' || process.platform === 'win32') {
|
||||
const submenu = buildPicBedListMenu()
|
||||
@@ -131,6 +132,7 @@ export function createContextMenu () {
|
||||
}
|
||||
])
|
||||
}
|
||||
return contextMenu!
|
||||
}
|
||||
|
||||
const getTrayIcon = () => {
|
||||
@@ -252,7 +254,21 @@ export function createTray () {
|
||||
}
|
||||
}
|
||||
|
||||
export function handleDockIcon () {
|
||||
if (process.platform === 'darwin') {
|
||||
if (db.get('settings.showDockIcon') !== false) {
|
||||
app.dock.show()
|
||||
app.dock.setMenu(createContextMenu())
|
||||
} else {
|
||||
app.dock.hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function createMenu () {
|
||||
if (menu) {
|
||||
return menu
|
||||
}
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
const template = [{
|
||||
label: 'Edit',
|
||||
|
||||
@@ -60,6 +60,7 @@ windowList.set(IWindowList.SETTING_WINDOW, {
|
||||
isValid: true,
|
||||
multiple: false,
|
||||
options () {
|
||||
const showDockIcon = db.get('settings.showDockIcon') !== false
|
||||
const options: IBrowserWindowOptions = {
|
||||
height: 450,
|
||||
width: 800,
|
||||
@@ -71,6 +72,7 @@ windowList.set(IWindowList.SETTING_WINDOW, {
|
||||
title: 'PicGo',
|
||||
vibrancy: 'ultra-dark',
|
||||
transparent: true,
|
||||
skipTaskbar: !showDockIcon,
|
||||
titleBarStyle: 'hidden',
|
||||
webPreferences: {
|
||||
backgroundThrottling: false,
|
||||
@@ -86,6 +88,7 @@ windowList.set(IWindowList.SETTING_WINDOW, {
|
||||
options.backgroundColor = '#3f3c37'
|
||||
options.transparent = false
|
||||
options.icon = `${__static}/logo.png`
|
||||
options.skipTaskbar = false
|
||||
}
|
||||
return options
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { IRPCActionType } from '~/universal/types/enum'
|
||||
import { IRPCActionType, IWindowList } from '~/universal/types/enum'
|
||||
import { RPCRouter } from '../router'
|
||||
import { app, clipboard, shell } from 'electron'
|
||||
import windowManager from '~/main/apis/app/window/windowManager'
|
||||
|
||||
const systemRouter = new RPCRouter()
|
||||
|
||||
@@ -17,6 +18,18 @@ systemRouter
|
||||
const [text] = args as ICopyTextArgs
|
||||
return clipboard.writeText(text)
|
||||
})
|
||||
.add(IRPCActionType.SHOW_DOCK_ICON, async (args) => {
|
||||
const [visible] = args as IShowDockIconArgs
|
||||
app.dock[visible ? 'show' : 'hide']()
|
||||
const win = windowManager.get(IWindowList.SETTING_WINDOW)
|
||||
if (!visible) {
|
||||
win?.show()
|
||||
win?.focus()
|
||||
win?.setSkipTaskbar(true)
|
||||
} else {
|
||||
win?.setSkipTaskbar(false)
|
||||
}
|
||||
})
|
||||
|
||||
export {
|
||||
systemRouter
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
uploadClipboardFiles
|
||||
} from 'apis/app/uploader/apis'
|
||||
import {
|
||||
createTray
|
||||
createTray, handleDockIcon
|
||||
} from 'apis/app/system'
|
||||
import server from '~/main/server/index'
|
||||
import updateChecker from '~/main/utils/updateChecker'
|
||||
@@ -36,6 +36,7 @@ import picgo from 'apis/core/picgo'
|
||||
import fixPath from './fixPath'
|
||||
import { initI18n } from '~/main/utils/handleI18n'
|
||||
import { remoteNoticeHandler } from 'apis/app/remoteNotice'
|
||||
import { isMacOS } from '../utils/getMacOSVersion'
|
||||
|
||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||
|
||||
@@ -84,6 +85,7 @@ class LifeCycle {
|
||||
windowManager.create(IWindowList.TRAY_WINDOW)
|
||||
windowManager.create(IWindowList.SETTING_WINDOW)
|
||||
createTray()
|
||||
handleDockIcon()
|
||||
db.set('needReload', false)
|
||||
updateChecker()
|
||||
// 不需要阻塞
|
||||
@@ -130,6 +132,13 @@ class LifeCycle {
|
||||
if (!windowManager.has(IWindowList.SETTING_WINDOW)) {
|
||||
windowManager.create(IWindowList.SETTING_WINDOW)
|
||||
}
|
||||
// click dock to open setting window
|
||||
if (isMacOS) {
|
||||
handleDockIcon()
|
||||
if (db.get('settings.showDockIcon') !== false) {
|
||||
windowManager.get(IWindowList.SETTING_WINDOW)?.show()
|
||||
}
|
||||
}
|
||||
})
|
||||
app.setLoginItemSettings({
|
||||
openAtLogin: db.get('settings.autoStart') || false
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<el-row align="middle">
|
||||
{{ props.settingText }}
|
||||
<template v-if="props.tooltips">
|
||||
<el-tooltip
|
||||
class="item"
|
||||
effect="dark"
|
||||
:content="props.tooltips"
|
||||
placement="right"
|
||||
>
|
||||
<el-icon style="margin-left: 4px">
|
||||
<QuestionFilled />
|
||||
</el-icon>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-switch
|
||||
v-model="value"
|
||||
:active-text="$T('SETTINGS_OPEN')"
|
||||
:inactive-text="$T('SETTINGS_CLOSE')"
|
||||
@change="handleChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { T as $T } from '@/i18n'
|
||||
import { saveConfig } from '@/utils/dataSender'
|
||||
import { ref, watch } from 'vue'
|
||||
import { QuestionFilled } from '@element-plus/icons-vue'
|
||||
|
||||
interface IProps {
|
||||
tooltips?: string
|
||||
settingProps: string
|
||||
settingText: string
|
||||
defaultValue: boolean
|
||||
}
|
||||
|
||||
const props = defineProps<IProps>()
|
||||
|
||||
// to fix v-model blank bug
|
||||
watch(() => props.defaultValue, (v) => {
|
||||
value.value = v
|
||||
})
|
||||
|
||||
const value = ref<boolean>(props.defaultValue)
|
||||
const emit = defineEmits(['change'])
|
||||
|
||||
const handleChange = (val: ICheckBoxValueType) => {
|
||||
saveConfig(props.settingProps, val)
|
||||
emit('change', val)
|
||||
}
|
||||
|
||||
</script>
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'CheckboxFormItem'
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang='stylus'>
|
||||
</style>
|
||||
@@ -242,6 +242,13 @@
|
||||
@change="handleEncodeOutputURL"
|
||||
/>
|
||||
</el-form-item>
|
||||
<checkbox-form-item
|
||||
v-if="os === 'darwin'"
|
||||
:default-value="form.showDockIcon"
|
||||
setting-props="settings.showDockIcon"
|
||||
:setting-text="$T('SETTINGS_SHOW_DOCK_ICON')"
|
||||
@change="handleShowDockIcon"
|
||||
/>
|
||||
<el-form-item
|
||||
:style="{ marginRight: '-64px' }"
|
||||
:label="$T('CHOOSE_SHOWED_PICBED')"
|
||||
@@ -540,10 +547,11 @@ import { enforceNumber } from '~/universal/utils/common'
|
||||
import { compare } from 'compare-versions'
|
||||
import { STABLE_RELEASE_URL, BETA_RELEASE_URL } from '#/utils/static'
|
||||
import { computed, onBeforeMount, onBeforeUnmount, reactive, ref } from 'vue'
|
||||
import { getConfig, saveConfig, sendToMain, triggerRPC } from '@/utils/dataSender'
|
||||
import { getConfig, saveConfig, sendRPC, sendToMain, triggerRPC } from '@/utils/dataSender'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { SHORTKEY_PAGE } from '@/router/config'
|
||||
import { IRPCActionType } from '~/universal/types/enum'
|
||||
import CheckboxFormItem from '@/components/settings/CheckboxFormItem.vue'
|
||||
|
||||
const $customLink = ref<InstanceType<typeof ElForm> | null>(null)
|
||||
|
||||
@@ -569,7 +577,8 @@ const form = reactive<ISettingForm>({
|
||||
useBuiltinClipboard: false,
|
||||
language: 'zh-CN',
|
||||
logFileSizeLimit: 10,
|
||||
encodeOutputURL: true
|
||||
encodeOutputURL: true,
|
||||
showDockIcon: true
|
||||
})
|
||||
|
||||
const languageList = i18nManager.languageList.map(item => ({
|
||||
@@ -667,6 +676,7 @@ async function initData () {
|
||||
enable: true
|
||||
}
|
||||
form.logFileSizeLimit = enforceNumber(settings.logFileSizeLimit) || 10
|
||||
form.showDockIcon = settings.showDockIcon === undefined ? true : settings.showDockIcon
|
||||
}
|
||||
}
|
||||
|
||||
@@ -921,6 +931,10 @@ function handleLanguageChange (val: string) {
|
||||
sendToMain(GET_PICBEDS)
|
||||
}
|
||||
|
||||
function handleShowDockIcon (val: ICheckBoxValueType) {
|
||||
sendRPC(IRPCActionType.SHOW_DOCK_ICON, val)
|
||||
}
|
||||
|
||||
function goConfigPage () {
|
||||
sendToMain(OPEN_URL, 'https://picgo.github.io/PicGo-Doc/zh/guide/config.html#picgo设置')
|
||||
}
|
||||
|
||||
@@ -70,7 +70,8 @@ export enum IRPCActionType {
|
||||
// system rpc
|
||||
RELOAD_APP = 'RELOAD_APP',
|
||||
OPEN_FILE = 'OPEN_FILE',
|
||||
COPY_TEXT = 'COPY_TEXT'
|
||||
COPY_TEXT = 'COPY_TEXT',
|
||||
SHOW_DOCK_ICON = 'SHOW_DOCK_ICON',
|
||||
}
|
||||
|
||||
export enum IToolboxItemType {
|
||||
|
||||
Vendored
+1
@@ -113,6 +113,7 @@ interface ILocales {
|
||||
UPLOADER_CONFIG_PLACEHOLDER: string
|
||||
SELECTED_SETTING_HINT: string
|
||||
SETTINGS_ENCODE_OUTPUT_URL: string
|
||||
SETTINGS_SHOW_DOCK_ICON: string
|
||||
SHORTCUT_NAME: string
|
||||
SHORTCUT_BIND: string
|
||||
SHORTCUT_STATUS: string
|
||||
|
||||
Vendored
+1
@@ -7,6 +7,7 @@ type IGetLatestVersionArgs = [isCheckBetaVersion: boolean]
|
||||
type IToolboxCheckArgs = [type: import('./enum').IToolboxItemType]
|
||||
type IOpenFileArgs = [filePath: string]
|
||||
type ICopyTextArgs = [text: string]
|
||||
type IShowDockIconArgs = [visible: boolean]
|
||||
|
||||
interface IRPCServer {
|
||||
start: () => void
|
||||
|
||||
Vendored
+1
@@ -13,6 +13,7 @@ interface ISettingForm {
|
||||
language: string
|
||||
logFileSizeLimit: number
|
||||
encodeOutputURL: boolean
|
||||
showDockIcon: boolean
|
||||
}
|
||||
|
||||
interface IShortKeyMap {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const CLIPBOARD_IMAGE_FOLDER = 'picgo-clipboard-images'
|
||||
export const RELEASE_URL = 'https://api.github.com/repos/Molunerfinn/PicGo/releases'
|
||||
export const RELEASE_URL_BACKUP = 'https://picgo-1251750343.cos.ap-chengdu.myqcloud.com'
|
||||
export const RELEASE_URL_BACKUP = 'https://picgo-release.molunerfinn.com'
|
||||
export const STABLE_RELEASE_URL = 'https://github.com/Molunerfinn/PicGo/releases/latest'
|
||||
export const BETA_RELEASE_URL = 'https://github.com/Molunerfinn/PicGo/releases'
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ const config = {
|
||||
mac: {
|
||||
icon: 'build/icons/icon.icns',
|
||||
extendInfo: {
|
||||
LSUIElement: 1
|
||||
LSUIElement: 0
|
||||
},
|
||||
target: [{
|
||||
target: 'dmg',
|
||||
|
||||
Reference in New Issue
Block a user