From 7b17039ee8b87a0a814572dae51feeedec42664b Mon Sep 17 00:00:00 2001 From: PhilReact Date: Fri, 10 Jan 2025 21:55:08 +0200 Subject: [PATCH] fixes --- src/components/Chat/ChatOptions.tsx | 4 ++-- src/components/Chat/MessageDisplay.tsx | 2 +- src/components/Chat/styles.css | 3 ++- src/qortalRequests/get.ts | 32 +++++++++++++++++++++----- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/components/Chat/ChatOptions.tsx b/src/components/Chat/ChatOptions.tsx index 42f009c..3640bd1 100644 --- a/src/components/Chat/ChatOptions.tsx +++ b/src/components/Chat/ChatOptions.tsx @@ -168,14 +168,14 @@ export const ChatOptions = ({ messages : untransformedMessages, goToMessage, mem if(isPrivate === false){ return messages .filter((message) => - extractTextFromHTML(message?.messageText)?.includes(`@${myName}`) + extractTextFromHTML(message?.messageText)?.includes(`@${myName?.toLowerCase()}`) ) ?.sort((a, b) => b?.timestamp - a?.timestamp); } return messages .filter((message) => - extractTextFromHTML(message?.decryptedData?.message)?.includes(`@${myName}`) + extractTextFromHTML(message?.decryptedData?.message)?.includes(`@${myName?.toLowerCase()}`) ) ?.sort((a, b) => b?.timestamp - a?.timestamp); }, [messages, myName, isPrivate]); diff --git a/src/components/Chat/MessageDisplay.tsx b/src/components/Chat/MessageDisplay.tsx index 916c7d4..67b8538 100644 --- a/src/components/Chat/MessageDisplay.tsx +++ b/src/components/Chat/MessageDisplay.tsx @@ -80,7 +80,7 @@ export const MessageDisplay = ({ htmlContent, isReply }) => { const sanitizedContent = DOMPurify.sanitize(linkify(htmlContent), { ALLOWED_TAGS: [ 'a', 'b', 'i', 'em', 'strong', 'p', 'br', 'div', 'span', 'img', - 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'code', 'pre', 'table', 'thead', 'tbody', 'tr', 'th', 'td' + 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'code', 'pre', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 's', 'hr' ], ALLOWED_ATTR: [ 'href', 'target', 'rel', 'class', 'src', 'alt', 'title', diff --git a/src/components/Chat/styles.css b/src/components/Chat/styles.css index 21680c8..ba97bb3 100644 --- a/src/components/Chat/styles.css +++ b/src/components/Chat/styles.css @@ -93,7 +93,7 @@ .tiptap hr { border: none; border-top: 1px solid var(--gray-2); - margin: 2rem 0; + margin: 1rem 0; } .ProseMirror:focus-visible { @@ -103,6 +103,7 @@ .tiptap p { font-size: 16px; color: white; /* Ensure paragraph text color is white */ + margin: 0px; } .tiptap p.is-editor-empty:first-child::before { color: #adb5bd; diff --git a/src/qortalRequests/get.ts b/src/qortalRequests/get.ts index 1a964ce..aa9b30b 100644 --- a/src/qortalRequests/get.ts +++ b/src/qortalRequests/get.ts @@ -889,7 +889,7 @@ export const deleteListItems = async (data, isFromExtension) => { if (isGateway) { throw new Error("This action cannot be done through a gateway"); } - const requiredFields = ["list_name", "item"]; + const requiredFields = ["list_name"]; const missingFields: string[] = []; requiredFields.forEach((field) => { if (!data[field]) { @@ -901,15 +901,18 @@ export const deleteListItems = async (data, isFromExtension) => { const errorMsg = `Missing fields: ${missingFieldsString}`; throw new Error(errorMsg); } - - const item = data.item; + if(!data?.item && !data?.items){ + throw new Error('Missing fields: items') + } + const item = data?.item; + const items = data?.items const list_name = data.list_name; const resPermission = await getUserPermission( { text1: "Do you give this application permission to", text2: `Remove the following from the list ${list_name}:`, - highlightedText: item, + highlightedText: items ? JSON.stringify(items) : item, }, isFromExtension ); @@ -918,7 +921,7 @@ export const deleteListItems = async (data, isFromExtension) => { if (accepted) { const url = await createEndpoint(`/lists/${list_name}`); const body = { - items: [item], + items: items || [item], }; const bodyToString = JSON.stringify(body); const response = await fetch(url, { @@ -1781,10 +1784,17 @@ export const getUserWallet = async (data, isFromExtension) => { const errorMsg = `Missing fields: ${missingFieldsString}`; throw new Error(errorMsg); } + const isGateway = await isRunningGateway(); + + if (data?.coin === "ARRR" && isGateway) + throw new Error( + "Cannot view ARRR wallet info through the gateway. Please use your local node." + ); const resPermission = await getUserPermission( { text1: "Do you give this application permission to get your wallet information?", + highlightedText: `coin: ${data.coin}`, }, isFromExtension ); @@ -1827,7 +1837,7 @@ export const getUserWallet = async (data, isFromExtension) => { break; case "BTC": userWallet["address"] = parsedData.btcAddress; - userWallet["publickey"] = parsedData.derivedMasterPublicKey; + userWallet["publickey"] = parsedData.btcPublicKey; break; case "LTC": userWallet["address"] = parsedData.ltcAddress; @@ -1846,6 +1856,7 @@ export const getUserWallet = async (data, isFromExtension) => { userWallet["publickey"] = parsedData.rvnPublicKey; break; case "ARRR": + await checkArrrSyncStatus(parsedData.arrrSeed58) userWallet["address"] = arrrAddress; break; default: @@ -2088,10 +2099,17 @@ export const getUserWalletInfo = async (data, isFromExtension) => { const errorMsg = `Missing fields: ${missingFieldsString}`; throw new Error(errorMsg); } + if(data?.coin === 'ARRR'){ + + throw new Error( + "ARRR is not supported for this call." + ); + } const resPermission = await getUserPermission( { text1: "Do you give this application permission to retrieve your wallet information", + highlightedText: `coin: ${data.coin}`, }, isFromExtension ); @@ -2100,6 +2118,8 @@ export const getUserWalletInfo = async (data, isFromExtension) => { if (accepted) { let coin = data.coin; let walletKeys = await getUserWalletFunc(coin); + + const _url = await createEndpoint( `/crosschain/` + data.coin.toLowerCase() + `/addressinfos` );