Added: clipboard image handler for picgo-core

This commit is contained in:
Molunerfinn
2018-12-20 17:23:03 +08:00
parent 8ff7d15f8d
commit 405548426a
5 changed files with 96 additions and 1 deletions

View File

@@ -5,6 +5,13 @@ import path from 'path'
import fs from 'fs-extra'
import { remote, app } from 'electron'
if (process.env.NODE_ENV !== 'development') {
global.__static = path.join(__dirname, '/static').replace(/\\/g, '\\\\')
}
if (process.env.DEBUG_ENV === 'debug') {
global.__static = path.join(__dirname, '../../static').replace(/\\/g, '\\\\')
}
const APP = process.type === 'renderer' ? remote.app : app
const STORE_PATH = APP.getPath('userData')
@@ -35,4 +42,11 @@ if (!db.has('settings.shortKey').value()) {
}).write()
}
// init generate clipboard image files
if (!fs.pathExistsSync(path.join(STORE_PATH, 'windows.ps1'))) {
fs.copySync(path.join(__static, '/linux.sh'), path.join(STORE_PATH, '/linux.sh'))
fs.copySync(path.join(__static, '/mac.applescript'), path.join(STORE_PATH, '/mac.applescript'))
fs.copySync(path.join(__static, '/windows.ps1'), path.join(STORE_PATH, '/windows.ps1'))
}
export default db

View File

@@ -84,8 +84,9 @@ class Uploader {
upload () {
const win = BrowserWindow.fromWebContents(this.webContents)
const picgo = new PicGo(CONFIG_PATH)
console.log(picgo.pluginLoader.getList())
picgo.config.debug = true
// for picgo-core
picgo.config.PICGO_ENV = 'GUI'
let input = this.img
picgo.helper.beforeUploadPlugins.register('renameFn', {