mirror of
https://github.com/cdr/code-server.git
synced 2026-04-02 03:23:17 +02:00
fix: apply --app-name to web page titles
This commit is contained in:
parent
8084884e17
commit
1e193f120e
3 changed files with 39 additions and 0 deletions
26
patches/app-name.diff
Normal file
26
patches/app-name.diff
Normal 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({
|
||||
|
|
@ -20,3 +20,4 @@ getting-started.diff
|
|||
keepalive.diff
|
||||
clipboard.diff
|
||||
display-language.diff
|
||||
app-name.diff
|
||||
|
|
|
|||
|
|
@ -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}\"`)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue