From 1e193f120e4990d9a3fcc67e08888e700166dc81 Mon Sep 17 00:00:00 2001 From: jonathandunne Date: Sun, 29 Mar 2026 15:16:57 -0400 Subject: [PATCH] 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 000000000..f629eda92 --- /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 61c801ae9..e47e9a1da 100644 --- a/patches/series +++ b/patches/series @@ -20,3 +20,4 @@ getting-started.diff keepalive.diff clipboard.diff display-language.diff +app-name.diff diff --git a/test/unit/node/routes/vscode.test.ts b/test/unit/node/routes/vscode.test.ts index a5a4fb72d..4bfd21e4d 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}\"`) + }) })