diff --git a/actix/resources/index.html b/actix/resources/index.html index 9fdfdb0..f9809b7 100644 --- a/actix/resources/index.html +++ b/actix/resources/index.html @@ -15,10 +15,10 @@ - + - + @@ -40,6 +40,7 @@
+

 

@@ -49,7 +50,7 @@
- Short URL (click to copy) + Short URL
(click to copy) Long URL Hits × diff --git a/actix/resources/404.html b/actix/resources/static/404.html similarity index 100% rename from actix/resources/404.html rename to actix/resources/static/404.html diff --git a/actix/resources/script.js b/actix/resources/static/script.js similarity index 94% rename from actix/resources/script.js rename to actix/resources/static/script.js index 354a490..8c2675d 100644 --- a/actix/resources/script.js +++ b/actix/resources/static/script.js @@ -48,7 +48,7 @@ const displayData = async (data) => { const table = document.querySelector("#url-table"); if (!window.isSecureContext) { const shortUrlHeader = document.getElementById("short-url-header"); - shortUrlHeader.innerHTML = "Short URL (right click and copy)"; + shortUrlHeader.innerHTML = "Short URL
(right click and copy)"; } table_box.style.visibility = "visible"; table.innerHTML = ''; // Clear @@ -57,10 +57,10 @@ const displayData = async (data) => { }; const showAlert = async (text, col) => { - document.getElementById("alertBox")?.remove(); + document.getElementById("alert-box")?.remove(); const controls = document.querySelector(".pure-controls"); const alertBox = document.createElement("p"); - alertBox.setAttribute("id", "alertBox"); + alertBox.setAttribute("id", "alert-box"); alertBox.setAttribute("style", `color:${col}`); alertBox.innerHTML = text; controls.appendChild(alertBox); @@ -121,7 +121,8 @@ const deleteButton = (shortUrl) => { btn.onclick = e => { e.preventDefault(); if (confirm("Do you want to delete the entry " + shortUrl + "?")) { - document.getElementById("alertBox")?.remove(); + document.getElementById("alert-box")?.remove(); + showAlert(" ", "black"); fetch(`/api/del/${shortUrl}`, { method: "DELETE" }).then(_ => refreshData()); diff --git a/actix/resources/styles.css b/actix/resources/static/styles.css similarity index 100% rename from actix/resources/styles.css rename to actix/resources/static/styles.css diff --git a/actix/src/auth.rs b/actix/src/auth.rs index 9d57339..df09b3f 100644 --- a/actix/src/auth.rs +++ b/actix/src/auth.rs @@ -32,7 +32,7 @@ fn check(token: Option) -> bool { .duration_since(SystemTime::UNIX_EPOCH) .expect("Time went backwards!") .as_secs(); - if token_text == "valid-session-token" && time_now < token_time + 1209600 { + if token_text == "session-token" && time_now < token_time + 1209600 { // There are 1209600 seconds in 14 days true } else { @@ -43,7 +43,7 @@ fn check(token: Option) -> bool { } pub fn gen_token() -> String { - let token_text = "valid-session-token".to_string(); + let token_text = "session-token".to_string(); let time = SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH) .expect("Time went backwards!") diff --git a/actix/src/main.rs b/actix/src/main.rs index 30d444b..d274080 100644 --- a/actix/src/main.rs +++ b/actix/src/main.rs @@ -59,7 +59,7 @@ async fn siteurl(session: Session) -> HttpResponse { // 404 error page #[get("/err/404")] async fn error404() -> impl Responder { - NamedFile::open_async("./resources/404.html").await + NamedFile::open_async("./resources/static/404.html").await } // Handle a given shortlink