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

@@ -713,14 +713,6 @@
<label for="http-port" class="block text-sm font-medium text-gray-700 mb-1">端口</label>
<input type="number" id="http-port" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent" placeholder="8080">
</div>
<div>
<label for="http-host" class="block text-sm font-medium text-gray-700 mb-1">主机</label>
<input type="text" id="http-host" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent" placeholder="0.0.0.0">
</div>
<div class="flex items-center">
<input type="checkbox" id="http-api-enabled" class="h-4 w-4 text-primary border-gray-300 rounded focus:ring-primary">
<label for="http-api-enabled" class="ml-2 block text-sm font-medium text-gray-700">启用API</label>
</div>
</div>
</div>
@@ -750,10 +742,6 @@
<option value="customIP">返回自定义IP</option>
</select>
</div>
<div class="md:col-span-2">
<label for="shield-remote-rules-urls" class="block text-sm font-medium text-gray-700 mb-1">远程规则URL (每行一个)</label>
<textarea id="shield-remote-rules-urls" rows="4" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent" placeholder="https://example.com/rules.txt"></textarea>
</div>
</div>
</div>

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'
}
};