Compare commits

..
43 Commits
Author SHA1 Message Date
Molunerfinn 748a7fd07e 🎉 Release: v2.1.1 2019-04-16 10:45:21 +08:00
Molunerfinn 4000cea7c8 🐛 Fix: upload-area can't upload images 2019-04-16 10:45:09 +08:00
Molunerfinn 8978166328 🎉 Release: v2.1.0 2019-04-15 15:26:42 +08:00
Molunerfinn 7f1769733b Feature: add workflow for mac
for uploading images from context menu in macOS
2019-04-15 15:25:33 +08:00
Molunerfinn e5fbe750ae Feature: add windows context menu
for uploading pictures with picgo.exe
2019-04-15 14:10:01 +08:00
Molunerfinn ed539cf206 ⬆️ Upgrade: picgo-core -> 1.3.5 2019-04-15 10:28:40 +08:00
Molunerfinn 74c7016d2c Feature: support commandline -> upload images in clipboard 2019-04-15 10:28:11 +08:00
Molunerfinn 407b821aca Feature: add gui-api for remove event
ISSUES CLOSED: #201
2019-04-14 22:07:33 +08:00
PiEgg 6db86ec359 Feature: add commandline argvs support for picgo app
for example: picgo.exe ./xxx.jpg
2019-04-14 15:41:48 +08:00
PiEgg c64959a139 🐛 Fix: qiniu area option from select group -> input
ISSUES CLOSED: #230
2019-04-13 11:44:21 +08:00
Molunerfinn 6122e17d75 📝 Docs: add brew cask source
Thanks to @womeimingzi11!
2019-04-12 10:58:10 +08:00
Molunerfinn 37f1d34abc 📦 Chore: add picgo bump-version 2019-04-10 10:48:22 +08:00
Molunerfinn 3dd20857aa Fixed: #223 || change github token input type -> password 2019-04-04 17:09:42 +08:00
Molunerfinn 4a11d9830b Rm: showInputBox handler in plugin page 2019-04-04 16:58:36 +08:00
Molunerfinn 0165879f2d Changed: showInputBox from plugin page -> mainPage layout 2019-04-04 16:56:38 +08:00
Molunerfinn 17302fe3e4 Finished: log level setting 2019-04-04 15:08:47 +08:00
Molunerfinn f65d2d2df4 Fixed: npm ENOENT bug && mini window display -> false by default 2019-04-02 17:11:01 +08:00
PiEgg af19de7168 Changed: MIT LICENSE -> 996ICU LICENSE 2019-03-30 12:20:00 +08:00
Molunerfinn 9ab9e1973c Finished: guiApi.showMessageBox 2019-03-27 16:38:15 +08:00
Molunerfinn a4056cbe58 Fixed: #175 || improve gallery page scroll performance 2019-03-26 17:18:52 +08:00
zWingzandPiEgg 69d660fe7e Updated: trayPage add img-list object-fit 2019-03-16 14:47:48 +08:00
Molunerfinn 058e903789 Fixed: mime-types bug 2019-03-12 15:11:33 +08:00
Molunerfinn 53cdddf44a 2.0.5 2019-03-12 11:21:02 +08:00
Molunerfinn 2315aad732 Fixed: WIN10 powershell output encoding bug 2019-03-12 11:20:27 +08:00
Molunerfinn 7f8c6fd60e Fixed: #195 || windows7's bug of uploading image in clipboard 2019-03-11 13:40:39 +08:00
Molunerfinn 10959f3c54 2.0.4 2019-03-08 14:39:05 +08:00
Molunerfinn 1f4f40848e Updated: doc 2019-03-08 14:39:00 +08:00
Molunerfinn 7ef76b0a9b Fixed: #190 || copy image to upload correctly 2019-03-01 16:41:40 +08:00
Molunerfinn f87311760a Fixed: #189 || added change picbed button for upload page 2019-02-27 11:11:48 +08:00
Molunerfinn d597477a79 2.0.3 2019-01-31 16:41:06 +08:00
Molunerfinn 2bcbf749d1 Added: awesome list 2019-01-31 16:40:08 +08:00
PiEgg 59dd2c0b55 Fixed: weibo picbed docs link 2019-01-27 10:22:00 +08:00
Molunerfinn 43bace3212 Fixed: #176 || macOS tray window upload img failed 2019-01-25 19:16:52 +08:00
Molunerfinn 649e9f0695 Fixed: #175 || gallery page keep-alive 2019-01-24 11:29:48 +08:00
Molunerfinn e8f2185bbb Updated: copyright 2019-01-22 10:32:23 +08:00
Molunerfinn cc9dea5e71 2.0.2 2019-01-22 09:49:09 +08:00
Molunerfinn aabc0028af Fixed: custom url bugs & updated picgo version 2019-01-22 09:48:36 +08:00
Molunerfinn 193946c469 Updated: miniWindow style & add reload button for app 2019-01-21 16:46:33 +08:00
Molunerfinn 22c7b9a170 Fixed: #172 || miniWindowOntop option 2019-01-21 15:43:27 +08:00
PiEgg c5f6ae8993 Fixed: #171 || guiMenu is a function 2019-01-19 14:42:11 +08:00
Molunerfinn bb034677bd Fixed: logo url 2019-01-17 19:30:41 +08:00
Molunerfinn d2eb8999c5 Fixed: #168 || add new logo 2019-01-17 19:27:25 +08:00
Molunerfinn 4cb7acfec0 Updated: awesome-picgo 2019-01-16 10:27:34 +08:00
44 changed files with 4027 additions and 2191 deletions
+37
View File
@@ -0,0 +1,37 @@
## :tada: 2.1.1 (2019-04-16)
### :bug: Bug Fixes
* upload-area can't upload images ([4000cea](https://github.com/Molunerfinn/PicGo/commit/4000cea))
# :tada: 2.1.0 (2019-04-15)
### :sparkles: Features
* add commandline argvs support for picgo app ([6db86ec](https://github.com/Molunerfinn/PicGo/commit/6db86ec))
* add gui-api for remove event ([407b821](https://github.com/Molunerfinn/PicGo/commit/407b821)), closes [#201](https://github.com/Molunerfinn/PicGo/issues/201)
* add windows context menu ([e5fbe75](https://github.com/Molunerfinn/PicGo/commit/e5fbe75))
* add workflow for mac ([7f17697](https://github.com/Molunerfinn/PicGo/commit/7f17697))
* support commandline -> upload images in clipboard ([74c7016](https://github.com/Molunerfinn/PicGo/commit/74c7016))
### :bug: Bug Fixes
* qiniu area option from select group -> input ([c64959a](https://github.com/Molunerfinn/PicGo/commit/c64959a)), closes [#230](https://github.com/Molunerfinn/PicGo/issues/230)
### :pencil: Documentation
* add brew cask source ([6122e17](https://github.com/Molunerfinn/PicGo/commit/6122e17))
### :package: Chore
* add picgo bump-version ([37f1d34](https://github.com/Molunerfinn/PicGo/commit/37f1d34))
+10 -5
View File
@@ -1,8 +1,13 @@
MIT License
Copyright (c) <year> <copyright holders>
The 996ICU License (996ICU)
Version 0.1, March 2019
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
PACKAGE is distributed under LICENSE with the following restriction:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above license is only granted to entities that act in concordance
with local labor laws. In addition, the following requirements must be
observed:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* The licencee must not, explicitly or implicitly, request or schedule
their employees to work more than 45 hours in any single week.
* The licencee must not, explicitly or implicitly, request or schedule
their employees to be at work consecutively for 10 hours.
+13 -6
View File
@@ -3,7 +3,7 @@
> 图片上传+管理新体验
<p align="center">
<img src="https://user-images.githubusercontent.com/12621342/33876119-85a5148e-df5f-11e7-8843-46224e595d52.png" alt="">
<img src="https://raw.githubusercontent.com/Molunerfinn/test/master/picgo/New%20LOGO-150.png" alt="">
</p>
<p align="center">
<a href="https://github.com/feross/standard">
@@ -18,6 +18,9 @@
<a href="https://github.com/Molunerfinn/PicGo/releases/latest">
<img src="https://img.shields.io/github/release/Molunerfinn/PicGo.svg?style=flat-square" alt="">
</a>
<a href="https://github.com/PicGo/bump-version">
<img src="https://img.shields.io/badge/picgo-convention-blue.svg?style=flat-square" alt="">
</a>
</p>
## 应用说明
@@ -35,7 +38,9 @@ PicGo目前支持了
- `阿里云OSS` v1.6.0
- `Imgur` v1.6.0
**本体不再增加默认的图床支持。你可以自行开发第三方图床插件。详见[PicGo-Core](https://picgo.github.io/PicGo-Core-Doc/)**
**本体不再增加默认的图床支持。你可以自行开发第三方图床插件。详见[PicGo-Core](https://picgo.github.io/PicGo-Core-Doc/)**
第三方插件以及使用了PicGo底层的应用可以在[Awesome-PicGo](https://github.com/PicGo/Awesome-PicGo)看到。欢迎贡献!
支持macOS、windows 64位(>= v1.3.1),linux>= v1.6.0)。
@@ -48,11 +53,13 @@ PicGo支持自定义快捷键,使用方法见[配置手册](https://picgo.gith
## 下载安装
macOS用户请下载最新版本的`dmg`文件,windows用户请下载最新版本的`exe`文件,linux用户请下载`AppImage`文件。
点击此处下载[应用](https://github.com/Molunerfinn/PicGo/releases)。
**如果你是Arch类的Linux用户,可以直接通过`aurman -S picgo-appimage`来安装PicGo。感谢@houbaron的贡献!**
macOS用户请下载最新版本的`dmg`文件,windows用户请下载最新版本的`exe`文件,linux用户请下载`AppImage`文件。
**如果你是Arch类的Linux用户,可以直接通过`aurman -S picgo-appimage`来安装PicGo。感谢 @houbaron 的贡献!**
**如果你是macOS用户,可以使用brew cask来安装PicGo: `brew cask install picgo`。感谢 @womeimingzi11 的贡献!**
## 应用截图
@@ -115,4 +122,4 @@ npm run build
[MIT](http://opensource.org/licenses/MIT)
Copyright (c) 2017 Molunerfinn
Copyright (c) 2017 - 2019 Molunerfinn
Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

+13 -8
View File
@@ -1,8 +1,13 @@
!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
!macro customInstall
SetRegView 64
WriteRegStr HKCR "*\shell\PicGo" "" "Upload pictures w&ith PicGo"
WriteRegStr HKCR "*\shell\PicGo" "Icon" "$INSTDIR\PicGo.exe"
WriteRegStr HKCR "*\shell\PicGo\command" "" '"$INSTDIR\PicGo.exe" "upload" "%1"'
SetRegView 32
WriteRegStr HKCR "*\shell\PicGo" "" "Upload pictures w&ith PicGo"
WriteRegStr HKCR "*\shell\PicGo" "Icon" "$INSTDIR\PicGo.exe"
WriteRegStr HKCR "*\shell\PicGo\command" "" '"$INSTDIR\PicGo.exe" "upload" "%1"'
!macroend
!macro customUninstall
DeleteRegKey HKCR "*\shell\PicGo"
!macroend
+1 -1
View File
@@ -7,7 +7,7 @@
small(v-if="version") {{ version }}
h2.desc 图片上传+管理新体验
button.download(@click="goLink('https://github.com/Molunerfinn/picgo/releases')") 免费下载
button.download(@click="goLink('https://github.com/Molunerfinn/picgo')") 在github上查看
button.download(@click="goLink('https://picgo.github.io/PicGo-Doc/zh/guide/')") 查看文档
h3.desc
| 基于#[a(href="https://github.com/SimulatedGREG/electron-vue" target="_blank") electron-vue]开发
h3.desc
+30 -4
View File
@@ -1,6 +1,6 @@
{
"name": "picgo",
"version": "2.0.1",
"version": "2.1.1",
"author": "Molunerfinn <marksz@teamsz.xyz>",
"description": "Easy to upload your pic & copy to write",
"license": "MIT",
@@ -26,7 +26,27 @@
"docs": "webpack-dev-server --content-base docs/dist --config .electron-vue/webpack.docs.config.js --hot --inline",
"patch": "npm version patch && git push origin master && git push origin --tags",
"minor": "npm version minor && git push origin master && git push origin --tags",
"major": "npm version major && git push origin master && git push origin --tags"
"major": "npm version major && git push origin master && git push origin --tags",
"cz": "git-cz",
"bump": "bump-version"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"config": {
"commitizen": {
"path": "./node_modules/cz-customizable"
},
"cz-customizable": {
"config": "./node_modules/@picgo/bump-version/.cz-config.js"
}
},
"commitlint": {
"extends": [
"./node_modules/@picgo/bump-version/commitlint-picgo"
]
},
"build": {
"productName": "PicGo",
@@ -82,7 +102,7 @@
"lowdb": "^1.0.0",
"md5": "^2.2.1",
"melody.css": "^1.0.2",
"picgo": "^1.2.1",
"picgo": "^1.3.5",
"qiniu": "^7.1.1",
"vue": "^2.3.3",
"vue-electron": "^1.0.6",
@@ -92,6 +112,8 @@
"vuex": "^2.3.1"
},
"devDependencies": {
"@commitlint/cli": "^7.5.2",
"@picgo/bump-version": "^1.0.2",
"babel-core": "^6.25.0",
"babel-eslint": "^7.2.3",
"babel-loader": "^7.1.1",
@@ -104,12 +126,15 @@
"cfonts": "^1.1.3",
"chai": "^4.0.0",
"chalk": "^2.1.0",
"commitizen": "^3.0.7",
"conventional-changelog": "^3.0.6",
"copy-webpack-plugin": "^4.0.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.4",
"cz-customizable": "^5.10.0",
"del": "^3.0.0",
"devtron": "^1.4.0",
"electron": "4.0.0",
"electron": "4.0.2",
"electron-builder": "^20.38.4",
"electron-debug": "^1.4.0",
"electron-devtools-installer": "^2.2.0",
@@ -124,6 +149,7 @@
"eslint-plugin-standard": "^3.0.1",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"husky": "^1.3.1",
"inject-loader": "^3.0.0",
"karma": "^1.3.0",
"karma-chai": "^0.1.0",
+32 -3
View File
@@ -43,10 +43,39 @@ if (!db.has('settings.shortKey').value()) {
}
// init generate clipboard image files
let clipboardFiles = getClipboardFiles()
if (!fs.pathExistsSync(path.join(STORE_PATH, 'windows.ps1'))) {
fs.copySync(path.join(__static, '/linux.sh'), path.join(STORE_PATH, '/linux.sh'))
fs.copySync(path.join(__static, '/mac.applescript'), path.join(STORE_PATH, '/mac.applescript'))
fs.copySync(path.join(__static, '/windows.ps1'), path.join(STORE_PATH, '/windows.ps1'))
clipboardFiles.forEach(item => {
fs.copyFileSync(item.origin, item.dest)
})
} else {
clipboardFiles.forEach(item => {
diffFilesAndUpdate(item.origin, item.dest)
})
}
function diffFilesAndUpdate (filePath1, filePath2) {
let file1 = fs.readFileSync(filePath1)
let file2 = fs.readFileSync(filePath2)
if (!file1.equals(file2)) {
fs.copyFileSync(filePath1, filePath2)
}
}
function getClipboardFiles () {
let files = [
'/linux.sh',
'/mac.applescript',
'/windows.ps1'
]
return files.map(item => {
return {
origin: path.join(__static, item),
dest: path.join(STORE_PATH, item)
}
})
}
export default db
+92 -39
View File
@@ -3,12 +3,17 @@
import Uploader from './utils/uploader.js'
import { app, BrowserWindow, Tray, Menu, Notification, clipboard, ipcMain, globalShortcut, dialog } from 'electron'
import db from '../datastore'
import beforeOpen from './utils/beforeOpen'
import pasteTemplate from './utils/pasteTemplate'
import updateChecker from './utils/updateChecker'
import { getPicBeds } from './utils/getPicBeds'
import pkg from '../../package.json'
import picgoCoreIPC from './utils/picgoCoreIPC'
import fixPath from 'fix-path'
import { getUploadFiles } from './utils/handleArgv'
if (process.platform === 'darwin') {
beforeOpen()
}
/**
* Set `__static` path to static files in production
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
@@ -94,6 +99,13 @@ function createContextMenu () {
db.read().set('settings.showUpdateTip', !value).write()
}
},
{
label: '重启应用',
click () {
app.relaunch()
app.exit(0)
}
},
{
role: 'quit',
label: '退出'
@@ -203,6 +215,7 @@ const createWindow = () => {
window.on('blur', () => {
window.hide()
})
return window
}
const createMiniWidow = () => {
@@ -212,9 +225,10 @@ const createMiniWidow = () => {
let obj = {
height: 64,
width: 64,
show: true,
show: false,
frame: false,
fullscreenable: false,
skipTaskbar: true,
resizable: false,
transparent: true,
icon: `${__static}/logo.png`,
@@ -231,7 +245,7 @@ const createMiniWidow = () => {
obj.show = false
}
if (db.read().get('miniWindowOntop').value()) {
if (db.read().get('settings.miniWindowOntop').value()) {
obj.alwaysOnTop = true
}
@@ -242,6 +256,7 @@ const createMiniWidow = () => {
miniWindow.on('closed', () => {
miniWindow = null
})
return miniWindow
}
const createSettingWindow = () => {
@@ -281,6 +296,7 @@ const createSettingWindow = () => {
})
createMenu()
createMiniWidow()
return settingWindow
}
const createMenu = () => {
@@ -329,7 +345,7 @@ const uploadClipboardFiles = async () => {
if (miniWindow.isVisible()) {
win = miniWindow
} else {
win = settingWindow || window
win = settingWindow || window || createSettingWindow()
}
let img = await new Uploader(undefined, win.webContents).upload()
if (img !== false) {
@@ -359,38 +375,9 @@ const uploadClipboardFiles = async () => {
}
}
picgoCoreIPC(app, ipcMain)
// from macOS tray
ipcMain.on('uploadClipboardFiles', async (evt, file) => {
const img = await new Uploader(file, window.webContents).upload()
if (img !== false) {
const pasteStyle = db.read().get('settings.pasteStyle').value() || 'markdown'
const url = img[0].url || img[0].imgUrl
clipboard.writeText(pasteTemplate(pasteStyle, url))
const notification = new Notification({
title: '上传成功',
body: img[0].imgUrl,
// icon: file[0]
icon: img[0].imgUrl
})
notification.show()
db.read().get('uploaded').insert(img[0]).write()
window.webContents.send('clipboardFiles', [])
window.webContents.send('uploadFiles')
if (settingWindow) {
settingWindow.webContents.send('updateGallery')
}
}
})
ipcMain.on('uploadClipboardFilesFromUploadPage', () => {
uploadClipboardFiles()
})
ipcMain.on('uploadChoosedFiles', async (evt, files) => {
const uploadChoosedFiles = async (webContents, files) => {
const input = files.map(item => item.path)
const imgs = await new Uploader(input, evt.sender).upload()
const imgs = await new Uploader(input, webContents).upload()
if (imgs !== false) {
const pasteStyle = db.read().get('settings.pasteStyle').value() || 'markdown'
let pasteText = ''
@@ -413,6 +400,39 @@ ipcMain.on('uploadChoosedFiles', async (evt, files) => {
settingWindow.webContents.send('updateGallery')
}
}
}
picgoCoreIPC(app, ipcMain)
// from macOS tray
ipcMain.on('uploadClipboardFiles', async (evt, file) => {
const img = await new Uploader(undefined, window.webContents).upload()
if (img !== false) {
const pasteStyle = db.read().get('settings.pasteStyle').value() || 'markdown'
const url = img[0].url || img[0].imgUrl
clipboard.writeText(pasteTemplate(pasteStyle, url))
const notification = new Notification({
title: '上传成功',
body: img[0].imgUrl,
// icon: file[0]
icon: img[0].imgUrl
})
notification.show()
db.read().get('uploaded').insert(img[0]).write()
window.webContents.send('clipboardFiles', [])
if (settingWindow) {
settingWindow.webContents.send('updateGallery')
}
}
window.webContents.send('uploadFiles')
})
ipcMain.on('uploadClipboardFilesFromUploadPage', () => {
uploadClipboardFiles()
})
ipcMain.on('uploadChoosedFiles', async (evt, files) => {
return uploadChoosedFiles(evt.sender, files)
})
ipcMain.on('updateShortKey', (evt, oldKey) => {
@@ -483,12 +503,29 @@ const gotTheLock = app.requestSingleInstanceLock()
if (!gotTheLock) {
app.quit()
} else {
if (settingWindow) {
if (settingWindow.isMinimized()) {
settingWindow.restore()
app.on('second-instance', (event, commandLine, workingDirectory) => {
let files = getUploadFiles(commandLine, workingDirectory)
if (files === null || files.length > 0) { // 如果有文件列表作为参数,说明是命令行启动
if (files === null) {
uploadClipboardFiles()
} else {
let win
if (miniWindow && miniWindow.isVisible()) {
win = miniWindow
} else {
win = settingWindow || window || createSettingWindow()
}
uploadChoosedFiles(win.webContents, files)
}
} else {
if (settingWindow) {
if (settingWindow.isMinimized()) {
settingWindow.restore()
}
settingWindow.focus()
}
}
settingWindow.focus()
}
})
}
if (process.platform === 'win32') {
@@ -511,6 +548,22 @@ app.on('ready', () => {
globalShortcut.register(db.read().get('settings.shortKey.upload').value(), () => {
uploadClipboardFiles()
})
if (process.env.NODE_ENV !== 'development') {
let files = getUploadFiles()
if (files === null || files.length > 0) { // 如果有文件列表作为参数,说明是命令行启动
if (files === null) {
uploadClipboardFiles()
} else {
let win
if (miniWindow && miniWindow.isVisible()) {
win = miniWindow
} else {
win = settingWindow || window || createSettingWindow()
}
uploadChoosedFiles(win.webContents, files)
}
}
}
})
app.on('window-all-closed', () => {
+23
View File
@@ -0,0 +1,23 @@
import fs from 'fs-extra'
import path from 'path'
import os from 'os'
if (process.env.NODE_ENV !== 'development') {
global.__static = path.join(__dirname, '/static').replace(/\\/g, '\\\\')
}
if (process.env.DEBUG_ENV === 'debug') {
global.__static = path.join(__dirname, '../../../static').replace(/\\/g, '\\\\')
}
function beforeOpen () {
const dest = `${os.homedir}/Library/Services/Upload pictures with PicGo.workflow`
if (fs.existsSync(dest)) {
return true
} else {
try {
fs.copySync(path.join(__static, 'Upload pictures with PicGo.workflow'), dest)
} catch (e) {
console.log(e)
}
}
}
export default beforeOpen
+27 -7
View File
@@ -87,19 +87,39 @@ class GuiApi {
* For notification
* @param {Object} options
*/
showNotification (options) {
if (options === undefined) {
options = {
title: '',
body: ''
}
}
showNotification (options = {
title: '',
body: ''
}) {
const notification = new Notification({
title: options.title,
body: options.body
})
notification.show()
}
/**
*
* @param {Object} options
*/
showMessageBox (options = {
title: '',
message: '',
type: 'info',
buttons: ['Yes', 'No']
}) {
return new Promise((resolve, reject) => {
dialog.showMessageBox(
BrowserWindow.fromWebContents(this[WEBCONTENTS]),
options,
(result, checkboxChecked) => {
resolve({
result,
checkboxChecked
})
})
})
}
}
export default GuiApi
+37
View File
@@ -0,0 +1,37 @@
import path from 'path'
import fs from 'fs-extra'
const getUploadFiles = (argv = process.argv, cwd = process.cwd()) => {
let files = argv.slice(1)
if (files.length > 0 && files[0] === 'upload') {
if (files.length === 1) {
return null // for uploading images in clipboard
} else if (files.length > 1) {
files = argv.slice(1)
let result = []
if (files.length > 0) {
result = files.map(item => {
if (path.isAbsolute(item)) {
return {
path: item
}
} else {
let tempPath = path.join(cwd, item)
if (fs.existsSync(tempPath)) {
return {
path: tempPath
}
} else {
return null
}
}
}).filter(item => item !== null)
}
return result
}
}
return []
}
export {
getUploadFiles
}
+1 -1
View File
@@ -1,7 +1,7 @@
import db from '../../datastore'
export default (style, url) => {
const customLink = db.read().get('customLink').value() || '$url'
const customLink = db.read().get('settings.customLink').value() || '$url'
const tpl = {
'markdown': `![](${url})`,
'HTML': `<img src="${url}"/>`,
+33 -7
View File
@@ -1,5 +1,6 @@
import path from 'path'
import GuiApi from './guiApi'
import { dialog, shell } from 'electron'
// eslint-disable-next-line
const requireFunc = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require
@@ -89,41 +90,63 @@ const handleGetPluginList = (ipcMain, STORE_PATH, CONFIG_PATH) => {
}
const handlePluginInstall = (ipcMain, CONFIG_PATH) => {
ipcMain.on('installPlugin', (event, msg) => {
ipcMain.on('installPlugin', async (event, msg) => {
const picgo = new PicGo(CONFIG_PATH)
const pluginHandler = new PluginHandler(picgo)
picgo.on('installSuccess', notice => {
event.sender.send('installSuccess', notice.body[0].replace(/picgo-plugin-/, ''))
})
picgo.on('failed', () => {
handleNPMError()
})
await pluginHandler.uninstall([msg])
pluginHandler.install([msg])
picgo.cmd.program.removeAllListeners()
})
}
const handlePluginUninstall = (ipcMain, CONFIG_PATH) => {
ipcMain.on('uninstallPlugin', (event, msg) => {
ipcMain.on('uninstallPlugin', async (event, msg) => {
const picgo = new PicGo(CONFIG_PATH)
const pluginHandler = new PluginHandler(picgo)
picgo.on('uninstallSuccess', notice => {
event.sender.send('uninstallSuccess', notice.body[0].replace(/picgo-plugin-/, ''))
})
pluginHandler.uninstall([msg])
picgo.on('failed', () => {
handleNPMError()
})
await pluginHandler.uninstall([msg])
picgo.cmd.program.removeAllListeners()
})
}
const handlePluginUpdate = (ipcMain, CONFIG_PATH) => {
ipcMain.on('updatePlugin', (event, msg) => {
ipcMain.on('updatePlugin', async (event, msg) => {
const picgo = new PicGo(CONFIG_PATH)
const pluginHandler = new PluginHandler(picgo)
picgo.on('updateSuccess', notice => {
event.sender.send('updateSuccess', notice.body[0].replace(/picgo-plugin-/, ''))
})
pluginHandler.update([msg])
picgo.on('failed', () => {
handleNPMError()
})
await pluginHandler.update([msg])
picgo.cmd.program.removeAllListeners()
})
}
const handleNPMError = () => {
dialog.showMessageBox({
title: '发生错误',
message: '请安装Node.js并重启PicGo再继续操作',
buttons: ['Yes']
}, (res) => {
if (res === 0) {
shell.openExternal('https://nodejs.org/')
}
})
}
const handleGetPicBedConfig = (ipcMain, CONFIG_PATH) => {
ipcMain.on('getPicBedConfig', (event, type) => {
const picgo = new PicGo(CONFIG_PATH)
@@ -143,7 +166,7 @@ const handlePluginActions = (ipcMain, CONFIG_PATH) => {
const picgo = new PicGo(CONFIG_PATH)
const plugin = picgo.pluginLoader.getPlugin(`picgo-plugin-${name}`)
const guiApi = new GuiApi(ipcMain, event.sender, picgo)
if (plugin.guiMenu && plugin.guiMenu.length > 0) {
if (plugin.guiMenu && plugin.guiMenu(picgo).length > 0) {
const menu = plugin.guiMenu(picgo)
menu.forEach(item => {
if (item.label === label) {
@@ -157,7 +180,10 @@ const handlePluginActions = (ipcMain, CONFIG_PATH) => {
const handleRemoveFiles = (ipcMain, CONFIG_PATH) => {
ipcMain.on('removeFiles', (event, files) => {
const picgo = new PicGo(CONFIG_PATH)
picgo.emit('remove', files)
const guiApi = new GuiApi(ipcMain, event.sender, picgo)
setTimeout(() => {
picgo.emit('remove', files, guiApi)
}, 500)
})
}
+47 -11
View File
@@ -64,7 +64,12 @@
class="main-wrapper"
:class="{ 'darwin': os === 'darwin' }">
<transition name="picgo-fade" mode="out-in">
<router-view :key="$route.params ? $route.params.type : $route.path"></router-view>
<keep-alive>
<router-view v-if="$route.meta.keepAlive"></router-view>
</keep-alive>
</transition>
<transition name="picgo-fade" mode="out-in">
<router-view :key="$route.path" v-if="!$route.meta.keepAlive"></router-view>
</transition>
</el-col>
</el-row>
@@ -138,6 +143,20 @@
<el-button type="primary" @click="confirmCustomLink">确定</el-button>
</span>
</el-dialog>
<el-dialog
:title="inputBoxOptions.title || '输入框'"
:visible.sync="showInputBoxVisible"
:modal-append-to-body="false"
@close="handleInputBoxClose"
>
<el-input
v-model="inputBoxValue"
:placeholder="inputBoxOptions.placeholder"></el-input>
<span slot="footer">
<el-button @click="showInputBoxVisible = false" round>取消</el-button>
<el-button type="primary" @click="showInputBoxVisible = false" round>确定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
@@ -177,7 +196,14 @@ export default {
shortKey: {
upload: db.read().get('shortKey.upload').value()
},
picBed: []
picBed: [],
// for showInputBox
showInputBoxVisible: false,
inputBoxValue: '',
inputBoxOptions: {
title: '',
placeholder: ''
}
}
},
created () {
@@ -185,6 +211,12 @@ export default {
this.buildMenu()
this.$electron.ipcRenderer.send('getPicBeds')
this.$electron.ipcRenderer.on('getPicBeds', this.getPicBeds)
this.$electron.ipcRenderer.on('showInputBox', (evt, options) => {
this.inputBoxValue = ''
this.inputBoxOptions.title = options.title || ''
this.inputBoxOptions.placeholder = options.placeholder || ''
this.showInputBoxVisible = true
})
},
methods: {
handleSelect (index) {
@@ -275,6 +307,9 @@ export default {
},
getPicBeds (event, picBeds) {
this.picBed = picBeds
},
handleInputBoxClose () {
this.$electron.ipcRenderer.send('showInputBox', this.inputBoxValue)
}
},
beforeRouteEnter: (to, from, next) => {
@@ -284,6 +319,7 @@ export default {
},
beforeDestroy () {
this.$electron.ipcRenderer.removeListener('getPicBeds', this.getPicBeds)
this.$electron.ipcRenderer.removeAllListeners('showInputBox')
}
}
</script>
@@ -296,7 +332,7 @@ $darwinBg = transparentify(#172426, #000, 0.7)
opacity 0
&-enter-active,
&-leave-active
transition opacity 100ms linear
transition all 100ms linear
.view-title
color #eee
font-size 20px
@@ -409,12 +445,12 @@ $darwinBg = transparentify(#172426, #000, 0.7)
.align-center
input
text-align center
*::-webkit-scrollbar
width 8px
height 8px
*::-webkit-scrollbar-thumb
border-radius 4px
background #6f6f6f
*::-webkit-scrollbar-track
background-color transparent
*::-webkit-scrollbar
width 8px
height 8px
*::-webkit-scrollbar-thumb
border-radius 4px
background #6f6f6f
*::-webkit-scrollbar-track
background-color transparent
</style>
+15 -8
View File
@@ -74,9 +74,9 @@
<el-col :span="6" v-for="(item, index) in images" :key="item.id" class="gallery-list__img">
<div
class="gallery-list__item"
v-lazy:background-image="item.imgUrl"
@click="zoomImage(index)"
>
<img v-lazy="item.imgUrl" class="gallery-list__item-img">
</div>
<div class="gallery-list__tool-panel">
<i class="el-icon-document" @click="copy(item)"></i>
@@ -139,8 +139,14 @@ export default {
picBed: []
}
},
beforeRouteEnter (to, from, next) {
next(vm => {
vm.getGallery()
vm.getPasteStyle()
vm.getPicBeds()
})
},
created () {
this.getGallery()
this.$electron.ipcRenderer.on('updateGallery', (event) => {
this.$nextTick(() => {
this.filterList = this.getGallery()
@@ -148,8 +154,6 @@ export default {
})
this.$electron.ipcRenderer.send('getPicBeds')
this.$electron.ipcRenderer.on('getPicBeds', this.getPicBeds)
this.getPasteStyle()
this.getPicBeds()
},
computed: {
filterList: {
@@ -368,6 +372,8 @@ export default {
transition all .2s ease-in-out
&.active
transform: rotate(180deg)
#gallery-view
height 100%
.item-base
background #2E2E2E
text-align center
@@ -417,12 +423,11 @@ export default {
&__item
width 100%
height 120px
background-size cover
background-position 50% 50%
background-repeat no-repeat
transition all .2s ease-in-out
cursor pointer
margin-bottom 8px
overflow hidden
display flex
&-fake
position absolute
top 0
@@ -431,8 +436,10 @@ export default {
width 100%
z-index -1
&:hover
background-color #49B1F5
transform scale(1.1)
&-img
width 100%
object-fit fill
&__tool-panel
color #ddd
i
+12 -1
View File
@@ -22,7 +22,7 @@ export default {
mixins: [mixin],
data () {
return {
logo: 'static/logo.png',
logo: 'static/squareLogo.png',
dragover: false,
progress: 0,
showProgress: false,
@@ -161,6 +161,17 @@ export default {
_this.$electron.ipcRenderer.send('uploadClipboardFilesFromUploadPage')
}
},
{
label: '最小化窗口',
role: 'minimize'
},
{
label: '重启应用',
click () {
_this.$electron.remote.app.relaunch()
_this.$electron.remote.app.exit(0)
}
},
{
role: 'quit',
label: '退出'
+98 -5
View File
@@ -14,7 +14,12 @@
<el-form-item
label="打开配置文件"
>
<el-button type="primary" round size="mini" @click="openConfigFile">点击打开</el-button>
<el-button type="primary" round size="mini" @click="openFile('data.json')">点击打开</el-button>
</el-form-item>
<el-form-item
label="设置日志文件"
>
<el-button type="primary" round size="mini" @click="openLogSetting">点击设置</el-button>
</el-form-item>
<el-form-item
label="修改上传快捷键"
@@ -215,6 +220,44 @@
<el-button type="primary" @click="confirmCheckVersion" round>确定</el-button>
</span>
</el-dialog>
<el-dialog
title="设置日志文件"
:visible.sync="logFileVisible"
:modal-append-to-body="false"
>
<el-form
label-position="right"
label-width="100px"
>
<el-form-item
label="日志文件"
>
<el-button type="primary" round size="mini" @click="openFile('picgo.log')">点击打开</el-button>
</el-form-item>
<el-form-item
label="日志记录等级"
>
<el-select
v-model="form.logLevel"
multiple
collapse-tags
@change="handleLogLevelChange"
>
<el-option
v-for="(value, key) of logLevel"
:key="key"
:label="value"
:value="key"
:disabled="handleLevelDisabled(key)"
></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer">
<el-button @click="cancelLogLevelSetting" round>取消</el-button>
<el-button type="primary" @click="confirmLogLevelSetting" round>确定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
@@ -250,9 +293,11 @@ export default {
rename: this.$db.read().get('settings.rename').value() || false,
autoRename: this.$db.read().get('settings.autoRename').value() || false,
uploadNotification: this.$db.read().get('settings.uploadNotification').value() || false,
miniWindowOntop: this.$db.read().get('settings.miniWindowOntop').value() || false
miniWindowOntop: this.$db.read().get('settings.miniWindowOntop').value() || false,
logLevel: this.$db.read().get('settings.logLevel').value() || ['all']
},
picBed: [],
logFileVisible: false,
keyBindingVisible: false,
customLinkVisible: false,
checkUpdateVisible: false,
@@ -269,6 +314,14 @@ export default {
{ validator: customLinkRule, trigger: 'blur' }
]
},
logLevel: {
all: '全部-All',
success: '成功-Success',
error: '错误-Error',
info: '普通-Info',
warn: '提醒-Warn',
none: '不记录日志-None'
},
version: pkg.version,
latestVersion: '',
os: ''
@@ -288,11 +341,14 @@ export default {
}
})
},
openConfigFile () {
openFile (file) {
const { app, shell } = this.$electron.remote
const STORE_PATH = app.getPath('userData')
const CONFIG_FILE = path.join(STORE_PATH, '/data.json')
shell.openItem(CONFIG_FILE)
const FILE = path.join(STORE_PATH, `/${file}`)
shell.openItem(FILE)
},
openLogSetting () {
this.logFileVisible = true
},
keyDetect (type, event) {
this.shortKey[type] = keyDetect(event).join('+')
@@ -399,6 +455,43 @@ export default {
handleMiniWindowOntop (val) {
this.$db.read().set('settings.miniWindowOntop', val).write()
this.$message('需要重启生效')
},
confirmLogLevelSetting () {
if (this.form.logLevel.length === 0) {
return this.$message.error('请选择日志记录等级')
}
this.$db.read().set('settings.logLevel', this.form.logLevel).write()
const successNotification = new window.Notification('设置日志', {
body: '设置成功'
})
successNotification.onclick = () => {
return true
}
this.logFileVisible = false
},
cancelLogLevelSetting () {
this.logFileVisible = false
this.form.logLevel = this.$db.read().get('settings.logLevel').value() || 'all'
},
handleLevelDisabled (val) {
let currentLevel = val
let flagLevel
let result = this.form.logLevel.some(item => {
if (item === 'all' || item === 'none') {
flagLevel = item
}
return (item === 'all' || item === 'none')
})
if (result) {
if (currentLevel !== flagLevel) {
return true
}
} else if (this.form.logLevel.length > 0) {
if (val === 'all' || val === 'none') {
return true
}
}
return false
}
},
beforeDestroy () {
+10 -34
View File
@@ -1,12 +1,12 @@
<template>
<div id="plugin-view">
<div class="view-title">
插件设置
插件设置 - <i class="el-icon-goods" @click="goAwesomeList"></i>
</div>
<el-row class="handle-bar" :class="{ 'cut-width': pluginList.length > 6 }">
<el-input
v-model="searchText"
placeholder="搜索npm上的PicGo插件"
placeholder="搜索npm上的PicGo插件,或者点击上方按钮查看优秀插件列表"
size="small"
>
<i slot="suffix" class="el-input__icon el-icon-close" v-if="searchText" @click="cleanSearch" style="cursor: pointer"></i>
@@ -17,7 +17,7 @@
<div class="plugin-item" :class="{ 'darwin': os === 'darwin' }">
<div class="cli-only-badge" v-if="!item.gui" title="CLI only">CLI</div>
<img class="plugin-item__logo" :src="item.logo"
onerror="this.src='static/logo.png'"
onerror="this.src='static/roundLogo.png'"
>
<div
class="plugin-item__content"
@@ -91,20 +91,6 @@
<el-button type="primary" @click="handleConfirmConfig" round>确定</el-button>
</span>
</el-dialog>
<el-dialog
:title="inputBoxOptions.title || '输入框'"
:visible.sync="showInputBoxVisible"
:modal-append-to-body="false"
@close="handleInputBoxClose"
>
<el-input
v-model="inputBoxValue"
:placeholder="inputBoxOptions.placeholder"></el-input>
<span slot="footer">
<el-button @click="showInputBoxVisible = false" round>取消</el-button>
<el-button type="primary" @click="showInputBoxVisible = false" round>确定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
@@ -128,14 +114,7 @@ export default {
loading: true,
needReload: false,
id: '',
os: '',
// for showInputBox
showInputBoxVisible: false,
inputBoxValue: '',
inputBoxOptions: {
title: '',
placeholder: ''
}
os: ''
}
},
computed: {
@@ -205,12 +184,6 @@ export default {
this.getPluginList()
this.getSearchResult = debounce(this.getSearchResult, 50)
this.needReload = this.$db.read().get('needReload').value()
this.$electron.ipcRenderer.on('showInputBox', (evt, options) => {
this.inputBoxValue = ''
this.inputBoxOptions.title = options.title || ''
this.inputBoxOptions.placeholder = options.placeholder || ''
this.showInputBoxVisible = true
})
},
methods: {
buildContextMenu (plugin) {
@@ -437,8 +410,8 @@ export default {
this.$electron.remote.shell.openExternal(url)
}
},
handleInputBoxClose () {
this.$electron.ipcRenderer.send('showInputBox', this.inputBoxValue)
goAwesomeList () {
this.$electron.remote.shell.openExternal('https://github.com/PicGo/Awesome-PicGo')
}
},
beforeDestroy () {
@@ -446,7 +419,6 @@ export default {
this.$electron.ipcRenderer.removeAllListeners('installSuccess')
this.$electron.ipcRenderer.removeAllListeners('uninstallSuccess')
this.$electron.ipcRenderer.removeAllListeners('updateSuccess')
this.$electron.ipcRenderer.removeAllListeners('showInputBox')
}
}
</script>
@@ -476,6 +448,10 @@ $darwinBg = #172426
font-size 20px
text-align center
margin 10px auto
i.el-icon-goods
font-size 20px
vertical-align middle
cursor pointer
.handle-bar
margin-bottom 20px
&.cut-width
+23 -8
View File
@@ -4,15 +4,18 @@
<div class="content">
<div class="wait-upload-img" v-if="clipboardFiles.length > 0">
<div class="list-title">等待上传</div>
<div v-for="(item, index) in clipboardFiles" :key="index" class="img-list" :style="{height: calcHeight(item.width, item.height) + 'px'}">
<div class="upload-img__container" @click="uploadClipboardFiles">
<div v-for="(item, index) in clipboardFiles" :key="index" class="img-list">
<div
class="upload-img__container"
:class="{ upload: uploadFlag }"
@click="uploadClipboardFiles">
<img :src="item.imgUrl" class="upload-img">
</div>
</div>
</div>
<div class="uploaded-img">
<div class="list-title">已上传</div>
<div v-for="(item, index) in files" :key="index" class="img-list" :style="{height: calcHeight(item.width, item.height) + 'px'}">
<div v-for="item in files" :key="item.imgUrl" class="img-list">
<div class="upload-img__container" @click="copyTheLink(item)">
<img :src="item.imgUrl" class="upload-img">
</div>
@@ -36,7 +39,8 @@
body: '',
icon: ''
},
clipboardFiles: []
clipboardFiles: [],
uploadFlag: false
}
},
computed: {
@@ -58,6 +62,8 @@
})
this.$electron.ipcRenderer.on('uploadFiles', (event) => {
this.files = this.$db.read().get('uploaded').slice().reverse().slice(0, 5).value()
console.log(this.files)
this.uploadFlag = false
})
this.$electron.ipcRenderer.on('updateFiles', (event) => {
this.getData()
@@ -97,14 +103,21 @@
}, false)
},
uploadClipboardFiles () {
this.$electron.ipcRenderer.send('uploadClipboardFiles', this.clipboardFiles[0])
if (this.uploadFlag) {
return
}
this.uploadFlag = true
this.$electron.ipcRenderer.send('uploadClipboardFiles')
}
}
}
</script>
<style lang="stylus">
body::-webkit-scrollbar
width 0px
#tray-page
background-color transparent
.list-title
text-align center
color #858585
@@ -134,11 +147,11 @@
top 0px
width 100%
.img-list
padding 16px 8px
padding 8px 8px
display flex
justify-content space-between
align-items center
height 45px
// height 45px
cursor pointer
transition all .2s ease-in-out
&:hover
@@ -146,11 +159,13 @@
.upload-img__index
color #fff
.upload-img
height 100%
width 100%
object-fit scale-down
margin 0 auto
&__container
width 100%
padding 8px 10px
height 100%
&.upload
cursor not-allowed
</style>
+22 -2
View File
@@ -3,7 +3,7 @@
<el-row :gutter="16">
<el-col :span="20" :offset="2">
<div class="view-title">
图片上传 - {{ picBedName }}
图片上传 - {{ picBedName }} <i class="el-icon-caret-bottom" @click="handleChangePicBed"></i>
</div>
<div
id="upload-area"
@@ -66,7 +66,8 @@ export default {
showError: false,
pasteStyle: '',
picBed: [],
picBedName: ''
picBedName: '',
menu: null
}
},
mounted () {
@@ -149,6 +150,25 @@ export default {
getPicBeds (event, picBeds) {
this.picBed = picBeds
this.getDefaultPicBed()
},
handleChangePicBed () {
this.buildMenu()
this.menu.popup(this.$electron.remote.getCurrentWindow())
},
buildMenu () {
const _this = this
const submenu = this.picBed.map(item => {
return {
label: item.name,
type: 'radio',
checked: this.$db.read().get('picBed.current').value() === item.type,
click () {
_this.$db.read().set('picBed.current', item.type).write()
_this.$electron.ipcRenderer.send('syncPicBed')
}
}
})
this.menu = this.$electron.remote.Menu.buildFromTemplate(submenu)
}
}
}
+1 -1
View File
@@ -33,7 +33,7 @@
:rules="{
required: true, message: 'Token不能为空', trigger: 'blur'
}">
<el-input v-model="form.token" @keyup.native.enter="confirm" placeholder="token"></el-input>
<el-input v-model="form.token" @keyup.native.enter="confirm" placeholder="token" type="password"></el-input>
</el-form-item>
<el-form-item
label="指定存储路径"
+5 -8
View File
@@ -45,13 +45,10 @@
</el-form-item>
<el-form-item
label="确认存储区域"
>
<el-radio-group v-model="form.area" size="mini">
<el-radio-button label="z0">华东</el-radio-button>
<el-radio-button label="z1">华北</el-radio-button>
<el-radio-button label="z2">华南</el-radio-button>
<el-radio-button label="na0">北美</el-radio-button>
</el-radio-group>
:rules="{
required: true, message: '区域代码不能为空', trigger: 'blur'
}">
<el-input v-model="form.area" placeholder="例如z0"></el-input>
</el-form-item>
<el-form-item
label="设定网址后缀"
@@ -86,7 +83,7 @@ export default {
secretKey: '',
bucket: '',
url: '',
area: 'z0',
area: '',
options: '',
path: ''
}
+1 -1
View File
@@ -113,7 +113,7 @@ export default {
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')
this.$electron.remote.shell.openExternal('https://picgo.github.io/PicGo-Doc/zh/guide/config.html#微博图床')
}
}
}
+4 -1
View File
@@ -78,7 +78,10 @@ export default new Router({
{
path: 'gallery',
component: require('@/pages/Gallery').default,
name: 'gallery'
name: 'gallery',
meta: {
keepAlive: true
}
},
{
path: 'setting',
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSServices</key>
<array>
<dict>
<key>NSBackgroundColorName</key>
<string>background</string>
<key>NSBackgroundSystemColorName</key>
<string>systemBlueColor</string>
<key>NSIconName</key>
<string>NSTouchBarShare</string>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>Upload pictures with PicGo</string>
</dict>
<key>NSMessage</key>
<string>runWorkflowAsService</string>
<key>NSRequiredContext</key>
<dict>
<key>NSApplicationIdentifier</key>
<string>com.apple.finder</string>
</dict>
<key>NSSendFileTypes</key>
<array>
<string>public.image</string>
</array>
</dict>
</array>
</dict>
</plist>
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

@@ -0,0 +1,314 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AMApplicationBuild</key>
<string>444.42</string>
<key>AMApplicationVersion</key>
<string>2.9</string>
<key>AMDocumentVersion</key>
<string>2</string>
<key>actions</key>
<array>
<dict>
<key>action</key>
<dict>
<key>AMAccepts</key>
<dict>
<key>Container</key>
<string>List</string>
<key>Optional</key>
<true/>
<key>Types</key>
<array>
<string>com.apple.cocoa.string</string>
</array>
</dict>
<key>AMActionVersion</key>
<string>2.0.3</string>
<key>AMApplication</key>
<array>
<string>自动操作</string>
</array>
<key>AMParameterProperties</key>
<dict>
<key>COMMAND_STRING</key>
<dict/>
<key>CheckedForUserDefaultShell</key>
<dict/>
<key>inputMethod</key>
<dict/>
<key>shell</key>
<dict/>
<key>source</key>
<dict/>
</dict>
<key>AMProvides</key>
<dict>
<key>Container</key>
<string>List</string>
<key>Types</key>
<array>
<string>com.apple.cocoa.string</string>
</array>
</dict>
<key>ActionBundlePath</key>
<string>/System/Library/Automator/Run Shell Script.action</string>
<key>ActionName</key>
<string>运行 Shell 脚本</string>
<key>ActionParameters</key>
<dict>
<key>COMMAND_STRING</key>
<string>/Applications/PicGo.app/Contents/MacOS/PicGo upload "$@" &gt; /dev/null 2&gt;&amp;1 &amp;</string>
<key>CheckedForUserDefaultShell</key>
<true/>
<key>inputMethod</key>
<integer>1</integer>
<key>shell</key>
<string>/bin/bash</string>
<key>source</key>
<string></string>
</dict>
<key>BundleIdentifier</key>
<string>com.apple.RunShellScript</string>
<key>CFBundleVersion</key>
<string>2.0.3</string>
<key>CanShowSelectedItemsWhenRun</key>
<false/>
<key>CanShowWhenRun</key>
<true/>
<key>Category</key>
<array>
<string>AMCategoryUtilities</string>
</array>
<key>Class Name</key>
<string>RunShellScriptAction</string>
<key>InputUUID</key>
<string>79609224-28DD-4ADE-AA8F-5A6C68C18C18</string>
<key>Keywords</key>
<array>
<string>Shell</string>
<string>脚本</string>
<string>命令</string>
<string>运行</string>
<string>Unix</string>
</array>
<key>OutputUUID</key>
<string>35CD6B4C-A616-4F89-8D76-DCD3249C5B4E</string>
<key>UUID</key>
<string>4350A83B-E7E6-4D2B-9768-B1D676CF58F3</string>
<key>UnlocalizedApplications</key>
<array>
<string>Automator</string>
</array>
<key>arguments</key>
<dict>
<key>0</key>
<dict>
<key>default value</key>
<integer>0</integer>
<key>name</key>
<string>inputMethod</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>0</string>
</dict>
<key>1</key>
<dict>
<key>default value</key>
<string></string>
<key>name</key>
<string>source</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>1</string>
</dict>
<key>2</key>
<dict>
<key>default value</key>
<false/>
<key>name</key>
<string>CheckedForUserDefaultShell</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>2</string>
</dict>
<key>3</key>
<dict>
<key>default value</key>
<string></string>
<key>name</key>
<string>COMMAND_STRING</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>3</string>
</dict>
<key>4</key>
<dict>
<key>default value</key>
<string>/bin/sh</string>
<key>name</key>
<string>shell</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>4</string>
</dict>
</dict>
<key>isViewVisible</key>
<true/>
<key>location</key>
<string>449.000000:305.000000</string>
<key>nibPath</key>
<string>/System/Library/Automator/Run Shell Script.action/Contents/Resources/Base.lproj/main.nib</string>
</dict>
<key>isViewVisible</key>
<true/>
</dict>
</array>
<key>connectors</key>
<dict/>
<key>workflowMetaData</key>
<dict>
<key>applicationBundleID</key>
<string>com.apple.finder</string>
<key>applicationBundleIDsByPath</key>
<dict>
<key>/System/Library/CoreServices/Finder.app</key>
<string>com.apple.finder</string>
</dict>
<key>applicationPath</key>
<string>/System/Library/CoreServices/Finder.app</string>
<key>applicationPaths</key>
<array>
<string>/System/Library/CoreServices/Finder.app</string>
</array>
<key>backgroundColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGNjdYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVy
VCR0b3ASAAGGoKoHCBMUFR4kKC8zVSRudWxs1QkKCwwNDg8QERJWJGNsYXNz
W05TQ29sb3JOYW1lXE5TQ29sb3JTcGFjZV1OU0NhdGFsb2dOYW1lV05TQ29s
b3KACYADEAaAAoAEVlN5c3RlbV8QD3N5c3RlbUJsdWVDb2xvctUWFwsYCRka
GxwOXE5TQ29tcG9uZW50c1VOU1JHQl8QEk5TQ3VzdG9tQ29sb3JTcGFjZUcw
IDAgMSAxTxARMCAwIDAuOTk4MTg4OTcyNQAQAYAFgAnTHyAJISIjVE5TSURV
TlNJQ0MQB4AGgAjSJQkmJ1dOUy5kYXRhTxEMSAAADEhMaW5vAhAAA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/23//4AH0ikqKyxaJGNsYXNzbmFtZVgkY2xh
c3Nlc11OU011dGFibGVEYXRhoystLlZOU0RhdGFYTlNPYmplY3TSKSowMVxO
U0NvbG9yU3BhY2WiMi5cTlNDb2xvclNwYWNl0ikqNDVXTlNDb2xvcqI0Ll8Q
D05TS2V5ZWRBcmNoaXZlctE4OVRyb290gAEACAARABoAIwAtADIANwBCAEgA
UwBaAGYAcwCBAIkAiwCNAI8AkQCTAJoArAC3AMQAygDfAOcA+wD9AP8BAQEI
AQ0BEwEVARcBGQEeASYNcg10DXkNhA2NDZsNnw2mDa8NtA3BDcQN0Q3WDd4N
4Q3zDfYN+wAAAAAAAAIBAAAAAAAAADoAAAAAAAAAAAAAAAAAAA39
</data>
<key>backgroundColorName</key>
<string>systemBlueColor</string>
<key>inputTypeIdentifier</key>
<string>com.apple.Automator.fileSystemObject.image</string>
<key>outputTypeIdentifier</key>
<string>com.apple.Automator.nothing</string>
<key>presentationMode</key>
<integer>15</integer>
<key>processesInput</key>
<integer>0</integer>
<key>serviceApplicationBundleID</key>
<string>com.apple.finder</string>
<key>serviceApplicationPath</key>
<string>/System/Library/CoreServices/Finder.app</string>
<key>serviceInputTypeIdentifier</key>
<string>com.apple.Automator.fileSystemObject.image</string>
<key>serviceOutputTypeIdentifier</key>
<string>com.apple.Automator.nothing</string>
<key>serviceProcessesInput</key>
<integer>0</integer>
<key>systemImageName</key>
<string>NSTouchBarShare</string>
<key>useAutomaticInputType</key>
<integer>0</integer>
<key>workflowTypeIdentifier</key>
<string>com.apple.Automator.servicesMenu</string>
</dict>
</dict>
</plist>
+12 -10
View File
@@ -1,16 +1,18 @@
# from https://github.com/favers/vscode-qiniu-upload-image/blob/master/lib/linux.sh
#!/bin/sh
# require xclip(see http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script/677212#677212)
command -v xclip >/dev/null 2>&1 || { echo >&1 "no xclip"; exit 1; }
# write image in clipboard to file (see http://unix.stackexchange.com/questions/145131/copy-image-from-clipboard-to-file)
if
xclip -selection clipboard -target image/png -o >/dev/null 2>&1
then
xclip -selection clipboard -target image/png -o >$1 2>/dev/null
echo $1
filePath=`xclip -selection clipboard -o 2>/dev/null | grep ^file:// | cut -c8-`
if [ ! -n "$filePath" ] ;then
if
xclip -selection clipboard -target image/png -o >/dev/null 2>&1
then
xclip -selection clipboard -target image/png -o >$1 2>/dev/null
echo $1
else
echo "no image"
fi
else
echo "no image"
fi
echo $filePath
fi
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

+35 -17
View File
@@ -1,26 +1,44 @@
# Adapted from https://github.com/octan3/img-clipboard-dump/blob/master/dump-clipboard-png.ps1
param($imagePath)
# Adapted from https://github.com/octan3/img-clipboard-dump/blob/master/dump-clipboard-png.ps1
# https://github.com/PowerShell/PowerShell/issues/7233
# fix the output encoding bug
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
Add-Type -Assembly PresentationCore
$img = [Windows.Clipboard]::GetImage()
function main {
$img = [Windows.Clipboard]::GetImage()
if ($img -eq $null) {
"no image"
Exit 1
if ($img -eq $null) {
"no image"
Exit 1
}
if (-not $imagePath) {
"no image"
Exit 1
}
$fcb = new-object Windows.Media.Imaging.FormatConvertedBitmap($img, [Windows.Media.PixelFormats]::Rgb24, $null, 0)
$stream = [IO.File]::Open($imagePath, "OpenOrCreate")
$encoder = New-Object Windows.Media.Imaging.PngBitmapEncoder
$encoder.Frames.Add([Windows.Media.Imaging.BitmapFrame]::Create($fcb)) | out-null
$encoder.Save($stream) | out-null
$stream.Dispose() | out-null
$imagePath
}
if (-not $imagePath) {
"no image"
Exit 1
try {
# For WIN10
$file = Get-Clipboard -Format FileDropList
if ($file -ne $null) {
Convert-Path $file
Exit 1
}
} catch {
# For WIN7 WIN8 WIN10
main
}
$fcb = new-object Windows.Media.Imaging.FormatConvertedBitmap($img, [Windows.Media.PixelFormats]::Rgb24, $null, 0)
$stream = [IO.File]::Open($imagePath, "OpenOrCreate")
$encoder = New-Object Windows.Media.Imaging.PngBitmapEncoder
$encoder.Frames.Add([Windows.Media.Imaging.BitmapFrame]::Create($fcb)) | out-null
$encoder.Save($stream) | out-null
$stream.Dispose() | out-null
$imagePath
main
+3046 -2003
View File
File diff suppressed because it is too large Load Diff