From b731f57c731d6f952e7e3b4b80fb7475ffb11635 Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 22 Feb 2022 19:45:57 +0000 Subject: [PATCH 1/2] Restore auth relay patch Fixes https://github.com/coder/code-server/issues/4795. --- extensions/github-authentication/src/githubServer.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extensions/github-authentication/src/githubServer.ts b/extensions/github-authentication/src/githubServer.ts index fe0fbfd9e917e..bc7e864d1141c 100644 --- a/extensions/github-authentication/src/githubServer.ts +++ b/extensions/github-authentication/src/githubServer.ts @@ -15,7 +15,12 @@ import { Log } from './common/logger'; const localize = nls.loadMessageBundle(); const NETWORK_ERROR = 'network error'; -const AUTH_RELAY_SERVER = 'vscode-auth.github.com'; +/** + * Change the auth relay server to our own as Microsoft's does not support + * self-hosted instances. + * @author coder + */ +const AUTH_RELAY_SERVER = 'auth.code-server.dev'; // const AUTH_RELAY_STAGING_SERVER = 'client-auth-staging-14a768b.herokuapp.com'; class UriEventHandler extends vscode.EventEmitter implements vscode.UriHandler { From eec359bbc9de2182631bdda6d3daa5c4b96dafa7 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 23 Feb 2022 23:56:02 +0000 Subject: [PATCH 2/2] Fix callback URIs behind a sub-path --- src/vs/code/browser/workbench/workbench.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts index 289a100e3d492..d3668ead951c7 100644 --- a/src/vs/code/browser/workbench/workbench.ts +++ b/src/vs/code/browser/workbench/workbench.ts @@ -34,6 +34,12 @@ function doCreateUri(path: string, queryValues: Map): URI { }); } + /** + * Preserve the current path so it works with reverse proxies serving behind a + * sub-path. + * @author coder + */ + path = (window.location.pathname + "/" + path).replace(/\/\/+/g, "/") return URI.parse(window.location.href).with({ path, query }); }