@@ -8,8 +8,6 @@ import RecommendationItem from '../components/books/RecommendationItem.astro';
88import BooksFooter from ' ../components/books/BooksFooter.astro' ;
99import Spinner from ' ../components/utils/LoaderSpin.vue' ;
1010
11-
12-
1311const books = [
1412 {
1513 id:0 ,
@@ -165,6 +163,7 @@ const books = [
165163 ]
166164 }
167165];
166+
168167const recs = [
169168 {
170169 title: $tr (' The Nature of the Firm' ),
@@ -221,22 +220,29 @@ const gateways = [
221220 ' https://gw.crust-gateway.com/ipfs/' ,
222221 ' https://gateway.pinata.cloud/ipfs/' ,
223222 ' https://ipfs.io/ipfs/' ,
223+ ' https://hardbin.com/ipfs/' ,
224+ ' https://ipfs.eth.aragon.network/ipfs/' ,
225+ ' https://nftstorage.link/ipfs/' ,
226+ ' https://4everland.io/ipfs/' ,
227+ ' https://w3s.link/ipfs/' ,
228+ ' https://trustless-gateway.link/ipfs/'
224229];
225230
226231let bookGateway = null ;
227232
228233try {
229- const res = await pingIPFS (gateways );
230- console .log (res )
231- if (res .ok ) {
232- bookGateway = gateway ;
233- console .log (res )
234+ const result = await pingIPFS (gateways );
235+ if (result ) {
236+ bookGateway = result ;
237+ console .log (" ✅ Selected IPFS Gateway:" , bookGateway );
238+ } else {
239+ console .warn (" ⚠️ No working gateway found via pingIPFS(), using fallback." );
240+ bookGateway = ' https://gw.crust-gateway.xyz/ipfs/' ;
234241 }
235- } catch {
236- bookGateway = ' https://gw.crust- gateway.xyz/ipfs/ ' ;
242+ } catch ( err ) {
243+ console . error ( " ❌ pingIPFS() failed, using fallback gateway. Error: " , err ) ;
237244}
238245
239- bookGateway = bookGateway ? bookGateway : ' https://gw.crust-gateway.xyz/ipfs/' ;
240246---
241247
242248<Layout
@@ -245,6 +251,7 @@ bookGateway = bookGateway ? bookGateway : 'https://gw.crust-gateway.xyz/ipfs/';
245251 pageTitle ={ $tr (" Read books" )}
246252>
247253
254+ <p >Selected IPFS Gateway: { Astro .props .gateway } </p >
248255 <section class =" layout layout__content e-books" >
249256 <div class =" layout__text books__abstract" >
250257 <p >{ $tr (" We think reading books can really open up your mind. Whether it's simple but smart ideas or more complex ones, books are the best way for your brain to soak it all in. You can grab our books for free and check out our list of recommended reads to dive into the exciting world of robotics!" )} </p >
0 commit comments