Skip to content

fix: version in about dialog #5057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 31, 2022
Merged
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
6 changes: 3 additions & 3 deletions patches/base-path.diff
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
productConfiguration: <Partial<IProductConfiguration>>{
+ rootEndpoint: base,
codeServerVersion: this._productService.codeServerVersion,
embedderIdentifier: 'server-distro',
extensionsGallery: this._webExtensionResourceUrlTemplate ? {
...this._productService.extensionsGallery,
@@ -290,7 +296,9 @@ export class WebClientServer {
@@ -291,7 +297,9 @@ export class WebClientServer {
} : undefined
}
})))
Expand All @@ -199,7 +199,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts

const cspDirectives = [
'default-src \'self\';',
@@ -369,3 +377,70 @@ export class WebClientServer {
@@ -370,3 +378,70 @@ export class WebClientServer {
return res.end(data);
}
}
Expand Down
2 changes: 1 addition & 1 deletion patches/display-language.diff
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
const data = (await util.promisify(fs.readFile)(filePath)).toString()
.replace('{{WORKBENCH_WEB_CONFIGURATION}}', escapeAttribute(JSON.stringify({
remoteAuthority,
@@ -302,7 +305,8 @@ export class WebClientServer {
@@ -303,7 +306,8 @@ export class WebClientServer {
})))
.replace('{{WORKBENCH_AUTH_SESSION}}', () => authSessionInfo ? escapeAttribute(JSON.stringify(authSessionInfo)) : '')
.replace(/{{BASE}}/g, base)
Expand Down
24 changes: 20 additions & 4 deletions patches/integration.diff
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,22 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandl
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
@@ -144,11 +144,12 @@ export class BrowserDialogHandler implem
@@ -143,12 +143,15 @@ export class BrowserDialogHandler implem

async about(): Promise<void> {
const detailString = (useAgo: boolean): string => {
return localize('aboutDetail',
- return localize('aboutDetail',
- "Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
+ "code-server: v{4}\nCode: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
+ return localize('aboutCodeServerDetail',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked into how localize works but I assume if it doesn't find something for aboutCodeServerDetail then it returns the string unlocalized aka this should just work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. Really we could just leave out the localize call here since no one will be localizing it and it does not have anything that needs localizing anyway but...just in case I guess.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I like that you opted for it since it matches the patterns used by the surrounding code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking exactly!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

+ "code-server: {0}",
+ this.productService.codeServerVersion ? `v${this.productService.codeServerVersion}` : 'Unknown'
+ ) + '\n' + localize('aboutDetail',
+ "Code: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
this.productService.version || 'Unknown',
this.productService.commit || 'Unknown',
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown',
- navigator.userAgent
+ navigator.userAgent,
+ this.productService.codeServerVersion || 'Unknown'
);
};

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

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
@@ -279,6 +279,7 @@ export class WebClientServer {
developmentOptions: { enableSmokeTestDriver: this._environmentService.driverHandle === 'web' ? true : undefined },
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
productConfiguration: <Partial<IProductConfiguration>>{
+ codeServerVersion: this._productService.codeServerVersion,
embedderIdentifier: 'server-distro',
extensionsGallery: this._webExtensionResourceUrlTemplate ? {
...this._productService.extensionsGallery,
2 changes: 1 addition & 1 deletion patches/logout.diff
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
rootEndpoint: base,
updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
+ logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined,
codeServerVersion: this._productService.codeServerVersion,
embedderIdentifier: 'server-distro',
extensionsGallery: {
...this._productService.extensionsGallery,
Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts
Expand Down
4 changes: 2 additions & 2 deletions patches/marketplace.diff
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ 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
@@ -286,14 +286,14 @@ export class WebClientServer {
productConfiguration: <Partial<IProductConfiguration>>{
@@ -287,14 +287,14 @@ export class WebClientServer {
rootEndpoint: base,
codeServerVersion: this._productService.codeServerVersion,
embedderIdentifier: 'server-distro',
- extensionsGallery: this._webExtensionResourceUrlTemplate ? {
+ extensionsGallery: {
Expand Down
2 changes: 1 addition & 1 deletion patches/proxy-uri.diff
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined,
+ proxyEndpointTemplate: base + '/proxy/{{port}}',
codeServerVersion: this._productService.codeServerVersion,
embedderIdentifier: 'server-distro',
extensionsGallery: {
...this._productService.extensionsGallery,
Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.main.ts
Expand Down
4 changes: 2 additions & 2 deletions patches/service-worker.diff
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ 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
@@ -297,6 +297,10 @@ export class WebClientServer {
logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined,
@@ -298,6 +298,10 @@ export class WebClientServer {
proxyEndpointTemplate: base + '/proxy/{{port}}',
codeServerVersion: this._productService.codeServerVersion,
embedderIdentifier: 'server-distro',
+ serviceWorker: {
+ scope: vscodeBase + '/',
Expand Down
2 changes: 1 addition & 1 deletion patches/update-check.diff
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
productConfiguration: <Partial<IProductConfiguration>>{
rootEndpoint: base,
+ updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
codeServerVersion: this._productService.codeServerVersion,
embedderIdentifier: 'server-distro',
extensionsGallery: {
...this._productService.extensionsGallery,
Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
Expand Down
7 changes: 6 additions & 1 deletion test/e2e/openHelpAbout.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { version } from "../../src/node/constants"
import { describe, test, expect } from "./baseFixture"

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

const isDevMode = process.env.VSCODE_DEV === "1"

// Look for code-server info div.
const element = await codeServerPage.page.waitForSelector('div[role="dialog"] >> text=code-server')
const element = await codeServerPage.page.waitForSelector(
`div[role="dialog"] >> text=code-server: ${isDevMode ? "Unknown" : "v" + version}`,
Comment on lines +9 to +13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement!

)
expect(element).not.toBeNull()
})
})