auc: update to version 0.2.0

* support for ASU server post commit aparcar/asu@bac6de18

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle 2021-08-15 02:14:20 +01:00
parent 51f9a12a54
commit b1d38e7ab3
No known key found for this signature in database
GPG Key ID: 5A8F39C31C3217CA
2 changed files with 10 additions and 3 deletions

View File

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=auc
PKG_VERSION:=0.1.9
PKG_VERSION:=0.2.0
PKG_RELEASE:=$(AUTORELEASE)
PKG_LICENSE:=GPL-3.0

View File

@ -1202,6 +1202,7 @@ static int request_branches(bool only_active)
struct blob_attr *tb[__REPLY_MAX];
int rem;
char url[256];
struct blob_attr *data;
blobmsg_buf_init(&brbuf);
snprintf(url, sizeof(url), "%s/%s/%s%s", serverurl, API_JSON,
@ -1214,10 +1215,16 @@ static int request_branches(bool only_active)
blobmsg_parse(reply_policy, __REPLY_MAX, tb, blob_data(brbuf.head), blob_len(brbuf.head));
if (!tb[REPLY_ARRAY])
/* newer server API replies OBJECT, older API replies ARRAY... */
if ((!tb[REPLY_ARRAY] && !tb[REPLY_OBJECT]))
return -ENODATA;
blobmsg_for_each_attr(cur, tb[REPLY_ARRAY], rem)
if (tb[REPLY_OBJECT])
data = tb[REPLY_OBJECT];
else
data = tb[REPLY_ARRAY];
blobmsg_for_each_attr(cur, data, rem)
process_branch(cur, only_active);
blob_buf_free(&brbuf);