···2929Using what you learned from day 1 find the following record `{{at_uri}}` and enter the verification code
3030found in the record
3131for it below
3232-3333-```json
3434-{
3535- "$type": "codes.advent.challenge.day",
3636- "partOne": "{{code}}"
3737-}
3838-```
3939-4040-[//]: # (<input type="file" id="part_one_input" placeholder="Enter your code here" />)
+16-49
shared/src/advent/challenges/day_two.rs
···2929 true
3030 }
31313232+ fn requires_manual_verification_part_one(&self) -> bool {
3333+ true
3434+ }
3535+3236 /// Create a record via the challenge agent and return the at_uri as additional context
3337 async fn build_additional_context(
3438 &self,
···5660 };
5761 let known_record: KnownRecord = record_data.into();
5862 let record_value: atrium_api::types::Unknown = known_record.into();
5959-6060- // Use a unique rkey per user based on the did to avoid collisions
6161- // let rkey = did.replace(":", "_").replace(".", "_");
62636364 let create_record_result = agent
6465 .api
···9394 async fn check_part_one(
9495 &self,
9596 did: String,
9696- _verification_code: Option<String>,
9797+ verification_code: Option<String>,
9798 ) -> Result<ChallengeCheckResponse, AdventError> {
9898- let client = self
9999- .oauth_client
100100- .as_ref()
101101- .ok_or(AdventError::ShouldNotHappen(
102102- "No oauth client. This should not happen".to_string(),
103103- ))?;
104104-105105- let record_res = client
106106- .api
107107- .com
108108- .atproto
109109- .repo
110110- .get_record(
111111- atrium_api::com::atproto::repo::get_record::ParametersData {
112112- cid: None,
113113- collection: advent::challenge::Day::NSID.parse().unwrap(),
114114- repo: did.parse().unwrap(),
115115- rkey: "1".parse().unwrap(),
116116- }
117117- .into(),
118118- )
119119- .await;
120120-121121- let record = match record_res {
122122- Ok(r) => r,
123123- Err(e) => {
124124- log::error!("Error getting record: {}", e);
125125- 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()));
9999+ let submitted_code = match verification_code {
100100+ Some(code) if !code.is_empty() => code,
101101+ _ => {
102102+ return Ok(ChallengeCheckResponse::Incorrect(
103103+ "Please enter a verification code".to_string(),
104104+ ));
126105 }
127106 };
128107129108 let Some(challenge) = self.get_days_challenge(&did).await? else {
130130- log::error!("Could not find a challenge record for day: 1 for the user: {did:?}");
109109+ log::error!("Could not find a challenge record for day: 2 for the user: {did:?}");
131110 return Err(AdventError::ShouldNotHappen(
132111 "Could not find challenge record".to_string(),
133112 ));
134113 };
135114136136- let record_data = match safe_check_unknown_record_parse::<advent::challenge::day::RecordData>(
137137- record.value.clone(),
138138- ) {
139139- Ok(rd) => rd,
140140- Err(e) => {
141141- log::error!("Error parsing record: {e}");
142142- return Ok(ChallengeCheckResponse::Incorrect(format!(
143143- "There is a record at the correct location, but it does not seem like it is correct. Try again:\n{e}"
144144- )));
145145- }
146146- };
147147-148148- let verification_code =
115115+ let expected_code =
149116 challenge
150117 .verification_code_one
151118 .ok_or(AdventError::ShouldNotHappen(
152152- "no verification code for day 1 challenge :/".to_string(),
119119+ "no verification code for day 2 challenge".to_string(),
153120 ))?;
154121155155- Ok(if record_data.part_one == verification_code {
122122+ Ok(if submitted_code == expected_code {
156123 ChallengeCheckResponse::Correct
157124 } else {
158125 ChallengeCheckResponse::Incorrect(format!(
159126 "The code {} is incorrect",
160160- record_data.part_one
127127+ submitted_code
161128 ))
162129 })
163130 }
+3-3
web/templates/index.askama.html
···33{% block content %}
44 <div class="card bg-base-100 shadow-xl mb-8">
55 <div class="card-body">
66- <h2 class="card-title text-3xl font-bold">Welcome to AT Protocol Advent! 🎄</h2>
77- <p class="text-base-content">Complete daily challenges throughout December to learn about the AT Protocol.</p>
66+ <h2 class="card-title text-3xl font-bold">Welcome to atproto advent! 🎄</h2>
77+ <p class="text-base-content">Complete <s>daily</s> challenges throughout <s>December</s> March 27th to learn about the atprotocol.</p>
88 </div>
99 </div>
1010···24242525 <style>
2626 .day-btn-partial {
2727- background: linear-gradient(135deg, #22c55e 0%, #22c55e 50%, #ef4444 50%, #ef4444 100%) !important;
2727+ background: linear-gradient(135deg, #00a96e 0%, #00a96e 50%, #ff5861 50%, #ff5861 100%) !important;
2828 color: white;
2929 }
3030