From 83bcf39bad4a2c0d6c74d59bebed74aa244a4846 Mon Sep 17 00:00:00 2001 From: nickfarrow Date: Tue, 8 Nov 2022 23:23:10 +1100 Subject: [PATCH] Move site from pj to server root Moves nolooking website from `/pj` to `/`, while keeping the payjoin POST `/pj` and other endpoints the same. --- src/http.rs | 8 ++++---- static/index.html | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/http.rs b/src/http.rs index ef3f871..fa8444c 100644 --- a/src/http.rs +++ b/src/http.rs @@ -48,14 +48,14 @@ async fn handle_web_req( use std::path::Path; match (req.method(), req.uri().path()) { - (&Method::GET, "/pj") => { + (&Method::GET, "/") => { let index = std::fs::read(Path::new(STATIC_DIR).join("index.html")).expect("can't open index"); Ok(Response::new(Body::from(index))) } - (&Method::GET, path) if path.starts_with("/pj/static/") => { - let directory_traversal_vulnerable_path = &path[("/pj/static/".len())..]; + (&Method::GET, path) if path.starts_with("/static/") => { + let directory_traversal_vulnerable_path = &path[("/static/".len())..]; let file = std::fs::read(Path::new(STATIC_DIR).join(directory_traversal_vulnerable_path)) .expect("can't open static file"); @@ -88,7 +88,7 @@ async fn handle_web_req( Ok(Response::new(Body::from(proposal_psbt))) } - (&Method::POST, "/pj/schedule") => { + (&Method::POST, "/schedule") => { let bytes = hyper::body::to_bytes(req.into_body()).await?; // deserialize x-www-form-urlencoded data with non-strict encoded "channel[arrayindex]" let conf = serde_qs::Config::new(2, false); diff --git a/static/index.html b/static/index.html index cb40172..0e92887 100644 --- a/static/index.html +++ b/static/index.html @@ -5,7 +5,7 @@ - + nolooking // Lightning PayJoin @@ -18,7 +18,7 @@

🎃 Halloween Alpha [experimental] | Avoid sp👀ks<

Queue batches of lightning channels to open in a single transaction

-
Config @@ -38,7 +38,7 @@

Queue batches of lightning channels to open in a single transaction

- +
@@ -115,7 +115,7 @@

PayJoin here to open these channels

link.innerHTML = bip21; var address = bip21.split("bitcoin:")[1].split("?")[0]; - document.getElementById("qrcode").innerHTML = ``; + document.getElementById("qrcode").innerHTML = ``; document.getElementById("queue").classList.add("invisible"); document.getElementById("queued").classList.remove("invisible"); })