diff --git a/src/httpapi/security/client.py b/src/httpapi/security/client.py
index fbb6b288..92a5587a 100644
--- a/src/httpapi/security/client.py
+++ b/src/httpapi/security/client.py
@@ -66,5 +66,5 @@ class ClientAPISecurity:
if request.endpoint in ('siteapi.site', 'siteapi.siteFile'):
resp.headers['Content-Security-Policy'] = "default-src 'none'; style-src 'self' data: 'unsafe-inline'; img-src 'self' data:; media-src 'self' data:"
else:
- resp.headers['Content-Security-Policy'] = "default-src 'none'; script-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; media-src 'none'; frame-src 'none'; font-src 'self'; connect-src 'self'"
+ resp.headers['Content-Security-Policy'] = "default-src 'none'; script-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; media-src 'self'; frame-src 'none'; font-src 'self'; connect-src 'self'"
return resp
diff --git a/src/httpapi/sse/private/__init__.py b/src/httpapi/sse/private/__init__.py
index 32934772..b0088dea 100644
--- a/src/httpapi/sse/private/__init__.py
+++ b/src/httpapi/sse/private/__init__.py
@@ -2,10 +2,17 @@
SSE API for node client access
"""
+from pathlib import Path
+
from flask import g, Blueprint
from gevent import sleep
import gevent
+import ujson
+from onionrblocks.onionrblockapi import Block
+from coredb.dbfiles import block_meta_db
+from coredb.blockmetadb import get_block_list
+from onionrutils.epoch import get_epoch
from onionrstatistics.transports.tor import TorStats
from .. import wrapper
"""
@@ -45,3 +52,22 @@ def stream_tor_circuits():
yield "data: " + tor_stats.get_json() + "\n\n"
sleep(10)
return SSEWrapper.handle_sse_request(circuit_stat_stream)
+
+@private_sse_blueprint.route('/recentblocks')
+def stream_recent_blocks():
+ def _compile_json(b_list):
+ js = {}
+ for block in b_list:
+ js[block] = Block(block).btype
+ return ujson.dumps(js, reject_bytes=True)
+
+ def _stream_recent():
+ last_time = Path(block_meta_db).stat().st_ctime
+ while True:
+ if Path(block_meta_db).stat().st_ctime != last_time:
+ last_time = Path(block_meta_db).stat().st_ctime
+ yield "data: " + _compile_json(get_block_list(get_epoch() - 5)) + "\n\n"
+ else:
+ yield "data: none" + "\n\n"
+ sleep(5)
+ return SSEWrapper.handle_sse_request(_stream_recent)
diff --git a/static-data/www/private/index.html b/static-data/www/private/index.html
index 535be0a1..24745ba1 100755
--- a/static-data/www/private/index.html
+++ b/static-data/www/private/index.html
@@ -15,10 +15,12 @@
+
+
@@ -118,8 +120,9 @@
+
-