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
This commit is contained in:
root
2026-04-20 12:29:04 +08:00
parent e375f7d7ba
commit 40a60a6912
3 changed files with 6 additions and 11 deletions

View File

@@ -1097,7 +1097,7 @@ function getProcessInfo(tag) {
// =======================【工具Base64 解码UTF-8】=======================
// # 这段代码的主要内容/用途:把 cmd_b64 还原成原始 shell 文本(仅用于 Action 优先路径;广播桥永远传 b64
// # 这段代码的主要内容/用途:把 cmd_b64 还原成原始 shell 文本
function decodeBase64Utf8(b64) {
try {
var s = String(b64 || "");

View File

@@ -1,9 +1,7 @@
// @version 1.0.0
// =======================【Shell智能执行Action优先 + 广播桥兜底)】======================
// 这段代码的主要内容/用途:执行 Shell 按钮动作时,优先尝试 ShortX 的 ShellCommand Action如可用失败则走自定义广播桥由外部接收器实际执行
// 注意system_server 进程本身不直接执行 shell;这里只负责"触发执行"
// 这段代码的主要内容/用途:通过广播桥触发 Shell 执行(仅广播桥,不再使用 ShellCommand Action
// 注意system_server 进程本身不直接执行 shell外部接收器负责实际执行。
// =======================【Shell广播桥执行】======================
// 仅通过广播桥发送 shell 命令,由外部接收器实际执行。
// 注意system_server 进程本身不直接执行 shell。
FloatBallAppWM.prototype.execShellSmart = function(cmdB64, needRoot) {
var ret = { ok: false, via: "", err: "" };
@@ -11,10 +9,9 @@ FloatBallAppWM.prototype.execShellSmart = function(cmdB64, needRoot) {
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(不再发送明文 cmd避免协议漂移
// 广播协议cmd_b64 + root + from
it.putExtra(CONST_SHELL_BRIDGE_EXTRA_CMD, String(cmdB64));
it.putExtra(CONST_SHELL_BRIDGE_EXTRA_ROOT, !!needRoot);
// # from来源标记仅用于接收端识别/日志,不参与权限判断
it.putExtra(CONST_SHELL_BRIDGE_EXTRA_FROM, "ToolHub");
context.sendBroadcast(it);
@@ -29,5 +26,3 @@ FloatBallAppWM.prototype.execShellSmart = function(cmdB64, needRoot) {
return ret;
};

View File

@@ -131,7 +131,7 @@ return;
var r = this.execShellSmart(cmdB64, needRoot);
if (r && r.ok) return;
this.toast("shell 失败Action + 广播桥失败");
this.toast("shell 广播桥发送失败");
safeLog(this.L, 'e', "shell all failed cmd_b64=" + cmdB64 + " ret=" + JSON.stringify(r || {}));
return;
}