diff --git a/README.md b/README.md index 8c532bb..4d16383 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,14 @@ # file-uploader 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 +~~I'm making this to replace my current File uploader hosted on https://ayaya.beauty which uses https://github.com/nokonoko/uguu~~ Already replaced lol. ## Features - Temporary file file uploader like Uguu - File deletion link (not available in frontend for now) - Chatterino and ShareX support +- Unix socket support if you don't want to deal with all the TCP overhead - Low memory usage: Between 6MB at idle and 25MB if a file is being uploaded or retrieved. I will depend of your traffic. ## TODO diff --git a/config/config.yml b/config/config.yml index 26fcf62..148e9cd 100644 --- a/config/config.yml +++ b/config/config.yml @@ -7,8 +7,8 @@ filename_length: 3 # In MiB size_limit: 512 port: 8080 -# unix socket not implemented -unix_socket: "/run/file-uploader.sock" +# If you define the unix socket, it will only listen on the socket and not the port. +unix_socket: "/tmp/file-uploader.sock" # In days delete_files_after: 7 # In seconds diff --git a/public/bliss-small.avif b/public/bliss-small.avif new file mode 100644 index 0000000..77c176c Binary files /dev/null and b/public/bliss-small.avif differ diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..6ec8a8c Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/frahv.ttf b/public/frahv.ttf new file mode 100644 index 0000000..fd61ff4 Binary files /dev/null and b/public/frahv.ttf differ diff --git a/public/frahvmod.ttf b/public/frahvmod.ttf new file mode 100644 index 0000000..d5006b5 Binary files /dev/null and b/public/frahvmod.ttf differ diff --git a/public/framd.ttf b/public/framd.ttf new file mode 100644 index 0000000..e698d26 Binary files /dev/null and b/public/framd.ttf differ diff --git a/public/script.js b/public/script.js index 1a60a5b..281e61e 100644 --- a/public/script.js +++ b/public/script.js @@ -89,7 +89,7 @@ document.addEventListener("DOMContentLoaded", () => { uploadText.innerHTML = "0%"; uploadText.className = "percent" copyButton.className = "copy-button"; // Add class for styling - copyButton.innerHTML = "Copy Link"; // Set button text + copyButton.innerHTML = "Copiar"; // Set button text copyButton.style.display = "none"; // Hide initially // Update progress text diff --git a/public/styles.css b/public/styles.css index d7950bd..c8fb455 100644 --- a/public/styles.css +++ b/public/styles.css @@ -1,6 +1,32 @@ +@font-face { + font-family: "FG"; + font-weight: 500; + src: url('framd.ttf'); +} + +@font-face { + font-family: "FG"; + font-weight: 900; + src: url('frahv.ttf'); +} +@font-face { + font-family: "XFG"; + font-weight: 900; + src: url('frahvmod.ttf'); +} + +html { + font-family: "FG"; + background-image: linear-gradient(to bottom, + rgba(11, 11, 11, 0.92), + rgba(11, 11, 11, 0.92)), + url(./bliss-small.avif); + background-attachment: fixed; +} + body { - font-family: Arial, sans-serif; - background-color: #111; +/* font-family: Arial, sans-serif; */ +/* background-color: #111; */ margin: 0; padding: 20px; } @@ -9,6 +35,28 @@ p, h1, h2, h3, h4, h5 { color: aliceblue } +h1 { + font-family: "FG"; + font-weight: 200; + max-width: 100%; + overflow-wrap: break-word; +} + +a { + text-decoration: none; +} + +.bottom { + font-size: 0.9em; +/* margin-top: 1ch;*/ + flex: 1; + text-align: center; +} + +.bottom > p { + margin: 10px 0px; +} + .percent { color: aliceblue } @@ -22,6 +70,7 @@ p, h1, h2, h3, h4, h5 { /*! box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); */ } + #drop-area { /*! border: 2px solid #00ff00; */ /*! border-radius: 6px; */ @@ -44,7 +93,6 @@ p, h1, h2, h3, h4, h5 { transition: background-color .25s,width .5s,height .5s; } - .button { display: inline-block; padding: 10px 20px; @@ -59,17 +107,6 @@ p, h1, h2, h3, h4, h5 { margin-top: 10px; } -.copy-button { - margin-top: 5px; - padding: 5px 10px; - background: #28a745; - color: white; - border: none; - border-radius: 5px; - cursor: pointer; - display: none; /* Hidden initially */ -} - nav a, nav > ul { list-style: none; @@ -86,7 +123,7 @@ nav a, nav > ul display: flex; align-items: center; justify-content: space-between; - border: 2px solid #eee; /* Optional styling for the status box */ + border: 2px solid #999; /* Optional styling for the status box */ padding: 5px; /* Optional padding */ /*! border-radius: 6px; */ /* Optional rounded corners */ /*! background-color: #f9f9f9; */ /* Optional background color */ diff --git a/src/file-uploader.cr b/src/file-uploader.cr index ed78287..95751d0 100644 --- a/src/file-uploader.cr +++ b/src/file-uploader.cr @@ -32,7 +32,15 @@ Utils.create_files_dir Routing.register_all Jobs.run -Kemal.run + +# Simple but ugly way +if !CONFIG.unix_socket.nil? + Kemal.run do |config| + config.server.not_nil!.bind_unix "#{CONFIG.unix_socket}" + end +else + Kemal.run +end {% if flag?(:release) || flag?(:production) %} Kemal.config.env = "production" if !ENV.has_key?("KEMAL_ENV") diff --git a/src/views/index.ecr b/src/views/index.ecr index 9576f92..157696a 100644 --- a/src/views/index.ecr +++ b/src/views/index.ecr @@ -1,28 +1,3 @@ -
@@ -31,11 +6,12 @@<%= CONFIG.siteInfo %>
+<%= CONFIG.siteInfo %>
Arrastra, Pega o Selecciona archivos.
@@ -45,11 +21,10 @@file-uploader-crystal (BETA <%= CURRENT_VERSION %>-<%= CURRENT_COMMIT %> @ <%= CURRENT_BRANCH %>)
++ Chatterino Config | ShareX Config | file-uploader-crystal (BETA <%= CURRENT_VERSION %>-<%= CURRENT_COMMIT %> @ <%= CURRENT_BRANCH %>) +
Archivos alojados: <%= files_hosted %>