MCPcopy Create free account
hub / github.com/PuzzleEmptyM/Unbound-editor-device-customizer / sync_from_cloud

Function sync_from_cloud

cloud_sync.py:48–64  ·  view source on GitHub ↗

Pulls all layers from the server and overwrites the local config in place. Cloud always wins. Saves to disk after applying. Returns the raw server payload.

(config: dict)

Source from the content-addressed store, hash-verified

46# ---------------------------------------------------------------------------
47
48def sync_from_cloud(config: dict) -> dict:
49 """
50 Pulls all layers from the server and overwrites the local config in place.
51 Cloud always wins. Saves to disk after applying.
52 Returns the raw server payload.
53 """
54 _check()
55 r = _requests.get(f"{API_BASE}/api/sync", headers=_headers(), timeout=_TIMEOUT)
56 r.raise_for_status()
57 data = r.json()
58
59 cloud_layers: dict = data.get("layers", {})
60 if cloud_layers:
61 config["layers"] = cloud_layers
62 cfg.save(config)
63
64 return data
65
66
67def push_layers(config: dict) -> None:

Callers

nothing calls this directly

Calls 2

_checkFunction · 0.85
_headersFunction · 0.85

Tested by

no test coverage detected