Skip to content

Commit 5bc26e9

Browse files
authored
fix: version in about dialog (#5057)
* Fix code-server version not appearing in other languages It needs to be separate from the localize call since the language version of that string is used and it will not include a spot for the code-server version. I also moved the "v" so we do not get "vUnknown". * Add code-server version to product configuration Before 1.64 the entire product configuration was sent to the client but that was removed so we have to add anything we want to use on the client, like the code-server version (used in the about dialog). Fixes #5027. * Refresh patches * Change version test to look for specific version This will catch if we are not sending the actual version to the client.
1 parent d796cc2 commit 5bc26e9

9 files changed

+37
-16
lines changed

Diff for: patches/base-path.diff

+3-3
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
185185
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
186186
productConfiguration: <Partial<IProductConfiguration>>{
187187
+ rootEndpoint: base,
188+
codeServerVersion: this._productService.codeServerVersion,
188189
embedderIdentifier: 'server-distro',
189190
extensionsGallery: this._webExtensionResourceUrlTemplate ? {
190-
...this._productService.extensionsGallery,
191-
@@ -290,7 +296,9 @@ export class WebClientServer {
191+
@@ -291,7 +297,9 @@ export class WebClientServer {
192192
} : undefined
193193
}
194194
})))
@@ -199,7 +199,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
199199

200200
const cspDirectives = [
201201
'default-src \'self\';',
202-
@@ -369,3 +377,70 @@ export class WebClientServer {
202+
@@ -370,3 +378,70 @@ export class WebClientServer {
203203
return res.end(data);
204204
}
205205
}

Diff for: patches/display-language.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
185185
const data = (await util.promisify(fs.readFile)(filePath)).toString()
186186
.replace('{{WORKBENCH_WEB_CONFIGURATION}}', escapeAttribute(JSON.stringify({
187187
remoteAuthority,
188-
@@ -302,7 +305,8 @@ export class WebClientServer {
188+
@@ -303,7 +306,8 @@ export class WebClientServer {
189189
})))
190190
.replace('{{WORKBENCH_AUTH_SESSION}}', () => authSessionInfo ? escapeAttribute(JSON.stringify(authSessionInfo)) : '')
191191
.replace(/{{BASE}}/g, base)

Diff for: patches/integration.diff

+20-4
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,22 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandl
104104
===================================================================
105105
--- code-server.orig/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
106106
+++ code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
107-
@@ -144,11 +144,12 @@ export class BrowserDialogHandler implem
107+
@@ -143,12 +143,15 @@ export class BrowserDialogHandler implem
108+
108109
async about(): Promise<void> {
109110
const detailString = (useAgo: boolean): string => {
110-
return localize('aboutDetail',
111+
- return localize('aboutDetail',
111112
- "Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
112-
+ "code-server: v{4}\nCode: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
113+
+ return localize('aboutCodeServerDetail',
114+
+ "code-server: {0}",
115+
+ this.productService.codeServerVersion ? `v${this.productService.codeServerVersion}` : 'Unknown'
116+
+ ) + '\n' + localize('aboutDetail',
117+
+ "Code: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
113118
this.productService.version || 'Unknown',
114119
this.productService.commit || 'Unknown',
115120
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown',
116121
- navigator.userAgent
117122
+ navigator.userAgent,
118-
+ this.productService.codeServerVersion || 'Unknown'
119123
);
120124
};
121125

@@ -253,3 +257,15 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.html
253257
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
254258
<link data-name="vs/workbench/workbench.web.main" rel="stylesheet" href="./static/out/vs/workbench/workbench.web.main.css">
255259

260+
Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
261+
===================================================================
262+
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
263+
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
264+
@@ -279,6 +279,7 @@ export class WebClientServer {
265+
developmentOptions: { enableSmokeTestDriver: this._environmentService.driverHandle === 'web' ? true : undefined },
266+
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
267+
productConfiguration: <Partial<IProductConfiguration>>{
268+
+ codeServerVersion: this._productService.codeServerVersion,
269+
embedderIdentifier: 'server-distro',
270+
extensionsGallery: this._webExtensionResourceUrlTemplate ? {
271+
...this._productService.extensionsGallery,

Diff for: patches/logout.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
4545
rootEndpoint: base,
4646
updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
4747
+ logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined,
48+
codeServerVersion: this._productService.codeServerVersion,
4849
embedderIdentifier: 'server-distro',
4950
extensionsGallery: {
50-
...this._productService.extensionsGallery,
5151
Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
5252
===================================================================
5353
--- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts

Diff for: patches/marketplace.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
3232
===================================================================
3333
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
3434
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
35-
@@ -286,14 +286,14 @@ export class WebClientServer {
36-
productConfiguration: <Partial<IProductConfiguration>>{
35+
@@ -287,14 +287,14 @@ export class WebClientServer {
3736
rootEndpoint: base,
37+
codeServerVersion: this._productService.codeServerVersion,
3838
embedderIdentifier: 'server-distro',
3939
- extensionsGallery: this._webExtensionResourceUrlTemplate ? {
4040
+ extensionsGallery: {

Diff for: patches/proxy-uri.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
7373
updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
7474
logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined,
7575
+ proxyEndpointTemplate: base + '/proxy/{{port}}',
76+
codeServerVersion: this._productService.codeServerVersion,
7677
embedderIdentifier: 'server-distro',
7778
extensionsGallery: {
78-
...this._productService.extensionsGallery,
7979
Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts
8080
===================================================================
8181
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.main.ts

Diff for: patches/service-worker.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
2121
===================================================================
2222
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
2323
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
24-
@@ -297,6 +297,10 @@ export class WebClientServer {
25-
logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined,
24+
@@ -298,6 +298,10 @@ export class WebClientServer {
2625
proxyEndpointTemplate: base + '/proxy/{{port}}',
26+
codeServerVersion: this._productService.codeServerVersion,
2727
embedderIdentifier: 'server-distro',
2828
+ serviceWorker: {
2929
+ scope: vscodeBase + '/',

Diff for: patches/update-check.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
105105
productConfiguration: <Partial<IProductConfiguration>>{
106106
rootEndpoint: base,
107107
+ updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
108+
codeServerVersion: this._productService.codeServerVersion,
108109
embedderIdentifier: 'server-distro',
109110
extensionsGallery: {
110-
...this._productService.extensionsGallery,
111111
Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
112112
===================================================================
113113
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts

Diff for: test/e2e/openHelpAbout.test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1+
import { version } from "../../src/node/constants"
12
import { describe, test, expect } from "./baseFixture"
23

34
describe("Open Help > About", true, [], {}, () => {
45
test("should see code-server version in about dialog", async ({ codeServerPage }) => {
56
// Open using the menu.
67
await codeServerPage.navigateMenus(["Help", "About"])
78

9+
const isDevMode = process.env.VSCODE_DEV === "1"
10+
811
// Look for code-server info div.
9-
const element = await codeServerPage.page.waitForSelector('div[role="dialog"] >> text=code-server')
12+
const element = await codeServerPage.page.waitForSelector(
13+
`div[role="dialog"] >> text=code-server: ${isDevMode ? "Unknown" : "v" + version}`,
14+
)
1015
expect(element).not.toBeNull()
1116
})
1217
})

0 commit comments

Comments
 (0)