Skip to content

Commit 5401c29

Browse files
authored
Feat/major package updates (#210)
* update all npm packages * Keys tab layout tweak * Additional checkForNewFw log * fix bug in external-links.js * bump manifest version to 5.5.0 * win-specific npm scrips * chmod nwjs runtime files to 755 * fix Linux autolaunch * bump release manifest info --------- Co-authored-by: Rodney G <rodgolpe@gmail.com>
1 parent 5e2db8a commit 5401c29

9 files changed

Lines changed: 87 additions & 41 deletions

File tree

app/app.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ <h2>
820820
</p>
821821
<hr />
822822
<div class="flex-container">
823-
<div class="flex-item">
823+
<div class="flex-item" style="max-width: 40%">
824824
<p>
825825
Need an OpenPGP key? Follow our guide
826826
<a
@@ -831,15 +831,15 @@ <h2>
831831
for generating an OpenPGP key with Keybase.
832832
</p>
833833
<p>
834-
Before loading a key, <span class="strong">you must first put your OnlyKey into config mode</span>.
834+
Before loading a key, <span class="critical-text">you must first put your OnlyKey into config mode</span>.
835835
<br/><br/>
836836
To do this
837837
<span class="device-specific ok-classic">hold down button #6 on your OnlyKey for 5+ seconds and release.</span>
838838
<span class="device-specific ok-duo">hold down button #1 on your OnlyKey DUO for 10+ seconds and release.</span>
839839
The light will turn off.
840840
<span class="device-specific ok-duo">If a PIN was previously set, re-enter the PIN to enter config mode.</span>
841841
You will notice the OnlyKey flashes red in config mode.
842-
</p>
842+
</p>
843843
</div>
844844
<div class="flex-item">
845845
<form id="rsaForm" name="rsaForm" class="auth-form">

app/scripts/external-links.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
const openMethod = typeof nw === 'undefined' ? window.open : nw.Shell.openExternal;
2+
3+
// Formerly checked for 'external' in classList. Now fires for all https:// links.
14
document.querySelector('#main').addEventListener('click', evt => {
2-
const parent = (evt.path && evt.path[1]) || {};
3-
const href = evt.target && evt.target.href ? evt.target.href : parent.href;
5+
let href = evt.target && evt.target.href;
6+
if (!href) href = evt.target && evt.target.offsetParent && evt.target.offsetParent.href;
7+
if (!href) href = evt.path && evt.path[1] && evt.path[1].href;
48

5-
if ((evt.target !== evt.currentTarget) && (!!href && (evt.target.classList.contains('external') || parent.classList.contains('external')))) {
6-
const openMethod = typeof nw === 'undefined' ? window.open : nw.Shell.openExternal;
9+
if (!!href && href.indexOf('https://') == 0) {
710
openMethod(href);
811
evt.preventDefault && evt.preventDefault();
912
evt.stopPropgation && evt.stopPropagation();

app/scripts/non-renderer-app-path.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const devApp = 'nwjs Helper.app';
22
const prodApp = 'OnlyKey App.app';
33
// path should use "nwjs Helper", not "nwjs Helper (Renderer)"
4+
console.log({ location: 'non-renderer-app-path.js', process_execPath: process.execPath })
45
const tempPath = process.execPath.replace(/ \(Renderer\)/g, '');
56
let appPath;
67
if (tempPath.includes(prodApp)) {

app/scripts/onlyKey/OnlyKeyComm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,12 +2184,12 @@ function checkForNewFW(checkForNewFW, fwUpdateSupport, version) {
21842184
fwchecked = true;
21852185
if (checkForNewFW == true && fwUpdateSupport == true) {
21862186
//fw checking enabled and firmware version supports app updates
2187-
var r = request.get(
2187+
console.info("Checking for new firmware");
2188+
request.get(
21882189
"https://github.com/trustcrypto/OnlyKey-Firmware/releases/latest",
21892190
function (err, res, body) {
21902191
if (err) return reject(err);
21912192

2192-
console.log(r.uri.href);
21932193
console.log(this.uri.href);
21942194
//var testupgradeurl = 'https://github.com/trustcrypto/OnlyKey-Firmware/releases/tag/v2.1.0-prod'
21952195
//var latestver = testupgradeurl.split("/tag/v"); //end of redirected URL is the version

app/scripts/tray.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,32 @@
66
const userPreferences = require('./scripts/userPreferences.js');
77
const settingsMenu = new nw.Menu();
88

9-
const appPath = require('./scripts/non-renderer-app-path');
10-
const appName = appPath.includes('nwjs Helper') ? 'OnlyKey-dev' : 'OnlyKey';
119
const os = require('os');
1210
const osx = os.platform() === 'darwin';
1311
const linux = os.platform() === 'linux';
1412

13+
const appPath = osx ? require('./scripts/non-renderer-app-path') : process.execPath;
14+
const appName = appPath.includes('node_modules') ? 'OnlyKey-dev' : 'OnlyKey';
15+
16+
const logParams = {
17+
location: 'tray.js',
18+
appPath,
19+
appName,
20+
os_platform: os.platform(),
21+
}
22+
23+
console.info(logParams);
24+
1525
const AutoLaunch = require("auto-launch");
26+
27+
// LINUX: adds "~/.config/autostart/nw.desktop" file when autoLaunch is enabled
1628
const autoLaunchOptions = {
17-
name: appName,
18-
isHidden: true
29+
name: appName, // the AutoLaunch class overwrites this required prop! (see the "fixOpts" method)
30+
isHidden: !(osx || linux), // this flag breaks the autoLaunch feature in Mac & Linux
1931
};
2032

2133
if (osx) {
2234
autoLaunchOptions.path = appPath;
23-
autoLaunchOptions.isHidden = false;
2435
}
2536

2637
const autoLaunch = new AutoLaunch(autoLaunchOptions);
@@ -84,7 +95,13 @@
8495
settingsMenu.append(autoLaunchMenuItem);
8596
settingsMenu.append(autoUpdateMenuItem);
8697
settingsMenu.append(autoUpdateFWMenuItem);
87-
tray.menu = settingsMenu;
98+
99+
// using setTimeout to counteract anomalies including empty tray menu
100+
setTimeout(() => {
101+
tray.menu = settingsMenu;
102+
console.info({ ...logParams, tray });
103+
}, 500);
104+
88105

89106
// discovered on linux that the menu item checked state does not live update
90107
function refreshMenuItem(menuItem, index) {

manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "OnlyKey Configuration",
33
"manifest_version": 2,
4-
"version": "5.3.6",
5-
"version_name": "5.3.6",
4+
"version": "5.5.0",
5+
"version_name": "5.5.0",
66
"minimum_chrome_version": "45.0.2439.3",
77
"app": {
88
"background": {

package.json

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
11
{
22
"name": "OnlyKey",
33
"productName": "OnlyKey App",
4-
"version": "5.3.6",
5-
"version_name": "5.3.6",
4+
"version": "5.5.0",
5+
"version_name": "5.5.0",
66
"description": "Setup and configure OnlyKey",
77
"main": "app.js",
88
"scripts": {
99
"build": "./node_modules/.bin/gulp build",
10+
"build_win": ".\\node_modules\\.bin\\gulp build",
1011
"prerelease": "rm -rf ./node_modules/* && npm install --production && rm -rf ./release_node_modules && mkdir release_node_modules && cd release_node_modules && mkdir node_modules && cd .. && cp -R ./node_modules/* ./release_node_modules/node_modules && npm install && npm run build -- --env=production",
12+
"prerelease_win": "rm -rf ./node_modules/* && npm install --production && rm -rf ./release_node_modules && mkdir release_node_modules && cd release_node_modules && mkdir node_modules && cd .. && cp -R ./node_modules/* ./release_node_modules/node_modules && npm install && npm run build_win -- --env=production",
1113
"release": "./node_modules/.bin/gulp release --env=production",
14+
"release_win": ".\\node_modules\\.bin\\gulp release --env=production",
1215
"start": "node ./tasks/start",
1316
"pretest": "npm run-script build",
1417
"test": "mocha",
18+
"testgulp": ".\\node_modules\\.bin\\gulp -v",
1519
"prechrome": "./node_modules/.bin/gulp build --env=chrome",
1620
"chrome": "echo 'Please run something like:'; echo \"chrome --load-and-launch-app=$(pwd)/build\""
1721
},
1822
"dependencies": {
1923
"auto-launch": "^5.0.5",
2024
"js-sha256": "^0.9.0",
21-
"nw": "^0.55.0",
22-
"nw-autoupdater": "^1.1.8",
23-
"request": "^2.88.0",
24-
"sshpk": "^1.16.1"
25+
"nw": "^0.71.1",
26+
"nw-autoupdater": "^1.1.11",
27+
"request": "^2.88.2",
28+
"sshpk": "^1.17.0"
2529
},
2630
"devDependencies": {
27-
"chai": "^4.2.0",
31+
"chai": "^4.3.7",
2832
"chai-as-promised": "^7.1.1",
29-
"eslint": "^6.4.0",
30-
"fs-jetpack": "^4.1.0",
33+
"eslint": "^8.33.0",
34+
"fs-jetpack": "^5.1.0",
3135
"gulp": "^4.0.2",
32-
"gulp-sourcemaps": "^2.6.4",
33-
"json": "^10.0.0",
34-
"mocha": "^8.2.0",
36+
"gulp-sourcemaps": "^3.0.0",
37+
"json": "^11.0.0",
38+
"mocha": "^10.2.0",
3539
"nw-dev": "^3.0.1",
3640
"q": "^1.5.1",
37-
"selenium-webdriver": "^3.6.0",
38-
"tree-kill": "^1.2.1",
39-
"yargs": "^16.1.0"
41+
"selenium-webdriver": "^4.8.0",
42+
"tree-kill": "^1.2.2",
43+
"yargs": "^17.6.2"
4044
},
4145
"optionalDependencies": {
42-
"appdmg": "^0.6.0"
46+
"appdmg": "^0.6.4"
4347
},
4448
"repository": {
4549
"type": "git",
@@ -57,7 +61,7 @@
5761
"author": "CryptoTrust <admin@crp.to>",
5862
"license": "Apache-2.0",
5963
"bugs": {
60-
"url": "https://github.com/trustcrypto/OnlyKey-App/issues"
64+
"url": "https://onlykey.discourse.group/"
6165
},
6266
"homepage": "https://github.com/trustcrypto/OnlyKey-App#readme",
6367
"window": {

releases/manifest.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
22
"name": "OnlyKey",
33
"productName": "OnlyKey App",
4-
"version": "5.2.0",
4+
"version": "5.5.0",
55
"packages": {
66
"linux64": {
7-
"url": "https://s3.amazonaws.com/onlykey/apps/desktop/releases/latest/OnlyKey_5.2.0_amd64.deb",
8-
"size": 64000000
7+
"url": "https://s3.amazonaws.com/onlykey/apps/desktop/releases/latest/OnlyKey_5.5.0_amd64.deb",
8+
"size": 105000000
99
},
1010
"win64": {
11-
"url": "https://s3.amazonaws.com/onlykey/apps/desktop/releases/latest/OnlyKey_5.2.0.exe",
12-
"size": 67000000
11+
"url": "https://s3.amazonaws.com/onlykey/apps/desktop/releases/latest/OnlyKey_5.5.0.exe",
12+
"size": 95000000
1313
},
1414
"mac64": {
15-
"url": "https://s3.amazonaws.com/onlykey/apps/desktop/releases/latest/OnlyKey_5.2.0.dmg",
16-
"size": 105000000
15+
"url": "https://s3.amazonaws.com/onlykey/apps/desktop/releases/latest/OnlyKey_5.5.0.dmg",
16+
"size": 134000000
1717
}
1818
},
1919
"description": "OnlyKey Configuration App"

tasks/release_linux.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ var init = function (params={}) {
2828
};
2929

3030
var copyRuntime = function () {
31+
// this pulls all files and directories from node_modules/nw/nwjs
32+
// and copies them into /opt/OnlyKey
3133
return projectDir.copyAsync(`${node_modules_dir}/nw/nwjs`, readyAppDir.path(), { overwrite: true });
3234
};
3335

@@ -57,6 +59,24 @@ var prepareOsSpecificThings = function () {
5759
return Q();
5860
};
5961

62+
var updateRuntimeFileMode = function () {
63+
var deferred = Q.defer();
64+
65+
console.log('chmodding nwjs runtime...');
66+
67+
childProcess.exec('chmod -R 755 ' + readyAppDir.path(),
68+
function (error, stdout, stderr) {
69+
if (error || stderr) {
70+
console.log("ERROR while chmodding nwjs runtime:");
71+
console.log(error);
72+
console.log(stderr);
73+
}
74+
deferred.resolve();
75+
});
76+
77+
return deferred.promise;
78+
};
79+
6080
var packToDebFile = function () {
6181
var deferred = Q.defer();
6282

@@ -102,6 +122,7 @@ var cleanClutter = function () {
102122
module.exports = function (params) {
103123
return init(params)
104124
.then(copyRuntime)
125+
.then(updateRuntimeFileMode)
105126
.then(copyBuiltApp)
106127
.then(prepareOsSpecificThings)
107128
.then(packToDebFile)

0 commit comments

Comments
 (0)