this repo has no description
0
fork

Configure Feed

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

small changes here and there

+19 -61
-9
shared/challenges_markdown/two/part_one.md
··· 29 29 Using what you learned from day 1 find the following record `{{at_uri}}` and enter the verification code 30 30 found in the record 31 31 for it below 32 - 33 - ```json 34 - { 35 - "$type": "codes.advent.challenge.day", 36 - "partOne": "{{code}}" 37 - } 38 - ``` 39 - 40 - [//]: # (<input type="file" id="part_one_input" placeholder="Enter your code here" />)
+16 -49
shared/src/advent/challenges/day_two.rs
··· 29 29 true 30 30 } 31 31 32 + fn requires_manual_verification_part_one(&self) -> bool { 33 + true 34 + } 35 + 32 36 /// Create a record via the challenge agent and return the at_uri as additional context 33 37 async fn build_additional_context( 34 38 &self, ··· 56 60 }; 57 61 let known_record: KnownRecord = record_data.into(); 58 62 let record_value: atrium_api::types::Unknown = known_record.into(); 59 - 60 - // Use a unique rkey per user based on the did to avoid collisions 61 - // let rkey = did.replace(":", "_").replace(".", "_"); 62 63 63 64 let create_record_result = agent 64 65 .api ··· 93 94 async fn check_part_one( 94 95 &self, 95 96 did: String, 96 - _verification_code: Option<String>, 97 + verification_code: Option<String>, 97 98 ) -> Result<ChallengeCheckResponse, AdventError> { 98 - let client = self 99 - .oauth_client 100 - .as_ref() 101 - .ok_or(AdventError::ShouldNotHappen( 102 - "No oauth client. This should not happen".to_string(), 103 - ))?; 104 - 105 - let record_res = client 106 - .api 107 - .com 108 - .atproto 109 - .repo 110 - .get_record( 111 - atrium_api::com::atproto::repo::get_record::ParametersData { 112 - cid: None, 113 - collection: advent::challenge::Day::NSID.parse().unwrap(), 114 - repo: did.parse().unwrap(), 115 - rkey: "1".parse().unwrap(), 116 - } 117 - .into(), 118 - ) 119 - .await; 120 - 121 - let record = match record_res { 122 - Ok(r) => r, 123 - Err(e) => { 124 - log::error!("Error getting record: {}", e); 125 - return Ok(ChallengeCheckResponse::Incorrect("Does not appear to be a record in your repo in the collection codes.advent.challenge.day with the record key of 1".to_string())); 99 + let submitted_code = match verification_code { 100 + Some(code) if !code.is_empty() => code, 101 + _ => { 102 + return Ok(ChallengeCheckResponse::Incorrect( 103 + "Please enter a verification code".to_string(), 104 + )); 126 105 } 127 106 }; 128 107 129 108 let Some(challenge) = self.get_days_challenge(&did).await? else { 130 - log::error!("Could not find a challenge record for day: 1 for the user: {did:?}"); 109 + log::error!("Could not find a challenge record for day: 2 for the user: {did:?}"); 131 110 return Err(AdventError::ShouldNotHappen( 132 111 "Could not find challenge record".to_string(), 133 112 )); 134 113 }; 135 114 136 - let record_data = match safe_check_unknown_record_parse::<advent::challenge::day::RecordData>( 137 - record.value.clone(), 138 - ) { 139 - Ok(rd) => rd, 140 - Err(e) => { 141 - log::error!("Error parsing record: {e}"); 142 - return Ok(ChallengeCheckResponse::Incorrect(format!( 143 - "There is a record at the correct location, but it does not seem like it is correct. Try again:\n{e}" 144 - ))); 145 - } 146 - }; 147 - 148 - let verification_code = 115 + let expected_code = 149 116 challenge 150 117 .verification_code_one 151 118 .ok_or(AdventError::ShouldNotHappen( 152 - "no verification code for day 1 challenge :/".to_string(), 119 + "no verification code for day 2 challenge".to_string(), 153 120 ))?; 154 121 155 - Ok(if record_data.part_one == verification_code { 122 + Ok(if submitted_code == expected_code { 156 123 ChallengeCheckResponse::Correct 157 124 } else { 158 125 ChallengeCheckResponse::Incorrect(format!( 159 126 "The code {} is incorrect", 160 - record_data.part_one 127 + submitted_code 161 128 )) 162 129 }) 163 130 }
+3 -3
web/templates/index.askama.html
··· 3 3 {% block content %} 4 4 <div class="card bg-base-100 shadow-xl mb-8"> 5 5 <div class="card-body"> 6 - <h2 class="card-title text-3xl font-bold">Welcome to AT Protocol Advent! 🎄</h2> 7 - <p class="text-base-content">Complete daily challenges throughout December to learn about the AT Protocol.</p> 6 + <h2 class="card-title text-3xl font-bold">Welcome to atproto advent! 🎄</h2> 7 + <p class="text-base-content">Complete <s>daily</s> challenges throughout <s>December</s> March 27th to learn about the atprotocol.</p> 8 8 </div> 9 9 </div> 10 10 ··· 24 24 25 25 <style> 26 26 .day-btn-partial { 27 - background: linear-gradient(135deg, #22c55e 0%, #22c55e 50%, #ef4444 50%, #ef4444 100%) !important; 27 + background: linear-gradient(135deg, #00a96e 0%, #00a96e 50%, #ff5861 50%, #ff5861 100%) !important; 28 28 color: white; 29 29 } 30 30