2025-03-08 06:23:54 +00:00
|
|
|
/*---------------------------------------------------------------------------------------------
|
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
import * as vscode from 'vscode';
|
|
|
|
|
import * as fs from 'fs';
|
|
|
|
|
import * as path from 'path';
|
|
|
|
|
|
|
|
|
|
let vscodeProductJson: any;
|
|
|
|
|
async function getVSCodeProductJson() {
|
|
|
|
|
if (!vscodeProductJson) {
|
|
|
|
|
const productJsonStr = await fs.promises.readFile(path.join(vscode.env.appRoot, 'product.json'), 'utf8');
|
|
|
|
|
vscodeProductJson = JSON.parse(productJsonStr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return vscodeProductJson;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface IServerConfig {
|
|
|
|
|
version: string;
|
|
|
|
|
commit: string;
|
|
|
|
|
quality: string;
|
|
|
|
|
release?: string; // void-like specific
|
|
|
|
|
serverApplicationName: string;
|
|
|
|
|
serverDataFolderName: string;
|
|
|
|
|
serverDownloadUrlTemplate?: string; // void-like specific
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getVSCodeServerConfig(): Promise<IServerConfig> {
|
|
|
|
|
const productJson = await getVSCodeProductJson();
|
|
|
|
|
|
|
|
|
|
return {
|
2025-04-01 04:00:34 +00:00
|
|
|
// version: vscode.version.replace('-insider', ''),
|
2025-03-08 06:23:54 +00:00
|
|
|
commit: productJson.commit,
|
|
|
|
|
quality: productJson.quality,
|
|
|
|
|
release: productJson.release,
|
|
|
|
|
serverApplicationName: productJson.serverApplicationName,
|
|
|
|
|
serverDataFolderName: productJson.serverDataFolderName,
|
2025-04-01 04:00:34 +00:00
|
|
|
serverDownloadUrlTemplate: productJson.serverDownloadUrlTemplate,
|
|
|
|
|
// Void changed this
|
|
|
|
|
version: productJson.voidVersion
|
2025-03-08 06:23:54 +00:00
|
|
|
};
|
|
|
|
|
}
|