mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 23:33:31 +00:00
remove self updates
This commit is contained in:
14
package-lock.json
generated
14
package-lock.json
generated
@@ -4,15 +4,6 @@
|
|||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/adm-zip": {
|
|
||||||
"version": "0.4.31",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/adm-zip/-/adm-zip-0.4.31.tgz",
|
|
||||||
"integrity": "sha1-ozdrn6j0xunAeMF20t8srreTneM=",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@types/node": "10.0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@types/commander": {
|
"@types/commander": {
|
||||||
"version": "2.12.2",
|
"version": "2.12.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/commander/-/commander-2.12.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/commander/-/commander-2.12.2.tgz",
|
||||||
@@ -117,11 +108,6 @@
|
|||||||
"acorn": "5.5.3"
|
"acorn": "5.5.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"adm-zip": {
|
|
||||||
"version": "0.4.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.7.tgz",
|
|
||||||
"integrity": "sha1-hgbCy/HEJs6MjsABdER/1Jtur8E="
|
|
||||||
},
|
|
||||||
"ajv": {
|
"ajv": {
|
||||||
"version": "6.5.0",
|
"version": "6.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.0.tgz",
|
||||||
|
|||||||
@@ -44,7 +44,6 @@
|
|||||||
"assets": "./build/**/*"
|
"assets": "./build/**/*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/adm-zip": "^0.4.31",
|
|
||||||
"@types/commander": "^2.12.2",
|
"@types/commander": "^2.12.2",
|
||||||
"@types/form-data": "^2.2.1",
|
"@types/form-data": "^2.2.1",
|
||||||
"@types/lowdb": "^1.0.1",
|
"@types/lowdb": "^1.0.1",
|
||||||
@@ -65,7 +64,6 @@
|
|||||||
"webpack": "^3.10.0"
|
"webpack": "^3.10.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"adm-zip": "0.4.7",
|
|
||||||
"chalk": "2.4.1",
|
"chalk": "2.4.1",
|
||||||
"commander": "2.15.1",
|
"commander": "2.15.1",
|
||||||
"form-data": "2.3.2",
|
"form-data": "2.3.2",
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import * as AdmZip from 'adm-zip';
|
|
||||||
import * as program from 'commander';
|
import * as program from 'commander';
|
||||||
import * as fs from 'fs';
|
|
||||||
import * as fetch from 'node-fetch';
|
import * as fetch from 'node-fetch';
|
||||||
import * as path from 'path';
|
|
||||||
|
|
||||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
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;
|
res.title = 'A new version is available: ' + tagName;
|
||||||
if (downloadUrl == null) {
|
if (downloadUrl == null) {
|
||||||
downloadUrl = 'https://github.com/bitwarden/cli/releases';
|
downloadUrl = 'https://github.com/bitwarden/cli/releases';
|
||||||
@@ -92,14 +66,6 @@ export class UpdateCommand {
|
|||||||
|
|
||||||
res.message += 'You can download this update at ' + downloadUrl;
|
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) {
|
if (this.inPkg) {
|
||||||
res.message += '\n\nIf you installed this CLI through a package manager ' +
|
res.message += '\n\nIf you installed this CLI through a package manager ' +
|
||||||
'you should probably update using its update command instead.';
|
'you should probably update using its update command instead.';
|
||||||
|
|||||||
@@ -466,7 +466,6 @@ export class Program {
|
|||||||
program
|
program
|
||||||
.command('update')
|
.command('update')
|
||||||
.description('Check for updates.')
|
.description('Check for updates.')
|
||||||
.option('--self', 'Attempt to automatically update self.')
|
|
||||||
.on('--help', () => {
|
.on('--help', () => {
|
||||||
writeLn('\n Notes:');
|
writeLn('\n Notes:');
|
||||||
writeLn('');
|
writeLn('');
|
||||||
@@ -474,13 +473,10 @@ export class Program {
|
|||||||
writeLn('');
|
writeLn('');
|
||||||
writeLn(' Use the `--raw` option to return only the download URL for the update.');
|
writeLn(' Use the `--raw` option to return only the download URL for the update.');
|
||||||
writeLn('');
|
writeLn('');
|
||||||
writeLn(' `--self` updates are not available on Windows.');
|
|
||||||
writeLn('');
|
|
||||||
writeLn(' Examples:');
|
writeLn(' Examples:');
|
||||||
writeLn('');
|
writeLn('');
|
||||||
writeLn(' bw update');
|
writeLn(' bw update');
|
||||||
writeLn(' bw update --raw');
|
writeLn(' bw update --raw');
|
||||||
writeLn(' bw update --self');
|
|
||||||
writeLn('', true);
|
writeLn('', true);
|
||||||
})
|
})
|
||||||
.action(async (cmd) => {
|
.action(async (cmd) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user