Initial commit
This commit is contained in:
commit
78f8d225ee
21173 changed files with 2907774 additions and 0 deletions
1
.next/server/app/api/files/download-file/route.js
Normal file
1
.next/server/app/api/files/download-file/route.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
(()=>{var e={};e.id=4141,e.ids=[4141],e.modules={3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},39061:(e,t,r)=>{"use strict";r.r(t),r.d(t,{patchFetch:()=>w,routeModule:()=>f,serverHooks:()=>m,workAsyncStorage:()=>g,workUnitAsyncStorage:()=>h});var s={};r.r(s),r.d(s,{GET:()=>x});var n=r(96559),a=r(48088),o=r(37719),i=r(32190),p=r(76760),u=r.n(p),l=r(51455),d=r.n(l);let c="/app/files";async function x(e){try{let t=new URL(e.url).searchParams.get("path");if(!t)return i.NextResponse.json({error:"Missing path"},{status:400});let r=u().normalize("/"+t).replace(/^\/+/,"/"),s=u().resolve(c,"."+r);if(!s.startsWith(c))return i.NextResponse.json({error:"Invalid path"},{status:400});let n=await d().stat(s).catch(()=>null);if(!n||!n.isFile())return i.NextResponse.json({error:"Not a file"},{status:400});let a=await d().readFile(s),o=u().extname(s).toLowerCase(),p=".pdf"===o?"application/pdf":".png"===o?"image/png":".jpg"===o||".jpeg"===o?"image/jpeg":".webp"===o?"image/webp":".txt"===o?"text/plain; charset=utf-8":"application/octet-stream";return new Response(a,{headers:{"Content-Type":p,"Content-Length":String(a.byteLength),"Content-Disposition":`inline; filename="${u().basename(s)}"`,"Cache-Control":"no-store"}})}catch(e){return i.NextResponse.json({error:e?.message??"Unknown error"},{status:500})}}let f=new n.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/files/download-file/route",pathname:"/api/files/download-file",filename:"route",bundlePath:"app/api/files/download-file/route"},resolvedPagePath:"/app/app/api/files/download-file/route.ts",nextConfigOutput:"",userland:s}),{workAsyncStorage:g,workUnitAsyncStorage:h,serverHooks:m}=f;function w(){return(0,o.patchFetch)({workAsyncStorage:g,workUnitAsyncStorage:h})}},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:e=>{"use strict";e.exports=require("node:fs/promises")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},76760:e=>{"use strict";e.exports=require("node:path")},78335:()=>{},96487:()=>{}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[7719,580],()=>r(39061));module.exports=s})();
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
.next/server/app/api/files/download/route.js
Normal file
1
.next/server/app/api/files/download/route.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
(()=>{var e={};e.id=9662,e.ids=[9662],e.modules={7413:(e,t,r)=>{"use strict";r.r(t),r.d(t,{patchFetch:()=>g,routeModule:()=>m,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var s={};r.r(s),r.d(s,{GET:()=>h,dynamic:()=>l,revalidate:()=>c});var n=r(96559),o=r(48088),a=r(37719);let i=require("fs/promises");var p=r(29021),u=r(33873),d=r.n(u);let l="force-dynamic",c=0,f=process.env.FILES_ROOT||"/app/files";async function h(e){try{let{searchParams:t}=new URL(e.url),r=t.get("path");if(!r)return new Response(JSON.stringify({error:"Missing path"}),{status:400});let s=function(e,t){let r=d().normalize("/"+(t||"/")),s=d().resolve(e,"."+r);if(!s.startsWith(d().resolve(e)))throw Error("Invalid path");return s}(f,r),n=await (0,i.stat)(s);if(n.isDirectory())return new Response(JSON.stringify({error:"Is a directory"}),{status:400});let o=(0,p.createReadStream)(s),a=d().basename(s);return new Response(o,{headers:{"Content-Type":"application/octet-stream","Content-Length":String(n.size),"Content-Disposition":`attachment; filename*=UTF-8''${encodeURIComponent(a)}`,"Cache-Control":"no-store"}})}catch(t){let e=t?.message||"Not found";return new Response(JSON.stringify({error:e}),{status:"Invalid path"===e?400:404,headers:{"Cache-Control":"no-store"}})}}let m=new n.AppRouteRouteModule({definition:{kind:o.RouteKind.APP_ROUTE,page:"/api/files/download/route",pathname:"/api/files/download",filename:"route",bundlePath:"app/api/files/download/route"},resolvedPagePath:"/app/app/api/files/download/route.ts",nextConfigOutput:"",userland:s}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=m;function g(){return(0,a.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29021:e=>{"use strict";e.exports=require("fs")},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:e=>{"use strict";e.exports=require("path")},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},96487:()=>{},96559:(e,t,r)=>{"use strict";e.exports=r(44870)}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[7719],()=>r(7413));module.exports=s})();
|
||||
1
.next/server/app/api/files/download/route.js.nft.json
Normal file
1
.next/server/app/api/files/download/route.js.nft.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
.next/server/app/api/files/get/route.js
Normal file
1
.next/server/app/api/files/get/route.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
(()=>{var e={};e.id=7746,e.ids=[7746],e.modules={3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},50190:(e,t,r)=>{"use strict";r.r(t),r.d(t,{patchFetch:()=>w,routeModule:()=>f,serverHooks:()=>v,workAsyncStorage:()=>h,workUnitAsyncStorage:()=>j});var s={};r.r(s),r.d(s,{GET:()=>m,dynamic:()=>g,runtime:()=>l});var a=r(96559),i=r(48088),n=r(37719),o=r(32190),p=r(51455),u=r.n(p),c=r(76760),d=r.n(c);let l="nodejs",g="force-dynamic",x={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".svg":"image/svg+xml",".txt":"text/plain; charset=utf-8",".json":"application/json; charset=utf-8",".pdf":"application/pdf"};async function m(e){try{let t=new URL(e.url).searchParams.get("path");if(!t)return o.NextResponse.json({error:"Missing path"},{status:400});let r=function(e,t){let r=t.startsWith("/")?t:`/${t}`,s=d().resolve(e,"."+r);if(!s.startsWith(e))throw Error("Outside base");return s}("/app/files",t);if(!(await u().stat(r)).isFile())return o.NextResponse.json({error:"Not a file"},{status:400});let s=await u().readFile(r),a=x[d().extname(r).toLowerCase()]??"application/octet-stream";return new o.NextResponse(s,{status:200,headers:{"Content-Type":a,"Cache-Control":"public, max-age=300"}})}catch(e){return o.NextResponse.json({error:e?.message??"Unknown"},{status:400})}}let f=new a.AppRouteRouteModule({definition:{kind:i.RouteKind.APP_ROUTE,page:"/api/files/get/route",pathname:"/api/files/get",filename:"route",bundlePath:"app/api/files/get/route"},resolvedPagePath:"/app/app/api/files/get/route.ts",nextConfigOutput:"",userland:s}),{workAsyncStorage:h,workUnitAsyncStorage:j,serverHooks:v}=f;function w(){return(0,n.patchFetch)({workAsyncStorage:h,workUnitAsyncStorage:j})}},51455:e=>{"use strict";e.exports=require("node:fs/promises")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},76760:e=>{"use strict";e.exports=require("node:path")},78335:()=>{},96487:()=>{}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[7719,580],()=>r(50190));module.exports=s})();
|
||||
1
.next/server/app/api/files/get/route.js.nft.json
Normal file
1
.next/server/app/api/files/get/route.js.nft.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
.next/server/app/api/files/list-files/route.js
Normal file
1
.next/server/app/api/files/list-files/route.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
(()=>{var e={};e.id=1743,e.ids=[1743],e.modules={3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:e=>{"use strict";e.exports=require("node:fs/promises")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},76760:e=>{"use strict";e.exports=require("node:path")},78335:()=>{},80728:(e,t,r)=>{"use strict";r.r(t),r.d(t,{patchFetch:()=>w,routeModule:()=>m,serverHooks:()=>v,workAsyncStorage:()=>f,workUnitAsyncStorage:()=>h});var s={};r.r(s),r.d(s,{GET:()=>x});var i=r(96559),a=r(48088),n=r(37719),o=r(32190),p=r(76760),u=r.n(p),l=r(51455),c=r.n(l);let d="/app/files";async function x(e){try{let t=new URL(e.url).searchParams.get("path")??"/",r=u().normalize("/"+t).replace(/^\/+/,"/"),s=u().resolve(d,"."+r);if(!s.startsWith(d))return o.NextResponse.json({error:"Invalid path"},{status:400});let i=await c().stat(s).catch(()=>null);if(!i||!i.isDirectory())return o.NextResponse.json({error:"Not a directory"},{status:400});let a=await c().readdir(s,{withFileTypes:!0}),n=await Promise.all(a.map(async e=>{let t=u().join(s,e.name),i=u().posix.join(r,e.name).replaceAll("\\","/"),a=await c().stat(t);return{name:e.name,path:i,type:e.isDirectory()?"dir":"file",size:a.size,mtime:a.mtimeMs}}));return o.NextResponse.json({path:r,items:n})}catch(e){return o.NextResponse.json({error:e?.message??"Unknown error"},{status:500})}}let m=new i.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/files/list-files/route",pathname:"/api/files/list-files",filename:"route",bundlePath:"app/api/files/list-files/route"},resolvedPagePath:"/app/app/api/files/list-files/route.ts",nextConfigOutput:"",userland:s}),{workAsyncStorage:f,workUnitAsyncStorage:h,serverHooks:v}=m;function w(){return(0,n.patchFetch)({workAsyncStorage:f,workUnitAsyncStorage:h})}},96487:()=>{}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[7719,580],()=>r(80728));module.exports=s})();
|
||||
1
.next/server/app/api/files/list-files/route.js.nft.json
Normal file
1
.next/server/app/api/files/list-files/route.js.nft.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
.next/server/app/api/files/list/route.js
Normal file
1
.next/server/app/api/files/list/route.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
(()=>{var e={};e.id=6702,e.ids=[6702],e.modules={3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29021:e=>{"use strict";e.exports=require("fs")},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:e=>{"use strict";e.exports=require("path")},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},49313:(e,t,r)=>{"use strict";r.r(t),r.d(t,{patchFetch:()=>f,routeModule:()=>c,serverHooks:()=>h,workAsyncStorage:()=>m,workUnitAsyncStorage:()=>x});var s={};r.r(s),r.d(s,{GET:()=>d});var i=r(96559),a=r(48088),n=r(37719),o=r(32190),p=r(29021),u=r(33873);let l="/app/files";async function d(e){let{searchParams:t}=new URL(e.url),r=t.get("path")||"/",s=r.startsWith("/")?r:`/${r}`,i=(0,u.normalize)((0,u.join)(l,`.${s}`));if(!i.startsWith(l))return o.NextResponse.json({error:"Invalid path"},{status:400});try{let e=await p.promises.readdir(i,{withFileTypes:!0}),t=await Promise.all(e.map(async e=>{let t=(0,u.join)(i,e.name),r=await p.promises.stat(t);return{name:e.name,isDir:e.isDirectory(),size:r.size,mtime:r.mtimeMs}}));return o.NextResponse.json({path:s,items:t})}catch(e){return o.NextResponse.json({error:e?.message??String(e)},{status:404})}}let c=new i.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/files/list/route",pathname:"/api/files/list",filename:"route",bundlePath:"app/api/files/list/route"},resolvedPagePath:"/app/app/api/files/list/route.ts",nextConfigOutput:"",userland:s}),{workAsyncStorage:m,workUnitAsyncStorage:x,serverHooks:h}=c;function f(){return(0,n.patchFetch)({workAsyncStorage:m,workUnitAsyncStorage:x})}},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},96487:()=>{}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[7719,580],()=>r(49313));module.exports=s})();
|
||||
1
.next/server/app/api/files/list/route.js.nft.json
Normal file
1
.next/server/app/api/files/list/route.js.nft.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
.next/server/app/api/files/raw/route.js
Normal file
1
.next/server/app/api/files/raw/route.js
Normal file
File diff suppressed because one or more lines are too long
1
.next/server/app/api/files/raw/route.js.nft.json
Normal file
1
.next/server/app/api/files/raw/route.js.nft.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
.next/server/app/api/files/route.js
Normal file
1
.next/server/app/api/files/route.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
(()=>{var e={};e.id=635,e.ids=[635],e.modules={3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},30801:(e,t,r)=>{"use strict";r.r(t),r.d(t,{patchFetch:()=>v,routeModule:()=>m,serverHooks:()=>f,workAsyncStorage:()=>x,workUnitAsyncStorage:()=>h});var s={};r.r(s),r.d(s,{GET:()=>c});var i=r(96559),a=r(48088),n=r(37719),o=r(32190),p=r(51455),u=r.n(p),d=r(76760),l=r.n(d);async function c(e){try{let{searchParams:t}=new URL(e.url),r=t.get("path")||"/",s=function(e,t){let r=decodeURIComponent(t||"/"),s=l().posix.normalize("/"+r).replace(/^(\.\.(\/|\\|$))+/g,""),i=l().join(e,s);if(!i.startsWith(e))throw Error("Invalid path");return i}("/app/files",r),i=await u().readdir(s,{withFileTypes:!0}),a=await Promise.all(i.map(async e=>{let t=l().join(s,e.name),i=await u().stat(t),a=e.isDirectory();return{name:e.name,type:a?"dir":"file",size:a?null:i.size,mtime:i.mtime.toISOString(),path:l().posix.join(r.endsWith("/")?r:r+"/",e.name),url:a?null:`/api/files/raw?path=${encodeURIComponent(l().posix.join(r,e.name))}`}}));return a.sort((e,t)=>e.type!==t.type?"dir"===e.type?-1:1:e.name.localeCompare(t.name,void 0,{sensitivity:"base"})),o.NextResponse.json({ok:!0,path:r,items:a})}catch(e){return o.NextResponse.json({ok:!1,error:e?.message||"Error"},{status:400})}}let m=new i.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/files/route",pathname:"/api/files",filename:"route",bundlePath:"app/api/files/route"},resolvedPagePath:"/app/app/api/files/route.ts",nextConfigOutput:"",userland:s}),{workAsyncStorage:x,workUnitAsyncStorage:h,serverHooks:f}=m;function v(){return(0,n.patchFetch)({workAsyncStorage:x,workUnitAsyncStorage:h})}},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:e=>{"use strict";e.exports=require("node:fs/promises")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},76760:e=>{"use strict";e.exports=require("node:path")},78335:()=>{},96487:()=>{}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[7719,580],()=>r(30801));module.exports=s})();
|
||||
1
.next/server/app/api/files/route.js.nft.json
Normal file
1
.next/server/app/api/files/route.js.nft.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue