From d14265f86547e0b69d5537cb2bd116122c53127b Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Thu, 23 Jan 2025 22:14:21 -0500 Subject: [PATCH 01/18] v1.03b from QDN --- assets/js/ARBoard.js | 5 ++--- assets/js/AdminTools.js | 6 +++--- index.html | 22 ++++++++++++++++++++-- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/assets/js/ARBoard.js b/assets/js/ARBoard.js index 05e7fed..b86332a 100644 --- a/assets/js/ARBoard.js +++ b/assets/js/ARBoard.js @@ -164,9 +164,8 @@ const fetchAllARTxData = async () => { // Filter out members with both pending and non-pending transactions return Object.values(adminTxMap) - .filter((txs) => !(txs.some(tx => tx.approvalStatus === 'PENDING') && - txs.some(tx => tx.approvalStatus !== 'PENDING'))) - .flat() + .filter(txs => txs.every(tx => tx.approvalStatus !== 'PENDING')) + .flat() } // Fetch ban transactions diff --git a/assets/js/AdminTools.js b/assets/js/AdminTools.js index f5c3907..0a0177e 100644 --- a/assets/js/AdminTools.js +++ b/assets/js/AdminTools.js @@ -28,10 +28,10 @@ async function loadMinterAdminToolsPage() { User Avatar ${userState.accountName || 'Guest'} -

No Functionality Here Yet

+

COMING SOON...

-

This page is still under development. Until the final Mintership proposal modifications are made, and the MINTER group is transferred to null, there is no need for this page's functionality. The page will be updated when the final modifications are made.

-

This page until then is simply a placeholder.

+

This page will have functionality to assist the Minter Admins in performing their duties. It will display all pending transactions (of any kind they can approve/deny) along with that ability. It can also be utilized to obtain more in-depth information about existing accounts.

+

The page will be getting a significant overhaul in the near(ish) future, as the MINTER group is now owned by null, and we are past the 'temporary state' we were in for much longer than planned.

diff --git a/index.html b/index.html index 94cb5f1..e96c9fe 100644 --- a/index.html +++ b/index.html @@ -191,6 +191,24 @@
+
+
+
+
+

+ v1.03beta 01-23-2025

+
+
+
+
+

+ v1.03b Fixes- Filtering issue resolved - Version 1.02 had a filtering logic modification applied to add and remove admin transactions. However, it was not changed on the REMOVE filtering, so REMOVE transactions that were PENDING were showing as COMPLETE and thus the board was displaying cards as already removed when there was only a PENDING tx. This has been resolved in 1.03b. +

+
+
+
+
+
@@ -536,12 +554,12 @@
-

Q-Mintership (v1.02b)

+

Q-Mintership (v1.03b)

- +
-- 2.43.0 From 5771c0817233355b379120874eea96b8c1b0df61 Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Thu, 23 Jan 2025 22:14:33 -0500 Subject: [PATCH 02/18] fix version number --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index e96c9fe..ed3c7be 100644 --- a/index.html +++ b/index.html @@ -42,7 +42,7 @@ - Q-Mintership (v1.02b) + Q-Mintership (v1.03b)
@@ -61,7 +61,7 @@ - Q-Mintership v1.02b
+ Q-Mintership v1.03b
-- 2.43.0 From 80ac7ef06a180729f0bdc1c3424f2682fa00a638 Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Thu, 23 Jan 2025 22:15:57 -0500 Subject: [PATCH 03/18] fix for names with quotes or apostrophes --- assets/js/MinterBoard.js | 20 +++++++++++++++----- assets/js/QortalApi.js | 3 ++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/assets/js/MinterBoard.js b/assets/js/MinterBoard.js index 788b8b5..b5dad0a 100644 --- a/assets/js/MinterBoard.js +++ b/assets/js/MinterBoard.js @@ -1297,14 +1297,24 @@ const handleInviteMinter = async (minterName) => { } } +function escapeForHtmlAttribute(str) { + return str + .replace(/'/g, ''') + .replace(/"/g, '"'); +} + const createInviteButtonHtml = (creator, cardIdentifier) => { + // Safely escape special chars so they won't break the HTML attribute + const safeCreator = escapeForHtmlAttribute(creator); + return `
-
diff --git a/assets/js/QortalApi.js b/assets/js/QortalApi.js index 0108f4a..442f0c8 100644 --- a/assets/js/QortalApi.js +++ b/assets/js/QortalApi.js @@ -331,7 +331,8 @@ const getNameInfo = async (name) => { console.log('getNameInfo called') console.log('name:', name) try { - const response = await fetch(`${baseUrl}/names/${name}`) + // Encode the name for URL safety + const response = await fetch(`${baseUrl}/names/${encodeURIComponent(name)}`) if (!response.ok) { console.warn(`Failed to fetch name info for: ${name}, status: ${response.status}`) -- 2.43.0 From ec283ef42fa318a690ea7a4e0916f11af1bd025e Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Thu, 23 Jan 2025 22:23:46 -0500 Subject: [PATCH 04/18] set voted card colors to avg of current & previous --- assets/js/AdminBoard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/AdminBoard.js b/assets/js/AdminBoard.js index cc82ffa..221a12d 100644 --- a/assets/js/AdminBoard.js +++ b/assets/js/AdminBoard.js @@ -1286,9 +1286,9 @@ const createEncryptedCardHTML = async (cardData, pollResults, cardIdentifier, co const removeActionsHtml = await checkAndDisplayRemoveActions(adminYes, verifiedName, cardIdentifier) showRemoveHtml = removeActionsHtml if (userVote === 0) { - cardColorCode = "rgba(1, 65, 39, 0.41)"; // or any green you want + cardColorCode = "rgba(1, 128, 20, 0.35)"; // or any green you want } else if (userVote === 1) { - cardColorCode = "rgba(55, 12, 12, 0.61)"; // or any red you want + cardColorCode = "rgba(124, 6, 6, 0.45)"; // or any red you want } if (banTransactions.some((banTx) => banTx.groupId === 694 && banTx.offender === accountAddress)){ -- 2.43.0 From b249f6b370ba5a0ba9cc6aa0b515d28c00b46ac8 Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Thu, 23 Jan 2025 22:38:54 -0500 Subject: [PATCH 05/18] add sorting to ARA board --- assets/js/ARBoard.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/assets/js/ARBoard.js b/assets/js/ARBoard.js index b86332a..c52e296 100644 --- a/assets/js/ARBoard.js +++ b/assets/js/ARBoard.js @@ -59,6 +59,13 @@ const loadAddRemoveAdminPage = async () => {

Existing Promotion/Demotion Proposals

+
@@ -91,6 +98,14 @@ const loadAddRemoveAdminPage = async () => { await loadCards(addRemoveIdentifierPrefix) }) + document.getElementById("sort-select").addEventListener("change", async () => { + // Optionally clear or show a message while loading + const cardsContainer = document.getElementById("cards-container"); + cardsContainer.innerHTML = "

Refreshing cards...

"; + // Re-load the cards using the same function that handles sorting logic + await loadCards(addRemoveIdentifierPrefix); + }); + document.getElementById("cancel-publish-button").addEventListener("click", async () => { // const cardsContainer = document.getElementById("existing-proposals-section") // cardsContainer.style.display = "flex" // Restore visibility -- 2.43.0 From 79f9d771767961f2488912af7bd1c696bce182f7 Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Fri, 24 Jan 2025 05:54:01 -0500 Subject: [PATCH 06/18] fix approval admin name color --- assets/js/MinterBoard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/MinterBoard.js b/assets/js/MinterBoard.js index b5dad0a..ef40f81 100644 --- a/assets/js/MinterBoard.js +++ b/assets/js/MinterBoard.js @@ -1656,7 +1656,7 @@ async function buildApprovalTableHtml(approvalTxs, getNameFunc) { return ` - ${displayName} + ${displayName} ${dateStr} ` -- 2.43.0 From 9826fbf00533179db2f5c38dd65ab53cd52507df Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Fri, 24 Jan 2025 06:02:03 -0500 Subject: [PATCH 07/18] highlight current approval admin row --- assets/js/MinterBoard.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/assets/js/MinterBoard.js b/assets/js/MinterBoard.js index ef40f81..45d0de0 100644 --- a/assets/js/MinterBoard.js +++ b/assets/js/MinterBoard.js @@ -1654,8 +1654,18 @@ async function buildApprovalTableHtml(approvalTxs, getNameFunc) { // Format the transaction timestamp const dateStr = new Date(tx.timestamp).toLocaleString() + // Check whether this is the current user + const isCurrentUser = + userState && + userState.accountName && + adminName && + adminName.toLowerCase() === userState.accountName.toLowerCase(); + // If it's the current user, highlight the row (change to any color/style you prefer) + const rowStyle = isCurrentUser + ? "background: rgba(178, 255, 89, 0.2);" // light green highlight + : ""; return ` - + ${displayName} ${dateStr} @@ -1669,6 +1679,8 @@ async function buildApprovalTableHtml(approvalTxs, getNameFunc) { // 4) Wrap the table in a container with horizontal scroll: // 1) max-width: 100% makes it fit the parent (card) width // 2) overflow-x: auto allows scrolling if the table is too wide + + // TODO - if "Admin Name" == userState.accountName, then table row should be highlighted const containerHtml = `
-- 2.43.0 From e4a5e752b23c6b5da46d04d2b7de81b495fe6c59 Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Sat, 25 Jan 2025 00:54:31 -0500 Subject: [PATCH 08/18] add card deletion to ARA board --- assets/js/ARBoard.js | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/assets/js/ARBoard.js b/assets/js/ARBoard.js index c52e296..a36caca 100644 --- a/assets/js/ARBoard.js +++ b/assets/js/ARBoard.js @@ -717,6 +717,47 @@ const handleRemoveMinterGroupAdmin = async (name, address) => { } } +// ADDED: A simple function to effectively 'delete' an AR Board card +// by publishing an empty card with the same identifier and prefix +const deleteARCard = async (cardIdentifier, prefix) => { + try { + const confirmed = confirm("Are you sure you want to delete this card? This action cannot be undone."); + if (!confirmed) return; + + // A minimal blank object + const blankData = { + header: "", + content: "", + links: [], + creator: userState.accountName, + timestamp: Date.now(), + poll: "" // or null. This ensures it won't appear as a valid poll card + }; + + let base64Data = await objectToBase64(blankData); + if (!base64Data) { + base64Data = btoa(JSON.stringify(blankData)); + } + + await qortalRequest({ + action: "PUBLISH_QDN_RESOURCE", + name: userState.accountName, + service: "BLOG_POST", // same as all ARBoard content + identifier: cardIdentifier, + data64: base64Data, + }); + + alert("Your card has been effectively deleted."); + + // Now reload the existing ARBoard cards so the UI no longer shows the old card + await loadCards(prefix); + + } catch (error) { + console.error("Error deleting AR card:", error); + alert("Failed to delete the card. Check console for details."); + } +}; + const fallbackMinterCheck = async (minterName, minterGroupMembers, minterAdmins) => { // Ensure we have addresses if (!minterGroupMembers) { @@ -893,6 +934,16 @@ const createARCardHTML = async (cardData, pollResults, cardIdentifier, commentCo + ${creator === userState.accountName ? ` +
+ +
+ ` : ''} + ${creator === userState.accountName ? ` +
+ +
+ ` : ''} + ${creator === userState.accountName ? ` +
+ +
+ ` : ''} @@ -61,7 +65,7 @@ - Q-Mintership v1.03b
+ @@ -554,12 +558,12 @@
-

Q-Mintership (v1.03b)

+

- +
@@ -572,6 +576,12 @@
+ -- 2.43.0 From 653669e0b9dfb4e43485aa5d59b58d11f206cac5 Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Sat, 25 Jan 2025 03:34:29 -0500 Subject: [PATCH 12/18] add count of minter admins & signatures needed to ARA board --- assets/js/ARBoard.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/assets/js/ARBoard.js b/assets/js/ARBoard.js index a36caca..344ed3a 100644 --- a/assets/js/ARBoard.js +++ b/assets/js/ARBoard.js @@ -28,7 +28,6 @@ const loadAddRemoveAdminPage = async () => {

-

Existing Minter Admins

@@ -223,6 +222,9 @@ const displayExistingMinterAdmins = async () => { // 1) Fetch addresses const admins = await fetchMinterGroupAdmins() minterAdminAddresses = admins.map(m => m.member) + // Compute total admin count and signatures needed (40%, rounded up) + const totalAdmins = admins.length; + const signaturesNeeded = Math.ceil(totalAdmins * 0.40); let rowsHtml = ""; for (const adminAddr of admins) { if (adminAddr.member === nullAddress) { @@ -282,7 +284,11 @@ const displayExistingMinterAdmins = async () => {
` - adminListContainer.innerHTML = tableHtml + adminListContainer.innerHTML = ` +

Existing Minter Admins: ${totalAdmins}

+

Signatures for Group Approval (40%): ${signaturesNeeded}

+ ${tableHtml} + `; } catch (err) { console.error("Error fetching minter admins:", err) adminListContainer.innerHTML = -- 2.43.0 From 4b7f811785f32c2b72973d88f796aadb7a8ca339 Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Sat, 25 Jan 2025 04:06:43 -0500 Subject: [PATCH 13/18] add button to show/hide minter admin list in ARA board --- assets/js/ARBoard.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/assets/js/ARBoard.js b/assets/js/ARBoard.js index 344ed3a..200d0a1 100644 --- a/assets/js/ARBoard.js +++ b/assets/js/ARBoard.js @@ -140,6 +140,19 @@ const toggleProposeButton = () => { proposeButton.style.display === 'flex' ? 'none' : 'flex' } +const toggleAdminTable = () => { + const tableContainer = document.getElementById("adminTableContainer"); + const toggleBtn = document.getElementById("toggleAdminTableButton"); + + if (tableContainer.style.display === "none") { + tableContainer.style.display = "block"; + toggleBtn.textContent = "Hide Minter Admins"; + } else { + tableContainer.style.display = "none"; + toggleBtn.textContent = "Show Minter Admins"; + } +}; + let addAdminTxs let remAdminTxs @@ -271,6 +284,22 @@ const displayExistingMinterAdmins = async () => { } // 3) Build the table const tableHtml = ` +
+ +
+ ` adminListContainer.innerHTML = `

Existing Minter Admins: ${totalAdmins}

-- 2.43.0 From d0dda6d306ba9ffdb4e2cc578e97babcfabb3fb0 Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Sat, 25 Jan 2025 06:13:56 -0500 Subject: [PATCH 14/18] fix rounding error for signature count --- assets/js/MinterBoard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/MinterBoard.js b/assets/js/MinterBoard.js index 49cb0b9..d56f1a1 100644 --- a/assets/js/MinterBoard.js +++ b/assets/js/MinterBoard.js @@ -1347,7 +1347,7 @@ const checkAndDisplayInviteButton = async (adminYes, creator, cardIdentifier) => let minAdminCount = 9 if (isBlockPassed) { - minAdminCount = Math.round(minterAdmins.length * 0.4) + minAdminCount = Math.ceil(minterAdmins.length * 0.4) console.warn(`Using 40% => ${minAdminCount}`) } -- 2.43.0 From b1b8f1abd4c17fc354f59323d32b3dde6a86daec Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Sat, 25 Jan 2025 06:18:34 -0500 Subject: [PATCH 15/18] fix more rounding errors --- assets/js/ARBoard.js | 2 +- assets/js/AdminBoard.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/ARBoard.js b/assets/js/ARBoard.js index 200d0a1..2871e3d 100644 --- a/assets/js/ARBoard.js +++ b/assets/js/ARBoard.js @@ -592,7 +592,7 @@ const checkAndDisplayActions = async (adminYes, name, cardIdentifier) => { } else if ((minterAdmins) && (minterAdmins.length > 1) && isBlockPassed){ const totalAdmins = minterAdmins.length const fortyPercent = totalAdmins * 0.40 - minAdminCount = Math.round(fortyPercent) + minAdminCount = Math.ceil(fortyPercent) console.warn(`this is another check to ensure minterAdmin group has more than 1 admin. IF so we will calculate the 40% needed for GROUP_APPROVAL, that number is: ${minAdminCount}`) } const addressInfo = await getNameInfo(name) diff --git a/assets/js/AdminBoard.js b/assets/js/AdminBoard.js index 6aec6af..c65c57d 100644 --- a/assets/js/AdminBoard.js +++ b/assets/js/AdminBoard.js @@ -1049,7 +1049,7 @@ const checkAndDisplayRemoveActions = async (adminYes, name, cardIdentifier) => { } else if ((minterAdmins) && (minterAdmins.length > 1) && isBlockPassed){ const totalAdmins = minterAdmins.length const fortyPercent = totalAdmins * 0.40 - minAdminCount = Math.round(fortyPercent) + minAdminCount = Math.ceil(fortyPercent) console.warn(`this is another check to ensure minterAdmin group has more than 1 admin. IF so we will calculate the 40% needed for GROUP_APPROVAL, that number is: ${minAdminCount}`) } if (isBlockPassed && userState.isMinterAdmin) { -- 2.43.0 From 6a971c9ced7f92d66634eee8572cce040b818c7f Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Sun, 26 Jan 2025 21:32:00 -0500 Subject: [PATCH 16/18] always show group invite tx approvals --- assets/js/MinterBoard.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/assets/js/MinterBoard.js b/assets/js/MinterBoard.js index d56f1a1..7c80f9a 100644 --- a/assets/js/MinterBoard.js +++ b/assets/js/MinterBoard.js @@ -1337,11 +1337,6 @@ const featureTriggerCheck = async () => { const checkAndDisplayInviteButton = async (adminYes, creator, cardIdentifier) => { - if (!userState.isMinterAdmin){ - console.warn(`User is NOT an admin, not displaying invite/approve button...`) - return null - } - const isBlockPassed = await featureTriggerCheck() const minterAdmins = await fetchMinterGroupAdmins() @@ -1388,7 +1383,7 @@ const checkAndDisplayInviteButton = async (adminYes, creator, cardIdentifier) => console.warn(`PriorBanOrKick determination:`, priorBanOrKick) - const inviteButtonHtml = createInviteButtonHtml(creator, cardIdentifier) + const inviteButtonHtml = userState.isMinterAdmin ? createInviteButtonHtml(creator, cardIdentifier) : '' const groupApprovalHtml = await checkGroupApprovalAndCreateButton(minterAddress, cardIdentifier, "GROUP_INVITE") if (!priorBanOrKick) { @@ -1477,7 +1472,8 @@ const checkGroupApprovalAndCreateButton = async (address, cardIdentifier, transa Existing ${transactionType} Approvals: ${uniqueApprovalCount}

${tableHtml} -
+ ${userState.isMinterAdmin ? + `