1- // 'use strict'
2-
3- // import { app, protocol, BrowserWindow } from 'electron'
4- // import {
5- // createProtocol,
6- // installVueDevtools
7- // } from 'vue-cli-plugin-electron-builder/lib'
8- // const isDevelopment = process.env.NODE_ENV !== 'production'
9-
10- // // Keep a global reference of the window object, if you don't, the window will
11- // // be closed automatically when the JavaScript object is garbage collected.
12- // let win: BrowserWindow | null
13-
14- // // Scheme must be registered before the app is ready
15- // protocol.registerSchemesAsPrivileged([{ scheme: 'app', privileges: { secure: true, standard: true } }])
16-
17- // function createWindow () {
18- // // Create the browser window.
19- // win = new BrowserWindow({ width: 800,
20- // height: 600,
21- // webPreferences: {
22- // nodeIntegration: true
23- // } })
24-
25- // if (process.env.WEBPACK_DEV_SERVER_URL) {
26- // // Load the url of the dev server if in development mode
27- // win.loadURL(process.env.WEBPACK_DEV_SERVER_URL as string)
28- // if (!process.env.IS_TEST) win.webContents.openDevTools()
29- // } else {
30- // createProtocol('app')
31- // // Load the index.html when not in development
32- // win.loadURL('app://./index.html')
33- // }
34-
35- // win.on('closed', () => {
36- // win = null
37- // })
38- // }
39-
40- // // Quit when all windows are closed.
41- // app.on('window-all-closed', () => {
42- // // On macOS it is common for applications and their menu bar
43- // // to stay active until the user quits explicitly with Cmd + Q
44- // if (process.platform !== 'darwin') {
45- // app.quit()
46- // }
47- // })
48-
49- // app.on('activate', () => {
50- // // On macOS it's common to re-create a window in the app when the
51- // // dock icon is clicked and there are no other windows open.
52- // if (win === null) {
53- // createWindow()
54- // }
55- // })
56-
57- // // This method will be called when Electron has finished
58- // // initialization and is ready to create browser windows.
59- // // Some APIs can only be used after this event occurs.
60- // app.on('ready', async () => {
61- // if (isDevelopment && !process.env.IS_TEST) {
62- // // Install Vue Devtools
63- // try {
64- // await installVueDevtools()
65- // } catch (e) {
66- // console.error('Vue Devtools failed to install:', e.toString())
67- // }
68- // }
69- // createWindow()
70- // })
71-
721'use strict'
732
743import Uploader from '~/main/utils/uploader'
@@ -108,8 +37,10 @@ import {
10837 shortKeyUpdater ,
10938 initShortKeyRegister
11039} from '~/main/utils/shortKeyHandler'
40+ import logger from '~/main/utils/logger'
41+
11142const isDevelopment = process . env . NODE_ENV !== 'production'
112- protocol . registerSchemesAsPrivileged ( [ { scheme : 'app ' , privileges : { secure : true , standard : true } } ] )
43+ protocol . registerSchemesAsPrivileged ( [ { scheme : 'picgo ' , privileges : { secure : true , standard : true } } ] )
11344
11445if ( process . platform === 'darwin' ) {
11546 beforeOpen ( )
@@ -634,6 +565,7 @@ if (process.env.XDG_CURRENT_DESKTOP && process.env.XDG_CURRENT_DESKTOP.includes(
634565}
635566
636567app . on ( 'ready' , async ( ) => {
568+ createProtocol ( 'picgo' )
637569 if ( isDevelopment && ! process . env . IS_TEST ) {
638570 // Install Vue Devtools
639571 try {
@@ -658,6 +590,11 @@ app.on('ready', async () => {
658590
659591 if ( process . env . NODE_ENV !== 'development' ) {
660592 let files = getUploadFiles ( )
593+ if ( files === null ) {
594+ logger . info ( 'get clipboardFile, null' )
595+ } else {
596+ logger . info ( `get clipboardFile, ${ files . toString ( ) } ` )
597+ }
661598 if ( files === null || files . length > 0 ) { // 如果有文件列表作为参数,说明是命令行启动
662599 if ( files === null ) {
663600 uploadClipboardFiles ( )
0 commit comments