Update Code to 1.97.0 (#7199)

* Update Code to 1.97.0
* Update flake
This is to get a newer version of Node since we need > 20.18.1.
* Hijack new base path var
* Update test path matchers
This commit is contained in:
Olivier Benz
2025-02-13 00:34:05 +01:00
committed by GitHub
parent a6fad66e5e
commit d23d1a9541
19 changed files with 135 additions and 150 deletions

12
flake.lock generated
View File

@ -5,11 +5,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1726560853, "lastModified": 1731533236,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -20,11 +20,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1730359060, "lastModified": 1739303263,
"narHash": "sha256-Hkk0mf4pgvX9Ut0YA397nsFqMLhzFVBdFHc4PhBrxYE=", "narHash": "sha256-c/Z/6gZLN8BIpYh1B3qMzEn0TArjf4F2lmy59lDLVBM=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e19cfce6f3f08d07653157d8826f5c920c770d7b", "rev": "6cc4213488e886db863878a1e3dc26cc932d38b8",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -111,21 +111,26 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -271,16 +271,15 @@ export class WebClientServer { @@ -246,7 +246,9 @@ export class WebClientServer {
return void res.end(); };
}
// Prefix routes with basePath for clients
- const basePath = getFirstHeader('x-forwarded-prefix') || this._basePath;
+ const rootBase = relativeRoot(getOriginalUrl(req))
+ const vscodeBase = relativePath(getOriginalUrl(req))
+ const basePath = vscodeBase || getFirstHeader('x-forwarded-prefix') || this._basePath;
const queryConnectionToken = parsedUrl.query[connectionTokenQueryName];
if (typeof queryConnectionToken === 'string') {
@@ -285,10 +287,14 @@ export class WebClientServer {
};
- const getFirstHeader = (headerName: string) => {
- const val = req.headers[headerName];
- return Array.isArray(val) ? val[0] : val;
- };
-
const useTestResolver = (!this._environmentService.isBuilt && this._environmentService.args['use-test-resolver']); const useTestResolver = (!this._environmentService.isBuilt && this._environmentService.args['use-test-resolver']);
+ // For now we are getting the remote authority from the client to avoid + // For now we are getting the remote authority from the client to avoid
+ // needing specific configuration for reverse proxies to work. Set this to + // needing specific configuration for reverse proxies to work. Set this to
+ // something invalid to make sure we catch code that is using this value + // something invalid to make sure we catch code that is using this value
+ // from the backend when it should not. + // from the backend when it should not.
const remoteAuthority = ( let remoteAuthority = (
useTestResolver useTestResolver
? 'test+test' ? 'test+test'
- : (getFirstHeader('x-original-host') || getFirstHeader('x-forwarded-host') || req.headers.host) - : (getFirstHeader('x-original-host') || getFirstHeader('x-forwarded-host') || req.headers.host)
@ -133,43 +138,26 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
); );
if (!remoteAuthority) { if (!remoteAuthority) {
return serveError(req, res, 400, `Bad request.`); return serveError(req, res, 400, `Bad request.`);
@@ -307,8 +306,12 @@ export class WebClientServer { @@ -335,6 +341,7 @@ export class WebClientServer {
scopes: [['user:email'], ['repo']]
} : undefined;
+ const base = relativeRoot(getOriginalUrl(req))
+ const vscodeBase = relativePath(getOriginalUrl(req))
+
const productConfiguration = { const productConfiguration = {
codeServerVersion: this._productService.codeServerVersion, codeServerVersion: this._productService.codeServerVersion,
+ rootEndpoint: base, + rootEndpoint: rootBase,
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? { extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? {
...this._productService.extensionsGallery, ...this._productService.extensionsGallery,
@@ -337,7 +340,7 @@ export class WebClientServer { @@ -382,7 +389,9 @@ export class WebClientServer {
folderUri: resolveWorkspaceURI(this._environmentService.args['default-folder']),
workspaceUri: resolveWorkspaceURI(this._environmentService.args['default-workspace']),
productConfiguration,
- callbackRoute: this._callbackRoute
+ callbackRoute: vscodeBase + this._callbackRoute
};
const cookies = cookie.parse(req.headers.cookie || '');
@@ -354,9 +357,11 @@ export class WebClientServer {
const values: { [key: string]: string } = {
WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration),
WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '', WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '',
- WORKBENCH_WEB_BASE_URL: this._staticRoute, WORKBENCH_WEB_BASE_URL: staticRoute,
+ WORKBENCH_WEB_BASE_URL: vscodeBase + this._staticRoute,
WORKBENCH_NLS_URL, WORKBENCH_NLS_URL,
- WORKBENCH_NLS_FALLBACK_URL: `${this._staticRoute}/out/nls.messages.js` - WORKBENCH_NLS_FALLBACK_URL: `${staticRoute}/out/nls.messages.js`
+ WORKBENCH_NLS_FALLBACK_URL: `${vscodeBase}${this._staticRoute}/out/nls.messages.js`, + WORKBENCH_NLS_FALLBACK_URL: `${staticRoute}/out/nls.messages.js`,
+ BASE: base, + BASE: rootBase,
+ VS_BASE: vscodeBase, + VS_BASE: basePath,
}; };
// DEV --------------------------------------------------------------------------------------- // DEV ---------------------------------------------------------------------------------------
@@ -393,7 +398,7 @@ export class WebClientServer { @@ -419,7 +428,7 @@ export class WebClientServer {
'default-src \'self\';', 'default-src \'self\';',
'img-src \'self\' https: data: blob:;', 'img-src \'self\' https: data: blob:;',
'media-src \'self\';', 'media-src \'self\';',
@ -178,7 +166,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
'child-src \'self\';', 'child-src \'self\';',
`frame-src 'self' https://*.vscode-cdn.net data:;`, `frame-src 'self' https://*.vscode-cdn.net data:;`,
'worker-src \'self\' data: blob:;', 'worker-src \'self\' data: blob:;',
@@ -466,3 +471,70 @@ export class WebClientServer { @@ -492,3 +501,70 @@ export class WebClientServer {
return void res.end(data); return void res.end(data);
} }
} }

View File

@ -26,7 +26,7 @@ Index: code-server/lib/vscode/src/vs/workbench/api/node/extHostCLIServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/api/node/extHostCLIServer.ts --- code-server.orig/lib/vscode/src/vs/workbench/api/node/extHostCLIServer.ts
+++ code-server/lib/vscode/src/vs/workbench/api/node/extHostCLIServer.ts +++ code-server/lib/vscode/src/vs/workbench/api/node/extHostCLIServer.ts
@@ -43,7 +43,12 @@ export interface ExtensionManagementPipe @@ -44,7 +44,12 @@ export interface ExtensionManagementPipe
force?: boolean; force?: boolean;
} }
@ -40,7 +40,7 @@ Index: code-server/lib/vscode/src/vs/workbench/api/node/extHostCLIServer.ts
export interface ICommandsExecuter { export interface ICommandsExecuter {
executeCommand<T>(id: string, ...args: any[]): Promise<T>; executeCommand<T>(id: string, ...args: any[]): Promise<T>;
@@ -105,6 +110,9 @@ export class CLIServerBase { @@ -106,6 +111,9 @@ export class CLIServerBase {
case 'extensionManagement': case 'extensionManagement':
returnObj = await this.manageExtensions(data); returnObj = await this.manageExtensions(data);
break; break;
@ -50,7 +50,7 @@ Index: code-server/lib/vscode/src/vs/workbench/api/node/extHostCLIServer.ts
default: default:
sendResponse(404, `Unknown message type: ${data.type}`); sendResponse(404, `Unknown message type: ${data.type}`);
break; break;
@@ -172,6 +180,10 @@ export class CLIServerBase { @@ -173,6 +181,10 @@ export class CLIServerBase {
return await this._commands.executeCommand<string | undefined>('_remoteCLI.getSystemStatus'); return await this._commands.executeCommand<string | undefined>('_remoteCLI.getSystemStatus');
} }
@ -78,7 +78,7 @@ Index: code-server/lib/vscode/src/vs/platform/environment/common/argv.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/environment/common/argv.ts --- code-server.orig/lib/vscode/src/vs/platform/environment/common/argv.ts
+++ code-server/lib/vscode/src/vs/platform/environment/common/argv.ts +++ code-server/lib/vscode/src/vs/platform/environment/common/argv.ts
@@ -119,6 +119,7 @@ export interface NativeParsedArgs { @@ -121,6 +121,7 @@ export interface NativeParsedArgs {
sandbox?: boolean; sandbox?: boolean;
'enable-coi'?: boolean; 'enable-coi'?: boolean;
@ -90,7 +90,7 @@ Index: code-server/lib/vscode/src/vs/platform/environment/node/argv.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/environment/node/argv.ts --- code-server.orig/lib/vscode/src/vs/platform/environment/node/argv.ts
+++ code-server/lib/vscode/src/vs/platform/environment/node/argv.ts +++ code-server/lib/vscode/src/vs/platform/environment/node/argv.ts
@@ -90,6 +90,7 @@ export const OPTIONS: OptionDescriptions @@ -91,6 +91,7 @@ export const OPTIONS: OptionDescriptions
'user-data-dir': { type: 'string', cat: 'o', args: 'dir', description: localize('userDataDir', "Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.") }, 'user-data-dir': { type: 'string', cat: 'o', args: 'dir', description: localize('userDataDir', "Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.") },
'profile': { type: 'string', 'cat': 'o', args: 'profileName', description: localize('profileName', "Opens the provided folder or workspace with the given profile and associates the profile with the workspace. If the profile does not exist, a new empty one is created.") }, 'profile': { type: 'string', 'cat': 'o', args: 'profileName', description: localize('profileName', "Opens the provided folder or workspace with the given profile and associates the profile with the workspace. If the profile does not exist, a new empty one is created.") },
'help': { type: 'boolean', cat: 'o', alias: 'h', description: localize('help', "Print usage.") }, 'help': { type: 'boolean', cat: 'o', alias: 'h', description: localize('help', "Print usage.") },
@ -102,7 +102,7 @@ Index: code-server/lib/vscode/src/vs/server/node/server.cli.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/server.cli.ts --- code-server.orig/lib/vscode/src/vs/server/node/server.cli.ts
+++ code-server/lib/vscode/src/vs/server/node/server.cli.ts +++ code-server/lib/vscode/src/vs/server/node/server.cli.ts
@@ -76,6 +76,7 @@ const isSupportedForPipe = (optionId: ke @@ -77,6 +77,7 @@ const isSupportedForPipe = (optionId: ke
case 'verbose': case 'verbose':
case 'remote': case 'remote':
case 'locate-shell-integration-path': case 'locate-shell-integration-path':
@ -110,7 +110,7 @@ Index: code-server/lib/vscode/src/vs/server/node/server.cli.ts
return true; return true;
default: default:
return false; return false;
@@ -293,6 +294,22 @@ export async function main(desc: Product @@ -295,6 +296,22 @@ export async function main(desc: Product
} }
} }
} else { } else {
@ -131,5 +131,5 @@ Index: code-server/lib/vscode/src/vs/server/node/server.cli.ts
+ } + }
+ +
if (parsedArgs.status) { if (parsedArgs.status) {
sendToPipe({ await sendToPipe({
type: 'status' type: 'status'

View File

@ -7,7 +7,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts --- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
+++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts +++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
@@ -320,6 +320,10 @@ export class Extension implements IExten @@ -321,6 +321,10 @@ export class Extension implements IExten
if (this.type === ExtensionType.System && this.productService.quality === 'stable') { if (this.type === ExtensionType.System && this.productService.quality === 'stable') {
return false; return false;
} }

View File

@ -161,23 +161,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
import { CharCode } from '../../base/common/charCode.js'; import { CharCode } from '../../base/common/charCode.js';
import { IExtensionManifest } from '../../platform/extensions/common/extensions.js'; import { IExtensionManifest } from '../../platform/extensions/common/extensions.js';
import { ICSSDevelopmentService } from '../../platform/cssDev/node/cssDevService.js'; import { ICSSDevelopmentService } from '../../platform/cssDev/node/cssDevService.js';
@@ -98,6 +99,7 @@ export class WebClientServer { @@ -380,14 +381,22 @@ export class WebClientServer {
private readonly _webExtensionResourceUrlTemplate: URI | undefined;
private readonly _staticRoute: string;
+ private readonly _serverRoot: string;
private readonly _callbackRoute: string;
private readonly _webExtensionRoute: string;
@@ -113,6 +115,7 @@ export class WebClientServer {
) {
this._webExtensionResourceUrlTemplate = this._productService.extensionsGallery?.resourceUrlTemplate ? URI.parse(this._productService.extensionsGallery.resourceUrlTemplate) : undefined;
+ this._serverRoot = serverRootPath;
this._staticRoute = `${serverRootPath}/static`;
this._callbackRoute = `${serverRootPath}/callback`;
this._webExtensionRoute = `/web-extension-resource`;
@@ -351,14 +354,22 @@ export class WebClientServer {
}; };
const cookies = cookie.parse(req.headers.cookie || ''); const cookies = cookie.parse(req.headers.cookie || '');
@ -193,7 +177,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
+ try { + try {
+ const nlsFile = await getBrowserNLSConfiguration(locale, this._environmentService.userDataPath); + const nlsFile = await getBrowserNLSConfiguration(locale, this._environmentService.userDataPath);
+ WORKBENCH_NLS_URL = nlsFile + WORKBENCH_NLS_URL = nlsFile
+ ? `${vscodeBase}${this._serverRoot}/vscode-remote-resource?path=${encodeURIComponent(nlsFile)}` + ? `${vscodeBase}/vscode-remote-resource?path=${encodeURIComponent(nlsFile)}`
+ : ''; + : '';
+ } catch (error) { + } catch (error) {
+ console.error("Failed to generate translations", error); + console.error("Failed to generate translations", error);
@ -214,7 +198,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -105,6 +106,7 @@ export interface ServerParsedArgs { @@ -106,6 +107,7 @@ export interface ServerParsedArgs {
'disable-file-downloads'?: boolean; 'disable-file-downloads'?: boolean;
'disable-file-uploads'?: boolean; 'disable-file-uploads'?: boolean;
'disable-getting-started-override'?: boolean, 'disable-getting-started-override'?: boolean,

View File

@ -99,7 +99,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -99,6 +101,8 @@ export interface ServerParsedArgs { @@ -100,6 +102,8 @@ export interface ServerParsedArgs {
/* ----- code-server ----- */ /* ----- code-server ----- */
'disable-update-check'?: boolean; 'disable-update-check'?: boolean;
'auth'?: string; 'auth'?: string;
@ -112,9 +112,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -335,6 +335,8 @@ export class WebClientServer { @@ -364,6 +364,8 @@ export class WebClientServer {
serverBasePath: this._basePath, serverBasePath: basePath,
webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre', webviewEndpoint: staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
userDataPath: this._environmentService.userDataPath, userDataPath: this._environmentService.userDataPath,
+ isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'], + isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'],
+ isEnabledFileUploads: !this._environmentService.args['disable-file-uploads'], + isEnabledFileUploads: !this._environmentService.args['disable-file-uploads'],
@ -240,10 +240,10 @@ Index: code-server/lib/vscode/src/vs/workbench/services/dialogs/browser/simpleFi
@IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService, @IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService,
@IPathService protected readonly pathService: IPathService, @IPathService protected readonly pathService: IPathService,
@IKeybindingService private readonly keybindingService: IKeybindingService, @IKeybindingService private readonly keybindingService: IKeybindingService,
@@ -283,20 +283,22 @@ export class SimpleFileDialog extends Di @@ -284,20 +284,22 @@ export class SimpleFileDialog extends Di
this.filePickBox.sortByLabel = false;
this.filePickBox.ignoreFocusOut = true; this.filePickBox.ignoreFocusOut = true;
this.filePickBox.ok = true; this.filePickBox.ok = true;
this.filePickBox.okLabel = this.options.openLabel;
- if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) { - if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) {
- this.filePickBox.customButton = true; - this.filePickBox.customButton = true;
- this.filePickBox.customLabel = nls.localize('remoteFileDialog.local', 'Show Local'); - this.filePickBox.customLabel = nls.localize('remoteFileDialog.local', 'Show Local');

View File

@ -28,7 +28,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro
import { IEditorOpenContext, IEditorSerializer } from '../../../common/editor.js'; import { IEditorOpenContext, IEditorSerializer } from '../../../common/editor.js';
import { IWebviewElement, IWebviewService } from '../../webview/browser/webview.js'; import { IWebviewElement, IWebviewService } from '../../webview/browser/webview.js';
import './gettingStartedColors.js'; import './gettingStartedColors.js';
@@ -834,6 +834,72 @@ export class GettingStartedPage extends @@ -869,6 +869,72 @@ export class GettingStartedPage extends
$('p.subtitle.description', {}, localize({ key: 'gettingStarted.editingEvolved', comment: ['Shown as subtitle on the Welcome page.'] }, "Editing evolved")) $('p.subtitle.description', {}, localize({ key: 'gettingStarted.editingEvolved', comment: ['Shown as subtitle on the Welcome page.'] }, "Editing evolved"))
); );
@ -101,7 +101,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro
const leftColumn = $('.categories-column.categories-column-left', {},); const leftColumn = $('.categories-column.categories-column-left', {},);
const rightColumn = $('.categories-column.categories-column-right', {},); const rightColumn = $('.categories-column.categories-column-right', {},);
@@ -869,6 +935,9 @@ export class GettingStartedPage extends @@ -904,6 +970,9 @@ export class GettingStartedPage extends
recentList.setLimit(5); recentList.setLimit(5);
reset(leftColumn, startList.getDomElement(), recentList.getDomElement()); reset(leftColumn, startList.getDomElement(), recentList.getDomElement());
} }
@ -189,7 +189,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -103,6 +104,7 @@ export interface ServerParsedArgs { @@ -104,6 +105,7 @@ export interface ServerParsedArgs {
'auth'?: string; 'auth'?: string;
'disable-file-downloads'?: boolean; 'disable-file-downloads'?: boolean;
'disable-file-uploads'?: boolean; 'disable-file-uploads'?: boolean;
@ -201,7 +201,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -339,6 +339,7 @@ export class WebClientServer { @@ -368,6 +368,7 @@ export class WebClientServer {
userDataPath: this._environmentService.userDataPath, userDataPath: this._environmentService.userDataPath,
isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'], isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'],
isEnabledFileUploads: !this._environmentService.args['disable-file-uploads'], isEnabledFileUploads: !this._environmentService.args['disable-file-uploads'],

View File

@ -113,7 +113,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandl
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts --- code-server.orig/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts +++ code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
@@ -78,8 +78,11 @@ export class BrowserDialogHandler extend @@ -77,8 +77,11 @@ export class BrowserDialogHandler extend
async about(): Promise<void> { async about(): Promise<void> {
const detailString = (useAgo: boolean): string => { const detailString = (useAgo: boolean): string => {
@ -187,10 +187,10 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts
import { IndexedDB } from '../../base/browser/indexedDB.js'; import { IndexedDB } from '../../base/browser/indexedDB.js';
import { WebFileSystemAccess } from '../../platform/files/browser/webFileSystemAccess.js'; import { WebFileSystemAccess } from '../../platform/files/browser/webFileSystemAccess.js';
+import { CodeServerClient } from '../../workbench/browser/client.js'; +import { CodeServerClient } from '../../workbench/browser/client.js';
import { ITelemetryService } from '../../platform/telemetry/common/telemetry.js';
import { IProgressService } from '../../platform/progress/common/progress.js'; import { IProgressService } from '../../platform/progress/common/progress.js';
import { DelayedLogChannel } from '../services/output/common/delayedLogChannel.js'; import { DelayedLogChannel } from '../services/output/common/delayedLogChannel.js';
@@ -131,6 +132,9 @@ export class BrowserMain extends Disposa import { dirname, joinPath } from '../../base/common/resources.js';
@@ -130,6 +131,9 @@ export class BrowserMain extends Disposa
// Startup // Startup
const instantiationService = workbench.startup(); const instantiationService = workbench.startup();
@ -269,7 +269,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -308,6 +308,7 @@ export class WebClientServer { @@ -334,6 +334,7 @@ export class WebClientServer {
} : undefined; } : undefined;
const productConfiguration = { const productConfiguration = {

View File

@ -18,10 +18,10 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -330,6 +330,7 @@ export class WebClientServer { @@ -359,6 +359,7 @@ export class WebClientServer {
remoteAuthority, remoteAuthority,
serverBasePath: this._basePath, serverBasePath: basePath,
webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre', webviewEndpoint: staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
+ userDataPath: this._environmentService.userDataPath, + userDataPath: this._environmentService.userDataPath,
_wrapWebWorkerExtHostInIframe, _wrapWebWorkerExtHostInIframe,
developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() }, developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() },
@ -66,7 +66,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/configuration/browser/co
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/services/configuration/browser/configurationService.ts --- code-server.orig/lib/vscode/src/vs/workbench/services/configuration/browser/configurationService.ts
+++ code-server/lib/vscode/src/vs/workbench/services/configuration/browser/configurationService.ts +++ code-server/lib/vscode/src/vs/workbench/services/configuration/browser/configurationService.ts
@@ -145,8 +145,10 @@ export class WorkspaceService extends Di @@ -147,8 +147,10 @@ export class WorkspaceService extends Di
this.workspaceConfiguration = this._register(new WorkspaceConfiguration(configurationCache, fileService, uriIdentityService, logService)); this.workspaceConfiguration = this._register(new WorkspaceConfiguration(configurationCache, fileService, uriIdentityService, logService));
this._register(this.workspaceConfiguration.onDidUpdateConfiguration(fromCache => { this._register(this.workspaceConfiguration.onDidUpdateConfiguration(fromCache => {
this.onWorkspaceConfigurationChanged(fromCache).then(() => { this.onWorkspaceConfigurationChanged(fromCache).then(() => {
@ -79,7 +79,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/configuration/browser/co
}); });
})); }));
@@ -552,6 +554,12 @@ export class WorkspaceService extends Di @@ -555,6 +557,12 @@ export class WorkspaceService extends Di
previousFolders = this.workspace.folders; previousFolders = this.workspace.folders;
this.workspace.update(workspace); this.workspace.update(workspace);
} else { } else {

View File

@ -28,7 +28,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -97,6 +98,7 @@ export const serverOptions: OptionDescri @@ -98,6 +99,7 @@ export const serverOptions: OptionDescri
export interface ServerParsedArgs { export interface ServerParsedArgs {
/* ----- code-server ----- */ /* ----- code-server ----- */
'disable-update-check'?: boolean; 'disable-update-check'?: boolean;
@ -40,11 +40,11 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -313,6 +313,7 @@ export class WebClientServer { @@ -342,6 +342,7 @@ export class WebClientServer {
codeServerVersion: this._productService.codeServerVersion, codeServerVersion: this._productService.codeServerVersion,
rootEndpoint: base, rootEndpoint: rootBase,
updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined, updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined,
+ logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? base + '/logout' : undefined, + logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined,
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery, extensionsGallery: this._productService.extensionsGallery,
} satisfies Partial<IProductConfiguration>; } satisfies Partial<IProductConfiguration>;

View File

@ -40,25 +40,24 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -115,7 +115,7 @@ export class WebClientServer { @@ -327,7 +327,6 @@ export class WebClientServer {
this._staticRoute = `${serverRootPath}/static`; const staticRoute = posix.join(basePath, this._productPath, STATIC_PATH);
this._callbackRoute = `${serverRootPath}/callback`; const callbackRoute = posix.join(basePath, this._productPath, CALLBACK_PATH);
- this._webExtensionRoute = `${serverRootPath}/web-extension-resource`; - const webExtensionRoute = posix.join(basePath, this._productPath, WEB_EXTENSION_PATH);
+ this._webExtensionRoute = `/web-extension-resource`;
}
/** const resolveWorkspaceURI = (defaultLocation?: string) => defaultLocation && URI.file(path.resolve(defaultLocation)).with({ scheme: Schemas.vscodeRemote, authority: remoteAuthority });
@@ -313,14 +313,7 @@ export class WebClientServer {
@@ -343,14 +342,7 @@ export class WebClientServer {
codeServerVersion: this._productService.codeServerVersion, codeServerVersion: this._productService.codeServerVersion,
rootEndpoint: base, rootEndpoint: rootBase,
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
- extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? { - extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? {
- ...this._productService.extensionsGallery, - ...this._productService.extensionsGallery,
- resourceUrlTemplate: this._webExtensionResourceUrlTemplate.with({ - resourceUrlTemplate: this._webExtensionResourceUrlTemplate.with({
- scheme: 'http', - scheme: 'http',
- authority: remoteAuthority, - authority: remoteAuthority,
- path: `${this._webExtensionRoute}/${this._webExtensionResourceUrlTemplate.authority}${this._webExtensionResourceUrlTemplate.path}` - path: `${webExtensionRoute}/${this._webExtensionResourceUrlTemplate.authority}${this._webExtensionResourceUrlTemplate.path}`
- }).toString(true) - }).toString(true)
- } : undefined - } : undefined
+ extensionsGallery: this._productService.extensionsGallery, + extensionsGallery: this._productService.extensionsGallery,

View File

@ -71,11 +71,11 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -314,6 +314,7 @@ export class WebClientServer { @@ -343,6 +343,7 @@ export class WebClientServer {
rootEndpoint: base, rootEndpoint: rootBase,
updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined, updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined,
logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? base + '/logout' : undefined, logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined,
+ proxyEndpointTemplate: process.env.VSCODE_PROXY_URI ?? base + '/proxy/{{port}}/', + proxyEndpointTemplate: process.env.VSCODE_PROXY_URI ?? rootBase + '/proxy/{{port}}/',
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery, extensionsGallery: this._productService.extensionsGallery,
} satisfies Partial<IProductConfiguration>; } satisfies Partial<IProductConfiguration>;
@ -148,7 +148,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/remote/browser/remoteExpl
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.ts --- code-server.orig/lib/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.ts
+++ code-server/lib/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.ts +++ code-server/lib/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.ts
@@ -77,8 +77,8 @@ export class ForwardedPortsView extends @@ -83,8 +83,8 @@ export class ForwardedPortsView extends
private async enableForwardedPortsFeatures() { private async enableForwardedPortsFeatures() {
this.contextKeyListener.clear(); this.contextKeyListener.clear();

View File

@ -54,13 +54,13 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -315,6 +315,10 @@ export class WebClientServer { @@ -344,6 +344,10 @@ export class WebClientServer {
updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined, updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined,
logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? base + '/logout' : undefined, logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined,
proxyEndpointTemplate: process.env.VSCODE_PROXY_URI ?? base + '/proxy/{{port}}/', proxyEndpointTemplate: process.env.VSCODE_PROXY_URI ?? rootBase + '/proxy/{{port}}/',
+ serviceWorker: { + serviceWorker: {
+ scope: vscodeBase + '/', + scope: vscodeBase + '/',
+ path: base + '/_static/out/browser/serviceWorker.js', + path: rootBase + '/_static/out/browser/serviceWorker.js',
+ }, + },
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery, extensionsGallery: this._productService.extensionsGallery,

View File

@ -10,7 +10,7 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/build/gulpfile.reh.js --- code-server.orig/lib/vscode/build/gulpfile.reh.js
+++ code-server/lib/vscode/build/gulpfile.reh.js +++ code-server/lib/vscode/build/gulpfile.reh.js
@@ -253,8 +253,7 @@ function packageTask(type, platform, arc @@ -256,8 +256,7 @@ function packageTask(type, platform, arc
const src = gulp.src(sourceFolderName + '/**', { base: '.' }) const src = gulp.src(sourceFolderName + '/**', { base: '.' })
.pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + sourceFolderName), 'out'); })) .pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + sourceFolderName), 'out'); }))
@ -20,7 +20,7 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js
const workspaceExtensionPoints = ['debuggers', 'jsonValidation']; const workspaceExtensionPoints = ['debuggers', 'jsonValidation'];
const isUIExtension = (manifest) => { const isUIExtension = (manifest) => {
@@ -293,9 +292,9 @@ function packageTask(type, platform, arc @@ -296,9 +295,9 @@ function packageTask(type, platform, arc
.map(name => `.build/extensions/${name}/**`); .map(name => `.build/extensions/${name}/**`);
const extensions = gulp.src(extensionPaths, { base: '.build', dot: true }); const extensions = gulp.src(extensionPaths, { base: '.build', dot: true });
@ -32,7 +32,7 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js
let version = packageJson.version; let version = packageJson.version;
const quality = product.quality; const quality = product.quality;
@@ -454,7 +453,7 @@ function tweakProductForServerWeb(produc @@ -457,7 +456,7 @@ function tweakProductForServerWeb(produc
const minifyTask = task.define(`minify-vscode-${type}`, task.series( const minifyTask = task.define(`minify-vscode-${type}`, task.series(
bundleTask, bundleTask,
util.rimraf(`out-vscode-${type}-min`), util.rimraf(`out-vscode-${type}-min`),

View File

@ -29,7 +29,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
import { OneDataSystemAppender } from '../../platform/telemetry/node/1dsAppender.js'; import { OneDataSystemAppender } from '../../platform/telemetry/node/1dsAppender.js';
import { LoggerService } from '../../platform/log/node/loggerService.js'; import { LoggerService } from '../../platform/log/node/loggerService.js';
@@ -152,11 +154,23 @@ export async function setupServerService @@ -152,11 +154,23 @@ export async function setupServerService
const requestService = new RequestService(configurationService, environmentService, logService); const requestService = new RequestService('remote', configurationService, environmentService, logService);
services.set(IRequestService, requestService); services.set(IRequestService, requestService);
+ let isContainer = undefined; + let isContainer = undefined;
@ -134,9 +134,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -319,6 +319,8 @@ export class WebClientServer { @@ -348,6 +348,8 @@ export class WebClientServer {
scope: vscodeBase + '/', scope: vscodeBase + '/',
path: base + '/_static/out/browser/serviceWorker.js', path: rootBase + '/_static/out/browser/serviceWorker.js',
}, },
+ enableTelemetry: this._productService.enableTelemetry, + enableTelemetry: this._productService.enableTelemetry,
+ telemetryEndpoint: this._productService.telemetryEndpoint, + telemetryEndpoint: this._productService.telemetryEndpoint,

View File

@ -105,11 +105,11 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -312,6 +312,7 @@ export class WebClientServer { @@ -341,6 +341,7 @@ export class WebClientServer {
const productConfiguration = { const productConfiguration = {
codeServerVersion: this._productService.codeServerVersion, codeServerVersion: this._productService.codeServerVersion,
rootEndpoint: base, rootEndpoint: rootBase,
+ updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined, + updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined,
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery, extensionsGallery: this._productService.extensionsGallery,
} satisfies Partial<IProductConfiguration>; } satisfies Partial<IProductConfiguration>;
@ -126,7 +126,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -93,6 +95,8 @@ export const serverOptions: OptionDescri @@ -94,6 +96,8 @@ export const serverOptions: OptionDescri
}; };
export interface ServerParsedArgs { export interface ServerParsedArgs {

View File

@ -54,11 +54,11 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -326,6 +326,7 @@ export class WebClientServer { @@ -355,6 +355,7 @@ export class WebClientServer {
const workbenchWebConfiguration = { const workbenchWebConfiguration = {
remoteAuthority, remoteAuthority,
serverBasePath: this._basePath, serverBasePath: basePath,
+ webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre', + webviewEndpoint: staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
_wrapWebWorkerExtHostInIframe, _wrapWebWorkerExtHostInIframe,
developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() }, developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() },
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined, settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
@ -113,12 +113,12 @@ Index: code-server/lib/vscode/src/vs/workbench/services/extensions/worker/webWor
<meta http-equiv="Content-Security-Policy" content=" <meta http-equiv="Content-Security-Policy" content="
default-src 'none'; default-src 'none';
child-src 'self' data: blob:; child-src 'self' data: blob:;
- script-src 'self' 'unsafe-eval' 'sha256-xM2KVDKIoeb8vVxk4ezEUsxdTZh5wFnKO3YmFhy9tkk=' https: http://localhost:* blob:; - script-src 'self' 'unsafe-eval' 'sha256-cl8ijlOzEe+0GRCQNJQu2k6nUQ0fAYNYIuuKEm72JDs=' https: http://localhost:* blob:;
+ script-src 'self' 'unsafe-eval' 'sha256-6eZXxikxkENULU0EOkVQSd4hglGixLg3Aow9psZ6u2Y=' https: http://localhost:* blob:; + script-src 'self' 'unsafe-eval' 'sha256-yhZXuB8LS6t73dvNg6rtLX8y4PHLnqRm5+6DdOGkOcw=' https: http://localhost:* blob:;
connect-src 'self' https: wss: http://localhost:* http://127.0.0.1:* ws://localhost:* ws://127.0.0.1:*;"/> connect-src 'self' https: wss: http://localhost:* http://127.0.0.1:* ws://localhost:* ws://127.0.0.1:*;"/>
</head> </head>
<body> <body>
@@ -23,6 +23,13 @@ @@ -25,6 +25,13 @@
// validation not requested // validation not requested
return start(); return start();
} }

View File

@ -1,7 +1,26 @@
import { clean, getMaybeProxiedPathname } from "../utils/helpers" import { clean, getMaybeProxiedPathname } from "../utils/helpers"
import { describe, test, expect } from "./baseFixture" import { describe, test, expect } from "./baseFixture"
const routes = ["/", "/vscode", "/vscode/"] const routes = {
"/": [
/\.\/manifest.json/,
/\.\/_static\//,
/[a-z]+-[0-9a-z]+\/static\//,
/http:\/\/localhost:[0-9]+\/[a-z]+-[0-9a-z]+\/static\//,
],
"/vscode": [
/\.\/vscode\/manifest.json/,
/\.\/_static\//,
/vscode\/[a-z]+-[0-9a-z]+\/static\//,
/http:\/\/localhost:[0-9]+\/vscode\/[a-z]+-[0-9a-z]+\/static\//,
],
"/vscode/": [
/\.\/manifest.json/,
/\.\/\.\.\/_static\//,
/[a-z]+-[0-9a-z]+\/static\//,
/http:\/\/localhost:[0-9]+\/vscode\/[a-z]+-[0-9a-z]+\/static\//,
],
}
describe("VS Code Routes", ["--disable-workspace-trust"], {}, async () => { describe("VS Code Routes", ["--disable-workspace-trust"], {}, async () => {
const testName = "vscode-routes-default" const testName = "vscode-routes-default"
@ -10,7 +29,7 @@ describe("VS Code Routes", ["--disable-workspace-trust"], {}, async () => {
}) })
test("should load all route variations", async ({ codeServerPage }) => { test("should load all route variations", async ({ codeServerPage }) => {
for (const route of routes) { for (const [route, matchers] of Object.entries(routes)) {
await codeServerPage.navigate(route) await codeServerPage.navigate(route)
// Check there were no redirections // Check there were no redirections
@ -18,21 +37,16 @@ describe("VS Code Routes", ["--disable-workspace-trust"], {}, async () => {
const pathname = getMaybeProxiedPathname(url) const pathname = getMaybeProxiedPathname(url)
expect(pathname).toBe(route) expect(pathname).toBe(route)
// TODO@jsjoeio // Check that assets are pointing to the right spot. Some will be
// now that we are in a proper browser instead of scraping the HTML we // relative, without a leading dot (VS Code's assets). Some will be
// could possibly intercept requests to make sure assets are loading from // relative with a leading dot (our assets). Others will have been
// the right spot. // resolved against the origin.
// const elements = await codeServerPage.page.locator("[src]").all()
// Check that page loaded from correct route for (const element of elements) {
const html = await codeServerPage.page.innerHTML("html") const src = await element.getAttribute("src")
switch (route) { if (src && !matchers.some((m) => m.test(src))) {
case "/": throw new Error(`${src} did not match any validators for route ${route}`)
case "/vscode/": }
expect(html).toMatch(/src="\.\/[a-z]+-[0-9a-z]+\/static\//)
break
case "/vscode":
expect(html).toMatch(/src="\.\/vscode\/[a-z]+-[0-9a-z]+\/static\//)
break
} }
} }
}) })
@ -85,7 +99,7 @@ describe("VS Code Routes with no workspace or folder", ["--disable-workspace-tru
// If you visit again without query parameters it will re-attach them by // If you visit again without query parameters it will re-attach them by
// redirecting. It should always redirect to the same route. // redirecting. It should always redirect to the same route.
for (const route of routes) { for (const route of Object.keys(routes)) {
await codeServerPage.navigate(route) await codeServerPage.navigate(route)
const url = new URL(codeServerPage.page.url()) const url = new URL(codeServerPage.page.url())
const pathname = getMaybeProxiedPathname(url) const pathname = getMaybeProxiedPathname(url)