Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/ec/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::path::PathBuf;

type Aes256CbcDec = Decryptor<Aes256>;

const BASE_URL: &str = "https://everybody.codes";
const BASE_URL: &str = "https://api.everybody.codes";

// Due to CDN issues, it was advised to not use the CDN URL anymore.
// See https://www.reddit.com/r/everybodycodes/comments/1p75qfr/2025_please_update_your_tools/
Expand Down Expand Up @@ -91,11 +91,9 @@ impl Client {
pub fn new() -> Result<Self, ClientError> {
let session = Self::read_session()?;
let event = Self::get_event()?;

let http_client = reqwest::blocking::Client::builder()
.build()
.map_err(|e| ClientError::HttpError(e.to_string()))?;

// Check if seed needs to be fetched
let seed = match Self::get_seed() {
Ok(s) => s,
Expand Down Expand Up @@ -158,7 +156,7 @@ impl Client {
}

pub fn fetch_user_seed(&self) -> Result<u32, ClientError> {
let url = format!("{}/api/user/me", BASE_URL);
let url = format!("{}/user/me", BASE_URL);
let response = self
.http_client
.get(&url)
Expand Down Expand Up @@ -214,7 +212,7 @@ impl Client {
}

pub fn fetch_decryption_key(&self, quest: u8, part: u8) -> Result<String, ClientError> {
let url = format!("{}/api/event/{}/quest/{}", BASE_URL, self.event, quest);
let url = format!("{}/event/{}/quest/{}", BASE_URL, self.event, quest);

let response = self
.http_client
Expand Down Expand Up @@ -280,7 +278,7 @@ impl Client {

pub fn submit_answer(&self, quest: u8, part: u8, answer: &str) -> Result<String, ClientError> {
let url = format!(
"{}/api/event/{}/quest/{}/part/{}/answer",
"{}/event/{}/quest/{}/part/{}/answer",
BASE_URL, self.event, quest, part
);

Expand Down