diff --git a/package.json b/package.json index 370c83ed..e50b2433 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "@babel/plugin-transform-react-jsx": "7.21.0", "@capacitor/android": "3.6.0", "@capacitor/core": "3.6.0", - "@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#d41d7a4f150cecd831aeda57c3ec9edf1c22f9f5", + "@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#5c5521672fac68ab00c83b96614445f7ccfd5b04", "@testing-library/dom": "9.0.1", "@testing-library/jest-dom": "5.14.1", "@testing-library/react": "14.0.0", @@ -71,9 +71,11 @@ }, "browserslist": { "production": [ - ">0.2%", - "not dead", - "not op_mini all" + "chrome >= 67", + "edge >= 79", + "firefox >= 68", + "opera >= 54", + "safari >= 14" ], "development": [ "last 1 chrome version", @@ -132,7 +134,6 @@ "wait-on": "7.0.1" }, "resolutions": { - "styled-components": "^5", - "@adraffy/ens-normalize": "1.8.3" + "styled-components": "^5" } } diff --git a/src/components/modals/ReplyModal.jsx b/src/components/modals/ReplyModal.jsx index 96fb2235..c15ce2fa 100755 --- a/src/components/modals/ReplyModal.jsx +++ b/src/components/modals/ReplyModal.jsx @@ -178,6 +178,7 @@ const ReplyModal = ({ isOpen, closeModal }) => { ...prevPublishCommentOptions, author: { displayName: nameRef.current.value || undefined, + address: account?.author.address, }, content: commentRef.current.value || undefined, link: linkRef.current.value || undefined, @@ -215,7 +216,7 @@ const ReplyModal = ({ isOpen, closeModal }) => { signer, author: { ...prevPublishCommentOptions.author, - address: signer?.address + address: signer?.address, }, }; diff --git a/src/components/modals/SettingsModal.jsx b/src/components/modals/SettingsModal.jsx index b2b3183b..9b09d7e0 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 || []), @@ -445,7 +446,7 @@ const SettingsModal = ({ isOpen, closeModal }) => { {setAnonymousMode(!anonymousMode)}} + onChange={() => {setAnonymousMode(!anonymousMode); window.location.reload();}} />  Anon Mode @@ -571,7 +572,7 @@ const SettingsModal = ({ isOpen, closeModal }) => {