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

proxy auth - use urlProtocol as partition

上级 e5c0007c
......@@ -11,6 +11,7 @@ import { IWindowsMainService } from 'vs/platform/windows/electron-main/windows';
import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService';
import { IEncryptionMainService } from 'vs/platform/encryption/electron-main/encryptionMainService';
import { generateUuid } from 'vs/base/common/uuid';
import product from 'vs/platform/product/common/product';
type LoginEvent = {
event: ElectronEvent;
......@@ -26,7 +27,7 @@ type Credentials = {
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 proxyDialogShown = false;
......
......@@ -395,7 +395,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
const emptyToRestore: IEmptyWindowBackupInfo[] = []; // empty windows with backupPath
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) {
if (isFolderPathToOpen(path)) {
if (openConfig.addMode) {
......@@ -504,6 +504,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
recents.push({ label: pathToOpen.label, fileUri: pathToOpen.fileUri });
}
}
this.workspacesHistoryMainService.addRecentlyOpened(recents);
}
......@@ -767,7 +768,6 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
window.focus(); // make sure window has focus
const request: IAddFoldersRequest = { foldersToAdd };
window.sendWhenReady('vscode:addFolders', request);
return window;
......@@ -1098,7 +1098,8 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
return undefined;
}
let lineNumber, columnNumber: number | undefined;
let lineNumber: number | undefined;
let columnNumber: number | undefined;
if (options.gotoLineMode) {
const parsedPath = parseLineAndColumnAware(anyPath);
......@@ -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.
const remoteAuthority = options.remoteAuthority;
if (remoteAuthority) {
const first = anyPath.charCodeAt(0);
......@@ -1119,7 +1119,8 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
if (isWindowsDriveLetter(first) && anyPath.charCodeAt(anyPath.charCodeAt(1)) === CharCode.Colon) {
anyPath = toSlashes(anyPath);
}
anyPath = '/' + anyPath;
anyPath = `/${anyPath}`;
}
const uri = URI.from({ scheme: Schemas.vscodeRemote, authority: remoteAuthority, path: anyPath });
......@@ -1134,13 +1135,13 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
return { fileUri: uri, remoteAuthority };
}
}
return { folderUri: uri, remoteAuthority };
}
let candidate = normalize(anyPath);
try {
const candidateStat = fs.statSync(candidate);
if (candidateStat.isFile()) {
......@@ -1247,6 +1248,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
return [existingWindow];
}
let folderUris = openConfig.cli['folder-uri'] || [];
let fileUris = openConfig.cli['file-uri'] || [];
let cliArgs = openConfig.cli._;
......@@ -1297,23 +1299,26 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
if (!!findWindowOnWorkspaceOrFolderUri(WindowsMainService.WINDOWS, uri)) {
return false;
}
return uri.authority === authority;
});
folderUris = folderUris.filter(uri => {
const u = this.argToUri(uri);
if (!!findWindowOnWorkspaceOrFolderUri(WindowsMainService.WINDOWS, u)) {
folderUris = folderUris.filter(folderUriStr => {
const folderUri = this.argToUri(folderUriStr);
if (!!findWindowOnWorkspaceOrFolderUri(WindowsMainService.WINDOWS, folderUri)) {
return false;
}
return u ? u.authority === authority : false;
return folderUri ? folderUri.authority === authority : false;
});
fileUris = fileUris.filter(uri => {
const u = this.argToUri(uri);
if (!!findWindowOnWorkspaceOrFolderUri(WindowsMainService.WINDOWS, u)) {
fileUris = fileUris.filter(fileUriStr => {
const fileUri = this.argToUri(fileUriStr);
if (!!findWindowOnWorkspaceOrFolderUri(WindowsMainService.WINDOWS, fileUri)) {
return false;
}
return u ? u.authority === authority : false;
return fileUri ? fileUri.authority === authority : false;
});
openConfig.cli._ = cliArgs;
......@@ -1623,6 +1628,16 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
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 {
return getLastActiveWindow(WindowsMainService.WINDOWS);
}
......@@ -1680,14 +1695,4 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
getWindowCount(): number {
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.
先完成此消息的编辑!
想要评论请 注册