From 7048db3589a41773ba84ca6ed9e00517657d245d Mon Sep 17 00:00:00 2001 From: 409H Date: Wed, 13 Jun 2018 20:10:57 +0100 Subject: [PATCH 1/2] Increased version --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index a8880ed6..242a8e59 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "name": "EtherAddressLookup", "short_name": "EtherAddressLookup", "description": "Adds links to strings that look like Ethereum addresses to your favorite blockchain explorer.", - "version": "1.18", + "version": "1.18.1", "browser_action": { "default_icon": "images/icon.png", From e47a87cf42655858c83e10157503500e436c8fdd Mon Sep 17 00:00:00 2001 From: 409H Date: Wed, 13 Jun 2018 20:11:26 +0100 Subject: [PATCH 2/2] Added logic to fetch the latest lists if not fetched --- js/options.js | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/js/options.js b/js/options.js index 838be979..c85405d6 100644 --- a/js/options.js +++ b/js/options.js @@ -150,14 +150,41 @@ objBrowser.runtime.onMessage.addListener( } break; case 'twitter_lists' : + //See when they were last fetched let twitter_lists = { - "whitelist": [ - "237387363", //sniko_ - "4831010888" //MyCrypto - ], + "last_fetched": 0, + "whitelist": [], "blacklist": [] }; + if(localStorage.getItem("ext-etheraddresslookup-twitter_lists")) { + let saved_settings = JSON.parse(localStorage.getItem("ext-etheraddresslookup-twitter_lists")); + twitter_lists.last_fetched = saved_settings.last_fetched; + } + + if((Math.floor(Date.now() - twitter_lists.last_fetched)) > 600*1000) { + fetch("https://raw.githubusercontent.com/MrLuit/EtherScamDB/master/_data/twitter.json") + .then(res => res.json()) + .then((lists) => { + twitter_lists.last_fetched = Date.now(); + + //We only need the Twitter IDs + Object.entries(lists.whitelist).forEach( + ([twitter_userid, screename]) => { + twitter_lists.whitelist.push(twitter_userid); + } + ); + + Object.entries(lists.blacklist).forEach( + ([twitter_userid, screename]) => { + twitter_lists.blacklist.push(twitter_userid); + } + ); + + localStorage.setItem("ext-etheraddresslookup-twitter_lists", JSON.stringify(twitter_lists)); + }); + } + if(localStorage.getItem("ext-etheraddresslookup-twitter_lists")) { var cached_list = JSON.parse(localStorage.getItem("ext-etheraddresslookup-twitter_lists")); twitter_lists.whitelist = cached_list.whitelist;