diff --git a/upub/cli/src/cloak.rs b/upub/cli/src/cloak.rs index 3eebcc5..cf953eb 100644 --- a/upub/cli/src/cloak.rs +++ b/upub/cli/src/cloak.rs @@ -19,7 +19,7 @@ pub async fn cloak(ctx: upub::Context, post_contents: bool, objects: bool, actor } } - if post_contents { + if objects { let mut stream = upub::model::object::Entity::find() .filter(upub::model::object::Column::Image.is_not_null()) .filter(upub::model::object::Column::Image.not_like(&local_base)) diff --git a/upub/routes/src/activitypub/actor/mod.rs b/upub/routes/src/activitypub/actor/mod.rs index 83e185d..4b76771 100644 --- a/upub/routes/src/activitypub/actor/mod.rs +++ b/upub/routes/src/activitypub/actor/mod.rs @@ -66,7 +66,7 @@ pub async fn view( .set_endpoints(Node::object( apb::new() .set_shared_inbox(Some(&upub::url!(ctx, "/inbox"))) - .set_proxy_url(Some(&upub::url!(ctx, "/proxy"))) + .set_proxy_url(Some(&upub::url!(ctx, "/fetch"))) )); if auth.is(&uid) { diff --git a/upub/routes/src/activitypub/application.rs b/upub/routes/src/activitypub/application.rs index 85cd110..2ac3d55 100644 --- a/upub/routes/src/activitypub/application.rs +++ b/upub/routes/src/activitypub/application.rs @@ -1,5 +1,5 @@ use apb::{LD, ActorMut, BaseMut, ObjectMut, PublicKeyMut}; -use axum::{extract::{Path, Query, State}, http::HeaderMap, response::{IntoResponse, Redirect, Response}, Form}; +use axum::{extract::{Path, Query, State}, http::HeaderMap, response::{IntoResponse, Redirect, Response}}; use reqwest::Method; use upub::{traits::{Cloaker, Fetcher}, Context}; @@ -39,22 +39,12 @@ pub async fn view( ).into_response()) } -pub async fn proxy_path( - State(ctx): State, - AuthIdentity(auth): AuthIdentity, - Path(uri): Path, -) -> crate::ApiResult { - let query = uriproxy::expand(&uri) - .ok_or_else(crate::ApiError::bad_request)?; - proxy(ctx, query, auth).await -} - #[derive(Debug, serde::Deserialize)] pub struct ProxyQuery { uri: String, } -pub async fn proxy_get( +pub async fn ap_fetch( State(ctx): State, AuthIdentity(auth): AuthIdentity, Query(query): Query, @@ -62,14 +52,6 @@ pub async fn proxy_get( proxy(ctx, query.uri, auth).await } -pub async fn proxy_form( - State(ctx): State, - AuthIdentity(auth): AuthIdentity, - Form(query): Form, -) -> crate::ApiResult { - proxy(ctx, query, auth).await -} - pub async fn proxy_cloak( State(ctx): State, AuthIdentity(auth): AuthIdentity, diff --git a/upub/routes/src/activitypub/mod.rs b/upub/routes/src/activitypub/mod.rs index 629f27d..d6ed08f 100644 --- a/upub/routes/src/activitypub/mod.rs +++ b/upub/routes/src/activitypub/mod.rs @@ -22,9 +22,7 @@ impl ActivityPubRouter for Router { // core server inbox/outbox, maybe for feeds? TODO do we need these? .route("/", get(ap::application::view)) // fetch route, to debug and retreive remote objects - .route("/proxy", post(ap::application::proxy_form)) - .route("/proxy", get(ap::application::proxy_get)) - .route("/proxy/:uri", get(ap::application::proxy_path)) + .route("/fetch", get(ap::application::ap_fetch)) .route("/proxy/:hmac/:uri", get(ap::application::proxy_cloak)) .route("/inbox", post(ap::inbox::post)) .route("/inbox", get(ap::inbox::get)) diff --git a/web/src/page/debug.rs b/web/src/page/debug.rs index 2fa7fde..32df8af 100644 --- a/web/src/page/debug.rs +++ b/web/src/page/debug.rs @@ -31,7 +31,7 @@ pub fn DebugPage() -> impl IntoView { }, } } else { - debug_fetch(&format!("{URL_BASE}/proxy?uri={query}"), auth, set_error).await + debug_fetch(&format!("{URL_BASE}/fetch?uri={query}"), auth, set_error).await } } );