Skip to content

Commit

Permalink
Merge branch 'hf-1.18.1'
Browse files Browse the repository at this point in the history
* hf-1.18.1:
  Added logic to fetch the latest lists if not fetched
  Increased version
  • Loading branch information
409H committed Jun 13, 2018
2 parents d8ef972 + e47a87c commit b196995
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
35 changes: 31 additions & 4 deletions js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit b196995

Please sign in to comment.