add direnv

This commit is contained in:
2026-03-27 11:36:29 +01:00
parent cd030a6c44
commit 3f555079aa
5 changed files with 21 additions and 22 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use nix

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
**/*.rs.bk **/*.rs.bk
serveurhttp serveurhttp
test test
.env

View File

@ -164,18 +164,12 @@
.visible { .visible {
visibility: visible; visibility: visible;
} }
.m-0 {
margin: calc(var(--spacing) * 0);
}
.hidden { .hidden {
display: none; display: none;
} }
.table { .table {
display: table; display: table;
} }
.w-1 {
width: calc(var(--spacing) * 1);
}
.transform { .transform {
transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,); 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 { .px-2 {
padding-inline: calc(var(--spacing) * 2); padding-inline: calc(var(--spacing) * 2);
} }
.ps-6 {
padding-inline-start: calc(var(--spacing) * 6);
}
.text-4xl { .text-4xl {
font-size: var(--text-4xl); font-size: var(--text-4xl);
line-height: var(--tw-leading, var(--text-4xl--line-height)); line-height: var(--tw-leading, var(--text-4xl--line-height));

View File

@ -13,4 +13,11 @@ pkgs.mkShell {
lld lld
]; ];
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
shellHook = ''
source .env
'';
UPLOAD_FOLDER="./test/";
} }

View File

@ -133,20 +133,19 @@ pub fn Upload() -> Element {
} }
} } } }
input { id: "file", r#type : "file" ,multiple: true, class : "hidden", oninput: move |e| async move { input { id: "file", r#type : "file" ,multiple: false, class : "hidden", oninput: move |e| async move {
for file in e.files() { let file = &e.files()[0];
selected.with_mut(|files| {files.push((file.name(), byte_to_human_size(file.size()), None)); } ); selected.with_mut(|files| {files.push((file.name(), byte_to_human_size(file.size()), None)); } );
let idx = selected().len() - 1; let idx = selected().len() - 1;
if (file.size() > UPLOAD_SIZE_LIMIT) { if (file.size() > UPLOAD_SIZE_LIMIT) {
//messy but firefox can't handle when server returns early //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")) }); selected.with_mut(|files| { files[idx].2 = Some(HttpError::payload_too_large("This file is too large")) });
continue; return ;
} }
let res = upload_file(file.clone().into()).await; let res = upload_file(file.clone().into()).await;
selected.with_mut(|files| { files[idx].2 = Some(res) }); selected.with_mut(|files| { files[idx].2 = Some(res) });
}
}} }}
} }
} }