mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-02 00:09:30 +01:00
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:
@@ -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') {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user