feat(homeserver): remove public key in path endpoints

This commit is contained in:
nazeh
2024-12-19 13:42:53 +03:00
parent daa06b6453
commit 0c1326c2c7
2 changed files with 12 additions and 21 deletions

View File

@@ -32,17 +32,6 @@ fn base(state: AppState) -> Router {
.route("/pub/*path", head(public::read::head))
.route("/pub/*path", put(public::write::put))
.route("/pub/*path", delete(public::write::delete))
// Pubky in the path.
//
// Important to support web browsers until they support Pkarr domains natively.
// - Session routes
.route("/:pubky/session", get(auth::session))
.route("/:pubky/session", delete(auth::signout))
// - Data routes
.route("/:pubky/*path", get(public::read::get))
.route("/:pubky/*path", head(public::read::head))
.route("/:pubky/*path", put(public::write::put))
.route("/:pubky/*path", delete(public::write::delete))
// Events
.route("/events/", get(feed::feed))
.layer(CookieManagerLayer::new())

View File

@@ -219,14 +219,13 @@ mod tests {
let cookie = server.create_user(&public_key).unwrap();
let cookie = cookie.to_string();
let url = format!("/{public_key}/pub/foo");
let data = vec![1_u8, 2, 3, 4, 5];
let response = server
.call(
Request::builder()
.uri(&url)
.header("host", public_key.to_string())
.uri("/pub/foo")
.method(Method::PUT)
.header(header::COOKIE, cookie)
.body(Body::from(data))
@@ -240,7 +239,8 @@ mod tests {
let response = server
.call(
Request::builder()
.uri(&url)
.header("host", public_key.to_string())
.uri("/pub/foo")
.method(Method::GET)
.body(Body::empty())
.unwrap(),
@@ -251,7 +251,8 @@ mod tests {
let response = server
.call(
Request::builder()
.uri(&url)
.header("host", public_key.to_string())
.uri("/pub/foo")
.method(Method::GET)
.header(
header::IF_MODIFIED_SINCE,
@@ -274,14 +275,13 @@ mod tests {
let cookie = server.create_user(&public_key).unwrap();
let cookie = cookie.to_string();
let url = format!("/{public_key}/pub/foo");
let data = vec![1_u8, 2, 3, 4, 5];
let response = server
.call(
Request::builder()
.uri(&url)
.uri("/pub/foo")
.header("host", public_key.to_string())
.method(Method::PUT)
.header(header::COOKIE, cookie)
.body(Body::from(data))
@@ -295,7 +295,8 @@ mod tests {
let response = server
.call(
Request::builder()
.uri(&url)
.uri("/pub/foo")
.header("host", public_key.to_string())
.method(Method::GET)
.body(Body::empty())
.unwrap(),
@@ -306,7 +307,8 @@ mod tests {
let response = server
.call(
Request::builder()
.uri(&url)
.uri("/pub/foo")
.header("host", public_key.to_string())
.method(Method::GET)
.header(
header::IF_NONE_MATCH,