diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e192558 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +test/* \ No newline at end of file diff --git a/classDefinitions.js b/classDefinitions.js index 609d0d3..6f4ce94 100644 --- a/classDefinitions.js +++ b/classDefinitions.js @@ -2,6 +2,7 @@ const _injectedWiiShopSoundUrls = window._wiiShopSoundUrls_ || []; const _injectedWiiShopBgmUrl = window._wiiShopBgmUrl_ || ''; const _bgmInitiallyEnabled = window._wiiShopBgmInitiallyEnabled_ === true; const _bgmAlreadyPlaying = window._bgmAlreadyPlaying || false; +const _currentstatus = window._currentstatus || ""; var ecsUrl = ""; var iasUrl = ""; @@ -104,7 +105,7 @@ class ECommerceInterface { if (window.location.pathname === unwantedPath) { //window.location.pathname = "/oss/serv/W_01.jsp"; console.log("Do nothing..."); - } + }/* this._titlesMap = new Map([ ["0001000248414241", { name: 'Wii Shop Channel', @@ -116,7 +117,7 @@ class ECommerceInterface { version: '1', isTmdPresent: true, }], - ]); + ]);*/ trace("ECommerceInterface initialized"); // Use the trace function } @@ -135,18 +136,36 @@ class ECommerceInterface { } }; } - + /* getTitleInfo(shopAppTitleId) { const title = this._titlesMap.get(shopAppTitleId); if (!title || typeof title !== 'object' || !title.isTmdPresent || title.version == null) { return null; } - } + }*/ getTitleInfo(titleid) { - return { - isOnDevice: false, - version: 0, - isTmdPresent: false, + if (titleid === "0001000248414241") { + return { + titleId: titleid, + isOnDevice: true, + version: 21, + isTmdPresent: true, + occupiedUserBlocks: 0, + occupiedUserInodes: 0, + occupiedSysBlocks: 1599, + occupiedSysInodes: 23 + } + } else { + return { + titleId: titleid, + isOnDevice: false, + version: 0, + isTmdPresent: false, + occupiedUserBlocks: 0, + occupiedUserInodes: 0, + occupiedSysBlocks: 0, + occupiedSysInodes: 0 + } } } getLog() { @@ -190,6 +209,7 @@ class ECommerceInterface { } getCachedBalance() { + window._currentstatus = "getCachedBalance" const storedPoints = window.localStorage.getItem('points'); if (storedPoints) { return parseInt(storedPoints, 10); @@ -200,38 +220,52 @@ class ECommerceInterface { } refreshCachedBalance() { + window._currentstatus = "refreshCachedBalance" + return { + status: 0, + operation: "refreshCachedBalance", + description: "", + phase: 7, + isCancelRequested: "false", + downloadedSize: 0, + totalSize: 0, + errCode: 0, + errInfo: null, + }; + /* const storedPoints = window.localStorage.getItem('points'); if (storedPoints) { return parseInt(storedPoints, 10); } else { return 0; - } + }*/ } checkDeviceStatus() { + window._currentstatus = "checkDeviceStatus"; return { status: 0, operation: "checkDeviceStatus", description: "", phase: 17, isCancelRequested: "false", - downloadedSize: 888, - totalSize: 888, - errCode: "", - errInfo: "", + downloadedSize: 0, + totalSize: 0, + errCode: 0, + errInfo: null, }; } getDeviceInfo() { return { - country: "CA", // Example value + country: "US", // Example value region: "USA", // Example value isParentalControlEnabled: false, // Example value userAge: 20, // Example value language: "fr", // Example value - accountId: "659247", // Example value - deviceId: "458757", // Example value + accountId: "659247864", // Example value + deviceId: "4587571479", // Example value serial: "PC156494873", // Example value maxUserInodes: 200000, usedUserInodes: 100000, @@ -245,7 +279,9 @@ class ECommerceInterface { titleId: "0001000248414241", accountCountry: "CA", deviceCode: "0302167078436756", - accountDeviceCode: this.deviceCode, + accountDeviceCode: "0302167078436756", + isKeyPairConfirmed: function() { return true; }, + registrationStatus: "R", }; } setSessionValue(key, value) { @@ -263,11 +299,58 @@ class ECommerceInterface { return 100; } getProgress() { - console.log("idk what to return its a progress?"); - return 100; + var downsize = 0; + if (window._currentstatus === "checkRegistration") { + downsize = 727; + } else if (window._currentstatus === "syncRegistration") { + downsize = 913; + } else if (window._currentstatus === "checkDeviceStatus") { + downsize = 846; + } else if (window._currentstatus === "refreshCachedBalance") { + downsize = 731; + } else { + downsize = 0; + } + return { + "status": 0, + "operation": window._currentstatus, + "description": "", + "phase": 2, + "isCancelRequested": false, + "downloadedSize": downsize, + "totalSize": 0, + "errCode": 0, + "errInfo": null + }; } checkRegistration() { - return true; + window._currentstatus = "checkRegistration"; + return { + "status": 0, + "operation": "checkRegistration", + "description": "", + "phase": 11, + "isCancelRequested": false, + "downloadedSize": 0, + "totalSize": 0, + "errCode": 0, + "errInfo": null + }; + } + syncRegistration(value) { + console.log("idk what to do with this: " + value); + window._currentstatus = "syncRegistration"; + return { + "status": 0, + "operation": "syncRegistration", + "description": "", + "phase": 18, + "isCancelRequested": false, + "downloadedSize": 0, + "totalSize": 0, + "errCode": 0, + "errInfo": null + }; } getWeakToken() { return "iamaweaktoken"; @@ -275,6 +358,17 @@ class ECommerceInterface { getVersion() { return parseInt("21"); } + request(value) { + if (value === "checkRegistration") { + return this.checkRegistration(); + } else if (value === "checkDeviceStatus") { + return this.checkDeviceStatus(); + } else if (value === "refreshCachedBalance") { + return this.refreshCachedBalance(); + } else if (value === "getCachedBalance") { + return this.getCachedBalance(); + } + } } class wiiShop { @@ -282,6 +376,7 @@ class wiiShop { trace("wiiShop initialized"); // Use the trace function return "isok"; } + connecting = null; retry() { window.location.pathname = "/oss/serv/W_01.jsp"; } @@ -328,6 +423,7 @@ class wiiShop { isCompatibleMode() { return true; } + launchCode = 0; } class wiiSound { @@ -487,6 +583,7 @@ class wiiNwc24 { return "111" } } + myUserId = "0302167078436756"; } class wiiDlTask { constructor() { diff --git a/content.js b/content.js index dafcbd6..04005a8 100644 --- a/content.js +++ b/content.js @@ -7,6 +7,7 @@ console.log("Content script is running."); let fontLoaded = false; function loadFont() { + return "nuh uh"; const fontUrl = chrome.runtime.getURL("fonts/fot_rodin_pro_m.ttf"); const style = document.createElement('style'); style.textContent = ` @@ -102,6 +103,7 @@ function loadFont() { function checkFontState() { chrome.storage.local.get(['fontDisabled'], function(result) { if (!result.fontDisabled) { + return "disabled"; return loadFont(); } else { return "disabled"; diff --git a/manifest-chome.json b/manifest-chome.json index 908bd95..99b58e9 100644 --- a/manifest-chome.json +++ b/manifest-chome.json @@ -25,7 +25,8 @@ "https://oss-auth.thecheese.io/*", "https://oss-auth.shop.wii.com/*", "http://wiimart:8080/oss/serv/*", - "https://wiimart:8080/oss/serv/*" + "https://wiimart:8080/oss/serv/*", + "https://localhost/oss/serv*" ], "js": ["content.js"], "run_at": "document_start" @@ -44,7 +45,8 @@ "https://oss-auth.thecheese.io/*", "https://oss-auth.shop.wii.com/*", "http://wiimart:8080/oss/serv/*", - "https://wiimart:8080/oss/serv/*" + "https://wiimart:8080/oss/serv/*", + "https://localhost/oss/serv*" ] } ] diff --git a/manifest.json b/manifest.json index 3dc11fc..40da033 100644 --- a/manifest.json +++ b/manifest.json @@ -26,7 +26,8 @@ "https://oss-auth.thecheese.io/*", "https://oss-auth.shop.wii.com/*", "http://wiimart:8080/oss/serv/*", - "https://wiimart:8080/oss/serv/*" + "https://wiimart:8080/oss/serv/*", + "https://localhost/oss/serv*" ], "js": ["content.js"], "run_at": "document_start" @@ -45,7 +46,8 @@ "https://oss-auth.thecheese.io/*", "https://oss-auth.shop.wii.com/*", "http://wiimart:8080/oss/serv/*", - "https://wiimart:8080/oss/serv/*" + "https://wiimart:8080/oss/serv/*", + "https://localhost/oss/serv*" ] } ]