* * @param {string} userID - single or comma separated userIDs * @param {string | null} hostName * @returns {string}
(userIDs, hostName)
| 791 | * @returns {string} |
| 792 | */ |
| 793 | function getVLESSConfig(userIDs, hostName) { |
| 794 | const commonUrlPart = `:443?encryption=none&security=tls&sni=${hostName}&type=ws&host=${hostName}&path=%2F%3Fed%3D2048#${hostName}`; |
| 795 | const separator = "---------------------------------------------------------------"; |
| 796 | const hashSeparator = "################################################################"; |
| 797 | |
| 798 | // Split the userIDs into an array |
| 799 | let userIDArray = userIDs.split(','); |
| 800 | |
| 801 | // Prepare output array |
| 802 | let output = []; |
| 803 | let header = []; |
| 804 | |
| 805 | header.push(`\n<p align="right" style="direction: rtl; text-align: right;"> |
| 806 | <img src="https://fa.shafaqna.com/media/2023/02/%D9%88%D8%B2%DB%8C%D8%B1-%D8%A7%D8%B1%D8%AA%D8%A8%D8%A7%D8%B7%D8%A7%D8%AA.jpg" alt="description" style="width: 25%; height: 30%;"> |
| 807 | </p>`); |
| 808 | header.push(`\n<p align="right" style="direction: rtl; text-align: right; font-size: 15px;" >👋خوش آمدید: با اینکه سریعترین اینترنت (داخلی) رو در سطح استان داریم میتوانید از کانفیگ های Vless زیر برای کاهش سرعت جهت جلوگیری از تصادفات اینترنتی استفاده کنید.</p>\n`); |
| 809 | header.push(`<p align="right" style="direction: rtl; text-align: right; font-size: 15px;" >اگر کانفیگ های VLESS برات کار کرد میتونی به این برنامه یک ستاره 🌟 بدی.</p>\n`); |
| 810 | header.push(`\n<p align="right" style="direction: rtl; text-align: right;"><a href="https://github.com/Ptechgithub/pp-worker" target="_blank">pp-worker - https://github.com/Ptechgithub/pp-worker</a></p>\n`); |
| 811 | header.push(`\n<p align="right" style="direction: rtl; text-align: right;"><iframe src="https://ghbtns.com/github-btn.html?user=USERNAME&repo=REPOSITORY&type=star&count=true&size=large" frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe></p>\n\n`.replace(/USERNAME/g, "Ptechgithub").replace(/REPOSITORY/g, "pp-worker")); |
| 812 | header.push(`<p align="right" style="direction: rtl; text-align: right;"><a href="//${hostName}/sub/${userIDArray[0]}" target="_blank">✅️ لیست کانفیگ های VLESS</a></p>\n<p align="right" style="direction: rtl; text-align: right;"><a href="https://subconverter.do.xn--b6gac.eu.org/sub?target=clash&url=https://${hostName}/sub/${userIDArray[0]}?format=clash&insert=false&emoji=true&list=false&tfo=false&scv=true&fdn=false&sort=false&new_name=true" target="_blank">✅️ لیست کانفیگ های CLASH</a></p>\n`); |
| 813 | header.push(``); |
| 814 | |
| 815 | |
| 816 | |
| 817 | // Generate output string for each userID |
| 818 | userIDArray.forEach((userID) => { |
| 819 | const vlessMain = `vless://${userID}@${hostName}${commonUrlPart}`; |
| 820 | const vlessSec = `vless://${userID}@${proxyIP}${commonUrlPart}`; |
| 821 | output.push(`UUID: ${userID}`); |
| 822 | output.push(`${hashSeparator}\nv2ray default ip\n💫 کانفیگ با دامین پیش فرض\n${separator}\n1️⃣\n${vlessMain}\n${separator}`); |
| 823 | output.push(`${hashSeparator}\nv2ray with best ip\n🌟 کانفیگ با آی پی سالم کلودفلر\n${separator}\n2️⃣\n${vlessSec}\n${separator}`); |
| 824 | }); |
| 825 | output.push(`${hashSeparator}\n# Clash Proxy Provider configuration format\nproxy-groups:\n - name: UseProvider\n type: select\n use:\n - provider1\n proxies:\n - Proxy\n - DIRECT\nproxy-providers:\n provider1:\n type: http\n url: https://${hostName}/sub/${userIDArray[0]}?format=clash\n interval: 3600\n path: ./provider1.yaml\n health-check:\n enable: true\n interval: 600\n # lazy: true\n url: http://www.gstatic.com/generate_204\n\n${hashSeparator}`); |
| 826 | |
| 827 | // HTML Head with CSS |
| 828 | const htmlHead = ` |
| 829 | <head> |
| 830 | <title>pp-worker: VLESS configuration</title> |
| 831 | <meta name="description" content="This is a tool for generating VLESS protocol configurations. Give us a star on GitHub https://github.com/Ptechgithub/pp-worker if you found it useful!"> |
| 832 | <meta name="keywords" content="pp-worker, cloudflare pages, cloudflare worker, severless"> |
| 833 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 834 | <meta property="og:site_name" content="pp-worker: VLESS configuration" /> |
| 835 | <meta property="og:type" content="website" /> |
| 836 | <meta property="og:title" content="pp-worker - VLESS configuration and subscribe output" /> |
| 837 | <meta property="og:description" content="Use cloudflare pages and worker severless to implement vless protocol" /> |
| 838 | <meta property="og:url" content="https://${hostName}/" /> |
| 839 | <meta property="og:image" content="https://api.qrserver.com/v1/create-qr-code/?size=500x500&data=${encodeURIComponent(`vless://${userIDs.split(',')[0]}@${hostName}${commonUrlPart}`)}" /> |
| 840 | <meta name="twitter:card" content="summary_large_image" /> |
| 841 | <meta name="twitter:title" content="pp-worker - VLESS configuration and subscribe output" /> |
| 842 | <meta name="twitter:description" content="Use cloudflare pages and worker severless to implement vless protocol" /> |
| 843 | <meta name="twitter:url" content="https://${hostName}/" /> |
| 844 | <meta name="twitter:image" content="https://cloudflare-ipfs.com/ipfs/bafybeigd6i5aavwpr6wvnwuyayklq3omonggta4x2q7kpmgafj357nkcky" /> |
| 845 | <meta property="og:image:width" content="1500" /> |
| 846 | <meta property="og:image:height" content="1500" /> |
| 847 | |
| 848 | <style> |
| 849 | body { |
| 850 | font-family: Arial, sans-serif; |