feat: карточки сервисов на дашборде + секция Hosts в правилах + скрытие вкладки Conditions для Hosts
Дашборд: - Добавлены карточки статуса Zapret, Zapret2, ByeDpi на панель мониторинга - Показывают статус (работает/остановлен), количество перезапусков, предупреждения - Баг: API возвращает boolean а не число — исправлено сравнение Секция Hosts: - Перенесены опции hosts из глобальных настроек в отдельный тип секции (action=hosts) - Опции: пользовательские DNS записи, удалённые списки хостов, автообновление, интервал - Миграция: автоматический перенос глобальных настроек hosts в секцию - Вкладка «Условия» скрыта для секций типа Hosts (hosts записи применяются глобально) - Возвращена кнопка «Import Hosts File» с модальным окном загрузки из файла - Убраны неиспользуемые опции из settings.js (~280 строк) Локализация: - Переведены 6 новых строк для превью импорта hosts
This commit is contained in:
@@ -175,7 +175,7 @@ assert(JSON.stringify(config.settings.dns_server) === JSON.stringify(['9.9.9.9']
|
||||
assert(JSON.stringify(config.settings.bootstrap_dns_server) === JSON.stringify(['1.1.1.1']), 'legacy Bootstrap DNS scalar migrated to ordered list');
|
||||
assert(config.settings.config_version === '1.0.5', 'legacy config should be marked at the current schema version');
|
||||
assert(config.settings.component_update_check_enabled === '1', 'component update checks should be enabled during migration');
|
||||
assert(JSON.stringify(config.settings.applied_migrations) === JSON.stringify(['interface_sections', 'enable_component_checks', 'http_connection_urls', 'dns_hosts_to_option']), 'legacy config should record named migrations');
|
||||
assert(JSON.stringify(config.settings.applied_migrations) === JSON.stringify(['interface_sections', 'enable_component_checks', 'http_connection_urls', 'dns_hosts_to_option', 'global_hosts_to_section']), 'legacy config should record named migrations');
|
||||
|
||||
function assert(condition, message) {
|
||||
if (!condition) {
|
||||
@@ -394,7 +394,7 @@ function assert(condition, message) {
|
||||
assert(out.changed === true, '1.0.1 config should require migration');
|
||||
assert(out.config.settings.config_version === '1.0.5', 'config schema version should advance to 1.0.5');
|
||||
assert(out.config.settings.component_update_check_enabled === '1', 'updates from 1.0.1 and below should enable component update checks');
|
||||
assert(JSON.stringify(out.config.settings.applied_migrations) === JSON.stringify(['interface_sections', 'enable_component_checks', 'http_connection_urls', 'dns_hosts_to_option']), 'named migrations should be recorded');
|
||||
assert(JSON.stringify(out.config.settings.applied_migrations) === JSON.stringify(['interface_sections', 'enable_component_checks', 'http_connection_urls', 'dns_hosts_to_option', 'global_hosts_to_section']), 'named migrations should be recorded');
|
||||
assert(!Object.prototype.hasOwnProperty.call(section, 'interfaces'), 'parent interface list should be removed');
|
||||
assert(JSON.stringify(interfaces.map(item => item.name)) === JSON.stringify(['awg0', 'tun0']), 'interfaces should keep their order');
|
||||
for (const item of interfaces) {
|
||||
@@ -432,7 +432,7 @@ function assert(condition, message) {
|
||||
|
||||
assert(out.config.settings.component_update_check_enabled === '0', '1.0.2 config must preserve an explicitly disabled component check');
|
||||
assert(out.config.settings.config_version === '1.0.5', '1.0.2 config should advance through the HTTP URL migration schema');
|
||||
assert(JSON.stringify(out.config.settings.applied_migrations) === JSON.stringify(['interface_sections', 'enable_component_checks', 'http_connection_urls', 'dns_hosts_to_option']), 'newer configs should mark skipped migrations');
|
||||
assert(JSON.stringify(out.config.settings.applied_migrations) === JSON.stringify(['interface_sections', 'enable_component_checks', 'http_connection_urls', 'dns_hosts_to_option', 'global_hosts_to_section']), 'newer configs should mark skipped migrations');
|
||||
NODE
|
||||
|
||||
cat >"$WORK_DIR/forkop-1.0.4-http.json" <<'JSON'
|
||||
@@ -498,7 +498,7 @@ assert(JSON.stringify(jsonOutbounds[1]) === JSON.stringify({
|
||||
server_port: 8080,
|
||||
}), 'unnamed HTTP URL should receive a unique http tag');
|
||||
assert(jsonOutbounds[2].type === 'direct' && jsonOutbounds[2].tag === 'http', 'existing JSON outbounds should remain unchanged');
|
||||
assert(JSON.stringify(out.config.settings.applied_migrations) === JSON.stringify(['interface_sections', 'enable_component_checks', 'http_connection_urls', 'dns_hosts_to_option']), 'HTTP URL migration should be recorded');
|
||||
assert(JSON.stringify(out.config.settings.applied_migrations) === JSON.stringify(['interface_sections', 'enable_component_checks', 'http_connection_urls', 'dns_hosts_to_option', 'global_hosts_to_section']), 'HTTP URL migration should be recorded');
|
||||
NODE
|
||||
|
||||
cat >"$WORK_DIR/forkop-1.0.5-http.json" <<'JSON'
|
||||
@@ -613,7 +613,7 @@ grep -Fxq 'tachyon.settings.config_version=1.0.5' "$WORK_DIR/runtime-version.sta
|
||||
fail "runtime version migration must advance config_version"
|
||||
grep -Fxq 'tachyon.settings.component_update_check_enabled=1' "$WORK_DIR/runtime-version.state" ||
|
||||
fail "runtime version migration must enable component update checks"
|
||||
grep -Fq 'tachyon.settings.applied_migrations=interface_sections enable_component_checks http_connection_urls dns_hosts_to_option' "$WORK_DIR/runtime-version.state" ||
|
||||
grep -Fq 'tachyon.settings.applied_migrations=interface_sections enable_component_checks http_connection_urls dns_hosts_to_option global_hosts_to_section' "$WORK_DIR/runtime-version.state" ||
|
||||
fail "runtime migration must record stable migration names"
|
||||
grep -Eq '^tachyon\.main\.outbound_jsons=\{ "type": "http", "tag": "http", "server": "proxy\.example", "server_port": 8080 \}$' "$WORK_DIR/runtime-version.state" ||
|
||||
fail "runtime migration must convert native HTTP proxy links to JSON outbounds"
|
||||
|
||||
@@ -74,6 +74,8 @@ grep -Fq "list applied_migrations 'http_connection_urls'" "$TACHYON_CONFIG" ||
|
||||
fail "new installations must mark the HTTP connection URL migration as applied"
|
||||
grep -Fq "list applied_migrations 'dns_hosts_to_option'" "$TACHYON_CONFIG" ||
|
||||
fail "new installations must mark the dns_hosts to option migration as applied"
|
||||
grep -Fq "list applied_migrations 'global_hosts_to_section'" "$TACHYON_CONFIG" ||
|
||||
fail "new installations must mark the global hosts to section migration as applied"
|
||||
grep -Fq '/usr/lib/tachyon/config/migration.uc migrate' "$TACHYON_MAKEFILE" ||
|
||||
fail "OpenWrt package postinst must run configuration migrations"
|
||||
[ "$(grep -Fc '/usr/lib/tachyon/config/migration.uc migrate' "$BUILD_SCRIPT")" -ge 3 ] ||
|
||||
|
||||
Reference in New Issue
Block a user