Skip to content

Commit 70697c4

Browse files
authored
Merge pull request #4 from AzlanCoding/bug-fixes
Fixed double checking bug
2 parents a1f9843 + cb34735 commit 70697c4

File tree

3 files changed

+19
-28
lines changed

3 files changed

+19
-28
lines changed

extension/background.js

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,21 @@ async function handleExternalAction(sendResponse, func, args){
553553

554554

555555
/*---Main Startup---*/
556+
function initExtension(){
557+
if (typeof syncEnrollmentInterval == 'undefined'){
558+
syncEnrollment();
559+
let syncEnrollmentInterval = setInterval(syncEnrollment, 30000);
560+
}
561+
if (typeof syncEnrollmentInterval == 'undefined'){
562+
let setBlockedSitesInterval = setBlockedSitesLoop();
563+
}
564+
if (typeof permissionsCheckInterval == 'undefined'){
565+
checkPermissions();
566+
let permissionsCheckInterval = setInterval(checkPermissions, 1000);
567+
}
568+
return logData("info","EXTENSION INITILISATION COMPLETE");
569+
}
570+
556571
if (typeof window == 'undefined') { //The javascript equivilant of `if __name__ == '__main__':` in python
557572
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
558573
if (request === 'getBlockedSites') {
@@ -579,30 +594,6 @@ if (typeof window == 'undefined') { //The javascript equivilant of `if __name__
579594
}
580595
});
581596

582-
chrome.runtime.onStartup.addListener(function() {
583-
if (typeof syncEnrollmentInterval == 'undefined'){
584-
syncEnrollment();
585-
let syncEnrollmentInterval = setInterval(syncEnrollment, 30000);
586-
}
587-
if (typeof syncEnrollmentInterval == 'undefined'){
588-
let setBlockedSitesInterval = setBlockedSitesLoop();
589-
}
590-
if (typeof permissionsCheckInterval == 'undefined'){
591-
checkPermissions();
592-
let permissionsCheckInterval = setInterval(checkPermissions, 1000);
593-
}
594-
});
595-
596-
if (typeof syncEnrollmentInterval == 'undefined'){
597-
syncEnrollment();
598-
let syncEnrollmentInterval = setInterval(syncEnrollment, 30000);
599-
}
600-
if (typeof syncEnrollmentInterval == 'undefined'){
601-
let setBlockedSitesInterval = setBlockedSitesLoop();
602-
}
603-
if (typeof permissionsCheckInterval == 'undefined'){
604-
checkPermissions();
605-
let permissionsCheckInterval = setInterval(checkPermissions, 1000);
606-
}
607-
logData("info","INITILISATION COMPLETE");//This is async function but I can't put `await` here.
597+
chrome.runtime.onStartup.addListener(initExtension);
598+
chrome.runtime.onInstalled.addListener(initExtension);
608599
}

extension/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "Ignite DMA",
4-
"version": "1.1.0",
4+
"version": "1.1.1",
55
"author": "AzlanCoding",
66
"description": "A Device Manager Application (DMA) for students under MOE",
77
"homepage_url": "https://ignitedma.mooo.com/",

server/assets/service/update.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
33
<app appid='clhnfaboginbheghbebffggbdnijjika'>
4-
<updatecheck codebase='https://ignitedma.mooo.com/assets/service/chrome_extension/v1.1.0.crx' version='1.1.0' />
4+
<updatecheck codebase='https://ignitedma.mooo.com/assets/service/chrome_extension/v1.1.1.crx' version='1.1.1' />
55
</app>
66
</gupdate>

0 commit comments

Comments
 (0)