Add redirect to the new interface

This commit is contained in:
2021-08-12 15:48:02 +02:00
committed by dietrich
parent b9a02b1740
commit 2b276a5130
2 changed files with 11 additions and 1 deletions
+2 -1
View File
@@ -166,7 +166,8 @@ pub async fn webservice(
web::post().to(views::get_logged_user_json),
)
.route("/login_user/", web::post().to(views::process_login_json)),
),
)
.default_service(web::to(views::to_admin)),
)
// Serve the Wasm App for the admin interface.
.service(
+9
View File
@@ -308,6 +308,15 @@ pub async fn logout(id: Identity) -> Result<HttpResponse, ServerError> {
Ok(redirect_builder("/app/"))
}
#[instrument()]
pub async fn to_admin() -> Result<HttpResponse, ServerError> {
let response = HttpResponse::PermanentRedirect()
.set_header(actix_web::http::header::LOCATION, "/app/")
.body(r#"The admin interface moved to <a href="/app/">/app/</a>"#);
Ok(response)
}
#[instrument()]
pub async fn redirect(
config: web::Data<crate::ServerConfig>,