fix: improve VLESS link compatibility and add Reality repair script

Only encode SNI dots, keep pbk/sid raw, copy links via API, prefer xray keygen, and add repair-reality.sh for server-side fixes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-27 23:58:14 +08:00
parent 40d10a846f
commit 1fc3b8a89c
9 changed files with 127 additions and 28 deletions
+33 -3
View File
@@ -45,6 +45,20 @@ function copyText(text) {
});
}
let nodeLinksCache = null;
async function fetchNodeLinks() {
if (nodeLinksCache) {
return nodeLinksCache;
}
const res = await fetch(apiUrl("/api/nodes"), { credentials: "same-origin" });
if (!res.ok) {
throw new Error(`HTTP ${res.status}`);
}
nodeLinksCache = await res.json();
return nodeLinksCache;
}
document.querySelectorAll(".copy-row").forEach((row) => {
const input = row.querySelector(".copy-input");
const btn = row.querySelector(".copy-btn");
@@ -56,17 +70,33 @@ document.querySelectorAll(".copy-row").forEach((row) => {
});
btn.addEventListener("click", async () => {
const text = input.value;
const card = row.closest(".node-card");
const nodeId = card?.dataset.id;
const kind = btn.dataset.linkKind || input.dataset.linkKind || "vless";
let text = input.value;
if (nodeId) {
try {
const nodes = await fetchNodeLinks();
const node = nodes.find((item) => String(item.id) === String(nodeId));
if (node?.links) {
text = kind === "hy2" ? node.links.hy2 : node.links.vless;
}
} catch {
/* fall back to input.value */
}
}
if (!text) {
toast("没有可复制的内容");
return;
}
try {
input.select();
input.setSelectionRange(0, text.length);
await copyText(text);
toast("已复制到剪贴板");
} catch {
input.select();
input.setSelectionRange(0, text.length);
toast("复制失败,请选中上方链接后 Ctrl+C");
}
});