this repo has no description

words for day 3 part 2 (+hide the submit button)

+41 -12
+22 -11
shared/challenges_markdown/three/part_two.md
··· 1 - TODO: need to explain what the MST is! 1 + Now to really get your hands dirty. It's time to build your own CAR. 2 2 3 - make a valid CAR file and upload it 3 + The CAR libraries listed in **Part one** above can help with this, or you can hand-craft every byte if you're that hardcore. 4 4 5 - the inspection will check for: 5 + Your CAR just needs to have one very specific record to pass this challenge: 6 6 7 7 - **Collection:** `codes.advent.challenge.day` 8 - - **Record key:** `three` 9 - - **Field:** `verificationCode` set to `{{code}}` 8 + - **Rkey:** `three` 10 9 11 - any valid DID will do for the commit, and the signature won't be checked 10 + Inside the record, we'll be looking for: 11 + 12 + - `"verificationCode": "{{code}}"` 13 + 14 + Any valid `DID` will do for the commit, and the signature won't be verified. 15 + 12 16 13 17 <form id="car-upload" method="post" action="/day/3/upload-car" enctype="multipart/form-data"> 14 18 <div id="drop-zone" style="border-radius: 0.5rem; padding: 1.25rem 1.5rem; text-align: center; cursor: pointer; max-width: 28rem;"> 15 - <p id="drop-label" style="display: flex; align-items: center; gap: 0.75rem; margin: 0"> 16 - Drop your car off here <small style="opacity: 0.667">(or click to browse)</small> 19 + <p id="drop-label" style="display: flex; align-items: center; gap: 0.75rem; margin: 0; color: var(--color-primary)"> 20 + Drop your CAR off here <small style="opacity: 0.667">(or click to browse)</small> 17 21 </p> 18 22 <div id="drop-file-name" class="hidden" style="font-family: monospace; font-size: 0.875rem;"></div> 19 23 <input id="car-input" type="file" name="car_file" accept=".car" class="hidden" required /> 20 24 </div> 21 25 </form> 22 - 23 - TODO: remove the "check answer" button 24 26 25 27 <script> 26 28 (function() { ··· 73 75 } 74 76 #drop-zone.dragging, 75 77 #drop-zone:hover { 76 - background: hsla(0, 0%, 50%, 0.333); 78 + background: hsla(0, 0%, 50%, 0.2); 77 79 border-color: #22c55e; 78 80 } 79 81 #drop-label { ··· 84 86 opacity: 1; 85 87 } 86 88 </style> 89 + 90 + 91 + <hr/> 92 + 93 + <details> 94 + <summary>MAJOR CHEATING hint for part 2</summary> 95 + 96 + So&hellip; we really want you to build your own car. But. Tools like `goat` and `PDSls` do have a "download repo" function, and also a "create record" function, 👀 97 + </details>
+4
shared/src/advent/challenges/day_three/day_three.rs
··· 31 31 true 32 32 } 33 33 34 + fn custom_submit_part_two(&self) -> bool { 35 + true 36 + } 37 + 34 38 /// inject the car right on the page :sicko: 35 39 async fn markdown_text_part_one( 36 40 &self,
+6
shared/src/advent/mod.rs
··· 140 140 false 141 141 } 142 142 143 + /// Does this challenge's part two have its own submit mechanism? 144 + /// Default is false (render the normal submit button) 145 + fn custom_submit_part_two(&self) -> bool { 146 + false 147 + } 148 + 143 149 /// The text Markdown for challenge 1 144 150 async fn markdown_text_part_one( 145 151 &self,
+4
web/src/handlers/day.rs
··· 192 192 193 193 let requires_code_input_part_one = challenge.requires_manual_verification_part_one(); 194 194 let requires_code_input_part_two = challenge.requires_manual_verification_part_two(); 195 + let custom_submit_part_two = challenge.custom_submit_part_two(); 195 196 let is_logged_in = session.logged_in(); 196 197 197 198 let template = match status { ··· 206 207 part_two_submit_message: part_two_flash, 207 208 requires_code_input_part_one, 208 209 requires_code_input_part_two, 210 + custom_submit_part_two, 209 211 is_logged_in, 210 212 }, 211 213 CompletionStatus::PartOne => { ··· 222 224 part_two_submit_message: part_two_flash, 223 225 requires_code_input_part_one, 224 226 requires_code_input_part_two, 227 + custom_submit_part_two, 225 228 is_logged_in, 226 229 } 227 230 } ··· 238 241 part_two_submit_message: part_two_flash, 239 242 requires_code_input_part_one, 240 243 requires_code_input_part_two, 244 + custom_submit_part_two, 241 245 is_logged_in, 242 246 } 243 247 }
+3
web/src/templates/day.rs
··· 19 19 pub requires_code_input_part_one: bool, 20 20 pub requires_code_input_part_two: bool, 21 21 22 + // prevent rendering the default "Check answer" button 23 + pub custom_submit_part_two: bool, 24 + 22 25 pub is_logged_in: bool, 23 26 }
+2 -1
web/templates/day.askama.html
··· 109 109 <div class="card-actions justify-start mt-4"> 110 110 {% if !is_logged_in %} 111 111 <a href="/login" class="btn btn-primary">Login to complete challenges</a> 112 - {% else if !challenge_two_completed %} 112 + {% else if !challenge_two_completed && !custom_submit_part_two %} 113 113 <form method="post" action="/day/{{ day }}"> 114 114 {% if requires_code_input_part_two %} 115 115 <div class="join"> ··· 125 125 <button class="btn btn-primary" type="submit">Check answer</button> 126 126 {% endif %} 127 127 </form> 128 + {% else if !challenge_two_completed %} 128 129 {% else %} 129 130 <div class="badge badge-success badge-lg gap-2"> 130 131 <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="inline-block w-4 h-4 stroke-current"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg>