From e0cd6101d3dfce9924879764b9fb0a14b52b71e9 Mon Sep 17 00:00:00 2001 From: #deCloudflare <103764-servant@users.noreply.framagit.org> Date: Fri, 26 Aug 2022 11:00:24 +0000 Subject: [PATCH] Replace main.js --- tool/mypdns_reporter/addon/firefox/main.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tool/mypdns_reporter/addon/firefox/main.js b/tool/mypdns_reporter/addon/firefox/main.js index 863ba12860..af9d13c2cd 100644 --- a/tool/mypdns_reporter/addon/firefox/main.js +++ b/tool/mypdns_reporter/addon/firefox/main.js @@ -2198,6 +2198,23 @@ browser.webNavigation.onCompleted.addListener(() => { }); }); browser.runtime.onMessage.addListener((r, s, sr) => { + if (r[0] == 'iidCACHEget') { + let iidDOMAIN = get_realdomain(r[1]) + '.mpdns_iid'; + if (domainCAT[iidDOMAIN]) { + sr([true, domainCAT[iidDOMAIN][1]]); + } else { + sr([false, 0]); + } + } + if (r[0] == 'iidCACHEset') { + let iidDOMAIN = get_realdomain(r[1]) + '.mpdns_iid'; + if (!domainCAT[iidDOMAIN]) { + domainCAT[iidDOMAIN] = [tUNIX(), r[2], + [] + ]; + } + sr(true); + } if (r[0] == 'set') { token = r[1]; if (token.length == 20) { @@ -2273,4 +2290,4 @@ browser.runtime.onInstalled.addListener(g => { browser.runtime.openOptionsPage(); showreply('Hello!', 'Please set your token to begin.'); } -}); +}); \ No newline at end of file