diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/.gitignore b/.gitignore index 0cd7db5..33cc4d7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ **/*.rs.bk serveurhttp test +.env diff --git a/assets/tailwind.css b/assets/tailwind.css index 0af5088..d5f91da 100644 --- a/assets/tailwind.css +++ b/assets/tailwind.css @@ -164,18 +164,12 @@ .visible { visibility: visible; } - .m-0 { - margin: calc(var(--spacing) * 0); - } .hidden { display: none; } .table { display: table; } - .w-1 { - width: calc(var(--spacing) * 1); - } .transform { transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,); } @@ -188,9 +182,6 @@ .px-2 { padding-inline: calc(var(--spacing) * 2); } - .ps-6 { - padding-inline-start: calc(var(--spacing) * 6); - } .text-4xl { font-size: var(--text-4xl); line-height: var(--tw-leading, var(--text-4xl--line-height)); diff --git a/shell.nix b/shell.nix index 886a391..1bf133b 100644 --- a/shell.nix +++ b/shell.nix @@ -13,4 +13,11 @@ pkgs.mkShell { lld ]; PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; + + shellHook = '' + source .env + + ''; + + UPLOAD_FOLDER="./test/"; } diff --git a/src/views/upload.rs b/src/views/upload.rs index 5b8e46e..c5c6a77 100644 --- a/src/views/upload.rs +++ b/src/views/upload.rs @@ -133,20 +133,19 @@ pub fn Upload() -> Element { } } } - input { id: "file", r#type : "file" ,multiple: true, class : "hidden", oninput: move |e| async move { - for file in e.files() { - selected.with_mut(|files| {files.push((file.name(), byte_to_human_size(file.size()), None)); } ); - let idx = selected().len() - 1; - - if (file.size() > UPLOAD_SIZE_LIMIT) { - //messy but firefox can't handle when server returns early - selected.with_mut(|files| { files[idx].2 = Some(HttpError::payload_too_large("This file is too large")) }); - continue; - } - - let res = upload_file(file.clone().into()).await; - selected.with_mut(|files| { files[idx].2 = Some(res) }); + input { id: "file", r#type : "file" ,multiple: false, class : "hidden", oninput: move |e| async move { + let file = &e.files()[0]; + selected.with_mut(|files| {files.push((file.name(), byte_to_human_size(file.size()), None)); } ); + let idx = selected().len() - 1; + + if (file.size() > UPLOAD_SIZE_LIMIT) { + //messy but firefox can't handle when server returns early + selected.with_mut(|files| { files[idx].2 = Some(HttpError::payload_too_large("This file is too large")) }); + return ; } + + let res = upload_file(file.clone().into()).await; + selected.with_mut(|files| { files[idx].2 = Some(res) }); }} } }