r2-explorer 1.1.10 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dashboard/assets/{AuthLayout.44d95d02.js → AuthLayout.0d7701f7.js} +1 -1
- package/dashboard/assets/EmailFilePage.12cbd72f.js +2 -0
- package/dashboard/assets/ErrorNotFound.edf4fcea.js +1 -0
- package/dashboard/{spa/assets/LoginPage.ca226917.js → assets/LoginPage.55d653ae.js} +1 -1
- package/dashboard/assets/{auth-store.c1556190.js → auth-store.a55ef8b1.js} +1 -1
- package/dashboard/assets/{auth.e242b7eb.js → auth.7340ecd2.js} +1 -1
- package/dashboard/assets/{bus.4a606b2f.js → bus.88084376.js} +1 -1
- package/dashboard/assets/{index.a1f775a6.css → index.4aacbd79.css} +1 -1
- package/dashboard/assets/{index.706c4d3e.js → index.a267d362.js} +28 -28
- package/dashboard/index.html +2 -2
- package/dashboard/spa/assets/{AuthLayout.44d95d02.js → AuthLayout.0d7701f7.js} +1 -1
- package/dashboard/spa/assets/EmailFilePage.12cbd72f.js +2 -0
- package/dashboard/spa/assets/ErrorNotFound.edf4fcea.js +1 -0
- package/dashboard/{assets/LoginPage.ca226917.js → spa/assets/LoginPage.55d653ae.js} +1 -1
- package/dashboard/spa/assets/{auth-store.c1556190.js → auth-store.a55ef8b1.js} +1 -1
- package/dashboard/spa/assets/{auth.e242b7eb.js → auth.7340ecd2.js} +1 -1
- package/dashboard/spa/assets/{bus.4a606b2f.js → bus.88084376.js} +1 -1
- package/dashboard/spa/assets/{index.a1f775a6.css → index.4aacbd79.css} +1 -1
- package/dashboard/spa/assets/{index.706c4d3e.js → index.a267d362.js} +28 -28
- package/dashboard/spa/index.html +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +792 -454
- package/dist/index.mjs +782 -444
- package/package.json +15 -15
- package/dashboard/assets/EmailFilePage.ccbeefd3.js +0 -2
- package/dashboard/assets/ErrorNotFound.19a254c5.js +0 -1
- package/dashboard/spa/assets/EmailFilePage.ccbeefd3.js +0 -2
- package/dashboard/spa/assets/ErrorNotFound.19a254c5.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "r2-explorer",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"description": "A Google Drive Interface for your Cloudflare R2 Buckets",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "tsup src/index.ts --format cjs,esm --dts && cp -R ../dashboard/dist/spa/ dashboard/ && cp ../../README.md . && cp ../../LICENSE .",
|
|
16
16
|
"lint": "npx @biomejs/biome check src/ tests/ || (npx @biomejs/biome check --write src/ tests/; exit 1)",
|
|
17
|
-
"test": "npx vitest run --config tests/vitest.config.mts",
|
|
17
|
+
"test": "tsc && npx vitest run --config tests/vitest.config.mts",
|
|
18
18
|
"package": "npm run build && npm pack",
|
|
19
19
|
"publish-npm": "npm publish"
|
|
20
20
|
},
|
|
@@ -52,20 +52,20 @@
|
|
|
52
52
|
"url": "https://github.com/G4brym/R2-Explorer/issues"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@cloudflare/vitest-pool-workers": "^0.
|
|
56
|
-
"@cloudflare/workers-types": "^4.
|
|
57
|
-
"@types/node": "^
|
|
58
|
-
"@vitest/coverage-istanbul": "^3.2.
|
|
59
|
-
"hono": "^4.
|
|
60
|
-
"tsup": "^8.
|
|
61
|
-
"typescript": "^5.
|
|
62
|
-
"vitest": "^3.2.
|
|
63
|
-
"wrangler": "^
|
|
55
|
+
"@cloudflare/vitest-pool-workers": "^0.10.11",
|
|
56
|
+
"@cloudflare/workers-types": "^4.20251128.0",
|
|
57
|
+
"@types/node": "^24.10.1",
|
|
58
|
+
"@vitest/coverage-istanbul": "^3.2.4",
|
|
59
|
+
"hono": "^4.10.7",
|
|
60
|
+
"tsup": "^8.5.1",
|
|
61
|
+
"typescript": "^5.9.3",
|
|
62
|
+
"vitest": "^3.2.4",
|
|
63
|
+
"wrangler": "^4.51.0"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@hono/cloudflare-access": "^0.
|
|
67
|
-
"chanfana": "^2.
|
|
68
|
-
"postal-mime": "^2.
|
|
69
|
-
"zod": "^3.
|
|
66
|
+
"@hono/cloudflare-access": "^0.3.1",
|
|
67
|
+
"chanfana": "^2.8.3",
|
|
68
|
+
"postal-mime": "^2.6.1",
|
|
69
|
+
"zod": "^3.25.76"
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{h as te,G as _e,H as Se,I as q,J as W,K as Te,L as $e,M as Pe,N as x,k as _,O as N,P as Be,R as Ce,S as qe,T as He,U as Ee,V as Me,W as Ae,X as z,Y as D,Z as U,$ as V,a0 as Fe,a1 as j,a2 as R,a3 as Oe,l as M,a4 as Ie,n as Le,a5 as Qe,m as ae,a6 as We,_ as xe,c as Ne,a7 as G,a8 as J,a9 as ze,aa as w,u as De,ab as Ue,o as u,ac as p,f as s,w as o,F as K,ad as Ve,x as $,E as P,z as b,ae as X,e as H,B as Y,y as d,A as v,t as Z,af as ee,ag as je,ah as Re}from"./index.706c4d3e.js";var E=te({name:"QTooltip",inheritAttrs:!1,props:{..._e,...Se,...q,maxHeight:{type:String,default:null},maxWidth:{type:String,default:null},transitionShow:{...q.transitionShow,default:"jump-down"},transitionHide:{...q.transitionHide,default:"jump-up"},anchor:{type:String,default:"bottom middle",validator:W},self:{type:String,default:"top middle",validator:W},offset:{type:Array,default:()=>[14,14],validator:Te},scrollTarget:$e,delay:{type:Number,default:0},hideDelay:{type:Number,default:0},persistent:Boolean},emits:[...Pe],setup(e,{slots:t,emit:m,attrs:l}){let a,n;const r=Le(),{proxy:{$q:c}}=r,g=x(null),S=x(!1),se=_(()=>N(e.anchor,c.lang.rtl)),le=_(()=>N(e.self,c.lang.rtl)),ne=_(()=>e.persistent!==!0),{registerTick:oe,removeTick:ie}=Be(),{registerTimeout:T}=Ce(),{transitionProps:re,transitionStyle:de}=qe(e),{localScrollTarget:A,changeScrollEvent:ce,unconfigureScrollTarget:ue}=He(e,L),{anchorEl:f,canShow:fe,anchorEvents:k}=Ee({showing:S,configureAnchorEl:ye}),{show:me,hide:B}=Me({showing:S,canShow:fe,handleShow:pe,handleHide:ve,hideOnRouteChange:ne,processOnMount:!0});Object.assign(k,{delayShow:ge,delayHide:ke});const{showPortal:F,hidePortal:O,renderPortal:he}=Ae(r,g,be,"tooltip");if(c.platform.is.mobile===!0){const i={anchorEl:f,innerRef:g,onClickOutside(h){return B(h),h.target.classList.contains("q-dialog__backdrop")&&We(h),!0}},C=_(()=>e.modelValue===null&&e.persistent!==!0&&S.value===!0);z(C,h=>{(h===!0?Qe:U)(i)}),D(()=>{U(i)})}function pe(i){F(),oe(()=>{n=new MutationObserver(()=>y()),n.observe(g.value,{attributes:!1,childList:!0,characterData:!0,subtree:!0}),y(),L()}),a===void 0&&(a=z(()=>c.screen.width+"|"+c.screen.height+"|"+e.self+"|"+e.anchor+"|"+c.lang.rtl,y)),T(()=>{F(!0),m("show",i)},e.transitionDuration)}function ve(i){ie(),O(),I(),T(()=>{O(!0),m("hide",i)},e.transitionDuration)}function I(){n!==void 0&&(n.disconnect(),n=void 0),a!==void 0&&(a(),a=void 0),ue(),V(k,"tooltipTemp")}function y(){Fe({targetEl:g.value,offset:e.offset,anchorEl:f.value,anchorOrigin:se.value,selfOrigin:le.value,maxHeight:e.maxHeight,maxWidth:e.maxWidth})}function ge(i){if(c.platform.is.mobile===!0){j(),document.body.classList.add("non-selectable");const C=f.value,h=["touchmove","touchcancel","touchend","click"].map(Q=>[C,Q,"delayHide","passiveCapture"]);R(k,"tooltipTemp",h)}T(()=>{me(i)},e.delay)}function ke(i){c.platform.is.mobile===!0&&(V(k,"tooltipTemp"),j(),setTimeout(()=>{document.body.classList.remove("non-selectable")},10)),T(()=>{B(i)},e.hideDelay)}function ye(){if(e.noParentEvent===!0||f.value===null)return;const i=c.platform.is.mobile===!0?[[f.value,"touchstart","delayShow","passive"]]:[[f.value,"mouseenter","delayShow","passive"],[f.value,"mouseleave","delayHide","passive"]];R(k,"anchor",i)}function L(){if(f.value!==null||e.scrollTarget!==void 0){A.value=Oe(f.value,e.scrollTarget);const i=e.noParentEvent===!0?y:B;ce(A.value,i)}}function we(){return S.value===!0?M("div",{...l,ref:g,class:["q-tooltip q-tooltip--style q-position-engine no-pointer-events",l.class],style:[l.style,de.value],role:"tooltip"},ae(t.default)):null}function be(){return M(Ie,re.value,we)}return D(I),Object.assign(r.proxy,{updatePosition:y}),he}}),Ge=te({name:"QBtnGroup",props:{unelevated:Boolean,outline:Boolean,flat:Boolean,rounded:Boolean,square:Boolean,push:Boolean,stretch:Boolean,glossy:Boolean,spread:Boolean},setup(e,{slots:t}){const m=_(()=>{const l=["unelevated","outline","flat","rounded","square","push","stretch","glossy"].filter(a=>e[a]===!0).map(a=>`q-btn-group--${a}`).join(" ");return`q-btn-group row no-wrap${l.length!==0?" "+l:""}`+(e.spread===!0?" q-btn-group--spread":" inline")});return()=>M("div",{class:m.value},ae(t.default))}});const Je=Ne({name:"EmailFolderPage",data:()=>({srcdoc:null,file:null,fileHead:null,timeInterval:null,attachments:[]}),computed:{selectedBucket:function(){return this.$route.params.bucket},selectedFolder:function(){return this.$route.params.folder},selectedFile:function(){return this.$route.params.file},filePath:function(){const e=G(this.selectedFile);return`.r2-explorer/emails/${this.selectedFolder}/${e}`}},watch:{selectedBucket(e){this.$router.push({name:"email-folder",params:{bucket:e,folder:J(this.selectedFolder)}})}},methods:{timeSince:ze,contentFinishedLoading(){clearInterval(this.timeInterval),this.timeInterval=null,this.resizeIframe()},resizeIframe(){this.$refs.renderWindow&&(this.$refs.renderWindow.style.height=`${this.$refs.renderWindow.contentWindow.document.documentElement.scrollHeight}px`)},fetchEmail:async function(){const e=G(this.selectedFile),t=await w.downloadFile(this.selectedBucket,this.filePath,{}),m=e.split(".json")[0];this.file=t.data;let l=t.data.html;if(l){l=l.replaceAll(/<a(.*?)>(.*?)<\/a>/gi,'<a$1 target="_blank">$2</a>');for(const a of t.data.attachments){a.display=!0,a.downloadUrl=`${this.mainStore.serverUrl}/api/buckets/${this.selectedBucket}/${J(`.r2-explorer/emails/${this.selectedFolder}/${m}/${a.filename}`)}`;let n=a.contentId;if(n){n.startsWith("<")&&n.endsWith(">")&&(n=n.substring(1,n.length-1));const r=`cid:${n}`;l.includes(r)&&(l=l.replaceAll(`cid:${n}`,a.downloadUrl),a.display=!1)}}this.srcdoc=l}this.attachments=t.data.attachments.filter(a=>a.display),w.headFile(this.selectedBucket,this.filePath).then(async a=>{a.customMetadata.read==="false"?this.fileHead=await w.updateMetadata(this.selectedBucket,this.filePath,{...a.customMetadata,read:!0}):this.fileHead=a}),setTimeout(()=>{this.contentFinishedLoading()},1e4),this.timeInterval=setInterval(()=>{this.resizeIframe()},400)},markAsUnread:async function(){this.fileHead=await w.updateMetadata(this.selectedBucket,this.filePath,{...this.fileHead.customMetadata,read:!1}),this.q.notify({group:!1,icon:"done",spinner:!1,message:"Email marked as unread!",timeout:2500})},markAsRead:async function(){this.fileHead=await w.updateMetadata(this.selectedBucket,this.filePath,{...this.fileHead.customMetadata,read:!0}),this.q.notify({group:!1,icon:"done",spinner:!1,message:"Email marked as read!",timeout:2500})},downloadAtt:e=>{console.log(e);const t=document.createElement("a");t.download=e.filename,t.href=e.downloadUrl,document.body.appendChild(t),t.click(),document.body.removeChild(t)}},created(){this.fetchEmail()},setup(){return{mainStore:De(),q:Ue()}}}),Ke={key:0},Xe={class:"font-18 q-my-none"},Ye={class:"d-flex row"},Ze={class:"d-flex column"},et={class:"text-muted"},tt={class:"q-ml-auto"},at={class:""},st={class:"overflow-auto d-block email-wrapper"},lt=["srcdoc"],nt=["innerHTML"],ot={class:"row attachments"},it={key:1,class:"text-center q-my-lg"};function rt(e,t,m,l,a,n){return this.file?(u(),p("div",Ke,[s(K,null,{default:o(()=>[s($,{class:"bg-grey-2 text-black",vertical:""},{default:o(()=>[s(Ge,{unelevated:""},{default:o(()=>[s(P,{push:"",icon:"arrow_back",to:{name:"email-folder",params:{bucket:e.$route.params.bucket,folder:e.$route.params.folder}}},{default:o(()=>[s(E,null,{default:o(()=>t[1]||(t[1]=[b("Back")])),_:1})]),_:1},8,["to"]),e.fileHead?(u(),p(X,{key:0},[e.fileHead.customMetadata.read==="true"?(u(),H(P,{key:0,push:"",icon:"mark_email_unread",onClick:e.markAsUnread},{default:o(()=>[s(E,null,{default:o(()=>t[2]||(t[2]=[b("Mark email as unread")])),_:1})]),_:1},8,["onClick"])):(u(),H(P,{key:1,push:"",icon:"mark_email_read",onClick:e.markAsRead},{default:o(()=>[s(E,null,{default:o(()=>t[3]||(t[3]=[b("Mark email as read")])),_:1})]),_:1},8,["onClick"]))],64)):Y("",!0)]),_:1})]),_:1}),s($,{vertical:""},{default:o(()=>[d("h5",Xe,v(e.file.subject),1)]),_:1}),s($,{horizontal:"",class:"q-px-sm"},{default:o(()=>[d("div",Ye,[s(Z,{name:"account_circle",size:"xl",class:"q-mr-sm"}),d("div",Ze,[d("span",null,[b(v(e.file.from.name)+" ",1),d("small",et,"<"+v(e.file.from.address)+">",1)]),d("span",null,"to "+v(e.file.to[0].address),1)])]),d("div",tt,[d("small",at,v(e.file.date)+" ("+v(e.timeSince(new Date(e.file.date)))+")",1)])]),_:1}),s(ee,{vertical:""},{default:o(()=>[d("div",st,[e.srcdoc?(u(),p("iframe",{key:0,frameborder:"0",scrolling:"no",class:"w-100 d-block",onLoad:t[0]||(t[0]=(...r)=>e.contentFinishedLoading&&e.contentFinishedLoading(...r)),ref:"renderWindow",id:"renderWindow",srcdoc:e.srcdoc,sandbox:"allow-popups allow-popups-to-escape-sandbox allow-same-origin",csp:"script-src 'none'"},null,40,lt)):(u(),p("div",{key:1,innerHTML:e.file.text.replaceAll(`
|
|
2
|
-
`,"<br>")},null,8,nt))])]),_:1}),e.attachments.length>0?(u(),H(ee,{key:0,vertical:""},{default:o(()=>[s(je),t[4]||(t[4]=d("h6",{class:"q-my-md"},"Attachments",-1)),d("div",ot,[(u(!0),p(X,null,Re(e.file.attachments,r=>(u(),p("div",{class:"col-md-4 col-sm-12",key:r.filename},[s(K,null,{default:o(()=>[s($,{class:"q-pa-sm flex",style:{"align-items":"center"}},{default:o(()=>[s(Z,{name:"description",size:"md",color:"blue",class:"q-mr-sm"}),b(" "+v(r.filename)+" ",1),s(P,{color:"white","text-color":"black",icon:"download",class:"q-mr-0 q-ml-auto",onClick:c=>e.downloadAtt(r)},null,8,["onClick"])]),_:2},1024)]),_:2},1024)]))),128))])]),_:1})):Y("",!0)]),_:1})])):(u(),p("div",it,[s(Ve,{color:"primary",size:"3em"})]))}var ct=xe(Je,[["render",rt],["__scopeId","data-v-59368c26"]]);export{ct as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as o,c as s,o as r,ac as n,y as t,f as a,E as l}from"./index.706c4d3e.js";const c=s({name:"ErrorNotFound"}),d={class:"fullscreen bg-blue text-white text-center q-pa-md flex flex-center"};function i(p,e,f,u,x,m){return r(),n("div",d,[t("div",null,[e[0]||(e[0]=t("div",{style:{"font-size":"30vh"}}," 404 ",-1)),e[1]||(e[1]=t("div",{class:"text-h2",style:{opacity:".4"}}," Oops. Nothing here... ",-1)),a(l,{class:"q-mt-xl",color:"white","text-color":"blue",unelevated:"",to:"/",label:"Go Home","no-caps":""})])])}var _=o(c,[["render",i]]);export{_ as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{h as te,G as _e,H as Se,I as q,J as W,K as Te,L as $e,M as Pe,N as x,k as _,O as N,P as Be,R as Ce,S as qe,T as He,U as Ee,V as Me,W as Ae,X as z,Y as D,Z as U,$ as V,a0 as Fe,a1 as j,a2 as R,a3 as Oe,l as M,a4 as Ie,n as Le,a5 as Qe,m as ae,a6 as We,_ as xe,c as Ne,a7 as G,a8 as J,a9 as ze,aa as w,u as De,ab as Ue,o as u,ac as p,f as s,w as o,F as K,ad as Ve,x as $,E as P,z as b,ae as X,e as H,B as Y,y as d,A as v,t as Z,af as ee,ag as je,ah as Re}from"./index.706c4d3e.js";var E=te({name:"QTooltip",inheritAttrs:!1,props:{..._e,...Se,...q,maxHeight:{type:String,default:null},maxWidth:{type:String,default:null},transitionShow:{...q.transitionShow,default:"jump-down"},transitionHide:{...q.transitionHide,default:"jump-up"},anchor:{type:String,default:"bottom middle",validator:W},self:{type:String,default:"top middle",validator:W},offset:{type:Array,default:()=>[14,14],validator:Te},scrollTarget:$e,delay:{type:Number,default:0},hideDelay:{type:Number,default:0},persistent:Boolean},emits:[...Pe],setup(e,{slots:t,emit:m,attrs:l}){let a,n;const r=Le(),{proxy:{$q:c}}=r,g=x(null),S=x(!1),se=_(()=>N(e.anchor,c.lang.rtl)),le=_(()=>N(e.self,c.lang.rtl)),ne=_(()=>e.persistent!==!0),{registerTick:oe,removeTick:ie}=Be(),{registerTimeout:T}=Ce(),{transitionProps:re,transitionStyle:de}=qe(e),{localScrollTarget:A,changeScrollEvent:ce,unconfigureScrollTarget:ue}=He(e,L),{anchorEl:f,canShow:fe,anchorEvents:k}=Ee({showing:S,configureAnchorEl:ye}),{show:me,hide:B}=Me({showing:S,canShow:fe,handleShow:pe,handleHide:ve,hideOnRouteChange:ne,processOnMount:!0});Object.assign(k,{delayShow:ge,delayHide:ke});const{showPortal:F,hidePortal:O,renderPortal:he}=Ae(r,g,be,"tooltip");if(c.platform.is.mobile===!0){const i={anchorEl:f,innerRef:g,onClickOutside(h){return B(h),h.target.classList.contains("q-dialog__backdrop")&&We(h),!0}},C=_(()=>e.modelValue===null&&e.persistent!==!0&&S.value===!0);z(C,h=>{(h===!0?Qe:U)(i)}),D(()=>{U(i)})}function pe(i){F(),oe(()=>{n=new MutationObserver(()=>y()),n.observe(g.value,{attributes:!1,childList:!0,characterData:!0,subtree:!0}),y(),L()}),a===void 0&&(a=z(()=>c.screen.width+"|"+c.screen.height+"|"+e.self+"|"+e.anchor+"|"+c.lang.rtl,y)),T(()=>{F(!0),m("show",i)},e.transitionDuration)}function ve(i){ie(),O(),I(),T(()=>{O(!0),m("hide",i)},e.transitionDuration)}function I(){n!==void 0&&(n.disconnect(),n=void 0),a!==void 0&&(a(),a=void 0),ue(),V(k,"tooltipTemp")}function y(){Fe({targetEl:g.value,offset:e.offset,anchorEl:f.value,anchorOrigin:se.value,selfOrigin:le.value,maxHeight:e.maxHeight,maxWidth:e.maxWidth})}function ge(i){if(c.platform.is.mobile===!0){j(),document.body.classList.add("non-selectable");const C=f.value,h=["touchmove","touchcancel","touchend","click"].map(Q=>[C,Q,"delayHide","passiveCapture"]);R(k,"tooltipTemp",h)}T(()=>{me(i)},e.delay)}function ke(i){c.platform.is.mobile===!0&&(V(k,"tooltipTemp"),j(),setTimeout(()=>{document.body.classList.remove("non-selectable")},10)),T(()=>{B(i)},e.hideDelay)}function ye(){if(e.noParentEvent===!0||f.value===null)return;const i=c.platform.is.mobile===!0?[[f.value,"touchstart","delayShow","passive"]]:[[f.value,"mouseenter","delayShow","passive"],[f.value,"mouseleave","delayHide","passive"]];R(k,"anchor",i)}function L(){if(f.value!==null||e.scrollTarget!==void 0){A.value=Oe(f.value,e.scrollTarget);const i=e.noParentEvent===!0?y:B;ce(A.value,i)}}function we(){return S.value===!0?M("div",{...l,ref:g,class:["q-tooltip q-tooltip--style q-position-engine no-pointer-events",l.class],style:[l.style,de.value],role:"tooltip"},ae(t.default)):null}function be(){return M(Ie,re.value,we)}return D(I),Object.assign(r.proxy,{updatePosition:y}),he}}),Ge=te({name:"QBtnGroup",props:{unelevated:Boolean,outline:Boolean,flat:Boolean,rounded:Boolean,square:Boolean,push:Boolean,stretch:Boolean,glossy:Boolean,spread:Boolean},setup(e,{slots:t}){const m=_(()=>{const l=["unelevated","outline","flat","rounded","square","push","stretch","glossy"].filter(a=>e[a]===!0).map(a=>`q-btn-group--${a}`).join(" ");return`q-btn-group row no-wrap${l.length!==0?" "+l:""}`+(e.spread===!0?" q-btn-group--spread":" inline")});return()=>M("div",{class:m.value},ae(t.default))}});const Je=Ne({name:"EmailFolderPage",data:()=>({srcdoc:null,file:null,fileHead:null,timeInterval:null,attachments:[]}),computed:{selectedBucket:function(){return this.$route.params.bucket},selectedFolder:function(){return this.$route.params.folder},selectedFile:function(){return this.$route.params.file},filePath:function(){const e=G(this.selectedFile);return`.r2-explorer/emails/${this.selectedFolder}/${e}`}},watch:{selectedBucket(e){this.$router.push({name:"email-folder",params:{bucket:e,folder:J(this.selectedFolder)}})}},methods:{timeSince:ze,contentFinishedLoading(){clearInterval(this.timeInterval),this.timeInterval=null,this.resizeIframe()},resizeIframe(){this.$refs.renderWindow&&(this.$refs.renderWindow.style.height=`${this.$refs.renderWindow.contentWindow.document.documentElement.scrollHeight}px`)},fetchEmail:async function(){const e=G(this.selectedFile),t=await w.downloadFile(this.selectedBucket,this.filePath,{}),m=e.split(".json")[0];this.file=t.data;let l=t.data.html;if(l){l=l.replaceAll(/<a(.*?)>(.*?)<\/a>/gi,'<a$1 target="_blank">$2</a>');for(const a of t.data.attachments){a.display=!0,a.downloadUrl=`${this.mainStore.serverUrl}/api/buckets/${this.selectedBucket}/${J(`.r2-explorer/emails/${this.selectedFolder}/${m}/${a.filename}`)}`;let n=a.contentId;if(n){n.startsWith("<")&&n.endsWith(">")&&(n=n.substring(1,n.length-1));const r=`cid:${n}`;l.includes(r)&&(l=l.replaceAll(`cid:${n}`,a.downloadUrl),a.display=!1)}}this.srcdoc=l}this.attachments=t.data.attachments.filter(a=>a.display),w.headFile(this.selectedBucket,this.filePath).then(async a=>{a.customMetadata.read==="false"?this.fileHead=await w.updateMetadata(this.selectedBucket,this.filePath,{...a.customMetadata,read:!0}):this.fileHead=a}),setTimeout(()=>{this.contentFinishedLoading()},1e4),this.timeInterval=setInterval(()=>{this.resizeIframe()},400)},markAsUnread:async function(){this.fileHead=await w.updateMetadata(this.selectedBucket,this.filePath,{...this.fileHead.customMetadata,read:!1}),this.q.notify({group:!1,icon:"done",spinner:!1,message:"Email marked as unread!",timeout:2500})},markAsRead:async function(){this.fileHead=await w.updateMetadata(this.selectedBucket,this.filePath,{...this.fileHead.customMetadata,read:!0}),this.q.notify({group:!1,icon:"done",spinner:!1,message:"Email marked as read!",timeout:2500})},downloadAtt:e=>{console.log(e);const t=document.createElement("a");t.download=e.filename,t.href=e.downloadUrl,document.body.appendChild(t),t.click(),document.body.removeChild(t)}},created(){this.fetchEmail()},setup(){return{mainStore:De(),q:Ue()}}}),Ke={key:0},Xe={class:"font-18 q-my-none"},Ye={class:"d-flex row"},Ze={class:"d-flex column"},et={class:"text-muted"},tt={class:"q-ml-auto"},at={class:""},st={class:"overflow-auto d-block email-wrapper"},lt=["srcdoc"],nt=["innerHTML"],ot={class:"row attachments"},it={key:1,class:"text-center q-my-lg"};function rt(e,t,m,l,a,n){return this.file?(u(),p("div",Ke,[s(K,null,{default:o(()=>[s($,{class:"bg-grey-2 text-black",vertical:""},{default:o(()=>[s(Ge,{unelevated:""},{default:o(()=>[s(P,{push:"",icon:"arrow_back",to:{name:"email-folder",params:{bucket:e.$route.params.bucket,folder:e.$route.params.folder}}},{default:o(()=>[s(E,null,{default:o(()=>t[1]||(t[1]=[b("Back")])),_:1})]),_:1},8,["to"]),e.fileHead?(u(),p(X,{key:0},[e.fileHead.customMetadata.read==="true"?(u(),H(P,{key:0,push:"",icon:"mark_email_unread",onClick:e.markAsUnread},{default:o(()=>[s(E,null,{default:o(()=>t[2]||(t[2]=[b("Mark email as unread")])),_:1})]),_:1},8,["onClick"])):(u(),H(P,{key:1,push:"",icon:"mark_email_read",onClick:e.markAsRead},{default:o(()=>[s(E,null,{default:o(()=>t[3]||(t[3]=[b("Mark email as read")])),_:1})]),_:1},8,["onClick"]))],64)):Y("",!0)]),_:1})]),_:1}),s($,{vertical:""},{default:o(()=>[d("h5",Xe,v(e.file.subject),1)]),_:1}),s($,{horizontal:"",class:"q-px-sm"},{default:o(()=>[d("div",Ye,[s(Z,{name:"account_circle",size:"xl",class:"q-mr-sm"}),d("div",Ze,[d("span",null,[b(v(e.file.from.name)+" ",1),d("small",et,"<"+v(e.file.from.address)+">",1)]),d("span",null,"to "+v(e.file.to[0].address),1)])]),d("div",tt,[d("small",at,v(e.file.date)+" ("+v(e.timeSince(new Date(e.file.date)))+")",1)])]),_:1}),s(ee,{vertical:""},{default:o(()=>[d("div",st,[e.srcdoc?(u(),p("iframe",{key:0,frameborder:"0",scrolling:"no",class:"w-100 d-block",onLoad:t[0]||(t[0]=(...r)=>e.contentFinishedLoading&&e.contentFinishedLoading(...r)),ref:"renderWindow",id:"renderWindow",srcdoc:e.srcdoc,sandbox:"allow-popups allow-popups-to-escape-sandbox allow-same-origin",csp:"script-src 'none'"},null,40,lt)):(u(),p("div",{key:1,innerHTML:e.file.text.replaceAll(`
|
|
2
|
-
`,"<br>")},null,8,nt))])]),_:1}),e.attachments.length>0?(u(),H(ee,{key:0,vertical:""},{default:o(()=>[s(je),t[4]||(t[4]=d("h6",{class:"q-my-md"},"Attachments",-1)),d("div",ot,[(u(!0),p(X,null,Re(e.file.attachments,r=>(u(),p("div",{class:"col-md-4 col-sm-12",key:r.filename},[s(K,null,{default:o(()=>[s($,{class:"q-pa-sm flex",style:{"align-items":"center"}},{default:o(()=>[s(Z,{name:"description",size:"md",color:"blue",class:"q-mr-sm"}),b(" "+v(r.filename)+" ",1),s(P,{color:"white","text-color":"black",icon:"download",class:"q-mr-0 q-ml-auto",onClick:c=>e.downloadAtt(r)},null,8,["onClick"])]),_:2},1024)]),_:2},1024)]))),128))])]),_:1})):Y("",!0)]),_:1})])):(u(),p("div",it,[s(Ve,{color:"primary",size:"3em"})]))}var ct=xe(Je,[["render",rt],["__scopeId","data-v-59368c26"]]);export{ct as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as o,c as s,o as r,ac as n,y as t,f as a,E as l}from"./index.706c4d3e.js";const c=s({name:"ErrorNotFound"}),d={class:"fullscreen bg-blue text-white text-center q-pa-md flex flex-center"};function i(p,e,f,u,x,m){return r(),n("div",d,[t("div",null,[e[0]||(e[0]=t("div",{style:{"font-size":"30vh"}}," 404 ",-1)),e[1]||(e[1]=t("div",{class:"text-h2",style:{opacity:".4"}}," Oops. Nothing here... ",-1)),a(l,{class:"q-mt-xl",color:"white","text-color":"blue",unelevated:"",to:"/",label:"Go Home","no-caps":""})])])}var _=o(c,[["render",i]]);export{_ as default};
|