diff --git a/app/app.html b/app/app.html index b6fde1f..dd1038f 100644 --- a/app/app.html +++ b/app/app.html @@ -820,7 +820,7 @@


-
+
diff --git a/app/scripts/external-links.js b/app/scripts/external-links.js index 37d71eb..edbed9f 100644 --- a/app/scripts/external-links.js +++ b/app/scripts/external-links.js @@ -1,9 +1,12 @@ +const openMethod = typeof nw === 'undefined' ? window.open : nw.Shell.openExternal; + +// Formerly checked for 'external' in classList. Now fires for all https:// links. document.querySelector('#main').addEventListener('click', evt => { - const parent = (evt.path && evt.path[1]) || {}; - const href = evt.target && evt.target.href ? evt.target.href : parent.href; + let href = evt.target && evt.target.href; + if (!href) href = evt.target && evt.target.offsetParent && evt.target.offsetParent.href; + if (!href) href = evt.path && evt.path[1] && evt.path[1].href; - if ((evt.target !== evt.currentTarget) && (!!href && (evt.target.classList.contains('external') || parent.classList.contains('external')))) { - const openMethod = typeof nw === 'undefined' ? window.open : nw.Shell.openExternal; + if (!!href && href.indexOf('https://') == 0) { openMethod(href); evt.preventDefault && evt.preventDefault(); evt.stopPropgation && evt.stopPropagation(); diff --git a/app/scripts/non-renderer-app-path.js b/app/scripts/non-renderer-app-path.js index 77da450..1051c27 100644 --- a/app/scripts/non-renderer-app-path.js +++ b/app/scripts/non-renderer-app-path.js @@ -1,6 +1,7 @@ const devApp = 'nwjs Helper.app'; const prodApp = 'OnlyKey App.app'; // path should use "nwjs Helper", not "nwjs Helper (Renderer)" +console.log({ location: 'non-renderer-app-path.js', process_execPath: process.execPath }) const tempPath = process.execPath.replace(/ \(Renderer\)/g, ''); let appPath; if (tempPath.includes(prodApp)) { diff --git a/app/scripts/onlyKey/OnlyKeyComm.js b/app/scripts/onlyKey/OnlyKeyComm.js index 93c6793..b112210 100644 --- a/app/scripts/onlyKey/OnlyKeyComm.js +++ b/app/scripts/onlyKey/OnlyKeyComm.js @@ -2184,12 +2184,12 @@ function checkForNewFW(checkForNewFW, fwUpdateSupport, version) { fwchecked = true; if (checkForNewFW == true && fwUpdateSupport == true) { //fw checking enabled and firmware version supports app updates - var r = request.get( + console.info("Checking for new firmware"); + request.get( "https://github.com/trustcrypto/OnlyKey-Firmware/releases/latest", function (err, res, body) { if (err) return reject(err); - console.log(r.uri.href); console.log(this.uri.href); //var testupgradeurl = 'https://github.com/trustcrypto/OnlyKey-Firmware/releases/tag/v2.1.0-prod' //var latestver = testupgradeurl.split("/tag/v"); //end of redirected URL is the version diff --git a/app/scripts/tray.js b/app/scripts/tray.js index 7de8fdc..21eb09b 100644 --- a/app/scripts/tray.js +++ b/app/scripts/tray.js @@ -6,21 +6,32 @@ const userPreferences = require('./scripts/userPreferences.js'); const settingsMenu = new nw.Menu(); - const appPath = require('./scripts/non-renderer-app-path'); - const appName = appPath.includes('nwjs Helper') ? 'OnlyKey-dev' : 'OnlyKey'; const os = require('os'); const osx = os.platform() === 'darwin'; const linux = os.platform() === 'linux'; + const appPath = osx ? require('./scripts/non-renderer-app-path') : process.execPath; + const appName = appPath.includes('node_modules') ? 'OnlyKey-dev' : 'OnlyKey'; + + const logParams = { + location: 'tray.js', + appPath, + appName, + os_platform: os.platform(), + } + + console.info(logParams); + const AutoLaunch = require("auto-launch"); + + // LINUX: adds "~/.config/autostart/nw.desktop" file when autoLaunch is enabled const autoLaunchOptions = { - name: appName, - isHidden: true + name: appName, // the AutoLaunch class overwrites this required prop! (see the "fixOpts" method) + isHidden: !(osx || linux), // this flag breaks the autoLaunch feature in Mac & Linux }; if (osx) { autoLaunchOptions.path = appPath; - autoLaunchOptions.isHidden = false; } const autoLaunch = new AutoLaunch(autoLaunchOptions); @@ -84,7 +95,13 @@ settingsMenu.append(autoLaunchMenuItem); settingsMenu.append(autoUpdateMenuItem); settingsMenu.append(autoUpdateFWMenuItem); - tray.menu = settingsMenu; + + // using setTimeout to counteract anomalies including empty tray menu + setTimeout(() => { + tray.menu = settingsMenu; + console.info({ ...logParams, tray }); + }, 500); + // discovered on linux that the menu item checked state does not live update function refreshMenuItem(menuItem, index) { diff --git a/manifest.json b/manifest.json index ca2f5fd..0d09f3b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,8 +1,8 @@ { "name": "OnlyKey Configuration", "manifest_version": 2, - "version": "5.3.6", - "version_name": "5.3.6", + "version": "5.5.0", + "version_name": "5.5.0", "minimum_chrome_version": "45.0.2439.3", "app": { "background": { diff --git a/package.json b/package.json index 04d0748..b29e2b6 100644 --- a/package.json +++ b/package.json @@ -1,45 +1,49 @@ { "name": "OnlyKey", "productName": "OnlyKey App", - "version": "5.3.6", - "version_name": "5.3.6", + "version": "5.5.0", + "version_name": "5.5.0", "description": "Setup and configure OnlyKey", "main": "app.js", "scripts": { "build": "./node_modules/.bin/gulp build", + "build_win": ".\\node_modules\\.bin\\gulp build", "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", + "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", "release": "./node_modules/.bin/gulp release --env=production", + "release_win": ".\\node_modules\\.bin\\gulp release --env=production", "start": "node ./tasks/start", "pretest": "npm run-script build", "test": "mocha", + "testgulp": ".\\node_modules\\.bin\\gulp -v", "prechrome": "./node_modules/.bin/gulp build --env=chrome", "chrome": "echo 'Please run something like:'; echo \"chrome --load-and-launch-app=$(pwd)/build\"" }, "dependencies": { "auto-launch": "^5.0.5", "js-sha256": "^0.9.0", - "nw": "^0.55.0", - "nw-autoupdater": "^1.1.8", - "request": "^2.88.0", - "sshpk": "^1.16.1" + "nw": "^0.71.1", + "nw-autoupdater": "^1.1.11", + "request": "^2.88.2", + "sshpk": "^1.17.0" }, "devDependencies": { - "chai": "^4.2.0", + "chai": "^4.3.7", "chai-as-promised": "^7.1.1", - "eslint": "^6.4.0", - "fs-jetpack": "^4.1.0", + "eslint": "^8.33.0", + "fs-jetpack": "^5.1.0", "gulp": "^4.0.2", - "gulp-sourcemaps": "^2.6.4", - "json": "^10.0.0", - "mocha": "^8.2.0", + "gulp-sourcemaps": "^3.0.0", + "json": "^11.0.0", + "mocha": "^10.2.0", "nw-dev": "^3.0.1", "q": "^1.5.1", - "selenium-webdriver": "^3.6.0", - "tree-kill": "^1.2.1", - "yargs": "^16.1.0" + "selenium-webdriver": "^4.8.0", + "tree-kill": "^1.2.2", + "yargs": "^17.6.2" }, "optionalDependencies": { - "appdmg": "^0.6.0" + "appdmg": "^0.6.4" }, "repository": { "type": "git", @@ -57,7 +61,7 @@ "author": "CryptoTrust ", "license": "Apache-2.0", "bugs": { - "url": "https://github.com/trustcrypto/OnlyKey-App/issues" + "url": "https://onlykey.discourse.group/" }, "homepage": "https://github.com/trustcrypto/OnlyKey-App#readme", "window": { diff --git a/releases/manifest.json b/releases/manifest.json index e328346..16b9185 100644 --- a/releases/manifest.json +++ b/releases/manifest.json @@ -1,19 +1,19 @@ { "name": "OnlyKey", "productName": "OnlyKey App", - "version": "5.2.0", + "version": "5.5.0", "packages": { "linux64": { - "url": "https://s3.amazonaws.com/onlykey/apps/desktop/releases/latest/OnlyKey_5.2.0_amd64.deb", - "size": 64000000 + "url": "https://s3.amazonaws.com/onlykey/apps/desktop/releases/latest/OnlyKey_5.5.0_amd64.deb", + "size": 105000000 }, "win64": { - "url": "https://s3.amazonaws.com/onlykey/apps/desktop/releases/latest/OnlyKey_5.2.0.exe", - "size": 67000000 + "url": "https://s3.amazonaws.com/onlykey/apps/desktop/releases/latest/OnlyKey_5.5.0.exe", + "size": 95000000 }, "mac64": { - "url": "https://s3.amazonaws.com/onlykey/apps/desktop/releases/latest/OnlyKey_5.2.0.dmg", - "size": 105000000 + "url": "https://s3.amazonaws.com/onlykey/apps/desktop/releases/latest/OnlyKey_5.5.0.dmg", + "size": 134000000 } }, "description": "OnlyKey Configuration App" diff --git a/tasks/release_linux.js b/tasks/release_linux.js index a6dfb4f..4af0e80 100755 --- a/tasks/release_linux.js +++ b/tasks/release_linux.js @@ -28,6 +28,8 @@ var init = function (params={}) { }; var copyRuntime = function () { + // this pulls all files and directories from node_modules/nw/nwjs + // and copies them into /opt/OnlyKey return projectDir.copyAsync(`${node_modules_dir}/nw/nwjs`, readyAppDir.path(), { overwrite: true }); }; @@ -57,6 +59,24 @@ var prepareOsSpecificThings = function () { return Q(); }; +var updateRuntimeFileMode = function () { + var deferred = Q.defer(); + + console.log('chmodding nwjs runtime...'); + + childProcess.exec('chmod -R 755 ' + readyAppDir.path(), + function (error, stdout, stderr) { + if (error || stderr) { + console.log("ERROR while chmodding nwjs runtime:"); + console.log(error); + console.log(stderr); + } + deferred.resolve(); + }); + + return deferred.promise; +}; + var packToDebFile = function () { var deferred = Q.defer(); @@ -102,6 +122,7 @@ var cleanClutter = function () { module.exports = function (params) { return init(params) .then(copyRuntime) + .then(updateRuntimeFileMode) .then(copyBuiltApp) .then(prepareOsSpecificThings) .then(packToDebFile)