ObsidianJustSharePlease/server/public/share.php

24 lines
810 B
PHP
Raw Normal View History

2023-08-09 18:11:29 +02:00
<?php
2023-08-09 17:57:29 +02:00
2023-08-09 20:13:44 +02:00
parse_str($_SERVER["QUERY_STRING"], $query);
switch ($_SERVER["REQUEST_METHOD"]) {
case "GET":
$content = file_get_contents(dirname(getcwd()) . "/data/" . $query["file"]);
if (!$content) {
http_response_code(404);
break;
}
header("Content-Type: text/plain");
echo $content;
break;
case "POST":
// TODO upload using POST
// TODO when uploading, generate and send back Guid and store in meta file alongside data
// TODO when uploading, also generate and return a deletion password that is also stored in meta file
break;
case "DELETE":
// TODO delete using DELETE
// TODO only accept deletions if the password matches the deletion password from the upload
break;
}