├── readme.md ├── template.js └── dist └── main.min.css /readme.md: -------------------------------------------------------------------------------- 1 | # GD Share 2 | ## demo 3 | [https://drive.google.com/drive/folders/1soZPZdN0beUTvnD8YbRXgOIeff7Dgwa2](https://drive.google.com/drive/folders/1soZPZdN0beUTvnD8YbRXgOIeff7Dgwa2) 4 | 5 | ## 介绍 6 | 这是一款受goindex启发而产生的项目,适合部署于cloudflare worker,相比原版有以下特性: 7 | 8 | - 全盘搜索(包括个人盘和所有有权限的团队盘,可点击搜索结果中的链接跳转到对应的google drive官方网址) 9 | - 分页浏览(可自定义每页文件数,每页可根据文件名和大小排序) 10 | - 更美观的UI(致谢 ant design) 11 | - 防爬虫,对于所有目录和文件,只有管理员才有读取和下载的权限(原版goindex可以通过在目录下防止 .password 来给目录设置读取密码,但无法限制单个文件的下载) 12 | - 可以生成下载直链,方便第三方下载工具下载,对于流媒体文件,可以用potplayer等播放器直接打开进行播放(可以自定义有效期) 13 | - 可以生成带有提取码的分享链接,方便分享给他人浏览和下载(同样支持自定义有效期) 14 | 15 | ## changelog 16 | ### 2020-08-12 17 | - 在首页展示团队盘列表(最多100条),点击对应名称即可进入 18 | - 添加批量获取直链功能(可自行选择,也可一键获取当前目录下所有直接子文件的直链) 19 | - 添加唤起外部播放器功能(支持IINA/PotPlayer/VLC/nPlayer/MXPlayer) 20 | - 添加指定范围搜素功能(可在目录列表页进行搜索,由于Google API的限制,只能搜索当前目录的直接子文件,无法搜索到递归子目录的内容。若当前目录为团队盘根目录,则支持整盘搜索) 21 | - 「显示路径」按钮可正确识别团队盘名称(之前会返回"Drive") 22 | - 后端搜索接口添加失败重试机制 23 | 24 | ## tips 25 | - 本工具亦可当作goindex使用,只需将目录ID添加到 `https://your.website.com/ls/` 后即可。 26 | 比如浏览团队盘内容可以直接访问 `https://your.website.com/ls/你的团队盘ID` 27 | 浏览个人盘根目录可以直接访问 `https://your.website.com/ls/root` 28 | 29 | ## 搭建方法 30 | 打开[template.js](./template.js),根据提示修改变量: 31 | ```javascript 32 | const CONFIG = { 33 | PASSKEY: "this is your passkey", // 管理员网页登录密钥,请自行修改,尽量复杂 34 | HASHKEY: "this is your hash key", // 用于校验生成的下载链接和分享链接,请自行修改,尽量复杂。修改后之前生成的下载和分享链接都会失效 35 | RETRY_LIMIT: 5, // 有时调用 google drive api 读取目录时会报错,这里设置最多允许重试的次数 36 | PAGESIZE: 100, // 读取列表的单页对象数,官方限制最大 1000 37 | AUTH: { 38 | client_id: "insert_your_client_id", // 这三项是你的google帐号个人授权信息,和goindex相同 39 | client_secret: "insert_your_client_secret", // 同上必填 40 | refresh_token: "insert_your_refresh_token", // 同上必填 41 | expires: 0, 42 | access_token: "" // 可不填 43 | } 44 | } 45 | ``` 46 | 变量设置完成后,将 `template.js` 整体复制到 cloudflare worker 中(具体步骤可参考[https://www.jiyiblog.com/archives/031279.html](https://www.jiyiblog.com/archives/031279.html)),完成。 47 | -------------------------------------------------------------------------------- /template.js: -------------------------------------------------------------------------------- 1 | const CONFIG = { 2 | PASSKEY: "this is your passkey", // 管理员网页登录密钥,请自行修改,尽量复杂 3 | HASHKEY: "this is your hash key", // 用于校验生成的下载链接和分享链接,请自行修改,尽量复杂。修改后之前生成的下载和分享链接都会失效 4 | RETRY_LIMIT: 5, // 有时调用 google drive api 读取目录时会报错,这里设置最多允许重试的次数 5 | PAGESIZE: 100, // 读取列表的单页对象数,官方限制最大 1000 6 | ORDERBY: 'modifiedTime', // 可选值 modifiedTime 或 name,分别表示根据文件修改时间排序和根据文件名排序 7 | DESC: true, // 可选值 true 或 false,分别表示逆序排列和顺序排列 8 | AUTH: { 9 | client_id: "insert_your_client_id", // 这三项是你的google帐号个人授权信息,和goindex相同 10 | client_secret: "insert_your_client_secret", // 同上必填 11 | refresh_token: "insert_your_refresh_token", // 同上必填 12 | expires: 0, 13 | access_token: "" // 可不填 14 | } 15 | } 16 | 17 | !function(t){var e={};function n(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)n.d(i,s,function(e){return t[e]}.bind(null,s));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=8)}([function(t,e,n){"use strict";var i=n(1),s=n(10);function r(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function o(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function h(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=s,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),s=0;s>6|192,n[i++]=63&o|128):r(t,s)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++s)),n[i++]=o>>18|240,n[i++]=o>>12&63|128,n[i++]=o>>6&63|128,n[i++]=63&o|128):(n[i++]=o>>12|224,n[i++]=o>>6&63|128,n[i++]=63&o|128)}else for(s=0;s>>0}return o},e.split32=function(t,e){for(var n=new Array(4*t.length),i=0,s=0;i>>24,n[s+1]=r>>>16&255,n[s+2]=r>>>8&255,n[s+3]=255&r):(n[s+3]=r>>>24,n[s+2]=r>>>16&255,n[s+1]=r>>>8&255,n[s]=255&r)}return n},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,n){return t+e+n>>>0},e.sum32_4=function(t,e,n,i){return t+e+n+i>>>0},e.sum32_5=function(t,e,n,i,s){return t+e+n+i+s>>>0},e.sum64=function(t,e,n,i){var s=t[e],r=i+t[e+1]>>>0,o=(r>>0,t[e+1]=r},e.sum64_hi=function(t,e,n,i){return(e+i>>>0>>0},e.sum64_lo=function(t,e,n,i){return e+i>>>0},e.sum64_4_hi=function(t,e,n,i,s,r,o,a){var h=0,c=e;return h+=(c=c+i>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,n,i,s,r,o,a){return e+i+r+a>>>0},e.sum64_5_hi=function(t,e,n,i,s,r,o,a,h,c){var u=0,l=e;return u+=(l=l+i>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,n,i,s,r,o,a,h,c){return e+i+r+a+c>>>0},e.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},e.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},e.shr64_hi=function(t,e,n){return t>>>n},e.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0}},function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=n,n.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)}},function(t,e,n){"use strict";var i=n(0),s=n(1);function r(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=r,r.prototype.update=function(t,e){if(t=i.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-n,this.endian);for(var s=0;s>>24&255,i[s++]=t>>>16&255,i[s++]=t>>>8&255,i[s++]=255&t}else for(i[s++]=255&t,i[s++]=t>>>8&255,i[s++]=t>>>16&255,i[s++]=t>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,r=8;r>>3},e.g1_256=function(t){return i(t,17)^i(t,19)^t>>>10}},function(t,e,n){"use strict";var i=n(0),s=n(2),r=n(3),o=n(1),a=i.sum32,h=i.sum32_4,c=i.sum32_5,u=r.ch32,l=r.maj32,d=r.s0_256,p=r.s1_256,f=r.g0_256,g=r.g1_256,m=s.BlockHash,y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function w(){if(!(this instanceof w))return new w;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}i.inherits(w,m),t.exports=w,w.blockSize=512,w.outSize=256,w.hmacStrength=192,w.padLength=64,w.prototype._update=function(t,e){for(var n=this.W,i=0;i<16;i++)n[i]=t[e+i];for(;i{const n={};return n[e[0]]=e[1],{...t,...n}},{})}async function i(t,e=1048576){const n=[],i=t.getReader(),s=new TextDecoder;let r=0;for(;e&&r(c.push(n),"([^.]+)")),d=e.replace(/(:([^/]+))/g,(t,e,n)=>"*"===n.slice(-1)?(u.push(n.slice(0,n.length-1)),"(.*)"):(u.push(n),"([^/]*)")),p=new RegExp(`^${l}$`,"i"),f=new RegExp(`^${d}$`,"i"),g=n?new RegExp(`^${n}$`,"i"):null,m=new RegExp(`^${i.join("|")}$`,"i"),y=new RegExp(`^${r}$`,"i");return{hostVariables:c,pathVariables:u,host:p,path:f,excludePath:g,method:m,protocol:y,handler:s,handlerName:o,headers:a,data:h}},parseRequest:function(t){const e=new URL(t.url),s=n(e.searchParams),r=n(t.headers);return r.host&&(e.hostname=r.host),{body:t.body,headers:r,host:e.host,hostname:e.hostname,href:e.href,json:async e=>JSON.parse(await i(t.body,e)),method:t.method,origin:`${e.protocol}//${e.host}`,path:e.pathname,protocol:e.protocol.slice(0,-1),query:s,querystring:e.search.slice(1),search:e.search,text:async e=>{const n=await i(t.body,e);return"application/x-www-form-urlencoded"===t.headers.get("content-type")?decodeURIComponent(n):n}}}}},function(t,e){t.exports=CONFIG},function(t,e,n){const i=n(9),s=n(17),{wtf:r,bad:o,ok:a}=n(21),{ls_drives:h,find:c,get_file_info:u,check_belonging:l,gen_payload:d,get_all_ancestors:p,ls:f,ls_all:g}=n(22),m=n(23),{PASSKEY:y,HASHKEY:w}=n(7),v="application/vnd.google-apps.folder";function _(t){return i.hmac(i.sha256,w).update(t).digest("hex")}function b({expired:t,id:e,name:n}){const i=t?`expired=${t}&id=${e}`:"id="+e;return`/api/download/${n?encodeURIComponent(n):"noname"}?${i}&sig=${_(i)}`}const x=new s;x.use(async(t,e)=>{try{return await e(t)}catch(e){console.error(e.message);const n=e&&e.response&&e.response.data;n&&console.error(JSON.stringify(n)),o(t,e.message)}}),x.use((async function(t,e){if("post"!==t.request.method.toLowerCase())return e(t);try{t.request.body=await t.request.json()}catch(e){console.log("fail to parse request body to json",e),t.request.body={}}const{passkey:n}=t.request.body;if(t.request.path.startsWith("/api/admin")&&n!==y)return o(t,"invalid passkey");return e(t)})),x.post("/api/folder/link",async t=>{const{id:e,nextPageToken:n,root:i,code:s,expired:r,sig:h,name:c}=t.request.body;if(!(e&&i&&s&&h))return o(t,"invalid request");if(_(r?`expired=${r}&root=${i}&code=${s}`:`root=${i}&code=${s}`)!==h)return o(t,"提取码错误");if(!await l({root:i,id:e}))return o(t,"folder id does not belongs to root");const u=b({expired:r,id:e,name:c});a(t,{link:u})}),x.post("/api/folder/links",async t=>{const{id:e,root:n,code:i,expired:s,sig:r}=t.request.body;if(!(e&&n&&i&&r))return o(t,"invalid request");if(_(s?`expired=${s}&root=${n}&code=${i}`:`root=${n}&code=${i}`)!==r)return o(t,"提取码错误");if(!await l({root:n,id:e}))return o(t,"folder id does not belongs to root");let h=await g(e);h=h.filter(t=>t.mimeType!==v);const c=h.map(t=>b({expired:s,...t}));a(t,{links:c})}),x.post("/api/folder/ls",async t=>{const{id:e,nextPageToken:n,root:i,code:s,expired:r,sig:h}=t.request.body;if(!(e&&i&&s&&h))return o(t,"invalid request");if(_(r?`expired=${r}&root=${i}&code=${s}`:`root=${i}&code=${s}`)!==h)return o(t,"提取码错误");if(!await l({root:i,id:e}))return o(t,"folder id does not belongs to root");let c;if(!n&&(c=await u(e),c.mimeType!==v))return o(t,"未找到相关目录");const d=await f(e,n),p=c&&c.name;a(t,{name:p,list:d})}),x.post("/api/file/info",async t=>{const{id:e}=t.request.body;if(!e)return r(t,"invalid id");try{const n=await u(e);a(t,n)}catch(n){console.log("fail to get file",e,n.message),o(t,"获取文件信息失败")}}),x.post("/api/file/link",async t=>{const{code:e,id:n,expired:i,sig:s,name:h}=t.request.body;if(!n||!e||!s)return r(t,"invalid request");if(i&&Date.now()>Number(i))return o(t,"分享链接已过期");if(_(i?`expired=${i}&id=${n}&code=${e}`:`id=${n}&code=${e}`)!==s)return o(t,"提取码错误");const c=b({expired:i,id:n,name:h});a(t,{link:c})}),x.post("/api/admin/ancestors",async t=>{const{id:e}=t.request.body;if(!e)return o(t,"invalid id");const n=await p(e);a(t,n)}),x.post("/api/admin/link",t=>{let{expired:e,id:n,name:i}=t.request.body;if(!n)return o(t,"id can not be empty");const s=b({expired:e,id:n,name:i});a(t,{link:s})}),x.post("/api/admin/links",t=>{const{expired:e,files:n}=t.request.body;if(!Array.isArray(n))return o(t,"files must be an array");const i=n.map(t=>b({expired:e,...t}));a(t,{links:i})}),x.post("/api/admin/all",async t=>{const{id:e,expired:n}=t.request.body;if(!e)return o(t,"id can not be empty");let i=await g(e);i=i.filter(t=>t.mimeType!==v);const s=i.map(t=>b({expired:n,...t}));a(t,{links:s})}),x.post("/api/admin/auth",t=>{const{passkey:e}=t.request.body;if(e!==y)return o(t,"passkey 错误");a(t,"ok")}),x.post("/api/admin/search",async t=>{const{keyword:e,nextPageToken:n,range:i}=t.request.body;if(!e)return o(t,"搜索词不能为空");const s=await c(e,n,i);a(t,s)}),x.post("/api/admin/drives",async t=>{const e=await h();a(t,e)}),x.post("/api/admin/ls",async t=>{const{id:e,nextPageToken:n}=t.request.body;if(!e)return o(t,"invalid folder id");let i;n||(i=await u(e));const s=await f(e,n);s.name=i&&i.name,s.parent=i&&i.parents&&i.parents[0],a(t,s)}),x.post("/api/admin/share",t=>{const{expired:e,id:n,code:i,is_folder:s}=t.request.body;if(!n||!i)return o(t,"id or code can not be empty");let r=s?"root":"id",h=e?`expired=${e}&${r}=${n}`:`${r}=${n}`;h=h+"&sig="+_(h+"&code="+i),a(t,{link:h})}),x.use((t,e)=>{const{method:n,path:i}=t.request;"GET"!==n||i.startsWith("/api")||(t.status=200,t.set("Content-Type","text/html; charset=utf-8"),t.body=m)}),addEventListener("fetch",t=>{if(new URL(t.request.url).pathname.startsWith("/api/download"))return t.respondWith(async function(t){const e=new URL(t.url),[n,i,s]=["expired","id","sig"].map(t=>e.searchParams.get(t));if(!i||!s)return new Response("invalid request",{status:403});if(n&&Date.now()>Number(n))return new Response("link expired",{status:403});if(s!==_(n?`expired=${n}&id=${i}`:"id="+i))return new Response("invalid sig",{status:403});const r=t.headers.get("Range"),o=await d();o.headers.Range=r||"";const{name:a}=await u(i);let h=await fetch(`https://www.googleapis.com/drive/v3/files/${i}?alt=media`,o);return h=new Response(h.body,h),h.headers.set("Content-Disposition",`attachment; filename="${a}"`),h}(t.request));t.respondWith(x.resolve(t))})},function(t,e,n){var i=e;i.utils=n(0),i.common=n(2),i.sha=n(11),i.ripemd=n(15),i.hmac=n(16),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},function(t,e,n){"use strict";e.sha1=n(12),e.sha224=n(13),e.sha256=n(4),e.sha384=n(14),e.sha512=n(5)},function(t,e,n){"use strict";var i=n(0),s=n(2),r=n(3),o=i.rotl32,a=i.sum32,h=i.sum32_5,c=r.ft_1,u=s.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(d,u),t.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(t,e){for(var n=this.W,i=0;i<16;i++)n[i]=t[e+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest()),s(t.length<=this.blockSize);for(var e=t.length;e{e.headers[i]!==t.headers[i]&&(n=!1)}),n}(t,e)&&function(t,e){return t.protocol.test(e.protocol)}(t,e)&&(!t.excludePath||!t.excludePath.test(e.path))}t.exports={recurseRoutes:async function t(e,i){const[s,...r]=i;if(!s)return new Response("NOT_FOUND",{status:404});if(!n(s,e.request))return t(e,r);e.state.handlers=e.state.handlers||[],e.state.handlers.push(s.handlerName||s.handler.name),e.params=function(t,e){const n={},i=e.host.exec(t.host);e.hostVariables.forEach((t,e)=>{n[t]=i[e+1]});const s=e.path.exec(t.path);return e.pathVariables.forEach((t,e)=>{n[t]=s[e+1]}),n}(e.request,s);try{return s.handler(e,async e=>t(e,r))}catch(t){throw t.route=s.handler.name,t}}}},function(t,e){t.exports={methods:{DELETE:"DELETE",GET:"GET",HEAD:"HEAD",OPTIONS:"OPTIONS",PATCH:"PATCH",POST:"POST"},statusMessages:{404:"Not found",429:"Rate limited"}}},function(t,e,n){const i=n(6);t.exports=class t{constructor(t){this.request=i.parseRequest(t.request),this.event=t,this.state={},this.cloned=!1,this.response={headers:{}},this.body="",this.status=404,this.query=this.request.query}header(t){return this.request.headers[t]}set(t,e){this.response.headers[t]=e}clone(){const e=new t(this.event);return e.cloned=!0,e}}},function(t,e){t.exports={ok:function(t,e={}){t.status=200,t.body=JSON.stringify({data:e})},bad:function(t,e){const n=e||"sorry, please try again later";t.status=200,t.body=JSON.stringify({message:n})},wtf:function(t,e){e=e||"no comment",console.error(new Error("wtf? "+e)),t.status=200,t.body=JSON.stringify({message:"FBI Warning"})}}},function(t,e,n){const{RETRY_LIMIT:i,PAGESIZE:s,AUTH:r,ORDERBY:o,DESC:a}=n(7);async function h(t={},e="GET"){const n=await async function(){const{expires:t,access_token:e,client_id:n,client_secret:i,refresh_token:s}=r;if(t>Date.now())return e;const o={headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",body:c({client_id:n,client_secret:i,refresh_token:s,grant_type:"refresh_token"})},a=await fetch("https://www.googleapis.com/oauth2/v4/token",o),h=await a.json();return r.access_token=h.access_token,r.expires=Date.now()+1e3*h.expires_in,h.access_token}();return t.authorization="Bearer "+n,{method:e,headers:t}}function c(t){const e=[];for(let n in t)e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.join("&")}async function u(t){let e="https://www.googleapis.com/drive/v3/files/"+t;e+="?"+c({includeItemsFromAllDrives:!0,supportsAllDrives:!0,corpora:"allDrives",fields:"id, name, size, mimeType, createdTime, parents"}),function(t){return t.startsWith("0A")&&19===t.length}(t)&&(e="https://www.googleapis.com/drive/v3/drives/"+t);const n=await h();return(await fetch(e,n)).json()}async function l(t,e,n){const r={includeItemsFromAllDrives:!0,supportsAllDrives:!0,q:`'${t}' in parents and trashed = false`,fields:"nextPageToken, files(id, name, mimeType, modifiedTime, size, md5Checksum)",pageSize:Math.min(s,1e3)};r.orderBy=`folder, ${"name"===o?"name":"modifiedTime"} desc`,!1!==a&&"false"!==a||(r.orderBy=r.orderBy.replace(" desc","")),e&&(r.pageToken=e),n&&(r.pageSize=n);const u="https://www.googleapis.com/drive/v3/files?"+c(r),l=await h();let d=0;for(;d(await u(t)).parents)),n=[].concat(...n).filter(t=>t),n.includes(e))return!0}while(n.length);return!1},get_all_ancestors:async function(t){const e=[];for(;t;){const n=await u(t);e.push(n),t=n.parents&&n.parents[0]}return e},gen_payload:h}},function(t,e){t.exports='\n\n\n \n \n GDShare\n \n \n\n\n
\n