Keychainify on direct access to a SteemConnect URL

Repository & PR

https://github.com/MattyIce/steem-keychain
https://github.com/MattyIce/steem-keychain/pull/112

Context

Last week I described Keychainify, a feature I added to Steem Keychain to trigger a Keychain operation on click on a Steem Connect link on a page. But that would not work if the user copied and pasted the Steem Connect URL and loaded it directly in a browser tab or in cases such as the page using some programmatic way to redirect the user. Well, today's PR should solve the issue.

New Features

Previously, the Keychain extension was injecting what we call a content script into the source code of loaded page. That content script is what parses the source for Steem Connect anchor tags. For a direct access to be detected, I needed to modify the background script which is always running during the lifetime of a browser.

As the content script and background scripts are going to share common logic, I ended up creating a Keychainify library to avoid code duplication.

In the background script, the core of the changes is this block of code:
Screen Shot 2019-07-09 at 8.11.49 am.jpg

What is does is create an event handler to be triggered every time a browser tab is getting update (change of URL). It would then grab the new URL and Keychainify it if it is a supported Steem Connect URL.

All the rest in the PR is just code refactor and re-organisation.

GitHub Account

https://github.com/quochuy

H2
H3
H4
Upload from PC
Video gallery
3 columns
2 columns
1 column
9 Comments