diff --git a/CHANGELOG.md b/CHANGELOG.md index 62acc5d..9fa2395 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/), and this - Upgraded to Angular 10 - Now uses `--chunker=buzhash` - Updated `bootstrap` and `ipfs-css` +- Added support for subdomain gateways ### Deprecated diff --git a/src/app/pages/pages.component.html b/src/app/pages/pages.component.html index 053ab37..5b4e2d8 100644 --- a/src/app/pages/pages.component.html +++ b/src/app/pages/pages.component.html @@ -1,4 +1,4 @@ -
+

Public IPFS Cacher

@@ -8,11 +8,11 @@ IPFS - + - + @@ -22,18 +22,18 @@ IPNS - + - + - + - +
@@ -41,7 +41,7 @@ @@ -52,10 +52,16 @@ @@ -70,14 +76,15 @@

About

This allows you to cache a specific IPFS hash to a bunch of public gateways. - It's inspired from github.com/ipfs/public-gateway-checker. - The source code is available at github.com/ipfs/public-gateway-checker. + The source code is available at gitlab.com/NatoBoram/public-gateway-cacher.

If you'd like to add a new public gateway, - please go to github.com/ipfs/public-gateway-checker, - submit a pull request then open an issue here. + please go to github.com/ipfs/public-gateway-checker, + submit a pull request then open an issue here.

diff --git a/src/app/pages/pages.component.ts b/src/app/pages/pages.component.ts index 847fdc3..251fcc1 100644 --- a/src/app/pages/pages.component.ts +++ b/src/app/pages/pages.component.ts @@ -56,10 +56,10 @@ export class PagesComponent implements OnInit { this.gateways.forEach((gateway): void => { this.subscriptions.push( this.gatewayService.get(gateway, type, hash).subscribe((): void => { - this.dataSource.data.push({ gateway: `${gateway.replace(':type', type).replace(':hash', hash)}`, error: null }); + this.dataSource.data.push({ gateway: this.gatewayService.url(gateway, type, hash), error: null }); this.matTable.renderRows(); }, (error: HttpErrorResponse): void => { - this.dataSource.data.push({ gateway: `${gateway.replace(':type', type).replace(':hash', hash)}`, error }); + this.dataSource.data.push({ gateway: this.gatewayService.url(gateway, type, hash), error }); this.matTable.renderRows(); }) ); diff --git a/src/app/services/gateway.service.ts b/src/app/services/gateway.service.ts index 64cc5cb..a115c29 100644 --- a/src/app/services/gateway.service.ts +++ b/src/app/services/gateway.service.ts @@ -21,9 +21,15 @@ export class GatewayService { } get(gateway: string, type: string, hash: string): Observable { - return this.http.get(`${gateway.replace(':type', type).replace(':hash', hash)}#x-ipfs-companion-no-redirect`, { + return this.http.get(`${this.url(gateway, type, hash)}#x-ipfs-companion-no-redirect`, { responseType: 'blob' as 'json' }); } + url(gateway: string, type: string, hashpath: string): string { + const splits = hashpath.split('/'); + const url = gateway.replace(':type', type).replace(':hash', splits.shift()); + return splits.length ? [url, splits.join('/')].join('/') : url; + } + } diff --git a/src/assets/json/gateways.json b/src/assets/json/gateways.json index 8d7d3d3..6e6ca76 100644 --- a/src/assets/json/gateways.json +++ b/src/assets/json/gateways.json @@ -1,22 +1,16 @@ [ "https://ipfs.io/:type/:hash", + "https://:hash.:type.dweb.link", "https://gateway.ipfs.io/:type/:hash", "https://ipfs.infura.io/:type/:hash", - "https://rx14.co.uk/:type/:hash", "https://ninetailed.ninja/:type/:hash", "https://ipfs.globalupload.io/:hash", - "https://ipfs.jes.xxx/:type/:hash", - "https://siderus.io/:type/:hash", - "https://eu.siderus.io/:type/:hash", - "https://na.siderus.io/:type/:hash", - "https://ap.siderus.io/:type/:hash", "https://10.via0.com/:type/:hash", "https://ipfs.eternum.io/:type/:hash", "https://hardbin.com/:type/:hash", - "https://ipfs.wa.hle.rs/:type/:hash", "https://gateway.blocksec.com/:type/:hash", - "https://ipfs.renehsz.com/:type/:hash", "https://cloudflare-ipfs.com/:type/:hash", + "https://:hash.:type.cf-ipfs.com", "https://ipns.co/:hash", "https://ipfs.mrh.io/:type/:hash", "https://gateway.originprotocol.com/:type/:hash", @@ -33,7 +27,30 @@ "https://ipfs.privacytools.io/:type/:hash", "https://ipfs.jeroendeneef.com/:type/:hash", "https://permaweb.io/:type/:hash", - "https://ipfs.stibarc.gq/:type/:hash", + "https://ipfs.stibarc.com/:type/:hash", "https://ipfs.best-practice.se/:type/:hash", - "https://lineageos-on-ipfs.com/:type/:hash" + "https://:hash.:type.2read.net", + "https://ipfs.2read.net/:type/:hash", + "https://storjipfs-gateway.com/:type/:hash", + "https://ipfs.runfission.com/:type/:hash", + "https://trusti.id/:type/:hash", + "https://:hash.:type.cosmos-ink.net", + "https://ipfs.overpi.com/:type/:hash", + "https://ipfs.lc/:type/:hash", + "https://ipfs.leiyun.org/:type/:hash", + "https://ipfs.ink/:type/:hash", + "https://filecoin.io/:type/:hash", + "https://ipfs.jes.xxx/:type/:hash", + "https://ipfs.oceanprotocol.com/:type/:hash", + "https://d26g9c7mfuzstv.cloudfront.net/:type/:hash", + "https://ipfsgateway.makersplace.com/:type/:hash", + "https://gateway.ravenland.org/:type/:hash", + "https://ipfs.smartsignature.io/:type/:hash", + "https://ipfs.funnychain.co/:type/:hash", + "https://ipfs.telos.miami/:type/:hash", + "https://robotizing.net/:type/:hash", + "https://ipfs.mttk.net/:type/:hash", + "https://ipfs.fleek.co/:type/:hash", + "https://ipfs.jbb.one/:type/:hash", + "https://ipfs.yt/:type/:hash" ]
-
+