From 2103b644fe156c03a0504d6838ba12cf984928f2 Mon Sep 17 00:00:00 2001 From: jonathandunne Date: Sun, 29 Mar 2026 15:16:57 -0400 Subject: [PATCH 1/5] fix: apply --app-name to web page titles --- patches/app-name.diff | 26 ++++++++++++++++++++++++++ patches/series | 1 + test/unit/node/routes/vscode.test.ts | 12 ++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 patches/app-name.diff diff --git a/patches/app-name.diff b/patches/app-name.diff new file mode 100644 index 000000000000..f629eda9274a --- /dev/null +++ b/patches/app-name.diff @@ -0,0 +1,26 @@ +Apply --app-name to VS Code web page titles + +VS Code's `${appName}` title variable comes from `productService.nameLong` in the +web client. code-server already injects per-request product configuration into +VS Code's web bootstrap, so set `nameShort`/`nameLong` from the existing +`--app-name` CLI arg there. + +This keeps the patch minimal and makes browser tab titles honor `--app-name` +without changing unrelated product metadata. + +Index: code-server/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 +@@ -333,8 +333,11 @@ export class WebClientServer { + scopes: [['user:email'], ['repo']] + } : undefined; + ++ const appName = this._environmentService.args['app-name']; + const productConfiguration = { + embedderIdentifier: 'server-distro', ++ nameShort: appName, ++ nameLong: appName, + extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? { + ...this._productService.extensionsGallery, + resourceUrlTemplate: this._webExtensionResourceUrlTemplate.with({ diff --git a/patches/series b/patches/series index 3935786a69b6..6f438da313bf 100644 --- a/patches/series +++ b/patches/series @@ -23,3 +23,4 @@ display-language.diff trusted-domains.diff signature-verification.diff copilot.diff +app-name.diff diff --git a/test/unit/node/routes/vscode.test.ts b/test/unit/node/routes/vscode.test.ts index a5a4fb72da7a..4bfd21e4dcd2 100644 --- a/test/unit/node/routes/vscode.test.ts +++ b/test/unit/node/routes/vscode.test.ts @@ -27,4 +27,16 @@ describe("vscode", () => { }) }).rejects.toThrow() }) + + it("should apply app-name to the VS Code product configuration", async () => { + const appName = "testnäme" + codeServer = await integration.setup(["--auth=none", `--app-name=${appName}`], "") + + const resp = await codeServer.fetch("/vscode") + const htmlContent = await resp.text() + + expect(resp.status).toBe(200) + expect(htmlContent).toContain(`\"nameShort\":\"${appName}\"`) + expect(htmlContent).toContain(`\"nameLong\":\"${appName}\"`) + }) }) From 976cf119091fe836987982f7aa92a002201dd939 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 20 May 2026 14:40:45 -0800 Subject: [PATCH 2/5] Make the linter happy --- test/unit/node/routes/vscode.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/node/routes/vscode.test.ts b/test/unit/node/routes/vscode.test.ts index 4bfd21e4dcd2..5ae1827f630a 100644 --- a/test/unit/node/routes/vscode.test.ts +++ b/test/unit/node/routes/vscode.test.ts @@ -36,7 +36,7 @@ describe("vscode", () => { const htmlContent = await resp.text() expect(resp.status).toBe(200) - expect(htmlContent).toContain(`\"nameShort\":\"${appName}\"`) - expect(htmlContent).toContain(`\"nameLong\":\"${appName}\"`) + expect(htmlContent).toContain(`"nameShort":"${appName}"`) + expect(htmlContent).toContain(`"nameLong":"${appName}"`) }) }) From e898621bd91bea4da138f145bca9e884444f18a0 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 20 May 2026 14:45:01 -0800 Subject: [PATCH 3/5] Refresh patch on latest VS Code --- patches/app-name.diff | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/patches/app-name.diff b/patches/app-name.diff index f629eda9274a..6cd03af15e2b 100644 --- a/patches/app-name.diff +++ b/patches/app-name.diff @@ -12,15 +12,15 @@ Index: code-server/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 -@@ -333,8 +333,11 @@ export class WebClientServer { - scopes: [['user:email'], ['repo']] - } : undefined; +@@ -366,8 +366,11 @@ export class WebClientServer { + linkProtectionTrustedDomains.push(...this._productService.linkProtectionTrustedDomains); + } + const appName = this._environmentService.args['app-name']; - const productConfiguration = { - embedderIdentifier: 'server-distro', + const productConfiguration: Partial> = { + codeServerVersion: this._productService.codeServerVersion, + nameShort: appName, + nameLong: appName, - extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? { - ...this._productService.extensionsGallery, - resourceUrlTemplate: this._webExtensionResourceUrlTemplate.with({ + rootEndpoint: rootBase, + updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined, + logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined, From 5b93f3fb1c057b23dff5ae28ff54473c77368dd1 Mon Sep 17 00:00:00 2001 From: Micah Zoltu Date: Thu, 21 May 2026 07:20:41 +0000 Subject: [PATCH 4/5] Add app-name to serevr options/args. --- patches/app-name.diff | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/patches/app-name.diff b/patches/app-name.diff index 6cd03af15e2b..5675d1646098 100644 --- a/patches/app-name.diff +++ b/patches/app-name.diff @@ -8,6 +8,26 @@ VS Code's web bootstrap, so set `nameShort`/`nameLong` from the existing This keeps the patch minimal and makes browser tab titles honor `--app-name` without changing unrelated product metadata. +Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts +=================================================================== +--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts ++++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts +@@ -24,6 +24,7 @@ export const serverOptions: OptionDescri + 'disable-getting-started-override': { type: 'boolean' }, + 'locale': { type: 'string' }, + 'link-protection-trusted-domains': { type: 'string[]' }, ++ 'app-name': { type: 'string' }, + + /* ----- server setup ----- */ + +@@ -120,6 +121,7 @@ export interface ServerParsedArgs { + 'disable-getting-started-override'?: boolean, + 'locale'?: string + 'link-protection-trusted-domains'?: string[], ++ 'app-name'?: string, + + /* ----- server setup ----- */ + Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts From be87801626c8640810ff4211c55a418212f879dc Mon Sep 17 00:00:00 2001 From: Asher Date: Thu, 21 May 2026 11:49:31 -0800 Subject: [PATCH 5/5] Move test to e2e Unfortunately currently the unit test job does not build VS Code so it ends up with a 500 in CI. Might change that in the future but for now move it to an e2e test. --- test/e2e/appName.test.ts | 9 +++++++++ test/unit/node/routes/vscode.test.ts | 12 ------------ 2 files changed, 9 insertions(+), 12 deletions(-) create mode 100644 test/e2e/appName.test.ts diff --git a/test/e2e/appName.test.ts b/test/e2e/appName.test.ts new file mode 100644 index 000000000000..a12795cb0b33 --- /dev/null +++ b/test/e2e/appName.test.ts @@ -0,0 +1,9 @@ +import { version } from "../../src/node/constants" +import { describe, test, expect } from "./baseFixture" + +const appName = "testnäme" +describe("--app-name", [`--app-name=${appName}`], {}, () => { + test("should use app-name for the title", async ({ codeServerPage }) => { + expect(await codeServerPage.page.title()).toContain(appName) + }) +}) diff --git a/test/unit/node/routes/vscode.test.ts b/test/unit/node/routes/vscode.test.ts index 5ae1827f630a..a5a4fb72da7a 100644 --- a/test/unit/node/routes/vscode.test.ts +++ b/test/unit/node/routes/vscode.test.ts @@ -27,16 +27,4 @@ describe("vscode", () => { }) }).rejects.toThrow() }) - - it("should apply app-name to the VS Code product configuration", async () => { - const appName = "testnäme" - codeServer = await integration.setup(["--auth=none", `--app-name=${appName}`], "") - - const resp = await codeServer.fetch("/vscode") - const htmlContent = await resp.text() - - expect(resp.status).toBe(200) - expect(htmlContent).toContain(`"nameShort":"${appName}"`) - expect(htmlContent).toContain(`"nameLong":"${appName}"`) - }) })