Files
ShortX_ToolHub/code/th_10_shell.js
root 40a60a6912 refactor: remove Action-first shell path, keep only broadcast bridge
- th_10_shell.js: clean up outdated comments, title now 'Shell: broadcast execution'
- th_11_action.js: update toast msg from 'Action + bridge both failed' to 'broadcast bridge send failed'
- th_01_base.js: remove 'Action-first path' reference in Base64 decode comment
- th_16_entry.js already has useActionFirst: false / hasShellCommand: false
2026-04-20 12:29:04 +08:00

29 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// @version 1.0.0
// =======================【Shell广播桥执行】======================
// 仅通过广播桥发送 shell 命令,由外部接收器实际执行。
// 注意system_server 进程本身不直接执行 shell。
FloatBallAppWM.prototype.execShellSmart = function(cmdB64, needRoot) {
var ret = { ok: false, via: "", err: "" };
try {
var action = String(this.config.SHELL_BRIDGE_ACTION || CONST_SHELL_BRIDGE_ACTION || "shortx.toolhub.SHELL");
var it = new android.content.Intent(action);
// 广播协议cmd_b64 + root + from
it.putExtra(CONST_SHELL_BRIDGE_EXTRA_CMD, String(cmdB64));
it.putExtra(CONST_SHELL_BRIDGE_EXTRA_ROOT, !!needRoot);
it.putExtra(CONST_SHELL_BRIDGE_EXTRA_FROM, "ToolHub");
context.sendBroadcast(it);
ret.ok = true;
ret.via = "BroadcastBridge";
safeLog(this.L, 'i', "shell via broadcast ok action=" + action + " root=" + String(!!needRoot));
} catch (eB) {
ret.err = "Broadcast err=" + String(eB);
safeLog(this.L, 'e', "shell via broadcast fail err=" + String(eB));
}
return ret;
};