/action?do=sync: Device Sync

Send JSON strings as form POST. mode directions are relative to the App receiving the request; an HTTP OK does not mean data has been merged.

ParameterPurpose
typehistory for viewing history; keep for favorites.
mode0 send and receive (default); 1 receive only; 2 send only.
deviceTarget Device object string used when sending in mode 0 / 2; without device nothing is sent.
forceOnly the string true enables delete-then-merge; unset or any other value keeps existing data.
configConfig object string for history; receiving needs a valid url and may load that configuration first.
targetsJSON string of History[] or Keep[], decided by type.
configsConfig[] object array string for keep 鈥?not an array of URLs; ties to Keep.cid by source id.
force=true deletes existing data

history deletes the viewing history of the matching configuration; keep deletes all favorites. For normal syncs, omit force or set it to false.

How favorites relate

Decoded content of the two form fields

{
  "configs": [
    { "id": 7, "type": 0, "url": "https://example.com/vod.json", "name": "Sample configuration" }
  ],
  "targets": [
    {
      "key": "demo@@@demo-1@@@7",
      "cid": 7,
      "type": 0,
      "siteName": "Demo",
      "vodName": "Sample item",
      "vodPic": "https://example.com/poster.jpg",
      "createTime": 1788825600000
    }
  ]
}

Convert configs and targets to JSON form strings separately. Each Keep.cid must point at its own Config.id; it is mapped to the local configuration ID when merging.

curl "http://127.0.0.1:9978/action?do=sync&type=keep&mode=1&force=false" --data-urlencode 'configs=[{"id":7,"type":0,"url":"https://example.com/vod.json","name":"Sample configuration"}]' --data-urlencode 'targets=[{"key":"demo@@@demo-1@@@7","cid":7,"type":0,"siteName":"Demo","vodName":"Sample item","vodPic":"https://example.com/poster.jpg","createTime":1788825600000}]'

Viewing history

Viewing history uses type=history, a single config, and a History array; merging compares createTime on entries with the same name instead of overwriting everything. A sync may load another configuration, so back up personal data first.

curl "http://127.0.0.1:9978/action?do=sync&type=history&mode=0" --data-urlencode 'config={"id":7,"type":0,"url":"https://example.com/vod.json","name":"Sample configuration"}' --data-urlencode 'targets=[{"key":"demo@@@demo-1@@@7","vodName":"Sample item","vodFlag":"Demo","vodRemarks":"Episode 1","episodeUrl":"demo://episode/1","position":120000,"createTime":1788825600000}]'

Merge rules

Local records
Existing entries in the App
Incoming targets
History锛廗eep in the request
→Compare createTime
Take the newer
The more recent side wins
→The other is older
Keep local
Existing data is preserved