From 1c0d9bf899d60bd2af767c91fc449c552369d199 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Fri, 15 Nov 2019 18:15:12 +0100 Subject: [PATCH 1/3] Improve detection of Chrome channel variants --- lib/browsers.js | 6 +++++- lib/chrome/find-progids.js | 11 +++++++++-- lib/chrome/find-update-clients.js | 5 ++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/browsers.js b/lib/browsers.js index f0a9db8..1faf8cc 100644 --- a/lib/browsers.js +++ b/lib/browsers.js @@ -6,13 +6,17 @@ exports.chrome = { find: function () { // Joined with filename (or [browser name].exe) this.dir('LOCALAPPDATA', 'Google\\Chrome\\Application') - + this.dir('LOCALAPPDATA', 'Google\\Chrome Beta\\Application') + this.dir('LOCALAPPDATA', 'Google\\Chrome Dev\\Application') // Chrome Canary this.dir('LOCALAPPDATA', 'Google\\Chrome SxS\\Application') // programFiles() is a shortcut to dir() that checks both // "Program Files" and "Program Files (x86)" if on 64-bit Windows this.programFiles('Google\\Chrome\\Application') + this.programFiles('Google\\Chrome Beta\\Application') + this.programFiles('Google\\Chrome Dev\\Application') + this.programFiles('Google\\Chrome SxS\\Application') // Expanded to HKEY_LOCAL_MACHINE\Software, HKEY_CURRENT_USER\Software // and if on a x64 machine, their 32-bit (Software\WoW6432) counterparts. diff --git a/lib/chrome/find-progids.js b/lib/chrome/find-progids.js index 4552f5c..dea720f 100644 --- a/lib/chrome/find-progids.js +++ b/lib/chrome/find-progids.js @@ -29,7 +29,11 @@ function queryHive (self, hive, done) { if (err) return next(err.notFound ? null : err) const metadata = { - channel: id === 'ChromeHTML' ? 'stable' : 'canary' + channel: id.startsWith('ChromeSSHTM.') ? 'canary' : { + 'ChromeHTML': null, // In some cases this can be ambiguous + 'ChromeBHTML': 'beta', + 'ChromeDHTML': 'dev' + }[id] } self.found(extractPath(bin), metadata, key, next) @@ -39,5 +43,8 @@ function queryHive (self, hive, done) { } function isChromeHTML (id) { - return id === 'ChromeHTML' || id.slice(0, 12) === 'ChromeSSHTM.' + return id === 'ChromeHTML' || + id === 'ChromeBHTML' || + id === 'ChromeDHTML' || + id.slice(0, 12) === 'ChromeSSHTM.' } diff --git a/lib/chrome/find-update-clients.js b/lib/chrome/find-update-clients.js index dc54fde..d2ddcf7 100644 --- a/lib/chrome/find-update-clients.js +++ b/lib/chrome/find-update-clients.js @@ -7,12 +7,15 @@ const { basename, resolve, dirname } = require('path') const registry = require('../registry') const GUIDS = [ + '401C381F-E0DE-4B85-8BD8-3F3F14FBDA57', // dev + '8237E44A-0054-442C-B6B6-EA0509993955', // beta '8A69D345-D564-463C-AFF1-A69D9E530F96', // 32 '4DC8B4CA-1BDA-483E-B5FA-D3C12E15B62D', // 64 '4EA16AC7-FD5A-47C3-875B-DBF4A2008C20' // canary ] const CHANNELS = [ + 'stable', 'canary', 'beta', 'dev' @@ -91,5 +94,5 @@ function getReleaseChannel (ap) { if (ap.has(channel)) return channel } - return 'stable' + return null } From 51101b3941fa95296e3818127f1c4a4ac5e1f8e3 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 16 Nov 2019 13:15:57 +0100 Subject: [PATCH 2/3] Breaking: remove 'bitness' from chrome metadata --- cli.js | 6 +++--- lib/chrome/find-update-clients.js | 1 - lib/finder.js | 1 - readme.md | 3 --- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/cli.js b/cli.js index 60726f4..2c4d7cb 100644 --- a/cli.js +++ b/cli.js @@ -59,9 +59,9 @@ detect(argv._, argv, function (err, browsers, methods) { labels.push(b.channel.toUpperCase()) } - if (b.arch === 'amd64' || b.bitness === 64) { + if (b.arch === 'amd64') { labels.push('64-bit') - } else if (b.arch === 'i386' || b.bitness === 32) { + } else if (b.arch === 'i386') { labels.push('32-bit') } @@ -108,7 +108,7 @@ function ordered (a) { const remaining = new Set(Object.keys(a)) const objects = [] - for (const k of ['name', 'path', 'version', 'channel', 'arch', 'bitness']) { + for (const k of ['name', 'path', 'version', 'channel', 'arch']) { if (k in a) { b[k] = a[k] remaining.delete(k) diff --git a/lib/chrome/find-update-clients.js b/lib/chrome/find-update-clients.js index d2ddcf7..c702a96 100644 --- a/lib/chrome/find-update-clients.js +++ b/lib/chrome/find-update-clients.js @@ -48,7 +48,6 @@ function queryState (self, hive, guid, inWoW, done) { const metadata = { channel: getReleaseChannel(ap), - bitness: ap.has('x64') ? 64 : 32, guid } diff --git a/lib/finder.js b/lib/finder.js index 59c2684..44f6e96 100644 --- a/lib/finder.js +++ b/lib/finder.js @@ -194,7 +194,6 @@ Finder.prototype.found = function (bin, metadata, method, cb, _skipPre) { if (metadata) { if (metadata.channel) debugName.push(`(${metadata.channel})`) - if (metadata.bitness) debugName.push(`(${metadata.bitness})`) } debug('Found %s:\n - %s\n @ %s', debugName.join(' '), bin, method) diff --git a/readme.md b/readme.md index 7a14796..eb3b131 100644 --- a/readme.md +++ b/readme.md @@ -68,7 +68,6 @@ Additional properties are usually available but not guaranteed: - `uninstall` (object): Chrome only. Uninstaller info with: - `path` (string): path to installer; - `arguments` (array): arguments to installer in order to uninstall. -- `bitness` (number): Chrome only. 64 or 32. - `guid` (string): Chrome only. ## CLI @@ -234,7 +233,6 @@ On Windows 10 with `--json`: "version": "68.0.3436.0", "channel": "canary", "arch": "amd64", - "bitness": 64, "guid": "4EA16AC7-FD5A-47C3-875B-DBF4A2008C20", "info": { "FileVersion": "68.0.3436.0", @@ -264,7 +262,6 @@ On Windows 10 with `--json`: "version": "66.0.3359.181", "channel": "stable", "arch": "amd64", - "bitness": 64, "guid": "8A69D345-D564-463C-AFF1-A69D9E530F96", "info": { "FileVersion": "66.0.3359.181", From 967fdca53074eeaaa11b592b91cb9932a9836291 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Mon, 18 Nov 2019 13:08:09 +0100 Subject: [PATCH 3/3] Refactor Chrome channel registry detection to a separate function --- lib/chrome/find-progids.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/chrome/find-progids.js b/lib/chrome/find-progids.js index dea720f..9940f4d 100644 --- a/lib/chrome/find-progids.js +++ b/lib/chrome/find-progids.js @@ -29,11 +29,7 @@ function queryHive (self, hive, done) { if (err) return next(err.notFound ? null : err) const metadata = { - channel: id.startsWith('ChromeSSHTM.') ? 'canary' : { - 'ChromeHTML': null, // In some cases this can be ambiguous - 'ChromeBHTML': 'beta', - 'ChromeDHTML': 'dev' - }[id] + channel: getChromeChannel(id) } self.found(extractPath(bin), metadata, key, next) @@ -48,3 +44,10 @@ function isChromeHTML (id) { id === 'ChromeDHTML' || id.slice(0, 12) === 'ChromeSSHTM.' } + +function getChromeChannel (id) { + if (id.startsWith('ChromeSSHTM.')) return 'canary' + if (id === 'ChromeBHTML') return 'beta' + if (id === 'ChromeDHTML') return 'dev' + return null // Unknown or ChromeHTML (which can be ambiguous) +}