an http based roguelike rpg about jelqing
Blame: src/http/meta.rs
782069860236 | atagen | 2026-10-10 12:44 UTC | 1 | //! Resources that do not belong to a single run. |
782069860236 | atagen | 2026-10-10 12:44 UTC | 2 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 3 | use axum::{ |
782069860236 | atagen | 2026-10-10 12:44 UTC | 4 | Json, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 5 | http::{StatusCode, header}, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 6 | response::{IntoResponse, Response}, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 7 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 8 | use rand::Rng; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 9 | use serde_json::{Value, json}; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 10 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 11 | use super::{ |
782069860236 | atagen | 2026-10-10 12:44 UTC | 12 | Shared, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 13 | ctx::Ctx, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 14 | resource::{Resource, Verb}, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 15 | run, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 16 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 17 | use crate::{ |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 18 | game::{ELDER_LAST_MODIFIED, FORUM_THREAD, Run, balance::MM_PER_INCH, forum_thread, volume}, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 19 | headers::X_SEED, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 20 | problem::{PROBLEM_BASE, Problem}, |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 21 | records::Record, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 22 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 23 | |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 24 | use super::registry::hold; |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 25 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 26 | pub static INDEX: Resource<Shared> = Resource::new(&[Verb::new("GET", index)]); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 27 | pub static RUNS: Resource<Shared> = Resource::new(&[Verb::new("POST", create_run)]); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 28 | pub static THREAD: Resource<Shared> = Resource::new(&[Verb::new("GET", thread)]); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 29 | pub static GRAVEYARD: Resource<Shared> = Resource::new(&[Verb::new("GET", graveyard)]); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 30 | pub static LEADERBOARD: Resource<Shared> = Resource::new(&[Verb::new("GET", leaderboard)]); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 31 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 32 | fn index(_: &mut Shared, ctx: &Ctx) -> Response { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 33 | let wants_html = ctx |
782069860236 | atagen | 2026-10-10 12:44 UTC | 34 | .header(header::ACCEPT) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 35 | .is_some_and(|accept| accept.contains("text/html")); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 36 | if wants_html { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 37 | return ( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 38 | StatusCode::SEE_OTHER, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 39 | [(header::LOCATION, "/ui/"), (header::VARY, "Accept")], |
782069860236 | atagen | 2026-10-10 12:44 UTC | 40 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 41 | .into_response(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 42 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 43 | ( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 44 | [(header::VARY, "Accept")], |
782069860236 | atagen | 2026-10-10 12:44 UTC | 45 | Json(json!({ |
782069860236 | atagen | 2026-10-10 12:44 UTC | 46 | "detail": "This is jelqd. It is a roguelike. It is played over HTTP.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 47 | "start": { "href": "/runs", "method": "POST" }, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 48 | "leaderboard": "/leaderboard", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 49 | "graveyard": "/graveyard", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 50 | "forum": FORUM_THREAD, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 51 | "ui": "/ui/", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 52 | })), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 53 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 54 | .into_response() |
782069860236 | atagen | 2026-10-10 12:44 UTC | 55 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 56 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 57 | fn create_run(state: &mut Shared, ctx: &Ctx) -> Response { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 58 | let seeded = ctx.query("seed").is_some(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 59 | let seed = match ctx.query("seed").map(str::parse::<u64>) { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 60 | None => rand::rng().random(), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 61 | Some(Ok(seed)) => seed, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 62 | Some(Err(_)) => { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 63 | return Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 64 | StatusCode::BAD_REQUEST, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 65 | "bad-seed", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 66 | "The seed must be an unsigned 64-bit integer.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 67 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 68 | .into_response(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 69 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 70 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 71 | let config = &state.config; |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 72 | for slot in state.runs.evict_idle(ctx.now, config.idle_ttl) { |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 73 | state.records.save(&Record::of(&hold(&slot))); |
e807266c323b | atagen | 2026-10-12 09:46 UTC | 74 | } |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 75 | if state.runs.len() >= config.max_runs { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 76 | return Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 77 | StatusCode::SERVICE_UNAVAILABLE, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 78 | "server-full", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 79 | "The server is full. Everyone is in there.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 80 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 81 | .header(header::RETRY_AFTER, "600") |
782069860236 | atagen | 2026-10-10 12:44 UTC | 82 | .into_response(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 83 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 84 | let id = loop { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 85 | let id = format!("{:032x}", rand::rng().random::<u128>()); |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 86 | if !state.runs.contains(&id) && state.records.find(&id).is_none() { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 87 | break id; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 88 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 89 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 90 | let public_id = format!("{:08x}", rand::rng().random::<u32>()); |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 91 | let mut run = Run::with_oracle( |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 92 | id.clone(), |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 93 | public_id, |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 94 | config.secret.mix_seed(seed), |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 95 | &config.oracle, |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 96 | ); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 97 | run.seeded = seeded; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 98 | run.last_seen = ctx.now; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 99 | let response = ( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 100 | StatusCode::CREATED, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 101 | [ |
782069860236 | atagen | 2026-10-10 12:44 UTC | 102 | (header::LOCATION, run.path("")), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 103 | (header::ETAG, run.etag()), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 104 | (X_SEED, seed.to_string()), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 105 | ], |
782069860236 | atagen | 2026-10-10 12:44 UTC | 106 | Json(run.view()), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 107 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 108 | .into_response(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 109 | let response = run::finish(&mut run, ctx, &config.secret, response); |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 110 | state.runs.insert(run); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 111 | response |
782069860236 | atagen | 2026-10-10 12:44 UTC | 112 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 113 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 114 | fn thread(_: &mut Shared, ctx: &Ctx) -> Response { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 115 | match ctx.param("year").parse::<u32>() { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 116 | Ok(2009) => ( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 117 | [(header::LAST_MODIFIED, ELDER_LAST_MODIFIED)], |
782069860236 | atagen | 2026-10-10 12:44 UTC | 118 | Json(forum_thread()), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 119 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 120 | .into_response(), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 121 | Ok(year) if year > 2009 => Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 122 | StatusCode::NOT_FOUND, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 123 | "no-thread", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 124 | "Nobody has posted since 2009.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 125 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 126 | .with("thread", FORUM_THREAD) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 127 | .into_response(), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 128 | _ => Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 129 | StatusCode::NOT_FOUND, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 130 | "no-thread", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 131 | "The forum did not exist yet. The problem did.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 132 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 133 | .with("thread", FORUM_THREAD) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 134 | .into_response(), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 135 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 136 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 137 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 138 | fn graveyard(state: &mut Shared, _: &Ctx) -> Response { |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 139 | let dead: Vec<Value> = state |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 140 | .records |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 141 | .dead() |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 142 | .into_iter() |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 143 | .filter_map(|record| { |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 144 | let ending = record.ending?; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 145 | Some(json!({ |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 146 | "public_id": record.public_id, |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 147 | "cause": format!("{PROBLEM_BASE}{}", ending.cause), |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 148 | "detail": ending.detail, |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 149 | "turn": record.turn, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 150 | })) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 151 | }) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 152 | .collect(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 153 | Json(json!({ "runs": dead })).into_response() |
782069860236 | atagen | 2026-10-10 12:44 UTC | 154 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 155 | |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 156 | #[derive(Clone, Copy, PartialEq, Eq)] |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 157 | enum Sort { |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 158 | SelfReported, |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 159 | ContentLength, |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 160 | /// Self-reported length against real girth, the only metric the forum respects. |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 161 | Volume, |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 162 | } |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 163 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 164 | fn leaderboard(state: &mut Shared, ctx: &Ctx) -> Response { |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 165 | let sort = match ctx.query("sort") { |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 166 | None | Some("self-reported-length") => Sort::SelfReported, |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 167 | Some("volume") => Sort::Volume, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 168 | Some("content-length") => match ctx.cookie("ruler") { |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 169 | Some(ruler) if state.config.secret.verify("ruler", ruler) == Some("1") => { |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 170 | Sort::ContentLength |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 171 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 172 | Some(_) => { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 173 | return Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 174 | StatusCode::BAD_REQUEST, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 175 | "exaggeration", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 176 | "The server has measured. Lying is not a technique.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 177 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 178 | .with("cookie", "ruler") |
782069860236 | atagen | 2026-10-10 12:44 UTC | 179 | .into_response(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 180 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 181 | None => { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 182 | return Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 183 | StatusCode::FORBIDDEN, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 184 | "ruler-required", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 185 | "Sorting by the truth requires a Ruler.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 186 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 187 | .into_response(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 188 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 189 | }, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 190 | Some(_) => { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 191 | return Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 192 | StatusCode::BAD_REQUEST, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 193 | "unknown-sort", |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 194 | "The leaderboard sorts by self-reported-length, volume or content-length.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 195 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 196 | .into_response(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 197 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 198 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 199 | let include_seeded = ctx.query("seeded") == Some("include"); |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 200 | let mut entries: Vec<Record> = state.runs.each(Record::of); |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 201 | entries.extend( |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 202 | state |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 203 | .records |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 204 | .all() |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 205 | .into_iter() |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 206 | .filter(|record| !state.runs.contains(&record.id)), |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 207 | ); |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 208 | entries.retain(|record| include_seeded || !record.seeded); |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 209 | let key = |record: &Record| match sort { |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 210 | Sort::SelfReported => record.self_reported, |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 211 | Sort::ContentLength => record.length, |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 212 | Sort::Volume => volume(record.self_reported, record.girth), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 213 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 214 | entries.sort_by(|a, b| key(b).total_cmp(&key(a))); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 215 | let entries: Vec<Value> = entries |
782069860236 | atagen | 2026-10-10 12:44 UTC | 216 | .into_iter() |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 217 | .map(|record| { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 218 | let mut entry = json!({ |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 219 | "public_id": record.public_id, |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 220 | "status": record.status, |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 221 | "floor": record.floor, |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 222 | "self_reported_length": (record.self_reported * 100.0).round() / 100.0, |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 223 | "ranked": !record.seeded, |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 224 | "viral": record.viral, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 225 | }); |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 226 | if sort == Sort::Volume { |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 227 | entry["volume"] = |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 228 | json!((volume(record.self_reported, record.girth) * 100.0).round() / 100.0); |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 229 | } |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 230 | if sort == Sort::ContentLength { |
159f0998263b | atagen | 2026-10-12 11:01 UTC | 231 | entry["content_length"] = json!((record.length * MM_PER_INCH).round()); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 232 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 233 | entry |
782069860236 | atagen | 2026-10-10 12:44 UTC | 234 | }) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 235 | .collect(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 236 | Json(json!({ "entries": entries })).into_response() |
782069860236 | atagen | 2026-10-10 12:44 UTC | 237 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 238 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 239 | pub async fn not_found() -> Problem { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 240 | Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 241 | StatusCode::NOT_FOUND, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 242 | "not-found", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 243 | "The resource does not exist. This is not about you.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 244 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 245 | } |