fix(cyberfeed): Wrap RPCD array responses in objects for LuCI RPC
- get_feeds now returns {"feeds": [...]} instead of raw array
- get_items now returns {"items": [...]} instead of raw array
- Updated api.js to extract arrays from wrapped responses
- Fixes feed list not displaying in LuCI dashboard
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
22f6f26a01
commit
0607ed5628
@ -11,7 +11,7 @@ LUCI_PKGARCH:=all
|
|||||||
|
|
||||||
PKG_NAME:=luci-app-cyberfeed
|
PKG_NAME:=luci-app-cyberfeed
|
||||||
PKG_VERSION:=0.1.0
|
PKG_VERSION:=0.1.0
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
|
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
|
||||||
PKG_LICENSE:=MIT
|
PKG_LICENSE:=MIT
|
||||||
|
|||||||
@ -16,13 +16,13 @@ var callGetStatus = rpc.declare({
|
|||||||
var callGetFeeds = rpc.declare({
|
var callGetFeeds = rpc.declare({
|
||||||
object: 'luci.cyberfeed',
|
object: 'luci.cyberfeed',
|
||||||
method: 'get_feeds',
|
method: 'get_feeds',
|
||||||
expect: { }
|
expect: { feeds: [] }
|
||||||
});
|
});
|
||||||
|
|
||||||
var callGetItems = rpc.declare({
|
var callGetItems = rpc.declare({
|
||||||
object: 'luci.cyberfeed',
|
object: 'luci.cyberfeed',
|
||||||
method: 'get_items',
|
method: 'get_items',
|
||||||
expect: { }
|
expect: { items: [] }
|
||||||
});
|
});
|
||||||
|
|
||||||
var callAddFeed = rpc.declare({
|
var callAddFeed = rpc.declare({
|
||||||
@ -83,11 +83,15 @@ return baseclass.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getFeeds: function() {
|
getFeeds: function() {
|
||||||
return callGetFeeds();
|
return callGetFeeds().then(function(res) {
|
||||||
|
return res.feeds || [];
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getItems: function() {
|
getItems: function() {
|
||||||
return callGetItems();
|
return callGetItems().then(function(res) {
|
||||||
|
return res.items || [];
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
addFeed: function(name, url, type, category) {
|
addFeed: function(name, url, type, category) {
|
||||||
|
|||||||
@ -77,20 +77,20 @@ EOF
|
|||||||
|
|
||||||
# Get feeds list
|
# Get feeds list
|
||||||
get_feeds() {
|
get_feeds() {
|
||||||
|
local feeds="[]"
|
||||||
if [ -x "$CYBERFEED_BIN" ]; then
|
if [ -x "$CYBERFEED_BIN" ]; then
|
||||||
$CYBERFEED_BIN list
|
feeds=$($CYBERFEED_BIN list)
|
||||||
else
|
|
||||||
echo "[]"
|
|
||||||
fi
|
fi
|
||||||
|
echo "{\"feeds\":$feeds}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get feed items
|
# Get feed items
|
||||||
get_items() {
|
get_items() {
|
||||||
|
local items="[]"
|
||||||
if [ -f "${OUTPUT_DIR}/feeds.json" ]; then
|
if [ -f "${OUTPUT_DIR}/feeds.json" ]; then
|
||||||
cat "${OUTPUT_DIR}/feeds.json"
|
items=$(cat "${OUTPUT_DIR}/feeds.json")
|
||||||
else
|
|
||||||
echo "[]"
|
|
||||||
fi
|
fi
|
||||||
|
echo "{\"items\":$items}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add a feed
|
# Add a feed
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user