airdcpp-webui
Version:
2 lines • 9.32 kB
JavaScript
;(self.webpackChunkairdcpp_webui=self.webpackChunkairdcpp_webui||[]).push([[664],{40358:(e,n,t)=>{t.r(n),t.d(n,{default:()=>se});var s=t(74848),i=t(96540),o=t(91950),r=t(5945),a=t(32728),l=t(46942),c=t.n(l),d=t(4425),u=t(99347),m=t(80783),A=t(53632),f=t(74416),p=t(38453),h=t(8098);const x=(0,A.A)(({item:e,sessionT:n})=>{const{formatRelativeTime:t}=(0,f.k)();if((0,h.vU)())return null;const i=e.download_state;return(0,s.jsx)(p.q,{children:(0,s.jsx)(p.J,{label:n.translate(i?"Downloaded":"Opened"),text:t(i?i.time_finished:e.time_opened)})})});var E=t(68443),b=t(13017),w=t(39364),y=t(51938),j=t(95093),v=t.n(j),g=t(41110);const C=e=>v().duration(v()().diff(v().unix(e.time_opened))).asMinutes()<=1,O=e=>(0,s.jsx)(y.ug,Object.assign({},e,{textGetter:()=>(0,g.F)(e.url).then(e=>e.text()).then(n=>(e.onReady(),n))})),_=e=>(0,s.jsx)(y.rI,Object.assign({autoPlay:C(e.item)},e)),I=e=>(0,s.jsx)(y.Ag,Object.assign({autoPlay:C(e.item)},e)),k=(e,n,t)=>`${e}view/${n}?auth_token=${t}`,B=(0,i.memo)(function({file:e,sessionT:n,scrollPositionHandler:t}){const{auth_token:i}=(0,w.wV)(),o=(0,b.$P)("/"),{scrollable:r,onScrollableContentReady:a}=(0,E.Lu)(t,e),l=(e=>{if(e.text)return O;switch(e.type.content_type){case"audio":return _;case"picture":return y.E5;case"video":return I}return null})(e);let c;return c=l?(0,s.jsx)(l,{item:e,url:k(o,e.tth,i),type:e.mime_type,extension:e.type.str,sessionT:n,onReady:a}):n.translate("Unsupported format"),(0,s.jsx)("article",{ref:r,className:"content",children:c})});var T=t(97145),R=t(62253),S=t(50592);const N=({sessionItem:e,sessionT:n})=>{(0,m.q)(e,R.z,S.E_);const t=(0,T.c7)(e=>e.viewFiles.scroll);return e.content_ready?(0,s.jsxs)("div",{className:c()("file session",e.type.str,e.type.content_type),children:[(0,s.jsx)(B,{file:e,sessionT:n,scrollPositionHandler:t}),(0,s.jsx)(x,{item:e,sessionT:n})]}):"download_failed"===e.download_state.id?(0,s.jsx)("div",{className:"file session",children:(0,s.jsx)(a.A,{icon:d.A.ERROR,title:n.translate("Download failed"),description:e.download_state.str})}):(0,s.jsx)(u.A,{text:e.download_state.str})};var D=t(86038),P=t(67749),W=t(78046),M=t(85899);const V={remove:(0,t(4112).R)(M.A.SESSIONS_URL,D.US.VIEW_FILE_EDIT)},F={moduleData:{moduleId:P.KV.VIEWED_FILES},actions:V};var L=t(85072),U=t.n(L),H=t(97825),G=t.n(H),K=t(77659),z=t.n(K),$=t(55056),Y=t.n($),q=t(10540),Z=t.n(q),J=t(41113),Q=t.n(J),X=t(69865),ee={};ee.styleTagTransform=Q(),ee.setAttributes=Y(),ee.insert=z().bind(null,"head"),ee.domAPI=G(),ee.insertStyleElement=Z(),U()(X.A,ee),X.A&&X.A.locals&&X.A.locals;var ne=t(39115);const te={itemNameGetter:e=>e.name,itemLabelGetter:()=>null,itemHeaderDescriptionGetter:()=>null,itemHeaderIconGetter:e=>(0,s.jsx)(r.A,{typeInfo:e.type})},se=(0,W.Z)(e=>{const{params:n,sessionT:t}=e,i=function(e,n){var t={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&n.indexOf(s)<0&&(t[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(e);i<s.length;i++)n.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(t[s[i]]=e[s[i]])}return t}(e,["params","sessionT"]);return 0===e.items.length?(0,s.jsx)(a.A,{title:t.t("noFiles","No files to view"),description:t.t("noFilesDesc","You may open text or media files to be viewed here from search or filelists")}):(0,s.jsx)(o.A,Object.assign({activeId:n.id,baseUrl:"files",disableSideMenu:!0,editAccess:D.US.VIEW_FILE_EDIT,uiActions:F,sessionApi:R.z,sessionStoreSelector:S.E_,sessionItemLayout:N,sessionT:t,remoteMenuId:ne.Ay.VIEW_FILE},te,i))},S.E_,P.KV.VIEWED_FILES)},51938:(e,n,t)=>{t.d(n,{rI:()=>r,E5:()=>a,ug:()=>f,Ag:()=>p});var s=t(74848),i=t(96540);function o(e){return({url:n,autoPlay:t})=>{const[o,r]=i.useState(null),a=i.useRef(null);if(i.useEffect(()=>{a.current&&a.current.load(),r(null)},[n]),o)return(0,s.jsx)("div",{children:o});const l={onError:e=>{r((e=>{const n=e.target.error;switch(n.code){case n.MEDIA_ERR_NETWORK:return"A network error caused the media download to fail";case n.MEDIA_ERR_DECODE:return"The media playback was aborted due to a corruption problem or because the media used features your browser did not support";case n.MEDIA_ERR_SRC_NOT_SUPPORTED:return"The media could not be loaded, either because the file was not found, network failed or because the format is not supported by your browser";default:return"An unknown media error occurred"}})(e))},autoPlay:t,controls:!0,src:n};return(0,s.jsx)(e,{mediaRef:a,mediaProps:l,url:n})}}const r=o(({mediaRef:e,mediaProps:n})=>(0,s.jsx)("audio",Object.assign({ref:e,style:{maxWidth:"100%",maxHeight:"100%"}},n,{children:(0,s.jsx)("track",{kind:"captions"})}))),a=({url:e})=>(0,s.jsx)("img",{src:e,style:{maxWidth:"100%",maxHeight:"100%"}});var l=t(62048),c=t(32728),d=t(67749),u=t(42695),m=t(32389),A=t(99347);const f=({textGetter:e,url:n})=>{const[t,o]=(0,i.useState)(null),[r,a]=(0,i.useState)(null),{t:f}=(0,m.Bd)();return(0,i.useEffect)(()=>(e().then(o).catch(a),()=>{o(null),a(null)}),[n]),t?(0,s.jsx)("pre",{children:(0,s.jsx)(l.PW,{text:t})}):r?(0,s.jsx)(c.A,{title:(0,u.Tl)("Failed to fetch content",f,d.KV.COMMON),description:r.message}):(0,s.jsx)(A.A,{})},p=o(({mediaRef:e,mediaProps:n})=>(0,s.jsx)("video",Object.assign({ref:e,style:{maxWidth:"100%",maxHeight:"100%"}},n,{children:(0,s.jsx)("track",{kind:"captions"})})))},53632:(e,n,t)=>{t.d(n,{A:()=>o});var s=t(74848),i=t(96540);function o(e,n=60){class t extends i.Component{constructor(){super(...arguments),this.scheduleComponentRefresh=()=>{this.redrawTimeout=window.setTimeout(()=>{this.forceUpdate(),this.scheduleComponentRefresh()},1e3*n)}}componentDidMount(){this.scheduleComponentRefresh()}componentWillUnmount(){clearTimeout(this.redrawTimeout)}render(){return(0,s.jsx)(e,Object.assign({},this.props))}}return t}},69865:(e,n,t)=>{t.d(n,{A:()=>a});var s=t(71354),i=t.n(s),o=t(76314),r=t.n(o)()(i());r.push([e.id,".file.session {\n flex: 1 1 auto;\n display: flex;\n flex-direction: column;\n max-height: 100%;\n max-width: 100%;\n margin-top: 10px;\n}\n\n.file.session .content {\n flex: 1;\n overflow: auto;\n}\n\n.file.session .content pre {\n overflow: initial;\n}\n\n.file.session.nfo .file-content pre {\n font-family: 'Courier New', 'DejaVu Sans Mono', monospace;\n font-size: 11px;\n line-height: 12px;\n padding: 3px;\n margin: 0px;\n}\n\n.file.session img,\n.file.session video {\n max-width: 100%;\n max-height: 99%;\n}\n\n/* The fullscreen mode conflicts with layout styles in Webkit-based browsers */\n:-webkit-full-screen-ancestor:not(iframe) {\n max-width: inherit !important;\n overflow-x: initial;\n}\n\n:-webkit-full-screen-ancestor:not(iframe) #side-menu {\n visibility: hidden;\n}\n","",{version:3,sources:["webpack://./src/routes/Sidebar/routes/Files/style.css"],names:[],mappings:"AAAA;EACE,cAAc;EACd,aAAa;EACb,sBAAsB;EACtB,gBAAgB;EAChB,eAAe;EACf,gBAAgB;AAClB;;AAEA;EACE,OAAO;EACP,cAAc;AAChB;;AAEA;EACE,iBAAiB;AACnB;;AAEA;EACE,yDAAyD;EACzD,eAAe;EACf,iBAAiB;EACjB,YAAY;EACZ,WAAW;AACb;;AAEA;;EAEE,eAAe;EACf,eAAe;AACjB;;AAEA,8EAA8E;AAC9E;EACE,6BAA6B;EAC7B,mBAAmB;AACrB;;AAEA;EACE,kBAAkB;AACpB",sourcesContent:[".file.session {\n flex: 1 1 auto;\n display: flex;\n flex-direction: column;\n max-height: 100%;\n max-width: 100%;\n margin-top: 10px;\n}\n\n.file.session .content {\n flex: 1;\n overflow: auto;\n}\n\n.file.session .content pre {\n overflow: initial;\n}\n\n.file.session.nfo .file-content pre {\n font-family: 'Courier New', 'DejaVu Sans Mono', monospace;\n font-size: 11px;\n line-height: 12px;\n padding: 3px;\n margin: 0px;\n}\n\n.file.session img,\n.file.session video {\n max-width: 100%;\n max-height: 99%;\n}\n\n/* The fullscreen mode conflicts with layout styles in Webkit-based browsers */\n:-webkit-full-screen-ancestor:not(iframe) {\n max-width: inherit !important;\n overflow-x: initial;\n}\n\n:-webkit-full-screen-ancestor:not(iframe) #side-menu {\n visibility: hidden;\n}\n"],sourceRoot:""}]);const a=r},73070:(e,n,t)=>{t.d(n,{Y9:()=>u,fI:()=>d,xA:()=>m});var s=t(74848),i=(t(96540),t(46942)),o=t.n(i),r=t(32389),a=t(42695),l=t(67749);const c=e=>e||(0,s.jsx)(r.x6,{i18nKey:(0,a.j2)("na",l.KV.COMMON),children:"N/A"}),d=({title:e,text:n,className:t,titleWidth:i="four",noText:r})=>(0,s.jsxs)("div",{className:o()("ui row",t),children:[(0,s.jsx)("div",{className:o()(r?"sixteen":i,"wide column title"),children:(0,s.jsx)("div",{className:"ui tiny header",style:{overflow:"hidden"},children:e})}),!r&&(0,s.jsx)("div",{className:"column value",children:c(n)})]}),u=({title:e})=>(0,s.jsx)("div",{className:"ui row",children:(0,s.jsx)("div",{className:"sixteen wide column",children:(0,s.jsx)("div",{className:"ui blue section header",children:e})})}),m=e=>{var{className:n,children:t,columns:i,stackable:r}=e,a=function(e,n){var t={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&n.indexOf(s)<0&&(t[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(e);i<s.length;i++)n.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(t[s[i]]=e[s[i]])}return t}(e,["className","children","columns","stackable"]);return(0,s.jsx)("div",Object.assign({className:o()("ui grid",{[`${i} column`]:!!i},{stackable:r},n)},a,{children:t}))}}}]);
//# sourceMappingURL=files.64f72b3869667e0d4c7e.chunk.js.map