From 3901f8837332dfad1251fa89f1e3fe38716e8fb5 Mon Sep 17 00:00:00 2001 From: Shane Lx <39976362+shanefully-done@users.noreply.github.com> Date: Sat, 26 Jul 2025 10:40:30 +0900 Subject: [PATCH] Remove paywall --- popup.html | 2 +- popup.js | 126 ++++++----------------------------------------------- 2 files changed, 15 insertions(+), 113 deletions(-) diff --git a/popup.html b/popup.html index c84b12c..bc950f1 100644 --- a/popup.html +++ b/popup.html @@ -28,7 +28,7 @@ - + diff --git a/popup.js b/popup.js index dd0e073..55ecadc 100644 --- a/popup.js +++ b/popup.js @@ -90,129 +90,31 @@ function initializeButtons() { bulkArchiveButton.addEventListener("click", handleBulkArchive); } -const storageKey = "BulkDeleteChatGPT_isPaid"; +// Payment logic removed - bulk archive is now free async function checkMembershipStatus() { - const localIsPaid = localStorage.getItem(storageKey) === "true"; - - updateBulkArchiveButton(localIsPaid); - - const userInfo = await getUserInfo(); - if (!userInfo) { - console.error("Unable to get user info"); - return; - } - - try { - const response = await fetch( - `https://bulk-delete-chatgpt-worker.qcrao.com/check-payment-status?user_id=${encodeURIComponent( - userInfo.id - )}` - ); - const data = await response.json(); - - // 更新本地存储和按钮状态 - localStorage.setItem(storageKey, data.isPaid); - updateBulkArchiveButton(data.isPaid); - } catch (error) { - console.error("Error checking membership status:", error); - } + // Removed payment checking logic + updateBulkArchiveButton(true); // Always enable bulk archive } function updateBulkArchiveButton(isPaid) { const bulkArchiveButton = document.getElementById("bulk-archive"); - if (isPaid) { - bulkArchiveButton.querySelector("span").textContent = ""; - } else { - bulkArchiveButton.querySelector("span").textContent = "🔒"; - } + // Always enable bulk archive (no lock icon) + bulkArchiveButton.querySelector("span").textContent = ""; } async function handleBulkArchive() { - const localIsPaid = localStorage.getItem(storageKey) === "true"; - if (localIsPaid) { - chrome.tabs.query({ active: true, currentWindow: true }, ([tab]) => { - if (tab) { - const bulkArchiveButton = document.getElementById("bulk-archive"); - bulkArchiveButton.disabled = true; - bulkArchiveButton.classList.add("progress"); - loadGlobalsThenExecute(tab.id, "bulkArchiveConversations.js"); - } - }); - return; - } - - const userInfo = await getUserInfo(); - if (!userInfo) { - console.error("Unable to get user info"); - alert("Unable to verify user. Please try again later."); - return; - } - - const response = await fetch( - `https://bulk-delete-chatgpt-worker.qcrao.com/check-payment-status?user_id=${encodeURIComponent( - userInfo.id - )}` - ); - const data = await response.json(); - - if (data.isPaid) { - chrome.tabs.query({ active: true, currentWindow: true }, ([tab]) => { - if (tab) { - const bulkArchiveButton = document.getElementById("bulk-archive"); - bulkArchiveButton.disabled = true; - bulkArchiveButton.classList.add("progress"); - - loadGlobalsThenExecute(tab.id, "bulkArchiveConversations.js"); - } - }); - } else { - showModal().then(async (result) => { - if (result) { - const payResponse = await fetch( - `https://bulk-delete-chatgpt-worker.qcrao.com/pay-bulk-archive?user_id=${encodeURIComponent( - userInfo.id - )}`, - { method: "POST" } - ); - const payData = await payResponse.json(); - console.log("payData", payData); - if (payData.paymentUrl) { - window.open(payData.paymentUrl, "_blank"); - } else { - alert("Failed to get payment link. Please try again later."); - } - } - }); - } -} - -function showModal() { - return new Promise((resolve) => { - const modal = document.getElementById("customModal"); - const okButton = document.getElementById("modalOK"); - const cancelButton = document.getElementById("modalCancel"); - - modal.style.display = "block"; - - okButton.onclick = () => { - modal.style.display = "none"; - resolve(true); - }; - - cancelButton.onclick = () => { - modal.style.display = "none"; - resolve(false); - }; - - window.onclick = (event) => { - if (event.target == modal) { - modal.style.display = "none"; - resolve(false); - } - }; + // Removed payment requirements - bulk archive is now free for everyone + chrome.tabs.query({ active: true, currentWindow: true }, ([tab]) => { + if (tab) { + const bulkArchiveButton = document.getElementById("bulk-archive"); + bulkArchiveButton.disabled = true; + bulkArchiveButton.classList.add("progress"); + loadGlobalsThenExecute(tab.id, "bulkArchiveConversations.js"); + } }); } + // function updateCopyrightYear() { // const currentYear = new Date().getFullYear(); // document.getElementById(