gatherer: add host to store when having token
This commit is contained in:
parent
cda567d0bc
commit
dd3dabf356
|
@ -48,16 +48,18 @@ pub struct OAuthCode {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_token_collect(
|
pub async fn get_token_collect(
|
||||||
Extension(ServerState { db, http_client, .. }): Extension<ServerState>,
|
Extension(ServerState { db, http_client, mut store, .. }): Extension<ServerState>,
|
||||||
extract::Path(host): extract::Path<String>,
|
extract::Path(host): extract::Path<String>,
|
||||||
extract::Query(OAuthCode { code }): extract::Query<OAuthCode>,
|
extract::Query(OAuthCode { code }): extract::Query<OAuthCode>,
|
||||||
) -> impl IntoResponse {
|
) -> impl IntoResponse {
|
||||||
match collect_token(db, &http_client, &host, code.clone()).await {
|
match collect_token(db, &http_client, &host, code.clone()).await {
|
||||||
Ok(()) =>
|
Ok(()) => {
|
||||||
|
let _ = store.save_host(&host).await;
|
||||||
(
|
(
|
||||||
StatusCode::SEE_OTHER,
|
StatusCode::SEE_OTHER,
|
||||||
[("location", "/token/thanks")]
|
[("location", "/token/thanks")]
|
||||||
).into_response(),
|
).into_response()
|
||||||
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::error!("{}", e);
|
tracing::error!("{}", e);
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -14,7 +14,6 @@ pub async fn get_token_donate() -> impl IntoResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Deserialize, Debug)]
|
#[derive(serde::Deserialize, Debug)]
|
||||||
//#[allow(dead_code)]
|
|
||||||
pub struct TokenDonateForm {
|
pub struct TokenDonateForm {
|
||||||
instance: String,
|
instance: String,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user