commit 465f0fef513f1af41e52e97a101ed716c9d4d033 Author: Jincheng Lu Date: Sun May 15 12:44:38 2022 +0000 mvp diff --git a/index.php b/index.php new file mode 100644 index 0000000..07e765a --- /dev/null +++ b/index.php @@ -0,0 +1,79 @@ + 0) { + $items = $res['children']; + $nodes = explode('/',substr($path, 1), 2); + $next = $nodes[0]; + $rest = count($nodes) > 1 ? $nodes[1] : ""; + + foreach ($items as $item) { + if ($item['name'] == $next) { + if (isset($item['folder'])) { + return get_item_from_path($item['webUrl'], "/" . $rest); + } else if (isset($item['file'])) { + $result['pathvalid'] = true; + $result['isfolder'] = false; + $result['data'] = $item; + return $result; + } + } + } + + } + + $result['pathvalid'] = false; + return $result; + +} + +$result = get_item_from_path($share_url, $path); + +if ($result['pathvalid'] && $result['isfolder'] == false) { + $download_url = $result['data']['@content.downloadUrl']; + header("Location: $download_url", true, 302); + exit(); +} + +?> + + + + + Download + + + + " . substr($path, 1) . " does not exists!"; + ?> + + \ No newline at end of file