forked from mirrors/relay
Update deps, structopt -> clap, re-enable cargo publish
This commit is contained in:
parent
061c1a0c0a
commit
5ae4c43caa
6 changed files with 463 additions and 579 deletions
74
.drone.yml
74
.drone.yml
|
@ -381,41 +381,41 @@ trigger:
|
|||
event:
|
||||
- tag
|
||||
|
||||
# ---
|
||||
---
|
||||
|
||||
# kind: pipeline
|
||||
# type: docker
|
||||
# name: publish-crate
|
||||
#
|
||||
# platform:
|
||||
# arch: amd64
|
||||
#
|
||||
# clone:
|
||||
# disable: true
|
||||
#
|
||||
# steps:
|
||||
# - name: clone
|
||||
# image: alpine/git:latest
|
||||
# user: root
|
||||
# commands:
|
||||
# - git clone $DRONE_GIT_HTTP_URL .
|
||||
# - git checkout $DRONE_COMMIT
|
||||
# - chown -R 991:991 .
|
||||
#
|
||||
# - name: publish
|
||||
# image: asonix/rust-builder:latest-linux-amd64
|
||||
# pull: always
|
||||
# environment:
|
||||
# CRATES_IO_TOKEN:
|
||||
# from_secret: crates_io_token
|
||||
# commands:
|
||||
# - cargo publish --token $CRATES_IO_TOKEN
|
||||
#
|
||||
# depends_on:
|
||||
# - build-amd64
|
||||
# - build-arm64v8
|
||||
# - build-arm32v7
|
||||
#
|
||||
# trigger:
|
||||
# event:
|
||||
# - tag
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: publish-crate
|
||||
|
||||
platform:
|
||||
arch: amd64
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
steps:
|
||||
- name: clone
|
||||
image: alpine/git:latest
|
||||
user: root
|
||||
commands:
|
||||
- git clone $DRONE_GIT_HTTP_URL .
|
||||
- git checkout $DRONE_COMMIT
|
||||
- chown -R 991:991 .
|
||||
|
||||
- name: publish
|
||||
image: asonix/rust-builder:latest-linux-amd64
|
||||
pull: always
|
||||
environment:
|
||||
CRATES_IO_TOKEN:
|
||||
from_secret: crates_io_token
|
||||
commands:
|
||||
- cargo publish --token $CRATES_IO_TOKEN
|
||||
|
||||
depends_on:
|
||||
- build-amd64
|
||||
- build-arm64v8
|
||||
- build-arm32v7
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
|
|
913
Cargo.lock
generated
913
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
21
Cargo.toml
21
Cargo.toml
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "ap-relay"
|
||||
description = "A simple activitypub relay"
|
||||
version = "0.3.22-beta.0"
|
||||
version = "0.3.22"
|
||||
authors = ["asonix <asonix@asonix.dog>"]
|
||||
license-file = "LICENSE"
|
||||
readme = "README.md"
|
||||
|
@ -22,7 +22,7 @@ default = []
|
|||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
actix-rt = "2.6.0"
|
||||
actix-rt = "2.7.0"
|
||||
actix-web = { version = "4.0.1", default-features = false }
|
||||
actix-webfinger = "0.4.0"
|
||||
activitystreams = "0.7.0-alpha.19"
|
||||
|
@ -31,15 +31,16 @@ ammonia = "3.1.0"
|
|||
async-rwlock = "1.3.0"
|
||||
awc = { version = "3.0.0", default-features = false, features = ["rustls"] }
|
||||
base64 = "0.13"
|
||||
clap = { version = "4.0.0", features = ["derive"] }
|
||||
config = "0.13.0"
|
||||
console-subscriber = { version = "0.1", optional = true }
|
||||
dashmap = "5.1.0"
|
||||
dotenv = "0.15.0"
|
||||
futures-util = "0.3.17"
|
||||
lru = "0.7.0"
|
||||
lru = "0.8.0"
|
||||
mime = "0.3.16"
|
||||
opentelemetry = { version = "0.17", features = ["rt-tokio"] }
|
||||
opentelemetry-otlp = "0.10"
|
||||
opentelemetry = { version = "0.18", features = ["rt-tokio"] }
|
||||
opentelemetry-otlp = "0.11"
|
||||
rand = "0.8"
|
||||
rsa = "0.6"
|
||||
rsa-magic-public-key = "0.5.0"
|
||||
|
@ -47,14 +48,13 @@ serde = { version = "1.0", features = ["derive"] }
|
|||
serde_json = "1.0"
|
||||
sha2 = "0.10"
|
||||
sled = "0.34.7"
|
||||
structopt = "0.3.12"
|
||||
thiserror = "1.0"
|
||||
tracing = "0.1"
|
||||
tracing-awc = "0.1.0"
|
||||
tracing-awc = "0.1.6"
|
||||
tracing-error = "0.2"
|
||||
tracing-futures = "0.2"
|
||||
tracing-log = "0.1"
|
||||
tracing-opentelemetry = "0.17"
|
||||
tracing-opentelemetry = "0.18"
|
||||
tracing-subscriber = { version = "0.3", features = [
|
||||
"ansi",
|
||||
"env-filter",
|
||||
|
@ -66,7 +66,6 @@ uuid = { version = "1", features = ["v4", "serde"] }
|
|||
version = "0.13.0"
|
||||
default-features = false
|
||||
features = ["background-jobs-actix", "error-logging"]
|
||||
git = "https://git.asonix.dog/asonix/background-jobs"
|
||||
|
||||
[dependencies.http-signature-normalization-actix]
|
||||
version = "0.6.0"
|
||||
|
@ -74,12 +73,12 @@ default-features = false
|
|||
features = ["client", "server", "sha-2"]
|
||||
|
||||
[dependencies.tracing-actix-web]
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
|
||||
[build-dependencies]
|
||||
anyhow = "1.0"
|
||||
dotenv = "0.15.0"
|
||||
ructe = { version = "0.14.0", features = ["sass", "mime03"] }
|
||||
ructe = { version = "0.15.0", features = ["sass", "mime03"] }
|
||||
toml = "0.5.8"
|
||||
|
||||
[profile.dev.package.rsa]
|
||||
|
|
16
README.md
16
README.md
|
@ -9,21 +9,15 @@ $ ./relay
|
|||
|
||||
To learn about any other tasks, the `--help` flag can be passed
|
||||
```bash
|
||||
$ ./relay --help
|
||||
relay 0.2.0
|
||||
An activitypub relay
|
||||
|
||||
USAGE:
|
||||
relay [FLAGS] [OPTIONS]
|
||||
Usage: relay [OPTIONS]
|
||||
|
||||
FLAGS:
|
||||
-h, --help Prints help information
|
||||
Options:
|
||||
-b <BLOCKS> A list of domains that should be blocked
|
||||
-a <ALLOWED> A list of domains that should be allowed
|
||||
-u, --undo Undo allowing or blocking domains
|
||||
-V, --version Prints version information
|
||||
|
||||
OPTIONS:
|
||||
-a <allowed>... A list of domains that should be allowed
|
||||
-b <blocks>... A list of domains that should be blocked
|
||||
-h, --help Print help information
|
||||
```
|
||||
|
||||
To add domains to the blocklist, use the `-b` flag and pass a list of domains
|
||||
|
|
12
src/args.rs
12
src/args.rs
|
@ -1,21 +1,21 @@
|
|||
use structopt::StructOpt;
|
||||
use clap::Parser;
|
||||
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[derive(Debug, Parser)]
|
||||
#[structopt(name = "relay", about = "An activitypub relay")]
|
||||
pub(crate) struct Args {
|
||||
#[structopt(short, help = "A list of domains that should be blocked")]
|
||||
#[arg(short, help = "A list of domains that should be blocked")]
|
||||
blocks: Vec<String>,
|
||||
|
||||
#[structopt(short, help = "A list of domains that should be allowed")]
|
||||
#[arg(short, help = "A list of domains that should be allowed")]
|
||||
allowed: Vec<String>,
|
||||
|
||||
#[structopt(short, long, help = "Undo allowing or blocking domains")]
|
||||
#[arg(short, long, help = "Undo allowing or blocking domains")]
|
||||
undo: bool,
|
||||
}
|
||||
|
||||
impl Args {
|
||||
pub(crate) fn new() -> Self {
|
||||
Self::from_args()
|
||||
Self::parse()
|
||||
}
|
||||
|
||||
pub(crate) fn blocks(&self) -> &[String] {
|
||||
|
|
|
@ -108,7 +108,9 @@ impl State {
|
|||
let state = State {
|
||||
public_key,
|
||||
private_key,
|
||||
object_cache: Arc::new(RwLock::new(LruCache::new(1024 * 8))),
|
||||
object_cache: Arc::new(RwLock::new(LruCache::new(
|
||||
(1024 * 8).try_into().expect("nonzero"),
|
||||
))),
|
||||
node_cache: NodeCache::new(db.clone()),
|
||||
breakers: Breakers::default(),
|
||||
db,
|
||||
|
|
Loading…
Reference in a new issue