Files
janvanwan 42eaed647a feat: sync with upstream — v1.2.0, in-app updates, Projects, modules
Brings the public tree back in line with the development repo after several
weeks of drift caused by a stale publish include list.

New:
- In-app update path: GET /update/check compares the checkout against
  origin/main and POST /update/apply runs `ncp upgrade` detached (pull,
  rebuild, restart). The sidebar shows the version, checks on click, and
  offers an "update available" pill.
- Projects: a project workspace groups chats and RAG documents, with
  per-project instructions and document retrieval scoped to the active
  project. Replaces the standalone Documents page.
- modules/: auto-discovered feature plugins (mail, network) with their
  frontend counterparts and tests.
- Memory curation runs in-process (synapse/memory/curator.py) on the chat
  model when a conversation goes idle. The separate memory service on :8001
  is gone, along with the launcher lines that started it.

Also: the KDE theme, panel and Promethean terminal assets, the full test
suite, and VERSION 1.2.0.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-08-25 09:13:55 -05:00

53 lines
1.6 KiB
Python

"""HTTP routes for the network module — mounted onto the main app via modules/registry.py."""
from __future__ import annotations
import asyncio as _asyncio
from typing import Any, Dict
from fastapi import APIRouter, Body, HTTPException
from . import backend as net
MANIFEST = {"key": "network", "label": "Network", "icon": "📡"}
router = APIRouter(prefix="/network", tags=["network"])
@router.get("/status")
async def network_status():
return {"hostname": net.hostname(), "connection": net.primary_connection(), "vpn": net.vpn_status()}
@router.post("/vpn/toggle")
async def network_vpn_toggle(payload: Dict[str, Any] = Body(...)):
try:
return await _asyncio.to_thread(net.vpn_toggle, bool(payload.get("enable")))
except RuntimeError as e:
raise HTTPException(status_code=400, detail=str(e))
except Exception as e:
raise HTTPException(status_code=502, detail=f"nmcli error: {e}")
@router.get("/targets")
async def network_targets():
return {"targets": net.list_targets()}
@router.post("/targets")
async def network_target_create(payload: Dict[str, Any] = Body(...)):
host = (payload.get("host") or "").strip()
if not host:
raise HTTPException(status_code=400, detail="'host' is required")
return net.add_target((payload.get("label") or "").strip() or host, host)
@router.delete("/targets/{target_id}")
async def network_target_delete(target_id: str):
net.delete_target(target_id)
return {"status": "deleted"}
@router.get("/ping")
async def network_ping_all():
return {"targets": await _asyncio.to_thread(net.ping_targets)}