diff --git a/.gitignore b/.gitignore index 998a10d..ff97ff9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ dist/electron/* dist/web/* build/* !build/icons +!build/installer.nsh coverage node_modules/ npm-debug.log diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..fbe02cd --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +electron_mirror="https://npm.taobao.org/mirrors/electron/" \ No newline at end of file diff --git a/README.md b/README.md index dde253a..d47ddb0 100644 --- a/README.md +++ b/README.md @@ -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环境。 ### 开发模式 diff --git a/appveyor.yml b/appveyor.yml index 0bff3e0..83c2240 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,6 +28,6 @@ install: build_script: #- yarn test - - yarn build + - npm run release test: off diff --git a/build/installer.nsh b/build/installer.nsh new file mode 100644 index 0000000..0c93e80 --- /dev/null +++ b/build/installer.nsh @@ -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 \ No newline at end of file diff --git a/docs/APP.vue b/docs/APP.vue index 0d101b9..bcdfdce 100644 --- a/docs/APP.vue +++ b/docs/APP.vue @@ -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 diff --git a/package.json b/package.json index 7199f60..3a54d52 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/src/main/index.js b/src/main/index.js index aaeb550..dc6c0e6 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -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() diff --git a/src/renderer/components/SettingPage.vue b/src/renderer/components/SettingPage.vue index df6659f..f501b1d 100644 --- a/src/renderer/components/SettingPage.vue +++ b/src/renderer/components/SettingPage.vue @@ -2,8 +2,12 @@