mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-01-22 22:28:14 -05:00
Added: windows support
This commit is contained in:
parent
783adada58
commit
b4c760c8cd
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@ dist/electron/*
|
||||
dist/web/*
|
||||
build/*
|
||||
!build/icons
|
||||
!build/installer.nsh
|
||||
coverage
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
|
1
.npmrc
Normal file
1
.npmrc
Normal file
@ -0,0 +1 @@
|
||||
electron_mirror="https://npm.taobao.org/mirrors/electron/"
|
@ -24,7 +24,7 @@
|
||||
|
||||
PicGo目前支持了`微博图床`,`七牛图床`,`腾讯云COS`,`又拍云`。未来将支持更多图床。
|
||||
|
||||
暂时只支持macOS系统,未来将支持windows和linux。
|
||||
支持macOS、windows 64位(v1.3.0以上)系统,未来将支持linux。
|
||||
|
||||
点击此处下载[应用](https://github.com/Molunerfinn/PicGo/releases),macOS用户请下载最新版本的`dmg`文件。
|
||||
|
||||
@ -36,13 +36,14 @@ PicGo目前支持了`微博图床`,`七牛图床`,`腾讯云COS`,`又拍
|
||||
|
||||
## 开发说明
|
||||
|
||||
> 目前仅针对Mac平台。Windows和Linux平台并未测试。
|
||||
> 目前仅针对Mac、Windows。Linux平台并未测试。
|
||||
|
||||
如果你想要学习、开发、修改或自行构建PicGo,可以依照下面的指示:
|
||||
|
||||
1. 你需要有node、git环境。需要了解npm的相关知识。
|
||||
2. `git clone https://github.com/Molunerfinn/PicGo.git` 并进入项目
|
||||
3. `npm install` 下载依赖
|
||||
4. Mac需要有Xcode环境,Windows需要有VS环境。
|
||||
|
||||
### 开发模式
|
||||
|
||||
|
@ -28,6 +28,6 @@ install:
|
||||
|
||||
build_script:
|
||||
#- yarn test
|
||||
- yarn build
|
||||
- npm run release
|
||||
|
||||
test: off
|
||||
|
8
build/installer.nsh
Normal file
8
build/installer.nsh
Normal 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
|
@ -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
|
||||
|
@ -29,7 +29,7 @@
|
||||
},
|
||||
"build": {
|
||||
"productName": "PicGo",
|
||||
"appId": "org.simulatedgreg.electron-vue",
|
||||
"appId": "com.molunerfinn.picgo",
|
||||
"directories": {
|
||||
"output": "build"
|
||||
},
|
||||
@ -58,7 +58,12 @@
|
||||
}
|
||||
},
|
||||
"win": {
|
||||
"icon": "build/icons/icon.ico"
|
||||
"icon": "build/icons/icon.ico",
|
||||
"target": "nsis"
|
||||
},
|
||||
"nsis": {
|
||||
"oneClick": false,
|
||||
"allowToChangeInstallationDirectory": true
|
||||
},
|
||||
"linux": {
|
||||
"icon": "build/icons"
|
||||
|
@ -34,7 +34,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: '关于',
|
||||
@ -110,21 +111,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 +200,7 @@ const createWindow = () => {
|
||||
}
|
||||
|
||||
const createSettingWindow = () => {
|
||||
settingWindow = new BrowserWindow({
|
||||
const options = {
|
||||
height: 450,
|
||||
width: 800,
|
||||
show: false,
|
||||
@ -196,14 +208,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)
|
||||
|
||||
@ -351,6 +369,11 @@ if (isSecondInstance) {
|
||||
app.quit()
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
console.log(pkg.build.appId)
|
||||
app.setAppUserModelId(pkg.build.appId)
|
||||
}
|
||||
|
||||
app.on('ready', () => {
|
||||
createWindow()
|
||||
createTray()
|
||||
|
@ -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,8 @@
|
||||
<script>
|
||||
import pkg from '../../../package.json'
|
||||
import { remote } from 'electron'
|
||||
const { Menu, dialog } = remote
|
||||
import os from 'os'
|
||||
const { Menu, dialog, BrowserWindow } = remote
|
||||
export default {
|
||||
name: 'setting-page',
|
||||
data () {
|
||||
@ -72,10 +77,12 @@ export default {
|
||||
version: pkg.version,
|
||||
defaultActive: 'upload',
|
||||
menu: null,
|
||||
visible: false
|
||||
visible: false,
|
||||
os: ''
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.os = os.platform()
|
||||
this.buildMenu()
|
||||
},
|
||||
methods: {
|
||||
@ -84,6 +91,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 = [
|
||||
@ -128,6 +143,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 +192,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
|
||||
|
BIN
static/menubar-nodarwin.png
Normal file
BIN
static/menubar-nodarwin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 744 B |
Loading…
Reference in New Issue
Block a user