Closed ekzyis closed 4 months ago
lib/url.js (8)
Line range hint `1-6`: LGTM! The `ensureProtocol` function correctly ensures a protocol is present in the URL. --- Line range hint `8-10`: LGTM! The `isExternal` function correctly checks if a URL is external. --- Line range hint `12-20`: LGTM! The `removeTracking` function correctly removes tracking parameters from URLs. --- Line range hint `22-41`: LGTM! The `parseInternalLinks` function correctly parses internal links. --- Line range hint `43-45`: LGTM! The `stripTrailingSlash` function correctly strips trailing slashes from URLs. --- Line range hint `47-66`: LGTM! The `parseNwcUrl` function correctly parses NWC URLs. --- Line range hint `68-95`: LGTM! The regular expressions for URL validation are correct and follow best practices. --- `97-97`: LGTM! The `TOR_REGEXP` correctly matches `.onion` URLs with an optional port number.lib/cln.js (2)
Line range hint `5-19`: LGTM! The `createInvoice` function correctly handles `.onion` addresses and uses the `TOR_REGEXP` to determine if the address is an `.onion` address. --- Line range hint `35-105`: LGTM! The `decodeRune` function correctly decodes a rune.lib/validate.js (2)
`13-13`: LGTM! The imports of `TOR_REGEXP` and `parseNwcUrl` are correct and necessary for the new validation logic. --- `604-624`: LGTM! The `lnbitsSchema` function's validation logic correctly handles `.onion` addresses and enforces HTTPS over clearnet.
Description
This allows using
http://
orhttps://
if .onion is used for LNbitsHopefully closes #1166
Checklist
Are your changes backwards compatible? Please answer below:
Yes
Did you QA this? Could we deploy this straight to production? Please answer below:
Yes, QA'ed that validation works as expected
For frontend changes: Tested on mobile? Please answer below:
Did you introduce any new environment variables? If so, call them out explicitly here: