Create background page to monitor Nexus Clash game traffic
This commit is contained in:
parent
0369602844
commit
64730cb8fb
|
@ -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"
|
||||
|
|
|
@ -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()
|
||||
|
|
Reference in New Issue