Copy okgg VLESS Node Info

Copy node information to VLESS link

  1. // ==UserScript==
  2. // @name Copy okgg VLESS Node Info
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Copy node information to VLESS link
  6. // @author Your Name
  7. // @match *://*.okgg.top/*
  8. // @grant GM_setClipboard
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. function createCopyButton() {
  15. const button = document.createElement('button');
  16. button.textContent = '复制节点信息';
  17. button.style.position = 'fixed';
  18. button.style.top = '10px';
  19. button.style.right = '10px';
  20. button.style.zIndex = '9999';
  21. button.style.backgroundColor = '#4CAF50';
  22. button.style.color = 'white';
  23. button.style.border = 'none';
  24. button.style.padding = '10px';
  25. button.style.cursor = 'pointer';
  26. button.onclick = copyNodeInfo;
  27. document.body.appendChild(button);
  28. }
  29.  
  30. function copyNodeInfo() {
  31. const tip = document.querySelector('.node-tip.cust-model.cust-modelin.fade-delay');
  32. if (!tip || tip.style.display === 'none') {
  33. alert('没有找到节点信息弹窗');
  34. return;
  35. }
  36.  
  37. const protocol = tip.querySelector('.nodename').textContent.trim();
  38. const type = getValueFromTip(tip, '类型 Protocol');
  39. const name = getValueFromTip(tip, '名字 Name');
  40. const address = getValueFromTip(tip, '地址 Address');
  41. const userId = getValueFromTip(tip, '用户Id ID');
  42. const flow = getValueFromTip(tip, '流控 Flow');
  43. const port = getValueFromTip(tip, '端口 Port');
  44. const encryption = getValueFromTip(tip, '加密 Encryption');
  45. const network = getValueFromTip(tip, '传输协议 Network');
  46. const typeMasquerade = getValueFromTip(tip, '伪装类型 Type');
  47. const host = getValueFromTip(tip, '伪装 Host Quic加密方式');
  48. const tls = getValueFromTip(tip, 'Tls传输');
  49. const fingerprint = getValueFromTip(tip, 'FigerPrint 指纹');
  50. const sni = getValueFromTip(tip, 'SNI');
  51.  
  52. const vlessLink = `vless://${userId}@${address}:${port}?type=${network}&security=${tls}&flow=${flow}&sni=${sni}&fp=${fingerprint}&host=${host}&type=${typeMasquerade}#${name}`;
  53.  
  54. GM_setClipboard(vlessLink);
  55. alert('节点信息已复制');
  56. }
  57.  
  58. function getValueFromTip(tip, label) {
  59. const element = Array.from(tip.querySelectorAll('p')).find(p => p.textContent.includes(label));
  60. return element ? element.querySelector('span').textContent.trim() : '';
  61. }
  62.  
  63. createCopyButton();
  64. })();