Compare commits

...
13 Commits
Author SHA1 Message Date
Molunerfinn 406cfffbc9 1.3.2 2018-01-18 09:31:52 +08:00
Molunerfinn e5d5bad115 Fixed: cookie error 2018-01-18 09:31:15 +08:00
Molunerfinn 7364ea6ddf Fixed: imgList error 2018-01-16 17:05:33 +08:00
Molunerfinn f657026820 Removed: some console & modified readme 2018-01-16 14:51:53 +08:00
Molunerfinn e8e78303a3 Added: weibo cookie uploader support 2018-01-16 13:55:16 +08:00
Molunerfinn 29fb9c742e Added: debug options for vscode debug 2018-01-12 17:24:56 +08:00
Molunerfinn 16f518b2ad Fixed: CI download speed 2018-01-10 20:39:08 +08:00
Molunerfinn 790367efd6 Updated: readme 2018-01-10 18:57:01 +08:00
Molunerfinn 7e9fd9d14e 1.3.1 2018-01-10 17:18:43 +08:00
Molunerfinn 9df9b547d1 Fixed: appveyor yml 2018-01-10 17:18:07 +08:00
Molunerfinn 26f6627b44 1.3.0 2018-01-10 17:14:01 +08:00
Molunerfinn dc9d5d6dfb Added: options for update helper 2018-01-10 17:12:24 +08:00
Molunerfinn b4c760c8cd Added: windows support 2018-01-10 16:51:09 +08:00
13 changed files with 245 additions and 51 deletions
+1
View File
@@ -3,6 +3,7 @@ dist/electron/*
dist/web/*
build/*
!build/icons
!build/installer.nsh
coverage
node_modules/
npm-debug.log
+21 -1
View File
@@ -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
}
]
+6 -3
View File
@@ -24,9 +24,11 @@
PicGo目前支持了`微博图床``七牛图床``腾讯云COS``又拍云`。未来将支持更多图床。
暂时只支持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)用以支持快捷上传剪贴板里的图片(第一张)
点击此处下载[应用](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平台。WindowsLinux平台并未测试。
> 目前仅针对MacWindowsLinux平台并未测试。
如果你想要学习、开发、修改或自行构建PicGo,可以依照下面的指示:
1. 你需要有node、git环境。需要了解npm的相关知识。
2. `git clone https://github.com/Molunerfinn/PicGo.git` 并进入项目
3. `npm install` 下载依赖
4. Mac需要有Xcode环境,Windows需要有VS环境。
### 开发模式
+2 -3
View File
@@ -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
+8
View File
@@ -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
View File
@@ -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
+9 -3
View File
@@ -1,11 +1,12 @@
{
"name": "picgo",
"version": "1.2.1",
"version": "1.3.2",
"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"
+11
View File
@@ -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')
+52 -19
View File
@@ -13,6 +13,9 @@ 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
@@ -34,7 +37,8 @@ const uploadFailed = () => {
}
function createTray () {
tray = new Tray(`${__static}/menubar.png`)
const menubarPic = process.platform === 'darwin' ? `${__static}/menubar.png` : `${__static}/menubar-nodarwin.png`
tray = new Tray(menubarPic)
const contextMenu = Menu.buildFromTemplate([
{
label: '关于',
@@ -100,6 +104,15 @@ function createTray () {
}
]
},
{
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 +123,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 +212,7 @@ const createWindow = () => {
}
const createSettingWindow = () => {
settingWindow = new BrowserWindow({
const options = {
height: 450,
width: 800,
show: false,
@@ -196,14 +220,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)
@@ -347,10 +377,13 @@ 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()
+30 -8
View File
@@ -28,26 +28,48 @@ 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()
} else {
imgList[i]['imgUrl'] = `https://ws1.sinaimg.cn/${quality}/${resTextJson.data.pics.pic_1.pid}`
imgList[i]['type'] = 'weibo'
}
}
webContents.send('uploadProgress', 100)
return imgList
+49 -3
View File
@@ -2,8 +2,12 @@
<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-row style="padding-top: 22px;" class="main-content">
<el-col :span="5">
<el-menu
class="picgo-sidebar"
@@ -64,7 +68,7 @@
<script>
import pkg from '../../../package.json'
import { remote } from 'electron'
const { Menu, dialog } = remote
const { Menu, dialog, BrowserWindow } = remote
export default {
name: 'setting-page',
data () {
@@ -72,10 +76,12 @@ export default {
version: pkg.version,
defaultActive: 'upload',
menu: null,
visible: false
visible: false,
os: ''
}
},
created () {
this.os = process.platform
this.buildMenu()
},
methods: {
@@ -84,6 +90,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 = [
@@ -102,6 +116,15 @@ export default {
click () {
_this.visible = true
}
},
{
label: '打开更新助手',
type: 'checkbox',
checked: _this.$db.get('picBed.showUpdateTip').value(),
click () {
const value = _this.$db.read().get('picBed.showUpdateTip').value()
_this.$db.read().set('picBed.showUpdateTip', !value).write()
}
}
]
this.menu = Menu.buildFromTemplate(template)
@@ -128,6 +151,23 @@ export default {
font-size 12px
line-height h
position fixed
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
.picgo-sidebar
height calc(100vh - 22px)
.el-menu
@@ -160,6 +200,12 @@ export default {
right 0
top 18px
background active-color
.main-content
padding-top 22px
position relative
z-index 10
.el-dialog__body
padding 20px
.support
text-align center
&-title
+51 -9
View File
@@ -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">
@@ -50,8 +67,10 @@ export default {
return {
form: {
username: '',
password: ''
password: '',
cookie: ''
},
chooseCookie: false,
quality: 'large'
}
},
@@ -61,6 +80,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 +91,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 +105,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')
}
}
}
@@ -106,4 +135,17 @@ export default {
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>
Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B