mirror of
https://github.com/Molunerfinn/PicGo.git
synced 2024-04-21 10:31:33 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
406cfffbc9 | ||
|
|
e5d5bad115 | ||
|
|
7364ea6ddf | ||
|
|
f657026820 | ||
|
|
e8e78303a3 | ||
|
|
29fb9c742e | ||
|
|
16f518b2ad | ||
|
|
790367efd6 | ||
|
|
7e9fd9d14e | ||
|
|
9df9b547d1 |
Vendored
+21
-1
@@ -4,14 +4,34 @@
|
|||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"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",
|
"name": "Attach",
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "attach",
|
"request": "attach",
|
||||||
"port": 5858,
|
"port": 5858,
|
||||||
"sourceMaps": false,
|
"sourceMaps": true,
|
||||||
|
"restart": true,
|
||||||
"outFiles": [],
|
"outFiles": [],
|
||||||
"localRoot": "${workspaceRoot}",
|
"localRoot": "${workspaceRoot}",
|
||||||
|
"protocol": "inspector",
|
||||||
"remoteRoot": null
|
"remoteRoot": null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ PicGo目前支持了`微博图床`,`七牛图床`,`腾讯云COS`,`又拍
|
|||||||
|
|
||||||
支持macOS、windows 64位(v1.3.0以上)系统,未来将支持linux。
|
支持macOS、windows 64位(v1.3.0以上)系统,未来将支持linux。
|
||||||
|
|
||||||
点击此处下载[应用](https://github.com/Molunerfinn/PicGo/releases),macOS用户请下载最新版本的`dmg`文件。
|
支持快捷键`command+shift+p`(macOS)或者`control+shift+p`(windows)用以支持快捷上传剪贴板里的图片(第一张)。
|
||||||
|
|
||||||
|
点击此处下载[应用](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)。
|
如果第一次使用,请参考应用使用[手册](https://github.com/Molunerfinn/PicGo/wiki)。
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -21,9 +21,8 @@ init:
|
|||||||
|
|
||||||
install:
|
install:
|
||||||
- ps: Install-Product node 8 x64
|
- ps: Install-Product node 8 x64
|
||||||
- choco install yarn --ignore-dependencies
|
|
||||||
- git reset --hard HEAD
|
- git reset --hard HEAD
|
||||||
- yarn
|
- npm install
|
||||||
- node --version
|
- node --version
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
|
|||||||
+2
-1
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "picgo",
|
"name": "picgo",
|
||||||
"version": "1.3.0",
|
"version": "1.3.2",
|
||||||
"author": "Molunerfinn <marksz@teamsz.xyz>",
|
"author": "Molunerfinn <marksz@teamsz.xyz>",
|
||||||
"description": "Easy to upload your pic & copy to write",
|
"description": "Easy to upload your pic & copy to write",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./dist/electron/main.js",
|
"main": "./dist/electron/main.js",
|
||||||
"scripts": {
|
"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",
|
"build": "node .electron-vue/build.js && electron-builder",
|
||||||
"release": "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",
|
"build:dir": "node .electron-vue/build.js && electron-builder --dir",
|
||||||
|
|||||||
@@ -24,4 +24,15 @@ require('electron').app.on('ready', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Require `main` process to boot app
|
// Require `main` process to boot app
|
||||||
|
if (process.env.DEBUG_ENV === 'debug') {
|
||||||
|
require('babel-core/register')({
|
||||||
|
'presets': [
|
||||||
|
['env', {
|
||||||
|
'targets': {
|
||||||
|
'node': true
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}
|
||||||
require('./index')
|
require('./index')
|
||||||
|
|||||||
+3
-2
@@ -13,6 +13,9 @@ import pkg from '../../package.json'
|
|||||||
if (process.env.NODE_ENV !== 'development') {
|
if (process.env.NODE_ENV !== 'development') {
|
||||||
global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
|
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 window
|
||||||
let settingWindow
|
let settingWindow
|
||||||
@@ -374,12 +377,10 @@ const isSecondInstance = app.makeSingleInstance(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (isSecondInstance) {
|
if (isSecondInstance) {
|
||||||
console.log('is 2')
|
|
||||||
app.quit()
|
app.quit()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
console.log(pkg.build.appId)
|
|
||||||
app.setAppUserModelId(pkg.build.appId)
|
app.setAppUserModelId(pkg.build.appId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,26 +28,48 @@ const weiboUpload = async function (img, type, webContents) {
|
|||||||
password: db.read().get('picBed.weibo.password').value()
|
password: db.read().get('picBed.weibo.password').value()
|
||||||
}
|
}
|
||||||
const quality = db.read().get('picBed.weibo.quality').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 options = postOptions(formData)
|
||||||
const res = await rp(options)
|
let res
|
||||||
|
if (!chooseCookie) {
|
||||||
|
res = await rp(options)
|
||||||
|
}
|
||||||
webContents.send('uploadProgress', 30)
|
webContents.send('uploadProgress', 30)
|
||||||
if (res.body.retcode === 20000000) {
|
if (chooseCookie || res.body.retcode === 20000000) {
|
||||||
for (let i in res.body.data.crossdomainlist) {
|
if (res) {
|
||||||
await rp.get(res.body.data.crossdomainlist[i])
|
for (let i in res.body.data.crossdomainlist) {
|
||||||
|
await rp.get(res.body.data.crossdomainlist[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
webContents.send('uploadProgress', 60)
|
webContents.send('uploadProgress', 60)
|
||||||
const imgList = await img2Base64[type](img)
|
const imgList = await img2Base64[type](img)
|
||||||
for (let i in imgList) {
|
for (let i in imgList) {
|
||||||
let result = await rp.post(UPLOAD_URL, {
|
let opt = {
|
||||||
formData: {
|
formData: {
|
||||||
b64_data: imgList[i].base64Image
|
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>/, '')
|
result = result.replace(/<.*?\/>/, '').replace(/<(\w+).*?>.*?<\/\1>/, '')
|
||||||
delete imgList[i].base64Image
|
delete imgList[i].base64Image
|
||||||
const resTextJson = JSON.parse(result)
|
const resTextJson = JSON.parse(result)
|
||||||
imgList[i]['imgUrl'] = `https://ws1.sinaimg.cn/${quality}/${resTextJson.data.pics.pic_1.pid}`
|
if (resTextJson.data.pics.pic_1.pid === undefined) {
|
||||||
imgList[i]['type'] = 'weibo'
|
webContents.send('uploadProgress', -1)
|
||||||
|
const notification = new Notification({
|
||||||
|
title: '上传失败!',
|
||||||
|
body: '微博Cookie失效,请在网页版重新登录一遍'
|
||||||
|
})
|
||||||
|
notification.show()
|
||||||
|
} else {
|
||||||
|
imgList[i]['imgUrl'] = `https://ws1.sinaimg.cn/${quality}/${resTextJson.data.pics.pic_1.pid}`
|
||||||
|
imgList[i]['type'] = 'weibo'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
webContents.send('uploadProgress', 100)
|
webContents.send('uploadProgress', 100)
|
||||||
return imgList
|
return imgList
|
||||||
|
|||||||
@@ -1,30 +1,47 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="weibo-view">
|
<div id="weibo-view">
|
||||||
<el-row :gutter="16">
|
<el-row :gutter="16">
|
||||||
<el-col :span="12" :offset="6">
|
<el-col :span="16" :offset="4">
|
||||||
<div class="view-title">
|
<div class="view-title">
|
||||||
微博图床设置
|
微博图床设置
|
||||||
</div>
|
</div>
|
||||||
<el-form
|
<el-form
|
||||||
ref="weiboForm"
|
ref="weiboForm"
|
||||||
label-position="top"
|
label-position="right"
|
||||||
label-width="80px"
|
label-width="120px"
|
||||||
|
size="small"
|
||||||
:model="form">
|
:model="form">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
label="设定用户名"
|
label="设定用户名"
|
||||||
prop="username"
|
prop="username"
|
||||||
:rules="{
|
: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>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
label="设定密码"
|
label="设定密码"
|
||||||
prop="password"
|
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="{
|
: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>
|
||||||
<el-form-item label="* 图片质量">
|
<el-form-item label="* 图片质量">
|
||||||
<el-radio-group v-model="quality">
|
<el-radio-group v-model="quality">
|
||||||
@@ -50,8 +67,10 @@ export default {
|
|||||||
return {
|
return {
|
||||||
form: {
|
form: {
|
||||||
username: '',
|
username: '',
|
||||||
password: ''
|
password: '',
|
||||||
|
cookie: ''
|
||||||
},
|
},
|
||||||
|
chooseCookie: false,
|
||||||
quality: 'large'
|
quality: 'large'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -61,6 +80,8 @@ export default {
|
|||||||
this.form.username = config.username
|
this.form.username = config.username
|
||||||
this.form.password = config.password
|
this.form.password = config.password
|
||||||
this.quality = config.quality || 'large'
|
this.quality = config.quality || 'large'
|
||||||
|
this.form.cookie = config.cookie
|
||||||
|
this.chooseCookie = config.chooseCookie
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -70,7 +91,9 @@ export default {
|
|||||||
this.$db.read().set('picBed.weibo', {
|
this.$db.read().set('picBed.weibo', {
|
||||||
username: this.form.username,
|
username: this.form.username,
|
||||||
password: this.form.password,
|
password: this.form.password,
|
||||||
quality: this.quality
|
quality: this.quality,
|
||||||
|
cookie: this.form.cookie,
|
||||||
|
chooseCookie: this.chooseCookie
|
||||||
}).write()
|
}).write()
|
||||||
const successNotification = new window.Notification('设置结果', {
|
const successNotification = new window.Notification('设置结果', {
|
||||||
body: '设置成功'
|
body: '设置成功'
|
||||||
@@ -82,6 +105,12 @@ export default {
|
|||||||
return false
|
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')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,4 +135,17 @@ export default {
|
|||||||
border-radius 19px
|
border-radius 19px
|
||||||
.el-radio-group
|
.el-radio-group
|
||||||
margin-left 25px
|
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>
|
</style>
|
||||||
Reference in New Issue
Block a user