aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/routes.rs6
-rw-r--r--src/static/main.js4
-rw-r--r--src/templates.rs2
3 files changed, 6 insertions, 6 deletions
diff --git a/src/routes.rs b/src/routes.rs
index fed3067..c48ec24 100644
--- a/src/routes.rs
+++ b/src/routes.rs
@@ -41,9 +41,9 @@ pub async fn routes(
include_str!("static/main.css").to_string(),
"text/css",
)),
- (&Method::POST, [""]) => upload_file(request, db_conn, authorized_key, files_dir).await,
- (&Method::GET, [file_id]) => get(db_conn, file_id, GetFile::ShowPage, files_dir).await,
- (&Method::GET, [file_id, "download"]) => {
+ (&Method::POST, ["upload"]) => upload_file(request, db_conn, authorized_key, files_dir).await,
+ (&Method::GET, ["share", file_id]) => get(db_conn, file_id, GetFile::ShowPage, files_dir).await,
+ (&Method::GET, ["share", file_id, "download"]) => {
get(db_conn, file_id, GetFile::Download, files_dir).await
}
_ => Ok(not_found()),
diff --git a/src/static/main.js b/src/static/main.js
index 40e62d6..b3ed57b 100644
--- a/src/static/main.js
+++ b/src/static/main.js
@@ -28,10 +28,10 @@ window.onload = function() {
// Wait a bit to prevent showing the loader too briefly
setTimeout(function() {
const xhr = new XMLHttpRequest()
- xhr.open('POST', '/', true)
+ xhr.open('POST', '/upload', true)
xhr.onload = function () {
if (xhr.status === 200) {
- window.location = `/${xhr.responseText}`
+ window.location = `/share/${xhr.responseText}`
} else {
showError(`Error uploading: ${xhr.status}`)
}
diff --git a/src/templates.rs b/src/templates.rs
index b551bf6..9fd2162 100644
--- a/src/templates.rs
+++ b/src/templates.rs
@@ -109,7 +109,7 @@ pub const INTERNAL_SERVER_ERROR: &str = const_format::concatcp!(
);
pub fn file_page(file: File) -> String {
- let href = format!("{}/download", file.id);
+ let href = format!("/share/{}/download", file.id);
let expiration = file.expires_at.signed_duration_since(Local::now());
format!(