mirror of
https://github.com/Molunerfinn/PicGo.git
synced 2024-04-21 10:31:33 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10959f3c54 | ||
|
|
1f4f40848e | ||
|
|
7ef76b0a9b | ||
|
|
f87311760a | ||
|
|
d597477a79 | ||
|
|
2bcbf749d1 | ||
|
|
59dd2c0b55 | ||
|
|
43bace3212 | ||
|
|
649e9f0695 | ||
|
|
e8f2185bbb |
@@ -117,4 +117,4 @@ npm run build
|
||||
|
||||
[MIT](http://opensource.org/licenses/MIT)
|
||||
|
||||
Copyright (c) 2017 Molunerfinn
|
||||
Copyright (c) 2017 - 2019 Molunerfinn
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "picgo",
|
||||
"version": "2.0.2",
|
||||
"version": "2.0.4",
|
||||
"author": "Molunerfinn <marksz@teamsz.xyz>",
|
||||
"description": "Easy to upload your pic & copy to write",
|
||||
"license": "MIT",
|
||||
@@ -82,7 +82,7 @@
|
||||
"lowdb": "^1.0.0",
|
||||
"md5": "^2.2.1",
|
||||
"melody.css": "^1.0.2",
|
||||
"picgo": "^1.2.4",
|
||||
"picgo": "^1.2.6",
|
||||
"qiniu": "^7.1.1",
|
||||
"vue": "^2.3.3",
|
||||
"vue-electron": "^1.0.6",
|
||||
@@ -109,7 +109,7 @@
|
||||
"css-loader": "^0.28.4",
|
||||
"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",
|
||||
|
||||
+32
-3
@@ -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
|
||||
|
||||
+2
-2
@@ -371,7 +371,7 @@ picgoCoreIPC(app, ipcMain)
|
||||
|
||||
// from macOS tray
|
||||
ipcMain.on('uploadClipboardFiles', async (evt, file) => {
|
||||
const img = await new Uploader(file, window.webContents).upload()
|
||||
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
|
||||
@@ -385,11 +385,11 @@ ipcMain.on('uploadClipboardFiles', async (evt, file) => {
|
||||
notification.show()
|
||||
db.read().get('uploaded').insert(img[0]).write()
|
||||
window.webContents.send('clipboardFiles', [])
|
||||
window.webContents.send('uploadFiles')
|
||||
if (settingWindow) {
|
||||
settingWindow.webContents.send('updateGallery')
|
||||
}
|
||||
}
|
||||
window.webContents.send('uploadFiles')
|
||||
})
|
||||
|
||||
ipcMain.on('uploadClipboardFilesFromUploadPage', () => {
|
||||
|
||||
@@ -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>
|
||||
@@ -296,7 +301,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
@@ -439,6 +439,9 @@ export default {
|
||||
},
|
||||
handleInputBoxClose () {
|
||||
this.$electron.ipcRenderer.send('showInputBox', this.inputBoxValue)
|
||||
},
|
||||
goAwesomeList () {
|
||||
this.$electron.remote.shell.openExternal('https://github.com/PicGo/Awesome-PicGo')
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
@@ -476,6 +479,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
|
||||
|
||||
@@ -5,14 +5,17 @@
|
||||
<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
|
||||
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" :style="{height: calcHeight(item.width, item.height) + 'px'}">
|
||||
<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,7 @@
|
||||
})
|
||||
this.$electron.ipcRenderer.on('uploadFiles', (event) => {
|
||||
this.files = this.$db.read().get('uploaded').slice().reverse().slice(0, 5).value()
|
||||
this.uploadFlag = false
|
||||
})
|
||||
this.$electron.ipcRenderer.on('updateFiles', (event) => {
|
||||
this.getData()
|
||||
@@ -97,7 +102,11 @@
|
||||
}, false)
|
||||
},
|
||||
uploadClipboardFiles () {
|
||||
this.$electron.ipcRenderer.send('uploadClipboardFiles', this.clipboardFiles[0])
|
||||
if (this.uploadFlag) {
|
||||
return
|
||||
}
|
||||
this.uploadFlag = true
|
||||
this.$electron.ipcRenderer.send('uploadClipboardFiles')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,4 +165,6 @@ body::-webkit-scrollbar
|
||||
width 100%
|
||||
padding 8px 10px
|
||||
height 100%
|
||||
&.upload
|
||||
cursor not-allowed
|
||||
</style>
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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#微博图床')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,10 @@ export default new Router({
|
||||
{
|
||||
path: 'gallery',
|
||||
component: require('@/pages/Gallery').default,
|
||||
name: 'gallery'
|
||||
name: 'gallery',
|
||||
meta: {
|
||||
keepAlive: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'setting',
|
||||
|
||||
+12
-10
@@ -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
|
||||
|
||||
Binary file not shown.
@@ -4,6 +4,11 @@ param($imagePath)
|
||||
# Adapted from https://github.com/octan3/img-clipboard-dump/blob/master/dump-clipboard-png.ps1
|
||||
|
||||
Add-Type -Assembly PresentationCore
|
||||
$file = Get-Clipboard -Format FileDropList
|
||||
if ($file -ne $null) {
|
||||
Convert-Path $file
|
||||
Exit 1
|
||||
}
|
||||
$img = [Windows.Clipboard]::GetImage()
|
||||
|
||||
if ($img -eq $null) {
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
dependencies:
|
||||
"@types/babel-types" "*"
|
||||
|
||||
"@types/node@^8.0.24":
|
||||
version "8.10.39"
|
||||
resolved "http://registry.npm.taobao.org/@types/node/download/@types/node-8.10.39.tgz#e7e87ad00364dd7bc485c940926345b8ec1a26ca"
|
||||
"@types/node@^10.12.18":
|
||||
version "10.12.18"
|
||||
resolved "http://registry.npm.taobao.org/@types/node/download/@types/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67"
|
||||
|
||||
"@vue/component-compiler-utils@^2.0.0":
|
||||
version "2.3.1"
|
||||
@@ -3247,11 +3247,11 @@ electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.47:
|
||||
version "1.3.96"
|
||||
resolved "http://registry.npm.taobao.org/electron-to-chromium/download/electron-to-chromium-1.3.96.tgz#25770ec99b8b07706dedf3a5f43fa50cb54c4f9a"
|
||||
|
||||
electron@4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "http://registry.npm.taobao.org/electron/download/electron-4.0.0.tgz#6ccb40cc8bf2d49954dcea73b97ae7ad12ee04b3"
|
||||
electron@4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "http://registry.npm.taobao.org/electron/download/electron-4.0.2.tgz#b5e074c149841490825d0785aa2bc4f5e29bbea4"
|
||||
dependencies:
|
||||
"@types/node" "^8.0.24"
|
||||
"@types/node" "^10.12.18"
|
||||
electron-download "^4.1.0"
|
||||
extract-zip "^1.0.3"
|
||||
|
||||
@@ -6750,9 +6750,9 @@ performance-now@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "http://registry.npm.taobao.org/performance-now/download/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
|
||||
|
||||
picgo@^1.2.4:
|
||||
version "1.2.4"
|
||||
resolved "http://registry.npm.taobao.org/picgo/download/picgo-1.2.4.tgz#d5d9f48968e60cbd0f0f628e363abd5a97d6195a"
|
||||
picgo@^1.2.6:
|
||||
version "1.2.6"
|
||||
resolved "http://registry.npm.taobao.org/picgo/download/picgo-1.2.6.tgz#25f4d418592be36ba3fda55a32b56b8a006323bf"
|
||||
dependencies:
|
||||
chalk "^2.4.1"
|
||||
commander "^2.17.0"
|
||||
|
||||
Reference in New Issue
Block a user