Skip to content

Commit

Permalink
add subfolders support - both encrypted and normal
Browse files Browse the repository at this point in the history
  • Loading branch information
anadius committed Jun 15, 2020
1 parent 9ee57df commit a1ff8d1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion main.obf.js

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions templates/decrypt.php.template
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function decode($encoded) {

/* END OF DECRYPT FUNCTIONS */

$VERSION = 3;
$VERSION = 4;

function fail($reason, $status = 400) {
global $VERSION;
Expand Down Expand Up @@ -99,9 +99,9 @@ $info = function($data) {
$folderContents = apiRequest(
$data['auth'],
'files?q="' . $folderId . '"+in+parents'
. '+and+mimeType+!%3D+"application%2Fvnd.google-apps.folder"'
. '&fields=files(id,size,name,mimeType,md5Checksum,shortcutDetails/*)'
. '&orderBy=name_natural&supportsAllDrives=true&includeItemsFromAllDrives=true&pageSize=1000'
. '&fields=nextPageToken,files(id,size,name,mimeType,md5Checksum,shortcutDetails/*)'
. '&orderBy=name_natural&supportsAllDrives=true&includeItemsFromAllDrives=true&pageSize=100'
. (isset($data['pageToken']) ? '&pageToken=' . $data['pageToken'] : '')
);
}
// if it's shortcut/file, set notLoaded to true and grab the info later
Expand Down Expand Up @@ -138,6 +138,10 @@ $info = function($data) {
}

if(isset($file['notLoaded']) && $file['notLoaded'] === TRUE) {
// ignore shortcuts to folders
if($file['mimeType'] === 'application/vnd.google-apps.folder') {
continue;
}
$fileInfo = apiRequest(
$data['auth'],
'files/' . $file['id'] . '?supportsAllDrives=true&fields=size,md5Checksum'
Expand Down
12 changes: 8 additions & 4 deletions templates/worker.js.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const CORS_HEADERS = {
const DEFAULT_HEADERS = Object.assign({
"Content-Type": "application/json"
}, CORS_HEADERS);
const VERSION = 3;
const VERSION = 4;

addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
Expand Down Expand Up @@ -82,9 +82,9 @@ async function info(data) {
folderContents = await apiRequest(
data.auth,
`files?q="${folderId}"+in+parents`
+ "+and+mimeType+!%3D+'application%2Fvnd.google-apps.folder'"
+ "&fields=files(id,size,name,mimeType,md5Checksum,shortcutDetails/*)"
+ "&orderBy=name_natural&supportsAllDrives=true&includeItemsFromAllDrives=true&pageSize=1000"
+ "&fields=nextPageToken,files(id,size,name,mimeType,md5Checksum,shortcutDetails/*)"
+ "&orderBy=name_natural&supportsAllDrives=true&includeItemsFromAllDrives=true&pageSize=100"
+ (typeof data.pageToken !== "undefined" ? `&pageToken=${data.pageToken}` : '')
);
}
// if it's shortcut/file, set notLoaded to true and grab the info later
Expand Down Expand Up @@ -122,6 +122,10 @@ async function info(data) {

let fileInfo;
if(file.notLoaded === true) {
// ignore shortcuts to folders
if(file.mimeType === "application/vnd.google-apps.folder") {
continue;
}
fileInfo = await this.apiRequest(
data.auth,
`files/${file.id}?supportsAllDrives=true&fields=size,md5Checksum`
Expand Down

0 comments on commit a1ff8d1

Please sign in to comment.