fix: support protocol handling for sessions app on windows (#303398)

* fix: support protocol handling for sessions app on windows

* chore: always use HKCU for protocol registration
This commit is contained in:
Robo
2026-03-20 17:33:22 +09:00
committed by GitHub
parent 0b90e94168
commit 31ed44d62d
3 changed files with 14 additions and 3 deletions

View File

@@ -122,6 +122,7 @@ function buildWin32Setup(arch: string, target: string): task.CallbackTask {
definitions['ProxyExeBasename'] = embedded.nameShort;
definitions['ProxyAppUserId'] = embedded.win32AppUserModelId;
definitions['ProxyNameLong'] = embedded.nameLong;
definitions['ProxyExeUrlProtocol'] = embedded.urlProtocol;
}
if (quality === 'stable' || quality === 'insider') {

View File

@@ -1294,6 +1294,15 @@ Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Drive\shell\{#RegValu
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Drive\shell\{#RegValueName}"; ValueType: expandsz; ValueName: "Icon"; ValueData: "{app}\{#ExeBasename}.exe"; Check: ShouldInstallLegacyFolderContextMenu
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Drive\shell\{#RegValueName}\command"; ValueType: expandsz; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%V"""; Check: ShouldInstallLegacyFolderContextMenu
; URL Protocol handler for proxy executable
#ifdef ProxyExeBasename
#ifdef ProxyExeUrlProtocol
Root: HKCU; Subkey: "Software\Classes\{#ProxyExeUrlProtocol}"; ValueType: string; ValueName: ""; ValueData: "URL:{#ProxyExeUrlProtocol}"; Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\Classes\{#ProxyExeUrlProtocol}"; ValueType: string; ValueName: "URL Protocol"; ValueData: ""; Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\Classes\{#ProxyExeUrlProtocol}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ProxyExeBasename}.exe"" --open-url -- ""%1"""; Flags: uninsdeletekey
#endif
#endif
; Environment
#if "user" == InstallTarget
#define EnvironmentRootKey "HKCU"

View File

@@ -7,7 +7,7 @@ import { app, Event as ElectronEvent } from 'electron';
import { disposableTimeout } from '../../../base/common/async.js';
import { Event } from '../../../base/common/event.js';
import { Disposable } from '../../../base/common/lifecycle.js';
import { isWindows } from '../../../base/common/platform.js';
import { INodeProcess, isWindows } from '../../../base/common/platform.js';
import { URI } from '../../../base/common/uri.js';
import { IEnvironmentMainService } from '../../environment/electron-main/environmentMainService.js';
import { ILogService } from '../../log/common/log.js';
@@ -50,8 +50,9 @@ export class ElectronURLListener extends Disposable {
// Windows: install as protocol handler
// Skip in portable mode: the registered command wouldn't preserve
// portable mode settings, causing issues with OAuth flows
if (isWindows && !environmentMainService.isPortable) {
// portable mode settings, causing issues with OAuth flows.
// Skip for embedded apps: protocol handler is registered at install time.
if (isWindows && !environmentMainService.isPortable && !(process as INodeProcess).isEmbeddedApp) {
const windowsParameters = environmentMainService.isBuilt ? [] : [`"${environmentMainService.appRoot}"`];
windowsParameters.push('--open-url', '--');
app.setAsDefaultProtocolClient(productService.urlProtocol, process.execPath, windowsParameters);