Skip to content

Commit 3e93b11

Browse files
committed
Add code-server version into VS Code about
Closes #1506
1 parent d723402 commit 3e93b11

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed

ci/build/npm-postinstall.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
set -eu
33

44
main() {
5-
cd lib/vscode
6-
75
case "${npm_config_user_agent-}" in npm*)
86
# We are running under npm.
97
if [ "${npm_config_unsafe_perm-}" != "true" ]; then
@@ -16,6 +14,8 @@ main() {
1614
;;
1715
esac
1816

17+
cd lib/vscode
18+
1919
# We have to rename node_modules.bundled to node_modules.
2020
# The bundled modules were renamed originally to avoid being ignored by yarn.
2121
node_modules="$(find . -depth -name "node_modules.bundled")"

ci/dev/vscode.patch

+35-2
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,19 @@ index 87a3b99c70..09e2c93172 100644
653653
}
654654

655655
// Node: AMD loader
656+
diff --git a/src/vs/platform/product/common/productService.ts b/src/vs/platform/product/common/productService.ts
657+
index 266aa69fc6..243baa407b 100644
658+
--- a/src/vs/platform/product/common/productService.ts
659+
+++ b/src/vs/platform/product/common/productService.ts
660+
@@ -25,6 +25,8 @@ export interface IBuiltInExtension {
661+
export type ConfigurationSyncStore = { url: string, authenticationProviders: IStringDictionary<{ scopes: string[] }> };
662+
663+
export interface IProductConfiguration {
664+
+ readonly codeServerVersion: string;
665+
+
666+
readonly version: string;
667+
readonly date?: string;
668+
readonly quality?: string;
656669
diff --git a/src/vs/platform/remote/browser/browserSocketFactory.ts b/src/vs/platform/remote/browser/browserSocketFactory.ts
657670
index d0f6e6b18a..1966fd297d 100644
658671
--- a/src/vs/platform/remote/browser/browserSocketFactory.ts
@@ -1328,10 +1341,10 @@ index 0000000000..56331ff1fc
13281341
+require('../../bootstrap-amd').load('vs/server/entry');
13291342
diff --git a/src/vs/server/ipc.d.ts b/src/vs/server/ipc.d.ts
13301343
new file mode 100644
1331-
index 0000000000..d4771351de
1344+
index 0000000000..0a9c95d50e
13321345
--- /dev/null
13331346
+++ b/src/vs/server/ipc.d.ts
1334-
@@ -0,0 +1,116 @@
1347+
@@ -0,0 +1,117 @@
13351348
+/**
13361349
+ * External interfaces for integration into code-server over IPC. No vs imports
13371350
+ * should be made in this file.
@@ -1434,6 +1447,7 @@ index 0000000000..d4771351de
14341447
+ };
14351448
+ readonly remoteUserDataUri: UriComponents;
14361449
+ readonly productConfiguration: {
1450+
+ codeServerVersion?: string;
14371451
+ readonly extensionsGallery?: {
14381452
+ readonly serviceUrl: string;
14391453
+ readonly itemUrl: string;
@@ -3185,6 +3199,25 @@ index f2ca5011dd..4683e80a68 100644
31853199
} catch (e) {
31863200
console.error('Could not rewrite csp');
31873201
}
3202+
diff --git a/src/vs/workbench/services/dialogs/browser/dialogService.ts b/src/vs/workbench/services/dialogs/browser/dialogService.ts
3203+
index 6b42535bff..88b7e3c3ea 100644
3204+
--- a/src/vs/workbench/services/dialogs/browser/dialogService.ts
3205+
+++ b/src/vs/workbench/services/dialogs/browser/dialogService.ts
3206+
@@ -124,11 +124,12 @@ export class DialogService implements IDialogService {
3207+
async about(): Promise<void> {
3208+
const detailString = (useAgo: boolean): string => {
3209+
return nls.localize('aboutDetail',
3210+
- "Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
3211+
+ "code-server: v{4}\n VS Code: v{0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
3212+
this.productService.version || 'Unknown',
3213+
this.productService.commit || 'Unknown',
3214+
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown',
3215+
- navigator.userAgent
3216+
+ navigator.userAgent,
3217+
+ this.productService.codeServerVersion || 'Unknown',
3218+
);
3219+
};
3220+
31883221
diff --git a/src/vs/workbench/services/environment/browser/environmentService.ts b/src/vs/workbench/services/environment/browser/environmentService.ts
31893222
index 7ed6e9e21a..223fa72662 100644
31903223
--- a/src/vs/workbench/services/environment/browser/environmentService.ts

src/node/app/vscode.ts

+2
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ export class VscodeHttpProvider extends HttpProvider {
192192
response.content = response.content.replace(/<!-- PROD_ONLY/g, "").replace(/END_PROD_ONLY -->/g, "")
193193
}
194194

195+
options.productConfiguration.codeServerVersion = require("../../../package.json").version
196+
195197
response.content = response.content
196198
.replace(`"{{REMOTE_USER_DATA_URI}}"`, `'${JSON.stringify(options.remoteUserDataUri)}'`)
197199
.replace(`"{{PRODUCT_CONFIGURATION}}"`, `'${JSON.stringify(options.productConfiguration)}'`)

0 commit comments

Comments
 (0)