mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-09-26 06:35:45 +00:00
use own app protocol impl
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
import { app, protocol, ipcMain, screen } from 'electron'
|
||||
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
|
||||
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
|
||||
import { setupShortcuts } from './main/shortcuts'
|
||||
import { createTray } from './main/tray'
|
||||
@@ -54,7 +53,6 @@ app.on('ready', async () => {
|
||||
}
|
||||
}
|
||||
|
||||
createProtocol('app')
|
||||
createFileProtocol()
|
||||
|
||||
setupConfigEvents()
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
import { protocol, app, ipcMain } from 'electron'
|
||||
import { IMPORT_FILE } from '@/ipc/ipc-event'
|
||||
import { URL } from 'url'
|
||||
import path from 'path'
|
||||
import crypto from 'crypto'
|
||||
import fs from 'fs'
|
||||
|
||||
export function createFileProtocol () {
|
||||
protocol.registerFileProtocol('app', (req, resp) => {
|
||||
const url = new URL(req.url)
|
||||
const pathName = path.join(url.host, url.pathname)
|
||||
resp({ path: path.join(__dirname, pathName) })
|
||||
})
|
||||
|
||||
protocol.registerFileProtocol('app-file', (req, resp) => {
|
||||
resp({ path: path.join(app.getPath('userData'), 'apt-data/files', req.url.substr('app-file://'.length)) })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user