this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

handle max car size

phil 844f0f25 25561062

+12 -2
+11 -1
shared/challenges_markdown/three/part_two.md
··· 11 11 12 12 (TODO: we're not checking the signature, right? are we checking CID?) 13 13 14 - <form method="post" action="/day/3/upload-car" enctype="multipart/form-data"> 14 + <form id="car-upload" method="post" action="/day/3/upload-car" enctype="multipart/form-data"> 15 15 <div class="flex items-center gap-4"> 16 16 <input type="file" name="car_file" accept=".car" class="file-input file-input-bordered w-full max-w-xs" required /> 17 17 <button type="submit" class="btn btn-primary">Inspect your CAR</button> 18 18 </div> 19 19 </form> 20 + 21 + <script> 22 + document.getElementById('car-upload').addEventListener('submit', function(e) { 23 + const file = this.querySelector('input[type=file]').files[0]; 24 + if (file && file.size > 2 * Math.pow(2, 20)) { 25 + e.preventDefault(); 26 + alert('That car sure looks like a big vehicle (max 2MB)'); 27 + } 28 + }); 29 + </script>
+1 -1
web/src/main.rs
··· 288 288 ) 289 289 .route( 290 290 "/day/3/upload-car", 291 - post(handlers::custom::day_three::inspect_car), 291 + post(handlers::custom::day_three::inspect_car) // 2MB max for default axum 292 292 ) 293 293 .route( 294 294 "/day/5/{user_did}",