From ae6eaa6c53e30fd3e7ec0b122a874033a78d964b Mon Sep 17 00:00:00 2001 From: Yakov5776 Date: Tue, 11 Oct 2022 23:10:02 -0400 Subject: [PATCH] Add hidden service and downloads page --- README.md | 5 +++-- docs/assets/Download.js | 27 +++++++++++++++++++++++++++ docs/assets/download-24.png | Bin 0 -> 239 bytes docs/hidden/Download.md | 20 ++++++++++++++++++++ mkdocs.yml | 5 +++++ 5 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 docs/assets/Download.js create mode 100644 docs/assets/download-24.png create mode 100644 docs/hidden/Download.md diff --git a/README.md b/README.md index 5aff317..4ae857c 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,11 @@ TODO # How do I build this? This project uses material mkdocs. -To install materal mkdocs, simply run: +To install materal mkdocs (and it's dependencies), simply run: pip install mkdocs-material - + pip install mkdocs-exclude-search + Then run `mkdocs serve` to preview it. You can also build it into static html files using `mkdocs build`. \ No newline at end of file diff --git a/docs/assets/Download.js b/docs/assets/Download.js new file mode 100644 index 0000000..e409c8b --- /dev/null +++ b/docs/assets/Download.js @@ -0,0 +1,27 @@ +let dlText = document.getElementById("download-text"); +let descText = document.getElementById("description-text"); + +const hash = window.location.hash.substr(1); + +if (!hash || hash === "" || hash.length !== 64) redirect404(); + +fetch("/api/getFile?id=" + hash).then(function(response) { + return response.json(); + }).then(function(data) {setupPage(data)}); + +function setupPage(data) { + if (data["Error"]) redirect404(); + + dlText.innerText = `Download '${data["Name"]}'`; + descText.innerText = data["Description"]; +} + + +function redirect404() { + window.location.replace("/404"); + throw new Error("404"); +} + +function downloadFile() { + window.location.href = "/api/dlFile?id=" + hash; +} \ No newline at end of file diff --git a/docs/assets/download-24.png b/docs/assets/download-24.png new file mode 100644 index 0000000000000000000000000000000000000000..428104dc13d9cc48a55b42b2c26dd3d214df10e8 GIT binary patch literal 239 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE)4%caKYZ?lYt^jJY5_^ zJUZWAJ;-^;K&1WSmEePy1Z9?4dkDsy@RV5`S0ZpeFW}*G)u~#dy)OQL5ASaIzE8ig zrNux!{lY@;nUR08j5jBU{c&s%I%~}!HRWX5n+uC&*V@{cY}uIpy*HtgdEE^=?hSn( zgkPl`oRT7t(%7$3%JOx`kyFg`Ely6T`7m+GF~hL9A09yqy=H30HJB;3gf99YBXacL l;&T