airdcpp-webui
Version:
2 lines • 12.7 kB
JavaScript
;(self.webpackChunkairdcpp_webui=self.webpackChunkairdcpp_webui||[]).push([[959],{12039:(e,s,n)=>{n.r(s),n.d(s,{default:()=>He});var t=n(74848),o=n(96540),i=n(62048),r=n(91950),a=n(77856),c=n(8098),l=n(73616),u=n(20344),p=n(68465),d=n(52267),h=n(22005),A=n.n(h),m=n(44511);const S=A().createStore({_viewName:`${m.A.USER_VIEW_ID}_view`,_apiUrl:m.A.SESSIONS_URL,mixins:[(0,d.A)("nick")]});var b=n(3570),g=n(44247),x=n(71352),w=n(32728),f=n(99347),E=n(86038),j=n(67749),y=n(4425),_=n(39115),C=n(97145),U=n(70658);const v=({cellData:e,rowDataGetter:s,hub:n})=>(0,t.jsx)(x.F$,{text:e,user:s(),userIcon:!0,remoteMenuId:_.Ay.HUB_USER,entity:n}),I=({hub:e,sessionT:s})=>{const n=(0,C.c7)(U.KC);return(0,t.jsxs)(b.A,{store:S,entityId:e.id,sessionStore:n,rowClassNameGetter:e=>e.flags.join(" "),emptyRowsNodeGetter:()=>{const n=e.connect_state.id;if(n===E.gU.DISCONNECTED||n===E.gU.REDIRECT)return(0,t.jsx)("div",{className:"offline-message",children:(0,t.jsx)(w.A,{className:"offline",title:s.translate("Not connected to the hub"),icon:y.A.OFFLINE})});const o=s.translate(n!==E.gU.CONNECTED?"Connecting":"Loading userlist");return(0,t.jsx)("div",{className:"loader-wrapper",children:(0,t.jsx)(f.A,{text:o})})},moduleId:j.KV.HUBS,textFilterProps:{autoFocus:!0},children:[(0,t.jsx)(p.VP,{name:"Nick",width:170,columnKey:"nick",flexGrow:8,cell:(0,t.jsx)(v,{hub:e})}),(0,t.jsx)(p.VP,{name:"Share size",width:85,columnKey:"share_size",cell:(0,t.jsx)(g.us,{}),flexGrow:1}),(0,t.jsx)(p.VP,{name:"Description",width:100,columnKey:"description",flexGrow:1}),(0,t.jsx)(p.VP,{name:"Tag",width:150,columnKey:"tag",flexGrow:2}),(0,t.jsx)(p.VP,{name:"Upload speed",width:80,columnKey:"upload_speed",cell:(0,t.jsx)(g.Jy,{}),flexGrow:2}),(0,t.jsx)(p.VP,{name:"Download speed",width:80,columnKey:"download_speed",cell:(0,t.jsx)(g.Jy,{}),flexGrow:2}),(0,t.jsx)(p.VP,{name:"IP (v4)",width:120,columnKey:"ip4",flexGrow:3,cell:(0,t.jsx)(g.In,{})}),(0,t.jsx)(p.VP,{name:"IP (v6)",width:120,columnKey:"ip6",flexGrow:3,cell:(0,t.jsx)(g.In,{})}),(0,t.jsx)(p.VP,{name:"Files",width:70,columnKey:"file_count",flexGrow:3})]})};var B=n(74416),N=n(38453),O=n(85208),T=n(98147),D=n(18220);const k={toggleChatNotify:{id:"toggleChatNotify",displayName:"Use chat notification",access:E.US.HUBS_EDIT,handler:({itemData:e,socket:s})=>s.patch(`${m.A.SESSIONS_URL}/${e.id}`,{use_main_chat_notify:!e.settings.use_main_chat_notify}),checked:e=>e.settings.use_main_chat_notify},toggleShowJoins:{id:"toggleShowJoins",displayName:"Show joins/parts",access:E.US.HUBS_EDIT,handler:({itemData:e,socket:s})=>s.patch(`${m.A.SESSIONS_URL}/${e.id}`,{show_joins:!e.settings.show_joins}),checked:e=>e.settings.show_joins}},R={moduleData:{moduleId:j.KV.HUBS},actions:k};var H=n(48249);const P=(0,T.k)(e=>{const{formatSize:s}=(0,B.k)(),n=(0,H.F)(),[i,r]=(0,o.useState)({share_size:0,user_count:0});(0,o.useEffect)(()=>{const{hub:s}=e;n.get(`${m.A.SESSIONS_URL}/${s.id}/counts`).then(r).catch(e=>console.error("Failed to fetch hub counts",e.message));const t=m.A.SESSIONS_URL;return e.addSocketListener(t,m.A.SESSION_COUNTS_UPDATED,e=>r(e),s.id),()=>e.removeSocketListeners(e)},[e.hub]);const a=(0,D.y)(),{userlistToggle:l,hub:u,sessionT:p}=e,{user_count:d,share_size:h}=i,A=s(d>0?h/d:0);return(0,t.jsxs)(N.q,{children:[(0,t.jsx)(N.J,{text:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(O.A,{encryption:u.encryption}),p.t("xUsers",{defaultValue:"{{count}} user",defaultValue_plural:"{{count}} users",count:d,replace:{count:d}})]})}),!(0,c.vU)(a)&&(0,t.jsx)(N.J,{text:p.t("sharePerUser",{defaultValue:"{{total}} ({{average}}/user)",replace:{total:s(h),average:A}})}),(0,t.jsx)("div",{className:"actions-wrapper",children:(0,t.jsxs)("div",{className:"actions",children:[l,(0,t.jsx)(x.Wy,{className:"top right pointing",actions:R,header:p.translate("Notification settings"),itemData:u,triggerIcon:u.settings.use_main_chat_notify||u.settings.show_joins?"yellow bell":"bell"})]})})]})});var K=n(21479),L=n(96529),$=n(83994),G=n(32389);const V=(0,n(8418).$)(m.A.SESSIONS_URL);var F=n(36076),z=n(39364),J=n(70756);const W=({icon:e,title:s,content:n})=>{const o=(0,z.wV)();return(0,J.z)(o,E.US.HUBS_EDIT)?(0,t.jsxs)("div",{className:"ui icon message hub-action-prompt",children:[(0,t.jsxs)("h3",{className:"ui header",children:[(0,t.jsx)($.A,{icon:e}),(0,t.jsx)("div",{className:"content",children:s})]}),n]}):null},M=({hub:e,sessionT:s,socket:n})=>(0,t.jsxs)("div",{className:"password prompt",children:[(0,t.jsx)(K.A,{placeholder:s.translate("Password"),caption:s.translate("Submit"),icon:y.A.CONNECT,handleAction:t=>(0,F.bd)(()=>((e,s,n)=>n.post(`${m.A.SESSIONS_URL}/${e.id}/password`,{password:s}))(e,t,n),s.plainT)}),(0,t.jsx)("div",{className:"help",children:(0,t.jsx)(G.x6,{i18nKey:s.toI18nKey("passwordPromptHelp"),children:"This usually means that there's a registered account associated with your nick. If you don't remember having a registered account in this hub, there may be someone else using the same nick."})})]}),q=({hub:e,sessionT:s,socket:n})=>(0,t.jsx)(L.A,{className:"redirect prompt",icon:y.A.CONNECT,onClick:t=>(0,F.bd)(()=>((e,s)=>s.post(`${m.A.SESSIONS_URL}/${e.id}/redirect`))(e,n),s.plainT),caption:s.t("acceptRedirect",{defaultValue:"Accept redirect to {{url}}",replace:{url:e.connect_state.data.hub_url}})});var X=n(59548),Z=n(44657),Q=n(11216),Y=n(85072),ee=n.n(Y),se=n(97825),ne=n.n(se),te=n(77659),oe=n.n(te),ie=n(55056),re=n.n(ie),ae=n(10540),ce=n.n(ae),le=n(41113),ue=n.n(le),pe=n(32194),de={};de.styleTagTransform=ue(),de.setAttributes=re(),de.insert=oe().bind(null,"head"),de.domAPI=ne(),de.insertStyleElement=ce(),ee()(pe.A,de),pe.A&&pe.A.locals&&pe.A.locals;const he=e=>`view_userlist_${e}`,Ae=e=>(0,c.wO)(he(e),!1),me=(0,Q.$)(E.US.HUBS_EDIT,V),Se=({sessionItem:e,sessionT:s,baseUrl:n})=>{const[i,r]=(0,o.useState)(Ae(e.id)),a=(0,z.wV)(),p=(0,H.F)();(0,o.useEffect)(()=>{r(Ae(e.id))},[e.id]);const d=(0,t.jsx)(l.A,{id:"userlist-toggle",type:"toggle",caption:s.translate("User list"),onChange:()=>{const s=(r(!i),!i);(0,c.xu)(he(e.id),s)},checked:i});return(0,t.jsxs)("div",{className:"hub chat session",children:[(()=>{const n=e.connect_state.id;return n===E.gU.PASSWORD?(0,t.jsx)(W,{title:s.translate("Password required"),icon:y.A.LOCK,content:(0,t.jsx)(M,{hub:e,sessionT:s,socket:p})}):n===E.gU.REDIRECT?(0,t.jsx)(W,{title:s.translate("Redirect requested"),icon:y.A.REDIRECT,content:(0,t.jsx)(q,{hub:e,sessionT:s,socket:p})}):null})(),i?(0,t.jsx)(I,{hub:e,sessionT:s}):(0,t.jsx)(u.A,{storeSelector:U.KC,chatApi:Z.$,chatCommands:me,chatAccess:E.US.HUBS_SEND,chatSession:e,sessionType:n,handleFileUpload:s=>{const{hub_url:n}=e;return(0,X.eo)({file:s,hubUrl:n},a,p)},highlightRemoteMenuId:_.Ay.HUB_MESSAGE_HIGHLIGHT,hubUrl:e.hub_url}),(0,t.jsx)(P,{userlistToggle:d,hub:e,sessionT:s})]})};var be=n(68614),ge=n(62705),xe=n(13017),we=n(93226),fe=n(50489);const Ee=({sessionT:e,navigate:s})=>{const n=(0,C.Be)(),{t:o}=(0,G.Bd)(),i=(0,H.F)(),r=e=>{Z.$.createSession({hubUrl:e},{sessionStore:n,navigate:s,t:o,socket:i})};return(0,t.jsxs)("div",{className:"hub session new",children:[(0,t.jsx)(be.A,{submitHandler:r,button:(0,t.jsx)(L.A,{icon:y.A.CONNECT,caption:e.translate("Connect")})}),(0,t.jsx)(w.A,{description:(0,t.jsx)(G.x6,{i18nKey:e.toI18nKey("favoriteHubsHint"),defaults:"Tip: visit the <url>Favorite hubs</url> page to connect using custom settings",components:{url:(0,t.jsx)(xe.N_,{to:"/favorite-hubs"})}})}),(0,t.jsx)(ge.A,{entryType:we.iM.HUB,hasSession:e=>!!n.hubs.getSessionByUrl(e.hub_url),entryTitleRenderer:e=>(0,t.jsx)(fe.A,{onClick:s=>r(e.hub_url),caption:e.name}),entryIcon:"sitemap"})]})};var je=n(48916),ye=n(78046),_e=n(69858),Ce=n(4112),Ue=n(48844);const ve={id:"reconnect",displayName:"Reconnect",access:E.US.HUBS_EDIT,icon:y.A.REFRESH_COLORED,handler:({itemData:e,socket:s})=>s.post(`${m.A.SESSIONS_URL}/${e.id}/reconnect`)},Ie={id:"favorite",displayName:"Add to favorites",access:E.US.HUBS_EDIT,icon:y.A.FAVORITE,filter:({itemData:e})=>!e.favorite_hub,handler:({itemData:e,socket:s})=>s.post(`${m.A.SESSIONS_URL}/${e.id}/favorite`),notifications:{onSuccess:"The hub {{item.identity.name}} was added in favorites"}},Be=(0,_e.G)(m.A.SESSIONS_URL,E.US.HUBS_EDIT),Ne=(0,Ce.R)(m.A.SESSIONS_URL,E.US.HUBS_EDIT),Oe={reconnect:ve,favorite:Ie,clearChat:Be,divider:Ue.o,remove:Ne},Te={moduleData:{moduleId:j.KV.HUBS},actions:Oe};const De={itemNameGetter:e=>e.identity.name,itemStatusGetter:e=>(0,a.D8)(e.connect_state.id),itemHeaderDescriptionGetter:e=>(0,t.jsx)(i.PW,{text:e.identity.description,emojify:!0}),itemHeaderIconGetter:e=>(0,t.jsx)(je.A,{hub:e})},ke=e=>{if(e.id)return parseInt(e.id)},Re=["reconnect","clearChat","favorite"],He=(0,ye.Z)(e=>{const{params:s,sessionT:n}=e,o=function(e,s){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&s.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)s.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(n[t[o]]=e[t[o]])}return n}(e,["params","sessionT"]);return(0,t.jsx)(r.A,Object.assign({activeId:ke(s),baseUrl:"hubs",newCaption:n.t("new","Connect"),newDescription:n.t("newDesc","Connect to a new hub"),newIcon:y.A.HUBS_PLAIN,editAccess:E.US.HUBS_EDIT,uiActions:Te,actionIds:Re,sessionApi:Z.$,sessionItemLayout:Se,newLayout:Ee,sessionT:n,sessionStoreSelector:U.KC,remoteMenuId:_.Ay.HUB},De,o))},U.KC,j.KV.HUBS)},32194:(e,s,n)=>{n.d(s,{A:()=>a});var t=n(71354),o=n.n(t),i=n(76314),r=n.n(i)()(o());r.push([e.id,".hub-action-prompt {\n flex-direction: column;\n align-items: flex-start !important;\n}\n\n.hub-action-prompt .header {\n margin: 0 0 1rem !important;\n}\n\n.hub-action-prompt .password.prompt .help {\n margin-top: 10px;\n}\n\n.hub-action-prompt .redirect.prompt {\n max-width: 100%;\n overflow: hidden;\n}\n\n.hub.session .virtual-table,\n.hub.session .offline-message,\n.hub.session .loader-wrapper {\n flex: 1;\n margin-top: 5px;\n}\n\n.hub.session .cell-wrapper.tag,\n.hub.session .cell-wrapper.nick,\n.hub.session .cell-wrapper.description,\n.hub.session .cell-wrapper.share_size {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.hub.session .cell-wrapper.nick.op {\n color: steelblue;\n}\n.hub.session .session-footer .actions-wrapper > a,\n.hub.session .session-footer .actions-wrapper > div {\n /* Don't cut the shadow */\n padding-left: 1px;\n padding-bottom: 1px;\n}\n\n.hub.session .session-footer #userlist-toggle label {\n color: grey;\n font-size: small;\n}\n\n.hub.session .session-footer .actions-wrapper .dropdown {\n margin-left: 10px;\n}\n","",{version:3,sources:["webpack://./src/routes/Sidebar/routes/Hubs/style.css"],names:[],mappings:"AAAA;EACE,sBAAsB;EACtB,kCAAkC;AACpC;;AAEA;EACE,2BAA2B;AAC7B;;AAEA;EACE,gBAAgB;AAClB;;AAEA;EACE,eAAe;EACf,gBAAgB;AAClB;;AAEA;;;EAGE,OAAO;EACP,eAAe;AACjB;;AAEA;;;;EAIE,gBAAgB;EAChB,mBAAmB;AACrB;;AAEA;EACE,gBAAgB;AAClB;AACA;;EAEE,yBAAyB;EACzB,iBAAiB;EACjB,mBAAmB;AACrB;;AAEA;EACE,WAAW;EACX,gBAAgB;AAClB;;AAEA;EACE,iBAAiB;AACnB",sourcesContent:[".hub-action-prompt {\n flex-direction: column;\n align-items: flex-start !important;\n}\n\n.hub-action-prompt .header {\n margin: 0 0 1rem !important;\n}\n\n.hub-action-prompt .password.prompt .help {\n margin-top: 10px;\n}\n\n.hub-action-prompt .redirect.prompt {\n max-width: 100%;\n overflow: hidden;\n}\n\n.hub.session .virtual-table,\n.hub.session .offline-message,\n.hub.session .loader-wrapper {\n flex: 1;\n margin-top: 5px;\n}\n\n.hub.session .cell-wrapper.tag,\n.hub.session .cell-wrapper.nick,\n.hub.session .cell-wrapper.description,\n.hub.session .cell-wrapper.share_size {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.hub.session .cell-wrapper.nick.op {\n color: steelblue;\n}\n.hub.session .session-footer .actions-wrapper > a,\n.hub.session .session-footer .actions-wrapper > div {\n /* Don't cut the shadow */\n padding-left: 1px;\n padding-bottom: 1px;\n}\n\n.hub.session .session-footer #userlist-toggle label {\n color: grey;\n font-size: small;\n}\n\n.hub.session .session-footer .actions-wrapper .dropdown {\n margin-left: 10px;\n}\n"],sourceRoot:""}]);const a=r},48916:(e,s,n)=>{n.d(s,{A:()=>r});var t=n(74848),o=(n(96540),n(83994)),i=n(77856);const r=e=>{var{hub:s}=e,n=function(e,s){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&s.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)s.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(n[t[o]]=e[t[o]])}return n}(e,["hub"]);return(0,t.jsx)(o.A,Object.assign({},n,{icon:(0,i.D8)(s.connect_state.id)+" sitemap"}))}}}]);
//# sourceMappingURL=hubs.82f0f581d104a03d4461.chunk.js.map