From 873b4a4f5ac3ed260d94d187a6fb689a2206a8c5 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Sun, 4 Aug 2024 15:33:49 -0400 Subject: [PATCH] 0.5.2: Change retrieve_file error code to 403 because 404 doesn't work for some reason lol --- README.md | 15 ++++++++++++++- src/handling.cr | 3 +-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3453b89..166fffe 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,21 @@ Simple file uploader made on Crystal. I'm making this to replace my current File uploader hosted on https://ayaya.beauty which uses https://github.com/nokonoko/uguu +## Features + +- Temporary file file uploader like Uguu +- File deletion link (not available in frontend for now) +- Chatterino and ShareX support +- Low memory usage: Between 6MB at idle and 25MB if a file is being uploaded of retrieved. I will depend of your traffic. + ## TODO - ~~Add file size limit~~ ADDED - Fix error when accessing `http://127.0.0.1:8080` with an empty DB. -- Better frontend... \ No newline at end of file +- Better frontend... +- Disable file deletion if `delete_files_after_check_seconds` or `delete_files_after` is set to `0` +- Disable delete key if `delete_key_lenght` is `0` +- Exit if `filename_lenght` is `0` +- Disable file limit if `size_limit` is `0` +- + diff --git a/src/handling.cr b/src/handling.cr index 7556f8e..f285ec9 100644 --- a/src/handling.cr +++ b/src/handling.cr @@ -100,13 +100,12 @@ end end def retrieve_file(env) - puts env.params.url begin filename = SQL.query_one "SELECT filename FROM files WHERE filename = ?", env.params.url["filename"].to_s.split(".").first, as: String extension = SQL.query_one "SELECT extension FROM files WHERE filename = ?", filename, as: String send_file env, "#{CONFIG.files}/#{filename}#{extension}" rescue - error404("This file does not exist") + error403("This file does not exist") end end