mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-04-26 15:39:59 -07:00
wavehunter: adds static server, system stats
This commit does a couple things: 1. breaks out the pcap streaming logic into its own module 2. bundles wavehunter/static files into the binary for easy distribution 3. serves those static files 4. serves dynamic json representing system and diag stats I also threw together the world's ugliest website to display all this.
This commit is contained in:
24
wavehunter/static/js/main.js
Normal file
24
wavehunter/static/js/main.js
Normal file
@@ -0,0 +1,24 @@
|
||||
async function populateDivs() {
|
||||
const systemStats = await getSystemStats();
|
||||
const diagStats = await getDiagStats();
|
||||
|
||||
const systemStatsDiv = document.getElementById('system-stats');
|
||||
const diagStatsDiv = document.getElementById('diag-stats');
|
||||
|
||||
systemStatsDiv.innerHTML = JSON.stringify(systemStats, null, 2);
|
||||
diagStatsDiv.innerHTML = JSON.stringify(diagStats, null, 2);
|
||||
}
|
||||
|
||||
async function getSystemStats() {
|
||||
return await getJson('/api/system-stats');
|
||||
}
|
||||
|
||||
async function getDiagStats() {
|
||||
return await getJson('/api/diag-stats');
|
||||
}
|
||||
|
||||
async function getJson(url) {
|
||||
const response = await fetch(url);
|
||||
const data = await response.json();
|
||||
return data;
|
||||
}
|
||||
Reference in New Issue
Block a user