use specific download page, don't collect the pub key as the server
This commit is contained in:
parent
0020731207
commit
a2bdf2b1bf
5 changed files with 45 additions and 7 deletions
9
src/public/js/download.js
Normal file
9
src/public/js/download.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { RSA_dec_data as RSA_dec } from "./rsa.js";
|
||||
|
||||
window.addEventListener("load", () => main());
|
||||
|
||||
const main = () => {
|
||||
const pub_key = window.location.hash.slice(1).split(":");
|
||||
const hash = window.location.pathname.split("/").pop();
|
||||
console.log(pub_key, hash);
|
||||
};
|
|
@ -88,7 +88,7 @@ const send = (file, element) => {
|
|||
let link = `${url.join("/")}/${req.responseText.slice(
|
||||
1,
|
||||
-2
|
||||
)}/${pub_key[0]}:${pub_key[1]}`;
|
||||
)}#${pub_key[0]}:${pub_key[1]}`;
|
||||
|
||||
let main_div = element.parentElement.parentElement;
|
||||
main_div.textContent = "";
|
|
@ -4,10 +4,8 @@ from flask import Blueprint, render_template
|
|||
router = Blueprint("file", __name__)
|
||||
|
||||
|
||||
@router.route("<int:file_hash>/<string:key_data>")
|
||||
def file(file_hash: int, key_data: str) -> str:
|
||||
@router.route("<int:file_hash>")
|
||||
def file(file_hash: int) -> str:
|
||||
"""Download page"""
|
||||
print(f"hash : {file_hash}")
|
||||
key = key_data.split(":")
|
||||
print(f"key : {key}")
|
||||
return render_template("index.html", config=Config, download=True)
|
||||
return render_template("download.html", config=Config)
|
||||
|
|
31
src/templates/download.html
Normal file
31
src/templates/download.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{{ config.name }}</title>
|
||||
|
||||
<link rel="stylesheet" href="../styles/style.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header class="text-center">
|
||||
<h1 class="text-title">{{ config.name }}</h1>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<div class="download-area">
|
||||
<h3>Téléchargement</h3>
|
||||
<p>Cliquez pour lancer le téléchargement du fichier</p>
|
||||
<button>Hihi</button>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<p>NPNO</p>
|
||||
</footer>
|
||||
|
||||
<script type="module" src="../js/download.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -30,6 +30,6 @@
|
|||
</footer>
|
||||
|
||||
<script src="https://unpkg.com/node-forge@1.0.0/dist/forge.min.js"></script>
|
||||
<script type="module" src="../js/main.js"></script>
|
||||
<script type="module" src="../js/index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Reference in a new issue