Count number of hits

This commit is contained in:
SinTan1729
2023-04-03 15:46:22 -05:00
parent 046c6d63a4
commit 618fd0e53a
6 changed files with 102 additions and 67 deletions

View File

@@ -23,8 +23,7 @@ async fn getall() -> HttpResponse {
// Get the site URL
#[get("/api/siteurl")]
async fn siteurl() -> HttpResponse {
let site_url = env::var("site_url").unwrap_or(String::from("unset"));
println!("{site_url}");
let site_url = env::var("site_url").unwrap_or("unset".to_string());
HttpResponse::Ok().body(site_url)
}
@@ -38,7 +37,7 @@ async fn error404() -> impl Responder {
#[get("/{shortlink}")]
async fn link_handler(shortlink: web::Path<String>) -> impl Responder {
let longlink = utils::get_longurl(shortlink);
if longlink == String::from("") {
if longlink == "".to_string() {
Redirect::to("/err/404")
} else {
Redirect::to(longlink).permanent()