2 lines
17 KiB
JavaScript
2 lines
17 KiB
JavaScript
(()=>{"use strict";var e,t,r,i={4114:(e,t,r)=>{r.d(t,{u:()=>o});var i=r(65899);function o(){return window._nc_files_pinia||(window._nc_files_pinia=(0,i.Ey)()),window._nc_files_pinia}},9558:(e,t,r)=>{r.d(t,{A:()=>i});const i=(0,r(35947).YK)().setApp("files").detectUser().build()},16954:(e,t,r)=>{r.d(t,{hE:()=>f});var i=r(77815),o=r(36117),n=r(43627),a=r(9558),s=r(89761),d=r(4114),l=r(82736),c=r(56908),u=r(21976);const h=e=>(0,i.pO)(e);function f(e="/"){const t=new AbortController,r=(0,l.j)((0,d.u)());return r.query.length>=3?new o.CancelablePromise((o,a,l)=>{l(()=>t.abort()),async function(e,t,r){let o=(0,s._)((0,d.u)()).getDirectoryByPath("files",e);if(!o){const t=(0,n.join)(i.VA,e),r=await c.S.stat(t,{details:!0});o=h(r.data)}return{folder:o,contents:await(0,u.E)(t,{dir:e,signal:r})}}(e,r.query,t.signal).then(o).catch(a)}):function(e){e=(0,n.join)(i.VA,e);const t=new AbortController,r=(0,i.aN)();return new o.CancelablePromise(async(i,o,n)=>{n(()=>t.abort());try{const o=await c.S.getDirectoryContents(e,{details:!0,data:r,includeSelf:!0,signal:t.signal}),n=o.data[0],s=o.data.slice(1);if(n.filename!==e&&`${n.filename}/`!==e)throw a.A.debug(`Exepected "${e}" but got filename "${n.filename}" instead.`),new Error("Root node does not match requested path");i({folder:h(n),contents:s.map(e=>{try{return h(e)}catch(t){return a.A.error(`Invalid node detected '${e.basename}'`,{error:t}),null}}).filter(Boolean)})}catch(e){o(e)}})}(e)}},21976:(e,t,r)=>{r.d(t,{E:()=>d});var i=r(21777),o=r(77815),n=r(63814),a=r(9558),s=r(56908);async function d(e,{dir:t,signal:r}){const d=(0,i.HW)();if(!d)return[];if((e=e.trim()).length<3)return[];t&&!t.startsWith("/")&&(t=`/${t}`),a.A.debug("Searching for nodes",{query:e,dir:t});const{data:l}=await s.S.search("/",{details:!0,signal:r,data:`\n<d:searchrequest ${(0,o.CP)()}>\n\t <d:basicsearch>\n\t\t <d:select>\n\t\t\t <d:prop>\n\t\t\t ${(0,o.VX)()}\n\t\t\t </d:prop>\n\t\t </d:select>\n\t\t <d:from>\n\t\t\t <d:scope>\n\t\t\t\t <d:href>/files/${d.uid}${t||""}</d:href>\n\t\t\t\t <d:depth>infinity</d:depth>\n\t\t\t </d:scope>\n\t\t </d:from>\n\t\t <d:where>\n\t\t\t <d:like>\n\t\t\t\t <d:prop>\n\t\t\t\t\t <d:displayname/>\n\t\t\t\t </d:prop>\n\t\t\t\t <d:literal>%${e.replace("%","")}%</d:literal>\n\t\t\t </d:like>\n\t\t </d:where>\n\t\t <d:orderby/>\n\t</d:basicsearch>\n</d:searchrequest>`});return r?.aborted?[]:l.results.map(e=>(0,o.pO)(e,o.VA,(0,n.$_)()))}},25682:(e,t,r)=>{r(43690),r(61338),r(35810),r(53334),r(16954),r(49542)},43325:(e,t,r)=>{var i=r(61338),o=r(35810),n=r(81222);var a=r(77815),s=r(53334),d=r(85471);const l='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-link" viewBox="0 0 24 24"><path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /></svg>';var c=r(36117),u=r(56908);const h=(0,r(35947).YK)().setApp("files_sharing").detectUser().build();var f=r(16954),p=r(63814),v=r(82490),g=r(40173);const w=(0,n.C)("files_sharing","view"),y=(0,n.C)("files_sharing","sharingToken");d.Ay.use(g.Ay);const b=g.Ay.prototype.push;g.Ay.prototype.push=function(...e){return e.length>1?b.call(this,...e):b.call(this,e[0]).catch(A)};const m=g.Ay.prototype.replace;function A(e){if(!(0,g.Pq)(e,g.$c.duplicated))throw e;h.debug("Ignoring duplicated navigation from vue-router",{error:e})}g.Ay.prototype.replace=function(...e){return e.length>1?m.call(this,...e):m.call(this,e[0]).catch(A)};const C=new g.Ay({mode:"history",base:(0,p.Jv)("/s"),linkActiveClass:"active",routes:[{path:"/",redirect:{name:"filelist",params:{view:w,token:y}}},{path:"/:token",name:"filelist",props:!0}],stringifyQuery(e){const t=v.A.stringify(e).replace(/%2F/gim,"/");return t?"?"+t:""}});(()=>{const e=(0,n.C)("files_sharing","filename");let t,i;const l=new o.Ss({id:"public-file-drop",name:(0,s.Tl)("files_sharing","File drop"),caption:(0,s.Tl)("files_sharing","Upload files to {foldername}",{foldername:e}),icon:'<svg xmlns="http://www.w3.org/2000/svg" id="mdi-cloud-upload" viewBox="0 0 24 24"><path d="M11 20H6.5Q4.22 20 2.61 18.43 1 16.85 1 14.58 1 12.63 2.17 11.1 3.35 9.57 5.25 9.15 5.88 6.85 7.75 5.43 9.63 4 12 4 14.93 4 16.96 6.04 19 8.07 19 11 20.73 11.2 21.86 12.5 23 13.78 23 15.5 23 17.38 21.69 18.69 20.38 20 18.5 20H13V12.85L14.6 14.4L16 13L12 9L8 13L9.4 14.4L11 12.85Z" /></svg>',order:1,emptyView:async o=>{if(void 0===t){const{default:e}=await Promise.all([r.e(4208),r.e(3183)]).then(r.bind(r,13183));t=d.Ay.extend(e)}i&&i.$destroy(),i=new t({propsData:{foldername:e}}),i.$mount(o)},getContents:async()=>({contents:[],folder:new o.vd({id:0,source:`${a.Xn}${a.VA}`,root:a.VA,owner:null,permissions:o.aX.CREATE})})});(0,o.bh)().register(l)})(),(()=>{const e=new o.Ss({id:"public-share",name:(0,s.Tl)("files_sharing","Public share"),caption:(0,s.Tl)("files_sharing","Publicly shared files."),emptyTitle:(0,s.Tl)("files_sharing","No files"),emptyCaption:(0,s.Tl)("files_sharing","Files and folders shared with you will show up here"),icon:l,order:1,getContents:f.hE});(0,o.bh)().register(e)})(),(()=>{const e=new o.Ss({id:"public-file-share",name:(0,s.Tl)("files_sharing","Public file share"),caption:(0,s.Tl)("files_sharing","Publicly shared file."),emptyTitle:(0,s.Tl)("files_sharing","No file"),emptyCaption:(0,s.Tl)("files_sharing","The file shared with you will show up here"),icon:l,order:1,getContents:()=>new c.CancelablePromise(async(e,t,r)=>{const i=new AbortController;r(()=>i.abort());try{const t=await u.S.stat(o.lJ,{data:(0,o.VL)(),details:!0,signal:i.signal});e({contents:[(0,o.Al)(t.data)],folder:new o.vd({id:0,source:`${o.PY}${o.lJ}`,root:o.lJ,owner:null,permissions:o.aX.READ,attributes:{note:t.data.props?.note}})})}catch(e){h.error(e),t(e)}})});(0,o.bh)().register(e)})();const P=(0,n.C)("files_sharing","view"),N=(0,o.bh)();N.setActive(N.views.find(({id:e})=>e===P)??null),window.OCP.Files=window.OCP.Files??{},window.OCP.Files.Router=new class{constructor(e){var t,r,i;t=this,i=void 0,(r=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(r="router"))in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.router=e}get name(){return this.router.currentRoute.name}get query(){return this.router.currentRoute.query||{}}get params(){return this.router.currentRoute.params||{}}get _router(){return this.router}goTo(e,t=!1){return this.router.push({path:e,replace:t})}goToRoute(e,t,r,i){return this.router.push({name:e,query:r,params:t,replace:i})}}(C);const _=(0,n.C)("files_sharing","fileId",null),T=(0,n.C)("files_sharing","sharingToken");null!==_&&window.OCP.Files.Router.goToRoute("filelist",{...window.OCP.Files.Router.params,token:T,fileid:String(_)},{...window.OCP.Files.Router.query,openfile:"true"}),(0,i.B1)("files:list:updated",function e({folder:t}){if((0,i.al)("files:list:updated",e),t.attributes["share-attributes"]){const e=JSON.parse(t.attributes["share-attributes"]||"[]").find(({scope:e,key:t})=>"config"===e&&"grid_view"===t);void 0!==e&&(h.debug("Loading share attributes",{gridViewAttribute:e}),(0,i.Ic)("files:config:updated",{key:"grid_view",value:!0===e.value}))}})},43690:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-folder-outline" viewBox="0 0 24 24"><path d="M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z" /></svg>'},45238:(e,t,r)=>{r.d(t,{B:()=>c});var i=r(61338),o=r(35810),n=r(71225),a=r(65899),s=r(85471),d=r(9558),l=r(89761);function c(...e){const t=(0,l._)(...e),r=(0,a.nY)("paths",{state:()=>({paths:{}}),getters:{getPath:e=>(t,r)=>{if(e.paths[t])return e.paths[t][r]}},actions:{addPath(e){this.paths[e.service]||s.Ay.set(this.paths,e.service,{}),s.Ay.set(this.paths[e.service],e.path,e.source)},deletePath(e,t){this.paths[e]&&s.Ay.delete(this.paths[e],t)},onCreatedNode(e){const t=(0,o.bh)()?.active?.id||"files";e.fileid?(e.type===o.pt.Folder&&this.addPath({service:t,path:e.path,source:e.source}),this.addNodeToParentChildren(e)):d.A.error("Node has no fileid",{node:e})},onDeletedNode(e){const t=(0,o.bh)()?.active?.id||"files";e.type===o.pt.Folder&&this.deletePath(t,e.path),this.deleteNodeFromParentChildren(e)},onMovedNode({node:e,oldSource:t}){const r=(0,o.bh)()?.active?.id||"files";if(e.type===o.pt.Folder){const i=Object.entries(this.paths[r]).find(([,e])=>e===t);i?.[0]&&this.deletePath(r,i[0]),this.addPath({service:r,path:e.path,source:e.source})}const i=new o.ZH({source:t,owner:e.owner,mime:e.mime});this.deleteNodeFromParentChildren(i),this.addNodeToParentChildren(e)},deleteNodeFromParentChildren(e){const r=(0,o.bh)()?.active?.id||"files",i=(0,n.pD)(e.source),a="/"===e.dirname?t.getRoot(r):t.getNode(i);if(a){const t=new Set(a._children??[]);return t.delete(e.source),s.Ay.set(a,"_children",[...t.values()]),void d.A.debug("Children updated",{parent:a,node:e,children:a._children})}d.A.debug("Parent path does not exists, skipping children update",{node:e})},addNodeToParentChildren(e){const r=(0,o.bh)()?.active?.id||"files",i=(0,n.pD)(e.source),a="/"===e.dirname?t.getRoot(r):t.getNode(i);if(a){const t=new Set(a._children??[]);return t.add(e.source),s.Ay.set(a,"_children",[...t.values()]),void d.A.debug("Children updated",{parent:a,node:e,children:a._children})}d.A.debug("Parent path does not exists, skipping children update",{node:e})}}})(...e);return r._initialized||((0,i.B1)("files:node:created",r.onCreatedNode),(0,i.B1)("files:node:deleted",r.onDeletedNode),(0,i.B1)("files:node:moved",r.onMovedNode),r._initialized=!0),r}},49542:(e,t,r)=>{var i=r(61338),o=r(35810),n=r(65899),a=r(85471),s=r(9558);(0,n.nY)("active",()=>{const e=(0,a.KR)(),t=(0,a.KR)(),r=(0,a.KR)(),n=(0,a.KR)();function d(e){r.value&&r.value.source===e.source&&(r.value=void 0)}function l(e=null){s.A.debug("Setting active view",{view:e}),n.value=e??void 0,r.value=void 0}return function(){const e=(0,o.bh)();(0,i.B1)("files:node:deleted",d),l(e.active),e.addEventListener("updateActive",e=>{l(e.detail)})}(),{activeAction:e,activeFolder:t,activeNode:r,activeView:n}})},53775:(e,t,r)=>{r.d(t,{w:()=>i}),r(35810),r(53334),r(21777),r(77815),r(36117),r(9558),r(82736),r(21976),r(25682);const i="search"},56908:(e,t,r)=>{r.d(t,{S:()=>o,t:()=>n});var i=r(77815);const o=(0,i.KU)();async function n(e){const t=(0,i.aN)(),r=await o.stat(`${(0,i.ei)()}${e}`,{details:!0,data:t});return(0,i.pO)(r.data)}},77815:(e,t,r)=>{r.d(t,{CP:()=>i.k,KU:()=>i.c,VA:()=>i.d,VX:()=>i.j,Xn:()=>i.b,aN:()=>i.l,ei:()=>i.g,pO:()=>i.r});var i=r(1822)},82736:(e,t,r)=>{r.d(t,{j:()=>c});var i=r(61338),o=r(17334),n=r.n(o),a=r(65899),s=r(85471),d=r(9558),l=r(53775);const c=(0,a.nY)("search",()=>{const e=(0,s.KR)(""),t=(0,s.KR)("filter");(0,s.wB)(t,o),(0,s.wB)(e,(e,t)=>{e.trim()!==t.trim()&&o()}),function(){(0,i.B1)("files:navigation:changed",a);const r=window.OCP.Files.Router;r.params.view===l.w&&(e.value=[r.query.query].flat()[0]??"",e.value?(t.value="globally",d.A.debug("Directly navigated to search view",{query:e.value})):(d.A.info("Directly navigated to search view without any query, redirect to files view."),r.goToRoute(void 0,{...r.params,view:"files"},{...r.query,query:void 0},!0)))}();const r=n()(t=>{window.OCP.Files.Router.goToRoute(void 0,{view:l.w},{query:e.value},t)});function o(){(0,i.Ic)("files:search:updated",{query:e.value,scope:t.value});const o=window.OCP.Files.Router;if(o.params.view===l.w&&(""===e.value||"filter"===t.value))return t.value="filter",o.goToRoute(void 0,{view:"files"},{...o.query,query:void 0});if("filter"===t.value||!e.value)return;const n=o.params.view===l.w;d.A.debug("Update route for updated search query",{query:e.value,isSearch:n}),r(n)}function a(r){r.id!==l.w&&(e.value="",t.value="filter")}return{query:e,scope:t}})},89761:(e,t,r)=>{r.d(t,{_:()=>l});var i=r(61338),o=r(65899),n=r(85471),a=r(9558),s=r(56908),d=r(45238);function l(...e){const t=(0,o.nY)("files",{state:()=>({files:{},roots:{}}),getters:{getNode:e=>t=>e.files[t],getNodes:e=>t=>t.map(t=>e.files[t]).filter(Boolean),getNodesById:e=>t=>Object.values(e.files).filter(e=>e.fileid===t),getRoot:e=>t=>e.roots[t]},actions:{getDirectoryByPath(e,t){const r=(0,d.B)();let i;if(t&&"/"!==t){const o=r.getPath(e,t);o&&(i=this.getNode(o))}else i=this.getRoot(e);return i},getNodesByPath(e,t){const r=this.getDirectoryByPath(e,t);return(r?._children??[]).map(e=>this.getNode(e)).filter(Boolean)},updateNodes(e){const t=e.reduce((e,t)=>t.fileid?(e[t.source]=t,e):(a.A.error("Trying to update/set a node without fileid",{node:t}),e),{});n.Ay.set(this,"files",{...this.files,...t})},deleteNodes(e){e.forEach(e=>{e.source&&n.Ay.delete(this.files,e.source)})},setRoot({service:e,root:t}){n.Ay.set(this.roots,e,t)},onDeletedNode(e){this.deleteNodes([e])},onCreatedNode(e){this.updateNodes([e])},onMovedNode({node:e,oldSource:t}){e.fileid?(n.Ay.delete(this.files,t),this.updateNodes([e])):a.A.error("Trying to update/set a node without fileid",{node:e})},async onUpdatedNode(e){if(!e.fileid)return void a.A.error("Trying to update/set a node without fileid",{node:e});const t=this.getNodesById(e.fileid);if(t.length>1)return await Promise.all(t.map(e=>(0,s.t)(e.path))).then(this.updateNodes),void a.A.debug(t.length+" nodes updated in store",{fileid:e.fileid});1!==t.length||e.source!==t[0].source?(0,s.t)(e.path).then(e=>this.updateNodes([e])):this.updateNodes([e])},onAddFavorite(e){const t=this.getNode(e.source);t&&n.Ay.set(t.attributes,"favorite",1)},onRemoveFavorite(e){const t=this.getNode(e.source);t&&n.Ay.set(t.attributes,"favorite",0)}}})(...e);return t._initialized||((0,i.B1)("files:node:created",t.onCreatedNode),(0,i.B1)("files:node:deleted",t.onDeletedNode),(0,i.B1)("files:node:updated",t.onUpdatedNode),(0,i.B1)("files:node:moved",t.onMovedNode),(0,i.B1)("files:favorites:added",t.onAddFavorite),(0,i.B1)("files:favorites:removed",t.onRemoveFavorite),t._initialized=!0),t}}},o={};function n(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={id:e,loaded:!1,exports:{}};return i[e].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}n.m=i,e=[],n.O=(t,r,i,o)=>{if(!r){var a=1/0;for(c=0;c<e.length;c++){for(var[r,i,o]=e[c],s=!0,d=0;d<r.length;d++)(!1&o||a>=o)&&Object.keys(n.O).every(e=>n.O[e](r[d]))?r.splice(d--,1):(s=!1,o<a&&(a=o));if(s){e.splice(c--,1);var l=i();void 0!==l&&(t=l)}}return t}o=o||0;for(var c=e.length;c>0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[r,i,o]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((t,r)=>(n.f[r](e,t),t),[])),n.u=e=>e+"-"+e+".js?v="+{1082:"5717071164201a87ca6b",3183:"b98785e9878486749cd4",6106:"2a8c095ce0bf82542cc9",6590:"3e7307d5fb971e8aac64",7471:"6423b9b898ffefeb7d1d",7587:"dfb25e4279e28f17878d",8970:"1a3b6844f3a72d08ba45",9107:"99c50526a9179b809d7a",9165:"f5ea527f287d717fa967"}[e],n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="nextcloud:",n.l=(e,i,o,a)=>{if(t[e])t[e].push(i);else{var s,d;if(void 0!==o)for(var l=document.getElementsByTagName("script"),c=0;c<l.length;c++){var u=l[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+o){s=u;break}}s||(d=!0,(s=document.createElement("script")).charset="utf-8",n.nc&&s.setAttribute("nonce",n.nc),s.setAttribute("data-webpack",r+o),s.src=e),t[e]=[i];var h=(r,i)=>{s.onerror=s.onload=null,clearTimeout(f);var o=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach(e=>e(i)),r)return r(i)},f=setTimeout(h.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=h.bind(null,s.onerror),s.onload=h.bind(null,s.onload),d&&document.head.appendChild(s)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),n.j=5102,(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{n.b="undefined"!=typeof document&&document.baseURI||self.location.href;var e={5102:0};n.f.j=(t,r)=>{var i=n.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var o=new Promise((r,o)=>i=e[t]=[r,o]);r.push(i[2]=o);var a=n.p+n.u(t),s=new Error;n.l(a,r=>{if(n.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var o=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",s.name="ChunkLoadError",s.type=o,s.request=a,i[1](s)}},"chunk-"+t,t)}},n.O.j=t=>0===e[t];var t=(t,r)=>{var i,o,[a,s,d]=r,l=0;if(a.some(t=>0!==e[t])){for(i in s)n.o(s,i)&&(n.m[i]=s[i]);if(d)var c=d(n)}for(t&&t(r);l<a.length;l++)o=a[l],n.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return n.O(c)},r=self.webpackChunknextcloud=self.webpackChunknextcloud||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})(),n.nc=void 0;var a=n.O(void 0,[4208],()=>n(43325));a=n.O(a)})();
|
|
//# sourceMappingURL=files_sharing-init-public.js.map?v=a3983feff9a0ec5a6fc1
|