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)
| 46 | # --------------------------------------------------------------------------- |
| 47 | |
| 48 | def 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 | |
| 67 | def push_layers(config: dict) -> None: |