fix(singbox): strip <b prefix from binary UCI buffer strings in uci_bin_to_hex

This commit is contained in:
Dushnilin
2026-07-28 01:02:28 +03:00
parent e9a9ead675
commit e936f39b53
2 changed files with 10 additions and 7 deletions
+5 -4
View File
@@ -54,10 +54,11 @@ const CONFIG_NAME = "tachyon";
// serialized back to JSON appear as '<b 0x...>' — invalid for sing-box.
function uci_bin_to_hex(val) {
if (val == null || val == "") return "";
// Coerce to string — binary buffer becomes "<b 0x...>"
let s = replace("" + val, "<b 0x", "");
s = replace(s, ">", "");
s = replace(s, " ", "");
let s = as_string(val);
s = replace(s, /^<b\s*/i, "");
s = replace(s, /^0x/i, "");
s = replace(s, />$/, "");
s = replace(s, /\s+/g, "");
return s;
}
@@ -53,9 +53,11 @@ function unique_string_array(values) {
function uci_bin_to_hex(val) {
if (val == null || val == "") return "";
let s = replace("" + val, "<b 0x", "");
s = replace(s, ">", "");
s = replace(s, " ", "");
let s = as_string(val);
s = replace(s, /^<b\s*/i, "");
s = replace(s, /^0x/i, "");
s = replace(s, />$/, "");
s = replace(s, /\s+/g, "");
return s;
}