From 99a7f92621fea822b98b9999d00c54e7933f829a Mon Sep 17 00:00:00 2001 From: rodgolpe Date: Thu, 10 Nov 2022 01:33:43 -0500 Subject: [PATCH 1/6] catch error and show linux udev dialog --- app/app.html | 6 ++++++ app/scripts/external-links.js | 9 +++++++-- app/scripts/onlyKey/OnlyKeyComm.js | 20 +++++++++++++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/app/app.html b/app/app.html index b6fde1f..5156d30 100644 --- a/app/app.html +++ b/app/app.html @@ -1384,6 +1384,12 @@

Please connect your OnlyKey

+ +

Error connecting

+

Do you need a UDEV rule?

+

See the OnlyKey for Linux docs for more info.

+
+

Working...

Please wait

diff --git a/app/scripts/external-links.js b/app/scripts/external-links.js index 37d71eb..7d9337a 100644 --- a/app/scripts/external-links.js +++ b/app/scripts/external-links.js @@ -1,4 +1,4 @@ -document.querySelector('#main').addEventListener('click', evt => { +const handler = evt => { const parent = (evt.path && evt.path[1]) || {}; const href = evt.target && evt.target.href ? evt.target.href : parent.href; @@ -8,4 +8,9 @@ document.querySelector('#main').addEventListener('click', evt => { evt.preventDefault && evt.preventDefault(); evt.stopPropgation && evt.stopPropagation(); } -}); +}; + +[ + '#main', + '#udev-dialog', +].forEach(sel => document.querySelector(sel).addEventListener('click', handler)); diff --git a/app/scripts/onlyKey/OnlyKeyComm.js b/app/scripts/onlyKey/OnlyKeyComm.js index 93c6793..50b8a68 100644 --- a/app/scripts/onlyKey/OnlyKeyComm.js +++ b/app/scripts/onlyKey/OnlyKeyComm.js @@ -6,6 +6,9 @@ if (desktopApp) { request = require("request"); } +const os = require('os'); +const linux = os.platform() === 'linux'; + let backupsigFlag = -1; let fwchecked = false; let dialog; @@ -1077,6 +1080,7 @@ var ui = { lockedDialogDuo: null, workingDialog: null, disconnectedDialog: null, + udevDialog: null, main: null, }; @@ -1267,9 +1271,23 @@ var connectDevice = async function (device) { chromeHid.connect(deviceId, async function (connectInfo) { if (chrome.runtime.lastError) { - console.error("ERROR CONNECTING:", chrome.runtime.lastError); + console.error(`ERROR CONNECTING: ${chrome.runtime.lastError.message}`, device); + if (linux) { + dialog.open(ui.udevDialog); + } else { + if (confirm(`ERROR: ${chrome.runtime.lastError.message}\n\nRetry?`)) { + return await connectDevice(device); + } + } } else if (!connectInfo) { console.warn("Unable to connect to device."); + if (confirm(`ERROR: Unable to read device info.\n\nRetry?`)) { + return await connectDevice(device); + } + } + + if (!connectInfo) { + return; } myOnlyKey.setConnection(connectInfo.connectionId); From 4de24e18350e33badacc9e42780f412b9f269f6e Mon Sep 17 00:00:00 2001 From: rodgolpe Date: Fri, 15 Dec 2023 23:55:23 -0500 Subject: [PATCH 2/6] Clipboard-free password generator, courtesy of JasonJShuler --- app/app.html | 175 ++++++++++++++++++++++++++- app/scripts/onlyKey/OnlyKeyWizard.js | 107 +++++++++++++++- manifest.json | 4 +- package.json | 4 +- 4 files changed, 284 insertions(+), 6 deletions(-) diff --git a/app/app.html b/app/app.html index dd1038f..fd644f0 100644 --- a/app/app.html +++ b/app/app.html @@ -1459,6 +1459,171 @@

Please choose a key

+ +

Strong Random Password Generator

+

Generate complex, random password without the risk of a clipboard leak.
+ Make any necessary modifications before applying.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + + +
+
+