mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-11-13 13:11:01 +00:00
Update webfinger dep
This commit is contained in:
parent
fdf20016b2
commit
0ffcb74de6
4 changed files with 9 additions and 15 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -319,9 +319,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "actix-webfinger"
|
||||
version = "0.3.0-alpha.3"
|
||||
version = "0.3.0-alpha.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "120ce509b4ad2a0dedfbaebc1c1fb2b5e7bb34430a851c3eb264a704135e30a7"
|
||||
checksum = "818ce271e9226dc9b8885c4f397fb0e6d9e8888c95cc8bf98fa20941b8b26d89"
|
||||
dependencies = [
|
||||
"actix-http",
|
||||
"actix-web",
|
||||
|
|
|
@ -17,7 +17,7 @@ anyhow = "1.0"
|
|||
actix = "0.10.0-alpha.2"
|
||||
actix-rt = "1.0.0"
|
||||
actix-web = { version = "3.0.0-alpha.1", features = ["rustls"] }
|
||||
actix-webfinger = "0.3.0-alpha.3"
|
||||
actix-webfinger = "0.3.0-alpha.5"
|
||||
activitystreams = "0.5.0"
|
||||
ammonia = "3.1.0"
|
||||
async-trait = "0.1.24"
|
||||
|
|
|
@ -140,7 +140,7 @@ async fn main() -> Result<(), anyhow::Error> {
|
|||
.service(web::resource("/nodeinfo/2.0.json").route(web::get().to(nodeinfo)))
|
||||
.service(
|
||||
web::scope("/.well-known")
|
||||
.service(actix_webfinger::scoped::<_, RelayResolver>())
|
||||
.service(actix_webfinger::scoped::<RelayResolver>())
|
||||
.service(web::resource("/nodeinfo").route(web::get().to(nodeinfo_meta))),
|
||||
)
|
||||
.service(web::resource("/static/{filename}").route(web::get().to(statics)))
|
||||
|
|
|
@ -2,9 +2,8 @@ use crate::{
|
|||
config::{Config, UrlKind},
|
||||
data::State,
|
||||
};
|
||||
use activitystreams::context;
|
||||
use actix_web::web::Data;
|
||||
use actix_webfinger::{Link, Resolver, Webfinger};
|
||||
use actix_webfinger::{Resolver, Webfinger};
|
||||
use rsa_magic_public_key::AsMagicPublicKey;
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
|
@ -14,13 +13,14 @@ pub struct RelayResolver;
|
|||
#[error("Error resolving webfinger data")]
|
||||
pub struct RelayError;
|
||||
|
||||
impl Resolver<(Data<State>, Data<Config>)> for RelayResolver {
|
||||
impl Resolver for RelayResolver {
|
||||
type State = (Data<State>, Data<Config>);
|
||||
type Error = RelayError;
|
||||
|
||||
fn find(
|
||||
account: &str,
|
||||
domain: &str,
|
||||
(state, config): (Data<State>, Data<Config>),
|
||||
(state, config): Self::State,
|
||||
) -> Pin<Box<dyn Future<Output = Result<Option<Webfinger>, Self::Error>>>> {
|
||||
let domain = domain.to_owned();
|
||||
let account = account.to_owned();
|
||||
|
@ -37,13 +37,7 @@ impl Resolver<(Data<State>, Data<Config>)> for RelayResolver {
|
|||
let mut wf = Webfinger::new(&config.generate_resource());
|
||||
wf.add_alias(&config.generate_url(UrlKind::Actor))
|
||||
.add_activitypub(&config.generate_url(UrlKind::Actor))
|
||||
.add_magic_public_key(&state.public_key.as_magic_public_key())
|
||||
.add_link(Link {
|
||||
rel: "self".to_owned(),
|
||||
href: Some(config.generate_url(UrlKind::Actor)),
|
||||
template: None,
|
||||
kind: Some(format!("application/ld+json; profile=\"{}\"", context())),
|
||||
});
|
||||
.add_magic_public_key(&state.public_key.as_magic_public_key());
|
||||
|
||||
Ok(Some(wf))
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue