diff --git a/apps/deno-vless/src/app/app.tsx b/apps/deno-vless/src/app/app.tsx index d44ce5a..b62d424 100644 --- a/apps/deno-vless/src/app/app.tsx +++ b/apps/deno-vless/src/app/app.tsx @@ -42,7 +42,7 @@ function QRcodeImg({ text }: { text: string }) { } return ( -
+
- {text} + {text}
>>8&255)*192+(n&255),e.put(n,13)}};var Jp The chosen QR Code version cannot contain this amount of data. Minimum version required to store current data is: `+o+`. `);const i=a0(t,n,l),u=Fl.getSymbolSize(t),s=new qp(u);return l0(s,t),o0(s),i0(s,t),go(s,n,0),t>=7&&u0(s,t),s0(s,i),isNaN(r)&&(r=fi.getBestMask(s,go.bind(null,s,n))),fi.applyMask(r,s),go(s,n,r),{modules:s,version:t,errorCorrectionLevel:n,maskPattern:r,segments:l}}Oc.create=function(t,n){if(typeof t>"u"||t==="")throw new Error("No input text");let r=ho.M,l,o;return typeof n<"u"&&(r=ho.from(n.errorCorrectionLevel,ho.M),l=gl.from(n.version),o=fi.from(n.maskPattern),n.toSJISFunc&&Fl.setToSJISFunction(n.toSJISFunc)),f0(t,l,r,o)};var Zc={},du={};(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(o){return[o,o]}))),r.length===6&&r.push("F","F");const l=parseInt(r.join(""),16);return{r:l>>24&255,g:l>>16&255,b:l>>8&255,a:l&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const l=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,o=r.width&&r.width>=21?r.width:void 0,i=r.scale||4;return{width:o,scale:o?4:i,margin:l,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,l){return l.width&&l.width>=r+l.margin*2?l.width/(r+l.margin*2):l.scale},e.getImageWidth=function(r,l){const o=e.getScale(r,l);return Math.floor((r+l.margin*2)*o)},e.qrToImageData=function(r,l,o){const i=l.modules.size,u=l.modules.data,s=e.getScale(i,o),c=Math.floor((i+o.margin*2)*s),h=o.margin*s,g=[o.color.light,o.color.dark];for(let p=0;p=h&&v>=h&&p"u"&&(!i||!i.getContext)&&(s=i,i=void 0),i||(c=r()),s=t.getOptions(s);const h=t.getImageWidth(o.modules.size,s),g=c.getContext("2d"),p=g.createImageData(h,h);return t.qrToImageData(p.data,o,s),n(g,c,h),g.putImageData(p,0,0),c},e.renderToDataURL=function(o,i,u){let s=u;typeof s>"u"&&(!i||!i.getContext)&&(s=i,i=void 0),s||(s={});const c=e.render(o,i,s),h=s.type||"image/png",g=s.rendererOpts||{};return c.toDataURL(h,g.quality)}})(Zc);var qc={};const d0=du;function Ps(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function vo(e,t,n){let r=e+t;return typeof n<"u"&&(r+=" "+n),r}function p0(e,t,n){let r="",l=0,o=!1,i=0;for(let u=0;u0&&s>0&&e[u-1]||(r+=o?vo("M",s+n,.5+c+n):vo("m",l,0),l=0,o=!1),s+1':"",c="',h='viewBox="0 0 '+u+" "+u+'"',p=''+s+c+` -`;return typeof r=="function"&&r(null,p),p};const h0=Tp,pi=Oc,bc=Zc,m0=qc;function pu(e,t,n,r,l){const o=[].slice.call(arguments,1),i=o.length,u=typeof o[i-1]=="function";if(!u&&!h0())throw new Error("Callback required as last argument");if(u){if(i<2)throw new Error("Too few arguments provided");i===2?(l=n,n=t,t=r=void 0):i===3&&(t.getContext&&typeof l>"u"?(l=r,r=void 0):(l=r,r=n,n=t,t=void 0))}else{if(i<1)throw new Error("Too few arguments provided");return i===1?(n=t,t=r=void 0):i===2&&!t.getContext&&(r=n,n=t,t=void 0),new Promise(function(s,c){try{const h=pi.create(n,r);s(e(h,t,r))}catch(h){c(h)}})}try{const s=pi.create(n,r);l(null,e(s,t,r))}catch(s){l(s)}}cr.create=pi.create;cr.toCanvas=pu.bind(null,bc.render);cr.toDataURL=pu.bind(null,bc.renderToDataURL);cr.toString=pu.bind(null,function(e,t,n){return m0.render(e,n)});const g0=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function v0(e){return typeof e=="string"&&g0.test(e)}function y0(){const[e,t]=Ue.exports.useState("");function n(r){t(r)}return Ve("div",{className:"flex flex-col h-screen",children:[D(E0,{}),Ve("div",{className:"flex flex-col items-center h-full",children:[D(w0,{text:e}),D(k0,{handleShare:n}),D(S0,{handleShare:n})]})]})}function w0({text:e}){const[t,n]=Ue.exports.useState(""),[r,l]=Ue.exports.useState(!1);Ue.exports.useEffect(()=>{(async()=>{if(e){const i=await cr.toDataURL(e);n(i)}})()},[e]);async function o(){await navigator.clipboard.writeText(e),l(!0),setTimeout(()=>{l(!1)},1500)}return Ve("div",{className:"flex flex-col border border-blue-300 overflow-hidden w-[400px] h-[400px] justify-start items-center",children:[D("img",{src:t,width:"350",height:"350",alt:"\u4E8C\u7EF4\u7801",className:"border-spacing-1"}),Ve("div",{className:"flex flex-grow w-full bg-gray-200",children:[D("span",{className:"flex-grow ",children:e}),Ve("div",{className:"w-6 h-6 ml-auto",children:[D("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",onClick:o,className:`w-6 h-6 hover:cursor-pointer hover:border hover:border-indigo-500 ${r?"hidden":"block"}`,children:D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 7.5V6.108c0-1.135.845-2.098 1.976-2.192.373-.03.748-.057 1.123-.08M15.75 18H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08M15.75 18.75v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5A3.375 3.375 0 006.375 7.5H5.25m11.9-3.664A2.251 2.251 0 0015 2.25h-1.5a2.251 2.251 0 00-2.15 1.586m5.8 0c.065.21.1.433.1.664v.75h-6V4.5c0-.231.035-.454.1-.664M6.75 7.5H4.875c-.621 0-1.125.504-1.125 1.125v12c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V16.5a9 9 0 00-9-9z"})}),D("svg",{"aria-hidden":"true",height:"16",viewBox:"0 0 16 16",version:"1.1",className:`w-6 h-6 hover:border hover:border-indigo-500 ${r?"block bg-green-300":"hidden"}`,children:D("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"})})]})]})]})}function S0({handleShare:e}){const[t,n]=Ue.exports.useState("");return Ve("div",{className:"mt-4 w-60",children:[D("label",{htmlFor:"comment",className:"block text-sm font-medium text-gray-700",children:"\u968F\u610F\u8981\u5206\u4EAB\u7684\u5185\u5BB9"}),D("div",{className:"mt-1",children:D("textarea",{rows:4,name:"comment",id:"comment",className:"block w-full border border-gray-300 rounded-md shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm",value:t,onChange:r=>n(r.target.value)})}),D("div",{className:"flex justify-end mt-2",children:D("button",{onClick:()=>e(t),type:"submit",className:"inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-transparent rounded-md shadow-sm hover:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",children:"\u5206\u4EAB"})})]})}function k0({handleShare:e}){function t(){return window.location.href}function n(){const r=new URL(window.location.href);return`vless://${r.pathname.split("/").find(v0)}@${r.hostname}:443?encryption=none&security=tls&type=ws#deno-vless`}return Ve("span",{className:"inline-flex rounded-md shadow-sm isolate",children:[D("button",{onClick:()=>e(t()),type:"button",className:"relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-l-md hover:border-indigo-500 focus:z-10 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500",children:"\u5206\u4EAB\u672C\u9875"}),D("button",{onClick:()=>e(n()),type:"button",className:"relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 hover:bg-gray-50 focus:z-10 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500",children:"\u5206\u4EAB V2ray"})]})}function E0(){return D("div",{className:"flex justify-center p-4 rounded-md bg-yellow-50",children:Ve("div",{className:"flex",children:[D("div",{className:"flex-shrink-0",children:D(xp,{className:"w-5 h-5 text-red-400","aria-hidden":"true"})}),Ve("div",{className:"ml-3",children:[D("h3",{className:"text-sm font-medium text-yellow-800",children:"\u6CE8\u610F\uFF01\uFF01"}),D("div",{className:"mt-2 text-sm text-yellow-700",children:D("p",{children:"\u6CC4\u9732\u672C\u9875\u9762\u5C31\u7B49\u4E8E\u6CC4\u9732\u4F60\u7684\u8BBE\u7F6E\u3002"})})]})]})})}const C0=Fc(document.getElementById("root"));C0.render(D(Ue.exports.StrictMode,{children:D(y0,{})})); +`;return typeof r=="function"&&r(null,p),p};const h0=Tp,pi=Oc,bc=Zc,m0=qc;function pu(e,t,n,r,l){const o=[].slice.call(arguments,1),i=o.length,u=typeof o[i-1]=="function";if(!u&&!h0())throw new Error("Callback required as last argument");if(u){if(i<2)throw new Error("Too few arguments provided");i===2?(l=n,n=t,t=r=void 0):i===3&&(t.getContext&&typeof l>"u"?(l=r,r=void 0):(l=r,r=n,n=t,t=void 0))}else{if(i<1)throw new Error("Too few arguments provided");return i===1?(n=t,t=r=void 0):i===2&&!t.getContext&&(r=n,n=t,t=void 0),new Promise(function(s,c){try{const h=pi.create(n,r);s(e(h,t,r))}catch(h){c(h)}})}try{const s=pi.create(n,r);l(null,e(s,t,r))}catch(s){l(s)}}cr.create=pi.create;cr.toCanvas=pu.bind(null,bc.render);cr.toDataURL=pu.bind(null,bc.renderToDataURL);cr.toString=pu.bind(null,function(e,t,n){return m0.render(e,n)});const g0=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function v0(e){return typeof e=="string"&&g0.test(e)}function y0(){const[e,t]=Ue.exports.useState("");function n(r){t(r)}return Ve("div",{className:"flex flex-col h-screen",children:[D(E0,{}),Ve("div",{className:"flex flex-col items-center h-full",children:[D(w0,{text:e}),D(k0,{handleShare:n}),D(S0,{handleShare:n})]})]})}function w0({text:e}){const[t,n]=Ue.exports.useState(""),[r,l]=Ue.exports.useState(!1);Ue.exports.useEffect(()=>{(async()=>{if(e){const i=await cr.toDataURL(e);n(i)}})()},[e]);async function o(){await navigator.clipboard.writeText(e),l(!0),setTimeout(()=>{l(!1)},1500)}return Ve("div",{className:"flex flex-col border border-blue-300 overflow-hidden w-[420px] h-[420px] justify-start items-center",children:[D("img",{src:t,width:"350",height:"350",alt:"\u4E8C\u7EF4\u7801",className:"border-spacing-1"}),Ve("div",{className:"flex flex-grow w-full bg-gray-200",children:[D("span",{className:"flex-grow",children:e}),Ve("div",{className:"w-6 h-6 ml-auto",children:[D("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",onClick:o,className:`w-6 h-6 hover:cursor-pointer hover:border hover:border-indigo-500 ${r?"hidden":"block"}`,children:D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 7.5V6.108c0-1.135.845-2.098 1.976-2.192.373-.03.748-.057 1.123-.08M15.75 18H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08M15.75 18.75v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5A3.375 3.375 0 006.375 7.5H5.25m11.9-3.664A2.251 2.251 0 0015 2.25h-1.5a2.251 2.251 0 00-2.15 1.586m5.8 0c.065.21.1.433.1.664v.75h-6V4.5c0-.231.035-.454.1-.664M6.75 7.5H4.875c-.621 0-1.125.504-1.125 1.125v12c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V16.5a9 9 0 00-9-9z"})}),D("svg",{"aria-hidden":"true",height:"16",viewBox:"0 0 16 16",version:"1.1",className:`w-6 h-6 hover:border hover:border-indigo-500 ${r?"block bg-green-300":"hidden"}`,children:D("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"})})]})]})]})}function S0({handleShare:e}){const[t,n]=Ue.exports.useState("");return Ve("div",{className:"mt-4 w-60",children:[D("label",{htmlFor:"comment",className:"block text-sm font-medium text-gray-700",children:"\u968F\u610F\u8981\u5206\u4EAB\u7684\u5185\u5BB9"}),D("div",{className:"mt-1",children:D("textarea",{rows:4,name:"comment",id:"comment",className:"block w-full border border-gray-300 rounded-md shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm",value:t,onChange:r=>n(r.target.value)})}),D("div",{className:"flex justify-end mt-2",children:D("button",{onClick:()=>e(t),type:"submit",className:"inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-transparent rounded-md shadow-sm hover:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",children:"\u5206\u4EAB"})})]})}function k0({handleShare:e}){function t(){return window.location.href}function n(){const r=new URL(window.location.href);return`vless://${r.pathname.split("/").find(v0)}@${r.hostname}:443?encryption=none&security=tls&type=ws#deno-vless`}return Ve("span",{className:"inline-flex rounded-md shadow-sm isolate",children:[D("button",{onClick:()=>e(t()),type:"button",className:"relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-l-md hover:border-indigo-500 focus:z-10 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500",children:"\u5206\u4EAB\u672C\u9875"}),D("button",{onClick:()=>e(n()),type:"button",className:"relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 hover:bg-gray-50 focus:z-10 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500",children:"\u5206\u4EAB V2ray"})]})}function E0(){return D("div",{className:"flex justify-center p-4 rounded-md bg-yellow-50",children:Ve("div",{className:"flex",children:[D("div",{className:"flex-shrink-0",children:D(xp,{className:"w-5 h-5 text-red-400","aria-hidden":"true"})}),Ve("div",{className:"ml-3",children:[D("h3",{className:"text-sm font-medium text-yellow-800",children:"\u6CE8\u610F\uFF01\uFF01"}),D("div",{className:"mt-2 text-sm text-yellow-700",children:D("p",{children:"\u6CC4\u9732\u672C\u9875\u9762\u5C31\u7B49\u4E8E\u6CC4\u9732\u4F60\u7684\u8BBE\u7F6E\u3002"})})]})]})})}const C0=Fc(document.getElementById("root"));C0.render(D(Ue.exports.StrictMode,{children:D(y0,{})})); diff --git a/apps/deno-vless/src/client/index.html b/apps/deno-vless/src/client/index.html index ca62283..d1e1b74 100644 --- a/apps/deno-vless/src/client/index.html +++ b/apps/deno-vless/src/client/index.html @@ -8,8 +8,8 @@ - - + +