aboutsummaryrefslogtreecommitdiff
path: root/src/Main.php
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-02-10 22:36:13 +0100
committerLaria Carolin Chabowski <laria@laria.me>2020-02-10 22:36:13 +0100
commit62b0b360fa8a1a2d1fd6d89d4d227a0ef559cb8a (patch)
tree5db624a9ac4ce011c18941cbdd13da6e76492c58 /src/Main.php
parent2eb5a432d2229788ce2fdb09f36c6f4bebdea813 (diff)
downloadmicropoly-62b0b360fa8a1a2d1fd6d89d4d227a0ef559cb8a.tar.gz
micropoly-62b0b360fa8a1a2d1fd6d89d4d227a0ef559cb8a.tar.bz2
micropoly-62b0b360fa8a1a2d1fd6d89d4d227a0ef559cb8a.zip
Implement simple attachment support
It is now possible to upload and view attachments! Attachments are saved by their content hash, therefore they are automatically deduplicated and we can later easily add integrity checks. Still missing: - Deleting attachments - Multiple file inputs (idea: when the user fills in a file input, create a new empty file input beneath with js) - (nice to have) Thumbnails
Diffstat (limited to 'src/Main.php')
-rw-r--r--src/Main.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Main.php b/src/Main.php
index 443960b..c82a334 100644
--- a/src/Main.php
+++ b/src/Main.php
@@ -6,6 +6,7 @@ use Closure;
use FastRoute\Dispatcher;
use FastRoute\RouteCollector;
use Micropoly\Handlers\ApiTagsHandler;
+use Micropoly\Handlers\AttachmentHandler;
use Micropoly\Handlers\Index;
use Micropoly\Handlers\MethodNotAllowedHandler;
use Micropoly\Handlers\NewNote;
@@ -13,6 +14,7 @@ use Micropoly\Handlers\NoteHandler;
use Micropoly\Handlers\NotFoundHandler;
use Micropoly\Handlers\Search;
+use Micropoly\Models\Attachment;
use function FastRoute\simpleDispatcher;
class Main implements Entrypoint
@@ -24,6 +26,7 @@ class Main implements Entrypoint
$r->addRoute(["GET"], "/search", Search::class);
$r->addRoute(["GET", "POST"], "/n/{id}", NoteHandler::class);
$r->addRoute(["GET"], "/api/tags", ApiTagsHandler::class);
+ $r->addRoute(["GET"], "/attachments/{id}", AttachmentHandler::class);
}
public function run(Env $env)