diff --git a/src/components/modals/SettingsModal.jsx b/src/components/modals/SettingsModal.jsx index b2b3183b..780515cc 100755 --- a/src/components/modals/SettingsModal.jsx +++ b/src/components/modals/SettingsModal.jsx @@ -45,6 +45,30 @@ const SettingsModal = ({ isOpen, closeModal }) => { const author = {...account?.author, address: ensName}; const { resolvedAddress, state } = useResolvedAuthorAddress({ author, cache: false }); + const isElectron = window.electron && window.electron.isElectron; + + const defaultGatewayUrls = isElectron ? undefined : [ + 'https://ipfs.io', + 'https://ipfsgateway.xyz', + 'https://cloudflare-ipfs.com', + 'https://plebpubsub.live' + ]; + + const defaultPubsubHttpClientsOptions = isElectron ? undefined : [ + 'https://pubsubprovider.xyz/api/v0', + 'https://plebpubsub.live/api/v0' + ]; + + const defaultEthereumRpcUrls = [ + 'ethers.js', + 'https://ethrpc.xyz', + 'viem', + ]; + + const defaultPolygonRpcUrls = [ + 'https://polygon-rpc.com', + ]; + useEffect(() => { if (checkedENS && resolvedAddress && state === 'succeeded') { @@ -85,29 +109,6 @@ const SettingsModal = ({ isOpen, closeModal }) => { setNewErrorMessage(`Failed resolving address, ${ensName}`); } }; - - - const defaultGatewayUrls = [ - 'https://ipfs.io', - 'https://ipfsgateway.xyz', - 'https://cloudflare-ipfs.com', - 'https://plebpubsub.live' - ]; - - const defaultPubsubHttpClientsOptions = [ - 'https://pubsubprovider.xyz/api/v0', - 'https://plebpubsub.live/api/v0' - ]; - - const defaultEthereumRpcUrls = [ - 'ethers.js', - 'https://ethrpc.xyz', - 'viem', - ]; - - const defaultPolygonRpcUrls = [ - 'https://polygon-rpc.com', - ]; const isValidURL = (url) => { @@ -147,22 +148,22 @@ const SettingsModal = ({ isOpen, closeModal }) => { const handleSavePlebbitOptions = async () => { - let gatewayUrls = gatewayRef.current.value.split('\n').filter(url => url.trim()); + let gatewayUrls = gatewayRef.current.value.split('\n').filter((url) => url.trim()); let ipfsClientsOptions = ipfsRef.current.value.split('\n').filter(url => url.trim()); - let pubsubClientsOptions = pubsubRef.current.value.split('\n').filter(url => url.trim()); - - if (!gatewayUrls.length) { - gatewayUrls = defaultGatewayUrls; + let pubsubClientsOptions = pubsubRef.current.value.split('\n').filter((url) => url.trim()); + + if (!isElectron) { + if (!gatewayUrls.length) gatewayUrls = defaultGatewayUrls; + if (!pubsubClientsOptions.length) pubsubClientsOptions = defaultPubsubHttpClientsOptions; + } else { + if (!gatewayUrls.length) gatewayUrls = undefined; + if (!pubsubClientsOptions.length) pubsubClientsOptions = undefined; } if (!ipfsClientsOptions.length) { ipfsClientsOptions = undefined; } - if (!pubsubClientsOptions.length) { - pubsubClientsOptions = defaultPubsubHttpClientsOptions; - } - const invalidUrls = [ ...gatewayUrls || defaultGatewayUrls, ...(ipfsClientsOptions || []), @@ -571,7 +572,7 @@ const SettingsModal = ({ isOpen, closeModal }) => {