This commit is contained in:
Alex Yang
2025-11-27 01:49:49 +08:00
parent acf0ff6d96
commit 7970a4f093
13 changed files with 111 additions and 152633 deletions

View File

@@ -27,12 +27,9 @@ function populateConfigForm(config) {
// HTTP配置
document.getElementById('http-port')?.value = config.HTTPServer.Port || 8080;
document.getElementById('http-host')?.value = config.HTTPServer.Host || '0.0.0.0';
document.getElementById('http-api-enabled')?.checked = config.HTTPServer.APIEnabled !== false;
// 屏蔽配置
document.getElementById('shield-local-rules-file')?.value = config.Shield.LocalRulesFile || './rules.txt';
document.getElementById('shield-remote-rules-urls')?.value = (config.Shield.RemoteRulesURLs || []).join('\n');
document.getElementById('shield-update-interval')?.value = config.Shield.UpdateInterval || 3600;
document.getElementById('shield-hosts-file')?.value = config.Shield.HostsFile || '/etc/hosts';
document.getElementById('shield-block-method')?.value = config.Shield.BlockMethod || '0.0.0.0';
@@ -69,19 +66,16 @@ function collectFormData() {
Port: parseInt(document.getElementById('dns-port')?.value) || 53,
UpstreamServers: document.getElementById('dns-upstream-servers')?.value.split(',').map(s => s.trim()).filter(Boolean) || [],
Timeout: parseInt(document.getElementById('dns-timeout')?.value) || 5,
StatsFile: document.getElementById('dns-stats-file')?.value || './stats.json',
StatsFile: document.getElementById('dns-stats-file')?.value || './data/stats.json',
SaveInterval: parseInt(document.getElementById('dns-save-interval')?.value) || 300
},
HTTPServer: {
Port: parseInt(document.getElementById('http-port')?.value) || 8080,
Host: document.getElementById('http-host')?.value || '0.0.0.0',
APIEnabled: document.getElementById('http-api-enabled')?.checked !== false
Port: parseInt(document.getElementById('http-port')?.value) || 8080
},
Shield: {
LocalRulesFile: document.getElementById('shield-local-rules-file')?.value || './rules.txt',
RemoteRulesURLs: document.getElementById('shield-remote-rules-urls')?.value.split('\n').map(s => s.trim()).filter(Boolean) || [],
LocalRulesFile: document.getElementById('shield-local-rules-file')?.value || './data/rules.txt',
UpdateInterval: parseInt(document.getElementById('shield-update-interval')?.value) || 3600,
HostsFile: document.getElementById('shield-hosts-file')?.value || '/etc/hosts',
HostsFile: document.getElementById('shield-hosts-file')?.value || './data/hosts.txt',
BlockMethod: document.getElementById('shield-block-method')?.value || '0.0.0.0'
}
};