Skip to content

Commit b196995

Browse files
committed
Merge branch 'hf-1.18.1'
* hf-1.18.1: Added logic to fetch the latest lists if not fetched Increased version
2 parents d8ef972 + e47a87c commit b196995

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

js/options.js

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,41 @@ objBrowser.runtime.onMessage.addListener(
150150
}
151151
break;
152152
case 'twitter_lists' :
153+
//See when they were last fetched
153154
let twitter_lists = {
154-
"whitelist": [
155-
"237387363", //sniko_
156-
"4831010888" //MyCrypto
157-
],
155+
"last_fetched": 0,
156+
"whitelist": [],
158157
"blacklist": []
159158
};
160159

160+
if(localStorage.getItem("ext-etheraddresslookup-twitter_lists")) {
161+
let saved_settings = JSON.parse(localStorage.getItem("ext-etheraddresslookup-twitter_lists"));
162+
twitter_lists.last_fetched = saved_settings.last_fetched;
163+
}
164+
165+
if((Math.floor(Date.now() - twitter_lists.last_fetched)) > 600*1000) {
166+
fetch("https://raw.githubusercontent.com/MrLuit/EtherScamDB/master/_data/twitter.json")
167+
.then(res => res.json())
168+
.then((lists) => {
169+
twitter_lists.last_fetched = Date.now();
170+
171+
//We only need the Twitter IDs
172+
Object.entries(lists.whitelist).forEach(
173+
([twitter_userid, screename]) => {
174+
twitter_lists.whitelist.push(twitter_userid);
175+
}
176+
);
177+
178+
Object.entries(lists.blacklist).forEach(
179+
([twitter_userid, screename]) => {
180+
twitter_lists.blacklist.push(twitter_userid);
181+
}
182+
);
183+
184+
localStorage.setItem("ext-etheraddresslookup-twitter_lists", JSON.stringify(twitter_lists));
185+
});
186+
}
187+
161188
if(localStorage.getItem("ext-etheraddresslookup-twitter_lists")) {
162189
var cached_list = JSON.parse(localStorage.getItem("ext-etheraddresslookup-twitter_lists"));
163190
twitter_lists.whitelist = cached_list.whitelist;

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "EtherAddressLookup",
55
"short_name": "EtherAddressLookup",
66
"description": "Adds links to strings that look like Ethereum addresses to your favorite blockchain explorer.",
7-
"version": "1.18",
7+
"version": "1.18.1",
88

99
"browser_action": {
1010
"default_icon": "images/icon.png",

0 commit comments

Comments
 (0)