1 line
1.9 KiB
JavaScript
1 line
1.9 KiB
JavaScript
"use strict";(()=>{var e={};e.id=2127,e.ids=[2127],e.modules={39908:e=>{e.exports=require("@moduletrace/datasquirel/dist/users/user-auth")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},63311:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>l,routeModule:()=>P});var n={};t.r(n),t.d(n,{default:()=>c});var a=t(89947),i=t(2706),s=t(96762),o=t(29021),u=t.n(o),d=t(69842);async function c(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Failed!"});let t=await (0,d.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});try{let n=JSON.parse(e.body).path.replace(/ /g,"").replace(/\.\./g,"");if(n?.match(/\.\./))return r.json({success:!1,msg:"Error!",error:"Invalid url"});let a=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id.toString().replace(/\//g,"")}`,i=n.replace(/\@/,a);u().createReadStream(i).pipe(r)}catch(e){console.log("ERROR in getPrivateMedia api route:",e.message),r.json({success:!1,msg:"Error!",error:e})}}let l=(0,s.M)(n,"default"),p=(0,s.M)(n,"config"),P=new a.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/media/getPrivateMedia",pathname:"/api/media/getPrivateMedia",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>i});var n=t(39908),a=t.n(n);async function i(e,r,t){let n=a()({req:e,level:t?"deep":void 0});return console.log(n),n.payload}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=63311);module.exports=t})(); |