Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions patches/app-name.diff
Original file line number Diff line number Diff line change
@@ -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({
1 change: 1 addition & 0 deletions patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ display-language.diff
trusted-domains.diff
signature-verification.diff
copilot.diff
app-name.diff
12 changes: 12 additions & 0 deletions test/unit/node/routes/vscode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}\"`)
})
})