⛅ Sync 2026-10-07 23:59:28

This commit is contained in:
github-actions[bot] committed 2026-10-07 23:59:28 +08:00
1 parent 26ea6d17f5
commit 5a632575da
108 files changed
+420 -455

No files matched your search

@@ -15,6 +15,7 @@ fi
LOG_FILE="/tmp/honk_dashboard_download.log"
STATUS_FILE="/tmp/honk_dashboard_download.status"
TMP_DIR="/tmp/dashboard_dl_$$"
trap 'rm -rf "$TMP_DIR"' EXIT INT TERM
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" >> "$LOG_FILE"
@@ -182,10 +183,17 @@ if [ ! -f "$DEPLOY_SRC/index.html" ]; then
fi
log "Deploying files to $TARGET_DIR..."
case "$TARGET_DIR" in
/etc/honk/*) ;;
*)
log "Error: Invalid target directory (must be inside /etc/honk): $TARGET_DIR"
set_status "FAILED"
exit 1
;;
esac
mkdir -p "$TARGET_DIR"
if [ -n "$TARGET_DIR" ] && [ "$TARGET_DIR" != "/" ] && [ "$TARGET_DIR" != "/etc" ] && [ "$TARGET_DIR" != "/tmp" ]; then
rm -rf "${TARGET_DIR:?}"/* "${TARGET_DIR:?}"/.[!.]* 2>/dev/null || true
fi
rm -rf "${TARGET_DIR:?}"/* "${TARGET_DIR:?}"/.[!.]* 2>/dev/null || true
cp -rf "$DEPLOY_SRC/"* "$TARGET_DIR/"
rm -rf "$TARGET_DIR"/*.md "$TARGET_DIR"/LICENSE* "$TARGET_DIR"/NOTICE "$TARGET_DIR"/LICENSES 2>/dev/null || true
chmod -R 755 "$TARGET_DIR"
+74 -70
View File
@@ -90,6 +90,75 @@ function strip_dae_comments(content) {
return join("\n", clean_lines);
}
function find_bracket_block(content, header_regex) {
let lines = split(content, "\n");
let start_idx = -1;
let end_idx = -1;
let in_block = false;
let depth = 0;
let in_single = false;
let in_double = false;
for (let idx, line in lines) {
let trimmed = trim(line);
if (!in_block && match(trimmed, header_regex)) {
in_block = true;
start_idx = idx;
}
if (in_block) {
let len = length(line);
for (let i = 0; i < len; i++) {
let c = substr(line, i, 1);
let next_c = (i + 1 < len) ? substr(line, i + 1, 1) : "";
if (c == "'" && !in_double) {
in_single = !in_single;
} else if (c == '"' && !in_single) {
in_double = !in_double;
} else if (!in_single && !in_double) {
if (c == '#' || (c == '/' && next_c == '/')) {
break;
} else if (c == '{') {
depth++;
} else if (c == '}') {
depth--;
if (depth <= 0) {
end_idx = idx;
break;
}
}
}
}
if (end_idx != -1) break;
}
}
return { start: start_idx, end: end_idx };
}
function extract_bracket_block(content, header_regex) {
let bounds = find_bracket_block(content, header_regex);
if (bounds.start == -1 || bounds.end == -1) return null;
let lines = split(content, "\n");
let block_lines = [];
for (let i = bounds.start; i <= bounds.end; i++) {
push(block_lines, lines[i]);
}
return join("\n", block_lines);
}
function remove_bracket_block(content, header_regex) {
let bounds = find_bracket_block(content, header_regex);
if (bounds.start == -1 || bounds.end == -1) return content;
let lines = split(content, "\n");
let new_lines = [];
for (let i = 0; i < length(lines); i++) {
if (i < bounds.start || i > bounds.end) {
push(new_lines, lines[i]);
}
}
return join("\n", new_lines);
}
function parse_native_api(clean_content) {
let block = extract_bracket_block(clean_content, /native_api\s*\{/);
if (!block) return null;
@@ -166,75 +235,6 @@ function get_api_config() {
};
}
function find_bracket_block(content, header_regex) {
let lines = split(content, "\n");
let start_idx = -1;
let end_idx = -1;
let in_block = false;
let depth = 0;
let in_single = false;
let in_double = false;
for (let idx, line in lines) {
let trimmed = trim(line);
if (!in_block && match(trimmed, header_regex)) {
in_block = true;
start_idx = idx;
}
if (in_block) {
let len = length(line);
for (let i = 0; i < len; i++) {
let c = substr(line, i, 1);
let next_c = (i + 1 < len) ? substr(line, i + 1, 1) : "";
if (c == "'" && !in_double) {
in_single = !in_single;
} else if (c == '"' && !in_single) {
in_double = !in_double;
} else if (!in_single && !in_double) {
if (c == '#' || (c == '/' && next_c == '/')) {
break;
} else if (c == '{') {
depth++;
} else if (c == '}') {
depth--;
if (depth <= 0) {
end_idx = idx;
break;
}
}
}
}
if (end_idx != -1) break;
}
}
return { start: start_idx, end: end_idx };
}
function extract_bracket_block(content, header_regex) {
let bounds = find_bracket_block(content, header_regex);
if (bounds.start == -1 || bounds.end == -1) return null;
let lines = split(content, "\n");
let block_lines = [];
for (let i = bounds.start; i <= bounds.end; i++) {
push(block_lines, lines[i]);
}
return join("\n", block_lines);
}
function remove_bracket_block(content, header_regex) {
let bounds = find_bracket_block(content, header_regex);
if (bounds.start == -1 || bounds.end == -1) return content;
let lines = split(content, "\n");
let new_lines = [];
for (let i = 0; i < length(lines); i++) {
if (i < bounds.start || i > bounds.end) {
push(new_lines, lines[i]);
}
}
return join("\n", new_lines);
}
function get_uci_dashboard_type(u) {
if (!u) return null;
u.load("honk");
@@ -374,6 +374,7 @@ function download_dashboard(req) {
}
function switch_dashboard_api(target_type) {
cached_pid = null;
let api_file = get_api_file_path();
let config_file = get_config_file_path();
@@ -478,6 +479,7 @@ return {
reload: {
call: function(req) {
cached_pid = null;
system("/etc/init.d/honk hot_reload >/dev/null 2>&1 &");
return { success: true };
}
@@ -485,6 +487,7 @@ return {
restart: {
call: function(req) {
cached_pid = null;
system("/etc/init.d/honk restart >/dev/null 2>&1 &");
return { success: true };
}
@@ -501,7 +504,8 @@ return {
clear_log: {
call: function(req) {
system("true > /var/log/honk/honk.log");
system("mkdir -p /var/log/honk");
writefile("/var/log/honk/honk.log", "");
return { success: true };
}
},