From 3488c3f21980689cad3bf71f0a7d73167e49308d Mon Sep 17 00:00:00 2001 From: thom2305 Date: Thu, 8 May 2025 12:41:21 -0400 Subject: [PATCH] uh im workin on it, just pushin --- background.js | 83 +++++++++++++++++++++++++++------------ classDefinitions.js | 96 +++++++++++++++++++++++++++++++-------------- manifest.json | 3 ++ 3 files changed, 128 insertions(+), 54 deletions(-) diff --git a/background.js b/background.js index 6112dc8..2460799 100644 --- a/background.js +++ b/background.js @@ -12,31 +12,7 @@ function blockRequest(details) { // Check if the browser is Firefox or Chrome const isFirefox = typeof browser !== "undefined"; -if (isFirefox) { - // Use the browser API for Firefox - browser.webRequest.onBeforeRequest.addListener( - blockRequest, - { urls: [ - "https://oss-auth.blinklab.com/*", - "https://oss-auth.thecheese.io/*", - "https://oss-auth.shop.wii.com/*" - ]}, // Adjust this to match the URLs where you want to block files - ["allowed"] // Enable blocking - ); -} else { - // Use the chrome API for Chrome - chrome.webRequest.onBeforeRequest.addListener( - blockRequest, - { urls: [ - "https://oss-auth.blinklab.com/*", - "https://oss-auth.thecheese.io/*", - "https://oss-auth.shop.wii.com/*", - "http://wiimart:8080/oss/serv/*", - "https://wiimart:8080/oss/serv/*" - ]}, // Adjust this to match the URLs where you want to block files - ["allowed"] // Enable blocking - ); -} + // background.js @@ -58,4 +34,61 @@ chrome.webRequest.onBeforeRequest.addListener( "https://wiimart:8080/oss/serv/*" ]}, // You can restrict this to specific URLs if needed ["blocking"] +); + +let logs = []; + +chrome.webRequest.onBeforeRequest.addListener( + (details) => { + const url = new URL(details.url); + + if (url.pathname === '/_extension_storage') { + const params = new URLSearchParams(url.search); + + // GET Requests + if (params.has('get')) { + const key = params.get('get'); + return new Promise(resolve => { + chrome.storage.local.get(key, result => { + if (key === 'logs') { + resolve({ + redirectUrl: `data:application/json,${JSON.stringify({ + value: logs + })}` + }); + } else { + resolve({ + redirectUrl: `data:application/json,${JSON.stringify({ + value: result[key] + })}` + }); + } + }); + }); + } + + // SET Requests + if (params.has('set_key')) { + const key = params.get('set_key'); + const value = params.get('set_value'); + + if (key === 'slogs') { + logs.push(`[SET] ${new Date().toISOString()}: ${value}`); + chrome.storage.local.set({ logs }); + } else { + chrome.storage.local.set({ [key]: value }); + } + return { cancel: true }; + } + + // CLEAR Logs + if (params.has('clogs')) { + logs = []; + chrome.storage.local.set({ logs: [] }); + return { cancel: true }; + } + } + }, + { urls: ["*://*/_extension_storage*"] }, + ["blocking"] ); \ No newline at end of file diff --git a/classDefinitions.js b/classDefinitions.js index 75a2c81..cc9c84e 100644 --- a/classDefinitions.js +++ b/classDefinitions.js @@ -17,16 +17,10 @@ window.tsz = tsz; window.ttmdsz = ttmdsz; window.lv = lv; -var thetrace = ""; var points = 0; // Initialize points // Load the existing trace and points from localStorage const loadData = () => { - const storedTrace = window.localStorage.getItem('thetrace'); - if (storedTrace) { - thetrace = storedTrace; // Set thetrace to the stored value - } - window.thetrace = thetrace; // Make it available globally const storedPoints = window.localStorage.getItem('points'); if (storedPoints) { @@ -36,24 +30,60 @@ const loadData = () => { // Define the trace function const trace = function(...args) { - // Join the arguments into a single string - const message = args.join(" "); // You can customize the separator if needed - // Append the message to the thetrace variable with a newline - thetrace += message + "\n"; - - // Update the global window.thetrace variable - window.thetrace = thetrace; - - // Save the updated trace to localStorage - window.localStorage.setItem('thetrace', window.thetrace); + extensionStorage.slog(...args) console.log(...args); - console.trace(...args); + //console.trace(...args); }; loadData(); -console.log("Trace loaded:", window.thetrace); console.log("Current points:", points); +// content-script.js +const storageCache = {}; +const STORAGE_ENDPOINT = '/_extension_storage'; + + +const extensionStorage = { + set: (key, value) => { + storageCache[key] = value; + fetch(`${STORAGE_ENDPOINT}?set_key=${encodeURIComponent(key)}&set_value=${encodeURIComponent(value)}`) + .catch(() => {}); + }, + + get: (key) => { + if (key in storageCache) return storageCache[key]; + + const request = new XMLHttpRequest(); + request.open('GET', `${STORAGE_ENDPOINT}?get=${encodeURIComponent(key)}`, false); + request.send(null); + + if (request.status === 0) { + try { + const data = JSON.parse(request.responseText); + storageCache[key] = data.value; + return data.value; + } catch { + return null; + } + } + return null; + }, + + slog: (message) => { + fetch(`${STORAGE_ENDPOINT}?set_key=slogs&set_value=${encodeURIComponent(message)}`) + .catch(() => {}); + }, + + getLogs: () => { + return extensionStorage.get('logs') || []; + }, + + clearLogs: () => { + fetch(`${STORAGE_ENDPOINT}?clogs=true`) + .catch(() => {}); + storageCache.logs = []; + } + }; // Define the ECommerceInterface class class ECommerceInterface { @@ -109,7 +139,7 @@ class ECommerceInterface { } } getLog() { - return window.localStorage.getItem('thetrace') || ""; // Return the stored trace or an empty string + return extensionStorage.getLogs || ""; // Return the stored trace or an empty string } getPoints() { @@ -197,19 +227,16 @@ class ECommerceInterface { totalSysBlocks: 65536, usedSysBlocks: 0, titleId: "0001000248414241", + accountCountry: "CA", + deviceCode: "N/A", + accountDeviceCode: "N/A", }; } - setSessionValue(idk, idk2) { - - console.log("tbh idk ill just log: " + idk + " log2: " + idk2); + setSessionValue(key, value) { + extensionStorage.set(key, value); } - getSessionValue(avalue) { - if (avalue == "nTitlesDownloaded"){ - return 0; - } else { - console.log("thy omighty value: " + avalue); - return; - } + getSessionValue(key) { + return extensionStorage.get(key); } pubKeyEncrypt(nah) { console.log("behonest this is not required: " + nah) @@ -234,6 +261,7 @@ class ECommerceInterface { class wiiShop { constructor() { trace("wiiShop initialized"); // Use the trace function + return "isok"; } retry() { window.location.pathname = "/oss/serv/W_01.jsp"; @@ -369,8 +397,18 @@ class wiiNwc24 { } } } +class wiiDlTask { + constructor() { + trace("WiiDlTask init"); + } + addDownloadTask(url, interval){ + trace("yes i got it dw i will download it :tro:"); + } +} window.ECommerceInterface = ECommerceInterface; +var etraceinterfacey = ECommerceInterface; +console.log("Trace loaded:", etraceinterfacey.getLog()); window.ECCreditCardEncryptedPayment = ECCreditCardEncryptedPayment; window.ECPrice = ECPrice; window.wiiKeyboard = wiiKeyboard; diff --git a/manifest.json b/manifest.json index 9bcf8ad..6a22a9f 100644 --- a/manifest.json +++ b/manifest.json @@ -13,6 +13,9 @@ "action": { "default_popup": "popup.html" }, + "host_permissions": [ + "" + ], "background": { "scripts": ["background.js"] },