Compare commits
2 Commits
c62328c419
...
407cd2200c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
407cd2200c | ||
|
|
1d49609131 |
21
ToolHub.js
21
ToolHub.js
@@ -33,16 +33,31 @@ function getTrustedShaPath(relPath) { return getCodeDirPath() + ".trusted_sha_"
|
|||||||
function getTrustedVersionPath() { return getCodeDirPath() + ".trusted_manifest_version"; }
|
function getTrustedVersionPath() { return getCodeDirPath() + ".trusted_manifest_version"; }
|
||||||
|
|
||||||
function writeLog(msg) {
|
function writeLog(msg) {
|
||||||
|
var writer = null;
|
||||||
try {
|
try {
|
||||||
var f = new java.io.File(getLogPath());
|
var f = new java.io.File(getLogPath());
|
||||||
var dir = f.getParentFile();
|
var dir = f.getParentFile();
|
||||||
if (dir && !dir.exists()) dir.mkdirs();
|
if (dir && !dir.exists()) dir.mkdirs();
|
||||||
|
try {
|
||||||
|
var maxBytes = 512 * 1024;
|
||||||
|
if (f.exists() && f.length() > maxBytes) {
|
||||||
|
var bak = new java.io.File(String(f.getAbsolutePath()) + ".bak");
|
||||||
|
try { if (bak.exists()) bak.delete(); } catch (eBak0) {}
|
||||||
|
var moved = false;
|
||||||
|
try { moved = f.renameTo(bak); } catch (eMv) { moved = false; }
|
||||||
|
if (!moved) {
|
||||||
|
try { f.delete(); } catch (eDel) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (eTrim) {}
|
||||||
var sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
var sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
var ts = sdf.format(new java.util.Date());
|
var ts = sdf.format(new java.util.Date());
|
||||||
var writer = new java.io.FileWriter(f, true);
|
writer = new java.io.FileWriter(f, true);
|
||||||
writer.write("[" + ts + "] " + String(msg) + "\n");
|
writer.write("[" + ts + "] " + String(msg) + "\n");
|
||||||
writer.close();
|
} catch (e) {
|
||||||
} catch (e) {}
|
} finally {
|
||||||
|
try { if (writer) writer.close(); } catch (eClose) {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function runShell(cmdArr) {
|
function runShell(cmdArr) {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
a154dbf74570e6cd8ca14ad212c9213824b9c82d94722e0959e9e51cce577447 ToolHub.js
|
01d93690bdfc402ad59d6f51db45e3e057a3ebcbbf146a5667ecc5486e2d3ed6 ToolHub.js
|
||||||
|
|||||||
@@ -1188,8 +1188,15 @@ function applyRule(rule, kv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// =======================【日志:文件写入器(尽力落盘 + 自动清理旧日志)】=======================
|
// =======================【日志:文件写入器(尽力落盘 + 自动清理旧日志)】=======================
|
||||||
// =======================【日志:文件写入器(全局统一目录 + 分级)】=======================
|
function sanitizeLogMessage(msg) {
|
||||||
// 优化后的日志系统(带缓冲,减少文件 IO)
|
try {
|
||||||
|
var s = String(msg == null ? "" : msg);
|
||||||
|
s = s.replace(/(authorization\s*[:=]\s*bearer\s+)[^\s,;]+/ig, "$1[REDACTED]");
|
||||||
|
s = s.replace(/((access_)?token|api[_-]?key|password|passwd|secret)(\s*[=:]\s*)[^\s,;]+/ig, "$1$3[REDACTED]");
|
||||||
|
return s;
|
||||||
|
} catch (e) { return String(msg == null ? "" : msg); }
|
||||||
|
}
|
||||||
|
|
||||||
function ToolHubLogger(procInfo) {
|
function ToolHubLogger(procInfo) {
|
||||||
this.proc = procInfo || {};
|
this.proc = procInfo || {};
|
||||||
this.dir = PATH_LOG_DIR;
|
this.dir = PATH_LOG_DIR;
|
||||||
@@ -1199,17 +1206,10 @@ function ToolHubLogger(procInfo) {
|
|||||||
this.debug = false;
|
this.debug = false;
|
||||||
this.initOk = false;
|
this.initOk = false;
|
||||||
this.lastInitErr = "";
|
this.lastInitErr = "";
|
||||||
|
|
||||||
// 新增:日志缓冲
|
|
||||||
this._buffer = [];
|
|
||||||
this._bufferSize = 20; // 每 20 条写一次磁盘
|
|
||||||
this._flushTimer = null;
|
|
||||||
|
|
||||||
this._initOnce();
|
this._initOnce();
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolHubLogger.prototype._now = function() { return new Date().getTime(); };
|
ToolHubLogger.prototype._now = function() { return new Date().getTime(); };
|
||||||
|
|
||||||
ToolHubLogger.prototype._initOnce = function() {
|
ToolHubLogger.prototype._initOnce = function() {
|
||||||
try {
|
try {
|
||||||
if (FileIO.ensureDir(this.dir)) {
|
if (FileIO.ensureDir(this.dir)) {
|
||||||
@@ -1224,110 +1224,22 @@ ToolHubLogger.prototype._initOnce = function() {
|
|||||||
this.lastInitErr = String(e);
|
this.lastInitErr = String(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ToolHubLogger.prototype.updateConfig = function(cfg) {
|
ToolHubLogger.prototype.updateConfig = function(cfg) {
|
||||||
if (!cfg) return;
|
if (!cfg) return;
|
||||||
if (typeof cfg.LOG_KEEP_DAYS === "number") this.keepDays = cfg.LOG_KEEP_DAYS;
|
if (typeof cfg.LOG_KEEP_DAYS === "number") this.keepDays = cfg.LOG_KEEP_DAYS;
|
||||||
if (typeof cfg.LOG_ENABLE !== "undefined") this.enable = !!cfg.LOG_ENABLE;
|
if (typeof cfg.LOG_ENABLE !== "undefined") this.enable = !!cfg.LOG_ENABLE;
|
||||||
if (typeof cfg.LOG_DEBUG !== "undefined") this.debug = !!cfg.LOG_DEBUG;
|
if (typeof cfg.LOG_DEBUG !== "undefined") this.debug = !!cfg.LOG_DEBUG;
|
||||||
};
|
};
|
||||||
|
|
||||||
ToolHubLogger.prototype._line = function(level, msg) {
|
|
||||||
var ts = this._now();
|
|
||||||
var d = new Date(ts);
|
|
||||||
function pad2(x) { return (x < 10 ? "0" : "") + x; }
|
|
||||||
var t = d.getFullYear() + "-" + pad2(d.getMonth() + 1) + "-" + pad2(d.getDate()) +
|
|
||||||
" " + pad2(d.getHours()) + ":" + pad2(d.getMinutes()) + ":" + pad2(d.getSeconds());
|
|
||||||
return t + " [" + level + "] " + msg + "\n";
|
|
||||||
};
|
|
||||||
|
|
||||||
ToolHubLogger.prototype._scheduleFlush = function() {
|
|
||||||
if (this._flushTimer) try { this._flushTimer.cancel(); } catch(e) {}
|
|
||||||
var self = this;
|
|
||||||
this._flushTimer = new java.util.Timer();
|
|
||||||
this._flushTimer.schedule(new java.util.TimerTask({
|
|
||||||
run: function() { self._flushBuffer(); }
|
|
||||||
}), 3000); // 3秒后强制刷新
|
|
||||||
};
|
|
||||||
|
|
||||||
ToolHubLogger.prototype._flushBuffer = function() {
|
|
||||||
if (this._buffer.length === 0) return;
|
|
||||||
var content = this._buffer.join('');
|
|
||||||
this._buffer = [];
|
|
||||||
var path = this.dir + "/" + this.prefix + "_" + this._ymd() + ".log";
|
|
||||||
FileIO.appendText(path, content);
|
|
||||||
};
|
|
||||||
|
|
||||||
ToolHubLogger.prototype._ymd = function() {
|
ToolHubLogger.prototype._ymd = function() {
|
||||||
var d = new Date();
|
var d = new Date();
|
||||||
return "" + d.getFullYear() +
|
return "" + d.getFullYear() +
|
||||||
((d.getMonth() < 9 ? "0" : "") + (d.getMonth() + 1)) +
|
((d.getMonth() < 9 ? "0" : "") + (d.getMonth() + 1)) +
|
||||||
((d.getDate() < 10 ? "0" : "") + d.getDate());
|
((d.getDate() < 10 ? "0" : "") + d.getDate());
|
||||||
};
|
};
|
||||||
|
|
||||||
ToolHubLogger.prototype._write = function(level, msg) {
|
|
||||||
if (!this.enable) return false;
|
|
||||||
this._buffer.push(this._line(level, msg));
|
|
||||||
|
|
||||||
// 缓冲满或错误级别立即写入
|
|
||||||
if (this._buffer.length >= this._bufferSize || level === 'F' || level === 'E') {
|
|
||||||
this._flushBuffer();
|
|
||||||
} else {
|
|
||||||
this._scheduleFlush(); // 延迟写入
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
ToolHubLogger.prototype.d = function(msg) { if (this.debug) this._write("D", msg); };
|
|
||||||
ToolHubLogger.prototype.i = function(msg) { this._write("I", msg); };
|
|
||||||
ToolHubLogger.prototype.w = function(msg) { this._write("W", msg); };
|
|
||||||
ToolHubLogger.prototype.e = function(msg) { this._write("E", msg); };
|
|
||||||
ToolHubLogger.prototype.fatal = function(msg) { this._write("F", msg); this._flushBuffer(); };
|
|
||||||
|
|
||||||
ToolHubLogger.prototype.cleanupOldFiles = function() {
|
|
||||||
try {
|
|
||||||
if (!this.initOk) return false;
|
|
||||||
var dirF = new java.io.File(this.dir);
|
|
||||||
var files = dirF.listFiles();
|
|
||||||
if (!files) return false;
|
|
||||||
var now = this._now();
|
|
||||||
var cutoff = now - this.keepDays * 24 * 60 * 60 * 1000;
|
|
||||||
for (var i = 0; i < files.length; i++) {
|
|
||||||
var f = files[i];
|
|
||||||
if (f && f.isFile() && f.getName().indexOf(this.prefix) === 0 && f.lastModified() < cutoff) {
|
|
||||||
f["delete"]();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (e) { return false; };
|
|
||||||
};
|
|
||||||
|
|
||||||
ToolHubLogger.prototype._filePathForToday = function() {
|
ToolHubLogger.prototype._filePathForToday = function() {
|
||||||
var name = this.prefix + "_" + this._ymd(this._now()) + ".log";
|
var name = this.prefix + "_" + this._ymd() + ".log";
|
||||||
return this.dir + "/" + name;
|
return this.dir + "/" + name;
|
||||||
};
|
};
|
||||||
ToolHubLogger.prototype._initOnce = function() {
|
|
||||||
try {
|
|
||||||
// # 尝试创建目录
|
|
||||||
if (FileIO.ensureDir(this.dir)) {
|
|
||||||
this.initOk = true;
|
|
||||||
// # 清理旧日志
|
|
||||||
this.cleanupOldFiles();
|
|
||||||
} else {
|
|
||||||
this.initOk = false;
|
|
||||||
this.lastInitErr = "Mkdirs failed: " + this.dir;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
this.initOk = false;
|
|
||||||
this.lastInitErr = String(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ToolHubLogger.prototype.updateConfig = function(cfg) {
|
|
||||||
if (!cfg) return;
|
|
||||||
if (typeof cfg.LOG_KEEP_DAYS === "number") this.keepDays = cfg.LOG_KEEP_DAYS;
|
|
||||||
if (typeof cfg.LOG_ENABLE !== "undefined") this.enable = !!cfg.LOG_ENABLE;
|
|
||||||
if (typeof cfg.LOG_DEBUG !== "undefined") this.debug = !!cfg.LOG_DEBUG;
|
|
||||||
};
|
|
||||||
ToolHubLogger.prototype._line = function(level, msg) {
|
ToolHubLogger.prototype._line = function(level, msg) {
|
||||||
var ts = this._now();
|
var ts = this._now();
|
||||||
var d = new Date(ts);
|
var d = new Date(ts);
|
||||||
@@ -1339,7 +1251,7 @@ ToolHubLogger.prototype._line = function(level, msg) {
|
|||||||
proc = " uid=" + String(this.proc.uid) + " pid=" + String(this.proc.pid) + " tid=" + String(this.proc.tid) +
|
proc = " uid=" + String(this.proc.uid) + " pid=" + String(this.proc.pid) + " tid=" + String(this.proc.tid) +
|
||||||
" th=" + String(this.proc.threadName) + " proc=" + String(this.proc.processName);
|
" th=" + String(this.proc.threadName) + " proc=" + String(this.proc.processName);
|
||||||
} catch (e0) {}
|
} catch (e0) {}
|
||||||
return t + " [" + String(level) + "] " + String(msg) + proc + "\n";
|
return t + " [" + String(level) + "] " + sanitizeLogMessage(msg) + proc + "\n";
|
||||||
};
|
};
|
||||||
ToolHubLogger.prototype._writeRaw = function(level, msg) {
|
ToolHubLogger.prototype._writeRaw = function(level, msg) {
|
||||||
if (!this.initOk) return false;
|
if (!this.initOk) return false;
|
||||||
|
|||||||
@@ -288,7 +288,6 @@ FloatBallAppWM.prototype.applyImmediateEffectsForKey = function(k) {
|
|||||||
try {
|
try {
|
||||||
if (this.L) {
|
if (this.L) {
|
||||||
this.L.enable = !!this.config.LOG_ENABLE;
|
this.L.enable = !!this.config.LOG_ENABLE;
|
||||||
this.L.cfg.LOG_ENABLE = !!this.config.LOG_ENABLE;
|
|
||||||
this.L.i("apply LOG_ENABLE=" + String(this.config.LOG_ENABLE));
|
this.L.i("apply LOG_ENABLE=" + String(this.config.LOG_ENABLE));
|
||||||
}
|
}
|
||||||
} catch(eLE) { safeLog(null, 'e', "catch " + String(eLE)); }
|
} catch(eLE) { safeLog(null, 'e', "catch " + String(eLE)); }
|
||||||
@@ -298,7 +297,6 @@ FloatBallAppWM.prototype.applyImmediateEffectsForKey = function(k) {
|
|||||||
try {
|
try {
|
||||||
if (this.L) {
|
if (this.L) {
|
||||||
this.L.debug = !!this.config.LOG_DEBUG;
|
this.L.debug = !!this.config.LOG_DEBUG;
|
||||||
this.L.cfg.LOG_DEBUG = !!this.config.LOG_DEBUG;
|
|
||||||
this.L.i("apply LOG_DEBUG=" + String(this.config.LOG_DEBUG));
|
this.L.i("apply LOG_DEBUG=" + String(this.config.LOG_DEBUG));
|
||||||
}
|
}
|
||||||
} catch(eLD) { safeLog(null, 'e', "catch " + String(eLD)); }
|
} catch(eLD) { safeLog(null, 'e', "catch " + String(eLD)); }
|
||||||
@@ -310,7 +308,6 @@ FloatBallAppWM.prototype.applyImmediateEffectsForKey = function(k) {
|
|||||||
this.config.LOG_KEEP_DAYS = n;
|
this.config.LOG_KEEP_DAYS = n;
|
||||||
if (this.L) {
|
if (this.L) {
|
||||||
this.L.keepDays = n;
|
this.L.keepDays = n;
|
||||||
this.L.cfg.LOG_KEEP_DAYS = n;
|
|
||||||
this.L.i("apply LOG_KEEP_DAYS=" + String(n));
|
this.L.i("apply LOG_KEEP_DAYS=" + String(n));
|
||||||
this.L.cleanupOldFiles();
|
this.L.cleanupOldFiles();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,24 +21,23 @@ FloatBallAppWM.prototype.execButtonAction = function(btn, idx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (t === "open_viewer") {
|
if (t === "open_viewer") {
|
||||||
var logPath = (this.L && this.L._filePathForToday) ? this.L._filePathForToday() : "";
|
function tailLogText(path, maxLen) {
|
||||||
if (!logPath) logPath = PATH_LOG_DIR + "/ShortX_ToolHub_" + (new java.text.SimpleDateFormat("yyyyMMdd").format(new java.util.Date())) + ".log";
|
var txt = FileIO.readText(path);
|
||||||
|
if (!txt) return "(日志文件不存在或为空: " + path + ")";
|
||||||
var content = FileIO.readText(logPath);
|
txt = String(txt);
|
||||||
if (!content) content = "(日志文件不存在或为空: " + logPath + ")";
|
if (txt.length > maxLen) txt = "[...前略...]\n" + txt.substring(txt.length - maxLen);
|
||||||
|
|
||||||
if (content.length > 30000) {
|
|
||||||
content = "[...前略...]\n" + content.substring(content.length - 30000);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 简单的按行倒序,方便查看最新日志
|
|
||||||
try {
|
try {
|
||||||
var lines = content.split("\n");
|
var lines = txt.split("\n");
|
||||||
if (lines.length > 1) {
|
if (lines.length > 1) txt = lines.reverse().join("\n");
|
||||||
content = lines.reverse().join("\n");
|
|
||||||
}
|
|
||||||
} catch(eRev) { safeLog(null, 'e', "catch " + String(eRev)); }
|
} catch(eRev) { safeLog(null, 'e', "catch " + String(eRev)); }
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
|
var runLogPath = (this.L && this.L._filePathForToday) ? this.L._filePathForToday() : "";
|
||||||
|
if (!runLogPath) runLogPath = PATH_LOG_DIR + "/ShortX_ToolHub_" + (new java.text.SimpleDateFormat("yyyyMMdd").format(new java.util.Date())) + ".log";
|
||||||
|
var initLogPath = PATH_LOG_DIR + "/init.log";
|
||||||
|
var content = "【启动/更新日志】\n" + tailLogText(initLogPath, 15000) +
|
||||||
|
"\n\n【运行日志】\n" + tailLogText(runLogPath, 15000);
|
||||||
|
if (content.length > 32000) content = content.substring(0, 32000) + "\n[...后略...]";
|
||||||
this.showViewerPanel("今日日志 (倒序)", content);
|
this.showViewerPanel("今日日志 (倒序)", content);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -132,7 +131,7 @@ return;
|
|||||||
if (r && r.ok) return;
|
if (r && r.ok) return;
|
||||||
|
|
||||||
this.toast("shell 广播桥发送失败");
|
this.toast("shell 广播桥发送失败");
|
||||||
safeLog(this.L, 'e', "shell all failed cmd_b64=" + cmdB64 + " ret=" + JSON.stringify(r || {}));
|
safeLog(this.L, 'e', "shell all failed cmd_b64_len=" + String(cmdB64 ? cmdB64.length : 0) + " ret=" + JSON.stringify(r || {}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1261,6 +1261,11 @@ FloatBallAppWM.prototype.buildToolAppShell = function(contentView, title, canBac
|
|||||||
try { if (this.applySettingsTheme) this.applySettingsTheme(T, isDark, C, cfgTpl); } catch(eTheme) { safeLog(null, 'e', "catch " + String(eTheme)); }
|
try { if (this.applySettingsTheme) this.applySettingsTheme(T, isDark, C, cfgTpl); } catch(eTheme) { safeLog(null, 'e', "catch " + String(eTheme)); }
|
||||||
var spec = this.getToolAppResponsiveSpec ? this.getToolAppResponsiveSpec() : null;
|
var spec = this.getToolAppResponsiveSpec ? this.getToolAppResponsiveSpec() : null;
|
||||||
var shellPad = spec ? spec.shellPadding : this.dp(6);
|
var shellPad = spec ? spec.shellPadding : this.dp(6);
|
||||||
|
var shellTopPad = shellPad;
|
||||||
|
try {
|
||||||
|
var topInset = this.getToolAppStatusBarInsetPx ? this.getToolAppStatusBarInsetPx() : 0;
|
||||||
|
if (!isNaN(topInset) && topInset > 0) shellTopPad = shellPad + topInset;
|
||||||
|
} catch(eTopInset) {}
|
||||||
var outerRadius = spec ? spec.outerRadius : this.dp(26);
|
var outerRadius = spec ? spec.outerRadius : this.dp(26);
|
||||||
var topBarHeight = spec ? spec.topBarHeight : this.dp(56);
|
var topBarHeight = spec ? spec.topBarHeight : this.dp(56);
|
||||||
var rootDownX = 0;
|
var rootDownX = 0;
|
||||||
@@ -1420,7 +1425,7 @@ FloatBallAppWM.prototype.buildToolAppShell = function(contentView, title, canBac
|
|||||||
var body = new android.widget.LinearLayout(context);
|
var body = new android.widget.LinearLayout(context);
|
||||||
body.setOrientation(android.widget.LinearLayout.VERTICAL);
|
body.setOrientation(android.widget.LinearLayout.VERTICAL);
|
||||||
// 外层薄荷容器本身就是整张“岛屿设置”卡片:四角统一圆角,并给底部留出完整收口。
|
// 外层薄荷容器本身就是整张“岛屿设置”卡片:四角统一圆角,并给底部留出完整收口。
|
||||||
body.setPadding(shellPad, shellPad, shellPad, shellPad);
|
body.setPadding(shellPad, shellTopPad, shellPad, shellPad);
|
||||||
body.setBackground(this.ui.createStrokeDrawable(T.bg, this.withAlpha(T.stroke, isDark ? 0.30 : 0.46), this.dp(1), outerRadius));
|
body.setBackground(this.ui.createStrokeDrawable(T.bg, this.withAlpha(T.stroke, isDark ? 0.30 : 0.46), this.dp(1), outerRadius));
|
||||||
try { body.setClipToOutline(true); } catch(eClip) {}
|
try { body.setClipToOutline(true); } catch(eClip) {}
|
||||||
try { body.setElevation(this.dp((spec && (spec.isExpandedWidth || spec.isWideWidth)) ? 7 : 10)); } catch(eElev) { safeLog(null, 'e', "catch " + String(eElev)); }
|
try { body.setElevation(this.dp((spec && (spec.isExpandedWidth || spec.isWideWidth)) ? 7 : 10)); } catch(eElev) { safeLog(null, 'e', "catch " + String(eElev)); }
|
||||||
@@ -1538,6 +1543,23 @@ FloatBallAppWM.prototype.setToolAppContent = function(contentView) {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FloatBallAppWM.prototype.getToolAppStatusBarInsetPx = function() {
|
||||||
|
var inset = 0;
|
||||||
|
try {
|
||||||
|
var res = context.getResources();
|
||||||
|
var id = res.getIdentifier("status_bar_height", "dimen", "android");
|
||||||
|
if (id > 0) inset = Number(res.getDimensionPixelSize(id) || 0);
|
||||||
|
} catch(eRes) {
|
||||||
|
inset = 0;
|
||||||
|
}
|
||||||
|
if (isNaN(inset) || inset < 0) inset = 0;
|
||||||
|
try {
|
||||||
|
var maxInset = this.dp(48);
|
||||||
|
if (inset > maxInset) inset = maxInset;
|
||||||
|
} catch(eClamp) {}
|
||||||
|
return Math.floor(inset);
|
||||||
|
};
|
||||||
|
|
||||||
FloatBallAppWM.prototype.calculateToolAppLayout = function(shell) {
|
FloatBallAppWM.prototype.calculateToolAppLayout = function(shell) {
|
||||||
var sw = Math.max(1, Number(this.state.screen && this.state.screen.w || 0));
|
var sw = Math.max(1, Number(this.state.screen && this.state.screen.w || 0));
|
||||||
var sh = Math.max(1, Number(this.state.screen && this.state.screen.h || 0));
|
var sh = Math.max(1, Number(this.state.screen && this.state.screen.h || 0));
|
||||||
@@ -1548,27 +1570,30 @@ FloatBallAppWM.prototype.calculateToolAppLayout = function(shell) {
|
|||||||
var isLandscape = spec ? spec.isLandscape : (sw > sh);
|
var isLandscape = spec ? spec.isLandscape : (sw > sh);
|
||||||
var shortSide = Math.min(sw, sh);
|
var shortSide = Math.min(sw, sh);
|
||||||
var longSide = Math.max(sw, sh);
|
var longSide = Math.max(sw, sh);
|
||||||
var marginX = this.dp(12), marginTop = this.dp(14), marginBottom = this.dp(14);
|
var marginX = this.dp(12), marginTop = 0, marginBottom = this.dp(14);
|
||||||
|
var statusInset = 0;
|
||||||
|
try { statusInset = this.getToolAppStatusBarInsetPx ? this.getToolAppStatusBarInsetPx() : 0; } catch(eInset) { statusInset = 0; }
|
||||||
|
if (isNaN(statusInset) || statusInset < 0) statusInset = 0;
|
||||||
var targetW, targetH;
|
var targetW, targetH;
|
||||||
if (spec && (spec.isCompactWidth || shortSide < this.dp(420))) {
|
if (spec && (spec.isCompactWidth || shortSide < this.dp(420))) {
|
||||||
marginX = this.dp(isLandscape ? 8 : 10); marginTop = this.dp(isLandscape ? 6 : 14); marginBottom = this.dp(isLandscape ? 6 : 14);
|
marginX = this.dp(isLandscape ? 8 : 10); marginTop = 0; marginBottom = this.dp(isLandscape ? 6 : 14);
|
||||||
targetW = Math.min(spec.contentMaxWidth, sw - marginX * 2);
|
targetW = Math.min(spec.contentMaxWidth, sw - marginX * 2);
|
||||||
targetH = isLandscape ? (sh - marginTop - marginBottom) : Math.min(Math.floor(sh * 0.92), sh - marginTop - marginBottom);
|
targetH = isLandscape ? (sh - marginTop - marginBottom) : Math.min(Math.floor(sh * 0.96), sh - marginTop - marginBottom);
|
||||||
} else if (spec && spec.isMediumWidth) {
|
} else if (spec && spec.isMediumWidth) {
|
||||||
marginX = this.dp(18); marginTop = this.dp(isLandscape ? 10 : 18); marginBottom = this.dp(isLandscape ? 10 : 18);
|
marginX = this.dp(18); marginTop = 0; marginBottom = this.dp(isLandscape ? 10 : 18);
|
||||||
targetW = Math.min(spec.contentMaxWidth, sw - marginX * 2); targetH = sh - marginTop - marginBottom;
|
targetW = Math.min(spec.contentMaxWidth, sw - marginX * 2); targetH = sh - marginTop - marginBottom;
|
||||||
} else if (spec && (spec.isExpandedWidth || shortSide >= this.dp(720))) {
|
} else if (spec && (spec.isExpandedWidth || shortSide >= this.dp(720))) {
|
||||||
marginX = this.dp(22); marginTop = this.dp(isLandscape ? 18 : 24); marginBottom = this.dp(isLandscape ? 18 : 24);
|
marginX = this.dp(22); marginTop = 0; marginBottom = this.dp(isLandscape ? 18 : 24);
|
||||||
targetW = Math.min(spec.contentMaxWidth, sw - marginX * 2); targetH = sh - marginTop - marginBottom;
|
targetW = Math.min(spec.contentMaxWidth, sw - marginX * 2); targetH = sh - marginTop - marginBottom;
|
||||||
} else {
|
} else {
|
||||||
marginX = this.dp(30); marginTop = this.dp(24); marginBottom = this.dp(24);
|
marginX = this.dp(30); marginTop = 0; marginBottom = this.dp(24);
|
||||||
targetW = Math.min(spec ? spec.contentMaxWidth : this.dp(1080), sw - marginX * 2);
|
targetW = Math.min(spec ? spec.contentMaxWidth : this.dp(1080), sw - marginX * 2);
|
||||||
targetH = Math.min(this.dp(860), sh - marginTop - marginBottom);
|
targetH = Math.min(this.dp(900), sh - marginTop - marginBottom);
|
||||||
}
|
}
|
||||||
targetW = Math.max(this.dp(300), Math.min(targetW, sw - marginX * 2));
|
targetW = Math.max(this.dp(300), Math.min(targetW, sw - marginX * 2));
|
||||||
targetH = Math.max(this.dp(320), Math.min(targetH, sh - marginTop - marginBottom));
|
targetH = Math.max(this.dp(320), Math.min(targetH, sh - marginTop - marginBottom));
|
||||||
var x = Math.floor((sw - targetW) / 2);
|
var x = Math.floor((sw - targetW) / 2);
|
||||||
var y = Math.floor((sh - targetH) / 2);
|
var y = marginTop;
|
||||||
if (x < marginX) x = marginX;
|
if (x < marginX) x = marginX;
|
||||||
if (y < marginTop) y = marginTop;
|
if (y < marginTop) y = marginTop;
|
||||||
if (x + targetW > sw - marginX) x = Math.max(0, sw - marginX - targetW);
|
if (x + targetW > sw - marginX) x = Math.max(0, sw - marginX - targetW);
|
||||||
|
|||||||
@@ -128,17 +128,6 @@ FloatBallAppWM.prototype.close = function() {
|
|||||||
|
|
||||||
safeLog(this.L, 'i', "close done");
|
safeLog(this.L, 'i', "close done");
|
||||||
|
|
||||||
// # 清理日志定时器
|
|
||||||
try {
|
|
||||||
if (this.L) {
|
|
||||||
try { this.L._flushBuffer(); } catch (eFlushLog0) { safeLog(this.L, 'e', "logger flush fail: " + String(eFlushLog0)); }
|
|
||||||
if (this.L._flushTimer) {
|
|
||||||
this.L._flushTimer.cancel();
|
|
||||||
this.L._flushTimer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (eLog) {}
|
|
||||||
|
|
||||||
// # 清空缓存
|
// # 清空缓存
|
||||||
try {
|
try {
|
||||||
this._iconLru = null;
|
this._iconLru = null;
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
"alg": "SHA256withRSA",
|
"alg": "SHA256withRSA",
|
||||||
"files": {
|
"files": {
|
||||||
"th_01_base.js": {
|
"th_01_base.js": {
|
||||||
"sha256": "c77eb730b0a54bfe784ff9fee4f88e3276826dc73ae98a2ef964bf5041632d38",
|
"sha256": "e465a92b21f6819079255719bfe41c28a42ff3716f1d29b399897bc299ef92ec",
|
||||||
"size": 57562
|
"size": 54633
|
||||||
},
|
},
|
||||||
"th_02_core.js": {
|
"th_02_core.js": {
|
||||||
"sha256": "7bfd21df21c137595c3e2a8724b3eb3f0cce82ef0dd18b732de08e9be30b2ba3",
|
"sha256": "7bfd21df21c137595c3e2a8724b3eb3f0cce82ef0dd18b732de08e9be30b2ba3",
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
"size": 42568
|
"size": 42568
|
||||||
},
|
},
|
||||||
"th_05_persistence.js": {
|
"th_05_persistence.js": {
|
||||||
"sha256": "fac67158d57ce23c92dbc4103d1732946b6ea0fde9f55a04edede9a1f201a7da",
|
"sha256": "7fd2a62275bd26fcd940202057480fca7a8a800eaeb1fcb9d52003e255d1ef60",
|
||||||
"size": 14921
|
"size": 14763
|
||||||
},
|
},
|
||||||
"th_06_icon_parser.js": {
|
"th_06_icon_parser.js": {
|
||||||
"sha256": "25b95a5df634a7ee359f3ab798e4d3154a71c24016f7b4bf8a658096644b2484",
|
"sha256": "25b95a5df634a7ee359f3ab798e4d3154a71c24016f7b4bf8a658096644b2484",
|
||||||
@@ -42,8 +42,8 @@
|
|||||||
"size": 1094
|
"size": 1094
|
||||||
},
|
},
|
||||||
"th_11_action.js": {
|
"th_11_action.js": {
|
||||||
"sha256": "a0142d26621f3d076bd1b749f2885af2c0806c9f206e362a3b3680a5d2312b31",
|
"sha256": "1ba348415e891093bcf49619d950e9653e1c7323c3d35f74f6f71bec14b7c9e6",
|
||||||
"size": 13545
|
"size": 13838
|
||||||
},
|
},
|
||||||
"th_12_rebuild.js": {
|
"th_12_rebuild.js": {
|
||||||
"sha256": "7b820e813d2dd8866778fefe8bfeb6aca227bb1a32a89d318de830178f19824f",
|
"sha256": "7b820e813d2dd8866778fefe8bfeb6aca227bb1a32a89d318de830178f19824f",
|
||||||
@@ -70,15 +70,15 @@
|
|||||||
"size": 20484
|
"size": 20484
|
||||||
},
|
},
|
||||||
"th_15_extra.js": {
|
"th_15_extra.js": {
|
||||||
"sha256": "f49d9e94702ff6b69b800aea10ae2d21dc0d52246ad176a92904a55352dbbf82",
|
"sha256": "5b39db203b748f9d9919b6e19fc9fae5b5b5dcce6f46ade0f8e5cd2729f223aa",
|
||||||
"size": 122822
|
"size": 123635
|
||||||
},
|
},
|
||||||
"th_16_entry.js": {
|
"th_16_entry.js": {
|
||||||
"sha256": "6c59d9891cd010647f84c3db93f1cf95c7bbfb758470ea21044bf72eb8ff73d1",
|
"sha256": "652aa70214a9419923785e528a067d3828094fde48fc9c8c57cfda1e08206e25",
|
||||||
"size": 12799
|
"size": 12479
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"keyId": "toolhub-targets-2026-rsa3072",
|
"keyId": "toolhub-targets-2026-rsa3072",
|
||||||
"schema": 2,
|
"schema": 2,
|
||||||
"version": 20260522181206
|
"version": 20260522191219
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
Oj/koe1KG25KEOTq/5jJfYFRBPL3ue9kSuhhKc7h0DGGpKJPwt0P1lmLCwJAKpIbwaQiuJo806UKW6r1qtHdjptDU0XreC8URd27lLWg1YgT61mVTKZK7qW8XSV71AebS51sHP+AmqAP9aiIdDRF1atUr0IX4+lxZAcN5t14aDLPwAqd0Kq5YJUUAjGACPbA9JuwjEwyXxlZ2NoyM2KZyDE983VlbJTEYUpvQYGZKKCSpPsowdNdz5OQMouDKigyLbCKQNva3+JtFfX4ZTzz4NMVJesBw82Q2MhlosCoAnrubhwj15MAYEMEP6TpajxjZVGVvFqCLJGh6d4lTq3i1RWPBGq7jTgIZPhlhUXSypt+v8TvWgv5UdmmDE+tSvPdNE+j8oLsah3toquYgiUcWnNaN2qdU9taa3cLb9JBOY1+mgs/M21yjYUC7A4WYpX7N4FPOqGLRUF0tPABBY1L6hY/gJ9YKPvvM4LC6e0C0cZThuBCJu/obk40Dl7iTcpS
|
c7CEARIR2JCXq4UkAGC9hQ2L7q9fM1CbSAZY5RazdoIijLBSNuXEmEgYVmlJNuJ4+hfU5vTCXgU8AkTL/NG4Q17fm27uFqQLkzqwb/9stQHvs3I4By9fWm11w9pcr17620vHe8alqjLslmLijUy0GSKy3r+nVQKFYWmveem5tdZNm6dXxbMG+2ePuPkc+CP02/vOQz9kx8C2eCFBjlcS+x/lOlpVYWXAqGGV7SseymOLe4RkGozz84p3fl8snFNOjA9F7CThAdEbd/UrC6UAM4VhVoaRuwHblWyxjTiRL4+OluIHWRnFDMpB7R3u/kp+mnon0v5gNlN4QIIVo4/jgVbWirsRAzw5+UM6Zft7T1P/j8MXAv8BrQzmMElU71vzReWyEmWvu6BjUi88R55IlZ8Fu5xjm6ttXCW0fB2miZ0Je52E3PdYKGzLMULtv2M07X71oSdqjd60g25R1ulGph6izuWKwxnabcSRLnvjgdhGl2qJUvMAn0LjCeARPFNC
|
||||||
|
|||||||
Reference in New Issue
Block a user