mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-02 11:08:13 -05:00
Fixed: image-size bug && change config all to settings
This commit is contained in:
parent
804072999e
commit
5909d35566
@ -82,7 +82,7 @@
|
||||
"lowdb": "^1.0.0",
|
||||
"md5": "^2.2.1",
|
||||
"melody.css": "^1.0.2",
|
||||
"picgo": "^1.1.0",
|
||||
"picgo": "^1.1.7",
|
||||
"qiniu": "^7.1.1",
|
||||
"request": "^2.83.0",
|
||||
"request-promise": "^4.2.2",
|
||||
|
@ -29,8 +29,8 @@ if (!db.has('picBed').value()) {
|
||||
}).write()
|
||||
}
|
||||
|
||||
if (!db.has('shortKey').value()) {
|
||||
db.set('shortKey', {
|
||||
if (!db.has('settings.shortKey').value()) {
|
||||
db.set('settings.shortKey', {
|
||||
upload: 'CommandOrControl+Shift+P'
|
||||
}).write()
|
||||
}
|
||||
|
@ -93,10 +93,10 @@ function createTray () {
|
||||
{
|
||||
label: '打开更新助手',
|
||||
type: 'checkbox',
|
||||
checked: db.get('picBed.showUpdateTip').value(),
|
||||
checked: db.get('settings.showUpdateTip').value(),
|
||||
click () {
|
||||
const value = db.read().get('picBed.showUpdateTip').value()
|
||||
db.read().set('picBed.showUpdateTip', !value).write()
|
||||
const value = db.read().get('settings.showUpdateTip').value()
|
||||
db.read().set('settings.showUpdateTip', !value).write()
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -153,7 +153,7 @@ function createTray () {
|
||||
})
|
||||
|
||||
tray.on('drop-files', async (event, files) => {
|
||||
const pasteStyle = db.read().get('picBed.pasteStyle').value() || 'markdown'
|
||||
const pasteStyle = db.read().get('settings.pasteStyle').value() || 'markdown'
|
||||
const imgs = await uploader(files, 'imgFromPath', window.webContents)
|
||||
if (imgs !== false) {
|
||||
for (let i in imgs) {
|
||||
@ -360,7 +360,7 @@ const uploadClipboardFiles = async () => {
|
||||
img = await uploader(uploadImg, 'imgFromClipboard', win.webContents)
|
||||
if (img !== false) {
|
||||
if (img.length > 0) {
|
||||
const pasteStyle = db.read().get('picBed.pasteStyle').value() || 'markdown'
|
||||
const pasteStyle = db.read().get('settings.pasteStyle').value() || 'markdown'
|
||||
clipboard.writeText(pasteTemplate(pasteStyle, img[0].imgUrl))
|
||||
const notification = new Notification({
|
||||
title: '上传成功',
|
||||
@ -409,7 +409,7 @@ picgoCoreIPC(app, ipcMain)
|
||||
ipcMain.on('uploadClipboardFiles', async (evt, file) => {
|
||||
const img = await uploader(file, 'imgFromClipboard', window.webContents)
|
||||
if (img !== false) {
|
||||
const pasteStyle = db.read().get('picBed.pasteStyle').value() || 'markdown'
|
||||
const pasteStyle = db.read().get('settings.pasteStyle').value() || 'markdown'
|
||||
clipboard.writeText(pasteTemplate(pasteStyle, img[0].imgUrl))
|
||||
const notification = new Notification({
|
||||
title: '上传成功',
|
||||
@ -439,7 +439,7 @@ ipcMain.on('uploadChoosedFiles', async (evt, files) => {
|
||||
const input = files.map(item => item.path)
|
||||
const imgs = await uploader(input, 'imgFromUploader', evt.sender)
|
||||
if (imgs !== false) {
|
||||
const pasteStyle = db.read().get('picBed.pasteStyle').value() || 'markdown'
|
||||
const pasteStyle = db.read().get('settings.pasteStyle').value() || 'markdown'
|
||||
let pasteText = ''
|
||||
for (let i in imgs) {
|
||||
pasteText += pasteTemplate(pasteStyle, imgs[i].imgUrl) + '\r\n'
|
||||
@ -468,7 +468,7 @@ ipcMain.on('uploadChoosedFiles', async (evt, files) => {
|
||||
ipcMain.on('updateShortKey', (evt, oldKey) => {
|
||||
globalShortcut.unregisterAll()
|
||||
for (let key in oldKey) {
|
||||
globalShortcut.register(db.read().get('shortKey').value()[key], () => {
|
||||
globalShortcut.register(db.read().get('settings.shortKey').value()[key], () => {
|
||||
return shortKeyHash[key]()
|
||||
})
|
||||
}
|
||||
@ -557,7 +557,7 @@ app.on('ready', () => {
|
||||
}
|
||||
updateChecker()
|
||||
|
||||
globalShortcut.register(db.read().get('shortKey.upload').value(), () => {
|
||||
globalShortcut.register(db.read().get('settings.shortKey.upload').value(), () => {
|
||||
uploadClipboardFiles()
|
||||
})
|
||||
})
|
||||
@ -582,7 +582,7 @@ app.on('will-quit', () => {
|
||||
})
|
||||
|
||||
app.setLoginItemSettings({
|
||||
openAtLogin: db.read().get('picBed.autoStart').value() || false
|
||||
openAtLogin: db.read().get('settings.autoStart').value() || false
|
||||
})
|
||||
|
||||
/**
|
||||
|
@ -65,7 +65,8 @@ export default (app, ipcMain) => {
|
||||
config: handleConfigWithFunction(getConfig(uploaderName, 'transformer', picgo))
|
||||
}
|
||||
},
|
||||
enabled: picgo.getConfig(`plugins.${pluginList[i]}`)
|
||||
enabled: picgo.getConfig(`plugins.${pluginList[i]}`),
|
||||
pkg: pluginPKG
|
||||
}
|
||||
list.push(obj)
|
||||
}
|
||||
|
@ -7,9 +7,9 @@ const release = 'https://api.github.com/repos/Molunerfinn/PicGo/releases/latest'
|
||||
const downloadUrl = 'https://github.com/Molunerfinn/PicGo/releases/latest'
|
||||
|
||||
const checkVersion = async () => {
|
||||
let showTip = db.read().get('picBed.showUpdateTip').value()
|
||||
let showTip = db.read().get('settings.showUpdateTip').value()
|
||||
if (showTip === undefined) {
|
||||
db.read().set('picBed.showUpdateTip', true).write()
|
||||
db.read().set('settings.showUpdateTip', true).write()
|
||||
showTip = true
|
||||
}
|
||||
if (showTip) {
|
||||
@ -29,7 +29,7 @@ const checkVersion = async () => {
|
||||
if (res === 0) { // if selected yes
|
||||
shell.openExternal(downloadUrl)
|
||||
}
|
||||
db.read().set('picBed.showUpdateTip', !checkboxChecked).write()
|
||||
db.read().set('settings.showUpdateTip', !checkboxChecked).write()
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
@ -85,8 +85,8 @@ const uploader = (img, type, webContents) => {
|
||||
|
||||
picgo.helper.beforeUploadPlugins.register('renameFn', {
|
||||
handle: async ctx => {
|
||||
const rename = picgo.getConfig('picBed.rename')
|
||||
const autoRename = picgo.getConfig('picBed.autoRename')
|
||||
const rename = picgo.getConfig('settings.rename')
|
||||
const autoRename = picgo.getConfig('settings.autoRename')
|
||||
await Promise.all(ctx.output.map(async item => {
|
||||
let name
|
||||
let fileName
|
||||
@ -102,13 +102,12 @@ const uploader = (img, type, webContents) => {
|
||||
name = await waitForRename(window, window.webContents.id)
|
||||
}
|
||||
item.fileName = name || fileName
|
||||
console.log(item)
|
||||
}))
|
||||
}
|
||||
})
|
||||
|
||||
picgo.on('beforeTransform', ctx => {
|
||||
if (ctx.getConfig('picBed.uploadNotification')) {
|
||||
if (ctx.getConfig('settings.uploadNotification')) {
|
||||
const notification = new Notification({
|
||||
title: '上传进度',
|
||||
body: '正在上传'
|
||||
|
@ -155,7 +155,7 @@ export default {
|
||||
this.idx = null
|
||||
},
|
||||
copy (url) {
|
||||
const style = this.$db.read().get('picBed.pasteStyle').value() || 'markdown'
|
||||
const style = this.$db.read().get('settings.pasteStyle').value() || 'markdown'
|
||||
const copyLink = pasteStyle(style, url)
|
||||
const obj = {
|
||||
title: '复制链接成功',
|
||||
@ -254,7 +254,7 @@ export default {
|
||||
multiCopy () {
|
||||
if (Object.values(this.choosedList).some(item => item)) {
|
||||
let copyString = ''
|
||||
const style = this.$db.read().get('picBed.pasteStyle').value() || 'markdown'
|
||||
const style = this.$db.read().get('settings.pasteStyle').value() || 'markdown'
|
||||
Object.keys(this.choosedList).forEach(key => {
|
||||
if (this.choosedList[key]) {
|
||||
copyString += pasteStyle(style, this.$db.read().get('uploaded').getById(key).value().imgUrl) + '\n'
|
||||
|
@ -180,7 +180,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import db from '../../../datastore'
|
||||
// import db from '../../../datastore'
|
||||
import keyDetect from 'utils/key-binding'
|
||||
import pkg from '../../../../package.json'
|
||||
const release = 'https://api.github.com/repos/Molunerfinn/PicGo/releases/latest'
|
||||
@ -206,23 +206,23 @@ export default {
|
||||
}
|
||||
return {
|
||||
form: {
|
||||
updateHelper: this.$db.get('picBed.showUpdateTip').value(),
|
||||
updateHelper: this.$db.read().get('settings.showUpdateTip').value(),
|
||||
showPicBedList: [],
|
||||
autoStart: this.$db.get('picBed.autoStart').value() || false,
|
||||
rename: this.$db.get('picBed.rename').value() || false,
|
||||
autoRename: this.$db.get('picBed.autoRename').value() || false,
|
||||
uploadNotification: this.$db.get('picBed.uploadNotification').value() || false,
|
||||
miniWindowOntop: db.read().get('miniWindowOntop').value() || false
|
||||
autoStart: this.$db.read().get('settings.autoStart').value() || false,
|
||||
rename: this.$db.read().get('settings.rename').value() || false,
|
||||
autoRename: this.$db.read().get('settings.autoRename').value() || false,
|
||||
uploadNotification: this.$db.read().get('settings.uploadNotification').value() || false,
|
||||
miniWindowOntop: this.$db.read().get('settings.miniWindowOntop').value() || false
|
||||
},
|
||||
picBed: this.$picBed,
|
||||
keyBindingVisible: false,
|
||||
customLinkVisible: false,
|
||||
checkUpdateVisible: false,
|
||||
customLink: {
|
||||
value: db.read().get('customLink').value() || '$url'
|
||||
value: this.$db.read().get('settings.customLink').value() || '$url'
|
||||
},
|
||||
shortKey: {
|
||||
upload: db.read().get('shortKey.upload').value()
|
||||
upload: this.$db.read().get('settings.shortKey.upload').value()
|
||||
},
|
||||
rules: {
|
||||
value: [
|
||||
@ -246,22 +246,22 @@ export default {
|
||||
},
|
||||
cancelKeyBinding () {
|
||||
this.keyBindingVisible = false
|
||||
this.shortKey = db.read().get('shortKey').value()
|
||||
this.shortKey = this.$db.read().get('settings.shortKey').value()
|
||||
},
|
||||
confirmKeyBinding () {
|
||||
const oldKey = db.read().get('shortKey').value()
|
||||
db.read().set('shortKey', this.shortKey).write()
|
||||
const oldKey = this.$db.read().get('settings.shortKey').value()
|
||||
this.db.read().set('settings.shortKey', this.shortKey).write()
|
||||
this.keyBindingVisible = false
|
||||
this.$electron.ipcRenderer.send('updateShortKey', oldKey)
|
||||
},
|
||||
cancelCustomLink () {
|
||||
this.customLinkVisible = false
|
||||
this.customLink.value = db.read().get('customLink').value() || '$url'
|
||||
this.customLink.value = this.$db.read().get('settings.customLink').value() || '$url'
|
||||
},
|
||||
confirmCustomLink () {
|
||||
this.$refs.customLink.validate((valid) => {
|
||||
if (valid) {
|
||||
db.read().set('customLink', this.customLink.value).write()
|
||||
this.db.read().set('settings.customLink', this.customLink.value).write()
|
||||
this.customLinkVisible = false
|
||||
this.$electron.ipcRenderer.send('updateCustomLink')
|
||||
} else {
|
||||
@ -270,7 +270,7 @@ export default {
|
||||
})
|
||||
},
|
||||
updateHelperChange (val) {
|
||||
this.$db.read().set('picBed.showUpdateTip', val).write()
|
||||
this.$db.read().set('settings.showUpdateTip', val).write()
|
||||
},
|
||||
handleShowPicBedListChange (val) {
|
||||
const list = this.picBed.map(item => {
|
||||
@ -284,14 +284,14 @@ export default {
|
||||
this.$db.read().set('picBed.list', list).write()
|
||||
},
|
||||
handleAutoStartChange (val) {
|
||||
this.$db.read().set('picBed.autoStart', val).write()
|
||||
this.$db.read().set('settings.autoStart', val).write()
|
||||
this.$electron.ipcRenderer.send('autoStart', val)
|
||||
},
|
||||
handleRename (val) {
|
||||
this.$db.read().set('picBed.rename', val).write()
|
||||
this.$db.read().set('settings.rename', val).write()
|
||||
},
|
||||
handleAutoRename (val) {
|
||||
this.$db.read().set('picBed.autoRename', val).write()
|
||||
this.$db.read().set('settings.autoRename', val).write()
|
||||
},
|
||||
compareVersion2Update (current, latest) {
|
||||
const currentVersion = current.split('.').map(item => parseInt(item))
|
||||
@ -326,15 +326,12 @@ export default {
|
||||
this.checkUpdateVisible = false
|
||||
},
|
||||
handleUploadNotification (val) {
|
||||
this.$db.read().set('picBed.uploadNotification', val).write()
|
||||
this.$db.read().set('settings.uploadNotification', val).write()
|
||||
},
|
||||
handleMiniWindowOntop (val) {
|
||||
this.$db.read().set('miniWindowOntop', val).write()
|
||||
this.$db.read().set('settings.miniWindowOntop', val).write()
|
||||
this.$message('需要重启生效')
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.$electron.ipcRenderer.removeAllListeners('autoStart')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -124,10 +124,10 @@ export default {
|
||||
this.$electron.ipcRenderer.send('uploadChoosedFiles', sendFiles)
|
||||
},
|
||||
getPasteStyle () {
|
||||
this.pasteStyle = this.$db.read().get('picBed.pasteStyle').value() || 'markdown'
|
||||
this.pasteStyle = this.$db.read().get('settings.pasteStyle').value() || 'markdown'
|
||||
},
|
||||
handlePasteStyleChange (val) {
|
||||
this.$db.read().set('picBed.pasteStyle', val)
|
||||
this.$db.read().set('settings.pasteStyle', val)
|
||||
.write()
|
||||
},
|
||||
uploadClipboardFiles () {
|
||||
|
@ -75,7 +75,7 @@
|
||||
this.notification.body = item.imgUrl
|
||||
this.notification.icon = item.imgUrl
|
||||
const myNotification = new window.Notification(this.notification.title, this.notification)
|
||||
const pasteStyle = this.$db.read().get('picBed.pasteStyle').value() || 'markdown'
|
||||
const pasteStyle = this.$db.read().get('settings.pasteStyle').value() || 'markdown'
|
||||
this.$electron.clipboard.writeText(pasteTemplate(pasteStyle, item.imgUrl))
|
||||
myNotification.onclick = () => {
|
||||
return true
|
||||
|
49
yarn.lock
49
yarn.lock
@ -2566,6 +2566,12 @@ debug@*, debug@^3.0.0, debug@^3.0.1, debug@^3.1.0:
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
debug@2, debug@2.6.9, debug@^2.1.3, debug@^2.2.0, debug@^2.6.0, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9:
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
debug@2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da"
|
||||
@ -2584,12 +2590,6 @@ debug@2.6.8:
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
debug@2.6.9, debug@^2.1.3, debug@^2.2.0, debug@^2.6.0, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9:
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||
@ -2616,6 +2616,10 @@ deepmerge@^1.2.0:
|
||||
version "1.5.2"
|
||||
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-1.5.2.tgz#10499d868844cdad4fee0842df8c7f6f0c95a753"
|
||||
|
||||
deepmerge@^2.0.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-2.1.1.tgz#e862b4e45ea0555072bf51e7fd0d9845170ae768"
|
||||
|
||||
deepmerge@~2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-2.0.1.tgz#25c1c24f110fb914f80001b925264dd77f3f4312"
|
||||
@ -4412,10 +4416,6 @@ image-size@^0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.6.1.tgz#98122a562d59dcc097ef1b2c8191866eb8f5d663"
|
||||
|
||||
image-size@^0.6.3:
|
||||
version "0.6.3"
|
||||
resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.6.3.tgz#e7e5c65bb534bd7cdcedd6cb5166272a85f75fb2"
|
||||
|
||||
import-lazy@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43"
|
||||
@ -5684,6 +5684,10 @@ negotiator@0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
|
||||
|
||||
next-tick@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"
|
||||
|
||||
nice-try@^1.0.4:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
|
||||
@ -6190,20 +6194,20 @@ performance-now@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
|
||||
|
||||
picgo@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/picgo/-/picgo-1.1.0.tgz#b9033815f40a77b7f471e478c33382622ccc54de"
|
||||
picgo@^1.1.7:
|
||||
version "1.1.7"
|
||||
resolved "https://registry.yarnpkg.com/picgo/-/picgo-1.1.7.tgz#04e6e9a4fdd97a7f1efc8cfc75ad869610f7c120"
|
||||
dependencies:
|
||||
chalk "^2.4.1"
|
||||
commander "^2.17.0"
|
||||
cross-spawn "^6.0.5"
|
||||
dayjs "^1.7.4"
|
||||
fs-extra "^6.0.1"
|
||||
image-size "^0.6.3"
|
||||
inquirer "^6.0.0"
|
||||
lodash-id "^0.14.0"
|
||||
lowdb "^1.0.0"
|
||||
md5 "^2.2.1"
|
||||
probe-image-size "^4.0.0"
|
||||
qiniu "^7.2.1"
|
||||
request "^2.87.0"
|
||||
request-promise-native "^1.0.5"
|
||||
@ -6581,6 +6585,17 @@ private@^0.1.6, private@^0.1.7, private@~0.1.5:
|
||||
version "0.1.8"
|
||||
resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"
|
||||
|
||||
probe-image-size@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/probe-image-size/-/probe-image-size-4.0.0.tgz#d35b71759e834bcf580ea9f18ec8b9265c0977eb"
|
||||
dependencies:
|
||||
any-promise "^1.3.0"
|
||||
deepmerge "^2.0.1"
|
||||
inherits "^2.0.3"
|
||||
next-tick "^1.0.0"
|
||||
request "^2.83.0"
|
||||
stream-parser "~0.3.1"
|
||||
|
||||
process-nextick-args@~1.0.6:
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3"
|
||||
@ -7743,6 +7758,12 @@ stream-http@^2.7.2:
|
||||
to-arraybuffer "^1.0.0"
|
||||
xtend "^4.0.0"
|
||||
|
||||
stream-parser@~0.3.1:
|
||||
version "0.3.1"
|
||||
resolved "https://registry.yarnpkg.com/stream-parser/-/stream-parser-0.3.1.tgz#1618548694420021a1182ff0af1911c129761773"
|
||||
dependencies:
|
||||
debug "2"
|
||||
|
||||
strict-uri-encode@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
|
||||
|
Loading…
Reference in New Issue
Block a user