mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-01-22 14:28:12 -05:00
🐛 Fix(db): fix some db bugs
#873,#806
This commit is contained in:
parent
8d861be161
commit
d3bb5caa83
48
.vscode/launch.json
vendored
48
.vscode/launch.json
vendored
@ -1,38 +1,36 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch",
|
||||
"name": "Electron: Main",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/src/main/index.dev.js",
|
||||
"env": {
|
||||
"DEBUG_ENV": "debug"
|
||||
},
|
||||
"stopOnEntry": false,
|
||||
"args": [],
|
||||
"cwd": "${workspaceRoot}",
|
||||
// this points to the electron task runner
|
||||
"protocol": "inspector",
|
||||
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
|
||||
"runtimeArgs": [
|
||||
"--nolazy"
|
||||
],
|
||||
"sourceMaps": true
|
||||
"windows": {
|
||||
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
|
||||
},
|
||||
"preLaunchTask": "electron-debug",
|
||||
"args": ["--remote-debugging-port=9223", "./dist_electron"],
|
||||
"outFiles": ["${workspaceFolder}/dist_electron/**/*.js"]
|
||||
},
|
||||
{
|
||||
"name": "Attach",
|
||||
"type": "node",
|
||||
"name": "Electron: Renderer",
|
||||
"type": "chrome",
|
||||
"request": "attach",
|
||||
"port": 5858,
|
||||
"sourceMaps": true,
|
||||
"restart": true,
|
||||
"outFiles": [],
|
||||
"localRoot": "${workspaceRoot}",
|
||||
"protocol": "inspector",
|
||||
"remoteRoot": null
|
||||
"port": 9223,
|
||||
"urlFilter": "http://localhost:*",
|
||||
"timeout": 30000,
|
||||
"webRoot": "${workspaceFolder}/src",
|
||||
"sourceMapPathOverrides": {
|
||||
"webpack:///./src/*": "${webRoot}/*"
|
||||
}
|
||||
}
|
||||
],
|
||||
"compounds": [
|
||||
{
|
||||
"name": "Electron: All",
|
||||
"configurations": ["Electron: Main", "Electron: Renderer"]
|
||||
}
|
||||
]
|
||||
}
|
27
.vscode/tasks.json
vendored
Normal file
27
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "electron-debug",
|
||||
"type": "process",
|
||||
"command": "./node_modules/.bin/vue-cli-service",
|
||||
"windows": {
|
||||
"command": "./node_modules/.bin/vue-cli-service.cmd"
|
||||
},
|
||||
"isBackground": true,
|
||||
"args": ["electron:serve", "--debug"],
|
||||
"problemMatcher": {
|
||||
"owner": "custom",
|
||||
"pattern": {
|
||||
"regexp": ""
|
||||
},
|
||||
"background": {
|
||||
"beginsPattern": "Starting development server\\.\\.\\.",
|
||||
"endsPattern": "Not launching electron as debug argument was passed\\."
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
"bump": "bump-version",
|
||||
"release": "vue-cli-service electron:build --publish always"
|
||||
},
|
||||
"main": "background.js",
|
||||
"main": "index.js",
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
||||
@ -36,7 +36,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@picgo/i18n": "^1.0.0",
|
||||
"@picgo/store": "^1.0.3",
|
||||
"@picgo/store": "2.0.1",
|
||||
"axios": "^0.19.0",
|
||||
"core-js": "^3.3.2",
|
||||
"element-ui": "^2.13.0",
|
||||
@ -44,7 +44,7 @@
|
||||
"keycode": "^2.2.0",
|
||||
"lodash-id": "^0.14.0",
|
||||
"lowdb": "^1.0.0",
|
||||
"picgo": "^1.5.0-alpha.3",
|
||||
"picgo": "^1.5.0-alpha.4",
|
||||
"qrcode.vue": "^1.7.0",
|
||||
"shell-path": "2.1.0",
|
||||
"uuidv4": "^6.2.11",
|
||||
|
@ -177,7 +177,7 @@ class ShortKeyHandler {
|
||||
keyList.forEach(item => {
|
||||
globalShortcut.unregister(item.key)
|
||||
shortKeyService.unregisterCommand(item.command)
|
||||
picgo.unsetConfig('settings.shortKey', item.command)
|
||||
db.unset('settings.shortKey', item.command)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import logger from '@core/picgo/logger'
|
||||
import { T } from '~/universal/i18n'
|
||||
import fse from 'fs-extra'
|
||||
import path from 'path'
|
||||
import { privacyManager } from '~/main/utils/privacyManager'
|
||||
|
||||
const waitForShow = (webcontent: WebContents) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
@ -140,6 +141,10 @@ class Uploader {
|
||||
|
||||
async upload (img?: IUploadOption): Promise<ImgInfo[]|false> {
|
||||
try {
|
||||
const privacyCheckRes = await privacyManager.check()
|
||||
if (!privacyCheckRes) {
|
||||
throw Error(T('PRIVACY_TIPS'))
|
||||
}
|
||||
const startTime = Date.now()
|
||||
const output = await picgo.upload(img)
|
||||
if (Array.isArray(output) && output.some((item: ImgInfo) => item.imgUrl)) {
|
||||
|
@ -1,10 +1,6 @@
|
||||
import Datastore from 'lowdb'
|
||||
// @ts-ignore
|
||||
import LodashId from 'lodash-id'
|
||||
import FileSync from 'lowdb/adapters/FileSync'
|
||||
import fs from 'fs-extra'
|
||||
import { dbPathChecker, dbPathDir, getGalleryDBPath } from './dbChecker'
|
||||
import { DBStore } from '@picgo/store'
|
||||
import { DBStore, JSONStore } from '@picgo/store'
|
||||
import { T } from '~/universal/i18n'
|
||||
|
||||
const STORE_PATH = dbPathDir()
|
||||
@ -15,68 +11,55 @@ if (!fs.pathExistsSync(STORE_PATH)) {
|
||||
const CONFIG_PATH: string = dbPathChecker()
|
||||
const DB_PATH: string = getGalleryDBPath().dbPath
|
||||
|
||||
// TODO: use JSONStore with @picgo/store
|
||||
class ConfigStore {
|
||||
private db: Datastore.LowdbSync<Datastore.AdapterSync>
|
||||
private db: JSONStore
|
||||
constructor () {
|
||||
const adapter = new FileSync(CONFIG_PATH)
|
||||
this.db = new JSONStore(CONFIG_PATH)
|
||||
|
||||
this.db = Datastore(adapter)
|
||||
this.db._.mixin(LodashId)
|
||||
|
||||
if (!this.db.has('picBed').value()) {
|
||||
if (!this.db.has('picBed')) {
|
||||
this.db.set('picBed', {
|
||||
current: 'smms', // deprecated
|
||||
uploader: 'smms',
|
||||
smms: {
|
||||
token: ''
|
||||
}
|
||||
}).write()
|
||||
})
|
||||
}
|
||||
|
||||
if (!this.db.has('settings.shortKey').value()) {
|
||||
if (!this.db.has('settings.shortKey')) {
|
||||
this.db.set('settings.shortKey[picgo:upload]', {
|
||||
enable: true,
|
||||
key: 'CommandOrControl+Shift+P',
|
||||
name: 'upload',
|
||||
label: T('QUICK_UPLOAD')
|
||||
}).write()
|
||||
})
|
||||
}
|
||||
this.read()
|
||||
}
|
||||
|
||||
read () {
|
||||
return this.db.read()
|
||||
read (flush = false) {
|
||||
// if flush -> true, read origin file again
|
||||
this.db.read(flush)
|
||||
return this.db
|
||||
}
|
||||
|
||||
get (key = '') {
|
||||
return this.read().get(key).value()
|
||||
get (key = ''): any {
|
||||
if (key === '') {
|
||||
return this.db.read()
|
||||
}
|
||||
return this.db.get(key)
|
||||
}
|
||||
|
||||
set (key: string, value: any) {
|
||||
return this.read().set(key, value).write()
|
||||
set (key: string, value: any): void {
|
||||
return this.db.set(key, value)
|
||||
}
|
||||
|
||||
has (key: string) {
|
||||
return this.read().has(key).value()
|
||||
}
|
||||
|
||||
insert (key: string, value: any): void {
|
||||
// @ts-ignore
|
||||
return this.read().get(key).insert(value).write()
|
||||
return this.db.has(key)
|
||||
}
|
||||
|
||||
unset (key: string, value: any): boolean {
|
||||
return this.read().get(key).unset(value).value()
|
||||
}
|
||||
|
||||
getById (key: string, id: string) {
|
||||
// @ts-ignore
|
||||
return this.read().get(key).getById(id).value()
|
||||
}
|
||||
|
||||
removeById (key: string, id: string) {
|
||||
// @ts-ignore
|
||||
return this.read().get(key).removeById(id).write()
|
||||
return this.db.unset(key, value)
|
||||
}
|
||||
|
||||
getConfigPath () {
|
||||
@ -84,7 +67,9 @@ class ConfigStore {
|
||||
}
|
||||
}
|
||||
|
||||
export default new ConfigStore()
|
||||
const db = new ConfigStore()
|
||||
|
||||
export default db
|
||||
|
||||
// v2.3.0 add gallery db
|
||||
class GalleryDB {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { dbChecker, dbPathChecker } from 'apis/core/datastore/dbChecker'
|
||||
import pkg from 'root/package.json'
|
||||
import { PicGo } from 'picgo'
|
||||
import db from 'apis/core/datastore'
|
||||
|
||||
const CONFIG_PATH = dbPathChecker()
|
||||
|
||||
@ -15,4 +16,14 @@ picgo.saveConfig({
|
||||
global.PICGO_GUI_VERSION = pkg.version
|
||||
picgo.GUI_VERSION = global.PICGO_GUI_VERSION
|
||||
|
||||
const originPicGoSaveConfig = picgo.saveConfig.bind(picgo)
|
||||
|
||||
picgo.saveConfig = (config: IStringKeyMap) => {
|
||||
originPicGoSaveConfig(config)
|
||||
// flush electron's db
|
||||
setTimeout(() => {
|
||||
db.read(true)
|
||||
}, 0)
|
||||
}
|
||||
|
||||
export default picgo
|
||||
|
@ -146,6 +146,27 @@ class GuiApi implements IGuiApi {
|
||||
get galleryDB (): DBStore {
|
||||
return new Proxy<DBStore>(GalleryDB.getInstance(), {
|
||||
get (target, prop: keyof DBStore) {
|
||||
if (prop === 'overwrite') {
|
||||
return new Proxy(GalleryDB.getInstance().overwrite, {
|
||||
apply (target, ctx, args) {
|
||||
return new Promise((resolve) => {
|
||||
const guiApi = GuiApi.getInstance()
|
||||
guiApi.showMessageBox({
|
||||
title: T('TIPS_WARNING'),
|
||||
message: T('TIPS_PLUGIN_REMOVE_GALLERY_ITEM'),
|
||||
type: 'info',
|
||||
buttons: ['Yes', 'No']
|
||||
}).then(res => {
|
||||
if (res.result === 0) {
|
||||
resolve(Reflect.apply(target, ctx, args))
|
||||
} else {
|
||||
resolve(undefined)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
if (prop === 'removeById') {
|
||||
return new Proxy(GalleryDB.getInstance().removeById, {
|
||||
apply (target, ctx, args) {
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
import { IPasteStyle, IPicGoHelperType, IWindowList } from '#/types/enum'
|
||||
import shortKeyHandler from 'apis/app/shortKey/shortKeyHandler'
|
||||
import picgo from '@core/picgo'
|
||||
import { handleStreamlinePluginName } from '~/universal/utils/common'
|
||||
import { handleStreamlinePluginName, simpleClone } from '~/universal/utils/common'
|
||||
import { IGuiMenuItem, PicGo as PicGoCore } from 'picgo'
|
||||
import windowManager from 'apis/app/window/windowManager'
|
||||
import { showNotification } from '~/main/utils/common'
|
||||
@ -128,10 +128,19 @@ const getPluginList = (): IPicGoPlugin[] => {
|
||||
|
||||
const handleGetPluginList = () => {
|
||||
ipcMain.on('getPluginList', (event: IpcMainEvent) => {
|
||||
const list = getPluginList()
|
||||
// here can just send JS Object not function
|
||||
// or will cause [Failed to serialize arguments] error
|
||||
event.sender.send('pluginList', list)
|
||||
try {
|
||||
const list = simpleClone(getPluginList())
|
||||
// here can just send JS Object not function
|
||||
// or will cause [Failed to serialize arguments] error
|
||||
event.sender.send('pluginList', list)
|
||||
} catch (e: any) {
|
||||
event.sender.send('pluginList', [])
|
||||
showNotification({
|
||||
title: T('TIPS_GET_PLUGIN_LIST_FAILED'),
|
||||
body: e.message
|
||||
})
|
||||
picgo.log.error(e)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -267,8 +276,16 @@ const handleImportLocalPlugin = () => {
|
||||
if (filePaths.length > 0) {
|
||||
const res = await picgo.pluginHandler.install(filePaths)
|
||||
if (res.success) {
|
||||
const list = getPluginList()
|
||||
event.sender.send('pluginList', list)
|
||||
try {
|
||||
const list = simpleClone(getPluginList())
|
||||
event.sender.send('pluginList', list)
|
||||
} catch (e: any) {
|
||||
event.sender.send('pluginList', [])
|
||||
showNotification({
|
||||
title: T('TIPS_GET_PLUGIN_LIST_FAILED'),
|
||||
body: e.message
|
||||
})
|
||||
}
|
||||
showNotification({
|
||||
title: T('PLUGIN_IMPORT_SUCCEED'),
|
||||
body: ''
|
||||
|
@ -31,7 +31,6 @@ import shortKeyHandler from 'apis/app/shortKey/shortKeyHandler'
|
||||
import { getUploadFiles } from '~/main/utils/handleArgv'
|
||||
import db, { GalleryDB } from '~/main/apis/core/datastore'
|
||||
import bus from '@core/bus'
|
||||
import { privacyManager } from '~/main/utils/privacyManager'
|
||||
import logger from 'apis/core/picgo/logger'
|
||||
import picgo from 'apis/core/picgo'
|
||||
import fixPath from './fixPath'
|
||||
@ -81,10 +80,6 @@ class LifeCycle {
|
||||
console.error('Vue Devtools failed to install:', e.toString())
|
||||
}
|
||||
}
|
||||
const res = await privacyManager.init()
|
||||
if (!res) {
|
||||
return app.quit()
|
||||
}
|
||||
windowManager.create(IWindowList.TRAY_WINDOW)
|
||||
windowManager.create(IWindowList.SETTING_WINDOW)
|
||||
createTray()
|
||||
|
@ -34,7 +34,7 @@ const updateShortKeyFromVersion212 = (db: typeof ConfigStore, shortKeyConfig: IS
|
||||
}
|
||||
|
||||
const migrateGalleryFromVersion230 = async (configDB: typeof ConfigStore, galleryDB: DBStore, picgo: PicGoCore) => {
|
||||
const originGallery: ImgInfo[] = configDB.get('uploaded')
|
||||
const originGallery: ImgInfo[] = picgo.getConfig('uploaded')
|
||||
// if hasMigrate, we don't need to migrate
|
||||
const hasMigrate: boolean = configDB.get('__migrateUploaded')
|
||||
if (hasMigrate) {
|
||||
|
@ -10,6 +10,11 @@ const getPicBeds = () => {
|
||||
name: picgo.helper.uploader.get(item)!.name || item,
|
||||
visible: visible ? visible.visible : true
|
||||
}
|
||||
}).sort((a) => {
|
||||
if (a.type === 'tcyun') {
|
||||
return -1
|
||||
}
|
||||
return 0
|
||||
}) as IPicBedType[]
|
||||
return picBeds
|
||||
}
|
||||
|
@ -1,14 +1,9 @@
|
||||
import db from '~/main/apis/core/datastore'
|
||||
import { ipcMain } from 'electron'
|
||||
import { showMessageBox } from '~/main/utils/common'
|
||||
import { SHOW_PRIVACY_MESSAGE } from '~/universal/events/constants'
|
||||
import { T } from '~/universal/i18n'
|
||||
|
||||
class PrivacyManager {
|
||||
async init () {
|
||||
ipcMain.on(SHOW_PRIVACY_MESSAGE, () => {
|
||||
this.show(false)
|
||||
})
|
||||
async check () {
|
||||
if (db.get('settings.privacyEnsure') !== true) {
|
||||
const res = await this.show(true)
|
||||
// cancel
|
||||
|
@ -72,6 +72,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import mixin from '@/utils/ConfirmButtonMixin'
|
||||
import { trimValues } from '@/utils/common'
|
||||
@Component({
|
||||
name: 'aliyun',
|
||||
mixins: [mixin]
|
||||
@ -99,7 +100,7 @@ export default class extends Vue {
|
||||
this.$refs.aliyun.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveConfig({
|
||||
'picBed.aliyun': this.form
|
||||
'picBed.aliyun': trimValues(this.form)
|
||||
})
|
||||
const successNotification = new window.Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
|
@ -59,6 +59,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import mixin from '@/utils/ConfirmButtonMixin'
|
||||
import { trimValues } from '@/utils/common'
|
||||
@Component({
|
||||
name: 'github',
|
||||
mixins: [mixin]
|
||||
@ -84,7 +85,7 @@ export default class extends Vue {
|
||||
this.$refs.github.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveConfig({
|
||||
'picBed.github': this.form
|
||||
'picBed.github': trimValues(this.form)
|
||||
})
|
||||
const successNotification = new Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
|
@ -39,6 +39,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import mixin from '@/utils/ConfirmButtonMixin'
|
||||
import { trimValues } from '@/utils/common'
|
||||
@Component({
|
||||
name: 'imgur',
|
||||
mixins: [mixin]
|
||||
@ -61,7 +62,7 @@ export default class extends Vue {
|
||||
this.$refs.imgur.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveConfig({
|
||||
'picBed.imgur': this.form
|
||||
'picBed.imgur': trimValues(this.form)
|
||||
})
|
||||
const successNotification = new Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
|
@ -35,6 +35,7 @@ import {
|
||||
ipcRenderer,
|
||||
IpcRendererEvent
|
||||
} from 'electron'
|
||||
import { trimValues } from '@/utils/common'
|
||||
|
||||
@Component({
|
||||
name: 'OtherPicBed',
|
||||
@ -58,7 +59,7 @@ export default class extends Vue {
|
||||
const result = await this.$refs.configForm.validate()
|
||||
if (result !== false) {
|
||||
this.saveConfig({
|
||||
[`picBed.${this.type}`]: result
|
||||
[`picBed.${this.type}`]: trimValues(result)
|
||||
})
|
||||
const successNotification = new Notification(this.$T('SETTINGS_RESULT'), {
|
||||
body: this.$T('TIPS_SET_SUCCEED')
|
||||
|
@ -74,6 +74,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import mixin from '@/utils/ConfirmButtonMixin'
|
||||
import { trimValues } from '@/utils/common'
|
||||
@Component({
|
||||
name: 'qiniu',
|
||||
mixins: [mixin]
|
||||
@ -101,7 +102,7 @@ export default class extends Vue {
|
||||
this.$refs.qiniu.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveConfig({
|
||||
'picBed.qiniu': this.form
|
||||
'picBed.qiniu': trimValues(this.form)
|
||||
})
|
||||
const successNotification = new Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
|
@ -33,6 +33,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import mixin from '@/utils/ConfirmButtonMixin'
|
||||
import { trimValues } from '@/utils/common'
|
||||
@Component({
|
||||
name: 'smms',
|
||||
mixins: [mixin]
|
||||
@ -54,7 +55,7 @@ export default class extends Vue {
|
||||
this.$refs.smms.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveConfig({
|
||||
'picBed.smms': this.form
|
||||
'picBed.smms': trimValues(this.form)
|
||||
})
|
||||
const successNotification = new window.Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
|
@ -96,6 +96,7 @@ import { Component, Vue } from 'vue-property-decorator'
|
||||
import mixin from '@/utils/ConfirmButtonMixin'
|
||||
import { OPEN_URL } from '#/events/constants'
|
||||
import { ITcyunConfig } from 'picgo/dist/types'
|
||||
import { trimValues } from '@/utils/common'
|
||||
@Component({
|
||||
name: 'tcyun',
|
||||
mixins: [mixin]
|
||||
@ -125,7 +126,7 @@ export default class extends Vue {
|
||||
this.$refs.tcyun.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveConfig({
|
||||
'picBed.tcyun': this.form
|
||||
'picBed.tcyun': trimValues(this.form)
|
||||
})
|
||||
const successNotification = new window.Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
|
@ -68,6 +68,7 @@
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import mixin from '@/utils/ConfirmButtonMixin'
|
||||
import { IUpyunConfig } from 'picgo/dist/types'
|
||||
import { trimValues } from '@/utils/common'
|
||||
@Component({
|
||||
name: 'upyun',
|
||||
mixins: [mixin]
|
||||
@ -94,7 +95,7 @@ export default class extends Vue {
|
||||
this.$refs.tcyun.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveConfig({
|
||||
'picBed.upyun': this.form
|
||||
'picBed.upyun': trimValues(this.form)
|
||||
})
|
||||
const successNotification = new Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
|
@ -8,3 +8,11 @@ export const handleTalkingDataEvent = (data: ITalkingDataOptions) => {
|
||||
console.log('talkingData', data)
|
||||
}
|
||||
}
|
||||
|
||||
export const trimValues = (obj: IStringKeyMap) => {
|
||||
const newObj = {} as IStringKeyMap
|
||||
Object.keys(obj).forEach(key => {
|
||||
newObj[key] = typeof obj[key] === 'string' ? obj[key].trim() : obj[key]
|
||||
})
|
||||
return newObj
|
||||
}
|
||||
|
@ -157,6 +157,7 @@ export const EN: ILocales = {
|
||||
TIPS_SET_SUCCEED: 'Set successfully',
|
||||
TIPS_PLUGIN_NOT_GUI_IMPLEMENT: 'This plugin is not optimized for the GUI, continue?',
|
||||
TIPS_CLICK_NOTIFICATION_TO_RELOAD: 'Click notification to reload app',
|
||||
TIPS_GET_PLUGIN_LIST_FAILED: 'Get plugin list failed',
|
||||
// ---renderer i18n end---
|
||||
|
||||
// plugins
|
||||
@ -177,7 +178,8 @@ export const EN: ILocales = {
|
||||
TIPS_WARNING: 'Warning',
|
||||
TIPS_ERROR: 'Error',
|
||||
TIPS_INSTALL_NODE_AND_RELOAD_PICGO: 'Please install Node.js and restart PicGo to continue',
|
||||
TIPS_PLUGIN_REMOVE_GALLERY_ITEM: 'Plugin is trying to remove some images from the album, continue?',
|
||||
TIPS_PLUGIN_REMOVE_GALLERY_ITEM: 'Plugin is trying to remove some images from the album gallery, continue?',
|
||||
TIPS_PLUGIN_OVERWRITE_GALLERY: 'Plugin is trying to overwrite the album gallery, continue?',
|
||||
TIPS_UPLOAD_NOT_PICTURES: 'The latest clipboard item is not a picture',
|
||||
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_DEFAULT: 'PicGo config file broken, has been restored to default',
|
||||
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_BACKUP: 'PicGo config file broken, has been restored to backup',
|
||||
@ -212,6 +214,7 @@ c) If you violate relevant Chinese laws, regulations or relevant rules, you need
|
||||
|
||||
a) This software does not collect your personal information, key information and other private information, and the collected information is only used for improving the software, optimizing the experience, and understanding the daily activities of the software.
|
||||
`,
|
||||
PRIVACY_TIPS: 'Please agree the privacy policy to upload',
|
||||
// action
|
||||
QUIT: 'Quit'
|
||||
}
|
||||
|
@ -156,6 +156,7 @@ export const ZH_CN = {
|
||||
TIPS_SET_SUCCEED: '设置成功',
|
||||
TIPS_PLUGIN_NOT_GUI_IMPLEMENT: '该插件未对可视化界面进行优化, 是否继续安装?',
|
||||
TIPS_CLICK_NOTIFICATION_TO_RELOAD: '请点击此通知重启应用以生效',
|
||||
TIPS_GET_PLUGIN_LIST_FAILED: '获取插件列表失败',
|
||||
// ---renderer i18n end---
|
||||
|
||||
// plugins
|
||||
@ -177,6 +178,7 @@ export const ZH_CN = {
|
||||
TIPS_ERROR: '发生错误',
|
||||
TIPS_INSTALL_NODE_AND_RELOAD_PICGO: '请安装Node.js并重启PicGo再继续操作',
|
||||
TIPS_PLUGIN_REMOVE_GALLERY_ITEM: '有插件正在试图删除一些相册图片,是否继续',
|
||||
TIPS_PLUGIN_OVERWRITE_GALLERY: '有插件正在试图覆盖相册列表,是否继续',
|
||||
TIPS_UPLOAD_NOT_PICTURES: '剪贴板最新的一条记录不是图片',
|
||||
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_DEFAULT: 'PicGo 配置文件损坏,已经恢复为默认配置',
|
||||
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_BACKUP: 'PicGo 配置文件损坏,已经恢复为备份配置',
|
||||
@ -211,6 +213,7 @@ c)如您出现违反中国有关法律、法规或者相关规则的情况,需
|
||||
|
||||
a)本软件不会收集您的个人信息、密钥信息等隐私信息,所收集的信息仅仅作为改善软件、优化体验、了解软件日活等用途。
|
||||
`,
|
||||
PRIVACY_TIPS: '请同意隐私协议,否则无法上传。',
|
||||
// action
|
||||
QUIT: '退出'
|
||||
}
|
||||
|
@ -30,3 +30,10 @@ export const handleStreamlinePluginName = (name: string) => {
|
||||
return name.replace(/picgo-plugin-/, '')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* for just simple clone an object
|
||||
*/
|
||||
export const simpleClone = (obj: any) => {
|
||||
return JSON.parse(JSON.stringify(obj))
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ const config = {
|
||||
.set('#', resolve('src/universal'))
|
||||
.set('apis', resolve('src/main/apis'))
|
||||
.set('@core', resolve('src/main/apis/core'))
|
||||
config.resolve.mainFields
|
||||
.clear()
|
||||
.add('main') // fix some modules will use browser target
|
||||
.add('module')
|
||||
},
|
||||
builderOptions: {
|
||||
productName: 'PicGo',
|
||||
|
61
yarn.lock
61
yarn.lock
@ -1109,6 +1109,18 @@
|
||||
dependencies:
|
||||
chalk "^4.0.0"
|
||||
|
||||
"@commonify/lowdb@^3.0.0":
|
||||
version "3.0.0"
|
||||
resolved "https://registry.npmmirror.com/@commonify/lowdb/-/lowdb-3.0.0.tgz#09c33ffd19057eab67440a1dc22847569407cafe"
|
||||
integrity sha512-GwZq68zStvMENxEzN6EE8pacgY2Rlrs5L00BpvB6NvpDW96JUxIa8PJXd9T7qIdx07ro0ITBtw6HfSJw/qboGw==
|
||||
dependencies:
|
||||
"@commonify/steno" "2.1.0"
|
||||
|
||||
"@commonify/steno@2.1.0", "@commonify/steno@^2.1.0":
|
||||
version "2.1.0"
|
||||
resolved "https://registry.npmmirror.com/@commonify/steno/-/steno-2.1.0.tgz#7d1e68a0e239bf4fd35abfd167006a3e56140b28"
|
||||
integrity sha512-3W0LmYb84EU82Ky18M+D0tB33W66ccoC/Ot/8mm3uBQFuaTpiWaoxntQGBTL3+bIpV4e77ks53IE3sy9BRFBxA==
|
||||
|
||||
"@cspotcode/source-map-consumer@0.8.0":
|
||||
version "0.8.0"
|
||||
resolved "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b"
|
||||
@ -1332,17 +1344,21 @@
|
||||
chalk "4.1.2"
|
||||
tslib "^2.3.1"
|
||||
|
||||
"@picgo/store@^1.0.3":
|
||||
version "1.0.3"
|
||||
resolved "https://registry.npmjs.org/@picgo/store/-/store-1.0.3.tgz#cfe346ad30c80f378e0bc81311e7468df436bc1f"
|
||||
integrity sha512-quyu56yuUsFFJGQ88suTwUSEzKosZPzR1M52eyqzyQ2HZWZVn0pa/eBBsh7OYefS0V13YLR5llnIkQaL8y11Ww==
|
||||
"@picgo/store@2.0.1":
|
||||
version "2.0.1"
|
||||
resolved "https://registry.npmmirror.com/@picgo/store/-/store-2.0.1.tgz#9dce62a6e61e5539c06d261628c1c6c29b8e07eb"
|
||||
integrity sha512-DLv1/EpSWNec8AAFxVCHSFfArotuU4WdUs3KZePtDK7nwKYIqQMnfcCYOUadoAZn3mn1hS1byv7i26qyIPcKaw==
|
||||
dependencies:
|
||||
"@commonify/lowdb" "^3.0.0"
|
||||
"@commonify/steno" "^2.1.0"
|
||||
"@types/bson" "^4.0.1"
|
||||
"@types/graceful-fs" "^4.1.3"
|
||||
bson "^4.0.3"
|
||||
"@types/lodash" "^4.14.182"
|
||||
comment-json "^4.1.0"
|
||||
fflate "^0.7.3"
|
||||
lodash "^4.17.21"
|
||||
lodash-id "^0.14.0"
|
||||
lowdb "^1.0.0"
|
||||
write-file-atomic "^4.0.1"
|
||||
|
||||
"@sindresorhus/is@^0.14.0":
|
||||
version "0.14.0"
|
||||
@ -1514,6 +1530,11 @@
|
||||
resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.178.tgz#341f6d2247db528d4a13ddbb374bcdc80406f4f8"
|
||||
integrity sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==
|
||||
|
||||
"@types/lodash@^4.14.182":
|
||||
version "4.14.182"
|
||||
resolved "https://registry.npmmirror.com/@types/lodash/-/lodash-4.14.182.tgz#05301a4d5e62963227eaafe0ce04dd77c54ea5c2"
|
||||
integrity sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==
|
||||
|
||||
"@types/lowdb@^1.0.9":
|
||||
version "1.0.11"
|
||||
resolved "https://registry.npmjs.org/@types/lowdb/-/lowdb-1.0.11.tgz#d8336a635ea0dbd48a7f6f62fb9fccc5ec358ae3"
|
||||
@ -3087,7 +3108,7 @@ browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.17.5, browserslist@^4
|
||||
node-releases "^2.0.1"
|
||||
picocolors "^1.0.0"
|
||||
|
||||
bson@*, bson@^4.0.3:
|
||||
bson@*:
|
||||
version "4.6.0"
|
||||
resolved "https://registry.npmjs.org/bson/-/bson-4.6.0.tgz#15c3b39ba3940c3d915a0c44d51459f4b4fbf1b2"
|
||||
integrity sha512-8jw1NU1hglS+Da1jDOUYuNcBJ4cNHCFIqzlwoFNnsTOg2R/ox0aTYcTiBN4dzRa9q7Cvy6XErh3L8ReTEb9AQQ==
|
||||
@ -5994,6 +6015,11 @@ fd-slicer@~1.1.0:
|
||||
dependencies:
|
||||
pend "~1.2.0"
|
||||
|
||||
fflate@^0.7.3:
|
||||
version "0.7.3"
|
||||
resolved "https://registry.npmmirror.com/fflate/-/fflate-0.7.3.tgz#288b034ff0e9c380eaa2feff48c787b8371b7fa5"
|
||||
integrity sha512-0Zz1jOzJWERhyhsimS54VTqOteCNwRtIlh8isdL0AXLo0g7xNTfTL7oWrkmCnPhZGocKIkWHBistBrrpoNH3aw==
|
||||
|
||||
figgy-pudding@^3.5.1:
|
||||
version "3.5.2"
|
||||
resolved "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz#b4eee8148abb01dcf1d1ac34367d59e12fa61d6e"
|
||||
@ -9782,10 +9808,10 @@ performance-now@^2.1.0:
|
||||
resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
|
||||
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
|
||||
|
||||
picgo@^1.5.0-alpha.3:
|
||||
version "1.5.0-alpha.3"
|
||||
resolved "https://registry.npmmirror.com/picgo/-/picgo-1.5.0-alpha.3.tgz#1d30de78d0a963de131b6a3739706160a6a7598f"
|
||||
integrity sha512-87jotY0snEjQrjmy0Ka46ZvKLjPlfGOghRs5ArvDDZ8g2l5PuikXAyu8AEFxc2WcJ8RiMwjG/tbS15l1dzM5JQ==
|
||||
picgo@^1.5.0-alpha.4:
|
||||
version "1.5.0-alpha.4"
|
||||
resolved "https://registry.npmmirror.com/picgo/-/picgo-1.5.0-alpha.4.tgz#bca46bf6124a2855222c8536bd4e3522ebf2699c"
|
||||
integrity sha512-igNNBHSZywwTvtA28TtwoXJtO8omgDu+8TX3em2c4F1e4yHSmPsTJdWbHSf69KujULs0J0SV11eLp8gyI3B7nw==
|
||||
dependencies:
|
||||
"@picgo/i18n" "^1.0.0"
|
||||
chalk "^2.4.1"
|
||||
@ -11313,6 +11339,11 @@ signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3:
|
||||
resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz#24e630c4b0f03fea446a2bd299e62b4a6ca8d0af"
|
||||
integrity sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==
|
||||
|
||||
signal-exit@^3.0.7:
|
||||
version "3.0.7"
|
||||
resolved "https://registry.npmmirror.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
|
||||
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
|
||||
|
||||
simple-swizzle@^0.2.2:
|
||||
version "0.2.2"
|
||||
resolved "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
|
||||
@ -13237,6 +13268,14 @@ write-file-atomic@^3.0.0:
|
||||
signal-exit "^3.0.2"
|
||||
typedarray-to-buffer "^3.1.5"
|
||||
|
||||
write-file-atomic@^4.0.1:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.npmmirror.com/write-file-atomic/-/write-file-atomic-4.0.1.tgz#9faa33a964c1c85ff6f849b80b42a88c2c537c8f"
|
||||
integrity sha512-nSKUxgAbyioruk6hU87QzVbY279oYT6uiwgDoujth2ju4mJ+TZau7SQBhtbTmUyuNYTuXnSyRn66FV0+eCgcrQ==
|
||||
dependencies:
|
||||
imurmurhash "^0.1.4"
|
||||
signal-exit "^3.0.7"
|
||||
|
||||
ws@^6.0.0, ws@^6.2.1:
|
||||
version "6.2.2"
|
||||
resolved "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz#dd5cdbd57a9979916097652d78f1cc5faea0c32e"
|
||||
|
Loading…
Reference in New Issue
Block a user