Apply --app-name to web page titles (#7794)

This commit is contained in:
Micah Zoltu
2026-05-22 04:22:29 +08:00
committed by GitHub
parent bf61384523
commit 238769e535
3 changed files with 56 additions and 0 deletions

46
patches/app-name.diff Normal file
View File

@@ -0,0 +1,46 @@
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/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
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -366,8 +366,11 @@ export class WebClientServer {
linkProtectionTrustedDomains.push(...this._productService.linkProtectionTrustedDomains);
}
+ const appName = this._environmentService.args['app-name'];
const productConfiguration: Partial<Mutable<IProductConfiguration>> = {
codeServerVersion: this._productService.codeServerVersion,
+ nameShort: appName,
+ nameLong: appName,
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,

View File

@@ -23,3 +23,4 @@ display-language.diff
trusted-domains.diff
signature-verification.diff
copilot.diff
app-name.diff

9
test/e2e/appName.test.ts Normal file
View File

@@ -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)
})
})