UNPKG

p3x-redis-ui-server

Version:

🏍️ P3X Redis UI server — Socket.IO backend for the dual Angular + React frontend with AI queries, 54 languages, and auto data decompression

2 lines (1 loc) 590 B
export default async e=>{const{socket:s}=e;try{const r=s.p3xrs.ioredis;if(!r)return void s.emit(e.responseEvent,{status:"error",error:"Not connected to Redis"});const[t,l]=await Promise.all([r.call("ACL","LIST"),r.call("ACL","WHOAMI")]),a=t.map(e=>({name:e.split(" ")[1],raw:e,enabled:e.includes(" on "),allKeys:e.includes(" ~* ")||e.includes(" allkeys"),allCommands:e.includes(" +@all")||e.includes(" allcommands")}));s.emit(e.responseEvent,{status:"ok",data:{users:a,currentUser:l}})}catch(r){console.error("acl/list failed",r),s.emit(e.responseEvent,{status:"error",error:r.message})}};