mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-11-08 18:42:22 +01:00
Fix width display on mobile
This commit is contained in:
1 parent
b0ab2bcb32
commit
86c3765927
4 files changed
+11
-11
No files matched your search
+2
-2
@@ -78,7 +78,7 @@ No ACL entries`;const r=[`ACL (${a.length})`];for(const o of a){const s=o.name||
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Bk=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xg=Ou("x",Bk);var Jg=Gg();const ey=Ro(Jg);function _k(a){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",r.appendChild(o),o.styleSheet?o.styleSheet.cssText=a:o.appendChild(document.createTextNode(a))}const Dk=a=>{switch(a){case"success":return Tk;case"info":return Nk;case"warning":return Pk;case"error":return Ik;default:return null}},Fk=Array(12).fill(0),Rk=({visible:a,className:r})=>pe.createElement("div",{className:["sonner-loading-wrapper",r].filter(Boolean).join(" "),"data-visible":a},pe.createElement("div",{className:"sonner-spinner"},Fk.map((o,s)=>pe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),Tk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Pk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Nk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Ik=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Mk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},pe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),pe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Ok=()=>{const[a,r]=pe.useState(document.hidden);return pe.useEffect(()=>{const o=()=>{r(document.hidden)};return document.addEventListener("visibilitychange",o),()=>window.removeEventListener("visibilitychange",o)},[]),a};let ju=1;class Lk{constructor(){this.subscribe=r=>(this.subscribers.push(r),()=>{const o=this.subscribers.indexOf(r);this.subscribers.splice(o,1)}),this.publish=r=>{this.subscribers.forEach(o=>o(r))},this.addToast=r=>{this.publish(r),this.toasts=[...this.toasts,r]},this.create=r=>{var o;const{message:s,...u}=r,l=typeof(r==null?void 0:r.id)=="number"||((o=r.id)==null?void 0:o.length)>0?r.id:ju++,m=this.toasts.find(h=>h.id===l),c=r.dismissible===void 0?!0:r.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),m?this.toasts=this.toasts.map(h=>h.id===l?(this.publish({...h,...r,id:l,title:s}),{...h,...r,id:l,dismissible:c,title:s}):h):this.addToast({title:s,...u,dismissible:c,id:l}),l},this.dismiss=r=>(r?(this.dismissedToasts.add(r),requestAnimationFrame(()=>this.subscribers.forEach(o=>o({id:r,dismiss:!0})))):this.toasts.forEach(o=>{this.subscribers.forEach(s=>s({id:o.id,dismiss:!0}))}),r),this.message=(r,o)=>this.create({...o,message:r}),this.error=(r,o)=>this.create({...o,message:r,type:"error"}),this.success=(r,o)=>this.create({...o,type:"success",message:r}),this.info=(r,o)=>this.create({...o,type:"info",message:r}),this.warning=(r,o)=>this.create({...o,type:"warning",message:r}),this.loading=(r,o)=>this.create({...o,type:"loading",message:r}),this.promise=(r,o)=>{if(!o)return;let s;o.loading!==void 0&&(s=this.create({...o,promise:r,type:"loading",message:o.loading,description:typeof o.description!="function"?o.description:void 0}));const u=Promise.resolve(r instanceof Function?r():r);let l=s!==void 0,m;const c=u.then(async d=>{if(m=["resolve",d],pe.isValidElement(d))l=!1,this.create({id:s,type:"default",message:d});else if(Vk(d)&&!d.ok){l=!1;const y=typeof o.error=="function"?await o.error(`HTTP error! status: ${d.status}`):o.error,f=typeof o.description=="function"?await o.description(`HTTP error! status: ${d.status}`):o.description,k=typeof y=="object"&&!pe.isValidElement(y)?y:{message:y};this.create({id:s,type:"error",description:f,...k})}else if(d instanceof Error){l=!1;const y=typeof o.error=="function"?await o.error(d):o.error,Line truncated
|
||||
`).map((j,I,L)=>B.jsxs("span",{children:[px(j,c),I<L.length-1&&B.jsx("br",{})]},I)),!Z&&B.jsx("span",{className:"text-[10px] text-muted-foreground/50 ml-2",children:uh(C.sender_timestamp||C.received_at)}),C.outgoing&&(C.acked>0?` ✓${C.acked>1?C.acked:""}`:" ?")]})]})]},C.id)})]}),y&&B.jsx("button",{onClick:x,className:"absolute bottom-4 right-4 w-10 h-10 rounded-full bg-muted hover:bg-accent border border-border flex items-center justify-center shadow-lg transition-opacity",title:"Scroll to bottom",children:B.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:B.jsx("polyline",{points:"6 9 12 15 18 9"})})})]})}const hx=E.forwardRef(function({onSend:r,disabled:o,placeholder:s,isRepeaterMode:u},l){const[m,c]=E.useState(""),[h,d]=E.useState(!1),g=E.useRef(null);E.useImperativeHandle(l,()=>({appendText:k=>{var x;c(v=>v+k),(x=g.current)==null||x.focus()}}));const y=E.useCallback(async k=>{k.preventDefault();const x=m.trim();if(u){if(h||o)return;const v=x==="."?"":x;d(!0);try{await r(v),c("")}catch(q){console.error("Failed to request telemetry:",q);return}finally{d(!1)}setTimeout(()=>{var q;return(q=g.current)==null?void 0:q.focus()},0)}else{if(!x||h||o)return;d(!0);try{await r(x),c("")}catch(v){console.error("Failed to send message:",v);return}finally{d(!1)}setTimeout(()=>{var v;return(v=g.current)==null?void 0:v.focus()},0)}},[m,h,o,r,u]),f=E.useCallback(k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),y(k))},[y]),w=u?m.trim().length>0||m===".":m.trim().length>0;return B.jsxs("form",{className:"px-4 py-3 border-t border-border flex gap-2",onSubmit:y,children:[B.jsx(qi,{ref:g,type:u?"password":"text",value:m,onChange:k=>c(k.target.value),onKeyDown:f,placeholder:s||(u?"Enter password (or . for none)...":"Type a message..."),disabled:o||h,className:"flex-1"}),B.jsx(Ha,{type:"submit",disabled:o||h||!w,children:h?u?"Fetching...":"Sending...":u?"Fetch":"Send"})]})});function Si(a,r,{checkForDefaultPrevented:o=!0}={}){return function(u){if(a==null||a(u),o===!1||!u.defaultPrevented)return r==null?void 0:r(u)}}function gx(a,r){const o=E.createContext(r),s=l=>{const{children:m,...c}=l,h=E.useMemo(()=>c,Object.values(c));return B.jsx(o.Provider,{value:h,children:m})};s.displayName=a+"Provider";function u(l){const m=E.useContext(o);if(m)return m;if(r!==void 0)return r;throw new Error(`\`${l}\` must be used within \`${a}\``)}return[s,u]}function Hr(a,r=[]){let o=[];function s(l,m){const c=E.createContext(m),h=o.length;o=[...o,m];const d=y=>{var q;const{scope:f,children:w,...k}=y,x=((q=f==null?void 0:f[a])==null?void 0:q[h])||c,v=E.useMemo(()=>k,Object.values(k));return B.jsx(x.Provider,{value:v,children:w})};d.displayName=l+"Provider";function g(y,f){var x;const w=((x=f==null?void 0:f[a])==null?void 0:x[h])||c,k=E.useContext(w);if(k)return k;if(m!==void 0)return m;throw new Error(`\`${y}\` must be used within \`${l}\``)}return[d,g]}const u=()=>{const l=o.map(m=>E.createContext(m));return function(c){const h=(c==null?void 0:c[a])||l;return E.useMemo(()=>({[`__scope${a}`]:{...c,[a]:h}}),[c,h])}};return u.scopeName=a,[s,yx(u,...r)]}function yx(...a){const r=a[0];if(a.length===1)return r;const o=()=>{const s=a.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(l){const m=s.reduce((c,{useScope:h,scopeName:d})=>{const y=h(l)[`__scope${d}`];return{...c,...y}},{});return E.useMemo(()=>({[`__scope${r.scopeName}`]:m}),[m])}};return o.scopeName=r.scopeName,o}var Do=globalThis!=null&&globalThis.document?E.useLayoutEffect:()=>{},bx=Mu[" useId ".trim().toString()]||(()=>{}),fx=0;function Nr(a){const[r,o]=E.useState(bx());return Do(()=>{o(s=>s??String(fx++))},[a]),r?`radix-${r}`:""}var vx=Mu[" useInsertionEffect ".trim().toString()]||Do;function sl({prop:a,defaultProp:r,onChange:o=()=>{},caller:s}){const[u,l,m]=kx({defaultProp:r,onChange:o}),c=a!==void 0,h=c?a:u;{const g=E.useRef(a!==void 0);E.useEffect(()=>{const y=g.current;y!==c&&console.warn(`${s} is changing from ${y?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=c},[c,s])}const d=E.useCallback(g=>{var y;if(c){const f=wx(g)?g(a):g;f!==a&&((y=m.current)==null||y.call(m,f))}else l(g)},[c,a,l,m]);return[h,d]}function kx({defaultProp:a,onChange:r}){const[o,s]=E.useState(a),u=E.useRef(o),l=E.useRef(r);return vx(()=>{l.current=r},[r]),E.useEffect(()=>{var m;u.current!==o&&((m=l.current)==null||m.call(l,o),u.current=o)},[o,u]),[o,s,l]}function wx(a){return typeof a=="function"}function xx(a){const r=zx(a),o=E.forwardRef((s,u)=>{const{children:l,...m}=s,c=E.Children.toArray(l),h=c.find(jx);if(h){const d=h.props.children,g=c.map(y=>y===h?E.Children.count(d)>1?E.Children.only(null):E.isValidElement(d)?d.prLine truncated
|
||||
`).map((j,I,L)=>B.jsxs("span",{children:[px(j,c),I<L.length-1&&B.jsx("br",{})]},I)),!Z&&B.jsx("span",{className:"text-[10px] text-muted-foreground/50 ml-2",children:uh(C.sender_timestamp||C.received_at)}),C.outgoing&&(C.acked>0?` ✓${C.acked>1?C.acked:""}`:" ?")]})]})]},C.id)})]}),y&&B.jsx("button",{onClick:x,className:"absolute bottom-4 right-4 w-10 h-10 rounded-full bg-muted hover:bg-accent border border-border flex items-center justify-center shadow-lg transition-opacity",title:"Scroll to bottom",children:B.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:B.jsx("polyline",{points:"6 9 12 15 18 9"})})})]})}const hx=E.forwardRef(function({onSend:r,disabled:o,placeholder:s,isRepeaterMode:u},l){const[m,c]=E.useState(""),[h,d]=E.useState(!1),g=E.useRef(null);E.useImperativeHandle(l,()=>({appendText:k=>{var x;c(v=>v+k),(x=g.current)==null||x.focus()}}));const y=E.useCallback(async k=>{k.preventDefault();const x=m.trim();if(u){if(h||o)return;const v=x==="."?"":x;d(!0);try{await r(v),c("")}catch(q){console.error("Failed to request telemetry:",q);return}finally{d(!1)}setTimeout(()=>{var q;return(q=g.current)==null?void 0:q.focus()},0)}else{if(!x||h||o)return;d(!0);try{await r(x),c("")}catch(v){console.error("Failed to send message:",v);return}finally{d(!1)}setTimeout(()=>{var v;return(v=g.current)==null?void 0:v.focus()},0)}},[m,h,o,r,u]),f=E.useCallback(k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),y(k))},[y]),w=u?m.trim().length>0||m===".":m.trim().length>0;return B.jsxs("form",{className:"px-4 py-3 border-t border-border flex gap-2",onSubmit:y,children:[B.jsx(qi,{ref:g,type:u?"password":"text",value:m,onChange:k=>c(k.target.value),onKeyDown:f,placeholder:s||(u?"Enter password (or . for none)...":"Type a message..."),disabled:o||h,className:"flex-1 min-w-0"}),B.jsx(Ha,{type:"submit",disabled:o||h||!w,className:"flex-shrink-0",children:h?u?"Fetching...":"Sending...":u?"Fetch":"Send"})]})});function Si(a,r,{checkForDefaultPrevented:o=!0}={}){return function(u){if(a==null||a(u),o===!1||!u.defaultPrevented)return r==null?void 0:r(u)}}function gx(a,r){const o=E.createContext(r),s=l=>{const{children:m,...c}=l,h=E.useMemo(()=>c,Object.values(c));return B.jsx(o.Provider,{value:h,children:m})};s.displayName=a+"Provider";function u(l){const m=E.useContext(o);if(m)return m;if(r!==void 0)return r;throw new Error(`\`${l}\` must be used within \`${a}\``)}return[s,u]}function Hr(a,r=[]){let o=[];function s(l,m){const c=E.createContext(m),h=o.length;o=[...o,m];const d=y=>{var q;const{scope:f,children:w,...k}=y,x=((q=f==null?void 0:f[a])==null?void 0:q[h])||c,v=E.useMemo(()=>k,Object.values(k));return B.jsx(x.Provider,{value:v,children:w})};d.displayName=l+"Provider";function g(y,f){var x;const w=((x=f==null?void 0:f[a])==null?void 0:x[h])||c,k=E.useContext(w);if(k)return k;if(m!==void 0)return m;throw new Error(`\`${y}\` must be used within \`${l}\``)}return[d,g]}const u=()=>{const l=o.map(m=>E.createContext(m));return function(c){const h=(c==null?void 0:c[a])||l;return E.useMemo(()=>({[`__scope${a}`]:{...c,[a]:h}}),[c,h])}};return u.scopeName=a,[s,yx(u,...r)]}function yx(...a){const r=a[0];if(a.length===1)return r;const o=()=>{const s=a.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(l){const m=s.reduce((c,{useScope:h,scopeName:d})=>{const y=h(l)[`__scope${d}`];return{...c,...y}},{});return E.useMemo(()=>({[`__scope${r.scopeName}`]:m}),[m])}};return o.scopeName=r.scopeName,o}var Do=globalThis!=null&&globalThis.document?E.useLayoutEffect:()=>{},bx=Mu[" useId ".trim().toString()]||(()=>{}),fx=0;function Nr(a){const[r,o]=E.useState(bx());return Do(()=>{o(s=>s??String(fx++))},[a]),r?`radix-${r}`:""}var vx=Mu[" useInsertionEffect ".trim().toString()]||Do;function sl({prop:a,defaultProp:r,onChange:o=()=>{},caller:s}){const[u,l,m]=kx({defaultProp:r,onChange:o}),c=a!==void 0,h=c?a:u;{const g=E.useRef(a!==void 0);E.useEffect(()=>{const y=g.current;y!==c&&console.warn(`${s} is changing from ${y?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=c},[c,s])}const d=E.useCallback(g=>{var y;if(c){const f=wx(g)?g(a):g;f!==a&&((y=m.current)==null||y.call(m,f))}else l(g)},[c,a,l,m]);return[h,d]}function kx({defaultProp:a,onChange:r}){const[o,s]=E.useState(a),u=E.useRef(o),l=E.useRef(r);return vx(()=>{l.current=r},[r]),E.useEffect(()=>{var m;u.current!==o&&((m=l.current)==null||m.call(l,o),u.current=o)},[o,u]),[o,s,l]}function wx(a){return typeof a=="function"}function xx(a){const r=zx(a),o=E.forwardRef((s,u)=>{const{children:l,...m}=s,c=E.Children.toArray(l),h=c.find(jx);if(h){const d=h.props.children,g=c.map(y=>y===h?E.Children.count(d)>1?E.Children.oLine truncated
|
||||
.`.concat(Zx,` {
|
||||
overflow: hidden `).concat(s,`;
|
||||
padding-right: `).concat(c,"px ").concat(s,`;
|
||||
@@ -534,4 +534,4 @@ fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
|
||||
See https://github.com/richtr/NoSleep.js/issues/15 for more details.
|
||||
`),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(c=>(this.enabled=!0,c)).catch(c=>{throw this.enabled=!1,c})}disable(){s()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):o()?this.noSleepTimer&&(console.warn(`
|
||||
NoSleep now disabled for older iOS devices.
|
||||
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}return xu=u,xu}var Zj=Yj();const Xj=Ro(Zj);function Jj({packets:a,channels:r,onChannelCreate:o,onRunningChange:s}){const[u,l]=E.useState(!1),[m,c]=E.useState(6),[h,d]=E.useState(!1),[g,y]=E.useState(!0),[f,w]=E.useState(!1),[k,x]=E.useState(null),[v,q]=E.useState(new Map),[A,z]=E.useState([]),[_,C]=E.useState(!1),[D,F]=E.useState(null),[R,M]=E.useState(null),P=E.useRef(null),T=E.useRef(null),U=E.useRef(!1),H=E.useRef(!1),K=E.useRef(!1),ie=E.useRef(new Map),Z=E.useRef(!1),ae=E.useRef(6),W=E.useRef(!0),ne=E.useRef(!1),X=E.useRef(new Set);E.useEffect(()=>{const ce=new Gj;P.current=ce,F(ce.isGpuAvailable());const je=new Xj;return T.current=je,ce.setWordlist(Qj),C(!0),()=>{ce.destroy(),P.current=null,je.disable(),T.current=null}},[]),E.useEffect(()=>{const ce=()=>{ei.getUndecryptedPacketCount().then(({count:De})=>M(De)).catch(()=>M(null))};ce();const je=setInterval(ce,3e4);return()=>clearInterval(je)},[]);const j=new Set(r.map(ce=>ce.key.toUpperCase())),I=a.filter(ce=>ce.payload_type==="GROUP_TEXT"&&!ce.decrypted);E.useEffect(()=>{q(ce=>{const je=new Map(ce);let De=!1;for(const Pe of I)je.has(Pe.id)||(je.set(Pe.id,{packet:Pe,attempts:0,lastAttemptLength:0,status:"pending"}),De=!0);return De?(ie.current=je,je):ce})},[I.length]),E.useEffect(()=>{ie.current=v},[v]),E.useEffect(()=>{Z.current=h},[h]),E.useEffect(()=>{ae.current=m},[m]),E.useEffect(()=>{W.current=g},[g]),E.useEffect(()=>{ne.current=f},[f]),E.useEffect(()=>{X.current=new Set(I.map(ce=>ce.id))},[I]),E.useEffect(()=>{s==null||s(u)},[u,s]);const L=Array.from(v.values()).filter(ce=>ce.status==="pending").length,$=Array.from(v.values()).filter(ce=>ce.status==="cracked").length,le=Array.from(v.values()).filter(ce=>ce.status==="failed").length,me=E.useCallback(async()=>{if(K.current||!P.current||!U.current)return;const ce=ie.current;let je=null,De=null;for(const[He,Oe]of ce.entries())if(Oe.status==="pending"){je=Oe,De=He;break}if(!je&&Z.current){const He=Array.from(ce.entries()).filter(([,Oe])=>Oe.status==="failed"&&Oe.lastAttemptLength<10);He.length>0&&(He.sort((Oe,Je)=>Oe[1].lastAttemptLength-Je[1].lastAttemptLength),[De,je]=He[0])}if(!je||De===null){U.current&&setTimeout(()=>me(),1e3);return}if(!X.current.has(De)){q(He=>{const Oe=new Map(He);return Oe.delete(De),Oe}),U.current&&setTimeout(()=>me(),10);return}K.current=!0;const Pe=ae.current,ai=je.lastAttemptLength>0,Re=ai?je.lastAttemptLength+1:Pe;try{const He=await P.current.crack(je.packet.data,{maxLength:Re,useTimestampFilter:!0,useUtf8Filter:!0,...ne.current&&{gpuDispatchMs:1e4},...ai&&{useDictionary:!1,startingLength:Re}},Oe=>{x(Oe)});if(H.current){H.current=!1,K.current=!1,x(null);return}if(He.found&&He.roomName&&He.key){q(Ge=>{const oi=new Map(Ge),fi=oi.get(De);return fi&&oi.set(De,{...fi,status:"cracked",attempts:fi.attempts+1,lastAttemptLength:Re}),oi});const Oe={roomName:He.roomName,key:He.key,packetId:De,message:He.decryptedMessage||"",crackedAt:Date.now()};z(Ge=>[...Ge,Oe]);const Je=He.key.toUpperCase();if(!j.has(Je))try{const Ge="#"+He.roomName;await o(Ge,He.key),W.current&&await ei.decryptHistoricalPackets({key_type:"channel",channel_name:Ge})}catch(Ge){console.error("Failed to create channel or decrypt historical:",Ge)}}else q(Oe=>{const Je=new Map(Oe),Ge=Je.get(De);return Ge&&Je.set(De,{...Ge,status:"failed",attempts:Ge.attempts+1,lastAttemptLength:Re}),Je})}catch(He){console.error("Cracking error:",He),q(Oe=>{const Je=new Map(Oe),Ge=Je.get(De);return Ge&&Je.set(De,{...Ge,status:"failed",attempts:Ge.attempts+1,lastAttemptLength:Re}),Je})}K.current=!1,x(null),U.current&&setTimeout(()=>me(),100)},[j,o]),ge=()=>{var ce;if(!D){alert("WebGPU is not available in your browser. Please use Chrome 113+ or Edge 113+.");return}l(!0),U.current=!0,H.current=!1,(ce=T.current)==null||ce.enable(),me()},oe=()=>{var ce,je;l(!1),U.current=!1,H.current=!0,(ce=P.current)==null||ce.abort(),(je=T.current)==null||je.disable()};return B.jsxs("div",{className:"flex flex-col h-full p-3 gap-3 bg-background border-t border-border",children:[B.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["This will attempt to dictionary attack, then brute force GroupText packets as they arrive, testing room names up to the specified length.",B.jsx("strong",{children:" Retry failed at n+1"})," will let the cracker return to the failed queue and pick up messages it couldn't crack, attempting them at one longer length.",B.jsx("strong",{children:" Decrypt historical"})," will run an async job on any room name it finds to see if any historically captured packets will decrypt with that key.",B.jsx("strong",{children:" Turbo mode"})," will push your GPU to the max (target dispatch time of 10s) and may allow accelerated cracking and/or system instability."]}),B.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[B.jsx("button",{onClick:u?oe:ge,disabled:!_||D===!1,className:$e("px
Line truncated
|
||||
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}return xu=u,xu}var Zj=Yj();const Xj=Ro(Zj);function Jj({packets:a,channels:r,onChannelCreate:o,onRunningChange:s}){const[u,l]=E.useState(!1),[m,c]=E.useState(6),[h,d]=E.useState(!1),[g,y]=E.useState(!0),[f,w]=E.useState(!1),[k,x]=E.useState(null),[v,q]=E.useState(new Map),[A,z]=E.useState([]),[_,C]=E.useState(!1),[D,F]=E.useState(null),[R,M]=E.useState(null),P=E.useRef(null),T=E.useRef(null),U=E.useRef(!1),H=E.useRef(!1),K=E.useRef(!1),ie=E.useRef(new Map),Z=E.useRef(!1),ae=E.useRef(6),W=E.useRef(!0),ne=E.useRef(!1),X=E.useRef(new Set);E.useEffect(()=>{const ce=new Gj;P.current=ce,F(ce.isGpuAvailable());const je=new Xj;return T.current=je,ce.setWordlist(Qj),C(!0),()=>{ce.destroy(),P.current=null,je.disable(),T.current=null}},[]),E.useEffect(()=>{const ce=()=>{ei.getUndecryptedPacketCount().then(({count:De})=>M(De)).catch(()=>M(null))};ce();const je=setInterval(ce,3e4);return()=>clearInterval(je)},[]);const j=new Set(r.map(ce=>ce.key.toUpperCase())),I=a.filter(ce=>ce.payload_type==="GROUP_TEXT"&&!ce.decrypted);E.useEffect(()=>{q(ce=>{const je=new Map(ce);let De=!1;for(const Pe of I)je.has(Pe.id)||(je.set(Pe.id,{packet:Pe,attempts:0,lastAttemptLength:0,status:"pending"}),De=!0);return De?(ie.current=je,je):ce})},[I.length]),E.useEffect(()=>{ie.current=v},[v]),E.useEffect(()=>{Z.current=h},[h]),E.useEffect(()=>{ae.current=m},[m]),E.useEffect(()=>{W.current=g},[g]),E.useEffect(()=>{ne.current=f},[f]),E.useEffect(()=>{X.current=new Set(I.map(ce=>ce.id))},[I]),E.useEffect(()=>{s==null||s(u)},[u,s]);const L=Array.from(v.values()).filter(ce=>ce.status==="pending").length,$=Array.from(v.values()).filter(ce=>ce.status==="cracked").length,le=Array.from(v.values()).filter(ce=>ce.status==="failed").length,me=E.useCallback(async()=>{if(K.current||!P.current||!U.current)return;const ce=ie.current;let je=null,De=null;for(const[He,Oe]of ce.entries())if(Oe.status==="pending"){je=Oe,De=He;break}if(!je&&Z.current){const He=Array.from(ce.entries()).filter(([,Oe])=>Oe.status==="failed"&&Oe.lastAttemptLength<10);He.length>0&&(He.sort((Oe,Je)=>Oe[1].lastAttemptLength-Je[1].lastAttemptLength),[De,je]=He[0])}if(!je||De===null){U.current&&setTimeout(()=>me(),1e3);return}if(!X.current.has(De)){q(He=>{const Oe=new Map(He);return Oe.delete(De),Oe}),U.current&&setTimeout(()=>me(),10);return}K.current=!0;const Pe=ae.current,ai=je.lastAttemptLength>0,Re=ai?je.lastAttemptLength+1:Pe;try{const He=await P.current.crack(je.packet.data,{maxLength:Re,useTimestampFilter:!0,useUtf8Filter:!0,...ne.current&&{gpuDispatchMs:1e4},...ai&&{useDictionary:!1,startingLength:Re}},Oe=>{x(Oe)});if(H.current){H.current=!1,K.current=!1,x(null);return}if(He.found&&He.roomName&&He.key){q(Ge=>{const oi=new Map(Ge),fi=oi.get(De);return fi&&oi.set(De,{...fi,status:"cracked",attempts:fi.attempts+1,lastAttemptLength:Re}),oi});const Oe={roomName:He.roomName,key:He.key,packetId:De,message:He.decryptedMessage||"",crackedAt:Date.now()};z(Ge=>[...Ge,Oe]);const Je=He.key.toUpperCase();if(!j.has(Je))try{const Ge="#"+He.roomName;await o(Ge,He.key),W.current&&await ei.decryptHistoricalPackets({key_type:"channel",channel_name:Ge})}catch(Ge){console.error("Failed to create channel or decrypt historical:",Ge)}}else q(Oe=>{const Je=new Map(Oe),Ge=Je.get(De);return Ge&&Je.set(De,{...Ge,status:"failed",attempts:Ge.attempts+1,lastAttemptLength:Re}),Je})}catch(He){console.error("Cracking error:",He),q(Oe=>{const Je=new Map(Oe),Ge=Je.get(De);return Ge&&Je.set(De,{...Ge,status:"failed",attempts:Ge.attempts+1,lastAttemptLength:Re}),Je})}K.current=!1,x(null),U.current&&setTimeout(()=>me(),100)},[j,o]),ge=()=>{var ce;if(!D){alert("WebGPU is not available in your browser. Please use Chrome 113+ or Edge 113+.");return}l(!0),U.current=!0,H.current=!1,(ce=T.current)==null||ce.enable(),me()},oe=()=>{var ce,je;l(!1),U.current=!1,H.current=!0,(ce=P.current)==null||ce.abort(),(je=T.current)==null||je.disable()};return B.jsxs("div",{className:"flex flex-col h-full p-3 gap-3 bg-background border-t border-border",children:[B.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["This will attempt to dictionary attack, then brute force GroupText packets as they arrive, testing room names up to the specified length.",B.jsx("strong",{children:" Retry failed at n+1"})," will let the cracker return to the failed queue and pick up messages it couldn't crack, attempting them at one longer length.",B.jsx("strong",{children:" Decrypt historical"})," will run an async job on any room name it finds to see if any historically captured packets will decrypt with that key.",B.jsx("strong",{children:" Turbo mode"})," will push your GPU to the max (target dispatch time of 10s) and may allow accelerated cracking and/or system instability."]}),B.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[B.jsx("button",{onClick:u?oe:ge,disabled:!_||D===!1,className:$e("px
Line truncated
|
||||
Vendored
+1
-1
@@ -13,7 +13,7 @@
|
||||
<link rel="shortcut icon" href="/favicon.ico" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
<script type="module" crossorigin src="/assets/index-BQNVNq9u.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-DfR6hR94.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-CacA_plj.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -507,7 +507,7 @@ export function App() {
|
||||
</SheetContent>
|
||||
</Sheet>
|
||||
|
||||
<div className="flex-1 flex flex-col bg-background">
|
||||
<div className="flex-1 flex flex-col bg-background min-w-0">
|
||||
{activeConversation ? (
|
||||
activeConversation.type === 'raw' ? (
|
||||
<>
|
||||
@@ -518,19 +518,19 @@ export function App() {
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div className="flex justify-between items-center px-4 py-3 border-b border-border font-medium">
|
||||
<span className="flex flex-col sm:flex-row sm:items-center sm:gap-2">
|
||||
<span>
|
||||
<div className="flex justify-between items-center px-4 py-3 border-b border-border font-medium gap-2">
|
||||
<span className="flex flex-col sm:flex-row sm:items-center sm:gap-2 min-w-0 flex-1">
|
||||
<span className="truncate">
|
||||
{activeConversation.type === 'channel' && !activeConversation.name.startsWith('#') ? '#' : ''}
|
||||
{activeConversation.name}
|
||||
</span>
|
||||
<span className="font-normal text-xs text-muted-foreground font-mono">
|
||||
<span className="font-normal text-xs text-muted-foreground font-mono truncate">
|
||||
{activeConversation.id}
|
||||
</span>
|
||||
</span>
|
||||
{!(activeConversation.type === 'channel' && activeConversation.name === 'Public') && (
|
||||
<button
|
||||
className="py-1 px-3 bg-destructive/20 border border-destructive/30 text-destructive rounded text-xs cursor-pointer hover:bg-destructive/30"
|
||||
className="py-1 px-3 bg-destructive/20 border border-destructive/30 text-destructive rounded text-xs cursor-pointer hover:bg-destructive/30 flex-shrink-0"
|
||||
onClick={() => {
|
||||
if (activeConversation.type === 'channel') {
|
||||
handleDeleteChannel(activeConversation.id);
|
||||
|
||||
@@ -94,9 +94,9 @@ export const MessageInput = forwardRef<MessageInputHandle, MessageInputProps>(
|
||||
onKeyDown={handleKeyDown}
|
||||
placeholder={placeholder || (isRepeaterMode ? 'Enter password (or . for none)...' : 'Type a message...')}
|
||||
disabled={disabled || sending}
|
||||
className="flex-1"
|
||||
className="flex-1 min-w-0"
|
||||
/>
|
||||
<Button type="submit" disabled={disabled || sending || !canSubmit}>
|
||||
<Button type="submit" disabled={disabled || sending || !canSubmit} className="flex-shrink-0">
|
||||
{sending
|
||||
? (isRepeaterMode ? 'Fetching...' : 'Sending...')
|
||||
: (isRepeaterMode ? 'Fetch' : 'Send')}
|
||||
|
||||
Reference in new issue
Block a user