Add admin button to update repo
This commit is contained in:
parent
6cf7a0b586
commit
4f2b0a0b88
9 changed files with 69 additions and 15 deletions
29
src/server/web/admin/repo.rs
Normal file
29
src/server/web/admin/repo.rs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use axum::{
|
||||
extract::State,
|
||||
response::{IntoResponse, Redirect},
|
||||
};
|
||||
use log::info;
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
use crate::{
|
||||
config::ServerConfig,
|
||||
server::web::{
|
||||
base::Base,
|
||||
paths::{PathAdminRepoUpdate, PathIndex},
|
||||
},
|
||||
somehow,
|
||||
};
|
||||
|
||||
pub async fn post_admin_repo_update(
|
||||
_path: PathAdminRepoUpdate,
|
||||
State(config): State<&'static ServerConfig>,
|
||||
State(recurring_tx): State<Arc<mpsc::UnboundedSender<()>>>,
|
||||
) -> somehow::Result<impl IntoResponse> {
|
||||
let _ = recurring_tx.send(());
|
||||
info!("Admin updated repo");
|
||||
|
||||
let link = Base::link_with_config(config, PathIndex {});
|
||||
Ok(Redirect::to(&link.to_string()))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue