fix: apply --app-name to web page titles

This commit is contained in:
jonathandunne 2026-03-29 15:16:57 -04:00
parent 8084884e17
commit 1e193f120e
3 changed files with 39 additions and 0 deletions

26
patches/app-name.diff Normal file
View file

@ -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({

View file

@ -20,3 +20,4 @@ getting-started.diff
keepalive.diff
clipboard.diff
display-language.diff
app-name.diff

View file

@ -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}\"`)
})
})