forked from PhilippLgh/electron-app-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
26 lines (25 loc) · 1.1 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import AppManager from './updater/AppManager'
import { registerHotLoadProtocol } from './updater/lib/CustomProtocols';
export {default as AppManager} from './updater/AppManager'
export * from './updater/lib/downloader'
export const registerPackageProtocol = (cacheDir? : string) => {
const { protocol, app } = require('electron')
/**
// https://github.com/electron/electron/blob/master/docs/api/protocol.md
By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB, cookies) are disabled
for non standard schemes.
So in general if you want to register a custom protocol to replace the http protocol,
you have to register it as a standard scheme.
-> needs to be registered before app.onReady
*/
// @ts-ignore
if (protocol.registerStandardSchemes && typeof protocol.registerStandardSchemes === 'function') {
// @ts-ignore
protocol.registerStandardSchemes(['package'], { secure: true })
} else {
protocol.registerSchemesAsPrivileged([
{ scheme: 'package', privileges: { standard: true, secure: true } }
])
}
registerHotLoadProtocol(cacheDir)
}