Skip to content

Commit

Permalink
added open button
Browse files Browse the repository at this point in the history
  • Loading branch information
Andcool-Systems committed Jan 25, 2024
1 parent cd8adbe commit 440d5ef
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 10 deletions.
57 changes: 51 additions & 6 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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%;}
}
</style>
<body>
Expand All @@ -67,8 +81,39 @@ <h1>File uploader</h1>
</nav>
<hr>
<div id="main_div">
<h1>404</h1>
<p>Hmmm... It looks like the file has not been found.</p>
<div id="second_div">
<pre>
.:
!&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&#5^.~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^.
</pre>
</div>
<p>The file is a lie.</p>
</div>
</main>
</body>
Expand Down
5 changes: 3 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
Binary file added web/res/external-link.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 18 additions & 2 deletions web/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
13 changes: 13 additions & 0 deletions web/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;}
Expand Down Expand Up @@ -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%;}
Expand Down

0 comments on commit 440d5ef

Please sign in to comment.