pub mod provider;
pub mod threads;
use axum::{
extract::RawQuery,
http::{HeaderValue, StatusCode},
response::IntoResponse,
};
pub async fn login_redirect() -> impl IntoResponse {
(
StatusCode::FOUND,
[(
axum::http::header::LOCATION,
HeaderValue::from_static("https://ampcode.com/login"),
)],
)
}
pub async fn cli_login_redirect(RawQuery(query): RawQuery) -> impl IntoResponse {
let url = match query {
Some(q) => format!("https://ampcode.com/auth/cli-login?{q}"),
None => "https://ampcode.com/auth/cli-login".to_string(),
};
let location = HeaderValue::from_str(&url)
.unwrap_or_else(|_| HeaderValue::from_static("https://ampcode.com/amp/auth/cli-login"));
(
StatusCode::FOUND,
[(axum::http::header::LOCATION, location)],
)
}