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:
@@ -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 || "");
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user