mirror of
https://github.com/aljazceru/pubky-core.git
synced 2026-01-20 22:44:26 +01:00
feat(homeserver): remove public key in path endpoints
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user