airdcpp-webui
Version:
2 lines • 9.8 kB
JavaScript
;(self.webpackChunkairdcpp_webui=self.webpackChunkairdcpp_webui||[]).push([[629],{1964:(e,t,s)=>{s.r(t),s.d(t,{default:()=>pe});var n=s(74848),r=s(96540),a=s(22005),o=s.n(a),i=s(36671),c=s(52267);const l=o().createStore({_viewName:`${i.A.VIEW_ID}_view`,_apiUrl:i.A.MODULE_URL,mixins:[(0,c.A)("user")]});var d=s(32728),m=s(39798),u=s(82388);const p=({cellData:e,rowData:t})=>(0,n.jsx)(u.A,{triggerClassName:"name",className:"basic target",trigger:e,children:(0,n.jsx)("div",{children:t.target})});class h extends r.Component{shouldComponentUpdate(e){return e.cellData!==this.props.cellData}render(){const{cellData:e,rowDataGetter:t}=this.props;if(!e)return null;const s=t();return s.type?(0,n.jsx)(m.A,{typeInfo:s.type,caption:(0,n.jsx)(p,{cellData:e,rowData:s})}):null}}const A=h;var f=s(46942),y=s.n(f),g=s(25364),x=s(85208),E=s(99347),v=s(86038);const D=(e,t)=>{const s=e.id;return y()({grey:s===v.ZA.WAITING},{blue:s===v.ZA.RUNNING&&t.download},{red:s===v.ZA.RUNNING&&!t.download},{green:s===v.ZA.FINISHED&&t.download},{brown:s===v.ZA.FINISHED&&!t.download},{red:s===v.ZA.FAILED})},N=({cellData:e,rowDataGetter:t})=>{if(e.id===v.ZA.WAITING)return(0,n.jsx)(E.A,{size:"small",inline:!0,text:e.str});if(e.id===v.ZA.FAILED)return(0,n.jsx)("span",{className:"error",children:e.str});const s=t();let r=e.str;return s.encryption&&(r=(0,n.jsxs)("span",{className:"transfer status encryption",children:[(0,n.jsx)(x.A,{encryption:s.encryption}),r]})),(0,n.jsx)(g.A,{className:D(e,s),caption:r,percent:100*s.bytes_transferred/s.size})};var S=s(86668),j=s(71352),w=s(4425),R=s(39115),I=s(34395),C=s(89478),b=s(67749),U=s(48844),T=function(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(s[n[r]]=e[n[r]])}return s};const O=({itemData:e})=>e.download,_=({itemData:e})=>e.status.id===i.S.FINISHED,F={id:"force",displayName:"Force connect",access:v.US.TRANSFERS,icon:w.A.REFRESH_COLORED,filter:O,handler:({itemData:e,socket:t})=>t.post(`${i.A.TRANSFERS_URL}/${e.id}/force`)},k={id:"disconnect",displayName:"Disconnect",access:v.US.TRANSFERS,icon:w.A.DISCONNECT,handler:({itemData:e,socket:t})=>t.post(`${i.A.TRANSFERS_URL}/${e.id}/disconnect`)},K={id:"removeFile",displayName:"Remove file from queue",access:v.US.QUEUE_EDIT,icon:w.A.REMOVE,filter:e=>O(e)&&(({itemData:e})=>!!e.type&&"filelist"===e.type.content_type)(e)&&!_(e),handler:e=>{var{itemData:t}=e,s=T(e,["itemData"]);return C.ew.handler(Object.assign({itemData:{id:t.queue_file_id,target:t.target,name:t.name}},s))},notifications:{onSuccess:"File {{item.name}} was removed from queue"}},V={id:"removeSource",displayName:"Remove user from queue",access:v.US.QUEUE_EDIT,icon:w.A.REMOVE,filter:e=>O(e)&&!_(e),handler:e=>{var{itemData:t}=e,s=T(e,["itemData"]);return I.JN.handler(Object.assign({itemData:Object.assign(Object.assign({},t.user),{id:t.user.cid,hub_urls:[t.user.hub_url],flags:t.user.flags})},s))},notifications:{onSuccess:"The user {{item.user.nicks}} was removed from {{result.count}} files"}},L={force:F,disconnect:k,divider:U.o,removeFile:K,removeSource:V},P={moduleId:b.KV.TRANSFERS},G={moduleData:P,actions:L},$={moduleData:P,actions:{}},W=({cellData:e,rowData:t})=>(0,n.jsxs)("div",{className:"transfer-user icon-caption",children:[(0,n.jsx)("i",{className:y()(t.download?w.A.DOWNLOAD:w.A.UPLOAD,"large icon")}),e.nicks]});class M extends r.Component{shouldComponentUpdate(e){return e.cellData!==this.props.cellData}render(){const{cellData:e,rowDataGetter:t}=this.props;return(0,n.jsx)(j.F$,{user:e,userIcon:null,ids:S.F9,text:(0,n.jsx)(W,{rowData:t(),cellData:e}),remoteMenuId:R.Ay.HINTED_USER,children:(0,n.jsx)(j.yj,{itemData:t,actions:G,remoteMenuId:R.Ay.TRANSFER})})}}const H=M;var Z=s(68465),q=s(3570),Q=s(44247),z=s(85072),B=s.n(z),J=s(97825),X=s.n(J),Y=s(77659),ee=s.n(Y),te=s(55056),se=s.n(te),ne=s(10540),re=s.n(ne),ae=s(41113),oe=s.n(ae),ie=s(9538),ce={};ce.styleTagTransform=oe(),ce.setAttributes=se(),ce.insert=ee().bind(null,"head"),ce.domAPI=X(),ce.insertStyleElement=re(),B()(ie.A,ce),ie.A&&ie.A.locals&&ie.A.locals;var le=s(32389),de=s(42695);const me=({cellData:e})=>(0,n.jsx)("span",{className:"plain flags cell",children:e.join("")});class ue extends r.Component{constructor(){super(...arguments),this.isPositive=e=>e>0,this.isRunning=(e,t)=>t.speed>0,this.emptyRowsNodeGetter=()=>{const{translate:e}=this.transferT;return(0,n.jsx)(d.A,{title:e("No active transfers"),icon:w.A.TRANSFERS_PLAIN})},this.transferT=(0,de.lw)(this.props.t,b.KV.TRANSFERS)}render(){const{translate:e}=this.transferT;return(0,n.jsxs)(q.A,{emptyRowsNodeGetter:this.emptyRowsNodeGetter,store:l,moduleId:b.KV.TRANSFERS,footerData:(0,n.jsx)(j.Wy,{className:"top left pointing",caption:e("Actions..."),actions:$,header:e("Transfer actions"),triggerIcon:"chevron up",button:!0,remoteMenuId:R.Ay.TRANSFERS}),children:[(0,n.jsx)(Z.VP,{name:"User",width:150,flexGrow:4,columnKey:"user",cell:(0,n.jsx)(H,{})}),(0,n.jsx)(Z.VP,{name:"Name",width:150,flexGrow:4,columnKey:"name",cell:(0,n.jsx)(A,{})}),(0,n.jsx)(Z.VP,{name:"Segment",width:65,columnKey:"size",cell:(0,n.jsx)(Q.us,{}),renderCondition:this.isPositive,flexGrow:1}),(0,n.jsx)(Z.VP,{name:"Status",width:140,flexGrow:4,columnKey:"status",cell:(0,n.jsx)(N,{})}),(0,n.jsx)(Z.VP,{name:"Time left",width:50,columnKey:"seconds_left",renderCondition:this.isRunning,cell:(0,n.jsx)(Q.WQ,{})}),(0,n.jsx)(Z.VP,{name:"Speed",width:50,columnKey:"speed",cell:(0,n.jsx)(Q.kF,{}),renderCondition:this.isRunning,flexGrow:1}),(0,n.jsx)(Z.VP,{name:"Flags",width:50,columnKey:"flags",cell:(0,n.jsx)(me,{}),renderCondition:this.isRunning,flexGrow:1,hideWidth:800}),(0,n.jsx)(Z.VP,{name:"IP",width:120,columnKey:"ip",flexGrow:1,cell:(0,n.jsx)(Q.In,{}),hideWidth:1e3})]})}}ue.displayName="Transfers";const pe=(0,le.CI)()(ue)},9538:(e,t,s)=>{s.d(t,{A:()=>i});var n=s(71354),r=s.n(n),a=s(76314),o=s.n(a)()(r());o.push([e.id,".status .error {\n color: red;\n}\n\n.transfer.status .target {\n word-break: break-all;\n}\n","",{version:3,sources:["webpack://./src/routes/Transfers/style.css"],names:[],mappings:"AAAA;EACE,UAAU;AACZ;;AAEA;EACE,qBAAqB;AACvB",sourcesContent:[".status .error {\n color: red;\n}\n\n.transfer.status .target {\n word-break: break-all;\n}\n"],sourceRoot:""}]);const i=o},25364:(e,t,s)=>{s.d(t,{A:()=>o});var n=s(74848),r=(s(96540),s(46942)),a=s.n(r);const o=({className:e,percent:t,caption:s})=>(0,n.jsxs)("div",{className:a()("ui progress",e,{indeterminate:void 0===t}),"data-percent":t,children:[(0,n.jsx)("div",{className:"bar",style:{transitionDuration:"300ms",width:void 0===t?void 0:t+"%",minWidth:"0px"},children:(0,n.jsx)("div",{className:"progress"})}),!!s&&(0,n.jsx)("div",{className:"label",children:s})]})},34395:(e,t,s)=>{s.d(t,{JN:()=>i});var n=s(58059),r=s(4425),a=s(86038),o=s(67749);const i={id:"removeSource",displayName:"Remove user from queue",access:a.US.QUEUE_EDIT,icon:r.A.REMOVE,handler:({itemData:e,socket:t})=>t.delete(`${n.A.SOURCES_URL}/${e.cid}`),notifications:{onSuccess:"The user {{user.nicks}} was removed from {{result.count}} files"}};o.KV.QUEUE},85208:(e,t,s)=>{s.d(t,{A:()=>h});var n=s(74848),r=s(96540),a=s(82388),o=s(67749),i=s(32389),c=s(42695),l=s(83994),d=s(4425);const m=e=>{const t=e.str.match(/TLSv([\d.]+)/);return t&&2===t.length&&parseFloat(t[1])<1.2?{iconColor:"orange",messageColor:"red",message:"Outdated cryptographic protocol with known security vulnerabilities",cornerIcon:"orange warning",translationKey:"tlsOutdatedWarning"}:e.trusted?{iconColor:"green",messageColor:"green",message:"Authenticity of the certificate is validated",cornerIcon:"",translationKey:"tlsOk"}:{iconColor:"yellow",messageColor:"orange",message:"Authenticity of the certificate could not be validated",cornerIcon:"blue help",translationKey:"tlsAuthenticityWarning"}},u=({info:e,encryption:t})=>(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{children:t.str}),(0,n.jsx)("p",{style:{color:e.messageColor},children:(0,n.jsx)(i.x6,{i18nKey:(0,c.j2)(e.translationKey,o.KV.COMMON),children:e.message})})]});class p extends r.PureComponent{constructor(){super(...arguments),this.getChildren=()=>{const{encryption:e}=this.props,t=m(e);return(0,n.jsx)(u,{info:t,encryption:e})}}render(){const{encryption:e,alwaysVisible:t,boundary:s}=this.props;if(!e)return!!t&&(0,n.jsx)(l.A,{color:"grey",icon:d.A.LOCK});const r=m(e);return(0,n.jsx)(a.A,{triggerClassName:"encryption",className:"basic encryption content",trigger:(0,n.jsx)(l.A,{color:r.iconColor,icon:d.A.LOCK,cornerIcon:r.cornerIcon}),settings:{boundary:s},children:this.getChildren})}}const h=p},89478:(e,t,s)=>{s.d(t,{Hi:()=>u,ew:()=>d});var n=s(58059),r=s(4425),a=s(86038),o=s(67749),i=s(44054);const c={id:"search",displayName:"Search (foreground)",access:a.US.SEARCH,icon:r.A.SEARCH,handler:({itemData:e,location:t,navigate:s})=>(0,i.e)(e,t,s)},l={id:"searchAlternates",displayName:"Search for alternates",access:a.US.QUEUE_EDIT,icon:r.A.SEARCH_ALTERNATES,filter:({itemData:e})=>0===e.time_finished,handler:({itemData:e,socket:t})=>t.post(`${n.A.FILES_URL}/${e.id}/search`)},d={id:"remove",displayName:"Remove",access:a.US.QUEUE_EDIT,icon:r.A.REMOVE,confirmation:{content:"Are you sure that you want to remove the file {{item.name}}?",approveCaption:"Remove file",rejectCaption:"Don't remove",checkboxCaption:"Remove on disk"},handler:({itemData:e,socket:t},s)=>t.post(`${n.A.FILES_URL}/${e.id}/remove`,{remove_finished:s}),notifications:{onSuccess:"File {{item.name}} was removed from queue"}},m={search:c,searchAlternates:l,remove:d},u={moduleData:{moduleId:o.KV.QUEUE,subId:"file"},actions:m}}}]);
//# sourceMappingURL=transfers.1869852550ef1410991f.chunk.js.map