v0.8.1 - added screenshots
This commit is contained in:
17
api/index.js
17
api/index.js
@@ -93,10 +93,11 @@ function log(message, type = 'INFO') {
|
||||
|
||||
|
||||
// NIP-59 helper: randomize created_at to thwart time-analysis (past 2 days)
|
||||
// TEMPORARILY DISABLED: Using current timestamp for debugging
|
||||
function randomNow() {
|
||||
const TWO_DAYS = 2 * 24 * 60 * 60; // 172800 seconds
|
||||
// const TWO_DAYS = 2 * 24 * 60 * 60; // 172800 seconds
|
||||
const now = Math.round(Date.now() / 1000);
|
||||
return Math.round(now - Math.random() * TWO_DAYS);
|
||||
return now; // Math.round(now - Math.random() * TWO_DAYS);
|
||||
}
|
||||
|
||||
// Safe JSON parse with error handling
|
||||
@@ -1250,7 +1251,7 @@ async function processAdminResponse(event) {
|
||||
throw new Error('Failed to decrypt admin response content');
|
||||
}
|
||||
|
||||
console.log('Decrypted admin response:', decryptedContent);
|
||||
// console.log('Decrypted admin response:', decryptedContent);
|
||||
|
||||
// Try to parse as JSON first, if it fails treat as plain text
|
||||
let responseData;
|
||||
@@ -4033,9 +4034,9 @@ function updateStatsFromTimeMonitoringEvent(monitoringData) {
|
||||
|
||||
// Extract values from periods array
|
||||
monitoringData.periods.forEach(period => {
|
||||
if (period.period === '24h') timeStats.last_24h = period.count;
|
||||
else if (period.period === '7d') timeStats.last_7d = period.count;
|
||||
else if (period.period === '30d') timeStats.last_30d = period.count;
|
||||
if (period.period === 'last_24h') timeStats.last_24h = period.count;
|
||||
else if (period.period === 'last_7d') timeStats.last_7d = period.count;
|
||||
else if (period.period === 'last_30d') timeStats.last_30d = period.count;
|
||||
});
|
||||
|
||||
populateStatsTime({ time_stats: timeStats });
|
||||
@@ -4069,7 +4070,7 @@ function updateStatsFromTopPubkeysMonitoringEvent(monitoringData) {
|
||||
function updateStatsFromSubscriptionDetailsMonitoringEvent(monitoringData) {
|
||||
try {
|
||||
// DEBUG: Log every subscription_details event that arrives at the webpage
|
||||
console.log('subscription_details', JSON.stringify(monitoringData, null, 2));
|
||||
// console.log('subscription_details', JSON.stringify(monitoringData, null, 2));
|
||||
console.log('subscription_details decoded:', monitoringData);
|
||||
|
||||
if (monitoringData.data_type !== 'subscription_details') {
|
||||
@@ -4779,7 +4780,7 @@ const SQL_QUERY_TEMPLATES = {
|
||||
subscriptions: "SELECT * FROM active_subscriptions_log ORDER BY created_at DESC",
|
||||
top_pubkeys: "SELECT * FROM top_pubkeys_view",
|
||||
event_kinds: "SELECT * FROM event_kinds_view ORDER BY count DESC",
|
||||
time_stats: "SELECT * FROM time_stats_view"
|
||||
time_stats: "SELECT 'total' as period, COUNT(*) as total_events, COUNT(DISTINCT pubkey) as unique_pubkeys, MIN(created_at) as oldest_event, MAX(created_at) as newest_event FROM events UNION ALL SELECT '24h' as period, COUNT(*) as total_events, COUNT(DISTINCT pubkey) as unique_pubkeys, MIN(created_at) as oldest_event, MAX(created_at) as newest_event FROM events WHERE created_at >= (strftime('%s', 'now') - 86400) UNION ALL SELECT '7d' as period, COUNT(*) as total_events, COUNT(DISTINCT pubkey) as unique_pubkeys, MIN(created_at) as oldest_event, MAX(created_at) as newest_event FROM events WHERE created_at >= (strftime('%s', 'now') - 604800) UNION ALL SELECT '30d' as period, COUNT(*) as total_events, COUNT(DISTINCT pubkey) as unique_pubkeys, MIN(created_at) as oldest_event, MAX(created_at) as newest_event FROM events WHERE created_at >= (strftime('%s', 'now') - 2592000)"
|
||||
};
|
||||
|
||||
// Query history management (localStorage)
|
||||
|
||||
Reference in New Issue
Block a user