fix: Node::id() returns owned value, imports fix
This commit is contained in:
parent
b37d799f59
commit
f83103ba72
3 changed files with 5 additions and 20 deletions
|
@ -8,7 +8,7 @@ pub use following::follow___;
|
||||||
use axum::{extract::{Path, State}, http::StatusCode};
|
use axum::{extract::{Path, State}, http::StatusCode};
|
||||||
use sea_orm::EntityTrait;
|
use sea_orm::EntityTrait;
|
||||||
|
|
||||||
use crate::{activitystream::{key::PublicKeyMut, object::{actor::ActorMut, collection::{CollectionMut, CollectionType}, document::{DocumentMut, DocumentType}, ObjectMut}, BaseMut, Node}, model::{self, user}, server::Context, url};
|
use crate::{activitystream::{key::PublicKeyMut, object::{actor::ActorMut, document::{DocumentMut, DocumentType}, ObjectMut}, BaseMut, Node}, model::{self, user}, server::Context, url};
|
||||||
|
|
||||||
use super::{jsonld::LD, JsonLD};
|
use super::{jsonld::LD, JsonLD};
|
||||||
|
|
||||||
|
@ -33,19 +33,7 @@ pub fn ap_user(user: model::user::Model) -> serde_json::Value {
|
||||||
.set_inbox(Node::maybe_link(user.inbox))
|
.set_inbox(Node::maybe_link(user.inbox))
|
||||||
.set_outbox(Node::maybe_link(user.outbox))
|
.set_outbox(Node::maybe_link(user.outbox))
|
||||||
.set_following(Node::maybe_link(user.following))
|
.set_following(Node::maybe_link(user.following))
|
||||||
// .set_following(Node::object(
|
|
||||||
// serde_json::Value::new_object()
|
|
||||||
// .set_id(user.following.as_deref())
|
|
||||||
// .set_collection_type(Some(CollectionType::OrderedCollection))
|
|
||||||
// .set_total_items(Some(user.following_count as u64))
|
|
||||||
// ))
|
|
||||||
.set_followers(Node::maybe_link(user.followers))
|
.set_followers(Node::maybe_link(user.followers))
|
||||||
// .set_followers(Node::object(
|
|
||||||
// serde_json::Value::new_object()
|
|
||||||
// .set_id(user.followers.as_deref())
|
|
||||||
// .set_collection_type(Some(CollectionType::OrderedCollection))
|
|
||||||
// .set_total_items(Some(user.followers_count as u64))
|
|
||||||
// ))
|
|
||||||
.set_public_key(Node::object(
|
.set_public_key(Node::object(
|
||||||
serde_json::Value::new_object()
|
serde_json::Value::new_object()
|
||||||
.set_id(Some(&format!("{}#main-key", user.id)))
|
.set_id(Some(&format!("{}#main-key", user.id)))
|
||||||
|
|
|
@ -91,12 +91,12 @@ impl<T : super::Base> Node<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn id(&self) -> Option<&str> {
|
pub fn id(&self) -> Option<String> {
|
||||||
match self {
|
match self {
|
||||||
Node::Empty => None,
|
Node::Empty => None,
|
||||||
Node::Link(uri) => Some(uri.href()),
|
Node::Link(uri) => Some(uri.href().to_string()),
|
||||||
Node::Object(obj) => obj.id(),
|
Node::Object(obj) => obj.id().map(|x| x.to_string()),
|
||||||
Node::Array(arr) => arr.first()?.id(),
|
Node::Array(arr) => arr.first()?.id().map(|x| x.to_string()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
use std::collections::BTreeMap;
|
|
||||||
|
|
||||||
use base64::Engine;
|
use base64::Engine;
|
||||||
use http_signature_normalization::Config;
|
|
||||||
use openssl::{hash::MessageDigest, pkey::{PKey, Private}, sign::Signer};
|
use openssl::{hash::MessageDigest, pkey::{PKey, Private}, sign::Signer};
|
||||||
use reqwest::header::{CONTENT_TYPE, USER_AGENT};
|
use reqwest::header::{CONTENT_TYPE, USER_AGENT};
|
||||||
use sea_orm::{ColumnTrait, Condition, DatabaseConnection, EntityTrait, Order, QueryFilter, QueryOrder};
|
use sea_orm::{ColumnTrait, Condition, DatabaseConnection, EntityTrait, Order, QueryFilter, QueryOrder};
|
||||||
|
|
Loading…
Reference in a new issue