Skip to content

Commit 238769e

Browse files
authored
Apply --app-name to web page titles (#7794)
1 parent bf61384 commit 238769e

3 files changed

Lines changed: 56 additions & 0 deletions

File tree

patches/app-name.diff

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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/serverEnvironmentService.ts
12+
===================================================================
13+
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
14+
+++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
15+
@@ -24,6 +24,7 @@ export const serverOptions: OptionDescri
16+
'disable-getting-started-override': { type: 'boolean' },
17+
'locale': { type: 'string' },
18+
'link-protection-trusted-domains': { type: 'string[]' },
19+
+ 'app-name': { type: 'string' },
20+
21+
/* ----- server setup ----- */
22+
23+
@@ -120,6 +121,7 @@ export interface ServerParsedArgs {
24+
'disable-getting-started-override'?: boolean,
25+
'locale'?: string
26+
'link-protection-trusted-domains'?: string[],
27+
+ 'app-name'?: string,
28+
29+
/* ----- server setup ----- */
30+
31+
Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
32+
===================================================================
33+
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
34+
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
35+
@@ -366,8 +366,11 @@ export class WebClientServer {
36+
linkProtectionTrustedDomains.push(...this._productService.linkProtectionTrustedDomains);
37+
}
38+
39+
+ const appName = this._environmentService.args['app-name'];
40+
const productConfiguration: Partial<Mutable<IProductConfiguration>> = {
41+
codeServerVersion: this._productService.codeServerVersion,
42+
+ nameShort: appName,
43+
+ nameLong: appName,
44+
rootEndpoint: rootBase,
45+
updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined,
46+
logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined,

patches/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ display-language.diff
2323
trusted-domains.diff
2424
signature-verification.diff
2525
copilot.diff
26+
app-name.diff

test/e2e/appName.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { version } from "../../src/node/constants"
2+
import { describe, test, expect } from "./baseFixture"
3+
4+
const appName = "testnäme"
5+
describe("--app-name", [`--app-name=${appName}`], {}, () => {
6+
test("should use app-name for the title", async ({ codeServerPage }) => {
7+
expect(await codeServerPage.page.title()).toContain(appName)
8+
})
9+
})

0 commit comments

Comments
 (0)