fix(master-link): Rename RPCD to luci.master_link and flatten JSON output
Hyphens in RPCD filenames break ubus CLI argument parsing. Rename luci.master-link to luci.master_link and update all references in the JS view, ACL, and Makefile. Also pipe RPCD method output through tr -d '\n\t' so ubus receives single-line JSON it can parse. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
c4c829a593
commit
13960d39c3
@ -23,7 +23,7 @@ define Package/luci-app-master-link/install
|
||||
$(INSTALL_DATA) ./htdocs/luci-static/resources/view/secubox/master-link.js $(1)/www/luci-static/resources/view/secubox/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||
$(INSTALL_BIN) ./root/usr/libexec/rpcd/luci.master-link $(1)/usr/libexec/rpcd/
|
||||
$(INSTALL_BIN) ./root/usr/libexec/rpcd/luci.master_link $(1)/usr/libexec/rpcd/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,luci-app-master-link))
|
||||
|
||||
@ -7,36 +7,36 @@
|
||||
'require uci';
|
||||
|
||||
var callStatus = rpc.declare({
|
||||
object: 'luci.master-link',
|
||||
object: 'luci.master_link',
|
||||
method: 'status',
|
||||
expect: { '': {} }
|
||||
});
|
||||
|
||||
var callPeers = rpc.declare({
|
||||
object: 'luci.master-link',
|
||||
object: 'luci.master_link',
|
||||
method: 'peers',
|
||||
expect: { '': {} }
|
||||
});
|
||||
|
||||
var callTree = rpc.declare({
|
||||
object: 'luci.master-link',
|
||||
object: 'luci.master_link',
|
||||
method: 'tree',
|
||||
expect: { '': {} }
|
||||
});
|
||||
|
||||
var callTokenGenerate = rpc.declare({
|
||||
object: 'luci.master-link',
|
||||
object: 'luci.master_link',
|
||||
method: 'token_generate'
|
||||
});
|
||||
|
||||
var callApprove = rpc.declare({
|
||||
object: 'luci.master-link',
|
||||
object: 'luci.master_link',
|
||||
method: 'approve',
|
||||
params: ['fingerprint', 'action', 'reason']
|
||||
});
|
||||
|
||||
var callTokenCleanup = rpc.declare({
|
||||
object: 'luci.master-link',
|
||||
object: 'luci.master_link',
|
||||
method: 'token_cleanup'
|
||||
});
|
||||
|
||||
|
||||
@ -9,20 +9,20 @@ case "$1" in
|
||||
call)
|
||||
case "$2" in
|
||||
status)
|
||||
. /usr/lib/secubox/master-link.sh 2>/dev/null
|
||||
ml_status
|
||||
. /usr/lib/secubox/master-link.sh >/dev/null 2>&1
|
||||
ml_status | tr -d '\n\t'
|
||||
;;
|
||||
peers)
|
||||
. /usr/lib/secubox/master-link.sh 2>/dev/null
|
||||
ml_peer_list
|
||||
. /usr/lib/secubox/master-link.sh >/dev/null 2>&1
|
||||
ml_peer_list | tr -d '\n\t'
|
||||
;;
|
||||
tree)
|
||||
. /usr/lib/secubox/master-link.sh 2>/dev/null
|
||||
ml_tree
|
||||
. /usr/lib/secubox/master-link.sh >/dev/null 2>&1
|
||||
ml_tree | tr -d '\n\t'
|
||||
;;
|
||||
token_generate)
|
||||
. /usr/lib/secubox/master-link.sh 2>/dev/null
|
||||
ml_token_generate
|
||||
. /usr/lib/secubox/master-link.sh >/dev/null 2>&1
|
||||
ml_token_generate | tr -d '\n\t'
|
||||
;;
|
||||
approve)
|
||||
read -r input
|
||||
@ -30,17 +30,17 @@ case "$1" in
|
||||
action=$(echo "$input" | jsonfilter -e '@.action' 2>/dev/null)
|
||||
reason=$(echo "$input" | jsonfilter -e '@.reason' 2>/dev/null)
|
||||
|
||||
. /usr/lib/secubox/master-link.sh 2>/dev/null
|
||||
. /usr/lib/secubox/master-link.sh >/dev/null 2>&1
|
||||
|
||||
case "$action" in
|
||||
approve)
|
||||
ml_join_approve "$fingerprint"
|
||||
ml_join_approve "$fingerprint" | tr -d '\n\t'
|
||||
;;
|
||||
reject)
|
||||
ml_join_reject "$fingerprint" "$reason"
|
||||
ml_join_reject "$fingerprint" "$reason" | tr -d '\n\t'
|
||||
;;
|
||||
promote)
|
||||
ml_promote_to_submaster "$fingerprint"
|
||||
ml_promote_to_submaster "$fingerprint" | tr -d '\n\t'
|
||||
;;
|
||||
*)
|
||||
echo '{"error":"invalid_action"}'
|
||||
@ -48,8 +48,8 @@ case "$1" in
|
||||
esac
|
||||
;;
|
||||
token_cleanup)
|
||||
. /usr/lib/secubox/master-link.sh 2>/dev/null
|
||||
ml_token_cleanup
|
||||
. /usr/lib/secubox/master-link.sh >/dev/null 2>&1
|
||||
ml_token_cleanup | tr -d '\n\t'
|
||||
;;
|
||||
*)
|
||||
echo '{"error":"unknown_method"}'
|
||||
@ -8,7 +8,7 @@
|
||||
},
|
||||
"ubus": {
|
||||
"file": ["read", "stat"],
|
||||
"luci.master-link": ["*"]
|
||||
"luci.master_link": ["*"]
|
||||
},
|
||||
"uci": ["master-link"]
|
||||
},
|
||||
@ -17,7 +17,7 @@
|
||||
"/etc/config/master-link": ["write"]
|
||||
},
|
||||
"ubus": {
|
||||
"luci.master-link": ["*"]
|
||||
"luci.master_link": ["*"]
|
||||
},
|
||||
"uci": ["master-link"]
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user