- |
+ |
请先点击右上角 “一键拉取” 按钮解析节点
|
@@ -857,14 +858,28 @@
let subscriptions = [];
let proxies = []; // In-memory editable proxies
let originalDns = { clash: '', singbox: '' };
+ let appConfig = { publicBaseUrl: '' };
// On Load
- window.addEventListener('DOMContentLoaded', () => {
+ window.addEventListener('DOMContentLoaded', async () => {
lucide.createIcons();
+ await loadAppConfig();
loadSubscriptions();
loadDnsTemplates();
});
+ async function loadAppConfig() {
+ try {
+ const res = await fetch('/api/app-config');
+ if (res.ok) {
+ const data = await res.json();
+ appConfig.publicBaseUrl = (data.publicBaseUrl || '').replace(/\/+$/, '');
+ }
+ } catch (e) {
+ console.warn('Failed to load app config:', e);
+ }
+ }
+
// Logging helper
function log(message, type = 'info') {
const logs = document.getElementById('console-logs');
@@ -1094,6 +1109,24 @@
}
}
+ function escapeHtml(value) {
+ return String(value ?? '').replace(/[&<>"']/g, ch => ({
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": '''
+ })[ch]);
+ }
+
+ function getParsedName(node) {
+ return node.name || node.tag || '';
+ }
+
+ function getProxyName(node) {
+ return node.proxyName || node.originalName || getParsedName(node);
+ }
+
function renderProxiesTable() {
const list = document.getElementById('proxies-list');
const counter = document.getElementById('proxies-counter');
@@ -1104,7 +1137,7 @@
if (proxies.length === 0) {
list.innerHTML = `
- |
+ |
未提取到任何代理节点
|
@@ -1114,11 +1147,17 @@
proxies.forEach((node, idx) => {
const tr = document.createElement('tr');
+ const parsedName = getParsedName(node);
+ const proxyName = getProxyName(node);
+ const nodeType = node.type || '';
+ const server = node.server || '';
+ const port = node.port || node.server_port || '';
tr.innerHTML = `
- ${node.name || node.tag} |
- ${node.type} |
- ${node.server} |
- ${node.port || node.server_port} |
+ ${escapeHtml(parsedName)} |
+ ${escapeHtml(proxyName)} |
+ ${escapeHtml(nodeType)} |
+ ${escapeHtml(server)} |
+ ${escapeHtml(port)} |
|