diff --git a/app/services/platform-apps/api/modules/authorization.ts b/app/services/platform-apps/api/modules/authorization.ts index 5b686cdba505..763a97c4de30 100644 --- a/app/services/platform-apps/api/modules/authorization.ts +++ b/app/services/platform-apps/api/modules/authorization.ts @@ -67,9 +67,10 @@ export class AuthorizationModule extends Module { win.webContents.openDevTools({ mode: 'detach' }); } - win.webContents.session.protocol.registerFileProtocol('slobs-oauth', req => { + win.webContents.session.protocol.handle('slobs-oauth', req => { eventHandler({ type: EAuthWindowEventType.AuthRedirect, url: req.url }); win.close(); + return new Response(); }); win.on('closed', () => { diff --git a/updater/bundle-updater.ts b/updater/bundle-updater.ts index 81653dd81b5a..d3138513eb25 100644 --- a/updater/bundle-updater.ts +++ b/updater/bundle-updater.ts @@ -405,17 +405,16 @@ module.exports = async (basePath: string) => { e.returnValue = bundleNames; }); - electron.session.defaultSession?.protocol.registerFileProtocol('slbundle', (request, cb) => { + electron.session.defaultSession?.protocol.handle('slbundle', request => { const url = new URL(request.url); const bundleName = url.pathname.replace('/', '') as TBundleName; if (!useLocalBundles && bundlePathsMap[bundleName]) { - cb({ path: bundlePathsMap[bundleName] }); - return; + return electron.net.fetch(bundlePathsMap[bundleName]); } console.log(`Using local bundle for ${bundleName}`); - cb({ path: path.join(localBase, localManifest[bundleName]) }); + return electron.net.fetch(path.join(localBase, localManifest[bundleName])); }); // Use a local web server to serve source maps in development.