feat: redirect to store hostname after reset

This commit is contained in:
Aravinth Manivannan 2024-03-20 17:56:41 +05:30
parent 7f85686d93
commit 5201da5b1b
Signed by: realaravinth
GPG key ID: F8F50389936984FF

View file

@ -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()
}