From 4068bde89668dec5f01db692ca66bc3c28539705 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Mon, 31 Jul 2023 11:20:18 +0200 Subject: [PATCH 01/11] update video embed reply all.jsx subscriptions.jsx --- src/components/views/All.jsx | 36 +++++++++++++++++++++++--- src/components/views/Board.jsx | 19 +++++++------- src/components/views/Subscriptions.jsx | 36 +++++++++++++++++++++++--- 3 files changed, 74 insertions(+), 17 deletions(-) diff --git a/src/components/views/All.jsx b/src/components/views/All.jsx index 870a0f85..e9fc510b 100755 --- a/src/components/views/All.jsx +++ b/src/components/views/All.jsx @@ -1364,6 +1364,17 @@ const All = () => { replyMediaInfo?.url.slice(0, 30) + "(...)" : replyMediaInfo?.url } ({replyMediaInfo?.type}) + {replyMediaInfo?.type === "video" || "iframe" ? ( + isReplyThumbnailClicked[index] ? ( + + -[ + {handleThumbnailClick(index, 'reply')}}>Close + ] + ) + : null) + : null} {replyMediaInfo?.type === "webpage" ? (
@@ -1390,12 +1401,29 @@ const All = () => {
) : null} {replyMediaInfo?.type === "video" ? ( +
- +
) : null} {replyMediaInfo?.type === "audio" ? ( diff --git a/src/components/views/Board.jsx b/src/components/views/Board.jsx index 53853fc2..582f3e2d 100755 --- a/src/components/views/Board.jsx +++ b/src/components/views/Board.jsx @@ -2018,15 +2018,16 @@ const Board = () => { replyMediaInfo?.url } ({replyMediaInfo?.type}) {replyMediaInfo?.type === "video" || "iframe" ? ( - isReplyThumbnailClicked[index] ? ( - - -[ - {handleThumbnailClick(index, 'reply')}}>Close - ] - ) : null) - : null} + isReplyThumbnailClicked[index] ? ( + + -[ + {handleThumbnailClick(index, 'reply')}}>Close + ] + ) + : null) + : null} {replyMediaInfo?.type === "webpage" ? (
diff --git a/src/components/views/Subscriptions.jsx b/src/components/views/Subscriptions.jsx index 7993a2f0..7e380338 100755 --- a/src/components/views/Subscriptions.jsx +++ b/src/components/views/Subscriptions.jsx @@ -1375,6 +1375,17 @@ const Subscriptions = () => { replyMediaInfo?.url.slice(0, 30) + "(...)" : replyMediaInfo?.url } ({replyMediaInfo?.type}) + {replyMediaInfo?.type === "video" || "iframe" ? ( + isReplyThumbnailClicked[index] ? ( + + -[ + {handleThumbnailClick(index, 'reply')}}>Close + ] + ) + : null) + : null}
{replyMediaInfo?.type === "webpage" ? (
@@ -1401,12 +1412,29 @@ const Subscriptions = () => {
) : null} {replyMediaInfo?.type === "video" ? ( +
- +
) : null} {replyMediaInfo?.type === "audio" ? ( From a7a7001542e173255f7afcf5ad1f48ed9c62c8e3 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Tue, 1 Aug 2023 14:48:47 +0200 Subject: [PATCH 02/11] fix account address update after using signer --- src/components/modals/ReplyModal.jsx | 3 ++- src/components/views/Board.jsx | 3 ++- src/components/views/Catalog.jsx | 3 ++- src/components/views/Thread.jsx | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) 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/views/Board.jsx b/src/components/views/Board.jsx index 582f3e2d..23e7b945 100755 --- a/src/components/views/Board.jsx +++ b/src/components/views/Board.jsx @@ -445,6 +445,7 @@ const Board = () => { ...prevPublishCommentOptions, author: { displayName: nameRef.current.value || undefined, + address: account?.author.address, }, title: subjectRef.current.value || undefined, content: commentRef.current.value || undefined, @@ -482,7 +483,7 @@ const Board = () => { signer, author: { ...prevPublishCommentOptions.author, - address: signer?.address + address: signer?.address, }, }; diff --git a/src/components/views/Catalog.jsx b/src/components/views/Catalog.jsx index 029a9dc3..743b0ac6 100755 --- a/src/components/views/Catalog.jsx +++ b/src/components/views/Catalog.jsx @@ -292,6 +292,7 @@ const Catalog = () => { ...prevPublishCommentOptions, author: { displayName: nameRef.current.value || undefined, + address: account?.author.address, }, title: subjectRef.current.value || undefined, content: commentRef.current.value || undefined, @@ -329,7 +330,7 @@ const Catalog = () => { signer, author: { ...prevPublishCommentOptions.author, - address: signer?.address + address: signer?.address, }, }; diff --git a/src/components/views/Thread.jsx b/src/components/views/Thread.jsx index a3988d30..5ed440d0 100755 --- a/src/components/views/Thread.jsx +++ b/src/components/views/Thread.jsx @@ -386,6 +386,7 @@ const Thread = () => { ...prevPublishCommentOptions, author: { displayName: nameRef.current.value || undefined, + address: account?.author.address, }, content: commentRef.current.value || undefined, link: linkRef.current.value || undefined, @@ -423,7 +424,7 @@ const Thread = () => { signer, author: { ...prevPublishCommentOptions.author, - address: signer?.address + address: signer?.address, }, }; From 80455bd5cf4f14c697e839ad53379f3a3f97e20d Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Tue, 1 Aug 2023 15:47:52 +0200 Subject: [PATCH 03/11] fix ipfs options --- src/components/modals/SettingsModal.jsx | 69 +++++++++++++------------ 1 file changed, 35 insertions(+), 34 deletions(-) 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 }) => {