Quantumbraid's picture
download
raw
10.4 kB
(()=>{var a={};a.id=271,a.ids=[271],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},6452:(a,b,c)=>{"use strict";c.d(b,{Os:()=>j,_1:()=>f,b4:()=>h,eA:()=>g,iP:()=>i});var d=c(33873),e=c.n(d);let f=e().resolve("@","..",".."),g=e().join(f,"output"),h=e().join(f,"datasets"),i=e().join(f,"data"),j=e().join(f,"models")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},26529:(a,b,c)=>{"use strict";c.d(b,{D:()=>d});let d=a=>void 0===a?"":(Array.isArray(a)?a:[a]).join("/")},27910:a=>{"use strict";a.exports=require("stream")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},82344:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(96330);let e=globalThis.prisma??new d.PrismaClient},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86542:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>I,patchFetch:()=>H,routeModule:()=>D,serverHooks:()=>G,workAsyncStorage:()=>E,workUnitAsyncStorage:()=>F});var d={};c.r(d),c.d(d,{GET:()=>C});var e=c(95736),f=c(9117),g=c(4044),h=c(39326),i=c(32324),j=c(261),k=c(54290),l=c(85328),m=c(38928),n=c(46595),o=c(3421),p=c(17679),q=c(41681),r=c(63446),s=c(86439),t=c(51356),u=c(10641),v=c(29021),w=c.n(v),x=c(33873),y=c.n(x),z=c(27910),A=c(94345),B=c(26529);async function C(a,{params:b}){let{filePath:c}=await b;try{let b,d=(0,B.D)(c),e=await (0,A.EU)(),f=await (0,A.VI)(),g=[e,f],h=y().resolve(d);if(!g.some(a=>h===a||h.startsWith(a+y().sep)))return console.warn(`Access denied: ${h} not in ${g.join(", ")}`),new u.NextResponse("Access denied",{status:403});try{b=await w().promises.stat(h)}catch{return console.warn(`File not found: ${h}`),new u.NextResponse("File not found",{status:404})}if(!b.isFile())return new u.NextResponse("Not a file",{status:400});let i=y().basename(h),j=y().extname(h).toLowerCase(),k=a.headers.get("range"),l={"Content-Type":{".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".svg":"image/svg+xml",".bmp":"image/bmp",".safetensors":"application/octet-stream",".zip":"application/zip",".mp4":"video/mp4",".avi":"video/x-msvideo",".mov":"video/quicktime",".mkv":"video/x-matroska",".wmv":"video/x-ms-wmv",".m4v":"video/x-m4v",".flv":"video/x-flv",".mp3":"audio/mpeg",".wav":"audio/wav",".flac":"audio/flac",".ogg":"audio/ogg"}[j]||"application/octet-stream","Accept-Ranges":"bytes","Cache-Control":"public, max-age=86400","Content-Disposition":`attachment; filename="${encodeURIComponent(i)}"`,"X-Content-Type-Options":"nosniff"};if(k){let a=k.replace(/bytes=/,"").split("-"),c=parseInt(a[0],10),d=a[1]?parseInt(a[1],10):b.size-1;if(isNaN(c)||isNaN(d)||c>d||c>=b.size)return new u.NextResponse("Range Not Satisfiable",{status:416,headers:{"Content-Range":`bytes */${b.size}`}});let e=d-c+1,f=w().createReadStream(h,{start:c,end:d,highWaterMark:4194304});return new u.NextResponse(z.Readable.toWeb(f),{status:206,headers:{...l,"Content-Range":`bytes ${c}-${d}/${b.size}`,"Content-Length":String(e)}})}{let a=w().createReadStream(h,{highWaterMark:4194304});return new u.NextResponse(z.Readable.toWeb(a),{headers:{...l,"Content-Length":String(b.size)}})}}catch(a){return console.error("Error serving file:",a),new u.NextResponse("Internal Server Error",{status:500})}}let D=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/files/[...filePath]/route",pathname:"/api/files/[...filePath]",filename:"route",bundlePath:"app/api/files/[...filePath]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/app/ai-toolkit/ui/src/app/api/files/[...filePath]/route.ts",nextConfigOutput:"",userland:d}),{workAsyncStorage:E,workUnitAsyncStorage:F,serverHooks:G}=D;function H(){return(0,g.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:F})}async function I(a,b,c){var d;let e="/api/files/[...filePath]/route";"/index"===e&&(e="/");let g=await D.prepare(a,b,{srcPage:e,multiZoneDraftMode:!1});if(!g)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:u,params:v,nextConfig:w,isDraftMode:x,prerenderManifest:y,routerServerContext:z,isOnDemandRevalidate:A,revalidateOnlyGenerated:B,resolvedPathname:C}=g,E=(0,j.normalizeAppPath)(e),F=!!(y.dynamicRoutes[E]||y.routes[C]);if(F&&!x){let a=!!y.routes[C],b=y.dynamicRoutes[E];if(b&&!1===b.fallback&&!a)throw new s.NoFallbackError}let G=null;!F||D.isDev||x||(G="/index"===(G=C)?"/":G);let H=!0===D.isDev||!F,I=F&&!H,J=a.method||"GET",K=(0,i.getTracer)(),L=K.getActiveScopeSpan(),M={params:v,prerenderManifest:y,renderOpts:{experimental:{cacheComponents:!!w.experimental.cacheComponents,authInterrupts:!!w.experimental.authInterrupts},supportsDynamicResponse:H,incrementalCache:(0,h.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:null==(d=w.experimental)?void 0:d.cacheLife,isRevalidate:I,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d)=>D.onRequestError(a,b,d,z)},sharedContext:{buildId:u}},N=new k.NodeNextRequest(a),O=new k.NodeNextResponse(b),P=l.NextRequestAdapter.fromNodeNextRequest(N,(0,l.signalFromNodeResponse)(b));try{let d=async c=>D.handle(P,M).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=K.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==m.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${J} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${J} ${a.url}`)}),g=async g=>{var i,j;let k=async({previousCacheEntry:f})=>{try{if(!(0,h.getRequestMeta)(a,"minimalMode")&&A&&B&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let e=await d(g);a.fetchMetrics=M.renderOpts.fetchMetrics;let i=M.renderOpts.pendingWaitUntil;i&&c.waitUntil&&(c.waitUntil(i),i=void 0);let j=M.renderOpts.collectedTags;if(!F)return await (0,o.I)(N,O,e,M.renderOpts.pendingWaitUntil),null;{let a=await e.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(e.headers);j&&(b[r.NEXT_CACHE_TAGS_HEADER]=j),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==M.renderOpts.collectedRevalidate&&!(M.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&M.renderOpts.collectedRevalidate,d=void 0===M.renderOpts.collectedExpire||M.renderOpts.collectedExpire>=r.INFINITE_CACHE?void 0:M.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:e.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:d}}}}catch(b){throw(null==f?void 0:f.isStale)&&await D.onRequestError(a,b,{routerKind:"App Router",routePath:e,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:I,isOnDemandRevalidate:A})},z),b}},l=await D.handleResponse({req:a,nextConfig:w,cacheKey:G,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:y,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:B,responseGenerator:k,waitUntil:c.waitUntil});if(!F)return null;if((null==l||null==(i=l.value)?void 0:i.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==l||null==(j=l.value)?void 0:j.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});(0,h.getRequestMeta)(a,"minimalMode")||b.setHeader("x-nextjs-cache",A?"REVALIDATED":l.isMiss?"MISS":l.isStale?"STALE":"HIT"),x&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,p.fromNodeOutgoingHttpHeaders)(l.value.headers);return(0,h.getRequestMeta)(a,"minimalMode")&&F||m.delete(r.NEXT_CACHE_TAGS_HEADER),!l.cacheControl||b.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,q.getCacheControlHeader)(l.cacheControl)),await (0,o.I)(N,O,new Response(l.value.body,{headers:m,status:l.value.status||200})),null};L?await g(L):await K.withPropagatedContext(a.headers,()=>K.trace(m.BaseServerSpan.handleRequest,{spanName:`${J} ${a.url}`,kind:i.SpanKind.SERVER,attributes:{"http.method":J,"http.target":a.url}},g))}catch(b){if(b instanceof s.NoFallbackError||await D.onRequestError(a,b,{routerKind:"App Router",routePath:E,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:I,isOnDemandRevalidate:A})}),F)throw b;return await (0,o.I)(N,O,new Response(null,{status:500})),null}}},94345:(a,b,c)=>{"use strict";c.d(b,{EU:()=>k,Mc:()=>n,RI:()=>j,VI:()=>l,f2:()=>m});var d=c(33873),e=c.n(d),f=c(82344),g=c(6452),h=c(93940);let i=new(c.n(h)()),j=()=>{i.flushAll()},k=async()=>{let a="DATASETS_FOLDER",b=i.get(a);if(b)return b;let c=await f.A.settings.findFirst({where:{key:"DATASETS_FOLDER"}});return b=g.b4,c?.value&&""!==c.value&&(b=c.value),b=e().resolve(b),i.set(a,b),b},l=async()=>{let a="TRAINING_FOLDER",b=i.get(a);if(b)return b;let c=await f.A.settings.findFirst({where:{key:a}});return b=g.eA,c?.value&&""!==c.value&&(b=c.value),b=e().resolve(b),i.set(a,b),b},m=async()=>{let a="DATA_ROOT",b=i.get(a);if(b)return b;let c=await f.A.settings.findFirst({where:{key:a}});return b=g.iP,c?.value&&""!==c.value&&(b=c.value),b=e().resolve(b),i.set(a,b),b},n=async()=>{if(process.env.MODELS_PATH&&""!==process.env.MODELS_PATH.trim())return process.env.MODELS_PATH;let a=await f.A.settings.findFirst({where:{key:"MODELS_PATH"}});return a?.value&&""!==a.value?a.value:e().join(process.cwd(),"..","models")}},94735:a=>{"use strict";a.exports=require("events")},96330:a=>{"use strict";a.exports=require("@prisma/client")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[5873,1692,3940],()=>b(b.s=86542));module.exports=c})();

Xet Storage Details

Size:
10.4 kB
·
Xet hash:
19bc08f54f6ec16072646e2411f5ad07455f0f9cec5d104aa7919aca2df59fb0

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.