Related to T2866. Added logic and styling to parse and render URLs in cashtab messages and return them as clickable links. This could be taken care of more cleanly with a library but I wanted to attempt it without a library before going that route.
Details
- Reviewers
kieran709 - Group Reviewers
Restricted Project
cd web/cashtab && npm start
if there are no cashtab messages in recent tx history that contain links, receive some in the active wallet
observe that the URLs in the messages are now clickable links
Diff Detail
- Repository
- rABC Bitcoin ABC
- Branch
- parse-links-opReturn-msgs
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 21668 Build 42976: Build Diff cashtab-tests Build 42975: arc lint + arc unit
Event Timeline
Great diff. A couple of mods:
- This eats a space after the URL for messages that include a URL with text afterward
- This won't parse URLs without https://, ideally we don't want to make users add extra characters into OP_RETURN, e.g. cashtab.com should be parsed
Having looked into it I am not certain I can parse relative links without a protocol unless at the very least, an external library is added. That said even the external libraries I have tested aren't perfect( lists of links separated by commas (ex. google.com, cashtab.com, yahoo.com becomes google.com, cashtab.com, yahoo.com,), if a url is provided that does not support https it cannot really be accounted for, plus some other nits). Let me know if you want to see a version that uses an external library, or if you have any advice for how to improve the functionality here I would appreciate it.
web/cashtab/src/components/Home/Tx.js | ||
---|---|---|
475 | mb this for supporting shorthand URLs, e.g. "cashtab.com" return Boolean(new URL(urlString) || new URL(`https://${urlString}`) |
May implement this later. Diff is a good proof of concept. Not high priority with current resourcing.