workers使用静态资源,成功
This commit is contained in:
1 parent
6ab2631c51
commit
ce3bd1f542
13 files changed
+189
-10
No files matched your search
+1
-1
@@ -65,7 +65,7 @@ import { renderUserList, // 渲染用户列表 / Render user list
|
||||
// 设置全局配置参数
|
||||
// Set global configuration parameters
|
||||
window.config = {
|
||||
wsAddress: 'ws://127.0.0.1:8787', // WebSocket 服务器地址 / WebSocket server address
|
||||
wsAddress: `${window.location.protocol === 'https:' ? 'wss:' : 'ws:'}//${window.location.host}`, // WebSocket 服务器地址 / WebSocket server address
|
||||
debug: true // 是否开启调试模式 / Enable debug mode
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
function e(e){return e.replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}const t=-2147483648;function a(e){return e^=e<<13,e^=e>>17,e^=e<<5}function r(e=""){let l=function(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r)|0,t=a(t);return t}(e=e.toString())||1;const o=()=>l=a(l),i=(e,a)=>Math.floor((o()-t)/4294967295*(a+1-e)+e);return{seed:e,next:o,bool:(e=50)=>i(1,100)<=e,integer:(e,t)=>i(e,t),pick(e,t){var a;return 0===e.length?(o(),t):null!==(a=e[i(0,e.length-1)])&&void 0!==a?a:t},shuffle(e){const t=r(o().toString()),a=[...e];for(let r=a.length-1;r>0;r--){const e=t.integer(0,r);[a[r],a[e]]=[a[e],a[r]]}return a},string(e,t="abcdefghijklmnopqrstuvwxyz1234567890"){const a=r(o().toString());let l="";for(let r=0;r<e;r++)l+=t[a.integer(0,t.length-1)];return l}}}function l(e){let t=e.attributes.viewBox.split(" ");return{x:parseInt(t[0]),y:parseInt(t[1]),width:parseInt(t[2]),height:parseInt(t[3])}}const o={properties:{seed:{type:"string"},flip:{type:"boolean",default:!1},rotate:{type:"integer",minimum:0,maximum:360,default:0},scale:{type:"integer",minimum:0,maximum:200,default:100},radius:{type:"integer",minimum:0,maximum:50,default:0},size:{type:"integer",minimum:1},backgroundColor:{type:"array",items:{type:"string",pattern:"^(transparent|[a-fA-F0-9]{6})$"}},backgroundType:{type:"array",items:{type:"string",enum:["solid","gradientLinear"]},default:["solid"]},backgroundRotation:{type:"array",items:{type:"integer",minimum:-360,maximum:360},default:[0,360]},translateX:{type:"integer",minimum:-100,maximum:100,default:0},translateY:{type:"integer",minimum:-100,maximum:100,default:0},clip:{type:"boolean",default:!0},randomizeIds:{type:"boolean",default:!1}}};function i(e){var t;let a={},r=null!==(t=e.properties)&&void 0!==t?t:{};return Object.keys(r).forEach((e=>{let t=r[e];"object"==typeof t&&void 0!==t.default&&(Array.isArray(t.default)?a[e]=[...t.default]:"object"==typeof t.default?a[e]={...t.default}:a[e]=t.default)})),a}function n(e){return"transparent"===e?e:`#${e}`}function s(t,a={}){var s,d,c,u,f;a=function(e,t){var a;let r={...i(o),...i(null!==(a=e.schema)&&void 0!==a?a:{}),...t};return JSON.parse(JSON.stringify(r))}(t,a);const p=r(a.seed),g=t.create({prng:p,options:a}),h=p.pick(null!==(s=a.backgroundType)&&void 0!==s?s:[],"solid"),{primary:m,secondary:y}=function(e,t,a){var r;let l=e.shuffle(t);l.length<=1||2==t.length&&"gradientLinear"==a?(l=t,e.next()):l=e.shuffle(t),0===l.length&&(l=["transparent"]);const o=l[0],i=null!==(r=l[1])&&void 0!==r?r:l[0];return{primary:n(o),secondary:n(i)}}(p,null!==(d=a.backgroundColor)&&void 0!==d?d:[],h),v=p.integer((null===(c=a.backgroundRotation)||void 0===c?void 0:c.length)?Math.min(...a.backgroundRotation):0,(null===(u=a.backgroundRotation)||void 0===u?void 0:u.length)?Math.max(...a.backgroundRotation):0);a.size&&(g.attributes.width=a.size.toString(),g.attributes.height=a.size.toString()),void 0!==a.scale&&100!==a.scale&&(g.body=function(e,t){let{width:a,height:r,x:o,y:i}=l(e),n=t?(t-100)/100:0;return`<g transform="translate(${(a/2+o)*n*-1} ${(r/2+i)*n*-1}) scale(${t/100})">${e.body}</g>`}(g,a.scale)),a.flip&&(g.body=function(e){let{width:t,x:a}=l(e);return`<g transform="scale(-1 1) translate(${-1*t-2*a} 0)">${e.body}</g>`}(g)),a.rotate&&(g.body=function(e,t){let{width:a,height:r,x:o,y:i}=l(e);return`<g transform="rotate(${t}, ${a/2+o}, ${r/2+i})">${e.body}</g>`}(g,a.rotate)),(a.translateX||a.translateY)&&(g.body=function(e,t,a){let r=l(e);return`<g transform="translate(${(r.width+2*r.x)*((null!=t?t:0)/100)} ${(r.height+2*r.y)*((null!=a?a:0)/100)})">${e.body}</g>`}(g,a.translateX,a.translateY)),"transparent"!==m&&"transparent"!==y&&(g.body=function(e,t,a,r,o){let{width:i,height:n,x:s,y:d}=l(e);const c=`<rect fill="${t}" width="${i}" height="${n}" x="${s}" y="${d}" />`;switch(r){case"solid":return c+e.body;case"gradientLinear":return`<rect fill="url(#backgroundLinear)" width="${i}" height="${n}" x="${s}" y="${d}" /><defs><linearGradient id="backgroundLinear" gradientTransform="rotate(${o} 0.5 0.5)"><stop stop-color="${t}"/><stop offset="1" stop-color="${a}"/></linearGradient></defs>`+e.body}}(g,m,y,h,v)),(a.radius||a.clip)&&(g.body=function(e,t){let{width:a,height:r,x:o,y:i}=l(e);return`<mask id="viewboxMask"><rect width="${a}" height="${r}" rx="${t?a*t/100:0}" ry="${t?r*t/100:0}" x="${o}" y="${i}" fill="#fff" /></mask><g mask="url(#viewboxMask)">${e.body}</g>`}(g,null!==(f=a.radius)&&void 0!==f?f:0)),a.randomizeIds&&(g.body=function(e){const t=r(Math.random().toString()),a={};return e.body.replace(/(id="|url\(#)([a-z0-9-_]+)([")])/gi,((e,r,l,o)=>(a[l]=a[l]||t.string(8),`${r}${a[l]}${o}`)))}(g));const M=function(t){const a={xmlns:"http://www.w3.org/2000/svg",...t.attributes};return Object.keys(a).map((t=>`${e(t)}="${e(a[t])}"`)).join(" ")}(g),$=function(t){var a,r,l,o,i,n,s;const d=null===(a=t.meta)||void 0===a?void 0:a.title,c=null===(r=t.meta)||void 0===r?void 0:r.creator,u=null===(l=t.meta)||voLine truncated
|
||||
@@ -0,0 +1,10 @@
|
||||
import{r as e,a as f,b as t,c as d,d as r,e as a,f as c}from"./vendor-deps-CUoVodhr.js";var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function b(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var f=e.default;if("function"==typeof f){var t=function e(){return this instanceof e?Reflect.construct(f,arguments,this.constructor):f.apply(this,arguments)};t.prototype=f.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach((function(f){var d=Object.getOwnPropertyDescriptor(e,f);Object.defineProperty(t,f,d.get?d:{enumerable:!0,get:function(){return e[f]}})})),t}var s={exports:{}};const o=b(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));
|
||||
/**
|
||||
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
||||
*
|
||||
* @version 0.11.0
|
||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||
* @copyright Chen, Yi-Cyuan 2014-2024
|
||||
* @license MIT
|
||||
*/
|
||||
var h;var u,p=(h||(h=1,u=s,function(){var e="input is invalid type",f="object"==typeof window,t=f?window:{};t.JS_SHA256_NO_WINDOW&&(f=!1);var d=!f&&"object"==typeof self,r=!t.JS_SHA256_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;r?t=i:d&&(t=self);var a=!t.JS_SHA256_NO_COMMON_JS&&u.exports,c=!t.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,n="0123456789abcdef".split(""),b=[-2147483648,8388608,32768,128],s=[24,16,8,0],h=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],p=["hex","array","digest","arrayBuffer"],l=[];!t.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!c||!t.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var y=function(e,f){return function(t){return new w(f,!0).update(t)[e]()}},v=function(e){var f=y("hex",e);r&&(f=m(f,e)),f.create=function(){return new w(e)},f.update=function(e){return f.create().update(e)};for(var t=0;t<p.length;++t){var d=p[t];f[d]=y(d,e)}return f},m=function(f,d){var r,a=o,c=o.Buffer,i=d?"sha224":"sha256";return r=c.from&&!t.JS_SHA256_NO_BUFFER_FROM?c.from:function(e){return new c(e)},function(t){if("string"==typeof t)return a.createHash(i).update(t,"utf8").digest("hex");if(null==t)throw new Error(e);return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===c?a.createHash(i).update(r(t)).digest("hex"):f(t)}},g=function(e,f){return function(t,d){return new _(t,f,!0).update(d)[e]()}},S=function(e){var f=g("hex",e);f.create=function(f){return new _(f,e)},f.update=function(e,t){return f.create(e).update(t)};for(var t=0;t<p.length;++t){var d=p[t];f[d]=g(d,e)}return f};function w(e,f){f?(l[0]=l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0,this.blocks=l):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}function _(f,t,d){var r,a=typeof f;if("string"===a){var i,n=[],b=f.length,s=0;for(r=0;r<b;++r)(i=f.charCodeAt(r))<128?n[s++]=i:i<2048?(n[s++]=192|i>>>6,n[s++]=128|63&i):i<55296||i>=57344?(n[s++]=224|i>>>12,n[s++]=128|i>>>6&63,n[s++]=128|63&i):(i=65536+((1023&i)<<10|1023&f.charCodeAt(++r)),n[s++]=240|i>>>18,n[s++]=128|i>>>12&63,n[s++]=128|i>>>6&63,n[s++]=128|63&i);f=n}else{if("object"!==a)throw new Error(e);if(null===f)throw new Error(e);if(c&&f.constructor===ArrayBuffer)f=new Uint8Array(f);else if(!(Array.isArray(f)||c&&ArrayBuffer.isView(f)))throw new Error(e)}f.length>64&&(f=new w(t,!0).update(f).array());var o=[],h=[];for(r=0;r<64;++r){var u=f[r]||0;o[r]=92^u,h[r]=54^u}w.call(this,t,d),this.update(h),this.oKeyPad=o,this.inner=!0,this.sharedMemory=d}w.prototype.update=function(f){if(!this.finalized){var t,d=typeof f;if("string"!==d){if("object"!==d)throw new Error(e);if(null===f)throw new Error(e);if(c&&f.constructor===ArrayBuffer)f=new Uint8Array(f);else if(!(Array.isArray(f)||c&&ArrayBuffer.isView(f)))throw new Error(e);t=!0}for(var r,a,i=0,n=f.length,b=this.blocks;i<n;){if(this.hashed&&(this.hashed=!1,b[0]=this.block,this.block=b[16]=b[1]=b[2]=b[3]=b[4]=b[5]=b[6]=b[7]=b[8]=b[9]=b[10]=b[11]=b[12]=b[13]=b[14]=b[15]=0),t)for(a=this.start;i<n&&a<64;++i)b[a>>>2]|=f[i]<<s[3&a++];else for(a=this.start;i<n&&a<64;++i)(r=f.charCodeAt(i))<128?b[a>>>2]|=r<<s[3&a++]:r<2048?(b[a>>>2]|=(192|r>>>6)<<s[3&a++],b[a>>>2]|=(128|63&r)<<s[3&a++]):r<55296||r>=57344?(b[a>>>2]|=(224|r>>>12)<<s[3&a++],b[a>>>2]|=(128|r>>>6&63)<<s[3&a++],b[a>>>2]|=(128|63&r)<<s[3&a++]):(r=65536+((1023&r)<<10|1023&f.charCodeAt(++i)),b[a>>>2]|=(240|r>>>18)<<s[3&a++],b[a>>>2]|=(128|r>>>12&63)<<s[3&a++],b[a>>>2]|=(128|r>>>6&63)<<s[3&a++],b[a>>>2]|=(128|63&r)<<s[3&a++]);this.lastByteIndex=a,this.bytes+=a-this.start,a>=64?(this.block=b[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.byteLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
function e(e){if("string"!=typeof e||!e)throw new Error("expected a non-empty string, got: "+e)}function t(e){if("number"!=typeof e)throw new Error("expected a number, got: "+e)}const n="emoji",o="keyvalue",i="favorites",r="tokens",a="count",s="group-order",c="eTag",d="url",u="skinTone",l="readonly",m="readwrite",f="skinUnicodes";function h(e){return function(e,t){const n=new Set,o=[];for(const i of e){const e=t(i);n.has(e)||(n.add(e),o.push(i))}return o}(e,(e=>e.unicode))}const p={},g={},b={};function k(e,t,n){n.onerror=()=>t(n.error),n.onblocked=()=>t(new Error("IDB blocked")),n.onsuccess=()=>e(n.result)}async function v(e){const t=await new Promise(((t,c)=>{const d=indexedDB.open(e,1);p[e]=d,d.onupgradeneeded=e=>{e.oldVersion<1&&function(e){function t(t,n,o){const i=n?e.createObjectStore(t,{keyPath:n}):e.createObjectStore(t);if(o)for(const[e,[r,a]]of Object.entries(o))i.createIndex(e,r,{multiEntry:a});return i}t(o),t(n,"unicode",{[r]:["tokens",!0],[s]:[["group","order"]],[f]:["skinUnicodes",!0]}),t(i,void 0,{[a]:[""]})}(d.result)},k(t,c,d)}));return t.onclose=()=>w(e),t}function y(e,t,n,o){return new Promise(((i,r)=>{const a=e.transaction(t,n,{durability:"relaxed"}),s="string"==typeof t?a.objectStore(t):t.map((e=>a.objectStore(e)));let c;o(s,a,(e=>{c=e})),a.oncomplete=()=>i(c),a.onerror=()=>r(a.error)}))}function w(e){const t=p[e],n=t&&t.result;if(n){n.close();const t=b[e];if(t)for(const e of t)e()}delete p[e],delete g[e],delete b[e]}const j=new Set([":D","XD",":'D","O:)",":X",":P",";P","XP",":L",":Z",":j","8D","XO","8)",":B",":O",":S",":'o","Dx","X(","D:",":C",">0)",":3","</3","<3","\\M/",":E","8#"]);function E(e){return e.split(/[\s_]+/).map((e=>!e.match(/\w/)||j.has(e)?e.toLowerCase():e.replace(/[)(:,]/g,"").replace(/’/g,"'").toLowerCase())).filter(Boolean)}function S(e){return e.filter(Boolean).map((e=>e.toLowerCase())).filter((e=>e.length>=2))}function T(e,t,n,o){e[t](n).onsuccess=e=>o&&o(e.target.result)}function x(e,t,n){T(e,"get",t,n)}function $(e,t,n){T(e,"getAll",t,n)}function C(e){e.commit&&e.commit()}function _(e,t){const n=function(e,t){let n=e[0];for(let o=1;o<e.length;o++){const i=e[o];t(n)>t(i)&&(n=i)}return n}(e,(e=>e.length)),o=[];for(const i of n)e.some((e=>-1===e.findIndex((e=>t(e)===t(i)))))||o.push(i);return o}async function L(e,t,i,r){try{const a=function(e){return e.map((({annotation:e,emoticon:t,group:n,order:o,shortcodes:i,skins:r,tags:a,emoji:s,version:c})=>{const d={annotation:e,group:n,order:o,tags:a,tokens:[...new Set(S([...(i||[]).map(E).flat(),...(a||[]).map(E).flat(),...E(e),t]))].sort(),unicode:s,version:c};if(t&&(d.emoticon=t),i&&(d.shortcodes=i),r){d.skinTones=[],d.skinUnicodes=[],d.skinVersions=[];for(const{tone:e,emoji:t,version:n}of r)d.skinTones.push(e),d.skinUnicodes.push(t),d.skinVersions.push(n)}return d}))}(t);await y(e,[n,o],m,(([e,t],n)=>{let o,s,u=0;function l(){2===++u&&function(){if(o===r&&s===i)return;e.clear();for(const t of a)e.put(t);t.put(r,c),t.put(i,d),C(n)}()}x(t,c,(e=>{o=e,l()})),x(t,d,(e=>{s=e,l()}))}))}finally{}}async function I(e,t){const o=S(E(t));return o.length?y(e,n,l,((e,t,n)=>{const i=[],a=()=>{const e=_(i,(e=>e.unicode));n(e.sort(((e,t)=>e.order<t.order?-1:1)))};for(let s=0;s<o.length;s++){const t=o[s],n=s===o.length-1?IDBKeyRange.bound(t,t+"",!1,!0):IDBKeyRange.only(t);$(e.index(r),n,(e=>{i.push(e),i.length===o.length&&a()}))}})):[]}async function z(e,t){const o=await I(e,t);if(!o.length){const o=e=>(e.shortcodes||[]).includes(t.toLowerCase());return await async function(e,t){return y(e,n,l,((e,n,o)=>{let i;const r=()=>{e.getAll(i&&IDBKeyRange.lowerBound(i,!0),50).onsuccess=e=>{const n=e.target.result;for(const r of n)if(i=r.unicode,t(r))return o(r);if(n.length<50)return o();r()}};r()}))}(e,o)||null}return o.filter((e=>(e.shortcodes||[]).map((e=>e.toLowerCase())).includes(t.toLowerCase())))[0]||null}function M(e,t,n){return y(e,t,l,((e,t,o)=>x(e,n,o)))}const P=["name","url"];function A(e){!function(e){const t=e&&Array.isArray(e),n=t&&e.length&&(!e[0]||P.some((t=>!(t in e[0]))));if(!t||n)throw new Error("Custom emojis are in the wrong format")}(e);const t=(e,t)=>e.name.toLowerCase()<t.name.toLowerCase()?-1:1,n=e.sort(t),o=function(e,t){const n=new Map;for(const o of e){const e=t(o);for(const t of e){let e=n;for(let n=0;n<t.length;n++){const o=t.charAt(n);let i=e.get(o);i||(i=new Map,e.set(o,i)),e=i}let i=e.get("");i||(i=[],e.set("",i)),i.push(o)}}return(e,t)=>{let o=n;for(let n=0;n<e.length;n++){const t=e.charAt(n),i=o.get(t);if(!i)return[];o=i}if(t)return o.get("")||[];const i=[],r=[o];for(;r.length;){const e=[...r.shift().entries()].sort(((e,t)=>e[0]<t[0]?-1:1));for(const[t,n]of e)""===t?i.push(...n):r.push(n)}return i}}(e,(e=>{const t=new Set;if(e.shortcodes)for(const n of e.shortcodes)for(const e of E(n))t.add(e);return t})),i=e=>o(e,!0),r=e=>o(e,!1),a=new Map,s=new Map;for(const c of e){s.set(c.name.toLowerCase(),c);for(const e of c.shortcodes||[])a.set(e.toLowerCase(),c)}return{all:n,search:e=>{const n=E(e);return _(n.map(((eLine truncated
|
||||
@@ -0,0 +1,10 @@
|
||||
<svg viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<!-- 深蓝色圆背景 -->
|
||||
<circle cx="32" cy="32" r="32" fill="#357ae8" fill-opacity="0.95"/>
|
||||
<!-- 稍微下移且居中的白色锁体 -->
|
||||
<rect x="12" y="20" width="40" height="32" rx="10" fill="#fff"/>
|
||||
<!-- 稍微下移的锁头圆弧 -->
|
||||
<path d="M20 28v-8a12 12 0 0 1 24 0v8" fill="none" stroke="#fff" stroke-width="6"/>
|
||||
<!-- 锁孔与背景同色 -->
|
||||
<circle cx="32" cy="40" r="5" fill="#357ae8"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 502 B |
@@ -0,0 +1 @@
|
||||
import{e,s as t,a as n,c as s}from"./crypto-libs-Biap7jvT.js";import{b as i}from"./vendor-Cez3xphJ.js";import"./emoji-libs-WM5lT91j.js";import{c as o,d as r}from"./avatar-libs-exuC_fCG.js";import{p as a}from"./vendor-deps-CUoVodhr.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}(),window.Buffer=i.Buffer;class c{constructor(t={},n={}){this.config={rsaPublic:t.rsaPublic||"",wsAddress:t.wsAddress||"",reconnectDelay:t.reconnectDelay||3e3,pingInterval:t.pingInterval||2e4,debug:t.debug||!1},this.callbacks={onServerClosed:n.onServerClosed||null,onServerSecured:n.onServerSecured||null,onClientSecured:n.onClientSecured||null,onClientList:n.onClientList||null,onClientMessage:n.onClientMessage||null},this.SERVER_KEY_STORAGE="nodecrypt_server_key";try{this.clientEc=new e.ec("curve25519")}catch(s){this.logEvent("constructor",s,"error")}this.serverKeys=null,this.serverShared=null,this.credentials=null,this.connection=null,this.reconnect=null,this.ping=null,this.channel={},this.setCredentials=this.setCredentials.bind(this),this.connect=this.connect.bind(this),this.destruct=this.destruct.bind(this),this.onOpen=this.onOpen.bind(this),this.onMessage=this.onMessage.bind(this),this.onError=this.onError.bind(this),this.onClose=this.onClose.bind(this),this.logEvent=this.logEvent.bind(this),this.isOpen=this.isOpen.bind(this),this.isClosed=this.isClosed.bind(this),this.startReconnect=this.startReconnect.bind(this),this.stopReconnect=this.stopReconnect.bind(this),this.startPing=this.startPing.bind(this),this.stopPing=this.stopPing.bind(this),this.disconnect=this.disconnect.bind(this),this.sendMessage=this.sendMessage.bind(this),this.sendChannelMessage=this.sendChannelMessage.bind(this),this.encryptServerMessage=this.encryptServerMessage.bind(this),this.decryptServerMessage=this.decryptServerMessage.bind(this),this.encryptClientMessage=this.encryptClientMessage.bind(this),this.decryptClientMessage=this.decryptClientMessage.bind(this)}setCredentials(e,n,s){this.logEvent("setCredentials");try{this.credentials={username:e,channel:t.sha256(n),password:t.sha256(s)}}catch(i){return this.logEvent("setCredentials",i,"error"),!1}return!0}connect(){if(!this.credentials)return!1;this.logEvent("connect",this.config.wsAddress),this.stopReconnect(),this.stopPing(),this.serverKeys=null,this.serverShared=null,this.channel={};try{this.connection=new WebSocket(this.config.wsAddress),this.connection.onopen=this.onOpen,this.connection.onmessage=this.onMessage,this.connection.onerror=this.onError,this.connection.onclose=this.onClose}catch(e){return this.logEvent("connect",e,"error"),!1}return!0}destruct(){this.logEvent("destruct"),this.stopReconnect(),this.stopPing(),this.reconnect=null,this.ping=null,this.config={rsaPublic:"",wsAddress:"",reconnectDelay:3e3,pingInterval:15e3,debug:!1},this.callbacks.onServerClosed=null,this.callbacks.onServerSecured=null,this.callbacks.onClientSecured=null,this.callbacks.onClientList=null,this.callbacks.onClientMessage=null,this.clientEc=null,this.serverKeys=null,this.serverShared=null,this.credentials=null,this.connection.onopen=null,this.connection.onmessage=null,this.connection.onerror=null,this.connection.onclose=null;try{this.connection.removeAllListeners()}catch(e){this.logEvent("destruct",e,"error")}try{this.connection.close()}catch(e){this.logEvent("destruct",e,"error")}return this.connection=null,this.channel={},!0}async onOpen(){this.logEvent("onOpen"),this.startPing();try{this.serverKeys=await crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-384"},!1,["deriveKey","deriveBits"]),this.serverShared=null,this.sendMessage(i.Buffer.from(await crypto.subtle.exportKey("raw",this.serverKeys.publicKey)).toString("hex"))}catch(e){this.logEvent("onOpen",e,"error")}}async onMessage(e){if(!e||!this.isString(e.data))return;if("pong"===e.data)return;this.logEvent("onMessage",e.data);try{const t=JSON.parse(e.data);if("server-key"===t.type){if(!(await this.handleServerKey(t.key)))return}}catch(n){}if(!this.serverShared){const t=e.data.split("|");if(!t[0]||!t[1])return;try{if(!0===await crypto.subtle.verify({name:"RSASSA-PKCS1-v1_5"},await crypto.subtle.importKey("spki",i.Buffer.from(this.config.rsaPublic,"base64"),{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]),i.Buffer.from(t[1],"base64"),i.Buffer.from(t[0],"hex"))&&(this.serverShared=i.Buffer.from(await crypLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
body{margin:0;font-family:Roboto,Arial,sans-serif;height:100vh;overflow:hidden;background:#fff}.container{display:flex;height:100vh;background:#fff}.sidebar{width:250px;background:#fff;border-right:1px solid #e0e0e0;display:flex;flex-direction:column;box-shadow:2px 0 8px #e0e0e0a0;transition:width .3s ease}.sidebar-user{display:flex;align-items:center;padding:17.2px 18px 10px 17px;background:#fff;border-bottom:1px solid #dcdcdc;position:relative}.settings-btn{margin-left:auto;background:none;border:none;cursor:pointer;padding:4px;border-radius:50%;display:flex;align-items:center;justify-content:center;transition:background-color .2s ease}.settings-btn:hover{background:#f5f5f5}.settings-btn svg{display:block}.settings-panel{display:none;position:fixed;left:0;top:0;right:0;bottom:0;z-index:9999;pointer-events:none;background:none}.settings-panel-card{background:#fff;border-radius:16px;box-shadow:0 2px 24px #3c50642e;padding:15px;min-width:210px;position:absolute;display:flex;flex-direction:column;gap:10px;pointer-events:auto;opacity:0;transform:translateY(-10px) scale(.95);transition:opacity .3s ease,transform .3s ease}.settings-panel-card.open-anim{opacity:1;transform:translateY(0) scale(1)}.settings-panel-card.close-anim{opacity:0;transform:translateY(-10px) scale(.95)}.settings-title{font-size:1.3rem;font-weight:600;margin-bottom:10px;color:#30a8f7;text-align:left}.settings-item{display:flex;align-items:center;justify-content:space-between;font-size:1.08rem;color:#222;margin-bottom:8px}.settings-item select{font-size:1rem;border-radius:8px;border:1px solid #e0e0e0;padding:4px 10px;background:#fafbfc;outline:none;transition:border-color .2s ease,background-color .2s ease}.settings-item select:focus{border-color:#30a8f7;background:#fff}.switch{position:relative;display:inline-block;width:38px;height:22px}.switch input{opacity:0;width:0;height:0}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:#e0e0e0;border-radius:22px;transition:background-color .3s ease}.slider:before{position:absolute;content:"";height:16px;width:16px;left:3px;bottom:3px;background:#fff;border-radius:50%;box-shadow:0 1px 4px #0001;transition:transform .3s ease}.switch input:checked+.slider{background:#30a8f7}.switch input:checked+.slider:before{transform:translate(16px)}.settings-close{position:absolute;right:18px;top:14px;background:none;border:none;font-size:1.7rem;color:#888;cursor:pointer;z-index:3;line-height:1;border-radius:50%;transition:background-color .2s ease,color .2s ease}.settings-close:hover{background:#f5f5f5;color:#30a8f7}.sidebar .join-room{display:flex;align-items:center;justify-content:flex-start;padding:18px 0;background:#fff;border-bottom:1px solid #e0e0e0;font-size:1.13rem;font-weight:600;letter-spacing:1px;cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color .2s ease}.sidebar .join-room input,.sidebar .join-room .menu-icon{display:none!important}.sidebar .join-room:hover{background:#f5f5f5}.sidebar .rooms{flex:1;overflow-y:auto;background:#fff}.room{display:flex;align-items:center;padding:20px 15px;border-bottom:2px solid #ededed3b;cursor:pointer;background:#fff;border-radius:10px;margin:6px 8px;box-sizing:border-box;position:relative;box-shadow:none;transition:background-color .2s ease,box-shadow .2s ease}.room.active,.room.active:hover{background:#7bc0ff}.room:hover:not(.active){background:#f5f5f5}.room .info{flex:1}.room .title{font-weight:500;font-size:16px}.room .lastmsg{font-size:13px;color:#888;margin-top:2px}.room .time{font-size:12px;color:#999}.room .unread{background:#30a8f7;color:#fff;font-size:12px;border-radius:10px;padding:2px 7px;margin-left:8px;min-width:20px;text-align:center}.room-unread-badge{position:absolute;right:18px;top:50%;transform:translateY(-50%);min-width:22px;height:22px;background:linear-gradient(135deg,#ff3b30 60%,#ff5e62);color:#fff;font-size:13px;font-weight:700;border-radius:50%;display:flex;align-items:center;justify-content:center;letter-spacing:.5px;z-index:2;-webkit-user-select:none;user-select:none;pointer-events:none;transition:transform .3s ease,opacity .3s ease}.room:not(.active) .room-unread-badge{animation:badge-pop .4s cubic-bezier(.68,-.55,.265,1.55)}@keyframes badge-pop{0%{transform:scale(.3) translateY(-50%);opacity:0}50%{transform:scale(1.1) translateY(-50%);opacity:1}to{transform:scale(1) translateY(-50%);opacity:1}}.main{display:flex;flex-direction:column;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAI/0lEQVRoQ61Z24pcVRDtM52JX+sVRRAfBB8y0cmDTz75JKjxQhAVVAgoogRviYnRj0ky7a5atapW7XN6VDTSOed0eqZr7XWp2tvl3h/nh8Nu/Bl/+RW3O3uT14txd2HP4/VkvOz+YjzYPV6H3eMLXJ+M6+N4z+757/pz+Pnpe8Z38DtZAwtiXVFeXha5W34jkABAQMfAsAi7euF2HQ92NQCPxz1BOSAClAX4t0ASmCBRELvxMIDcCEKAW9lRMGBkMDM+AxDFgIMgGAPSngswmbwMiBbNWlg/mVmBGB9Y7v95w+pLUfE2pSUy00JUMpATmHBGgiUA+v+AdGkFHGODQLomh1ZnZkwWAYjeUFZSSg1QgaME/ysjBaSDsPedkUadCG3lkwCURpfVpjeKmW0gBorBYb/f7itgRN6pEa4qq9wAMThZHpi0hDM+gJdKL6YMTe7XYIAecWmlxCLine truncated
|
||||
@@ -0,0 +1,7 @@
|
||||
import{g as t,h as e}from"./vendor-deps-CUoVodhr.js";var r,n={};
|
||||
/*!
|
||||
* The buffer module from node.js, for the browser.
|
||||
*
|
||||
* @author Feross Aboukhadijeh <https://feross.org>
|
||||
* @license MIT
|
||||
*/var i=(r||(r=1,function(r){const n=e(),i=t(),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=u,r.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},r.INSPECT_MAX_BYTES=50;const f=2147483647;function s(t){if(t>f)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return a(t)}return h(t,e,r)}function h(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|y(t,e);let n=s(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(J(t,Uint8Array)){const e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return p(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(J(t,ArrayBuffer)||t&&J(t.buffer,ArrayBuffer))return l(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(J(t,SharedArrayBuffer)||t&&J(t.buffer,SharedArrayBuffer)))return l(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);const i=function(t){if(u.isBuffer(t)){const e=0|g(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||Z(t.length)?s(0):p(t):"Buffer"===t.type&&Array.isArray(t.data)?p(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function a(t){return c(t),s(t<0?0:0|g(t))}function p(t){const e=t.length<0?0:0|g(t.length),r=s(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function l(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function g(t){if(t>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||J(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(i)return n?-1:q(t).length;e=(""+e).toLowerCase(),i=!0}}function w(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,r);case"utf8":case"utf-8":return R(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return L(this,e,r);case"base64":return v(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function d(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:B(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):B(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function B(t,e,r,n,i){let o,f=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;f=2,s/=2,u/=2,r/=2}function h(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(i){let n=-1;for(o=r;o<s;o++)if(h(t,o)===h(e,-1===n?0:Line truncated
|
||||
@@ -0,0 +1,3 @@
|
||||
import{r as t}from"./crypto-libs-Biap7jvT.js";var e,i,r,n={exports:{}},o=n.exports;function h(){return e||(e=1,function(e,i){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t}function o(t,e,i){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(i=e,e=10),this._init(t||0,e||10,i||"be"))}var h;"object"==typeof e?e.exports=o:i.BN=o,o.BN=o,o.wordSize=26;try{h="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:t.Buffer}catch(T){}function s(t,e){var i=t.charCodeAt(e);return i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:i-48&15}function a(t,e,i){var r=s(t,i);return i-1>=e&&(r|=s(t,i-1)<<4),r}function u(t,e,i,r){for(var n=0,o=Math.min(t.length,i),h=e;h<o;h++){var s=t.charCodeAt(h)-48;n*=r,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},o.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},o.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,h,s=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)h=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=h<<s&67108863,this.words[o+1]=h>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)h=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=h<<s&67108863,this.words[o+1]=h>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,i){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var n,o=0,h=0;if("be"===i)for(r=t.length-1;r>=e;r-=2)n=a(t,e,r)<<o,this.words[h]|=67108863&n,o>=18?(o-=18,h+=1,this.words[h]|=n>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)n=a(t,e,r)<<o,this.words[h]|=67108863&n,o>=18?(o-=18,h+=1,this.words[h]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,i){this.words=[0],this.length=1;for(var r=0,n=1;n<=67108863;n*=e)r++;r--,n=n/e|0;for(var o=t.length-i,h=o%r,s=Math.min(o,o-h)+i,a=0,l=i;l<s;l+=r)a=u(t,l,l+r,e),this.imuln(n),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(0!==h){var f=1;for(a=u(t,l,t.length,e),l=0;l<h;l++)f*=e;this.imuln(f),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],m=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,i){i.negative=e.negative^t.negative;var r=t.length+e.length|0;i.length=r,r=r-1|0;var n=0|t.words[0],o=0|e.words[0],h=n*o,s=67108863&h,a=h/67108864|0;i.words[0]=s;for(var u=1;u<r;u++){for(var l=a>>>26,f=67108863&a,m=Math.min(u,e.length-1),c=MatLine truncated
|
||||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function it(){return tt||(tt=1,et.read=function(t,e,i,r,n){var o,h,s=8*n-r-1,a=(1<<s)-1,u=a>>1,l=-7,f=i?n-1:0,m=i?-1:1,c=t[e+f];for(f+=m,o=c&(1<<-l)-1,c>>=-l,l+=s;l>0;o=256*o+t[e+f],f+=m,l-=8);for(h=o&(1<<-l)-1,o>>=-l,l+=r;l>0;h=256*h+t[e+f],f+=m,l-=8);if(0===o)o=1-u;else{if(o===a)return h?NaN:1/0*(c?-1:1);h+=Math.pow(2,r),o-=u}return(c?-1:1)*h*Math.pow(2,o-r)},et.write=function(t,e,i,r,n,o){var h,s,a,u=8*o-n-1,l=(1<<u)-1,f=l>>1,m=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,c=r?0:o-1,p=r?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,h=l):(h=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-h))<1&&(h--,a*=2),(e+=h+f>=1?m/a:m*Math.pow(2,1-f))*a>=2&&(h++,a/=2),h+f>=l?(s=0,h=l):h+f>=1?(s=(e*a-1)*Math.pow(2,n),h+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,n),h=0));n>=8;t[i+c]=255&s,c+=p,s/=256,n-=8);for(h=h<<n|s,u+=n;u>0;t[i+c]=255&h,c+=p,h/=256,u-=8);t[i+c-p]|=128*d}),et}
|
||||
/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:rt,setPrototypeOf:nt,isFrozen:ot,getPrototypeOf:ht,getOwnPropertyDescriptor:st}=Object;let{freeze:at,seal:ut,create:lt}=Object,{apply:ft,construct:mt}="undefined"!=typeof Reflect&&Reflect;at||(at=function(t){return t}),ut||(ut=function(t){return t}),ft||(ft=function(t,e,i){return t.apply(e,i)}),mt||(mt=function(t,e){return new t(...e)});const ct=xt(Array.prototype.forEach),pt=xt(Array.prototype.lastIndexOf),dt=xt(Array.prototype.pop),gt=xt(Array.prototype.push),vt=xt(Array.prototype.splice),Mt=xt(String.prototype.toLowerCase),yt=xt(String.prototype.toString),wt=xt(String.prototype.match),_t=xt(String.prototype.replace),bt=xt(String.prototype.indexOf),At=xt(String.prototype.trim),St=xt(Object.prototype.hasOwnProperty),Tt=xt(RegExp.prototype.test),Et=(Nt=TypeError,function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return mt(Nt,e)});var Nt;function xt(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var i=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];return ft(t,e,r)}}function kt(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Mt;nt&&nt(t,null);let r=e.length;for(;r--;){let n=e[r];if("string"==typeof n){const t=i(n);t!==n&&(ot(e)||(e[r]=t),n=t)}t[n]=!0}return t}function Rt(t){for(let e=0;e<t.length;e++){St(t,e)||(t[e]=null)}return t}function Lt(t){const e=lt(null);for(const[i,r]of rt(t)){St(t,i)&&(Array.isArray(r)?e[i]=Rt(r):r&&"object"==typeof r&&r.constructor===Object?e[i]=Lt(r):e[i]=r)}return e}function Ct(t,e){for(;null!==t;){const i=st(t,e);if(i){if(i.get)return xt(i.get);if("function"==typeof i.value)return xt(i.value)}t=ht(t)}return function(){return null}}const Ot=at(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),It=at(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Dt=at(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),zt=at(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Bt=at(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Ht=at(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ut=at(["#text"]),Pt=at(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimuLine truncated
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 191 KiB |
@@ -0,0 +1,84 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head> <meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>NodeCrypt</title>
|
||||
<link rel="icon" type="image/svg+xml" href="./assets/favicon-DhO2lYdT.svg">
|
||||
<script type="module" crossorigin src="./assets/index-Cps9cQM-.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="./assets/vendor-deps-CUoVodhr.js">
|
||||
<link rel="modulepreload" crossorigin href="./assets/crypto-libs-Biap7jvT.js">
|
||||
<link rel="modulepreload" crossorigin href="./assets/vendor-Cez3xphJ.js">
|
||||
<link rel="modulepreload" crossorigin href="./assets/emoji-libs-WM5lT91j.js">
|
||||
<link rel="modulepreload" crossorigin href="./assets/avatar-libs-exuC_fCG.js">
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-D3uwBhG0.css">
|
||||
</head>
|
||||
<body> <div class="login-container" id="login-container">
|
||||
<h1>Enter a Node</h1>
|
||||
<form id="login-form">
|
||||
<!-- 登录表单内容将由JavaScript动态生成 -->
|
||||
<!-- Login form content will be dynamically generated by JavaScript -->
|
||||
</form>
|
||||
</div>
|
||||
<div class="container" id="chat-container" style="display:none;">
|
||||
<div class="mobile-sidebar-mask" id="mobile-sidebar-mask"></div>
|
||||
<div class="mobile-rightbar-mask" id="mobile-rightbar-mask"></div>
|
||||
<div class="sidebar" id="sidebar">
|
||||
<div class="sidebar-user"> <span class="avatar" id="sidebar-user-avatar"></span> <span class="sidebar-username" id="sidebar-username">My Name</span> <button class="settings-btn" id="settings-btn" title="设置" aria-label="设置"> <svg width="30px" height="30px" viewBox="0 0 24 24" fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
|
||||
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
|
||||
<g id="SVGRepo_iconCarrier">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M10.65 3L9.93163 3.53449L9.32754 5.54812L7.47651 4.55141L6.5906 4.68143L4.68141 6.59062L4.55139 7.47652L5.5481 9.32755L3.53449 9.93163L3 10.65V13.35L3.53449 14.0684L5.54811 14.6725L4.55142 16.5235L4.68144 17.4094L6.59063 19.3186L7.47653 19.4486L9.32754 18.4519L9.93163 20.4655L10.65 21H13.35L14.0684 20.4655L14.6725 18.4519L16.5235 19.4486L17.4094 19.3185L19.3186 17.4094L19.4486 16.5235L18.4519 14.6724L20.4655 14.0684L21 13.35V10.65L20.4655 9.93163L18.4519 9.32754L19.4486 7.47654L19.3186 6.59063L17.4094 4.68144L16.5235 4.55142L14.6725 5.54812L14.0684 3.53449L13.35 3H10.65ZM10.4692 6.96284L11.208 4.5H12.792L13.5308 6.96284L13.8753 7.0946C13.9654 7.12908 14.0543 7.16597 14.142 7.2052L14.4789 7.35598L16.7433 6.13668L17.8633 7.25671L16.644 9.52111L16.7948 9.85803C16.834 9.9457 16.8709 10.0346 16.9054 10.1247L17.0372 10.4692L19.5 11.208V12.792L17.0372 13.5308L16.9054 13.8753C16.8709 13.9654 16.834 14.0543 16.7948 14.1419L16.644 14.4789L17.8633 16.7433L16.7433 17.8633L14.4789 16.644L14.142 16.7948C14.0543 16.834 13.9654 16.8709 13.8753 16.9054L13.5308 17.0372L12.792 19.5H11.208L10.4692 17.0372L10.1247 16.9054C10.0346 16.8709 9.94569 16.834 9.85803 16.7948L9.52111 16.644L7.25671 17.8633L6.13668 16.7433L7.35597 14.4789L7.2052 14.142C7.16597 14.0543 7.12908 13.9654 7.0946 13.8753L6.96284 13.5308L4.5 12.792L4.5 11.208L6.96284 10.4692L7.0946 10.1247C7.12907 10.0346 7.16596 9.94571 7.20519 9.85805L7.35596 9.52113L6.13666 7.2567L7.25668 6.13667L9.5211 7.35598L9.85803 7.2052C9.9457 7.16597 10.0346 7.12908 10.1247 7.0946L10.4692 6.96284ZM14.25 12C14.25 13.2426 13.2426 14.25 12 14.25C10.7574 14.25 9.75 13.2426 9.75 12C9.75 10.7574 10.7574 9.75 12 9.75C13.2426 9.75 14.25 10.7574 14.25 12ZM15.75 12C15.75 14.0711 14.0711 15.75 12 15.75C9.92893 15.75 8.25 14.0711 8.25 12C8.25 9.92893 9.92893 8.25 12 8.25C14.0711 8.25 15.75 9.92893 15.75 12Z"
|
||||
fill="#808080"></path>
|
||||
</g>
|
||||
</svg> </button> </div>
|
||||
<div class="join-room"> <svg class="MuiSvgIcon-root icon-22-middle" focusable="false" viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M21 3.01H3c-1.1 0-2 .9-2 2V9h2V4.99h18v14.03H3V15H1v4.01c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98v-14c0-1.11-.9-2-2-2zM11 16l4-4-4-4v3H1v2h10v3z"></path>
|
||||
</svg> Enter a Node </div>
|
||||
<div class="rooms" id="room-list"> </div>
|
||||
</div>
|
||||
<div class="main">
|
||||
<div class="main-header" id="main-header"> </div>
|
||||
<div class="chat-area" id="chat-area"> </div>
|
||||
<div class="chat-input-area">
|
||||
<div class="rows-wrapper chat-input-wrapper chat-input-main-wrapper chat-rows-wrapper">
|
||||
<div class="new-message-wrapper rows-wrapper-row" data-offset="commands"> <button class="chat-emoji-btn" type="button" title="Emoji"> <svg width="30px" height="30px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
|
||||
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
|
||||
<g id="SVGRepo_iconCarrier">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M19.5 12C19.5 16.1421 16.1421 19.5 12 19.5C7.85786 19.5 4.5 16.1421 4.5 12C4.5 7.85786 7.85786 4.5 12 4.5C16.1421 4.5 19.5 7.85786 19.5 12ZM21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12ZM9.375 10.5C9.99632 10.5 10.5 9.99632 10.5 9.375C10.5 8.75368 9.99632 8.25 9.375 8.25C8.75368 8.25 8.25 8.75368 8.25 9.375C8.25 9.99632 8.75368 10.5 9.375 10.5ZM15.75 9.375C15.75 9.99632 15.2463 10.5 14.625 10.5C14.0037 10.5 13.5 9.99632 13.5 9.375C13.5 8.75368 14.0037 8.25 14.625 8.25C15.2463 8.25 15.75 8.75368 15.75 9.375ZM12 15C10.1783 15 9 13.8451 9 12.75H7.5C7.5 14.9686 9.67954 16.5 12 16.5C14.3205 16.5 16.5 14.9686 16.5 12.75H15C15 13.8451 13.8217 15 12 15Z"
|
||||
fill="#808080"></path>
|
||||
</g>
|
||||
</svg> </button>
|
||||
<div class="input-message-container">
|
||||
<div class="input-message-input is-empty scrollable scrollable-y no-scrollbar input-message-input-init" contenteditable="true" dir="auto" tabindex="-1"></div> <span class="input-field-placeholder i18n is-empty">Message</span>
|
||||
<div contenteditable="true" tabindex="-1" class="input-message-input is-empty scrollable scrollable-y no-scrollbar input-field-input-fake"></div> <button class="chat-attach-btn chat-attach-btn-abs" type="button" title="Attach file"> <svg width="30px" height="30px"
|
||||
viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
|
||||
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
|
||||
<g id="SVGRepo_iconCarrier">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M10.6875 3.75C8.96439 3.75 7.5 5.23565 7.5 7.15385L7.5 15.4615C7.5 18.1444 9.55201 20.25 12 20.25C14.448 20.25 16.5 18.1444 16.5 15.4615V7.15385H18V15.4615C18 18.8963 15.351 21.75 12 21.75C8.649 21.75 6 18.8963 6 15.4615L6 7.15385C6 4.48383 8.06137 2.25 10.6875 2.25C13.3136 2.25 15.375 4.48383 15.375 7.15385V15.4615C15.375 17.3669 13.9013 18.9808 12 18.9808C10.0987 18.9808 8.625 17.3669 8.625 15.4615V7.15385H10.125V15.4615C10.125 16.615 11.0018 17.4808 12 17.4808C12.9982 17.4808 13.875 16.615 13.875 15.4615V7.15385C13.875 5.23565 12.4106 3.75 10.6875 3.75Z"
|
||||
fill="#808080"></path>
|
||||
</g>
|
||||
</svg></button>
|
||||
</div> <input type="file" multiple class="input-hidden">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rightbar" id="rightbar">
|
||||
<div class="rightbar-header">
|
||||
<div class="rightbar-group">
|
||||
<div class="group-info">
|
||||
<div class="title">Members</div>
|
||||
<div class="group-desc" id="rightbar-group-desc"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rightbar-tabs tabs" id="member-tabs"> </div> <div class="members" id="member-list"> </div>
|
||||
</div> </div>
|
||||
</body>
|
||||
</html>
|
||||
+66
-9
@@ -1,17 +1,74 @@
|
||||
import { generateClientId, encryptMessage, decryptMessage, logEvent, isString, isObject, getTime } from './utils.js';
|
||||
|
||||
// 定义Content-Type映射
|
||||
const contentTypeMap = {
|
||||
'html': 'text/html',
|
||||
'css': 'text/css',
|
||||
'js': 'text/javascript',
|
||||
'json': 'application/json',
|
||||
'png': 'image/png',
|
||||
'jpg': 'image/jpeg',
|
||||
'jpeg': 'image/jpeg',
|
||||
'gif': 'image/gif',
|
||||
'svg': 'image/svg+xml',
|
||||
'ico': 'image/x-icon'
|
||||
};
|
||||
|
||||
// 获取文件的Content-Type
|
||||
function getContentType(filename) {
|
||||
const ext = filename.split('.').pop().toLowerCase();
|
||||
return contentTypeMap[ext] || 'text/plain';
|
||||
}
|
||||
|
||||
export default {
|
||||
async fetch(request, env, ctx) {
|
||||
const upgradeHeader = request.headers.get('Upgrade');
|
||||
if (!upgradeHeader || upgradeHeader !== 'websocket') {
|
||||
return new Response('Expected WebSocket Upgrade', { status: 426 });
|
||||
}
|
||||
|
||||
// Get or create a Durable Object instance
|
||||
const id = env.CHAT_ROOM.idFromName('chat-room');
|
||||
const stub = env.CHAT_ROOM.get(id);
|
||||
const url = new URL(request.url);
|
||||
const path = url.pathname;
|
||||
|
||||
return stub.fetch(request);
|
||||
// 处理WebSocket请求
|
||||
const upgradeHeader = request.headers.get('Upgrade');
|
||||
if (upgradeHeader && upgradeHeader === 'websocket') {
|
||||
// Get or create a Durable Object instance
|
||||
const id = env.CHAT_ROOM.idFromName('chat-room');
|
||||
const stub = env.CHAT_ROOM.get(id);
|
||||
|
||||
return stub.fetch(request);
|
||||
}
|
||||
|
||||
// 处理静态文件请求
|
||||
try {
|
||||
// 根路径重定向到index.html
|
||||
if (path === '/' || path === '') {
|
||||
return new Response('', {
|
||||
status: 302,
|
||||
headers: {
|
||||
'Location': '/index.html'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 从KV存储或Assets中获取静态文件
|
||||
let contentPath = path;
|
||||
if (contentPath.startsWith('/')) {
|
||||
contentPath = contentPath.substring(1);
|
||||
}
|
||||
|
||||
// 这里使用了Cloudflare Workers的__STATIC_CONTENT变量来获取静态资源
|
||||
// 在实际部署时,您需要将静态文件上传到Cloudflare Workers的Assets中
|
||||
const staticContent = await env.__STATIC_CONTENT.get(contentPath, 'stream');
|
||||
|
||||
if (staticContent === null) {
|
||||
return new Response('Not Found', { status: 404 });
|
||||
}
|
||||
|
||||
return new Response(staticContent, {
|
||||
headers: {
|
||||
'Content-Type': getContentType(contentPath)
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
return new Response('Server Error: ' + error.message, { status: 500 });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@ main = "src/index.js"
|
||||
compatibility_date = "2024-09-23"
|
||||
compatibility_flags = ["nodejs_compat"]
|
||||
|
||||
# 配置静态资源
|
||||
[site]
|
||||
bucket = "./public"
|
||||
|
||||
[durable_objects]
|
||||
bindings = [
|
||||
{ name = "CHAT_ROOM", class_name = "ChatRoom" }
|
||||
|
||||
Reference in new issue
Block a user