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