diff --git a/crates/tauri-app/src-tauri/src/lib.rs b/crates/tauri-app/src-tauri/src/lib.rs index 39dee81..c9e002a 100644 --- a/crates/tauri-app/src-tauri/src/lib.rs +++ b/crates/tauri-app/src-tauri/src/lib.rs @@ -250,7 +250,12 @@ async fn repost_post( }); let resp = state .pds - .create_record_with(&sess.did, "app.bsky.feed.repost", record, false, &sess.access_jwt) + // `true`: `app.bsky.feed.repost` is in the PDS's lexicon registry + // and this record passes it (verified against a live PDS). The + // `false` that stood here was inert — the flag was dropped before + // the request — so validating is what has actually been happening + // all along; saying so keeps the behaviour and drops the fiction. + .create_record_with(&sess.did, "app.bsky.feed.repost", record, true, &sess.access_jwt) .await .map_err(|e| e.to_string())?; Ok(serde_json::json!({ diff --git a/crates/tauri-app/src-tauri/src/pds_client.rs b/crates/tauri-app/src-tauri/src/pds_client.rs index a594f8f..63de5b7 100644 --- a/crates/tauri-app/src-tauri/src/pds_client.rs +++ b/crates/tauri-app/src-tauri/src/pds_client.rs @@ -41,6 +41,10 @@ pub struct CreateRecordReq { pub repo: String, pub collection: String, pub record: serde_json::Value, + /// Omitted rather than sent as `null` when the caller has no + /// opinion — the PDS's own default (`true`) then applies. + #[serde(skip_serializing_if = "Option::is_none")] + pub validate: Option, } /// Strong reference as defined by @@ -184,12 +188,19 @@ impl PdsHttpClient { Ok(r.json().await?) } + /// `validate` is forwarded to the PDS, which defaults it to `true`. + /// + /// It used to be `_validate` — accepted and silently dropped, so a + /// caller asking for `false` still got server-side validation. That + /// made no difference in practice (every collection the client writes + /// is in the PDS's lexicon registry and passes), but a parameter that + /// does nothing is a trap for the next caller who relies on it. pub async fn create_record_with( &self, repo: &str, collection: &str, record: serde_json::Value, - _validate: bool, + validate: bool, jwt: &str, ) -> Result { let r = self @@ -200,6 +211,7 @@ impl PdsHttpClient { repo: repo.to_string(), collection: collection.to_string(), record, + validate: Some(validate), }) .send() .await?; diff --git a/lexicons/app/bsky/graph/follow.json b/lexicons/app/bsky/graph/follow.json new file mode 100644 index 0000000..1e9cbf2 --- /dev/null +++ b/lexicons/app/bsky/graph/follow.json @@ -0,0 +1,18 @@ +{ + "lexicon": 1, + "id": "app.bsky.graph.follow", + "defs": { + "main": { + "type": "record", + "key": "tid", + "record": { + "type": "object", + "required": ["subject", "createdAt"], + "properties": { + "subject": { "type": "string", "format": "did" }, + "createdAt": { "type": "datetime" } + } + } + } + } +}