fix: response cache stats missing enabled field; tor status reads from JSON...

fix: response cache stats missing enabled field; tor status reads from JSON config instead of Pydantic singleton
parent 4a217dcd
......@@ -1638,8 +1638,8 @@ class ResponseCache:
Dict with cache statistics
"""
stats = self.stats.copy()
# Add current cache size
stats['enabled'] = self.enabled
stats['backend'] = self.backend
if self.backend == 'redis' and self.redis_client:
try:
pattern = f"{self.key_prefix}*"
......
......@@ -15651,10 +15651,11 @@ async def dashboard_tor_status(request: Request):
return JSONResponse({'success': False, 'error': 'Admin access required'}, status_code=403)
try:
from aisbf.config import get_config
config = get_config()
tor_enabled = config and hasattr(config, 'tor') and config.tor and config.tor.enabled
config_path = get_aisbf_config_path()
with open(config_path) as f:
aisbf_config = json.load(f)
tor_cfg = aisbf_config.get('tor', {})
tor_enabled = bool(tor_cfg.get('enabled', False))
tor_running = tor_service is not None and tor_service.is_connected() if tor_service else False
response = {
......
......@@ -347,8 +347,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
<h3 style="margin: 24px 0 16px; font-size:1em; color:#a0a0a0; border-bottom: 1px solid #0f3460; padding-bottom:8px;">Response Cache Configuration</h3>
<!-- DEBUG: {{ config.response_cache }} -->
<div class="form-group">
<label>
<input type="checkbox" name="response_cache_enabled" {% if config.response_cache and config.response_cache.enabled %}checked{% endif %}>
......@@ -531,7 +529,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
<input type="checkbox" name="tor_enabled" id="tor_enabled" {% if config.tor and config.tor.enabled %}checked{% endif %} onchange="toggleTorFields()">
Enable TOR Hidden Service
</label>
<!-- DEBUG TOR: {{ config.tor }} -->
<small style="color: #666; display: block; margin-top: 5px;">Expose AISBF over TOR network as a hidden service</small>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment