mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-01-22 22:28:14 -05:00
🐛 Fix: launch error in new structrue
This commit is contained in:
parent
4e3fa28be6
commit
bc8e641fda
@ -1,74 +1,3 @@
|
||||
// 'use strict'
|
||||
|
||||
// import { app, protocol, BrowserWindow } from 'electron'
|
||||
// import {
|
||||
// createProtocol,
|
||||
// installVueDevtools
|
||||
// } from 'vue-cli-plugin-electron-builder/lib'
|
||||
// const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||
|
||||
// // Keep a global reference of the window object, if you don't, the window will
|
||||
// // be closed automatically when the JavaScript object is garbage collected.
|
||||
// let win: BrowserWindow | null
|
||||
|
||||
// // Scheme must be registered before the app is ready
|
||||
// protocol.registerSchemesAsPrivileged([{ scheme: 'app', privileges: { secure: true, standard: true } }])
|
||||
|
||||
// function createWindow () {
|
||||
// // Create the browser window.
|
||||
// win = new BrowserWindow({ width: 800,
|
||||
// height: 600,
|
||||
// webPreferences: {
|
||||
// nodeIntegration: true
|
||||
// } })
|
||||
|
||||
// if (process.env.WEBPACK_DEV_SERVER_URL) {
|
||||
// // Load the url of the dev server if in development mode
|
||||
// win.loadURL(process.env.WEBPACK_DEV_SERVER_URL as string)
|
||||
// if (!process.env.IS_TEST) win.webContents.openDevTools()
|
||||
// } else {
|
||||
// createProtocol('app')
|
||||
// // Load the index.html when not in development
|
||||
// win.loadURL('app://./index.html')
|
||||
// }
|
||||
|
||||
// win.on('closed', () => {
|
||||
// win = null
|
||||
// })
|
||||
// }
|
||||
|
||||
// // Quit when all windows are closed.
|
||||
// app.on('window-all-closed', () => {
|
||||
// // On macOS it is common for applications and their menu bar
|
||||
// // to stay active until the user quits explicitly with Cmd + Q
|
||||
// if (process.platform !== 'darwin') {
|
||||
// app.quit()
|
||||
// }
|
||||
// })
|
||||
|
||||
// app.on('activate', () => {
|
||||
// // On macOS it's common to re-create a window in the app when the
|
||||
// // dock icon is clicked and there are no other windows open.
|
||||
// if (win === null) {
|
||||
// createWindow()
|
||||
// }
|
||||
// })
|
||||
|
||||
// // This method will be called when Electron has finished
|
||||
// // initialization and is ready to create browser windows.
|
||||
// // Some APIs can only be used after this event occurs.
|
||||
// app.on('ready', async () => {
|
||||
// if (isDevelopment && !process.env.IS_TEST) {
|
||||
// // Install Vue Devtools
|
||||
// try {
|
||||
// await installVueDevtools()
|
||||
// } catch (e) {
|
||||
// console.error('Vue Devtools failed to install:', e.toString())
|
||||
// }
|
||||
// }
|
||||
// createWindow()
|
||||
// })
|
||||
|
||||
'use strict'
|
||||
|
||||
import Uploader from '~/main/utils/uploader'
|
||||
@ -108,8 +37,10 @@ import {
|
||||
shortKeyUpdater,
|
||||
initShortKeyRegister
|
||||
} from '~/main/utils/shortKeyHandler'
|
||||
import logger from '~/main/utils/logger'
|
||||
|
||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||
protocol.registerSchemesAsPrivileged([{ scheme: 'app', privileges: { secure: true, standard: true } }])
|
||||
protocol.registerSchemesAsPrivileged([{ scheme: 'picgo', privileges: { secure: true, standard: true } }])
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
beforeOpen()
|
||||
@ -634,6 +565,7 @@ if (process.env.XDG_CURRENT_DESKTOP && process.env.XDG_CURRENT_DESKTOP.includes(
|
||||
}
|
||||
|
||||
app.on('ready', async () => {
|
||||
createProtocol('picgo')
|
||||
if (isDevelopment && !process.env.IS_TEST) {
|
||||
// Install Vue Devtools
|
||||
try {
|
||||
@ -658,6 +590,11 @@ app.on('ready', async () => {
|
||||
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
let files = getUploadFiles()
|
||||
if (files === null) {
|
||||
logger.info('get clipboardFile, null')
|
||||
} else {
|
||||
logger.info(`get clipboardFile, ${files.toString()}`)
|
||||
}
|
||||
if (files === null || files.length > 0) { // 如果有文件列表作为参数,说明是命令行启动
|
||||
if (files === null) {
|
||||
uploadClipboardFiles()
|
||||
|
@ -4,6 +4,7 @@ import Router from 'vue-router'
|
||||
Vue.use(Router)
|
||||
|
||||
export default new Router({
|
||||
mode: 'hash',
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
|
@ -12,6 +12,8 @@ module.exports = {
|
||||
},
|
||||
pluginOptions: {
|
||||
electronBuilder: {
|
||||
customFileProtocol: 'picgo://./',
|
||||
externals: ['picgo'],
|
||||
chainWebpackMainProcess: config => {
|
||||
config.resolve.alias
|
||||
.set('@', resolve('src/renderer'))
|
||||
|
Loading…
Reference in New Issue
Block a user