1
0
Fork 0

Create background page to monitor Nexus Clash game traffic

This commit is contained in:
Krzysztof Sikorski 2021-11-11 22:24:12 +01:00
parent 0369602844
commit 64730cb8fb
Signed by: krzysztof-sikorski
GPG Key ID: 4EB564BD08FE8476
2 changed files with 32 additions and 2 deletions

View File

@ -1,7 +1,13 @@
{
"author": "Krzysztof Andrzej Sikorski",
"background": {
"persistent": true,
"scripts": [
"src/preferences.js",
"src/nexusData.js",
"src/nexusDataQueue.js",
"src/nexusDataSender.js",
"src/webRequestMonitor.js",
"src/background.js"
]
},
@ -22,7 +28,11 @@
"page": "options/index.html"
},
"permissions": [
"storage"
"storage",
"unlimitedStorage",
"webRequest",
"webRequestBlocking",
"*://*.nexusclash.com/*"
],
"short_name": "NA Tracker",
"version": "0.0.2"

View File

@ -1 +1,21 @@
// Put all the javascript code here, that you want to execute in background.
/* global NexusDataQueue, NexusDataSender, Preferences, WebRequestMonitor */
'use strict'
function generateSessionId() {
const timestamp = Date.now()
const suffix = 1000000 * Math.random()
return `${timestamp}_${suffix}`
}
const sessionId = generateSessionId()
const preferences = new Preferences()
preferences.load()
preferences.listenForStorageChanges()
const nexusDataQueue = new NexusDataQueue()
const nexusDataSender = new NexusDataSender(preferences)
const webRequestMonitor = new WebRequestMonitor(sessionId, nexusDataQueue, nexusDataSender)
webRequestMonitor.addListeners()