-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support subdomains in isIPFS.url(url) (#32)
* feat: support DNSLink subdomains This change adds support for DNSLink subdomains on localhost gateway (ipfs/kubo#6096) Example: en.wikipedia-on-ipfs.org.ipfs.localhost:8080 BREAKING CHANGE: `isIPFS.subdomain` now returns true for <domain.tld>.ipns.localhost BREAKING CHANGE: `isIPFS.subdomainPattern` changed * test: support peer multiaddr with /p2p/ Context: libp2p/libp2p#79 * fix: explicitly ignore URL param and hash .url and .path now return true when validating: https://ipfs.io/ipfs/<CID>?filename=name.png#foo * refactor: simplify dnslinkSubdomain License: MIT Signed-off-by: Marcin Rataj <[email protected]> * fix: url() check should include subdomain() When .url was created we only had path gateways. When .subdomain was added, we did not update .url to test for subdomain gateways, which in the long run will confuse people and feels like a bug. Let's fix this: .url() will now check for both subdomain and path gateways #32 (comment) BREAKING CHANGE: .url(url) now returns true if .subdomain(url) is true * refactor: merge DNSLink check into ipnsSubdomain() This makes subdomain checks follow what path gateway checks do, removing confusion. In both cases (IPNS and DNSLink) user needs to perform online record check, so this is just a handy way of detecting potential matches. * docs: update examples * refactor: switch to iso-url * refactor: lint-package-json * chore: update deps License: MIT Signed-off-by: Marcin Rataj <[email protected]>
- Loading branch information
Showing
8 changed files
with
195 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,4 @@ node_modules | |
|
||
dist | ||
lib | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,67 @@ | ||
{ | ||
"name": "is-ipfs", | ||
"version": "0.6.3", | ||
"description": "A set of utilities to help identify IPFS resources", | ||
"description": "A set of utilities to help identify IPFS resources on the web", | ||
"keywords": [ | ||
"js-ipfs", | ||
"ipns", | ||
"gateway", | ||
"dnslink", | ||
"ipfs" | ||
], | ||
"homepage": "https://github.com/ipfs/is-ipfs", | ||
"bugs": { | ||
"url": "https://github.com/ipfs/is-ipfs/issues" | ||
}, | ||
"license": "MIT", | ||
"author": "Francisco Dias <[email protected]> (http://franciscodias.net/)", | ||
"leadMaintainer": "Marcin Rataj <[email protected]>", | ||
"files": [ | ||
"src", | ||
"dist" | ||
], | ||
"main": "src/index.js", | ||
"browser": { | ||
"fs": false | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ipfs/is-ipfs.git" | ||
}, | ||
"scripts": { | ||
"test:node": "aegir test --target node", | ||
"test:browser": "aegir test --target browser", | ||
"test": "aegir test", | ||
"lint": "aegir lint", | ||
"lint": "aegir lint && aegir lint-package-json", | ||
"release": "aegir release", | ||
"release-minor": "aegir release --type minor", | ||
"release-major": "aegir release --type major", | ||
"build": "aegir build", | ||
"coverage": "aegir coverage", | ||
"coverage-publish": "aegir coverage --upload" | ||
}, | ||
"pre-commit": [ | ||
"test", | ||
"lint" | ||
], | ||
"keywords": [ | ||
"js-ipfs", | ||
"ipfs" | ||
], | ||
"author": "Francisco Dias <[email protected]> (http://franciscodias.net/)", | ||
"license": "MIT", | ||
"dependencies": { | ||
"bs58": "^4.0.1", | ||
"cids": "~0.7.0", | ||
"mafmt": "^7.0.0", | ||
"multiaddr": "^7.2.1", | ||
"multibase": "~0.6.0", | ||
"multihashes": "~0.4.13" | ||
"cids": "~0.8.0", | ||
"iso-url": "~0.4.7", | ||
"mafmt": "^7.1.0", | ||
"multiaddr": "^7.4.3", | ||
"multibase": "~0.7.0", | ||
"multihashes": "~0.4.19" | ||
}, | ||
"devDependencies": { | ||
"aegir": "^20.5.0", | ||
"aegir": "^21.4.5", | ||
"chai": "^4.2.0", | ||
"pre-commit": "^1.2.2" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ipfs/is-ipfs.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ipfs/is-ipfs/issues" | ||
"engines": { | ||
"node": ">=10.0.0", | ||
"npm": ">=6.0.0" | ||
}, | ||
"homepage": "https://github.com/ipfs/is-ipfs", | ||
"pre-commit": [ | ||
"test", | ||
"lint" | ||
], | ||
"contributors": [ | ||
"Alan Shaw <[email protected]>", | ||
"David Dias <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.