feat: асинхронное обновление списков в LuCI (fix XHR timeout) и форматированный config.json
- backend: добавлены команды list_update_async и list_update_status с отслеживанием шагов в /var/run/tachyon/list-update.status - ui: кнопка ручного обновления списков теперь запускает операцию в фоне, показывает модалку с индикатором и опрашивает статус (устранен таймаут LuCI XHR в 30 сек) - json: sing-box config.json теперь форматируется с отступами в 2 пробела (sprintf '%.2J') для удобства чтения - tests: обновлены тесты и добавлены проверки для list-update-status (122/122 passed)
This commit is contained in:
@@ -117,10 +117,10 @@ function ensure_parent_dir(path) {
|
||||
return ensure_dir(parent_dir(path));
|
||||
}
|
||||
|
||||
function atomic_write_json_file(path, value) {
|
||||
function atomic_write_json_file(path, value, indent) {
|
||||
if (!ensure_parent_dir(path))
|
||||
return false;
|
||||
return write_json_file(path, value);
|
||||
return write_json_file(path, value, indent != null ? indent : 2);
|
||||
}
|
||||
|
||||
function fixture_section_list(type_name) {
|
||||
|
||||
@@ -787,7 +787,7 @@ function patch_dns_config(state_path) {
|
||||
let temp_config = temp_path();
|
||||
if (backup_path == "" || temp_config == "" ||
|
||||
fs.writefile(backup_path, fs.readfile(config_path)) == null ||
|
||||
!common.write_json_file(temp_config, config)) {
|
||||
!common.write_json_file(temp_config, config, 2)) {
|
||||
remove_files([ backup_path, temp_config ]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user