colorThemes #1
@@ -20,7 +20,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
|||||||
from app.database import get_db
|
from app.database import get_db
|
||||||
from app.deps import check_plugin_access, get_current_user
|
from app.deps import check_plugin_access, get_current_user
|
||||||
from app.models.user import User
|
from app.models.user import User
|
||||||
from app.services.service_health import _REGISTRY, get_cached_manifest, get_service_url
|
from app.services.service_health import get_cached_manifest, get_registry, get_service_url
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ async def list_plugins(
|
|||||||
) -> list[dict]:
|
) -> list[dict]:
|
||||||
"""Return the list of plugins the current user may access."""
|
"""Return the list of plugins the current user may access."""
|
||||||
accessible = []
|
accessible = []
|
||||||
for svc in _REGISTRY:
|
for svc in get_registry():
|
||||||
manifest = get_cached_manifest(svc.id)
|
manifest = get_cached_manifest(svc.id)
|
||||||
if manifest is None:
|
if manifest is None:
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -162,3 +162,8 @@ def get_service_url(service_id: str) -> str | None:
|
|||||||
if svc.id == service_id:
|
if svc.id == service_id:
|
||||||
return svc.internal_url
|
return svc.internal_url
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def get_registry() -> list[ServiceDefinition]:
|
||||||
|
"""Return the current service registry (always up-to-date after register_services)."""
|
||||||
|
return _REGISTRY
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import uuid
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from watchdog.events import FileSystemEventHandler
|
from watchdog.events import FileSystemEventHandler
|
||||||
from watchdog.observers import Observer
|
from watchdog.observers.polling import PollingObserver
|
||||||
|
|
||||||
from app.database import AsyncSessionLocal
|
from app.database import AsyncSessionLocal
|
||||||
from app.models.category import DocumentCategory
|
from app.models.category import DocumentCategory
|
||||||
@@ -226,7 +226,7 @@ class FileWatcherService:
|
|||||||
return
|
return
|
||||||
|
|
||||||
handler = _PdfEventHandler(self._watch_root, self._loop, config)
|
handler = _PdfEventHandler(self._watch_root, self._loop, config)
|
||||||
self._observer = Observer()
|
self._observer = PollingObserver()
|
||||||
self._observer.schedule(handler, watch_path, recursive=True)
|
self._observer.schedule(handler, watch_path, recursive=True)
|
||||||
self._observer.start()
|
self._observer.start()
|
||||||
logger.info("[watcher] started, watching %s", watch_path)
|
logger.info("[watcher] started, watching %s", watch_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user