synfull 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/backend/app/api/routes.py +41 -0
- package/frontend/dist/assets/index-BdVFYwZZ.js +251 -0
- package/frontend/dist/assets/index-pBaLmQTy.css +1 -0
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/scripts/synfull.cjs +89 -2
- package/frontend/dist/assets/index-B40UafPr.css +0 -1
- package/frontend/dist/assets/index-hx4yW_Xg.js +0 -249
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@ The first local login is `admin` / `admin`. Synfull requires a new password of a
|
|
|
43
43
|
| --- | --- |
|
|
44
44
|
| `synfull setup` | Ask setup options and prepare the isolated Python runtime/dependencies. |
|
|
45
45
|
| `synfull start` | Start Synfull in the background. |
|
|
46
|
+
| `synfull reload` | Refresh installed application files from the current CLI package and restart the service/background instance. |
|
|
46
47
|
| `synfull run` | Run Synfull in the foreground. |
|
|
47
48
|
| `synfull status` | Show process status, dashboard address, and data location. |
|
|
48
49
|
| `synfull stop` | Stop a background instance. |
|
|
@@ -50,7 +51,7 @@ The first local login is `admin` / `admin`. Synfull requires a new password of a
|
|
|
50
51
|
| `synfull install-service` | Explicitly register automatic startup (Windows sign-in task or Linux systemd service). |
|
|
51
52
|
| `synfull uninstall-service` | Remove startup registration; retain application data. |
|
|
52
53
|
|
|
53
|
-
Service registration is optional and is never performed by npm installation. On Linux, installing or removing the system-wide systemd service requires `sudo`; Synfull runs as the invoking user, not as root.
|
|
54
|
+
Service registration is optional and is never performed by npm installation. On Linux, installing or removing the system-wide systemd service requires `sudo`; Synfull runs as the invoking user, not as root. After updating the global npm package, run `synfull reload` to refresh the installed runtime and restart it. Reload does not download or install npm updates itself; use `npm update -g synfull` first.
|
|
54
55
|
|
|
55
56
|
## Optional integrations and security
|
|
56
57
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
from dataclasses import asdict
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import json
|
|
4
|
+
import re
|
|
2
5
|
|
|
3
6
|
from fastapi import APIRouter, HTTPException, Query, Request, Response
|
|
4
7
|
|
|
@@ -17,6 +20,16 @@ from ..services import management
|
|
|
17
20
|
router = APIRouter(prefix="/api/v1")
|
|
18
21
|
|
|
19
22
|
|
|
23
|
+
def installed_version() -> str:
|
|
24
|
+
for package_file in (Path(__file__).resolve().parents[3] / "package.json",
|
|
25
|
+
Path(__file__).resolve().parents[4] / "package.json"):
|
|
26
|
+
try:
|
|
27
|
+
return json.loads(package_file.read_text(encoding="utf-8"))["version"]
|
|
28
|
+
except (OSError, KeyError, json.JSONDecodeError):
|
|
29
|
+
continue
|
|
30
|
+
return "unknown"
|
|
31
|
+
|
|
32
|
+
|
|
20
33
|
@router.get("/auth/status")
|
|
21
34
|
def authentication_status(request: Request):
|
|
22
35
|
return management.auth_status(request.cookies.get(management.SESSION_COOKIE))
|
|
@@ -271,6 +284,33 @@ def security_summary(request: Request):
|
|
|
271
284
|
"service_allowlist": management.management_settings()["service_allowlist"]}
|
|
272
285
|
|
|
273
286
|
|
|
287
|
+
@router.get("/settings/update-check")
|
|
288
|
+
def check_for_update(request: Request):
|
|
289
|
+
management.require_admin(request)
|
|
290
|
+
import urllib.error
|
|
291
|
+
import urllib.request
|
|
292
|
+
|
|
293
|
+
current = installed_version()
|
|
294
|
+
request_message = urllib.request.Request(
|
|
295
|
+
"https://registry.npmjs.org/synfull/latest",
|
|
296
|
+
headers={"Accept": "application/json", "User-Agent": "Synfull-update-check"},
|
|
297
|
+
)
|
|
298
|
+
try:
|
|
299
|
+
with urllib.request.urlopen(request_message, timeout=4) as response:
|
|
300
|
+
package = json.loads(response.read(100_000).decode("utf-8"))
|
|
301
|
+
latest = package.get("version")
|
|
302
|
+
if not isinstance(latest, str) or not re.fullmatch(r"\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?", latest):
|
|
303
|
+
raise ValueError("Package registry returned an invalid version")
|
|
304
|
+
except (urllib.error.URLError, TimeoutError, OSError, ValueError, json.JSONDecodeError) as exc:
|
|
305
|
+
raise HTTPException(status_code=503, detail="Unable to check npm for updates. Please try again later.") from exc
|
|
306
|
+
current_core = tuple(int(part) for part in current.split(".")[:3]) if re.fullmatch(r"\d+\.\d+\.\d+", current) else None
|
|
307
|
+
latest_core = tuple(int(part) for part in latest.split(".")[:3]) if re.fullmatch(r"\d+\.\d+\.\d+", latest) else None
|
|
308
|
+
return {"current_version": current, "latest_version": latest,
|
|
309
|
+
"update_available": current_core is not None and latest_core is not None and latest_core > current_core,
|
|
310
|
+
"update_command": "npm install -g synfull@latest\nsynfull reload",
|
|
311
|
+
"package_url": "https://www.npmjs.com/package/synfull"}
|
|
312
|
+
|
|
313
|
+
|
|
274
314
|
@router.get("/settings")
|
|
275
315
|
def settings_summary(request: Request):
|
|
276
316
|
management.require_admin(request)
|
|
@@ -278,6 +318,7 @@ def settings_summary(request: Request):
|
|
|
278
318
|
return {
|
|
279
319
|
"bind_host": settings.bind_host,
|
|
280
320
|
"bind_port": settings.bind_port,
|
|
321
|
+
"version": installed_version(),
|
|
281
322
|
"state_dir": str(settings.state_dir),
|
|
282
323
|
"database_path": str(settings.resolved_database_path),
|
|
283
324
|
"log_dir": str(settings.resolved_log_dir),
|