1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Add basic auth support to get Cardlife working in non-offline mode

This commit is contained in:
NGnius (Graham)
2025-01-25 17:40:47 -05:00
commit fe2816e9d3
13 changed files with 3714 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
//! Not a temporary file, this is the name of the endpoint
use rocket::{post, routes, serde::json::Json};
#[post("/api/auth/temporarygetuserid", data = "<body>")]
pub fn temp_migration(body: Json<libfj::cardlife::TempGetUserIdPayload>) -> Json<libfj::cardlife::TempGetUserIdResponse> {
Json(libfj::cardlife::TempGetUserIdResponse {
public_id: body.public_id.to_owned(),
token: body.token.to_owned(),
user_id: 123456, // FIXME
})
}
pub fn stage() -> rocket::fairing::AdHoc {
rocket::fairing::AdHoc::on_ignite("CardLife Temp UserId", |rocket| async {
rocket.mount("/", routes![temp_migration])
})
}