From 652ab6ac4219061481a00d883c0d858421431198 Mon Sep 17 00:00:00 2001 From: asonix Date: Sat, 27 Jun 2020 17:29:23 -0500 Subject: [PATCH] Remove XsdAnyUri --- Cargo.lock | 185 ++++++++++++++++++++------------------ Cargo.toml | 2 +- docker/prod/deploy.sh | 2 +- src/apub.rs | 6 +- src/data/actor.rs | 8 +- src/data/node.rs | 6 +- src/jobs/apub/announce.rs | 14 +-- src/jobs/apub/follow.rs | 5 +- src/jobs/apub/reject.rs | 5 +- src/jobs/apub/undo.rs | 5 +- src/jobs/deliver.rs | 11 +-- src/jobs/deliver_many.rs | 6 +- src/jobs/instance.rs | 12 +-- src/jobs/nodeinfo.rs | 8 +- 14 files changed, 133 insertions(+), 142 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ccf5a76..b7c99ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6,18 +6,18 @@ version = "0.1.0" source = "git+https://git.asonix.dog/asonix/activitystreams-ext?branch=main#9acc466c7cb550ada31b669a1c47ea088f1c8471" dependencies = [ "activitystreams-new", - "serde 1.0.113", + "serde 1.0.114", "serde_json", ] [[package]] name = "activitystreams-new" version = "0.1.0" -source = "git+https://git.asonix.dog/asonix/activitystreams-sketch?branch=main#df49fcd1a756f2570651f82727c48ace66d9e8a3" +source = "git+https://git.asonix.dog/asonix/activitystreams-sketch?branch=main#60716a6d2ad18672e08be7564c5691b77536533c" dependencies = [ "chrono", "mime", - "serde 1.0.113", + "serde 1.0.114", "serde_json", "thiserror", "url", @@ -73,7 +73,7 @@ dependencies = [ "actix-threadpool", "actix-tls", "actix-utils", - "base64 0.12.2", + "base64 0.12.3", "bitflags", "brotli2", "bytes", @@ -98,7 +98,7 @@ dependencies = [ "pin-project", "rand", "regex", - "serde 1.0.113", + "serde 1.0.114", "serde_json", "serde_urlencoded", "sha-1", @@ -126,7 +126,7 @@ dependencies = [ "http", "log", "regex", - "serde 1.0.113", + "serde 1.0.114", ] [[package]] @@ -272,7 +272,7 @@ dependencies = [ "pin-project", "regex", "rustls", - "serde 1.0.113", + "serde 1.0.114", "serde_json", "serde_urlencoded", "socket2", @@ -300,16 +300,16 @@ checksum = "abb66d471f2af5a9ea7b48ea4456f117c56cd1b2348e52ae8d3bc95cddeebf4c" dependencies = [ "actix-http", "actix-web", - "serde 1.0.113", + "serde 1.0.114", "serde_derive", "thiserror", ] [[package]] name = "addr2line" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49806b9dadc843c61e7c97e72490ad7f7220ae249012fbda9ad0609457c0543" +checksum = "602d785912f476e480434627e8732e6766b760c045bbf897d9dfaa9f4fbd399c" dependencies = [ "gimli", ] @@ -331,9 +331,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.10" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" +checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" dependencies = [ "memchr", ] @@ -359,7 +359,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -382,9 +382,9 @@ checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" [[package]] name = "async-mutex" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7685ce9f0bbc046731a469dd6e17361b0403aa79e6e15c9492e15f3118dfe196" +checksum = "20e85981fc34e84cdff3fc2c9219189752633fdc538a06df8b5ac45b68a4f3a9" dependencies = [ "event-listener", ] @@ -408,7 +408,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -433,7 +433,7 @@ dependencies = [ "actix-http", "actix-rt", "actix-service", - "base64 0.12.2", + "base64 0.12.3", "bytes", "derive_more", "futures-core", @@ -442,7 +442,7 @@ dependencies = [ "percent-encoding", "rand", "rustls", - "serde 1.0.113", + "serde 1.0.114", "serde_json", "serde_urlencoded", ] @@ -471,7 +471,7 @@ dependencies = [ "log", "num_cpus", "rand", - "serde 1.0.113", + "serde 1.0.114", "serde_json", "thiserror", "tokio", @@ -490,7 +490,7 @@ dependencies = [ "chrono", "futures", "log", - "serde 1.0.113", + "serde 1.0.114", "serde_json", "thiserror", "tokio", @@ -525,9 +525,9 @@ checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" [[package]] name = "base64" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e223af0dc48c96d4f8342ec01a4974f139df863896b316681efd36742f22cc67" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" [[package]] name = "bit-vec" @@ -555,13 +555,10 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbcf92448676f82bb7a334c58bbce8b0d43580fb5362a9d608b18879d12a3d31" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "block-padding", - "byte-tools", - "byteorder", "generic-array 0.14.2", ] @@ -638,9 +635,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.54" +version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311" +checksum = "b1be3409f94d7bdceeb5f5fac551039d9b3f00e25da7a74fc4d33400a0d96368" [[package]] name = "cfg-if" @@ -656,7 +653,7 @@ checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ "num-integer", "num-traits 0.2.12", - "serde 1.0.113", + "serde 1.0.114", "time 0.1.43", ] @@ -693,7 +690,7 @@ dependencies = [ "lazy_static", "nom", "rust-ini", - "serde 1.0.113", + "serde 1.0.114", "serde-hjson", "serde_json", "toml", @@ -726,6 +723,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" +[[package]] +name = "cpuid-bool" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d375c433320f6c5057ae04a04376eef4d04ce2801448cf8863a78da99107be4" + [[package]] name = "crc32fast" version = "1.2.0" @@ -777,7 +780,7 @@ dependencies = [ "config", "crossbeam-queue", "num_cpus", - "serde 1.0.113", + "serde 1.0.114", "tokio", ] @@ -792,16 +795,16 @@ dependencies = [ "deadpool", "futures", "log", - "serde 1.0.113", + "serde 1.0.114", "tokio", "tokio-postgres", ] [[package]] name = "derive_more" -version = "0.99.8" +version = "0.99.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc655351f820d774679da6cdc23355a93de496867d8203496675162e17b1d671" +checksum = "298998b1cf6b5b2c8a7b023dfd45821825ce3ba8a8af55c921a0e734e4653f76" dependencies = [ "proc-macro2", "quote", @@ -886,9 +889,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "1.2.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043d21a617dda31c36aed31a38f4ebb643a6fa55c2963fd9f0cc1c831e5095d7" +checksum = "05b148ad9bf80edb24098fd1ab4883c7c381e7900c1a38e512fb0586c4501505" [[package]] name = "failure" @@ -1082,7 +1085,7 @@ dependencies = [ "libc", "log", "rustc_version", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1186,7 +1189,7 @@ checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ "libc", "match_cfg", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1232,13 +1235,13 @@ checksum = "60a0614ef2d44d570f78932a25cfa6975fa41d1f06f12c4b338e3f1ee1e3b6ab" dependencies = [ "actix-http", "actix-web", - "base64 0.12.2", + "base64 0.12.3", "bytes", "chrono", "futures", "http-signature-normalization", "log", - "sha2 0.9.0", + "sha2 0.9.1", "thiserror", ] @@ -1294,7 +1297,7 @@ checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" dependencies = [ "socket2", "widestring", - "winapi 0.3.8", + "winapi 0.3.9", "winreg", ] @@ -1456,7 +1459,7 @@ dependencies = [ "log", "phf", "phf_codegen", - "serde 1.0.113", + "serde 1.0.114", "serde_derive", "serde_json", "string_cache", @@ -1571,7 +1574,7 @@ checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" dependencies = [ "cfg-if", "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1616,7 +1619,7 @@ dependencies = [ "num-iter", "num-traits 0.2.12", "rand", - "serde 1.0.113", + "serde 1.0.114", "smallvec", "zeroize", ] @@ -1699,6 +1702,12 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "parking_lot" version = "0.10.2" @@ -1720,7 +1729,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1816,7 +1825,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f611afe4d1407ebe7f3ced1ffc66f730fac1b1c13085e230a8cdcb921e97710" dependencies = [ - "base64 0.12.2", + "base64 0.12.3", "byteorder", "bytes", "fallible-iterator", @@ -1838,7 +1847,7 @@ dependencies = [ "chrono", "fallible-iterator", "postgres-protocol", - "serde 1.0.113", + "serde 1.0.114", "serde_json", "uuid", ] @@ -1867,9 +1876,9 @@ dependencies = [ [[package]] name = "proc-macro-error" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98e9e4b82e0ef281812565ea4751049f1bdcdfccda7d3f459f2e138a40c08678" +checksum = "fc175e9777c3116627248584e8f8b3e2987405cabe1c0adf7d1dd28f09dc7880" dependencies = [ "proc-macro-error-attr", "proc-macro2", @@ -1880,9 +1889,9 @@ dependencies = [ [[package]] name = "proc-macro-error-attr" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f5444ead4e9935abd7f27dc51f7e852a0569ac888096d5ec2499470794e2e53" +checksum = "3cc9795ca17eb581285ec44936da7fc2335a3f34f2ddd13118b6f4d515435c50" dependencies = [ "proc-macro2", "quote", @@ -2016,7 +2025,7 @@ dependencies = [ "async-mutex", "async-trait", "background-jobs", - "base64 0.12.2", + "base64 0.12.3", "bytes", "config", "deadpool", @@ -2035,9 +2044,9 @@ dependencies = [ "rsa-magic-public-key", "rsa-pem", "ructe", - "serde 1.0.113", + "serde 1.0.114", "serde_json", - "sha2 0.9.0", + "sha2 0.9.1", "structopt", "thiserror", "tokio", @@ -2068,7 +2077,7 @@ dependencies = [ "spin", "untrusted", "web-sys", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -2138,7 +2147,7 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f615d1e172dcc01a7cd78c7f77f21a5669c6de4341548ad2e7764e9045d06657" dependencies = [ - "base64 0.12.2", + "base64 0.12.3", "bytecount", "itertools", "md5", @@ -2232,9 +2241,9 @@ checksum = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" [[package]] name = "serde" -version = "1.0.113" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6135c78461981c79497158ef777264c51d9d0f4f3fc3a4d22b915900e42dac6a" +checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" dependencies = [ "serde_derive", ] @@ -2254,9 +2263,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.113" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93c5eaa17d0954cb481cdcfffe9d84fcfa7a1a9f2349271e678677be4c26ae31" +checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" dependencies = [ "proc-macro2", "quote", @@ -2271,7 +2280,7 @@ checksum = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226" dependencies = [ "itoa", "ryu", - "serde 1.0.113", + "serde 1.0.114", ] [[package]] @@ -2291,7 +2300,7 @@ checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" dependencies = [ "dtoa", "itoa", - "serde 1.0.113", + "serde 1.0.114", "url", ] @@ -2304,7 +2313,7 @@ dependencies = [ "block-buffer 0.7.3", "digest 0.8.1", "fake-simd", - "opaque-debug", + "opaque-debug 0.2.3", ] [[package]] @@ -2322,19 +2331,20 @@ dependencies = [ "block-buffer 0.7.3", "digest 0.8.1", "fake-simd", - "opaque-debug", + "opaque-debug 0.2.3", ] [[package]] name = "sha2" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72377440080fd008550fe9b441e854e43318db116f90181eef92e9ae9aedab48" +checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" dependencies = [ - "block-buffer 0.8.0", + "block-buffer 0.9.0", + "cfg-if", + "cpuid-bool", "digest 0.9.0", - "fake-simd", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -2374,7 +2384,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -2420,7 +2430,7 @@ checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" dependencies = [ "proc-macro2", "quote", - "serde 1.0.113", + "serde 1.0.114", "serde_derive", "syn", ] @@ -2434,7 +2444,7 @@ dependencies = [ "base-x", "proc-macro2", "quote", - "serde 1.0.113", + "serde 1.0.114", "serde_derive", "serde_json", "sha1", @@ -2457,7 +2467,7 @@ dependencies = [ "new_debug_unreachable", "phf_shared", "precomputed-hash", - "serde 1.0.113", + "serde 1.0.114", ] [[package]] @@ -2526,9 +2536,9 @@ checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" [[package]] name = "syn" -version = "1.0.31" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6" +checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd" dependencies = [ "proc-macro2", "quote", @@ -2632,7 +2642,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -2647,7 +2657,7 @@ dependencies = [ "stdweb", "time-macros", "version_check", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -2697,7 +2707,7 @@ dependencies = [ "pin-project-lite", "signal-hook-registry", "slab", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -2768,7 +2778,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" dependencies = [ - "serde 1.0.113", + "serde 1.0.114", ] [[package]] @@ -2858,9 +2868,9 @@ checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "untrusted" @@ -2877,6 +2887,7 @@ dependencies = [ "idna", "matches", "percent-encoding", + "serde 1.0.114", ] [[package]] @@ -2892,7 +2903,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11" dependencies = [ "rand", - "serde 1.0.113", + "serde 1.0.114", ] [[package]] @@ -3010,9 +3021,9 @@ checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", @@ -3036,7 +3047,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -3051,7 +3062,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 973b97d..c2e60e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ deadpool-postgres = "0.5.5" dotenv = "0.15.0" env_logger = "0.7.1" futures = "0.3.4" -http-signature-normalization-actix = { version = "0.3.0-alpha.11", default-features = false, features = ["sha-2"] } +http-signature-normalization-actix = { version = "=0.3.0-alpha.12", default-features = false, features = ["sha-2"] } log = "0.4" lru = "0.5.1" mime = "0.3.16" diff --git a/docker/prod/deploy.sh b/docker/prod/deploy.sh index 1a40839..8042ec0 100755 --- a/docker/prod/deploy.sh +++ b/docker/prod/deploy.sh @@ -49,7 +49,7 @@ fi set -xe git checkout main -git commit -m "Version $TAG" +git commit -m "Version $TAG" || true git tag $TAG git push origin $TAG diff --git a/src/apub.rs b/src/apub.rs index 9877c02..09b8f19 100644 --- a/src/apub.rs +++ b/src/apub.rs @@ -2,15 +2,15 @@ use activitystreams_ext::{Ext1, UnparsedExtension}; use activitystreams_new::{ activity::ActorAndObject, actor::{Actor, ApActor}, - primitives::XsdAnyUri, unparsed::UnparsedMutExt, + url::Url, }; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] #[serde(rename_all = "camelCase")] pub struct PublicKeyInner { - pub id: XsdAnyUri, - pub owner: XsdAnyUri, + pub id: Url, + pub owner: Url, pub public_key_pem: String, } diff --git a/src/data/actor.rs b/src/data/actor.rs index bd81281..1ca841b 100644 --- a/src/data/actor.rs +++ b/src/data/actor.rs @@ -1,5 +1,5 @@ use crate::{apub::AcceptedActors, db::Db, error::MyError, requests::Requests}; -use activitystreams_new::{prelude::*, primitives::XsdAnyUri, uri, url::Url}; +use activitystreams_new::{prelude::*, uri, url::Url}; use log::error; use std::{collections::HashSet, sync::Arc, time::Duration}; use tokio::sync::RwLock; @@ -317,8 +317,8 @@ fn get_inbox(actor: &AcceptedActors) -> Result<&Url, MyError> { #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] pub struct Actor { - pub id: XsdAnyUri, + pub id: Url, pub public_key: String, - pub public_key_id: XsdAnyUri, - pub inbox: XsdAnyUri, + pub public_key_id: Url, + pub inbox: Url, } diff --git a/src/data/node.rs b/src/data/node.rs index cc9afb4..82beda0 100644 --- a/src/data/node.rs +++ b/src/data/node.rs @@ -1,5 +1,5 @@ use crate::{db::Db, error::MyError}; -use activitystreams_new::{primitives::XsdAnyUri, uri, url::Url}; +use activitystreams_new::{uri, url::Url}; use log::{debug, error}; use std::{ collections::{HashMap, HashSet}, @@ -417,8 +417,8 @@ pub struct Instance { pub struct Contact { pub username: String, pub display_name: String, - pub url: XsdAnyUri, - pub avatar: XsdAnyUri, + pub url: Url, + pub avatar: Url, pub updated: SystemTime, } diff --git a/src/jobs/apub/announce.rs b/src/jobs/apub/announce.rs index 71907a3..2a3a602 100644 --- a/src/jobs/apub/announce.rs +++ b/src/jobs/apub/announce.rs @@ -7,22 +7,19 @@ use crate::{ DeliverMany, JobState, }, }; -use activitystreams_new::{activity::Announce as AsAnnounce, primitives::XsdAnyUri, url::Url}; +use activitystreams_new::{activity::Announce as AsAnnounce, url::Url}; use background_jobs::ActixJob; use std::{future::Future, pin::Pin}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] pub struct Announce { - object_id: XsdAnyUri, + object_id: Url, actor: Actor, } impl Announce { pub fn new(object_id: Url, actor: Actor) -> Self { - Announce { - object_id: object_id.into(), - actor, - } + Announce { object_id, actor } } async fn perform(self, state: JobState) -> Result<(), anyhow::Error> { @@ -34,10 +31,7 @@ impl Announce { .job_server .queue(DeliverMany::new(inboxes, announce)?)?; - state - .state - .cache(self.object_id.into_inner(), activity_id) - .await; + state.state.cache(self.object_id, activity_id).await; Ok(()) } } diff --git a/src/jobs/apub/follow.rs b/src/jobs/apub/follow.rs index ac7319b..4e8f497 100644 --- a/src/jobs/apub/follow.rs +++ b/src/jobs/apub/follow.rs @@ -31,10 +31,7 @@ impl Follow { async fn perform(self, state: JobState) -> Result<(), anyhow::Error> { if !self.is_listener { - state - .db - .add_listener(self.actor.inbox.clone().into_inner()) - .await?; + state.db.add_listener(self.actor.inbox.clone()).await?; } let my_id = state.config.generate_url(UrlKind::Actor); diff --git a/src/jobs/apub/reject.rs b/src/jobs/apub/reject.rs index ffa9c51..99f66bc 100644 --- a/src/jobs/apub/reject.rs +++ b/src/jobs/apub/reject.rs @@ -12,10 +12,7 @@ pub struct Reject(pub Actor); impl Reject { async fn perform(self, state: JobState) -> Result<(), anyhow::Error> { if state.actors.unfollower(&self.0).await?.is_some() { - state - .db - .remove_listener(self.0.inbox.clone().into_inner()) - .await?; + state.db.remove_listener(self.0.inbox.clone()).await?; } let my_id = state.config.generate_url(UrlKind::Actor); diff --git a/src/jobs/apub/undo.rs b/src/jobs/apub/undo.rs index 4da420a..c8fc4b0 100644 --- a/src/jobs/apub/undo.rs +++ b/src/jobs/apub/undo.rs @@ -22,10 +22,7 @@ impl Undo { let was_following = state.actors.is_following(&self.actor.id).await; if state.actors.unfollower(&self.actor).await?.is_some() { - state - .db - .remove_listener(self.actor.inbox.clone().into_inner()) - .await?; + state.db.remove_listener(self.actor.inbox.clone()).await?; } if was_following { diff --git a/src/jobs/deliver.rs b/src/jobs/deliver.rs index ebd5fd4..3850021 100644 --- a/src/jobs/deliver.rs +++ b/src/jobs/deliver.rs @@ -1,17 +1,17 @@ use crate::{error::MyError, jobs::JobState}; -use activitystreams_new::primitives::XsdAnyUri; +use activitystreams_new::url::Url; use anyhow::Error; use background_jobs::{ActixJob, Backoff}; use std::{future::Future, pin::Pin}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] pub struct Deliver { - to: XsdAnyUri, + to: Url, data: serde_json::Value, } impl Deliver { - pub fn new(to: XsdAnyUri, data: T) -> Result + pub fn new(to: Url, data: T) -> Result where T: serde::ser::Serialize, { @@ -31,10 +31,7 @@ impl ActixJob for Deliver { fn run(self, state: Self::State) -> Self::Future { Box::pin(async move { - state - .requests - .deliver(self.to.into_inner(), &self.data) - .await?; + state.requests.deliver(self.to, &self.data).await?; Ok(()) }) diff --git a/src/jobs/deliver_many.rs b/src/jobs/deliver_many.rs index 010b20f..f35729d 100644 --- a/src/jobs/deliver_many.rs +++ b/src/jobs/deliver_many.rs @@ -2,14 +2,14 @@ use crate::{ error::MyError, jobs::{Deliver, JobState}, }; -use activitystreams_new::{primitives::XsdAnyUri, url::Url}; +use activitystreams_new::url::Url; use anyhow::Error; use background_jobs::ActixJob; use futures::future::{ready, Ready}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] pub struct DeliverMany { - to: Vec, + to: Vec, data: serde_json::Value, } @@ -19,7 +19,7 @@ impl DeliverMany { T: serde::ser::Serialize, { Ok(DeliverMany { - to: to.into_iter().map(XsdAnyUri::from).collect(), + to, data: serde_json::to_value(data)?, }) } diff --git a/src/jobs/instance.rs b/src/jobs/instance.rs index 2e0520e..b483417 100644 --- a/src/jobs/instance.rs +++ b/src/jobs/instance.rs @@ -2,7 +2,7 @@ use crate::{ config::UrlKind, jobs::{cache_media::CacheMedia, JobState}, }; -use activitystreams_new::{primitives::XsdAnyUri, url::Url}; +use activitystreams_new::url::Url; use anyhow::Error; use background_jobs::ActixJob; use futures::join; @@ -10,7 +10,7 @@ use std::{future::Future, pin::Pin}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] pub struct QueryInstance { - listener: XsdAnyUri, + listener: Url, } impl QueryInstance { @@ -64,8 +64,8 @@ impl QueryInstance { &self.listener, contact.username, contact.display_name, - contact.url.into_inner(), - contact.avatar.into_inner(), + contact.url, + contact.avatar, ) .await?; } @@ -116,6 +116,6 @@ struct Instance { struct Contact { username: String, display_name: String, - url: XsdAnyUri, - avatar: XsdAnyUri, + url: Url, + avatar: Url, } diff --git a/src/jobs/nodeinfo.rs b/src/jobs/nodeinfo.rs index 85de6e6..b5a5a30 100644 --- a/src/jobs/nodeinfo.rs +++ b/src/jobs/nodeinfo.rs @@ -1,19 +1,17 @@ use crate::jobs::JobState; -use activitystreams_new::{primitives::XsdAnyUri, url::Url}; +use activitystreams_new::url::Url; use anyhow::Error; use background_jobs::ActixJob; use std::{future::Future, pin::Pin}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] pub struct QueryNodeinfo { - listener: XsdAnyUri, + listener: Url, } impl QueryNodeinfo { pub fn new(listener: Url) -> Self { - QueryNodeinfo { - listener: listener.into(), - } + QueryNodeinfo { listener } } async fn perform(self, state: JobState) -> Result<(), Error> {