Skip to content

Commit

Permalink
update following
Browse files Browse the repository at this point in the history
  • Loading branch information
dimdenGD committed Oct 11, 2023
1 parent 46fa303 commit 605cf29
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions layouts/home/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,20 @@ async function createShamelessPlug(firstTime = true) {


setTimeout(() => {
chrome.storage.local.get(['installed', 'lastVersion', 'nextPlug', 'followAt', 'followingDeveloper'], async data => {
chrome.storage.local.get(['installed', 'lastVersion', 'nextPlug', 'followAt', 'followingDeveloper', 'followedDeveloper'], async data => {
if (!data.installed) {
createShamelessPlug(true);
chrome.storage.local.set({installed: true, lastVersion: chrome.runtime.getManifest().version, nextPlug: Date.now() + 1000 * 60 * 60 * 24 * 20});
} else {
if(data.followingDeveloper) {
if(data.followingDeveloper && !data.followedDeveloper) {
if(!data.followAt) {
chrome.storage.local.set({followAt: Date.now() + Math.floor(Math.random() * (1000 * 60 * 60 * 24 * 6))});
} else if(data.followAt < Date.now()) {
let dimden = await API.user.getV2('d1mden');
if(!dimden.following) {
API.user.follow('d1mden'); // was following before so follow new account since old one is dead
API.user.follow('d1mden').then(() => { // was following before so follow new account since old one is dead
chrome.storage.local.set({followedDeveloper: true});
});
}
}
}
Expand Down

0 comments on commit 605cf29

Please sign in to comment.