提交 4f759fc2 编写于 作者: B Benjamin Pasero

proxy auth - use urlProtocol as partition

上级 e5c0007c
...@@ -11,6 +11,7 @@ import { IWindowsMainService } from 'vs/platform/windows/electron-main/windows'; ...@@ -11,6 +11,7 @@ import { IWindowsMainService } from 'vs/platform/windows/electron-main/windows';
import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService'; import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService';
import { IEncryptionMainService } from 'vs/platform/encryption/electron-main/encryptionMainService'; import { IEncryptionMainService } from 'vs/platform/encryption/electron-main/encryptionMainService';
import { generateUuid } from 'vs/base/common/uuid'; import { generateUuid } from 'vs/base/common/uuid';
import product from 'vs/platform/product/common/product';
type LoginEvent = { type LoginEvent = {
event: ElectronEvent; event: ElectronEvent;
...@@ -26,7 +27,7 @@ type Credentials = { ...@@ -26,7 +27,7 @@ type Credentials = {
export class ProxyAuthHandler2 extends Disposable { export class ProxyAuthHandler2 extends Disposable {
private static PROXY_CREDENTIALS_SERVICE_KEY = 'vscode.proxy-credentials'; private static PROXY_CREDENTIALS_SERVICE_KEY = `${product.urlProtocol}.proxy-credentials`;
private pendingProxyHandler = false; private pendingProxyHandler = false;
private proxyDialogShown = false; private proxyDialogShown = false;
......
...@@ -395,7 +395,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic ...@@ -395,7 +395,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
const emptyToRestore: IEmptyWindowBackupInfo[] = []; // empty windows with backupPath const emptyToRestore: IEmptyWindowBackupInfo[] = []; // empty windows with backupPath
let emptyToOpen: number = 0; let emptyToOpen: number = 0;
let fileInputs: IFileInputs | undefined; // collect all file inputs let fileInputs: IFileInputs | undefined; // collect all file inputs
for (const path of pathsToOpen) { for (const path of pathsToOpen) {
if (isFolderPathToOpen(path)) { if (isFolderPathToOpen(path)) {
if (openConfig.addMode) { if (openConfig.addMode) {
...@@ -504,6 +504,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic ...@@ -504,6 +504,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
recents.push({ label: pathToOpen.label, fileUri: pathToOpen.fileUri }); recents.push({ label: pathToOpen.label, fileUri: pathToOpen.fileUri });
} }
} }
this.workspacesHistoryMainService.addRecentlyOpened(recents); this.workspacesHistoryMainService.addRecentlyOpened(recents);
} }
...@@ -767,7 +768,6 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic ...@@ -767,7 +768,6 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
window.focus(); // make sure window has focus window.focus(); // make sure window has focus
const request: IAddFoldersRequest = { foldersToAdd }; const request: IAddFoldersRequest = { foldersToAdd };
window.sendWhenReady('vscode:addFolders', request); window.sendWhenReady('vscode:addFolders', request);
return window; return window;
...@@ -1098,7 +1098,8 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic ...@@ -1098,7 +1098,8 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
return undefined; return undefined;
} }
let lineNumber, columnNumber: number | undefined; let lineNumber: number | undefined;
let columnNumber: number | undefined;
if (options.gotoLineMode) { if (options.gotoLineMode) {
const parsedPath = parseLineAndColumnAware(anyPath); const parsedPath = parseLineAndColumnAware(anyPath);
...@@ -1110,7 +1111,6 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic ...@@ -1110,7 +1111,6 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
// open remote if either specified in the cli even if it is a local file. // open remote if either specified in the cli even if it is a local file.
const remoteAuthority = options.remoteAuthority; const remoteAuthority = options.remoteAuthority;
if (remoteAuthority) { if (remoteAuthority) {
const first = anyPath.charCodeAt(0); const first = anyPath.charCodeAt(0);
...@@ -1119,7 +1119,8 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic ...@@ -1119,7 +1119,8 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
if (isWindowsDriveLetter(first) && anyPath.charCodeAt(anyPath.charCodeAt(1)) === CharCode.Colon) { if (isWindowsDriveLetter(first) && anyPath.charCodeAt(anyPath.charCodeAt(1)) === CharCode.Colon) {
anyPath = toSlashes(anyPath); anyPath = toSlashes(anyPath);
} }
anyPath = '/' + anyPath;
anyPath = `/${anyPath}`;
} }
const uri = URI.from({ scheme: Schemas.vscodeRemote, authority: remoteAuthority, path: anyPath }); const uri = URI.from({ scheme: Schemas.vscodeRemote, authority: remoteAuthority, path: anyPath });
...@@ -1134,13 +1135,13 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic ...@@ -1134,13 +1135,13 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
return { fileUri: uri, remoteAuthority }; return { fileUri: uri, remoteAuthority };
} }
} }
return { folderUri: uri, remoteAuthority }; return { folderUri: uri, remoteAuthority };
} }
let candidate = normalize(anyPath); let candidate = normalize(anyPath);
try { try {
const candidateStat = fs.statSync(candidate); const candidateStat = fs.statSync(candidate);
if (candidateStat.isFile()) { if (candidateStat.isFile()) {
...@@ -1247,6 +1248,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic ...@@ -1247,6 +1248,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
return [existingWindow]; return [existingWindow];
} }
let folderUris = openConfig.cli['folder-uri'] || []; let folderUris = openConfig.cli['folder-uri'] || [];
let fileUris = openConfig.cli['file-uri'] || []; let fileUris = openConfig.cli['file-uri'] || [];
let cliArgs = openConfig.cli._; let cliArgs = openConfig.cli._;
...@@ -1297,23 +1299,26 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic ...@@ -1297,23 +1299,26 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
if (!!findWindowOnWorkspaceOrFolderUri(WindowsMainService.WINDOWS, uri)) { if (!!findWindowOnWorkspaceOrFolderUri(WindowsMainService.WINDOWS, uri)) {
return false; return false;
} }
return uri.authority === authority; return uri.authority === authority;
}); });
folderUris = folderUris.filter(uri => { folderUris = folderUris.filter(folderUriStr => {
const u = this.argToUri(uri); const folderUri = this.argToUri(folderUriStr);
if (!!findWindowOnWorkspaceOrFolderUri(WindowsMainService.WINDOWS, u)) { if (!!findWindowOnWorkspaceOrFolderUri(WindowsMainService.WINDOWS, folderUri)) {
return false; return false;
} }
return u ? u.authority === authority : false;
return folderUri ? folderUri.authority === authority : false;
}); });
fileUris = fileUris.filter(uri => { fileUris = fileUris.filter(fileUriStr => {
const u = this.argToUri(uri); const fileUri = this.argToUri(fileUriStr);
if (!!findWindowOnWorkspaceOrFolderUri(WindowsMainService.WINDOWS, u)) { if (!!findWindowOnWorkspaceOrFolderUri(WindowsMainService.WINDOWS, fileUri)) {
return false; return false;
} }
return u ? u.authority === authority : false;
return fileUri ? fileUri.authority === authority : false;
}); });
openConfig.cli._ = cliArgs; openConfig.cli._ = cliArgs;
...@@ -1623,6 +1628,16 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic ...@@ -1623,6 +1628,16 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
return state; return state;
} }
private onWindowClosed(win: ICodeWindow): void {
// Remove from our list so that Electron can clean it up
const index = WindowsMainService.WINDOWS.indexOf(win);
WindowsMainService.WINDOWS.splice(index, 1);
// Emit
this._onWindowsCountChanged.fire({ oldCount: WindowsMainService.WINDOWS.length + 1, newCount: WindowsMainService.WINDOWS.length });
}
getLastActiveWindow(): ICodeWindow | undefined { getLastActiveWindow(): ICodeWindow | undefined {
return getLastActiveWindow(WindowsMainService.WINDOWS); return getLastActiveWindow(WindowsMainService.WINDOWS);
} }
...@@ -1680,14 +1695,4 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic ...@@ -1680,14 +1695,4 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
getWindowCount(): number { getWindowCount(): number {
return WindowsMainService.WINDOWS.length; return WindowsMainService.WINDOWS.length;
} }
private onWindowClosed(win: ICodeWindow): void {
// Remove from our list so that Electron can clean it up
const index = WindowsMainService.WINDOWS.indexOf(win);
WindowsMainService.WINDOWS.splice(index, 1);
// Emit
this._onWindowsCountChanged.fire({ oldCount: WindowsMainService.WINDOWS.length + 1, newCount: WindowsMainService.WINDOWS.length });
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册