1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

remove self updates

This commit is contained in:
Kyle Spearrin
2018-05-23 09:02:47 -04:00
parent 186783ba6d
commit 8207e703ac
4 changed files with 0 additions and 54 deletions

View File

@@ -1,8 +1,5 @@
import * as AdmZip from 'adm-zip';
import * as program from 'commander';
import * as fs from 'fs';
import * as fetch from 'node-fetch';
import * as path from 'path';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
@@ -56,29 +53,6 @@ export class UpdateCommand {
}
}
if ((cmd.self || false) && this.inPkg && process.platform !== 'win32') {
const zipResponse = await fetch.default(downloadUrl);
if (zipResponse.status === 200) {
const currentDir = path.dirname(process.execPath);
try {
const zipBuffer = await zipResponse.buffer();
const zip = new AdmZip(zipBuffer);
const stats = fs.statSync(process.execPath);
zip.extractAllTo(currentDir, true);
fs.chmodSync(path.join(currentDir, 'bw'), stats.mode);
res.title = 'Updated self to ' + tagName + '.';
if (responseJson.body != null && responseJson.body !== '') {
res.message = responseJson.body;
}
return Response.success(res);
} catch {
return Response.error('Error extracting update to ' + currentDir);
}
} else {
return Response.error('Error downloading update: ' + zipResponse.status);
}
}
res.title = 'A new version is available: ' + tagName;
if (downloadUrl == null) {
downloadUrl = 'https://github.com/bitwarden/cli/releases';
@@ -92,14 +66,6 @@ export class UpdateCommand {
res.message += 'You can download this update at ' + downloadUrl;
if ((cmd.self || false) && process.platform === 'win32') {
res.message += '\n`--self` updates are not available on Windows.';
} else if ((cmd.self || false) && !this.inPkg) {
res.message += '\n`--self` updates are only available in packaged executables.';
} else if (process.platform !== 'win32') {
res.message += '\nor just run `bw update --self`';
}
if (this.inPkg) {
res.message += '\n\nIf you installed this CLI through a package manager ' +
'you should probably update using its update command instead.';

View File

@@ -466,7 +466,6 @@ export class Program {
program
.command('update')
.description('Check for updates.')
.option('--self', 'Attempt to automatically update self.')
.on('--help', () => {
writeLn('\n Notes:');
writeLn('');
@@ -474,13 +473,10 @@ export class Program {
writeLn('');
writeLn(' Use the `--raw` option to return only the download URL for the update.');
writeLn('');
writeLn(' `--self` updates are not available on Windows.');
writeLn('');
writeLn(' Examples:');
writeLn('');
writeLn(' bw update');
writeLn(' bw update --raw');
writeLn(' bw update --self');
writeLn('', true);
})
.action(async (cmd) => {