title: $:/plugins/Gk0Wk/CPL-Repo/background-actions/auto-fetch-plugin-activity
tags: $:/tags/BackgroundAction
platforms: browser
track-filter: [[$:/HistoryList]get[current-tiddler]get[cpl.title]] [[$:/HistoryList]get[current-tiddler]tag[$:/tags/PluginWiki]get[title]] [[$:/temp/CPL-Repo/server-type]get[text]] [[$:/temp/CPL-Server/api-base]get[text]]

<$list filter="[[$:/temp/CPL-Repo/server-type]get[text]match[server]]">
<$let pluginTitle={{{ [[$:/HistoryList]get[current-tiddler]get[cpl.title]!is[blank]] [[$:/HistoryList]get[current-tiddler]tag[$:/tags/PluginWiki]get[title]!is[blank]] +[limit[1]] }}}>
<$list filter="[<pluginTitle>!is[blank]]">
<$action-sendmessage $message="tm-http-request"
  url={{{ [[$:/temp/CPL-Server/api-base]get[text]addsuffix[/cpl/comments/]] [<pluginTitle>encodeuricomponent[]] +[join[]] }}}
  method="GET"
  var-storeTiddler={{{ [<pluginTitle>addprefix[$:/temp/CPL-Server/comments/]] }}}
  var-storePluginTitle=<<pluginTitle>>
  oncompletion="<$action-setfield $tiddler=<<storeTiddler>> text=<<data>> type='application/json' plugin-title=<<storePluginTitle>>/>"/>
<$action-sendmessage $message="tm-http-request"
  url={{{ [[$:/temp/CPL-Server/api-base]get[text]addsuffix[/cpl/changelog/]] [<pluginTitle>encodeuricomponent[]] +[join[]] }}}
  method="GET"
  var-storeTiddler={{{ [<pluginTitle>addprefix[$:/temp/CPL-Server/plugin-changelog/]] }}}
  var-storePluginTitle=<<pluginTitle>>
  oncompletion="<$action-setfield $tiddler=<<storeTiddler>> text=<<data>> type='application/json' plugin-title=<<storePluginTitle>>/>"/>
<$action-sendmessage $message="tm-http-request"
  url={{{ [[$:/temp/CPL-Server/api-base]get[text]addsuffix[/cpl/compatibility/]] [<pluginTitle>encodeuricomponent[]] +[join[]] }}}
  method="GET"
  var-storeTiddler={{{ [<pluginTitle>addprefix[$:/temp/CPL-Server/compatibility/]] }}}
  var-storePluginTitle=<<pluginTitle>>
  oncompletion="<$action-setfield $tiddler=<<storeTiddler>> text=<<data>> type='application/json' plugin-title=<<storePluginTitle>>/>"/>
<$action-sendmessage $message="tm-http-request"
  url={{{ [[$:/temp/CPL-Server/api-base]get[text]addsuffix[/cpl/stats/]] [<pluginTitle>encodeuricomponent[]] +[join[]] }}}
  method="GET"
  var-storePluginTitle=<<pluginTitle>>
  oncompletion="<$action-setfield $tiddler='$:/temp/CPL-Server/all-plugin-stats' text={{{ [[$:/temp/CPL-Server/all-plugin-stats]get[text]else[{&quot;plugins&quot;:{}}]jsonset:json[plugins],<storePluginTitle>,<data>] }}} type='application/json'/>"/>
</$list>
</$let>
</$list>
