mirror of
https://github.com/Molunerfinn/PicGo.git
synced 2024-04-21 10:31:33 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e5eee7876 | ||
|
|
00689a9931 | ||
|
|
06539d1513 | ||
|
|
74b94feb74 | ||
|
|
757a7d1260 | ||
|
|
2496c0b467 | ||
|
|
4a685e0474 | ||
|
|
9fdd54ca16 | ||
|
|
eaa348ad56 | ||
|
|
282b0dc25c | ||
|
|
d99e45a021 | ||
|
|
ef8bf5476c | ||
|
|
d042c93bec | ||
|
|
ad71117876 | ||
|
|
fe7f688488 | ||
|
|
65a15724a3 | ||
|
|
422aa52763 | ||
|
|
eecf98e452 | ||
|
|
975927ac68 | ||
|
|
9ef615cab4 | ||
|
|
fb236c3186 | ||
|
|
458087a94e | ||
|
|
4e8dfef6cb | ||
|
|
e1c151e310 | ||
|
|
25068a8949 | ||
|
|
4010a09fe4 | ||
|
|
f6536b1dc2 | ||
|
|
df39511cdf | ||
|
|
504690b729 | ||
|
|
937979ae3d | ||
|
|
1f373fb325 | ||
|
|
92b9fbcee8 | ||
|
|
37a784225e | ||
|
|
16fe016c70 | ||
|
|
406cfffbc9 | ||
|
|
e5d5bad115 | ||
|
|
7364ea6ddf | ||
|
|
f657026820 | ||
|
|
e8e78303a3 | ||
|
|
29fb9c742e | ||
|
|
16f518b2ad | ||
|
|
790367efd6 | ||
|
|
7e9fd9d14e | ||
|
|
9df9b547d1 | ||
|
|
26f6627b44 | ||
|
|
dc9d5d6dfb | ||
|
|
b4c760c8cd |
@@ -133,7 +133,8 @@ let rendererConfig = {
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.join(__dirname, '../src/renderer'),
|
||||
'vue$': 'vue/dist/vue.esm.js'
|
||||
'vue$': 'vue/dist/vue.esm.js',
|
||||
'utils': path.join(__dirname, '../src/renderer/utils')
|
||||
},
|
||||
extensions: ['.js', '.vue', '.json', '.css', '.node']
|
||||
},
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<!--
|
||||
PicGo Issue 模板
|
||||
请依照该模板来提交,否则将会被关闭。
|
||||
-->
|
||||
|
||||
## 问题类型
|
||||
|
||||
<!-- 你要提交的是Bug Report还是Feature Request?-->
|
||||
|
||||
## PicGo的相关信息
|
||||
|
||||
<!-- 版本、所在平台(Mac或者Windows) -->
|
||||
|
||||
## 问题重现
|
||||
|
||||
<!-- 如果是Bug Report请填写本项 -->
|
||||
<!-- 请附上相关截图 -->
|
||||
|
||||
## 功能请求
|
||||
|
||||
<!-- 如果是Feature Request请填写本项 -->
|
||||
<!-- 详细描述你所预想的功能或者是现有功能的改进。 -->
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
最后,喜欢PicGo的话不妨给它点个star~
|
||||
如果可以的话,请我喝杯咖啡?首页有赞助二维码,谢谢你的支持!
|
||||
-->
|
||||
@@ -3,6 +3,7 @@ dist/electron/*
|
||||
dist/web/*
|
||||
build/*
|
||||
!build/icons
|
||||
!build/installer.nsh
|
||||
coverage
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
|
||||
Vendored
+21
-1
@@ -4,14 +4,34 @@
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch",
|
||||
"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
|
||||
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
|
||||
"runtimeArgs": [
|
||||
"--nolazy"
|
||||
],
|
||||
"sourceMaps": true
|
||||
},
|
||||
{
|
||||
"name": "Attach",
|
||||
"type": "node",
|
||||
"request": "attach",
|
||||
"port": 5858,
|
||||
"sourceMaps": false,
|
||||
"sourceMaps": true,
|
||||
"restart": true,
|
||||
"outFiles": [],
|
||||
"localRoot": "${workspaceRoot}",
|
||||
"protocol": "inspector",
|
||||
"remoteRoot": null
|
||||
}
|
||||
]
|
||||
|
||||
@@ -22,11 +22,13 @@
|
||||
|
||||
## 应用说明
|
||||
|
||||
PicGo目前支持了`微博图床`,`七牛图床`,`腾讯云COS`,`又拍云`。未来将支持更多图床。
|
||||
PicGo目前支持了`微博图床`,`七牛图床`,`腾讯云COS v4版本`,`又拍云`。未来将支持更多图床。
|
||||
|
||||
暂时只支持macOS系统,未来将支持windows和linux。
|
||||
支持macOS、windows 64位(v1.3.0以上)系统,未来将支持linux。
|
||||
|
||||
点击此处下载[应用](https://github.com/Molunerfinn/PicGo/releases),macOS用户请下载最新版本的`dmg`文件。
|
||||
支持快捷键`command+shift+p`(macOS)或者`control+shift+p`(windows)用以支持快捷上传剪贴板里的图片(第一张)。PicGo v1.4.0版本及以上支持自定义快捷键啦,使用方法见[配置手册](https://github.com/Molunerfinn/PicGo/wiki/%E8%AF%A6%E7%BB%86%E7%AA%97%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%BF%AB%E6%8D%B7%E9%94%AE)。
|
||||
|
||||
点击此处下载[应用](https://github.com/Molunerfinn/PicGo/releases),macOS用户请下载最新版本的`dmg`文件,windows用户请下载最新版本的`exe`文件。**如果是国内用户下载github release文件速度很慢的话,推荐使用[Free Download Manager](http://www.freedownloadmanager.org/download.htm)来下载,速度会快。**
|
||||
|
||||
如果第一次使用,请参考应用使用[手册](https://github.com/Molunerfinn/PicGo/wiki)。
|
||||
|
||||
@@ -36,13 +38,14 @@ PicGo目前支持了`微博图床`,`七牛图床`,`腾讯云COS`,`又拍
|
||||
|
||||
## 开发说明
|
||||
|
||||
> 目前仅针对Mac平台。Windows和Linux平台并未测试。
|
||||
> 目前仅针对Mac、Windows。Linux平台并未测试。
|
||||
|
||||
如果你想要学习、开发、修改或自行构建PicGo,可以依照下面的指示:
|
||||
|
||||
1. 你需要有node、git环境。需要了解npm的相关知识。
|
||||
2. `git clone https://github.com/Molunerfinn/PicGo.git` 并进入项目
|
||||
3. `npm install` 下载依赖
|
||||
4. Mac需要有Xcode环境,Windows需要有VS环境。
|
||||
|
||||
### 开发模式
|
||||
|
||||
|
||||
+2
-3
@@ -21,13 +21,12 @@ init:
|
||||
|
||||
install:
|
||||
- ps: Install-Product node 8 x64
|
||||
- choco install yarn --ignore-dependencies
|
||||
- git reset --hard HEAD
|
||||
- yarn
|
||||
- npm install
|
||||
- node --version
|
||||
|
||||
build_script:
|
||||
#- yarn test
|
||||
- yarn build
|
||||
- npm run release
|
||||
|
||||
test: off
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
!macro preInit
|
||||
SetRegView 64
|
||||
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\PicGo"
|
||||
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\PicGo"
|
||||
SetRegView 32
|
||||
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\PicGo"
|
||||
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\PicGo"
|
||||
!macroend
|
||||
+5
-2
@@ -6,6 +6,7 @@
|
||||
h1.title PicGo
|
||||
h2.desc 图片上传+管理新体验
|
||||
button.download(@click="goLink('https://github.com/Molunerfinn/picgo/releases')") 免费下载Mac版
|
||||
button.download(@click="goLink('https://github.com/Molunerfinn/picgo/releases')") 免费下载Windows版
|
||||
button.download(@click="goLink('https://github.com/Molunerfinn/picgo')") 在github上查看
|
||||
h3.desc
|
||||
| 基于#[a(href="https://github.com/SimulatedGREG/electron-vue" target="_blank") electron-vue]开发
|
||||
@@ -32,7 +33,7 @@ export default {
|
||||
{
|
||||
url: 'https://ws1.sinaimg.cn/large/8700af19ly1fma907llb5j20m30ed46a',
|
||||
title: '精致设计',
|
||||
desc: 'macOS系统下,支持拖拽至menubar图标实现上传。menubar app 窗口显示最新上传的5张图片以及剪贴板里的图片。点击图片自动将上传的链接复制到剪贴板。'
|
||||
desc: 'macOS系统下,支持拖拽至menubar图标实现上传。menubar app 窗口显示最新上传的5张图片以及剪贴板里的图片。点击图片自动将上传的链接复制到剪贴板。(Windows平台不支持)'
|
||||
},
|
||||
{
|
||||
url: 'https://ws1.sinaimg.cn/large/8700af19ly1fmd56zm2nej218g0p0teb',
|
||||
@@ -42,7 +43,7 @@ export default {
|
||||
{
|
||||
url: 'https://ws1.sinaimg.cn/large/8700af19ly1fmd5ck9m0wj20lr0cxmzs',
|
||||
title: '可选图床',
|
||||
desc: '目前支持微博图床和七牛图床。未来将支持更多。方便不同图床的上传需求。'
|
||||
desc: '目前支持微博图床、七牛图床、腾讯云COS、又拍云。未来将支持更多。方便不同图床的上传需求。'
|
||||
},
|
||||
{
|
||||
url: 'https://ws1.sinaimg.cn/large/8700af19gy1fmayjwttnbj218g0p0q4e',
|
||||
@@ -172,6 +173,8 @@ h1
|
||||
text-decoration none
|
||||
color #fff
|
||||
@media (max-width: 768px)
|
||||
#header
|
||||
padding 10vh
|
||||
#container
|
||||
.display-list
|
||||
&__item
|
||||
|
||||
+11
-3
@@ -1,11 +1,12 @@
|
||||
{
|
||||
"name": "picgo",
|
||||
"version": "1.2.1",
|
||||
"version": "1.5.0",
|
||||
"author": "Molunerfinn <marksz@teamsz.xyz>",
|
||||
"description": "Easy to upload your pic & copy to write",
|
||||
"license": "MIT",
|
||||
"main": "./dist/electron/main.js",
|
||||
"scripts": {
|
||||
"render": "webpack-dev-server --hot --colors --config .electron-vue/webpack.renderer.config.js --port 9080 --content-base app/dist",
|
||||
"build": "node .electron-vue/build.js && electron-builder",
|
||||
"release": "node .electron-vue/build.js && electron-builder",
|
||||
"build:dir": "node .electron-vue/build.js && electron-builder --dir",
|
||||
@@ -29,7 +30,7 @@
|
||||
},
|
||||
"build": {
|
||||
"productName": "PicGo",
|
||||
"appId": "org.simulatedgreg.electron-vue",
|
||||
"appId": "com.molunerfinn.picgo",
|
||||
"directories": {
|
||||
"output": "build"
|
||||
},
|
||||
@@ -58,7 +59,12 @@
|
||||
}
|
||||
},
|
||||
"win": {
|
||||
"icon": "build/icons/icon.ico"
|
||||
"icon": "build/icons/icon.ico",
|
||||
"target": "nsis"
|
||||
},
|
||||
"nsis": {
|
||||
"oneClick": false,
|
||||
"allowToChangeInstallationDirectory": true
|
||||
},
|
||||
"linux": {
|
||||
"icon": "build/icons"
|
||||
@@ -67,8 +73,10 @@
|
||||
"dependencies": {
|
||||
"axios": "^0.16.1",
|
||||
"element-ui": "^2.0.5",
|
||||
"fecha": "^2.3.3",
|
||||
"fs-extra": "^4.0.2",
|
||||
"image-size": "^0.6.1",
|
||||
"keycode": "^2.1.9",
|
||||
"lodash-id": "^0.14.0",
|
||||
"lowdb": "^1.0.0",
|
||||
"md5": "^2.2.1",
|
||||
|
||||
@@ -29,4 +29,10 @@ if (!db.has('picBed').value()) {
|
||||
}).write()
|
||||
}
|
||||
|
||||
if (!db.has('shortKey').value()) {
|
||||
db.set('shortKey', {
|
||||
upload: 'CommandOrControl+Shift+P'
|
||||
}).write()
|
||||
}
|
||||
|
||||
export default db
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import weiboUpload from '../main/utils/weiboUpload'
|
||||
import qiniuUpload from '../main/utils/qiniuUpload'
|
||||
import tcYunUpload from '../main/utils/tcYunUpload'
|
||||
import upYunUpload from '../main/utils/upYunUpload'
|
||||
import githubUpload from '../main/utils/githubUpload'
|
||||
|
||||
const picBedHandler = {
|
||||
weibo: weiboUpload,
|
||||
qiniu: qiniuUpload,
|
||||
tcyun: tcYunUpload,
|
||||
upyun: upYunUpload,
|
||||
github: githubUpload
|
||||
}
|
||||
|
||||
export default picBedHandler
|
||||
@@ -0,0 +1,35 @@
|
||||
import db from './index'
|
||||
|
||||
let picBed = db.read().get('picBed.list').value()
|
||||
|
||||
if (!picBed) {
|
||||
picBed = [
|
||||
{
|
||||
type: 'weibo',
|
||||
name: '微博图床',
|
||||
visible: true
|
||||
},
|
||||
{
|
||||
type: 'qiniu',
|
||||
name: '七牛图床',
|
||||
visible: true
|
||||
},
|
||||
{
|
||||
type: 'tcyun',
|
||||
name: '腾讯云COS',
|
||||
visible: true
|
||||
},
|
||||
{
|
||||
type: 'upyun',
|
||||
name: '又拍云图床',
|
||||
visible: true
|
||||
},
|
||||
{
|
||||
type: 'github',
|
||||
name: 'GitHub图床',
|
||||
visible: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
export default picBed
|
||||
@@ -24,4 +24,15 @@ require('electron').app.on('ready', () => {
|
||||
})
|
||||
|
||||
// Require `main` process to boot app
|
||||
if (process.env.DEBUG_ENV === 'debug') {
|
||||
require('babel-core/register')({
|
||||
'presets': [
|
||||
['env', {
|
||||
'targets': {
|
||||
'node': true
|
||||
}
|
||||
}]
|
||||
]
|
||||
})
|
||||
}
|
||||
require('./index')
|
||||
|
||||
+135
-32
@@ -13,11 +13,15 @@ import pkg from '../../package.json'
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
|
||||
}
|
||||
if (process.env.DEBUG_ENV === 'debug') {
|
||||
global.__static = require('path').join(__dirname, '../../static').replace(/\\/g, '\\\\')
|
||||
}
|
||||
|
||||
let window
|
||||
let settingWindow
|
||||
let tray
|
||||
let menu
|
||||
let contextMenu
|
||||
const winURL = process.env.NODE_ENV === 'development'
|
||||
? `http://localhost:9080`
|
||||
: `file://${__dirname}/index.html`
|
||||
@@ -34,8 +38,9 @@ const uploadFailed = () => {
|
||||
}
|
||||
|
||||
function createTray () {
|
||||
tray = new Tray(`${__static}/menubar.png`)
|
||||
const contextMenu = Menu.buildFromTemplate([
|
||||
const menubarPic = process.platform === 'darwin' ? `${__static}/menubar.png` : `${__static}/menubar-nodarwin.png`
|
||||
tray = new Tray(menubarPic)
|
||||
contextMenu = Menu.buildFromTemplate([
|
||||
{
|
||||
label: '关于',
|
||||
click () {
|
||||
@@ -97,9 +102,27 @@ function createTray () {
|
||||
db.read().set('picBed.current', 'upyun')
|
||||
.write()
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'GitHub图床',
|
||||
type: 'radio',
|
||||
checked: db.read().get('picBed.current').value() === 'github',
|
||||
click () {
|
||||
db.read().set('picBed.current', 'github')
|
||||
.write()
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '打开更新助手',
|
||||
type: 'checkbox',
|
||||
checked: db.get('picBed.showUpdateTip').value(),
|
||||
click () {
|
||||
const value = db.read().get('picBed.showUpdateTip').value()
|
||||
db.read().set('picBed.showUpdateTip', !value).write()
|
||||
}
|
||||
},
|
||||
{
|
||||
role: 'quit',
|
||||
label: '退出'
|
||||
@@ -110,21 +133,32 @@ function createTray () {
|
||||
tray.popUpContextMenu(contextMenu)
|
||||
})
|
||||
tray.on('click', () => {
|
||||
let img = clipboard.readImage()
|
||||
let obj = []
|
||||
if (!img.isEmpty()) {
|
||||
// 从剪贴板来的图片默认转为png
|
||||
const imgUrl = 'data:image/png;base64,' + Buffer.from(img.toPNG(), 'binary').toString('base64')
|
||||
obj.push({
|
||||
width: img.getSize().width,
|
||||
height: img.getSize().height,
|
||||
imgUrl
|
||||
})
|
||||
if (process.platform === 'darwin') {
|
||||
let img = clipboard.readImage()
|
||||
let obj = []
|
||||
if (!img.isEmpty()) {
|
||||
// 从剪贴板来的图片默认转为png
|
||||
const imgUrl = 'data:image/png;base64,' + Buffer.from(img.toPNG(), 'binary').toString('base64')
|
||||
obj.push({
|
||||
width: img.getSize().width,
|
||||
height: img.getSize().height,
|
||||
imgUrl
|
||||
})
|
||||
}
|
||||
toggleWindow()
|
||||
setTimeout(() => {
|
||||
window.webContents.send('clipboardFiles', obj)
|
||||
}, 0)
|
||||
} else {
|
||||
window.hide()
|
||||
if (settingWindow === null) {
|
||||
createSettingWindow()
|
||||
settingWindow.show()
|
||||
} else {
|
||||
settingWindow.show()
|
||||
settingWindow.focus()
|
||||
}
|
||||
}
|
||||
toggleWindow()
|
||||
setTimeout(() => {
|
||||
window.webContents.send('clipboardFiles', obj)
|
||||
}, 0)
|
||||
})
|
||||
|
||||
tray.on('drag-enter', () => {
|
||||
@@ -188,7 +222,7 @@ const createWindow = () => {
|
||||
}
|
||||
|
||||
const createSettingWindow = () => {
|
||||
settingWindow = new BrowserWindow({
|
||||
const options = {
|
||||
height: 450,
|
||||
width: 800,
|
||||
show: false,
|
||||
@@ -196,14 +230,20 @@ const createSettingWindow = () => {
|
||||
center: true,
|
||||
fullscreenable: false,
|
||||
resizable: false,
|
||||
title: 'Pic',
|
||||
title: 'PicGo',
|
||||
vibrancy: 'ultra-dark',
|
||||
transparent: true,
|
||||
titleBarStyle: 'hidden',
|
||||
webPreferences: {
|
||||
backgroundThrottling: false
|
||||
}
|
||||
})
|
||||
}
|
||||
if (process.platform === 'win32') {
|
||||
options.show = true
|
||||
options.frame = false
|
||||
options.backgroundColor = '#3f3c37'
|
||||
}
|
||||
settingWindow = new BrowserWindow(options)
|
||||
|
||||
settingWindow.loadURL(settingWinURL)
|
||||
|
||||
@@ -278,18 +318,27 @@ const uploadClipboardFiles = async () => {
|
||||
imgUrl
|
||||
}
|
||||
}
|
||||
img = await uploader(uploadImg, 'imgFromClipboard', window.webContents)
|
||||
const win = settingWindow || window
|
||||
img = await uploader(uploadImg, 'imgFromClipboard', win.webContents)
|
||||
if (img !== false) {
|
||||
const pasteStyle = db.read().get('picBed.pasteStyle').value() || 'markdown'
|
||||
clipboard.writeText(pasteTemplate(pasteStyle, img[0].imgUrl))
|
||||
const notification = new Notification({
|
||||
title: '上传成功',
|
||||
body: img[0].imgUrl,
|
||||
icon: img[0].imgUrl
|
||||
})
|
||||
notification.show()
|
||||
window.webContents.send('clipboardFiles', [])
|
||||
window.webContents.send('uploadFiles', img)
|
||||
if (img.length > 0) {
|
||||
const pasteStyle = db.read().get('picBed.pasteStyle').value() || 'markdown'
|
||||
clipboard.writeText(pasteTemplate(pasteStyle, img[0].imgUrl))
|
||||
const notification = new Notification({
|
||||
title: '上传成功',
|
||||
body: img[0].imgUrl,
|
||||
icon: img[0].imgUrl
|
||||
})
|
||||
notification.show()
|
||||
window.webContents.send('clipboardFiles', [])
|
||||
window.webContents.send('uploadFiles', img)
|
||||
} else {
|
||||
const notification = new Notification({
|
||||
title: '上传不成功',
|
||||
body: '你剪贴板最新的一条记录不是图片哦'
|
||||
})
|
||||
notification.show()
|
||||
}
|
||||
} else {
|
||||
uploadFailed()
|
||||
}
|
||||
@@ -314,6 +363,10 @@ ipcMain.on('uploadClipboardFiles', async (evt, file) => {
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.on('uploadClipboardFilesFromUploadPage', () => {
|
||||
uploadClipboardFiles()
|
||||
})
|
||||
|
||||
ipcMain.on('uploadChoosedFiles', async (evt, files) => {
|
||||
const imgs = await uploader(files, 'imgFromUploader', settingWindow.webContents)
|
||||
if (imgs !== false) {
|
||||
@@ -337,6 +390,49 @@ 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], () => {
|
||||
return shortKeyHash[key]()
|
||||
})
|
||||
}
|
||||
const notification = new Notification({
|
||||
title: '操作成功',
|
||||
body: '你的快捷键已经修改成功'
|
||||
})
|
||||
notification.show()
|
||||
})
|
||||
|
||||
ipcMain.on('updateCustomLink', (evt, oldLink) => {
|
||||
const notification = new Notification({
|
||||
title: '操作成功',
|
||||
body: '你的自定义链接格式已经修改成功'
|
||||
})
|
||||
notification.show()
|
||||
})
|
||||
|
||||
ipcMain.on('updteDefaultPicBed', (evt) => {
|
||||
const types = ['weibo', 'qiniu', 'tcyun', 'upyun']
|
||||
let submenuItem = contextMenu.items[2].submenu.items
|
||||
submenuItem.forEach((item, index) => {
|
||||
const result = db.read().get('picBed.current').value() === types[index]
|
||||
if (result) {
|
||||
item.click() // It's a bug which can not set checked status
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
ipcMain.on('autoStart', (evt, val) => {
|
||||
app.setLoginItemSettings({
|
||||
openAtLogin: val
|
||||
})
|
||||
})
|
||||
|
||||
const shortKeyHash = {
|
||||
upload: uploadClipboardFiles
|
||||
}
|
||||
|
||||
const isSecondInstance = app.makeSingleInstance(() => {
|
||||
if (settingWindow) {
|
||||
if (settingWindow.isMinimized()) {
|
||||
@@ -347,16 +443,19 @@ const isSecondInstance = app.makeSingleInstance(() => {
|
||||
})
|
||||
|
||||
if (isSecondInstance) {
|
||||
console.log('is 2')
|
||||
app.quit()
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
app.setAppUserModelId(pkg.build.appId)
|
||||
}
|
||||
|
||||
app.on('ready', () => {
|
||||
createWindow()
|
||||
createTray()
|
||||
updateChecker()
|
||||
|
||||
globalShortcut.register('CommandOrControl+Shift+P', () => {
|
||||
globalShortcut.register(db.read().get('shortKey.upload').value(), () => {
|
||||
uploadClipboardFiles()
|
||||
})
|
||||
})
|
||||
@@ -377,6 +476,10 @@ app.on('will-quit', () => {
|
||||
globalShortcut.unregisterAll()
|
||||
})
|
||||
|
||||
app.setLoginItemSettings({
|
||||
openAtLogin: db.read().get('picBed.autoStart').value() || false
|
||||
})
|
||||
|
||||
/**
|
||||
* Auto Updater
|
||||
*
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
import request from 'request-promise'
|
||||
import * as img2Base64 from './img2base64'
|
||||
import db from '../../datastore/index'
|
||||
import { Notification } from 'electron'
|
||||
|
||||
const postOptions = (fileName, options, data) => {
|
||||
const path = options.path || ''
|
||||
const {token, repo} = options
|
||||
return {
|
||||
method: 'PUT',
|
||||
url: `https://api.github.com/repos/${repo}/contents/${path}${encodeURI(fileName)}`,
|
||||
headers: {
|
||||
Authorization: `token ${token}`,
|
||||
'User-Agent': 'PicGo'
|
||||
},
|
||||
body: data,
|
||||
json: true
|
||||
}
|
||||
}
|
||||
|
||||
const githubUpload = async function (img, type, webContents) {
|
||||
try {
|
||||
webContents.send('uploadProgress', 0)
|
||||
const imgList = await img2Base64[type](img)
|
||||
const length = imgList.length
|
||||
const githubOptions = db.read().get('picBed.github').value()
|
||||
webContents.send('uploadProgress', 30)
|
||||
for (let i in imgList) {
|
||||
const data = {
|
||||
message: 'Upload by PicGo',
|
||||
branch: githubOptions.branch,
|
||||
content: imgList[i].base64Image,
|
||||
path: githubOptions.path + encodeURI(imgList[i].fileName)
|
||||
}
|
||||
const postConfig = postOptions(imgList[i].fileName, githubOptions, data)
|
||||
const body = await request(postConfig)
|
||||
if (body) {
|
||||
delete imgList[i].base64Image
|
||||
imgList[i]['imgUrl'] = body.content.download_url
|
||||
imgList[i]['type'] = 'github'
|
||||
if (i - length === -1) {
|
||||
webContents.send('uploadProgress', 60)
|
||||
}
|
||||
} else {
|
||||
webContents.send('uploadProgress', -1)
|
||||
return new Error()
|
||||
}
|
||||
}
|
||||
webContents.send('uploadProgress', 100)
|
||||
return imgList
|
||||
} catch (err) {
|
||||
webContents.send('uploadProgress', -1)
|
||||
const notification = new Notification({
|
||||
title: '上传失败!',
|
||||
body: '服务端出错,请重试'
|
||||
})
|
||||
notification.show()
|
||||
throw new Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
export default githubUpload
|
||||
@@ -1,33 +1,78 @@
|
||||
import fs from 'fs-extra'
|
||||
import path from 'path'
|
||||
import sizeOf from 'image-size'
|
||||
import fecha from 'fecha'
|
||||
import { BrowserWindow, ipcMain } from 'electron'
|
||||
import db from '../../datastore/index.js'
|
||||
const renameURL = process.env.NODE_ENV === 'development' ? `http://localhost:9080/#rename-page` : `file://${__dirname}/index.html#rename-page`
|
||||
|
||||
const createRenameWindow = () => {
|
||||
let options = {
|
||||
height: 175,
|
||||
width: 300,
|
||||
show: true,
|
||||
fullscreenable: false,
|
||||
resizable: false,
|
||||
vibrancy: 'ultra-dark',
|
||||
webPreferences: {
|
||||
backgroundThrottling: false
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
options.show = true
|
||||
options.backgroundColor = '#3f3c37'
|
||||
}
|
||||
|
||||
const window = new BrowserWindow(options)
|
||||
window.loadURL(renameURL)
|
||||
return window
|
||||
}
|
||||
|
||||
const imgFromPath = async (imgPath) => {
|
||||
let results = []
|
||||
let rename = db.read().get('picBed.rename').value()
|
||||
await Promise.all(imgPath.map(async item => {
|
||||
let name
|
||||
let fileName = path.basename(item)
|
||||
if (rename) {
|
||||
const window = createRenameWindow()
|
||||
await waitForShow(window.webContents)
|
||||
window.webContents.send('rename', fileName, window.webContents.id)
|
||||
name = await waitForRename(window, window.webContents.id)
|
||||
}
|
||||
let buffer = await fs.readFile(item)
|
||||
let base64Image = Buffer.from(buffer, 'binary').toString('base64')
|
||||
let fileName = path.basename(item)
|
||||
let imgSize = sizeOf(item)
|
||||
results.push({
|
||||
base64Image,
|
||||
fileName,
|
||||
fileName: name || fileName,
|
||||
width: imgSize.width,
|
||||
height: imgSize.height
|
||||
height: imgSize.height,
|
||||
extname: path.extname(item)
|
||||
})
|
||||
}))
|
||||
return results
|
||||
}
|
||||
|
||||
const imgFromClipboard = (file) => {
|
||||
const imgFromClipboard = async (file) => {
|
||||
let result = []
|
||||
let rename = db.read().get('picBed.rename').value()
|
||||
if (file !== null) {
|
||||
const today = new Date().toLocaleString().replace(/[ ]+/g, '-').replace(/\/+/g, '-')
|
||||
let name
|
||||
const today = fecha.format(new Date(), 'YYYYMMDDHHmmss') + '.png'
|
||||
if (rename) {
|
||||
const window = createRenameWindow()
|
||||
await waitForShow(window.webContents)
|
||||
window.webContents.send('rename', today, window.webContents.id)
|
||||
name = await waitForRename(window, window.webContents.id)
|
||||
}
|
||||
result.push({
|
||||
base64Image: file.imgUrl.replace(/^data\S+,/, ''),
|
||||
fileName: `${today}.png`,
|
||||
fileName: name || today,
|
||||
width: file.width,
|
||||
height: file.height
|
||||
height: file.height,
|
||||
extname: '.png'
|
||||
})
|
||||
}
|
||||
return result
|
||||
@@ -35,21 +80,51 @@ const imgFromClipboard = (file) => {
|
||||
|
||||
const imgFromUploader = async (files) => {
|
||||
let results = []
|
||||
let rename = db.read().get('picBed.rename').value()
|
||||
await Promise.all(files.map(async item => {
|
||||
let name
|
||||
if (rename) {
|
||||
const window = createRenameWindow()
|
||||
await waitForShow(window.webContents)
|
||||
window.webContents.send('rename', item.name, window.webContents.id)
|
||||
name = await waitForRename(window, window.webContents.id)
|
||||
}
|
||||
let buffer = await fs.readFile(item.path)
|
||||
let base64Image = Buffer.from(buffer, 'binary').toString('base64')
|
||||
let fileName = item.name
|
||||
let fileName = name || item.name
|
||||
let imgSize = sizeOf(item.path)
|
||||
results.push({
|
||||
base64Image,
|
||||
fileName,
|
||||
width: imgSize.width,
|
||||
height: imgSize.height
|
||||
height: imgSize.height,
|
||||
extname: path.extname(item.name)
|
||||
})
|
||||
}))
|
||||
return results
|
||||
}
|
||||
|
||||
const waitForShow = (webcontent) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
webcontent.on('dom-ready', () => {
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const waitForRename = (window, id) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
ipcMain.once(`rename${id}`, (evt, newName) => {
|
||||
resolve(newName)
|
||||
window.hide()
|
||||
})
|
||||
window.on('close', () => {
|
||||
resolve(null)
|
||||
ipcMain.removeAllListeners(`rename${id}`)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
imgFromPath,
|
||||
imgFromClipboard,
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import db from '../../datastore'
|
||||
|
||||
export default (style, url) => {
|
||||
const customLink = db.read().get('customLink').value() || '$url'
|
||||
const tpl = {
|
||||
'markdown': ``,
|
||||
'HTML': `<img src="${url}"/>`,
|
||||
'URL': url,
|
||||
'UBB': `[IMG]${url}[/IMG]`
|
||||
'UBB': `[IMG]${url}[/IMG]`,
|
||||
'Custom': customLink.replace(/\$url/, url)
|
||||
}
|
||||
return tpl[style]
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@ import { Notification } from 'electron'
|
||||
|
||||
function postOptions (fileName, token, imgBase64) {
|
||||
const area = selectArea(db.read().get('picBed.qiniu.area').value() || 'z0')
|
||||
const base64FileName = Buffer.from(fileName, 'utf-8').toString('base64').replace(/\+/g, '-').replace(/\//g, '_')
|
||||
const path = db.read().get('picBed.qiniu.path').value() || ''
|
||||
const base64FileName = Buffer.from(path + fileName, 'utf-8').toString('base64').replace(/\+/g, '-').replace(/\//g, '_')
|
||||
return {
|
||||
method: 'POST',
|
||||
url: `http://upload${area}.qiniu.com/putb64/-1/key/${base64FileName}`,
|
||||
|
||||
@@ -5,42 +5,72 @@ import { Notification, clipboard } from 'electron'
|
||||
import crypto from 'crypto'
|
||||
|
||||
// generate COS signature string
|
||||
const generateSignature = () => {
|
||||
const generateSignature = (fileName) => {
|
||||
const options = db.read().get('picBed.tcyun').value()
|
||||
const secretId = options.secretId
|
||||
const secretKey = options.secretKey
|
||||
const appId = options.appId
|
||||
const bucket = options.bucket
|
||||
const random = Math.floor(Math.random() * 10000000000)
|
||||
const current = parseInt(new Date().getTime() / 1000) - 1
|
||||
const expired = current + 3600
|
||||
let signature
|
||||
let signTime
|
||||
if (!options.version || options.version === 'v4') {
|
||||
const random = Math.floor(Math.random() * 10000000000)
|
||||
const current = parseInt(new Date().getTime() / 1000) - 1
|
||||
const expired = current + 3600
|
||||
|
||||
const multiSignature = `a=${appId}&b=${bucket}&k=${secretId}&e=${expired}&t=${current}&r=${random}&f=`
|
||||
const multiSignature = `a=${appId}&b=${bucket}&k=${secretId}&e=${expired}&t=${current}&r=${random}&f=`
|
||||
|
||||
const signHexKey = crypto.createHmac('sha1', secretKey).update(multiSignature).digest()
|
||||
const tempString = Buffer.concat([signHexKey, Buffer.from(multiSignature)])
|
||||
const signature = Buffer.from(tempString).toString('base64')
|
||||
const signHexKey = crypto.createHmac('sha1', secretKey).update(multiSignature).digest()
|
||||
const tempString = Buffer.concat([signHexKey, Buffer.from(multiSignature)])
|
||||
signature = Buffer.from(tempString).toString('base64')
|
||||
} else {
|
||||
// https://cloud.tencent.com/document/product/436/7778#signature
|
||||
const today = Math.floor(new Date().getTime() / 1000)
|
||||
const tomorrow = today + 86400
|
||||
signTime = `${today};${tomorrow}`
|
||||
const signKey = crypto.createHmac('sha1', secretKey).update(signTime).digest('hex')
|
||||
const httpString = `put\n/${options.path}${fileName}\n\nhost=${options.bucket}.cos.${options.area}.myqcloud.com\n`
|
||||
const sha1edHttpString = crypto.createHash('sha1').update(httpString).digest('hex')
|
||||
const stringToSign = `sha1\n${signTime}\n${sha1edHttpString}\n`
|
||||
signature = crypto.createHmac('sha1', signKey).update(stringToSign).digest('hex')
|
||||
}
|
||||
return {
|
||||
signature,
|
||||
appId,
|
||||
bucket
|
||||
bucket,
|
||||
signTime
|
||||
}
|
||||
}
|
||||
|
||||
const postOptions = (fileName, signature, imgBase64) => {
|
||||
const area = db.read().get('picBed.tcyun.area').value()
|
||||
const path = db.read().get('picBed.tcyun.path').value()
|
||||
return {
|
||||
method: 'POST',
|
||||
url: `http://${area}.file.myqcloud.com/files/v2/${signature.appId}/${signature.bucket}/${path}${fileName}`,
|
||||
headers: {
|
||||
Host: `${area}.file.myqcloud.com`,
|
||||
Authorization: signature.signature,
|
||||
contentType: 'multipart/form-data'
|
||||
},
|
||||
formData: {
|
||||
op: 'upload',
|
||||
filecontent: Buffer.from(imgBase64, 'base64')
|
||||
const options = db.read().get('picBed.tcyun').value()
|
||||
const area = options.area
|
||||
const path = options.path
|
||||
if (!options.version || options.version === 'v4') {
|
||||
return {
|
||||
method: 'POST',
|
||||
url: `http://${area}.file.myqcloud.com/files/v2/${signature.appId}/${signature.bucket}/${path}${fileName}`,
|
||||
headers: {
|
||||
Host: `${area}.file.myqcloud.com`,
|
||||
Authorization: signature.signature,
|
||||
contentType: 'multipart/form-data'
|
||||
},
|
||||
formData: {
|
||||
op: 'upload',
|
||||
filecontent: Buffer.from(imgBase64, 'base64')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
method: 'PUT',
|
||||
url: `http://${options.bucket}.cos.${options.area}.myqcloud.com/${path}${encodeURI(fileName)}`,
|
||||
headers: {
|
||||
Host: `${options.bucket}.cos.${options.area}.myqcloud.com`,
|
||||
Authorization: `q-sign-algorithm=sha1&q-ak=${options.secretId}&q-sign-time=${signature.signTime}&q-key-time=${signature.signTime}&q-header-list=host&q-url-param-list=&q-signature=${signature.signature}`,
|
||||
contentType: 'multipart/form-data'
|
||||
},
|
||||
body: Buffer.from(imgBase64, 'base64'),
|
||||
resolveWithFullResponse: true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,15 +80,49 @@ const tcYunUpload = async (img, type, webContents) => {
|
||||
webContents.send('uploadProgress', 0)
|
||||
const imgList = await img2Base64[type](img)
|
||||
webContents.send('uploadProgress', 30)
|
||||
const singature = generateSignature()
|
||||
const length = imgList.length
|
||||
const tcYunOptions = db.read().get('picBed.tcyun').value()
|
||||
const customUrl = tcYunOptions.customUrl
|
||||
const path = tcYunOptions.path
|
||||
const useV4 = !tcYunOptions.version || tcYunOptions.version === 'v4'
|
||||
for (let i in imgList) {
|
||||
const singature = generateSignature(imgList[i].fileName)
|
||||
const options = postOptions(imgList[i].fileName, singature, imgList[i].base64Image)
|
||||
const res = await request(options)
|
||||
const body = JSON.parse(res)
|
||||
if (body.message === 'SUCCESS') {
|
||||
.then(res => res)
|
||||
.catch(err => {
|
||||
console.log(err.response.body)
|
||||
return {
|
||||
statusCode: 400,
|
||||
body: {
|
||||
msg: '认证失败!'
|
||||
}
|
||||
}
|
||||
})
|
||||
let body
|
||||
if (useV4) {
|
||||
body = JSON.parse(res)
|
||||
} else {
|
||||
body = res
|
||||
}
|
||||
if (useV4 && body.message === 'SUCCESS') {
|
||||
delete imgList[i].base64Image
|
||||
imgList[i]['imgUrl'] = body.data.source_url
|
||||
if (customUrl) {
|
||||
imgList[i]['imgUrl'] = `${customUrl}/${path}${imgList[i].fileName}`
|
||||
} else {
|
||||
imgList[i]['imgUrl'] = body.data.source_url
|
||||
}
|
||||
imgList[i]['type'] = 'tcyun'
|
||||
if (i - length === -1) {
|
||||
webContents.send('uploadProgress', 60)
|
||||
}
|
||||
} else if (!useV4 && body && body.statusCode === 200) {
|
||||
delete imgList[i].base64Image
|
||||
if (customUrl) {
|
||||
imgList[i]['imgUrl'] = `${customUrl}/${path}${imgList[i].fileName}`
|
||||
} else {
|
||||
imgList[i]['imgUrl'] = `https://${tcYunOptions.bucket}.cos.${tcYunOptions.area}.myqcloud.com/${path}${imgList[i].fileName}`
|
||||
}
|
||||
imgList[i]['type'] = 'tcyun'
|
||||
if (i - length === -1) {
|
||||
webContents.send('uploadProgress', 60)
|
||||
@@ -70,6 +134,7 @@ const tcYunUpload = async (img, type, webContents) => {
|
||||
body: res.body.msg
|
||||
})
|
||||
notification.show()
|
||||
return false
|
||||
}
|
||||
}
|
||||
webContents.send('uploadProgress', 100)
|
||||
|
||||
@@ -8,12 +8,12 @@ import MD5 from 'md5'
|
||||
// generate COS signature string
|
||||
const generateSignature = (fileName) => {
|
||||
const options = db.read().get('picBed.upyun').value()
|
||||
// const apiKey = options.apiKey
|
||||
const path = options.path || ''
|
||||
const operator = options.operator
|
||||
const password = options.password
|
||||
const md5Password = MD5(password)
|
||||
const date = new Date().toGMTString()
|
||||
const uri = `/${options.bucket}/${encodeURI(fileName)}`
|
||||
const uri = `/${options.bucket}/${path}${encodeURI(fileName)}`
|
||||
const value = `PUT&${uri}&${date}`
|
||||
const sign = crypto.createHmac('sha1', md5Password).update(value).digest('base64')
|
||||
return `UPYUN ${operator}:${sign}`
|
||||
@@ -22,9 +22,10 @@ const generateSignature = (fileName) => {
|
||||
const postOptions = (fileName, signature, imgBase64) => {
|
||||
const options = db.read().get('picBed.upyun').value()
|
||||
const bucket = options.bucket
|
||||
const path = options.path || ''
|
||||
return {
|
||||
method: 'PUT',
|
||||
url: `https://v0.api.upyun.com/${bucket}/${encodeURI(fileName)}`,
|
||||
url: `https://v0.api.upyun.com/${bucket}/${path}${encodeURI(fileName)}`,
|
||||
headers: {
|
||||
Authorization: signature,
|
||||
Date: new Date().toGMTString()
|
||||
@@ -41,24 +42,21 @@ const upYunUpload = async (img, type, webContents) => {
|
||||
webContents.send('uploadProgress', 30)
|
||||
const length = imgList.length
|
||||
const upyunOptions = db.read().get('picBed.upyun').value()
|
||||
const path = upyunOptions.path || ''
|
||||
for (let i in imgList) {
|
||||
const singature = generateSignature(imgList[i].fileName)
|
||||
const options = postOptions(imgList[i].fileName, singature, imgList[i].base64Image)
|
||||
const body = await request(options)
|
||||
if (body.statusCode === 200) {
|
||||
delete imgList[i].base64Image
|
||||
imgList[i]['imgUrl'] = `${upyunOptions.url}/${imgList[i].fileName}${upyunOptions.options}`
|
||||
imgList[i]['imgUrl'] = `${upyunOptions.url}/${path}${imgList[i].fileName}${upyunOptions.options}`
|
||||
imgList[i]['type'] = 'upyun'
|
||||
if (i - length === -1) {
|
||||
webContents.send('uploadProgress', 60)
|
||||
}
|
||||
} else {
|
||||
webContents.send('uploadProgress', -1)
|
||||
const notification = new Notification({
|
||||
title: '上传失败!',
|
||||
body: '服务端出错,请稍后再试'
|
||||
})
|
||||
notification.show()
|
||||
return new Error()
|
||||
}
|
||||
}
|
||||
webContents.send('uploadProgress', 100)
|
||||
|
||||
@@ -22,7 +22,7 @@ const checkVersion = async () => {
|
||||
type: 'info',
|
||||
title: '发现新版本',
|
||||
buttons: ['Yes', 'No'],
|
||||
message: '发现新版本,是否去下载最新的版本?',
|
||||
message: '发现新版本,更新了很多功能,是否去下载最新的版本?',
|
||||
checkboxLabel: '以后不再提醒',
|
||||
checkboxChecked: false
|
||||
}, (res, checkboxChecked) => {
|
||||
@@ -44,15 +44,16 @@ const checkVersion = async () => {
|
||||
const compareVersion2Update = (current, latest) => {
|
||||
const currentVersion = current.split('.').map(item => parseInt(item))
|
||||
const latestVersion = latest.split('.').map(item => parseInt(item))
|
||||
let flag = false
|
||||
|
||||
for (let i = 0; i < 3; i++) {
|
||||
if (currentVersion[i] < latestVersion[i]) {
|
||||
flag = true
|
||||
return true
|
||||
}
|
||||
if (currentVersion[i] > latestVersion[i]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return flag
|
||||
return false
|
||||
}
|
||||
|
||||
export default checkVersion
|
||||
|
||||
@@ -2,6 +2,7 @@ import weiboUpload from './weiboUpload'
|
||||
import qiniuUpload from './qiniuUpload'
|
||||
import tcYunUpload from './tcYunUpload'
|
||||
import upYunUpload from './upYunUpload'
|
||||
import githubUpload from './githubUpload'
|
||||
import db from '../../datastore/index'
|
||||
|
||||
const checkUploader = (type) => {
|
||||
@@ -25,6 +26,8 @@ const uploader = (img, type, webContents) => {
|
||||
return tcYunUpload(img, type, webContents)
|
||||
case 'upyun':
|
||||
return upYunUpload(img, type, webContents)
|
||||
case 'github':
|
||||
return githubUpload(img, type, webContents)
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
|
||||
@@ -28,26 +28,51 @@ const weiboUpload = async function (img, type, webContents) {
|
||||
password: db.read().get('picBed.weibo.password').value()
|
||||
}
|
||||
const quality = db.read().get('picBed.weibo.quality').value()
|
||||
const cookie = db.read().get('picBed.weibo.cookie').value()
|
||||
const chooseCookie = db.read().get('picBed.weibo.chooseCookie').value()
|
||||
const options = postOptions(formData)
|
||||
const res = await rp(options)
|
||||
let res
|
||||
if (!chooseCookie) {
|
||||
res = await rp(options)
|
||||
}
|
||||
webContents.send('uploadProgress', 30)
|
||||
if (res.body.retcode === 20000000) {
|
||||
for (let i in res.body.data.crossdomainlist) {
|
||||
await rp.get(res.body.data.crossdomainlist[i])
|
||||
if (chooseCookie || res.body.retcode === 20000000) {
|
||||
if (res) {
|
||||
for (let i in res.body.data.crossdomainlist) {
|
||||
await rp.get(res.body.data.crossdomainlist[i])
|
||||
}
|
||||
}
|
||||
webContents.send('uploadProgress', 60)
|
||||
const imgList = await img2Base64[type](img)
|
||||
for (let i in imgList) {
|
||||
let result = await rp.post(UPLOAD_URL, {
|
||||
let opt = {
|
||||
formData: {
|
||||
b64_data: imgList[i].base64Image
|
||||
}
|
||||
})
|
||||
}
|
||||
if (chooseCookie) {
|
||||
opt.headers = {
|
||||
Cookie: cookie
|
||||
}
|
||||
}
|
||||
let result = await rp.post(UPLOAD_URL, opt)
|
||||
result = result.replace(/<.*?\/>/, '').replace(/<(\w+).*?>.*?<\/\1>/, '')
|
||||
delete imgList[i].base64Image
|
||||
const resTextJson = JSON.parse(result)
|
||||
imgList[i]['imgUrl'] = `https://ws1.sinaimg.cn/${quality}/${resTextJson.data.pics.pic_1.pid}`
|
||||
imgList[i]['type'] = 'weibo'
|
||||
if (resTextJson.data.pics.pic_1.pid === undefined) {
|
||||
webContents.send('uploadProgress', -1)
|
||||
const notification = new Notification({
|
||||
title: '上传失败!',
|
||||
body: '微博Cookie失效,请在网页版重新登录一遍'
|
||||
})
|
||||
notification.show()
|
||||
return new Error()
|
||||
} else {
|
||||
const extname = imgList[i].extname === '.gif' ? '.gif' : '.jpg'
|
||||
imgList[i]['imgUrl'] = `https://ws1.sinaimg.cn/${quality}/${resTextJson.data.pics.pic_1.pid}${extname}`
|
||||
imgList[i]['type'] = 'weibo'
|
||||
}
|
||||
delete imgList[i].extname
|
||||
}
|
||||
webContents.send('uploadProgress', 100)
|
||||
return imgList
|
||||
@@ -58,6 +83,7 @@ const weiboUpload = async function (img, type, webContents) {
|
||||
body: res.body.msg
|
||||
})
|
||||
notification.show()
|
||||
return new Error()
|
||||
}
|
||||
} catch (err) {
|
||||
webContents.send('uploadProgress', -1)
|
||||
|
||||
@@ -20,4 +20,16 @@
|
||||
#app
|
||||
overflow-x hidden
|
||||
user-select none
|
||||
.el-button-group
|
||||
width 100%
|
||||
.el-button
|
||||
width 50%
|
||||
*::-webkit-scrollbar
|
||||
width 8px
|
||||
height 8px
|
||||
*::-webkit-scrollbar-thumb
|
||||
border-radius 4px
|
||||
background #6f6f6f
|
||||
*::-webkit-scrollbar-track
|
||||
background-color transparent
|
||||
</style>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
|
||||
@font-face {font-family: "iconfont";
|
||||
src: url('iconfont.eot?t=1513753554908'); /* IE9*/
|
||||
src: url('iconfont.eot?t=1513753554908#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
||||
url('data:application/x-font-woff;charset=utf-8;base64,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') format('woff'),
|
||||
url('iconfont.ttf?t=1513753554908') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
|
||||
url('iconfont.svg?t=1513753554908#iconfont') format('svg'); /* iOS 4.1- */
|
||||
src: url('iconfont.eot?t=1523001890286'); /* IE9*/
|
||||
src: url('iconfont.eot?t=1523001890286#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
||||
url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAApcAAsAAAAADqAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFZW7kmaY21hcAAAAYAAAACMAAAB5Jz6bNVnbHlmAAACDAAABisAAAfkf7GmJ2hlYWQAAAg4AAAALwAAADYQ+dpBaGhlYQAACGgAAAAcAAAAJAfeA4lobXR4AAAIhAAAABQAAAAgH+kAAGxvY2EAAAiYAAAAEgAAABII+gbebWF4cAAACKwAAAAfAAAAIAEYAMxuYW1lAAAIzAAAAUUAAAJtPlT+fXBvc3QAAAoUAAAASAAAAF2Rted1eJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2Bk/ss4gYGVgYOpk+kMAwNDP4RmfM1gxMjBwMDEwMrMgBUEpLmmMDgwVDxfzdzwv4EhhrmBoQEozAiSAwAxwA0deJzFkdEJwzAMRE9ymoRiSv+TETpK6BQZwvSr+2QvZYz0ZLmFTpAzz/gOGRkLwAVAIg/SAfKGwPViKjVPuNa8w5M+Y4TyXExttmXfjoNpMbHp574SVmfccOdy12Ngv8TbStvjNMl5rf+V6742N5DS4BOtwX+DaeA1NgU+O5sDn6Etgc9x3wLoBwU0H794nG1VXYwcRxHu6p7unt+enf/9m9293buZde5u97w/M3Zs7xof2AoJPsLJ4JMR52AUEUgiJcLxQ2znEEIkEEQiJGOQIl0QCDlKpCgP5MXipAiJl5N44S0IAvjVQkGKBUIs9OzFEkjslGqner7pmar6vhpEEfr3n8htUkYe6qLD6JPoswgBW4a2wDEspKMeXoZggQaRL0jaSRd4p90jJyBqMz8cZKMkYpzZIKABw4VBlvZwCuPRBB+DQRgDVGrVTXep7pJXQC+njW/PPo1/CkGzU7cnq7OHVqb+oOWpV0zXrbjuyyqjVMVYsQU8FYUa1XQ2+xm1q8Ht5iHcBLOSVh/Zslo197EXR0/HS5EGsLMDXq0lfjF1qo60q9XQcyu8ZKnlqtVZ9OHKHaPsmXHyFyR/IHP9DXmP5GhdBgJ4A6IwS8csyXvAkyxqQNCAfAIyTEeZ9HkSRtkgmgAPmUQH83tiYOEBCKO9GcW3XirZ8MUJLrVwtaK0O62zgWLrG8+Tcki5A8dP5t/ITx4Hh9OwTK6eNV2wnRdvYTojOZ3t3bzTJ7a+KSY0rYOvAU3JGphhQ6UXri+diLRpn6iHbPuQSvpTLTqxdP0C1Q+1ntdt0r9zc29W5MXmed0jWyhEPfQw+gK6hJ6UGfqsnaR5RybDxz0YZVPZpOgwbyfjUZEh6xSL+bBYDHzGi/y5mJu8mmdunoWc8QnIdXpQrXnWRF6VJzIUkN6nAflIhAIA8EuPq5ppaurVn5MbhsDKtK9QQ8iFM9vYvtJIRj1Cnjj/4Ksbb/6TQfSvM0fOYyArF3vThdmPX7ilKLde2Cn87voWxlvrpwp/LozjlTjGC4ZtG8qTPyDyMSIQGJS3vtWwDUYPnyIY7FBg/JWHFcM+rWjidHZs90i3D+SNndJ3oOrw/indrNVVcWkDP3d+6zLGl7fOPze7CZuTySbM/W5ztSkNIVwUlXyEP0Cvob0DpgiwD/64wHNPAj8KZWGGgyyfKAUdRknao2lSKCDpQ/Ix3iapLJe0ZJRPyHAQNkHWawqyZH0oliV0LLswIVOYSM3ILaU1YVBsOcjmmLlJXBFAgwSSiwfvIoXHWmnRWAnOpjgL4XfNMyFXmKgtW1xlinfE1lvML5l0fXnoXvr97aeZs8itmpmugKYQsLnhirrgbFEjRjSo+HpDCybR5742XrBj3n3QUAittAdR/WhtrChO4HBDjWhiV5dMZlK93F4JAu61PSte9a2KZmCTVayKzhlRMYms0lo5wrxW/RSMa4stGzChhiq6PjXLq7O7Xs3fI3WdcuGwNn6f1koKlnsebdiVqARlTY1ZPU7a3vb6A7ZKACuawhy99aWhc1hjPNZc1yxToli44J3GlRIvHYk2Hh/JCPi4ay1bfrfu1ip9InxXxQb3adPwBCWgLOpuq1lmFMtxwyPHjG1HngLTbVUQtWG7S4aBsaYqs10eJN16ydZLoeZWFQwFrua/qwSUEEpBDhVF6m+XfEAuIhOV0SKaILQk2zicwCiRg5RBiKIM5QlKGYruK0dqLGey1ccg8EM5LbN8XHBJdjxpc/g1lKzjluNYx01ndoGCvb8PNqWzD/f3Zx/m9O4779ylc39PEFwyLsyBsGWUMBEvmy3zWRmBU3GklzfQ/97g/p3S/80JDXGjeMwNYYTO65ZVzEjJ/b/iX6I1yfyMFYOvXTAw6hXan7NTWh5KysohmRwwsQCEw8WMvO+VFfzHf2x8QnRjunMZcGhd+y5zTH9j8/PbluWDGrZyXVxa9mtC0hbt48t9UMR7wl47ybazHarYj7x76tFXGkcbGMdrR39icd1tf9+xHMu9tmGYf74/x39LfkVOo20ZJGky/wB1Pn4XKUt5yK+SfOEsTbK5kKTgChxnbnFxLpjhfIjLJJLikJWX048daKtTCKvA5RkmUK7oPntWq9i60X2o6vsYjDLFnhss6UIFJap2Lo4D68uU6tfunXti+XvVuubzZ7SqMHSJDzyJjyjxPD/RBFfC2hz+GGPa9b+f+2of/8GRfVF/ZJiStkmnNl2wqFn1mowGK55uPvDo4mofnG+qLul85uuvzt5+xi/9D7xt/l+4o3TOPvVD2JDl+g9+5y00AHicY2BkYGAA4vdhFhPj+W2+MnCzMIDAtbfeSgj6/wIWBuYEIJeDgQkkCgAriQovAHicY2BkYGBu+N/AEMPCAAJAkpEBFXAAAEcOAnF4nGNhYGBgfsnAwMKAHQMAGtcBCQAAAAAAdgDiAYoCogMIA1oD8gAAeJxjYGRgYOBgOMDAxgACTEDMBYQMDP/BfAYAHGwB5QB4nGWPTU7DMBCFX/oHpBKqqGCH5AViASj9EatuWFRq911036ZOmyqJI8et1ANwHo7ACTgC3IA78EgnmzaWx9+8eWNPANzgBx6O3y33kT1cMjtyDRe4F65TfxBukF+Em2jjVbhF/U3YxzOmwm10YXmD17hi9oR3YQ8dfAjXcI1P4Tr1L+EG+Vu4iTv8CrfQ8erCPuZeV7iNRy/2x1YvnF6p5UHFockikzm/gple75KFrdLqnGtbxCZTg6BfSVOdaVvdU+zXQ+ciFVmTqgmrOkmMyq3Z6tAFG+fyUa8XiR6EJuVYY/62xgKOcQWFJQ6MMUIYZIjK6Og7VWb0r7FDwl57Vj3N53RbFNT/c4UBAvTPXFO6stJ5Ok+BPV8bUnV0K27LnpQ0kV7NSRKyQl7WtlRC6gE2ZVeOEXpc0Yk/KGdI/wAJWm7IAAAAeJxtyMEOQDAQBNCZslX+UhE2kbaSbvD3JK7e8cHhM+BfoGPDlkLPjoE9ePlV62ZRzkVjljrdlryVPY+zHJrUxMpbwANFHA6a') format('woff'),
|
||||
url('iconfont.ttf?t=1523001890286') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
|
||||
url('iconfont.svg?t=1523001890286#iconfont') format('svg'); /* iOS 4.1- */
|
||||
}
|
||||
|
||||
[class*=" el-icon-ui"], [class^=el-icon-ui] {
|
||||
@@ -15,6 +15,8 @@
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.el-icon-ui-github:before { content: "\e7ab"; }
|
||||
|
||||
.el-icon-ui-weibo:before { content: "\e61c"; }
|
||||
|
||||
.el-icon-ui-tcyun:before { content: "\e64c"; }
|
||||
|
||||
Binary file not shown.
@@ -27,6 +27,9 @@ t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-
|
||||
|
||||
|
||||
|
||||
<glyph glyph-name="github" unicode="" d="M512 822.894c-248.508 0-450-201.456-450-450 0-198.828 128.934-367.506 307.728-426.996 22.482-4.158 30.762 9.756 30.762 21.654 0 10.728-0.414 46.188-0.612 83.772-125.19-27.216-151.614 53.1-151.614 53.1-20.466 52.002-49.968 65.844-49.968 65.844-40.824 27.936 3.078 27.36 3.078 27.36 45.18-3.168 68.976-46.368 68.976-46.368 40.14-68.796 105.264-48.906 130.968-37.404 4.032 29.088 15.696 48.942 28.566 60.174-99.954 11.376-205.02 49.968-205.02 222.39 0 49.122 17.586 89.28 46.368 120.78-4.68 11.34-20.088 57.096 4.356 119.088 0 0 37.8 12.078 123.786-46.134 35.892 9.972 74.394 14.976 112.644 15.156 38.232-0.18 76.752-5.166 112.716-15.156 85.896 58.23 123.624 46.134 123.624 46.134 24.498-61.992 9.09-107.748 4.428-119.088 28.854-31.518 46.314-71.658 46.314-120.78 0-172.836-105.282-210.888-205.488-222.03 16.146-13.968 30.528-41.346 30.528-83.322 0-60.21-0.522-108.666-0.522-123.498 0-11.97 8.1-26.01 30.906-21.6 178.704 59.562 307.476 228.186 307.476 426.942 0 248.544-201.474 450-450 450z" horiz-adv-x="1024" />
|
||||
|
||||
|
||||
<glyph glyph-name="weibo" unicode="" d="M1013.46529415 545.47540804c0-14.8526376-11.46535652-26.88232091-25.58940469-26.8823209-14.12272255 0-25.56953354 12.03100762-25.56953352 26.8823209 0 1.34457994 0.18810806 2.64941756 0.37224319 3.94895792l-0.37224319 0c0 139.92901597-108.14394722 253.3466299-241.5222759 253.3466299-2.53151878 0-4.99680252-0.32587799-7.5296456-0.39211435l0 0.7842274c-12.33966437 1.93142522-21.81663342 13.00334437-21.81663343 26.49020656 0 13.48421356 9.47564343 24.53891019 21.81663343 26.4703354l0 0.02251979c0.06358643 0 0.14571841 0 0.20532929 0 1.16441905 0.17486105 2.34605934 0.36959327 3.56744197 0.36959325 0.39608859 0 0.79085155-0.08610622 1.18164029-0.10862599 0.79217586 0.04371526 1.57640327 0.10862599 2.38712599 0.10862599 161.74962231 0 292.86932347-137.4968504 292.86932348-307.08875061l-0.39608859 0C1013.25863924 548.1235012899999 1013.46529415 546.8199879900001 1013.46529415 545.47540804zM863.34794096 518.59176283c-14.12139824 0-25.56953354 12.03100762-25.56953354 26.8823209 0 3.56081781 0.68487418 6.96797006 1.88770995 10.0730871-2.98854387 64.2960783-52.1948614 115.73982917-113.60042345 118.60649873-2.81765575-1.13130087-5.84726626-1.80292934-9.0384895-1.80292935-14.11874832 0-25.58940468 12.02968331-25.5894047 26.86112543 0 13.50540903 9.47564343 24.55878134 21.81663342 26.49020656l0 0c0.06358643 0 0.12319732 0.0238454 0.18678375 0.0238454 1.18429021 0.17221243 2.3646062 0.36694464 3.58731185 0.36694464 0.39608859 0 0.79085155-0.10862599 1.18164028-0.12849716 0.79217586 0.06358643 1.57640327 0.12849716 2.38712598 0.12849716 92.9614561 0 168.34005063-79.10500064 168.34005064-176.6711449l-0.39078874 0c0.18810806-1.30086468 0.39078875-2.60437798 0.39078874-3.94895792C888.93602132 530.6227704400001 877.47066481 518.59176283 863.34794096 518.59176283zM754.87281718 449.10547541c20.4879504 2.58450683 43.02787472 1.45453025 68.32981684-5.21405452 70.0267688-18.47969046 98.02449494-65.7929995 94.95381909-137.84392388-3.10909257-73.41934842-80.46017767-204.8583047-196.12979627-275.14471646-77.16430135-51.85441078-177.86470788-87.75137581-282.42001895-87.7513758-221.16017403 0-429.07193204 134.69774021-429.07193204 300.83612299 0 2.19239377 0.20797922 4.40730732 0.30070958 6.60367404 0 0.0834563 0.01059709 0.17221243 0.01059709 0.23712316 0.15499118 3.17135339 0.35237202 6.34138245 0.70474535 9.51406017C25.08266092 424.84872796 281.96361331 686.07605117 358.85634901 693.93819893c71.77008594 7.33756332 148.28925417-16.54694094 142.21546312-106.1635069-0.4583494-6.73084688-1.94997206-13.94123735-3.85755316-21.34636133 57.46322827 34.46230593 125.08565114 58.5640622 185.94940747 46.83906271C766.77400333 597.1774775700001 787.13875511 513.92348823 754.87281718 449.10547541zM420.4857885 420.8110152c-165.81383039 0-300.19098985-93.13366851-300.19098984-208.04555373 0-114.89068974 134.37715946-208.02700817 300.19098984-208.02700818 165.77276377 0 300.16979438 93.13631843 300.16979438 208.02700818C720.6569072 327.67734540000004 586.25855228 420.8110152 420.4857885 420.8110152zM387.57869037 58.58919872000001c-86.91018613 0-157.33436782 65.55852496-157.33436783 146.3988943 0 80.84566786 70.4241817 146.39889428 157.33436783 146.39889429 86.90753621 0 157.35291338-65.5519021 157.35291337-146.39889429C544.93160374 124.1490493 474.48622658 58.58919872000001 387.57869037 58.58919872000001zM369.22484715 220.25404044000004c-28.36864372 0-51.34307333-24.08056079-51.34307335-53.76331621 0-29.68407973 22.97442832-53.74741927 51.34307335-53.74741926 28.36731941 0 51.36559312 24.06333954 51.36559313 53.74741926C420.59044028 196.17480396999997 397.59216656 220.25404044000004 369.22484715 220.25404044000004z" horiz-adv-x="1024" />
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 16 KiB |
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<div id="rename-page">
|
||||
<el-form
|
||||
@submit.native.prevent
|
||||
>
|
||||
<el-form-item
|
||||
label="文件改名"
|
||||
>
|
||||
<el-input
|
||||
v-model="fileName"
|
||||
size="small"
|
||||
@keyup.enter.native="confirmName"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="pull-right">
|
||||
<el-button @click="cancel" round size="mini">取消</el-button>
|
||||
<el-button type="primary" @click="confirmName" round size="mini">确定</el-button>
|
||||
</div>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'rename-page',
|
||||
data () {
|
||||
return {
|
||||
fileName: '',
|
||||
id: null
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.$electron.ipcRenderer.on('rename', (event, name, id) => {
|
||||
this.fileName = name
|
||||
this.id = id
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
confirmName () {
|
||||
this.$electron.ipcRenderer.send(`rename${this.id}`, this.fileName)
|
||||
},
|
||||
cancel () {
|
||||
this.$electron.ipcRenderer.send(`rename${this.id}`, null)
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.$electron.ipcRenderer.removeAllListeners('rename')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang='stylus'>
|
||||
#rename-page
|
||||
padding 0 20px
|
||||
.pull-right
|
||||
float right
|
||||
.el-form-item__label
|
||||
color #ddd
|
||||
</style>
|
||||
@@ -2,13 +2,18 @@
|
||||
<div id="setting-page">
|
||||
<div class="fake-title-bar">
|
||||
PicGo - {{ version }}
|
||||
<div class="handle-bar" v-if="os === 'win32'">
|
||||
<i class="el-icon-minus" @click="minimizeWindow"></i>
|
||||
<i class="el-icon-close" @click="closeWindow"></i>
|
||||
</div>
|
||||
</div>
|
||||
<el-row style="padding-top: 22px;">
|
||||
<el-col :span="5">
|
||||
<el-row style="padding-top: 22px;" class="main-content">
|
||||
<el-col :span="5" class="side-bar-menu">
|
||||
<el-menu
|
||||
class="picgo-sidebar"
|
||||
:default-active="defaultActive"
|
||||
@select="handleSelect"
|
||||
:unique-opened="true"
|
||||
>
|
||||
<el-menu-item index="upload">
|
||||
<i class="el-icon-upload"></i>
|
||||
@@ -18,24 +23,32 @@
|
||||
<i class="el-icon-picture"></i>
|
||||
<span slot="title">相册</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="weibo">
|
||||
<i class="el-icon-ui-weibo"></i>
|
||||
<span slot="title">微博设置</span>
|
||||
<el-submenu
|
||||
index="sub-menu"
|
||||
>
|
||||
<template slot="title">
|
||||
<i class="el-icon-menu"></i>
|
||||
<span>图床设置</span>
|
||||
</template>
|
||||
<template
|
||||
v-for="item in picBed"
|
||||
>
|
||||
<el-menu-item
|
||||
v-if="item.visible"
|
||||
:index="item.type"
|
||||
:key="item.type"
|
||||
>
|
||||
<i :class="`el-icon-ui-${item.type}`"></i>
|
||||
<span slot="title">{{ item.name }}</span>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</el-submenu>
|
||||
<el-menu-item index="setting">
|
||||
<i class="el-icon-setting"></i>
|
||||
<span slot="title">PicGo设置</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="qiniu">
|
||||
<i class="el-icon-ui-qiniu"></i>
|
||||
<span slot="title">七牛云设置</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="tcyun">
|
||||
<i class="el-icon-ui-tcyun"></i>
|
||||
<span slot="title">腾讯COS设置</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="upyun">
|
||||
<i class="el-icon-ui-upyun"></i>
|
||||
<span slot="title">又拍云设置</span>
|
||||
</el-menu-item>
|
||||
<i class="el-icon-setting" @click="openDialog"></i>
|
||||
</el-menu>
|
||||
<i class="el-icon-info setting-window" @click="openDialog"></i>
|
||||
</el-col>
|
||||
<el-col :span="19" :offset="5">
|
||||
<router-view></router-view>
|
||||
@@ -59,23 +72,100 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
title="修改快捷键"
|
||||
:visible.sync="keyBindingVisible"
|
||||
>
|
||||
<el-form
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item
|
||||
label="快捷上传"
|
||||
>
|
||||
<el-input
|
||||
class="align-center"
|
||||
@keydown.native.prevent="keyDetect('upload', $event)"
|
||||
v-model="shortKey.upload"
|
||||
:autofocus="true"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer">
|
||||
<el-button @click="cancelKeyBinding">取消</el-button>
|
||||
<el-button type="primary" @click="confirmKeyBinding">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
title="自定义链接格式"
|
||||
:visible.sync="customLinkVisible"
|
||||
>
|
||||
<el-form
|
||||
label-position="top"
|
||||
:model="customLink"
|
||||
ref="customLink"
|
||||
:rules="rules"
|
||||
>
|
||||
<el-form-item
|
||||
label="用占位符$url来表示url的位置"
|
||||
prop="value"
|
||||
>
|
||||
<el-input
|
||||
class="align-center"
|
||||
v-model="customLink.value"
|
||||
:autofocus="true"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div>
|
||||
如[]($url)
|
||||
</div>
|
||||
<span slot="footer">
|
||||
<el-button @click="cancelCustomLink">取消</el-button>
|
||||
<el-button type="primary" @click="confirmCustomLink">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import pkg from '../../../package.json'
|
||||
import keyDetect from 'utils/key-binding'
|
||||
import { remote } from 'electron'
|
||||
const { Menu, dialog } = remote
|
||||
import db from '../../datastore'
|
||||
const { Menu, dialog, BrowserWindow } = remote
|
||||
export default {
|
||||
name: 'setting-page',
|
||||
data () {
|
||||
const customLinkRule = (rule, value, callback) => {
|
||||
if (!/\$url/.test(value)) {
|
||||
return callback(new Error('必须含有$url'))
|
||||
} else {
|
||||
return callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
version: pkg.version,
|
||||
version: process.env.NODE_ENV === 'production' ? pkg.version : 'Dev',
|
||||
defaultActive: 'upload',
|
||||
menu: null,
|
||||
visible: false
|
||||
visible: false,
|
||||
keyBindingVisible: false,
|
||||
customLinkVisible: false,
|
||||
customLink: {
|
||||
value: db.read().get('customLink').value() || '$url'
|
||||
},
|
||||
rules: {
|
||||
value: [
|
||||
{ validator: customLinkRule, trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
os: '',
|
||||
shortKey: {
|
||||
upload: db.read().get('shortKey.upload').value()
|
||||
},
|
||||
picBed: this.$picBed
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.os = process.platform
|
||||
this.buildMenu()
|
||||
},
|
||||
methods: {
|
||||
@@ -84,6 +174,14 @@ export default {
|
||||
name: index
|
||||
})
|
||||
},
|
||||
minimizeWindow () {
|
||||
const window = BrowserWindow.getFocusedWindow()
|
||||
window.minimize()
|
||||
},
|
||||
closeWindow () {
|
||||
const window = BrowserWindow.getFocusedWindow()
|
||||
window.close()
|
||||
},
|
||||
buildMenu () {
|
||||
const _this = this
|
||||
const template = [
|
||||
@@ -108,6 +206,34 @@ export default {
|
||||
},
|
||||
openDialog () {
|
||||
this.menu.popup(remote.getCurrentWindow)
|
||||
},
|
||||
keyDetect (type, event) {
|
||||
this.shortKey[type] = keyDetect(event).join('+')
|
||||
},
|
||||
cancelKeyBinding () {
|
||||
this.keyBindingVisible = false
|
||||
this.shortKey = db.read().get('shortKey').value()
|
||||
},
|
||||
confirmKeyBinding () {
|
||||
const oldKey = db.read().get('shortKey').value()
|
||||
db.read().set('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'
|
||||
},
|
||||
confirmCustomLink () {
|
||||
this.$refs.customLink.validate((valid) => {
|
||||
if (valid) {
|
||||
db.read().set('customLink', this.customLink.value).write()
|
||||
this.customLinkVisible = false
|
||||
this.$electron.ipcRenderer.send('updateCustomLink')
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
beforeRouteEnter: (to, from, next) => {
|
||||
@@ -128,14 +254,31 @@ export default {
|
||||
font-size 12px
|
||||
line-height h
|
||||
position fixed
|
||||
.picgo-sidebar
|
||||
height calc(100vh - 22px)
|
||||
.el-menu
|
||||
border-right none
|
||||
background transparent
|
||||
position fixed
|
||||
.el-icon-setting
|
||||
z-index 100
|
||||
.handle-bar
|
||||
position absolute
|
||||
top 2px
|
||||
right 4px
|
||||
width 40px
|
||||
z-index 10000
|
||||
-webkit-app-region no-drag
|
||||
i
|
||||
cursor pointer
|
||||
font-size 16px
|
||||
.el-icon-minus
|
||||
&:hover
|
||||
color #409EFF
|
||||
.el-icon-close
|
||||
&:hover
|
||||
color #F15140
|
||||
.side-bar-menu
|
||||
position fixed
|
||||
height calc(100vh - 22px)
|
||||
overflow-x hidden
|
||||
overflow-y auto
|
||||
width 170px
|
||||
.el-icon-info.setting-window
|
||||
position fixed
|
||||
bottom 4px
|
||||
left 4px
|
||||
cursor pointer
|
||||
@@ -143,6 +286,10 @@ export default {
|
||||
transition .2s all ease-in-out
|
||||
&:hover
|
||||
color #409EFF
|
||||
.el-menu
|
||||
border-right none
|
||||
background transparent
|
||||
width 170px
|
||||
&-item
|
||||
color #eee
|
||||
position relative
|
||||
@@ -160,9 +307,31 @@ export default {
|
||||
right 0
|
||||
top 18px
|
||||
background active-color
|
||||
.el-submenu__title
|
||||
span
|
||||
color #eee
|
||||
&:hover
|
||||
background transparent
|
||||
span
|
||||
color #fff
|
||||
.el-submenu
|
||||
.el-menu-item
|
||||
min-width 166px
|
||||
&.is-active
|
||||
&:before
|
||||
top 16px
|
||||
.main-content
|
||||
padding-top 22px
|
||||
position relative
|
||||
z-index 10
|
||||
.el-dialog__body
|
||||
padding 20px
|
||||
.support
|
||||
text-align center
|
||||
&-title
|
||||
text-align center
|
||||
color #878d99
|
||||
.align-center
|
||||
input
|
||||
text-align center
|
||||
</style>
|
||||
@@ -21,12 +21,25 @@
|
||||
</div>
|
||||
<div class="gallery-list__tool-panel">
|
||||
<i class="el-icon-document" @click="copy(item.imgUrl)"></i>
|
||||
<i class="el-icon-edit-outline" @click="openDialog(item)"></i>
|
||||
<i class="el-icon-delete" @click="remove(item.id)"></i>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-dialog
|
||||
:visible.sync="dialogVisible"
|
||||
title="修改图片URL"
|
||||
width="500px"
|
||||
:modal-append-to-body="false"
|
||||
>
|
||||
<el-input v-model="imgInfo.imgUrl"></el-input>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="confirmModify">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@@ -45,6 +58,11 @@ export default {
|
||||
titleProperty: 'fileName',
|
||||
urlProperty: 'imgUrl',
|
||||
closeOnSlideClick: true
|
||||
},
|
||||
dialogVisible: false,
|
||||
imgInfo: {
|
||||
id: null,
|
||||
imgUrl: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -94,6 +112,28 @@ export default {
|
||||
}).catch(() => {
|
||||
return true
|
||||
})
|
||||
},
|
||||
openDialog (item) {
|
||||
this.imgInfo.id = item.id
|
||||
this.imgInfo.imgUrl = item.imgUrl
|
||||
this.dialogVisible = true
|
||||
},
|
||||
confirmModify () {
|
||||
this.$db.read().get('uploaded')
|
||||
.getById(this.imgInfo.id)
|
||||
.assign({imgUrl: this.imgInfo.imgUrl})
|
||||
.write()
|
||||
const obj = {
|
||||
title: '修改图片URL成功',
|
||||
body: this.imgInfo.imgUrl,
|
||||
icon: this.imgInfo.imgUrl
|
||||
}
|
||||
const myNotification = new window.Notification(obj.title, obj)
|
||||
myNotification.onclick = () => {
|
||||
return true
|
||||
}
|
||||
this.dialogVisible = false
|
||||
this.getGallery()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,7 +143,9 @@ export default {
|
||||
color #eee
|
||||
font-size 20px
|
||||
text-align center
|
||||
margin 20px auto
|
||||
margin 10px auto
|
||||
.sub-title
|
||||
font-size 14px
|
||||
#gallery-view
|
||||
.gallery-list
|
||||
height 360px
|
||||
@@ -142,6 +184,9 @@ export default {
|
||||
&.el-icon-document
|
||||
&:hover
|
||||
color #49B1F5
|
||||
&.el-icon-edit-outline
|
||||
&:hover
|
||||
color #69C282
|
||||
&.el-icon-delete
|
||||
&:hover
|
||||
color #F15140
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<div id="github-view">
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="16" :offset="4">
|
||||
<div class="view-title">
|
||||
GitHub设置
|
||||
</div>
|
||||
<el-form
|
||||
ref="github"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
:model="form"
|
||||
size="mini">
|
||||
<el-form-item
|
||||
label="设定仓库名"
|
||||
prop="repo"
|
||||
:rules="{
|
||||
required: true, message: '仓库名不能为空', trigger: 'blur'
|
||||
}">
|
||||
<el-input v-model="form.repo" @keyup.native.enter="confirm" placeholder="格式:username/repo"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="设定分支名"
|
||||
prop="branch"
|
||||
:rules="{
|
||||
required: true, message: '分支名不能为空', trigger: 'blur'
|
||||
}">
|
||||
<el-input v-model="form.branch" @keyup.native.enter="confirm" placeholder="例如:master"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="设定Token"
|
||||
prop="token"
|
||||
:rules="{
|
||||
required: true, message: 'Token不能为空', trigger: 'blur'
|
||||
}">
|
||||
<el-input v-model="form.token" @keyup.native.enter="confirm" placeholder="token"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="指定存储路径"
|
||||
>
|
||||
<el-input v-model="form.path" @keyup.native.enter="confirm" placeholder="例如img/"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="confirm" round>确定</el-button>
|
||||
<el-button type="success" @click="setDefaultPicBed('github')" round :disabled="defaultPicBed === 'github'">设为默认图床</el-button>
|
||||
</el-button-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import mixin from '../mixin'
|
||||
export default {
|
||||
name: 'upyun',
|
||||
mixins: [mixin],
|
||||
data () {
|
||||
return {
|
||||
form: {
|
||||
repo: '',
|
||||
token: '',
|
||||
path: '',
|
||||
branch: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
const config = this.$db.get('picBed.github').value()
|
||||
if (config) {
|
||||
for (let i in config) {
|
||||
this.form[i] = config[i]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
confirm () {
|
||||
this.$refs.github.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$db.set('picBed.github', this.form).write()
|
||||
const successNotification = new window.Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
})
|
||||
successNotification.onclick = () => {
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang='stylus'>
|
||||
.view-title
|
||||
color #eee
|
||||
font-size 20px
|
||||
text-align center
|
||||
margin 20px auto
|
||||
#github-view
|
||||
.el-form
|
||||
label
|
||||
line-height 22px
|
||||
padding-bottom 0
|
||||
color #eee
|
||||
.el-input__inner
|
||||
border-radius 19px
|
||||
.el-radio-group
|
||||
width 100%
|
||||
label
|
||||
width 25%
|
||||
.el-radio-button__inner
|
||||
width 100%
|
||||
.el-radio-button:first-child
|
||||
.el-radio-button__inner
|
||||
border-left none
|
||||
border-radius 14px 0 0 14px
|
||||
.el-radio-button:last-child
|
||||
.el-radio-button__inner
|
||||
border-left none
|
||||
border-radius 0 14px 14px 0
|
||||
</style>
|
||||
@@ -0,0 +1,279 @@
|
||||
<template>
|
||||
<div id="picgo-setting">
|
||||
<div class="view-title">
|
||||
PicGo设置
|
||||
</div>
|
||||
<el-row class="setting-list">
|
||||
<el-col :span="15" :offset="4">
|
||||
<el-row>
|
||||
<el-form
|
||||
label-width="120px"
|
||||
label-position="right"
|
||||
size="small"
|
||||
>
|
||||
<el-form-item
|
||||
label="修改快捷键"
|
||||
>
|
||||
<el-button type="primary" round size="mini" @click="keyBindingVisible = true">点击设置</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="自定义链接格式"
|
||||
>
|
||||
<el-button type="primary" round size="mini" @click="customLinkVisible = true">点击设置</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="打开更新助手"
|
||||
>
|
||||
<el-switch
|
||||
v-model="form.updateHelper"
|
||||
active-text="开"
|
||||
inactive-text="关"
|
||||
@change="updateHelperChange"
|
||||
></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="开机自启"
|
||||
>
|
||||
<el-switch
|
||||
v-model="form.autoStart"
|
||||
active-text="开"
|
||||
inactive-text="关"
|
||||
@change="handleAutoStartChange"
|
||||
></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="上传前重命名"
|
||||
>
|
||||
<el-switch
|
||||
v-model="form.rename"
|
||||
active-text="开"
|
||||
inactive-text="关"
|
||||
@change="handleRename"
|
||||
></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="选择显示的图床"
|
||||
>
|
||||
<el-checkbox-group
|
||||
v-model="form.showPicBedList"
|
||||
@change="handleShowPicBedListChange"
|
||||
>
|
||||
<el-checkbox
|
||||
v-for="item in picBed"
|
||||
:label="item.name"
|
||||
:key="item.name"
|
||||
></el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-dialog
|
||||
title="修改快捷键"
|
||||
:visible.sync="keyBindingVisible"
|
||||
:modal-append-to-body="false"
|
||||
>
|
||||
<el-form
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item
|
||||
label="快捷上传"
|
||||
>
|
||||
<el-input
|
||||
class="align-center"
|
||||
@keydown.native.prevent="keyDetect('upload', $event)"
|
||||
v-model="shortKey.upload"
|
||||
:autofocus="true"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer">
|
||||
<el-button @click="cancelKeyBinding">取消</el-button>
|
||||
<el-button type="primary" @click="confirmKeyBinding">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
title="自定义链接格式"
|
||||
:visible.sync="customLinkVisible"
|
||||
:modal-append-to-body="false"
|
||||
>
|
||||
<el-form
|
||||
label-position="top"
|
||||
:model="customLink"
|
||||
ref="customLink"
|
||||
:rules="rules"
|
||||
>
|
||||
<el-form-item
|
||||
label="用占位符$url来表示url的位置"
|
||||
prop="value"
|
||||
>
|
||||
<el-input
|
||||
class="align-center"
|
||||
v-model="customLink.value"
|
||||
:autofocus="true"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div>
|
||||
如[]($url)
|
||||
</div>
|
||||
<span slot="footer">
|
||||
<el-button @click="cancelCustomLink">取消</el-button>
|
||||
<el-button type="primary" @click="confirmCustomLink">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import db from '../../../datastore'
|
||||
import keyDetect from 'utils/key-binding'
|
||||
export default {
|
||||
name: 'picgo-setting',
|
||||
data () {
|
||||
const customLinkRule = (rule, value, callback) => {
|
||||
if (!/\$url/.test(value)) {
|
||||
return callback(new Error('必须含有$url'))
|
||||
} else {
|
||||
return callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
form: {
|
||||
updateHelper: this.$db.get('picBed.showUpdateTip').value(),
|
||||
showPicBedList: [],
|
||||
autoStart: this.$db.get('picBed.autoStart').value() || false,
|
||||
rename: this.$db.get('picBed.rename').value() || false
|
||||
},
|
||||
picBed: this.$picBed,
|
||||
keyBindingVisible: false,
|
||||
customLinkVisible: false,
|
||||
customLink: {
|
||||
value: db.read().get('customLink').value() || '$url'
|
||||
},
|
||||
shortKey: {
|
||||
upload: db.read().get('shortKey.upload').value()
|
||||
},
|
||||
rules: {
|
||||
value: [
|
||||
{ validator: customLinkRule, trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.form.showPicBedList = this.picBed.map(item => {
|
||||
if (item.visible) {
|
||||
return item.name
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
keyDetect (type, event) {
|
||||
this.shortKey[type] = keyDetect(event).join('+')
|
||||
},
|
||||
cancelKeyBinding () {
|
||||
this.keyBindingVisible = false
|
||||
this.shortKey = db.read().get('shortKey').value()
|
||||
},
|
||||
confirmKeyBinding () {
|
||||
const oldKey = db.read().get('shortKey').value()
|
||||
db.read().set('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'
|
||||
},
|
||||
confirmCustomLink () {
|
||||
this.$refs.customLink.validate((valid) => {
|
||||
if (valid) {
|
||||
db.read().set('customLink', this.customLink.value).write()
|
||||
this.customLinkVisible = false
|
||||
this.$electron.ipcRenderer.send('updateCustomLink')
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
updateHelperChange (val) {
|
||||
this.$db.read().set('picBed.showUpdateTip', val).write()
|
||||
},
|
||||
handleShowPicBedListChange (val) {
|
||||
const list = this.picBed.map(item => {
|
||||
if (!val.includes(item.name)) {
|
||||
item.visible = false
|
||||
} else {
|
||||
item.visible = true
|
||||
}
|
||||
return item
|
||||
})
|
||||
this.$db.read().set('picBed.list', list).write()
|
||||
},
|
||||
handleAutoStartChange (val) {
|
||||
this.$db.read().set('picBed.autoStart', val).write()
|
||||
this.$electron.ipcRenderer.send('autoStart', val)
|
||||
},
|
||||
handleRename (val) {
|
||||
this.$db.read().set('picBed.rename', val).write()
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.$electron.ipcRenderer.removeAllListeners('autoStart')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang='stylus'>
|
||||
.el-message
|
||||
left 60%
|
||||
.view-title
|
||||
color #eee
|
||||
font-size 20px
|
||||
text-align center
|
||||
margin 20px auto
|
||||
#picgo-setting
|
||||
.sub-title
|
||||
font-size 14px
|
||||
.setting-list
|
||||
height 360px
|
||||
box-sizing border-box
|
||||
overflow-y auto
|
||||
overflow-x hidden
|
||||
.setting-list
|
||||
.el-form
|
||||
label
|
||||
line-height 32px
|
||||
padding-bottom 0
|
||||
color #eee
|
||||
.el-button-group
|
||||
width 100%
|
||||
.el-button
|
||||
width 50%
|
||||
.el-input__inner
|
||||
border-radius 19px
|
||||
.el-radio-group
|
||||
margin-left 25px
|
||||
.el-switch__label
|
||||
color #eee
|
||||
&.is-active
|
||||
color #409EFF
|
||||
.el-icon-question
|
||||
font-size 20px
|
||||
float right
|
||||
margin-top 9px
|
||||
color #eee
|
||||
cursor pointer
|
||||
transition .2s color ease-in-out
|
||||
&:hover
|
||||
color #409EFF
|
||||
.el-checkbox-group
|
||||
label
|
||||
margin-right 30px
|
||||
width 100px
|
||||
.el-checkbox+.el-checkbox
|
||||
margin-right 30px
|
||||
margin-left 0
|
||||
.confirm-button
|
||||
width 100%
|
||||
</style>
|
||||
@@ -58,8 +58,16 @@
|
||||
>
|
||||
<el-input v-model="form.options" @keyup.native.enter="confirm" placeholder="例如?imageslim"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="指定存储路径"
|
||||
>
|
||||
<el-input v-model="form.path" @keyup.native.enter="confirm" placeholder="例如img/"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="confirm">确定</el-button>
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="confirm" round>确定</el-button>
|
||||
<el-button type="success" @click="setDefaultPicBed('qiniu')" round :disabled="defaultPicBed === 'qiniu'">设为默认图床</el-button>
|
||||
</el-button-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
@@ -79,7 +87,8 @@ export default {
|
||||
bucket: '',
|
||||
url: '',
|
||||
area: 'z0',
|
||||
options: ''
|
||||
options: '',
|
||||
path: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -122,11 +131,10 @@ export default {
|
||||
line-height 22px
|
||||
padding-bottom 0
|
||||
color #eee
|
||||
.el-button
|
||||
width 100%
|
||||
border-radius 19px
|
||||
.el-input__inner
|
||||
border-radius 19px
|
||||
&-item
|
||||
margin-bottom 10.5px
|
||||
.el-radio-group
|
||||
width 100%
|
||||
label
|
||||
|
||||
@@ -11,6 +11,19 @@
|
||||
label-width="120px"
|
||||
:model="form"
|
||||
size="mini">
|
||||
<el-form-item
|
||||
label="COS版本"
|
||||
>
|
||||
<el-switch
|
||||
v-model="form.version"
|
||||
active-text="v4"
|
||||
inactive-text="v5"
|
||||
active-value="v4"
|
||||
inactive-value="v5"
|
||||
inactive-color="#67C23A"
|
||||
></el-switch>
|
||||
<i class="el-icon-question" @click="openWiki"></i>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="设定SecretId"
|
||||
prop="secretId"
|
||||
@@ -56,8 +69,16 @@
|
||||
>
|
||||
<el-input v-model="form.path" @keyup.native.enter="confirm" placeholder="例如img/"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="设定自定义域名"
|
||||
>
|
||||
<el-input v-model="form.customUrl" @keyup.native.enter="confirm" placeholder="例如https://xxxx.com"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="confirm">确定</el-button>
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="confirm" round>确定</el-button>
|
||||
<el-button type="success" @click="setDefaultPicBed('tcyun')" round :disabled="defaultPicBed === 'tcyun'">设为默认图床</el-button>
|
||||
</el-button-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
@@ -77,7 +98,9 @@ export default {
|
||||
bucket: '',
|
||||
appId: '',
|
||||
area: '',
|
||||
path: ''
|
||||
path: '',
|
||||
customUrl: '',
|
||||
version: 'v4'
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -104,6 +127,9 @@ export default {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
openWiki () {
|
||||
this.$electron.remote.shell.openExternal('https://github.com/Molunerfinn/PicGo/wiki/%E8%AF%A6%E7%BB%86%E7%AA%97%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8#%E5%BE%AE%E5%8D%9A%E5%9B%BE%E5%BA%8A')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,11 +146,10 @@ export default {
|
||||
line-height 22px
|
||||
padding-bottom 0
|
||||
color #eee
|
||||
.el-button
|
||||
width 100%
|
||||
border-radius 19px
|
||||
.el-input__inner
|
||||
border-radius 19px
|
||||
&-item
|
||||
margin-bottom 10.5px
|
||||
.el-radio-group
|
||||
width 100%
|
||||
label
|
||||
@@ -139,4 +164,17 @@ export default {
|
||||
.el-radio-button__inner
|
||||
border-left none
|
||||
border-radius 0 14px 14px 0
|
||||
.el-switch__label
|
||||
color #eee
|
||||
&.is-active
|
||||
color #409EFF
|
||||
.el-icon-question
|
||||
font-size 20px
|
||||
float right
|
||||
margin-top 9px
|
||||
color #eee
|
||||
cursor pointer
|
||||
transition .2s color ease-in-out
|
||||
&:hover
|
||||
color #409EFF
|
||||
</style>
|
||||
@@ -48,8 +48,16 @@
|
||||
>
|
||||
<el-input v-model="form.options" @keyup.native.enter="confirm" placeholder="例如!imgslim"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="指定存储路径"
|
||||
>
|
||||
<el-input v-model="form.path" @keyup.native.enter="confirm" placeholder="例如img/"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="confirm">确定</el-button>
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="confirm" round>确定</el-button>
|
||||
<el-button type="success" @click="setDefaultPicBed('upyun')" round :disabled="defaultPicBed === 'upyun'">设为默认图床</el-button>
|
||||
</el-button-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
@@ -67,7 +75,8 @@ export default {
|
||||
bucket: '',
|
||||
operator: '',
|
||||
password: '',
|
||||
options: ''
|
||||
options: '',
|
||||
path: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -110,9 +119,6 @@ export default {
|
||||
line-height 22px
|
||||
padding-bottom 0
|
||||
color #eee
|
||||
.el-button
|
||||
width 100%
|
||||
border-radius 19px
|
||||
.el-input__inner
|
||||
border-radius 19px
|
||||
.el-radio-group
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div id="upload-view">
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="16" :offset="4">
|
||||
<el-col :span="20" :offset="2">
|
||||
<div class="view-title">
|
||||
图片上传
|
||||
图片上传 - {{ picBed }}
|
||||
</div>
|
||||
<div
|
||||
id="upload-area"
|
||||
@@ -25,19 +25,28 @@
|
||||
:status="showError ? 'exception' : ''"
|
||||
></el-progress>
|
||||
<div class="paste-style">
|
||||
<div class="paste-style__text">
|
||||
链接格式
|
||||
<div class="el-col-16">
|
||||
<div class="paste-style__text">
|
||||
链接格式
|
||||
</div>
|
||||
<el-radio-group v-model="pasteStyle" size="mini"
|
||||
@change="handlePasteStyleChange"
|
||||
>
|
||||
<el-radio-button label="markdown">
|
||||
Markdown
|
||||
</el-radio-button>
|
||||
<el-radio-button label="HTML"></el-radio-button>
|
||||
<el-radio-button label="URL"></el-radio-button>
|
||||
<el-radio-button label="UBB"></el-radio-button>
|
||||
<el-radio-button label="Custom" title="自定义"></el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div class="el-col-8">
|
||||
<div class="paste-style__text">
|
||||
快捷上传
|
||||
</div>
|
||||
<el-button type="primary" round size="mini" @click="uploadClipboardFiles" class="paste-upload">剪贴板图片上传</el-button>
|
||||
</div>
|
||||
<el-radio-group v-model="pasteStyle" size="mini"
|
||||
@change="handlePasteStyleChange"
|
||||
>
|
||||
<el-radio-button label="markdown">
|
||||
Markdown
|
||||
</el-radio-button>
|
||||
<el-radio-button label="HTML"> </el-radio-button>
|
||||
<el-radio-button label="URL"> </el-radio-button>
|
||||
<el-radio-button label="UBB"> </el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -54,7 +63,8 @@ export default {
|
||||
progress: 0,
|
||||
showProgress: false,
|
||||
showError: false,
|
||||
pasteStyle: ''
|
||||
pasteStyle: '',
|
||||
picBed: ''
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
@@ -68,6 +78,7 @@ export default {
|
||||
}
|
||||
})
|
||||
this.getPasteStyle()
|
||||
this.getDefaultPicBed()
|
||||
},
|
||||
watch: {
|
||||
progress (val) {
|
||||
@@ -114,6 +125,17 @@ export default {
|
||||
handlePasteStyleChange (val) {
|
||||
this.$db.read().set('picBed.pasteStyle', val)
|
||||
.write()
|
||||
},
|
||||
uploadClipboardFiles () {
|
||||
this.$electron.ipcRenderer.send('uploadClipboardFilesFromUploadPage')
|
||||
},
|
||||
getDefaultPicBed () {
|
||||
const current = this.$db.read().get('picBed.current').value()
|
||||
this.$picBed.forEach(item => {
|
||||
if (item.type === current) {
|
||||
this.picBed = item.name
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,6 +152,8 @@ export default {
|
||||
border 2px dashed #dddddd
|
||||
border-radius 8px
|
||||
text-align center
|
||||
width 450px
|
||||
margin 0 auto
|
||||
color #dddddd
|
||||
cursor pointer
|
||||
transition all .2s ease-in-out
|
||||
@@ -149,9 +173,10 @@ export default {
|
||||
#file-uploader
|
||||
display none
|
||||
.upload-progress
|
||||
margin-top 20px
|
||||
opacity 0
|
||||
transition all .2s ease-in-out
|
||||
width 450px
|
||||
margin 20px auto 0
|
||||
&.show
|
||||
opacity 1
|
||||
.el-progress-bar__inner
|
||||
@@ -174,4 +199,6 @@ export default {
|
||||
.el-radio-button__inner
|
||||
border-left none
|
||||
border-radius 0 14px 14px 0
|
||||
.paste-upload
|
||||
width 100%
|
||||
</style>
|
||||
@@ -1,30 +1,47 @@
|
||||
<template>
|
||||
<div id="weibo-view">
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="6">
|
||||
<el-col :span="16" :offset="4">
|
||||
<div class="view-title">
|
||||
微博图床设置
|
||||
</div>
|
||||
<el-form
|
||||
ref="weiboForm"
|
||||
label-position="top"
|
||||
label-width="80px"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
size="small"
|
||||
:model="form">
|
||||
<el-form-item
|
||||
label="设定用户名"
|
||||
prop="username"
|
||||
:rules="{
|
||||
required: true, message: '用户名不能为空', trigger: 'blur'
|
||||
required: !chooseCookie, message: '用户名不能为空', trigger: 'blur'
|
||||
}">
|
||||
<el-input v-model="form.username" placeholder="用户名" @keyup.native.enter="confirm('weiboForm')"></el-input>
|
||||
<el-input v-model="form.username" placeholder="用户名" @keyup.native.enter="confirm('weiboForm')" :disabled="chooseCookie"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="设定密码"
|
||||
prop="password"
|
||||
:rules="{required: !chooseCookie,messsage: '密码不能为空',trigger: 'blur'}">
|
||||
<el-input v-model="form.password" type="password" @keyup.native.enter="confirm('weiboForm')" placeholder="密码" :disabled="chooseCookie"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="使用Cookie上传"
|
||||
>
|
||||
<el-switch
|
||||
v-model="chooseCookie"
|
||||
active-text="cookie模式"
|
||||
@change="handleSwitchChange"
|
||||
></el-switch>
|
||||
<i class="el-icon-question" @click="openWiki"></i>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="设定Cookie"
|
||||
prop="cookie"
|
||||
:rules="{
|
||||
required: true, message: '密码不能为空', trigger: 'blur'
|
||||
required: chooseCookie, message: '密码不能为空', trigger: 'blur'
|
||||
}">
|
||||
<el-input v-model="form.password" type="password" @keyup.native.enter="confirm('weiboForm')" placeholder="密码"></el-input>
|
||||
<el-input v-model="form.cookie" @keyup.native.enter="confirm('weiboForm')" placeholder="Cookie" :disabled="!chooseCookie"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="* 图片质量">
|
||||
<el-radio-group v-model="quality">
|
||||
@@ -34,7 +51,10 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="confirm('weiboForm')" round>确定</el-button>
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="confirm('weiboForm')" round>确定</el-button>
|
||||
<el-button type="success" @click="setDefaultPicBed('weibo')" round :disabled="defaultPicBed === 'weibo'">设为默认图床</el-button>
|
||||
</el-button-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
@@ -50,8 +70,10 @@ export default {
|
||||
return {
|
||||
form: {
|
||||
username: '',
|
||||
password: ''
|
||||
password: '',
|
||||
cookie: ''
|
||||
},
|
||||
chooseCookie: false,
|
||||
quality: 'large'
|
||||
}
|
||||
},
|
||||
@@ -61,6 +83,8 @@ export default {
|
||||
this.form.username = config.username
|
||||
this.form.password = config.password
|
||||
this.quality = config.quality || 'large'
|
||||
this.form.cookie = config.cookie
|
||||
this.chooseCookie = config.chooseCookie
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -70,7 +94,9 @@ export default {
|
||||
this.$db.read().set('picBed.weibo', {
|
||||
username: this.form.username,
|
||||
password: this.form.password,
|
||||
quality: this.quality
|
||||
quality: this.quality,
|
||||
cookie: this.form.cookie,
|
||||
chooseCookie: this.chooseCookie
|
||||
}).write()
|
||||
const successNotification = new window.Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
@@ -82,6 +108,12 @@ export default {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
handleSwitchChange () {
|
||||
this.$refs['weiboForm'].resetFields()
|
||||
},
|
||||
openWiki () {
|
||||
this.$electron.remote.shell.openExternal('https://github.com/Molunerfinn/PicGo/wiki/%E8%AF%A6%E7%BB%86%E7%AA%97%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8#%E5%BE%AE%E5%8D%9A%E5%9B%BE%E5%BA%8A')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,10 +132,25 @@ export default {
|
||||
line-height 22px
|
||||
padding-bottom 0
|
||||
color #eee
|
||||
.el-button
|
||||
.el-button-group
|
||||
width 100%
|
||||
.el-button
|
||||
width 50%
|
||||
.el-input__inner
|
||||
border-radius 19px
|
||||
.el-radio-group
|
||||
margin-left 25px
|
||||
.el-switch__label
|
||||
color #eee
|
||||
&.is-active
|
||||
color #409EFF
|
||||
.el-icon-question
|
||||
font-size 20px
|
||||
float right
|
||||
margin-top 9px
|
||||
color #eee
|
||||
cursor pointer
|
||||
transition .2s color ease-in-out
|
||||
&:hover
|
||||
color #409EFF
|
||||
</style>
|
||||
@@ -1,7 +1,13 @@
|
||||
import db from '../../datastore'
|
||||
export default {
|
||||
mounted () {
|
||||
this.disableDragEvent()
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
defaultPicBed: db.read().get('picBed.current').value()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
disableDragEvent () {
|
||||
window.addEventListener('dragenter', this.disableDrag, false)
|
||||
@@ -15,6 +21,17 @@ export default {
|
||||
e.dataTransfer.effectAllowed = 'none'
|
||||
e.dataTransfer.dropEffect = 'none'
|
||||
}
|
||||
},
|
||||
setDefaultPicBed (type) {
|
||||
db.read().set('picBed.current', type).write()
|
||||
this.defaultPicBed = type
|
||||
this.$electron.ipcRenderer.send('updateDefaultPicBed')
|
||||
const successNotification = new window.Notification('设置默认图床', {
|
||||
body: '设置成功'
|
||||
})
|
||||
successNotification.onclick = () => {
|
||||
return true
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
|
||||
@@ -8,6 +8,7 @@ import store from './store'
|
||||
import db from '../datastore/index'
|
||||
import { webFrame } from 'electron'
|
||||
import './assets/fonts/iconfont.css'
|
||||
import picBed from '../datastore/pic-bed'
|
||||
Vue.use(ElementUI)
|
||||
|
||||
webFrame.setVisualZoomLevelLimits(1, 1)
|
||||
@@ -16,6 +17,7 @@ webFrame.setLayoutZoomLevelLimits(0, 0)
|
||||
if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
|
||||
Vue.http = Vue.prototype.$http = axios
|
||||
Vue.prototype.$db = db
|
||||
Vue.prototype.$picBed = picBed
|
||||
Vue.config.productionTip = false
|
||||
|
||||
/* eslint-disable no-new */
|
||||
|
||||
@@ -10,6 +10,11 @@ export default new Router({
|
||||
name: 'tray-page',
|
||||
component: require('@/components/TrayPage').default
|
||||
},
|
||||
{
|
||||
path: '/rename-page',
|
||||
name: 'rename-page',
|
||||
component: require('@/components/RenamePage').default
|
||||
},
|
||||
{
|
||||
path: '/setting',
|
||||
name: 'setting-page',
|
||||
@@ -40,10 +45,20 @@ export default new Router({
|
||||
component: require('@/components/SettingView/UpYun').default,
|
||||
name: 'upyun'
|
||||
},
|
||||
{
|
||||
path: 'github',
|
||||
component: require('@/components/SettingView/GitHub').default,
|
||||
name: 'github'
|
||||
},
|
||||
{
|
||||
path: 'gallery',
|
||||
component: require('@/components/SettingView/Gallery').default,
|
||||
name: 'gallery'
|
||||
},
|
||||
{
|
||||
path: 'setting',
|
||||
component: require('@/components/SettingView/PicGoSetting').default,
|
||||
name: 'setting'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import keycode from 'keycode'
|
||||
|
||||
const isSpecialKey = (keyCode) => {
|
||||
const keyArr = [
|
||||
16, // Shift
|
||||
17, // Ctrl
|
||||
18, // Alt
|
||||
91, // Left Meta
|
||||
93 // Right Meta
|
||||
]
|
||||
|
||||
return keyArr.includes(keyCode)
|
||||
}
|
||||
|
||||
const keyDetect = (event) => {
|
||||
const meta = process.platform === 'darwin' ? 'Cmd' : 'Super'
|
||||
let specialKey = {
|
||||
Ctrl: event.ctrlKey,
|
||||
Shift: event.shiftKey,
|
||||
Alt: event.altKey
|
||||
}
|
||||
specialKey[meta] = event.metaKey
|
||||
|
||||
let pressKey = []
|
||||
|
||||
for (let i in specialKey) {
|
||||
if (specialKey[i]) {
|
||||
pressKey.push(i)
|
||||
}
|
||||
}
|
||||
|
||||
if (!isSpecialKey(event.keyCode)) {
|
||||
pressKey.push(keycode(event.keyCode).toUpperCase())
|
||||
}
|
||||
return pressKey
|
||||
}
|
||||
|
||||
export default keyDetect
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 744 B |
@@ -3556,6 +3556,10 @@ fd-slicer@~1.0.1:
|
||||
dependencies:
|
||||
pend "~1.2.0"
|
||||
|
||||
fecha@^2.3.3:
|
||||
version "2.3.3"
|
||||
resolved "http://registry.npm.taobao.org/fecha/download/fecha-2.3.3.tgz#948e74157df1a32fd1b12c3a3c3cdcb6ec9d96cd"
|
||||
|
||||
figures@^1.4.0:
|
||||
version "1.7.0"
|
||||
resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e"
|
||||
@@ -4884,6 +4888,10 @@ keyboardevents-areequal@^0.2.1:
|
||||
version "0.2.2"
|
||||
resolved "https://registry.yarnpkg.com/keyboardevents-areequal/-/keyboardevents-areequal-0.2.2.tgz#88191ec738ce9f7591c25e9056de928b40277194"
|
||||
|
||||
keycode@^2.1.9:
|
||||
version "2.1.9"
|
||||
resolved "https://registry.yarnpkg.com/keycode/-/keycode-2.1.9.tgz#964a23c54e4889405b4861a5c9f0480d45141dfa"
|
||||
|
||||
keypress@0.1.x:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/keypress/-/keypress-0.1.0.tgz#4a3188d4291b66b4f65edb99f806aa9ae293592a"
|
||||
|
||||
Reference in New Issue
Block a user