Use LEGACY fetch mode for better compat

This commit is contained in:
Riley Apeldoorn 2024-05-03 17:16:59 +02:00
parent 21b47409f1
commit f0d7d793ca
3 changed files with 7 additions and 7 deletions

View file

@ -48,7 +48,7 @@ impl Client {
.body(()) .body(())
.unwrap(); .unwrap();
key.sign(Options::MODERN, &req) key.sign(Options::LEGACY, &req)
.map_err(FetchError::Sig)? .map_err(FetchError::Sig)?
.commit(&mut req); .commit(&mut req);
@ -82,7 +82,7 @@ impl Client {
.unwrap(); .unwrap();
println!("[{system}]: using modern config"); println!("[{system}]: using modern config");
key.sign(Options::MODERN, &req) key.sign(Options::LEGACY, &req)
.expect("signing error") .expect("signing error")
.commit(&mut req); .commit(&mut req);

View file

@ -23,8 +23,8 @@ where
], ],
"id": self.id.to_string(), "id": self.id.to_string(),
"actor": self.actor.to_string(), "actor": self.actor.to_string(),
"object": self.object.to_json_ld(),
"type": self.kind.to_string(), "type": self.kind.to_string(),
"object": self.object.to_json_ld()
}) })
} }
} }
@ -69,7 +69,7 @@ impl Actor {
pub enum Object { pub enum Object {
Activity(Activity), Activity(Activity),
Actor(Actor), Actor(Actor),
Object { Other {
id: String, id: String,
kind: String, kind: String,
content: Option<String>, content: Option<String>,
@ -82,14 +82,14 @@ impl Object {
match self { match self {
Object::Activity(a) => &a.id, Object::Activity(a) => &a.id,
Object::Actor(a) => &a.id, Object::Actor(a) => &a.id,
Object::Object { id, .. } => id, Object::Other { id, .. } => id,
} }
} }
pub fn to_json_ld(&self) -> Value { pub fn to_json_ld(&self) -> Value {
match self { match self {
Object::Activity(a) => a.to_json_ld(), Object::Activity(a) => a.to_json_ld(),
Object::Actor(a) => a.to_json_ld(), Object::Actor(a) => a.to_json_ld(),
Object::Object { id, kind, content, summary } => json!({ Object::Other { id, kind, content, summary } => json!({
"id": id.to_string(), "id": id.to_string(),
"type": kind, "type": kind,
"content": content, "content": content,

View file

@ -76,7 +76,7 @@ pub fn get_local_ap_object(tx: &Transaction<'_>, key: Key) -> Result<fetch::obje
let Some(Content { content, warning, .. }) = tx.get_mixin(key)? else { let Some(Content { content, warning, .. }) = tx.get_mixin(key)? else {
panic!() panic!()
}; };
Ok(fetch::object::Object::Object { Ok(fetch::object::Object::Other {
id: obj.id.0.clone().into(), id: obj.id.0.clone().into(),
summary: warning, summary: warning,
content, content,