feat: redirect to store hostname after reset
This commit is contained in:
parent
7f85686d93
commit
5201da5b1b
1 changed files with 10 additions and 4 deletions
14
src/main.rs
14
src/main.rs
|
@ -10,8 +10,8 @@ use actix_web::web::ServiceConfig;
|
|||
use actix_web::HttpResponse;
|
||||
use actix_web::{get, http::header, post, web, App, HttpServer, Responder};
|
||||
use clap::Parser;
|
||||
use url::Url;
|
||||
use log::info;
|
||||
use url::Url;
|
||||
|
||||
fn thirappu(ribbon: &str, store: &str) {
|
||||
let ribbon_link = format!("/etc/nginx/sites-enabled/{ribbon}");
|
||||
|
@ -64,11 +64,17 @@ struct Args {
|
|||
|
||||
impl Display for Args {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "port: {} ribbon: {} store: {} store_weburl: {}", self.port, self.ribbon, self.store, self.store_weburl.to_string())
|
||||
write!(
|
||||
f,
|
||||
"port: {} ribbon: {} store: {} store_weburl: {}",
|
||||
self.port,
|
||||
self.ribbon,
|
||||
self.store,
|
||||
self.store_weburl.to_string()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[get("/reset")]
|
||||
async fn reset_get() -> impl Responder {
|
||||
let reset = include_str!("./reset.html");
|
||||
|
@ -83,7 +89,7 @@ async fn reset_post(ctx: web::Data<Args>) -> impl Responder {
|
|||
reset(&ctx.ribbon, &ctx.store);
|
||||
|
||||
HttpResponse::Found()
|
||||
.append_header((header::LOCATION, "/"))
|
||||
.append_header((header::LOCATION, ctx.store_weburl.to_string()))
|
||||
.finish()
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue