Skip to content

Semver #54

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
26 changes: 13 additions & 13 deletions src/utilities/setupSidecarBinary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@ export function getSidecarBinaryURL() {
return 'http://127.0.0.1:42424';
}

// We are hardcoding the version of the sidecar binary here, so we can figure out
// if the version we are looking at is okay, or we need to download a new binary
// for now, lets keep it as it is and figure out a way to update the hash on
// important updates
export const SIDECAR_VERSION = 'a077b88a38143728bc3db94084ec56545f7071b8ae64383ef0c1b9895d74b5da';
export function createUpdateURL(platform: string, quality: string): string {
return `https://aide-updates.codestory.ai/api/update/sidecar/${platform}/${quality}`;
}

async function checkCorrectVersionRunning(url: string): Promise<boolean> {
try {
console.log('Sidecar-binary:Version check starting');
const response = await fetch(`${url}/api/version`);
const version = await response.json();
console.log('Sidecar-binary:Version check starting' + version);
return version.version_hash === SIDECAR_VERSION;
const currentVersionResponse = await fetch(`${url}/api/version`);
const currentVersion = await currentVersionResponse.json();
const updateUrl = createUpdateURL(process.platform, 'stable');
const latestVersionResponse = await fetch(updateUrl);
const latestVersion = await latestVersionResponse.json();
return currentVersion.package_version === latestVersion.package_version;
} catch (e) {
return false;
}
}


export async function runCommand(cmd: string): Promise<[string, string | undefined]> {
let stdout = '';
let stderr = '';
Expand Down Expand Up @@ -238,10 +238,10 @@ export async function startSidecarBinary(
const bucket = 'sidecar-bin';
const fileName =
os.platform() === 'win32'
? 'windows/sidecar.zip'
? 'windows/latest/sidecar.zip'
: os.platform() === 'darwin'
? 'mac/sidecar.zip'
: 'linux/sidecar.zip';
? 'mac/latest/sidecar.zip'
: 'linux/latest/sidecar.zip';

const zipDestination = path.join(extensionBasePath, 'sidecar_zip.zip');
const sidecarDestination = path.join(extensionBasePath, 'sidecar_bin');
Expand Down