|
243 | 243 | } |
244 | 244 |
|
245 | 245 | var params = ""; |
| 246 | + |
| 247 | + opt.get(dom_prefix + "tcp_fast_open")?.checked && (params += "&tfo=1"); |
| 248 | + |
246 | 249 | var v_plugin_dom = opt.get(dom_prefix + "plugin"); |
247 | 250 | if (v_plugin_dom) { |
248 | 251 | var v_plugin = v_plugin_dom.value; |
|
322 | 325 | params += opt.query("ech", dom_prefix + "ech_config"); |
323 | 326 | } |
324 | 327 |
|
| 328 | + opt.get(dom_prefix + "uot")?.checked && (params += "&udp=1"); |
| 329 | + |
325 | 330 | if (opt.get(dom_prefix + "shadowtls")?.checked) { |
326 | 331 | let st_plugin_str = ""; |
327 | 332 | let st_version = opt.get(dom_prefix + "shadowtls_version")?.value; |
|
418 | 423 | info.tls = "tls"; |
419 | 424 | info.sni = opt.get(dom_prefix + "tls_serverName").value; |
420 | 425 | } |
| 426 | + |
| 427 | + opt.get(dom_prefix + "tcp_fast_open")?.checked && (info.tfo = "1"); |
| 428 | + |
421 | 429 | url = b64EncodeUnicode(JSON.stringify(info)); |
422 | 430 | } else if ((v_type === "sing-box" || v_type === "Xray") && opt.get(dom_prefix + "protocol").value === "vless") { |
423 | 431 | protocol = "vless"; |
|
502 | 510 | params += opt.query("ech", dom_prefix + "ech_config"); |
503 | 511 | } |
504 | 512 |
|
| 513 | + opt.get(dom_prefix + "tcp_fast_open")?.checked && (params += "&tfo=1"); |
| 514 | + |
505 | 515 | params += "#" + encodeURI(v_alias.value); |
506 | 516 | if (params[0] == "&") { |
507 | 517 | params = params.substring(1); |
|
567 | 577 | params += opt.query("vcn", dom_prefix + "tls_CertByName"); |
568 | 578 | params += opt.query("ech", dom_prefix + "ech_config"); |
569 | 579 | } |
| 580 | + |
| 581 | + opt.get(dom_prefix + "tcp_fast_open")?.checked && (params += "&tfo=1"); |
| 582 | + |
570 | 583 | params += "#" + encodeURI(v_alias.value); |
571 | 584 | if (params[0] == "&") { |
572 | 585 | params = params.substring(1); |
|
944 | 957 | pluginOpts = pluginParams.join(";"); |
945 | 958 | } |
946 | 959 |
|
947 | | - if (has_xray && ((ss_type !== "xray" && ss_type !== "sing-box" && queryParam.type) || ss_type == "xray" || queryParam.type == "xhttp")) { |
| 960 | + const needUpgrade = ss_type !== "Xray" && ss_type !== "sing-box" && |
| 961 | + queryParam.type && queryParam.type !== "tcp" && |
| 962 | + queryParam.headerType && queryParam.headerType !== "none"; |
| 963 | + if (has_xray && (ss_type == "xray" || needUpgrade || queryParam.type === "xhttp")) { |
948 | 964 | dom_prefix = "xray_" |
949 | 965 | opt.set('type', "Xray"); |
950 | 966 | opt.set(dom_prefix + 'protocol', "shadowsocks"); |
951 | | - } else if (has_singbox && ((ss_type !== "xray" && ss_type !== "sing-box" && queryParam.type) || ss_type == "sing-box")) { |
| 967 | + } else if (has_singbox && (ss_type == "sing-box" || needUpgrade)) { |
952 | 968 | dom_prefix = "singbox_" |
953 | 969 | opt.set('type', "sing-box"); |
954 | 970 | opt.set(dom_prefix + 'protocol', "shadowsocks"); |
|
977 | 993 | opt.set(dom_prefix + 'password', password || ""); |
978 | 994 | opt.set(dom_prefix + 'method', method || ""); |
979 | 995 | opt.set(dom_prefix + 'ss_method', method || ""); |
| 996 | + opt.set(dom_prefix + 'tcp_fast_open', queryParam.tfo); |
980 | 997 | if (plugin && plugin != "none") { |
981 | 998 | plugin = (plugin === "simple-obfs") ? "obfs-local" : plugin; |
982 | 999 | opt.set(dom_prefix + 'plugin_enabled', true); |
|
1114 | 1131 | opt.set(dom_prefix + 'use_xhttp_extra', !!queryParam.extra); |
1115 | 1132 | opt.set(dom_prefix + 'xhttp_extra', queryParam.extra || ""); |
1116 | 1133 | } |
| 1134 | + |
| 1135 | + opt.set(dom_prefix + 'uot', queryParam.udp); |
1117 | 1136 |
|
1118 | 1137 | if (queryParam["shadow-tls"]) { |
1119 | 1138 | //解析SS Shadow-TLS 插件参数 |
|
1273 | 1292 | opt.set(dom_prefix + 'tls_allowInsecure', false); |
1274 | 1293 | } |
1275 | 1294 |
|
| 1295 | + opt.set(dom_prefix + 'tcp_fast_open', queryParam.tfo); |
| 1296 | + |
1276 | 1297 | if (m.hash) { |
1277 | 1298 | opt.set('remarks', decodeURIComponent(m.hash.substr(1))); |
1278 | 1299 | } |
|
1367 | 1388 | } else if (ssm.net === "grpc") { |
1368 | 1389 | opt.set(dom_prefix + 'grpc_serviceName', ssm.path); |
1369 | 1390 | } |
| 1391 | + |
| 1392 | + opt.set(dom_prefix + 'tcp_fast_open', ssm.tfo); |
1370 | 1393 | } |
1371 | 1394 | if (ssu[0] === "vless") { |
1372 | 1395 | if (vless_type == "sing-box" && has_singbox) { |
|
1518 | 1541 | opt.set(dom_prefix + 'httpupgrade_path', queryParam.path || ""); |
1519 | 1542 | } |
1520 | 1543 |
|
| 1544 | + opt.set(dom_prefix + 'tcp_fast_open', queryParam.tfo); |
| 1545 | + |
1521 | 1546 | if (m.hash) { |
1522 | 1547 | opt.set('remarks', decodeURIComponent(m.hash.substr(1))); |
1523 | 1548 | } |
|
1697 | 1722 | } |
1698 | 1723 |
|
1699 | 1724 | document.addEventListener("DOMContentLoaded", function () { |
1700 | | - const fromUrlCache = JSON.parse(sessionStorage.getItem("fromUrl")); |
1701 | | - if (fromUrlCache && fromUrlCache.savetime && (Date.now() - fromUrlCache.timestamp) < fromUrlCache.savetime) { |
1702 | | - fromUrl(null, fromUrlCache.urlname, fromUrlCache.sid, fromUrlCache) |
1703 | | - } else { |
1704 | | - sessionStorage.removeItem("fromUrl"); |
1705 | | - } |
| 1725 | + setTimeout(function () { |
| 1726 | + const fromUrlCache = JSON.parse(sessionStorage.getItem("fromUrl")); |
| 1727 | + if (fromUrlCache && fromUrlCache.savetime && (Date.now() - fromUrlCache.timestamp) < fromUrlCache.savetime) { |
| 1728 | + fromUrl(null, fromUrlCache.urlname, fromUrlCache.sid, fromUrlCache) |
| 1729 | + } else { |
| 1730 | + sessionStorage.removeItem("fromUrl"); |
| 1731 | + } |
| 1732 | + }, 500); |
1706 | 1733 | }) |
1707 | 1734 |
|
1708 | 1735 | //]]></script> |
|
0 commit comments