title: $:/plugins/Gk0Wk/CPL-Repo/background-actions/auto-fetch-update-json
tags: $:/tags/BackgroundAction
platforms: browser
track-filter: [prefix[$:/temp/CPL-Repo/plugin-database-tab-state]get[text]match[$:/plugins/Gk0Wk/CPL-Repo/views/system/update-manager]]

<$action-sendmessage $message="tm-http-request"
  url={{{ [[$:/plugins/Gk0Wk/CPL-Repo/config/current-static-repo]get[text]addsuffix[/update.json]] }}}
  method="GET"
  oncompletion="""<$list filter='[<status>compare:number:gteq[200]compare:number:lt[300]]'>
  <$action-sendmessage $message="cpl-process-update-json" data=<<data>>/>
</$list>
<$list filter='[<status>compare:number:lt[200]] [<status>compare:number:gteq[300]] +[limit[1]]'>
  <$action-setfield $tiddler='$:/temp/CPL-Repo/updating' text={{{ [<error>!is[blank]then<error>] [<data>!is[blank]then<data>] [<statusText>!is[blank]then<statusText>] +[limit[1]] }}}/>
</$list>"""/>
