mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-09 13:58:12 -05:00
✨ Feature: add tencent-cos options for url
ISSUES CLOSED: #862, #863, #865, #524, #845, #732
This commit is contained in:
parent
f1c8507927
commit
af291e4f11
@ -44,7 +44,7 @@
|
|||||||
"keycode": "^2.2.0",
|
"keycode": "^2.2.0",
|
||||||
"lodash-id": "^0.14.0",
|
"lodash-id": "^0.14.0",
|
||||||
"lowdb": "^1.0.0",
|
"lowdb": "^1.0.0",
|
||||||
"picgo": "^1.5.0-alpha.0",
|
"picgo": "^1.5.0-alpha.3",
|
||||||
"qrcode.vue": "^1.7.0",
|
"qrcode.vue": "^1.7.0",
|
||||||
"shell-path": "2.1.0",
|
"shell-path": "2.1.0",
|
||||||
"uuidv4": "^6.2.11",
|
"uuidv4": "^6.2.11",
|
||||||
|
@ -41,7 +41,7 @@ export const uploadClipboardFiles = async (): Promise<string> => {
|
|||||||
trayWindow?.webContents?.send('clipboardFiles', [])
|
trayWindow?.webContents?.send('clipboardFiles', [])
|
||||||
trayWindow?.webContents?.send('uploadFiles', img)
|
trayWindow?.webContents?.send('uploadFiles', img)
|
||||||
if (windowManager.has(IWindowList.SETTING_WINDOW)) {
|
if (windowManager.has(IWindowList.SETTING_WINDOW)) {
|
||||||
windowManager.get(IWindowList.SETTING_WINDOW)!.webContents.send('updateGallery')
|
windowManager.get(IWindowList.SETTING_WINDOW)!.webContents?.send('updateGallery')
|
||||||
}
|
}
|
||||||
return handleUrlEncode(img[0].imgUrl as string)
|
return handleUrlEncode(img[0].imgUrl as string)
|
||||||
} else {
|
} else {
|
||||||
@ -81,7 +81,7 @@ export const uploadChoosedFiles = async (webContents: WebContents, files: IFileW
|
|||||||
// trayWindow just be created in mac/windows, not in linux
|
// trayWindow just be created in mac/windows, not in linux
|
||||||
windowManager.get(IWindowList.TRAY_WINDOW)?.webContents?.send('uploadFiles', imgs)
|
windowManager.get(IWindowList.TRAY_WINDOW)?.webContents?.send('uploadFiles', imgs)
|
||||||
if (windowManager.has(IWindowList.SETTING_WINDOW)) {
|
if (windowManager.has(IWindowList.SETTING_WINDOW)) {
|
||||||
windowManager.get(IWindowList.SETTING_WINDOW)!.webContents.send('updateGallery')
|
windowManager.get(IWindowList.SETTING_WINDOW)!.webContents?.send('updateGallery')
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
} else {
|
} else {
|
||||||
|
@ -9,14 +9,23 @@ const LOG_PATH = path.join(STORE_PATH, '/picgo.log')
|
|||||||
// since the error may occur in picgo-core
|
// since the error may occur in picgo-core
|
||||||
// so we can't use the log from picgo
|
// so we can't use the log from picgo
|
||||||
export const loggerWriter = (error: Error) => {
|
export const loggerWriter = (error: Error) => {
|
||||||
let log = `${dayjs().format('YYYY-MM-DD HH:mm:ss')} [PicGo ERROR] startup error`
|
try {
|
||||||
|
const time = dayjs().format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
let log = `${time} [PicGo ERROR] process error begin`
|
||||||
if (error?.stack) {
|
if (error?.stack) {
|
||||||
log += `\n------Error Stack Begin------\n${util.format(error.stack)}\n-------Error Stack End-------\n`
|
log += `\n------Error Stack Begin------\n${util.format(error.stack)}\n-------Error Stack End-------\n`
|
||||||
} else {
|
} else {
|
||||||
const msg = JSON.stringify(error)
|
const msg = JSON.stringify(error)
|
||||||
log += `${msg}\n`
|
log += `${msg}\n`
|
||||||
}
|
}
|
||||||
|
log += `${time} [PicGo ERROR] process error end`
|
||||||
|
if (!fse.existsSync(LOG_PATH)) {
|
||||||
|
fse.ensureFileSync(LOG_PATH)
|
||||||
|
}
|
||||||
fse.appendFileSync(LOG_PATH, log)
|
fse.appendFileSync(LOG_PATH, log)
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleProcessError = (error: Error) => {
|
const handleProcessError = (error: Error) => {
|
||||||
|
@ -35,6 +35,11 @@ const updateShortKeyFromVersion212 = (db: typeof ConfigStore, shortKeyConfig: IS
|
|||||||
|
|
||||||
const migrateGalleryFromVersion230 = async (configDB: typeof ConfigStore, galleryDB: DBStore, picgo: PicGoCore) => {
|
const migrateGalleryFromVersion230 = async (configDB: typeof ConfigStore, galleryDB: DBStore, picgo: PicGoCore) => {
|
||||||
const originGallery: ImgInfo[] = configDB.get('uploaded')
|
const originGallery: ImgInfo[] = configDB.get('uploaded')
|
||||||
|
// if hasMigrate, we don't need to migrate
|
||||||
|
const hasMigrate: boolean = configDB.get('__migrateUploaded')
|
||||||
|
if (hasMigrate) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const configPath = configDB.getConfigPath()
|
const configPath = configDB.getConfigPath()
|
||||||
const configBakPath = path.join(path.dirname(configPath), 'config.bak.json')
|
const configBakPath = path.join(path.dirname(configPath), 'config.bak.json')
|
||||||
// migrate gallery from config to gallery db
|
// migrate gallery from config to gallery db
|
||||||
@ -44,7 +49,8 @@ const migrateGalleryFromVersion230 = async (configDB: typeof ConfigStore, galler
|
|||||||
}
|
}
|
||||||
await galleryDB.insertMany(originGallery)
|
await galleryDB.insertMany(originGallery)
|
||||||
picgo.saveConfig({
|
picgo.saveConfig({
|
||||||
uploaded: []
|
uploaded: [],
|
||||||
|
__migrateUploaded: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ router.post('/upload', async ({
|
|||||||
// upload with clipboard
|
// upload with clipboard
|
||||||
logger.info('[PicGo Server] upload clipboard file')
|
logger.info('[PicGo Server] upload clipboard file')
|
||||||
const res = await uploadClipboardFiles()
|
const res = await uploadClipboardFiles()
|
||||||
|
logger.info('[PicGo Server] upload result:', res)
|
||||||
if (res) {
|
if (res) {
|
||||||
handleResponse({
|
handleResponse({
|
||||||
response,
|
response,
|
||||||
@ -51,6 +52,7 @@ router.post('/upload', async ({
|
|||||||
})
|
})
|
||||||
const win = windowManager.getAvailableWindow()
|
const win = windowManager.getAvailableWindow()
|
||||||
const res = await uploadChoosedFiles(win.webContents, pathList)
|
const res = await uploadChoosedFiles(win.webContents, pathList)
|
||||||
|
logger.info('[PicGo Server] upload result', res.join(' ; '))
|
||||||
if (res.length) {
|
if (res.length) {
|
||||||
handleResponse({
|
handleResponse({
|
||||||
response,
|
response,
|
||||||
|
@ -270,6 +270,11 @@ export default class extends Vue {
|
|||||||
</script>
|
</script>
|
||||||
<style lang='stylus'>
|
<style lang='stylus'>
|
||||||
$darwinBg = transparentify(#172426, #000, 0.7)
|
$darwinBg = transparentify(#172426, #000, 0.7)
|
||||||
|
.setting-list-scroll
|
||||||
|
height 425px
|
||||||
|
overflow-y auto
|
||||||
|
overflow-x hidden
|
||||||
|
margin-right 0!important
|
||||||
.picgo-fade
|
.picgo-fade
|
||||||
&-enter,
|
&-enter,
|
||||||
&-leave,
|
&-leave,
|
||||||
|
@ -147,8 +147,13 @@
|
|||||||
></el-switch>
|
></el-switch>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label="$T('SETTINGS_USE_BUILTIN_CLIPBOARD_UPLOAD')"
|
|
||||||
>
|
>
|
||||||
|
<div class="el-form-item__custom-label" slot="label">
|
||||||
|
{{ $T('SETTINGS_USE_BUILTIN_CLIPBOARD_UPLOAD') }}
|
||||||
|
<el-tooltip class="item" effect="dark" :content="$T('BUILTIN_CLIPBOARD_TIPS')" placement="right">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="form.useBuiltinClipboard"
|
v-model="form.useBuiltinClipboard"
|
||||||
:active-text="$T('SETTINGS_OPEN')"
|
:active-text="$T('SETTINGS_OPEN')"
|
||||||
@ -811,6 +816,9 @@ export default class extends Vue {
|
|||||||
color #eee
|
color #eee
|
||||||
flex-basis: 50%
|
flex-basis: 50%
|
||||||
flex-shrink: 0
|
flex-shrink: 0
|
||||||
|
.el-form-item__custom-label
|
||||||
|
display flex
|
||||||
|
align-items center
|
||||||
.el-button-group
|
.el-button-group
|
||||||
width 100%
|
width 100%
|
||||||
.el-button
|
.el-button
|
||||||
@ -824,9 +832,7 @@ export default class extends Vue {
|
|||||||
&.is-active
|
&.is-active
|
||||||
color #409EFF
|
color #409EFF
|
||||||
.el-icon-question
|
.el-icon-question
|
||||||
font-size 20px
|
margin-left 4px
|
||||||
float right
|
|
||||||
margin-top 9px
|
|
||||||
color #eee
|
color #eee
|
||||||
cursor pointer
|
cursor pointer
|
||||||
transition .2s color ease-in-out
|
transition .2s color ease-in-out
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="tcyun-view">
|
<div id="tcyun-view">
|
||||||
<el-row :gutter="16">
|
<el-row :gutter="16" class="setting-list-scroll">
|
||||||
<el-col :span="16" :offset="4">
|
<el-col :span="16" :offset="4">
|
||||||
<div class="view-title">
|
<div class="view-title">
|
||||||
腾讯云COS设置
|
腾讯云COS设置
|
||||||
@ -74,6 +74,11 @@
|
|||||||
>
|
>
|
||||||
<el-input v-model="form.customUrl" @keyup.native.enter="confirm" placeholder="例如https://xxxx.com"></el-input>
|
<el-input v-model="form.customUrl" @keyup.native.enter="confirm" placeholder="例如https://xxxx.com"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="设定网址后缀"
|
||||||
|
>
|
||||||
|
<el-input v-model="form.options" @keyup.native.enter="confirm" placeholder="例如?imageMogr2"></el-input>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
<el-button type="primary" @click="confirm" round>确定</el-button>
|
<el-button type="primary" @click="confirm" round>确定</el-button>
|
||||||
@ -90,12 +95,13 @@ import { ipcRenderer } from 'electron'
|
|||||||
import { Component, Vue } from 'vue-property-decorator'
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import mixin from '@/utils/ConfirmButtonMixin'
|
import mixin from '@/utils/ConfirmButtonMixin'
|
||||||
import { OPEN_URL } from '#/events/constants'
|
import { OPEN_URL } from '#/events/constants'
|
||||||
|
import { ITcyunConfig } from 'picgo/dist/types'
|
||||||
@Component({
|
@Component({
|
||||||
name: 'tcyun',
|
name: 'tcyun',
|
||||||
mixins: [mixin]
|
mixins: [mixin]
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
form: ITcYunConfig = {
|
form: ITcyunConfig = {
|
||||||
secretId: '',
|
secretId: '',
|
||||||
secretKey: '',
|
secretKey: '',
|
||||||
bucket: '',
|
bucket: '',
|
||||||
@ -103,11 +109,12 @@ export default class extends Vue {
|
|||||||
area: '',
|
area: '',
|
||||||
path: '',
|
path: '',
|
||||||
customUrl: '',
|
customUrl: '',
|
||||||
version: 'v4'
|
version: 'v5',
|
||||||
|
options: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
async created () {
|
async created () {
|
||||||
const config = await this.getConfig<ITcYunConfig>('picBed.tcyun')
|
const config = await this.getConfig<ITcyunConfig>('picBed.tcyun')
|
||||||
if (config) {
|
if (config) {
|
||||||
this.form = Object.assign({}, config)
|
this.form = Object.assign({}, config)
|
||||||
}
|
}
|
||||||
|
@ -67,21 +67,23 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from 'vue-property-decorator'
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import mixin from '@/utils/ConfirmButtonMixin'
|
import mixin from '@/utils/ConfirmButtonMixin'
|
||||||
|
import { IUpyunConfig } from 'picgo/dist/types'
|
||||||
@Component({
|
@Component({
|
||||||
name: 'upyun',
|
name: 'upyun',
|
||||||
mixins: [mixin]
|
mixins: [mixin]
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
form: IUpYunConfig = {
|
form: IUpyunConfig = {
|
||||||
bucket: '',
|
bucket: '',
|
||||||
operator: '',
|
operator: '',
|
||||||
password: '',
|
password: '',
|
||||||
options: '',
|
options: '',
|
||||||
|
url: '',
|
||||||
path: ''
|
path: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
async created () {
|
async created () {
|
||||||
const config = await this.getConfig<IUpYunConfig>('picBed.upyun')
|
const config = await this.getConfig<IUpyunConfig>('picBed.upyun')
|
||||||
if (config) {
|
if (config) {
|
||||||
this.form = Object.assign({}, config)
|
this.form = Object.assign({}, config)
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,7 @@ export const EN: ILocales = {
|
|||||||
SETTINGS_NOT_CONFIG_OPTIONS: 'Not Config Options',
|
SETTINGS_NOT_CONFIG_OPTIONS: 'Not Config Options',
|
||||||
SETTINGS_USE_BUILTIN_CLIPBOARD_UPLOAD: 'Use Builtin Clipboard to Upload',
|
SETTINGS_USE_BUILTIN_CLIPBOARD_UPLOAD: 'Use Builtin Clipboard to Upload',
|
||||||
SETTINGS_CHOOSE_LANGUAGE: 'Choose Language',
|
SETTINGS_CHOOSE_LANGUAGE: 'Choose Language',
|
||||||
|
BUILTIN_CLIPBOARD_TIPS: 'Use builtin clipboard function to upload instead of using scripts',
|
||||||
|
|
||||||
// shortcut page
|
// shortcut page
|
||||||
SHORTCUT_NAME: 'Shortcut Name',
|
SHORTCUT_NAME: 'Shortcut Name',
|
||||||
|
@ -106,6 +106,7 @@ export const ZH_CN = {
|
|||||||
SETTINGS_NOT_CONFIG_OPTIONS: '暂无配置项',
|
SETTINGS_NOT_CONFIG_OPTIONS: '暂无配置项',
|
||||||
SETTINGS_USE_BUILTIN_CLIPBOARD_UPLOAD: '使用内置剪贴板上传',
|
SETTINGS_USE_BUILTIN_CLIPBOARD_UPLOAD: '使用内置剪贴板上传',
|
||||||
SETTINGS_CHOOSE_LANGUAGE: '选择语言',
|
SETTINGS_CHOOSE_LANGUAGE: '选择语言',
|
||||||
|
BUILTIN_CLIPBOARD_TIPS: '使用内置剪贴板函数而不是调用脚本获取剪贴板图片',
|
||||||
|
|
||||||
// shortcut page
|
// shortcut page
|
||||||
SHORTCUT_NAME: '快捷键名称',
|
SHORTCUT_NAME: '快捷键名称',
|
||||||
|
3
src/universal/types/types.d.ts
vendored
3
src/universal/types/types.d.ts
vendored
@ -287,7 +287,8 @@ interface ITcYunConfig {
|
|||||||
area: string,
|
area: string,
|
||||||
path: string,
|
path: string,
|
||||||
customUrl: string,
|
customUrl: string,
|
||||||
version: 'v4' | 'v5'
|
version: 'v4' | 'v5',
|
||||||
|
options: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IUpYunConfig {
|
interface IUpYunConfig {
|
||||||
|
11
yarn.lock
11
yarn.lock
@ -9782,11 +9782,12 @@ performance-now@^2.1.0:
|
|||||||
resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
|
resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
|
||||||
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
|
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
|
||||||
|
|
||||||
picgo@^1.5.0-alpha.0:
|
picgo@^1.5.0-alpha.3:
|
||||||
version "1.5.0-alpha.0"
|
version "1.5.0-alpha.3"
|
||||||
resolved "https://registry.npmmirror.com/picgo/download/picgo-1.5.0-alpha.0.tgz#c546a8e48035a0d0a97552dcb3b1e33d85e196d9"
|
resolved "https://registry.npmmirror.com/picgo/-/picgo-1.5.0-alpha.3.tgz#1d30de78d0a963de131b6a3739706160a6a7598f"
|
||||||
integrity sha1-xUao5IA1oNCpdVLcs7HjPYXhltk=
|
integrity sha512-87jotY0snEjQrjmy0Ka46ZvKLjPlfGOghRs5ArvDDZ8g2l5PuikXAyu8AEFxc2WcJ8RiMwjG/tbS15l1dzM5JQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
|
"@picgo/i18n" "^1.0.0"
|
||||||
chalk "^2.4.1"
|
chalk "^2.4.1"
|
||||||
commander "^8.1.0"
|
commander "^8.1.0"
|
||||||
comment-json "^2.3.1"
|
comment-json "^2.3.1"
|
||||||
@ -9810,7 +9811,7 @@ picgo@^1.5.0-alpha.0:
|
|||||||
request "^2.87.0"
|
request "^2.87.0"
|
||||||
request-promise-native "^1.0.5"
|
request-promise-native "^1.0.5"
|
||||||
resolve "^1.8.1"
|
resolve "^1.8.1"
|
||||||
rimraf "^2.6.3"
|
rimraf "^3.0.2"
|
||||||
|
|
||||||
picocolors@^0.2.1:
|
picocolors@^0.2.1:
|
||||||
version "0.2.1"
|
version "0.2.1"
|
||||||
|
Loading…
Reference in New Issue
Block a user