diff --git a/404.html b/404.html index 5fff4dc..f987d83 100644 --- a/404.html +++ b/404.html @@ -24,15 +24,31 @@ text-align: left; } + #main_div{ + text-align: center; + } + #second_div{ + display: flex; + justify-content: center; + } h1{ font-family: 'Roboto Mono', monospace; font-weight: 400; } + pre{ + font-family: 'Roboto Mono', monospace; + font-weight: 400; + font-size: 80%; + text-align: left; + } + hr{ border: 1px solid rgb(105, 105, 105); } - p{font-size: 110%;} + p{ + font-size: 100%; + } nav a{ @@ -48,14 +64,12 @@ #login_mess{ font-style: italic; } - #main_div{ - text-align: center; - } @media(max-width: 425px){ main{width: 90%;} h1{font-size: 130%;} p{font-size: 90%;} + pre{font-size: 50%;} } @@ -67,8 +81,39 @@

File uploader


-

404

-

Hmmm... It looks like the file has not been found.

+
+
+                    .:
+                    !&J
+                    ~GP:
+                    !#?
+            :^:. .!J7.
+           .JB&@@B~?57.                     ..:^~!7JY?
+       .~?:G@@@@B?#@@@&7       ..:^~!7?JJYYY5PG&@#PJ77~
+     .J#B^!@@@@@&&@@@@@&.!JYYYY55YYJ?!~^~!?Y55J7~!?5B@#
+     ^@@! ^@@@@@@@@@@@@B.^J&#G!     .~?Y5Y?!~!JP#@@@@@B
+⠀⠀^JYY57!#G  ?B@@@@@@@@#5: .7^.~7Y55J!^~7YG&@@@@@@@@@B
+Y@#7:  .?^ 7G?7?JYY?^.  ~55?7J55J7^^~?P#@@@@@@@@@@@#P?^
+Y#!5PY7~:.  !GPY5Y7.  :!J55Y7~:^!JG&@@@@@@@@@@&BY!:  :~
+Y#  .~7JY555YYGBPYJJY55J!::^75B&@@@@@@@@@@#PJ~. .^?P#@#
+Y#        ..:::^^^^^^.:~?P#@@@@@@@@@@&B57^  :!JG&@@@@@B
+Y#                   P&@@@@@@@@@@&GY!:  ^75B&@@@@@@@@@B
+Y#                  .&@@@@@@@#P?~. .~JP#@@@@@@@@@@&B57:
+Y#                  .&@@&B57:  :!YG&@@@@@@@@@@&GJ!::~?J
+Y#                  .5J~. .^?5#@@@@@@@@@@@#P?~:^!YG&@@#
+Y#       404          .~JG#@@@@@@@@@@&BY7^:^75B@@@@@@@#
+Y#                  .P&@@@@@@@@@@#GJ~::~JP#@@@@@@@@@@@P
+Y#                  .&@@@@@@@B5?^:^!YB&@@@@@@@@@@&GY!:
+Y#                  .&@@&GY!^:~?P#@@@@@@@@@@@#P?~.
+Y#                  .5J~::!JG&@@@@@@@@@@&B57^.
+Y#                   :75B&@@@@@@@@@@#GJ!:
+!&!                 .#@@@@@@@@@@B5?^.
+~GP!:              .&@@@@@&GY!:
+    ~J55YJ?7!~~^^^^^~!@@#PJ~.
+    .^~!7??JJJJJJJJ7^.
+                    
+
+

The file is a lie.

diff --git a/main.py b/main.py index bd9e7f8..ad070bd 100644 --- a/main.py +++ b/main.py @@ -2,7 +2,6 @@ created by AndcoolSystems, 2023-2024 """ - from fastapi import FastAPI, UploadFile, Request, Header from fastapi.responses import JSONResponse, FileResponse, Response from typing import Annotated, Union @@ -43,6 +42,8 @@ check_period = 86_400 # File check period (unused) + + @app.on_event("startup") async def startup_event(): await db.connect() # Connecting to database @@ -102,7 +103,7 @@ async def upload_file(file: UploadFile, request: Request, include_ext: bool = Fa saved_to_account = True key = str(uuid.uuid4()) # Generate unique delete key - ext = "." + file.filename.split(".")[-1] # Get file extension + ext = "." + file.filename.split(".")[-1].lower() # Get file extension fid = utils.generate_token(10) + (ext if include_ext else "") # Generate file url fn = str(uuid.uuid4()) + ext # Generate file name diff --git a/web/res/external-link.png b/web/res/external-link.png new file mode 100644 index 0000000..e9e742f Binary files /dev/null and b/web/res/external-link.png differ diff --git a/web/script.js b/web/script.js index 63727f7..bbe818a 100644 --- a/web/script.js +++ b/web/script.js @@ -62,8 +62,24 @@ function append_to_files_arr(data, id){ online.title = "Stored on local browser"; } + let a_btn = document.createElement("a"); + a_btn.href = data['file_url_full']; + a_btn.className = "href_btn"; + a_btn.target = "_blank"; + a_btn.title = "Open in new tab"; + + let href_img = document.createElement("img"); + href_img.src = "./res/external-link.png"; + + a_btn.appendChild(href_img); + let urls_div = document.createElement("div"); - urls_div.appendChild(url); + let url_link_div = document.createElement("div"); + url_link_div.className = "url_link_div"; + url_link_div.appendChild(a_btn); + url_link_div.appendChild(url); + + urls_div.appendChild(url_link_div); urls_div.appendChild(filename); creation_date_div.appendChild(cr_time); @@ -76,7 +92,7 @@ function append_to_files_arr(data, id){ async function get_new_tokens(accessToken){ try{ - let response = await axios.post(api_url + "/api/refresh_token", {'accessToken': accessToken}, {}) + let response = await axios.post(api_url + "/api/refresh_token", {'accessToken': "Bearer " + accessToken}, {}) if (!response) return false; if (response.status != 200) return false; return response.data.accessToken; diff --git a/web/style.css b/web/style.css index 7b611e3..4a820ca 100644 --- a/web/style.css +++ b/web/style.css @@ -111,6 +111,7 @@ p{margin-left: 2px;} cursor: pointer; color: white; text-decoration: none; + word-wrap: break-word; } #files_table #url:hover{text-decoration: underline dashed;} @@ -236,6 +237,18 @@ nav a:hover{ transition: transform 0.3s ease-in-out; } +.url_link_div{ + display: flex; + align-items: center; + flex-direction: row; +} + +.href_btn{ + display: flex; + align-items: center; + justify-content: center; + margin-right: 1%; +} @media(max-width: 425px){ main{width: 90%;} h1{font-size: 130%;}