diff --git a/package-lock.json b/package-lock.json index cb1cf7418..257a84437 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,7 +36,7 @@ "ipfs-css": "^1.4.0", "ipfs-geoip": "^9.1.0", "ipfs-provider": "^2.1.0", - "ipld-explorer-components": "^7.0.2", + "ipld-explorer-components": "^7.0.3", "is-ipfs": "^8.0.1", "istextorbinary": "^6.0.0", "it-all": "^1.0.5", @@ -3868,14 +3868,14 @@ } }, "node_modules/@helia/bitswap": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@helia/bitswap/-/bitswap-1.1.3.tgz", - "integrity": "sha512-nCszNky/kOxaj1CZrZbzzFz6Fn7uNWigudn4KaLV+ZuFx6xyB8+t6aCmjKQ59me0WA3mwkmHkPtUOi9Y75zLSw==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@helia/bitswap/-/bitswap-1.1.4.tgz", + "integrity": "sha512-BcmIc2FZ0NEjSYrwJxzFO5OapcOCBfcHmaBKaDoPNVh1egLLUkws2a7C3hPH5ZR7PXGQPXonH1YFz1CKYypzgA==", "license": "Apache-2.0 OR MIT", "dependencies": { "@helia/interface": "^4.3.1", "@helia/utils": "^0.3.3", - "@libp2p/interface": "^1.1.2", + "@libp2p/interface": "^1.1.4", "@libp2p/logger": "^4.0.5", "@libp2p/peer-collections": "^5.1.6", "@libp2p/utils": "^5.2.3", @@ -3910,19 +3910,19 @@ } }, "node_modules/@helia/bitswap/node_modules/interface-blockstore": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/interface-blockstore/-/interface-blockstore-5.3.0.tgz", - "integrity": "sha512-MsOE2H9duZdpxXk7KVOQLaQnX4LfqHegshKxSr4b/YD44t13koT5Lg4lphZ0FwB5uvtvqQPm7LNcS0T/5Z2YUQ==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/interface-blockstore/-/interface-blockstore-5.3.1.tgz", + "integrity": "sha512-nhgrQnz6yUQEqxTFLhlOBurQOy5lWlwCpgFmZ3GTObTVTQS9RZjK/JTozY6ty9uz2lZs7VFJSqwjWAltorJ4Vw==", "license": "Apache-2.0 OR MIT", "dependencies": { - "interface-store": "6.0.0", - "multiformats": "^13.0.1" + "interface-store": "^6.0.0", + "multiformats": "^13.2.3" } }, "node_modules/@helia/bitswap/node_modules/interface-blockstore/node_modules/interface-store": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/interface-store/-/interface-store-6.0.0.tgz", - "integrity": "sha512-HkjsDPsjA7SKkCr+TH1elUQApAAM3X3JPwrz3vFzaf614wI+ZD6GVvwKGZCHYcbSRqeZP/uzVPqezzeISeo5kA==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/interface-store/-/interface-store-6.0.2.tgz", + "integrity": "sha512-KSFCXtBlNoG0hzwNa0RmhHtrdhzexp+S+UY2s0rWTBJyfdEIgn6i6Zl9otVqrcFYbYrneBT7hbmHQ8gE0C3umA==", "license": "Apache-2.0 OR MIT" }, "node_modules/@helia/bitswap/node_modules/interface-store": { @@ -4032,12 +4032,12 @@ } }, "node_modules/@helia/block-brokers": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@helia/block-brokers/-/block-brokers-3.0.3.tgz", - "integrity": "sha512-xSnmWv1jgeBJURcdF/KFOHEa1CQygk3jm1qxYPYqnMWxRXhsFG5Qi13EA+QfslCXyywfxbr4yJWleUUV2Mw4oQ==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@helia/block-brokers/-/block-brokers-3.0.4.tgz", + "integrity": "sha512-ymtV2cNrVeRoXsAOTpx558nDzfyOu87bLAewF98OVZ/NB28EUTy0c592GHLX3QcMaW/XfTzSGCi+te3fvVIuQg==", "license": "Apache-2.0 OR MIT", "dependencies": { - "@helia/bitswap": "^1.1.3", + "@helia/bitswap": "^1.1.4", "@helia/interface": "^4.3.1", "@helia/utils": "^0.3.3", "@libp2p/interface": "^1.1.4", @@ -42236,12 +42236,12 @@ } }, "node_modules/ipld-explorer-components": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/ipld-explorer-components/-/ipld-explorer-components-7.0.2.tgz", - "integrity": "sha512-e8LApY0pC7Fmf1m8UsnRMVOusLEkupjVtk6W5tzpArtdVppLQiCYvFtcwVvPUHRaC5JlTEahacIdBkotwXTuXg==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/ipld-explorer-components/-/ipld-explorer-components-7.0.3.tgz", + "integrity": "sha512-YPDji6NncHOO8dPX8vkv/UOnI5YS8dZ12ngjkQGKD/FunGm1ULqNGyCeOtps221tHhmGAgZUxXAVijibUXFUUQ==", "license": "Apache-2.0 OR MIT", "dependencies": { - "@helia/block-brokers": "^3.0.3", + "@helia/block-brokers": "^3.0.4", "@helia/http": "^1.0.10", "@helia/interface": "^4.3.1", "@helia/routers": "^1.1.1", @@ -54741,9 +54741,9 @@ } }, "node_modules/multiformats": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-13.2.2.tgz", - "integrity": "sha512-RWI+nyf0q64vyOxL8LbKtjJMki0sogRL/8axvklNtiTM0iFCVtHwME9w6+0P1/v4dQvsIg8A45oT3ka1t/M/+A==", + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-13.3.0.tgz", + "integrity": "sha512-CBiqvsufgmpo01VT5ze94O+uc+Pbf6f/sThlvWss0sBZmAOu6GQn5usrYV2sf2mr17FWYc0rO8c/CNe2T90QAA==", "license": "Apache-2.0 OR MIT" }, "node_modules/multimatch": { diff --git a/package.json b/package.json index 67dc16c17..374d1762b 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "ipfs-css": "^1.4.0", "ipfs-geoip": "^9.1.0", "ipfs-provider": "^2.1.0", - "ipld-explorer-components": "^7.0.2", + "ipld-explorer-components": "^7.0.3", "is-ipfs": "^8.0.1", "istextorbinary": "^6.0.0", "it-all": "^1.0.5", diff --git a/src/App.js b/src/App.js index efca47bc2..8b53cab54 100644 --- a/src/App.js +++ b/src/App.js @@ -21,6 +21,7 @@ import FilesExploreForm from './files/explore-form/FilesExploreForm.js' export class App extends Component { static propTypes = { + doSetupLocalStorage: PropTypes.func.isRequired, doTryInitIpfs: PropTypes.func.isRequired, doInitHelia: PropTypes.func.isRequired, doUpdateUrl: PropTypes.func.isRequired, @@ -32,6 +33,11 @@ export class App extends Component { isOver: PropTypes.bool.isRequired } + constructor (props) { + super(props) + props.doSetupLocalStorage() + } + componentDidMount () { this.props.doTryInitIpfs() this.props.doInitHelia() @@ -131,6 +137,7 @@ export default connect( 'doExploreUserProvidedPath', 'doUpdateUrl', 'doUpdateHash', + 'doSetupLocalStorage', 'doTryInitIpfs', 'doInitHelia', 'doFilesWrite', diff --git a/src/bundles/ipfs-provider.js b/src/bundles/ipfs-provider.js index 7e6893e3a..30732afa2 100644 --- a/src/bundles/ipfs-provider.js +++ b/src/bundles/ipfs-provider.js @@ -315,6 +315,25 @@ const selectors = { */ const actions = { + + doSetupLocalStorage: () => async () => { + /** For the Explore page (i.e. ipld-explorer-components) */ + const useRemoteGatewaysToExplore = localStorage.getItem('explore.ipld.gatewayEnabled') + if (useRemoteGatewaysToExplore === null) { + // by default, disable remote gateways for the Explore page (i.e. ipld-explorer-components) + await writeSetting('explore.ipld.gatewayEnabled', false) + } + + const kuboGateway = readSetting('kuboGateway') + if (kuboGateway === null || typeof kuboGateway === 'string' || typeof kuboGateway === 'boolean' || typeof kuboGateway === 'number') { + // empty or invalid, set defaults + await writeSetting('kuboGateway', { trustlessBlockBrokerConfig: { init: { allowLocal: true, allowInsecure: false } } }) + } else if (/** @type {Record} */(kuboGateway).trustlessBlockBrokerConfig == null) { + // missing trustlessBlockBrokerConfig, set defaults + await writeSetting('kuboGateway', { ...kuboGateway, trustlessBlockBrokerConfig: { init: { allowLocal: true, allowInsecure: false } } }) + } + }, + /** * @returns {function(Context):Promise} */