File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Apply --app-name to VS Code web page titles
2+
3+ VS Code's `${appName}` title variable comes from `productService.nameLong` in the
4+ web client. code-server already injects per-request product configuration into
5+ VS Code's web bootstrap, so set `nameShort`/`nameLong` from the existing
6+ `--app-name` CLI arg there.
7+
8+ This keeps the patch minimal and makes browser tab titles honor `--app-name`
9+ without changing unrelated product metadata.
10+
11+ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
12+ ===================================================================
13+ --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
14+ +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
15+ @@ -333,8 +333,11 @@ export class WebClientServer {
16+ scopes: [['user:email'], ['repo']]
17+ } : undefined;
18+
19+ + const appName = this._environmentService.args['app-name'];
20+ const productConfiguration = {
21+ embedderIdentifier: 'server-distro',
22+ + nameShort: appName,
23+ + nameLong: appName,
24+ extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? {
25+ ...this._productService.extensionsGallery,
26+ resourceUrlTemplate: this._webExtensionResourceUrlTemplate.with({
Original file line number Diff line number Diff line change @@ -23,3 +23,4 @@ display-language.diff
2323trusted-domains.diff
2424signature-verification.diff
2525copilot.diff
26+ app-name.diff
Original file line number Diff line number Diff line change @@ -27,4 +27,16 @@ describe("vscode", () => {
2727 } )
2828 } ) . rejects . toThrow ( )
2929 } )
30+
31+ it ( "should apply app-name to the VS Code product configuration" , async ( ) => {
32+ const appName = "testnäme"
33+ codeServer = await integration . setup ( [ "--auth=none" , `--app-name=${ appName } ` ] , "" )
34+
35+ const resp = await codeServer . fetch ( "/vscode" )
36+ const htmlContent = await resp . text ( )
37+
38+ expect ( resp . status ) . toBe ( 200 )
39+ expect ( htmlContent ) . toContain ( `\"nameShort\":\"${ appName } \"` )
40+ expect ( htmlContent ) . toContain ( `\"nameLong\":\"${ appName } \"` )
41+ } )
3042} )
You can’t perform that action at this time.
0 commit comments