Compare commits

..

No commits in common. "5a2cf10883c4f2d87ccc476382344c68bd03a8e8" and "8345de8f0c96d7f44856fd7b3373c73e0214a8b4" have entirely different histories.

4 changed files with 61 additions and 188 deletions

179
Cargo.lock generated
View File

@ -50,16 +50,34 @@ dependencies = [
]
[[package]]
name = "atty"
version = "0.2.14"
name = "argh"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
checksum = "a7e7e4aa7e40747e023c0761dafcb42333a9517575bbf1241747f68dd3177a62"
dependencies = [
"hermit-abi",
"libc",
"winapi",
"argh_derive",
"argh_shared",
]
[[package]]
name = "argh_derive"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69f2bd7ff6ed6414f4e5521bd509bae46454bbd513801767ced3f21a751ab4bc"
dependencies = [
"argh_shared",
"heck",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "argh_shared"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47253b98986dafc7a3e1cf3259194f1f47ac61abb57a57f46ec09e48d004ecda"
[[package]]
name = "autocfg"
version = "1.1.0"
@ -70,9 +88,10 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
name = "aviary-cli"
version = "0.1.0"
dependencies = [
"argh",
"argh_derive",
"base64",
"blurhash",
"clap",
"image",
"iota-crypto",
"itertools",
@ -174,46 +193,6 @@ dependencies = [
"generic-array",
]
[[package]]
name = "clap"
version = "3.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29e724a68d9319343bb3328c9cc2dfde263f4b3142ee1059a9980580171c954b"
dependencies = [
"atty",
"bitflags",
"clap_derive",
"clap_lex",
"indexmap",
"once_cell",
"strsim",
"termcolor",
"textwrap",
"unicase",
]
[[package]]
name = "clap_derive"
version = "3.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13547f7012c01ab4a0e8f8967730ada8f9fdf419e8b6c792788f39cf4e46eefa"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "clap_lex"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
dependencies = [
"os_str_bytes",
]
[[package]]
name = "color_quant"
version = "1.1.0"
@ -346,25 +325,13 @@ dependencies = [
"weezl",
]
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "heck"
version = "0.4.0"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
dependencies = [
"libc",
"unicode-segmentation",
]
[[package]]
@ -405,16 +372,6 @@ dependencies = [
"tiff",
]
[[package]]
name = "indexmap"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]]
name = "iota-crypto"
version = "0.13.0"
@ -553,12 +510,6 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "os_str_bytes"
version = "6.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff"
[[package]]
name = "percent-encoding"
version = "2.1.0"
@ -589,30 +540,6 @@ dependencies = [
"universal-hash",
]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro2"
version = "1.0.43"
@ -717,12 +644,6 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "subtle"
version = "2.4.1"
@ -740,24 +661,6 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"winapi-util",
]
[[package]]
name = "textwrap"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
dependencies = [
"unicode-width",
]
[[package]]
name = "thiserror"
version = "1.0.32"
@ -810,15 +713,6 @@ version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
[[package]]
name = "unicase"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
dependencies = [
"version_check",
]
[[package]]
name = "unicode-bidi"
version = "0.3.8"
@ -841,10 +735,10 @@ dependencies = [
]
[[package]]
name = "unicode-width"
version = "0.1.9"
name = "unicode-segmentation"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99"
[[package]]
name = "universal-hash"
@ -1017,15 +911,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"

View File

@ -2,13 +2,12 @@
name = "aviary-cli"
version = "0.1.0"
edition = "2021"
authors = ["Emi Simpson <emi@alchemi.dev>"]
description = "Create and download E2E encrypted image galleries"
repository = "https://fem.mint.lgbt/Emi/aviary-cli"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
argh = "0.1.8"
argh_derive = "0.1.8"
webp = "0.2.2"
itertools = "0.10.3"
blurhash = "0.1.1"
@ -31,14 +30,6 @@ version = "0.24.3"
default-features = false
features = ["gif", "jpeg", "ico", "png", "tiff", "webp", "bmp", "hdr"]
[dependencies.clap]
version = "3.2.12"
features = ["std", "color", "suggestions", "derive", "cargo", "unicode"]
[profile.release]
lto = true
codegen-units = 1
[[bin]]
name = "aviary"
path = "src/main.rs"

View File

@ -10,7 +10,6 @@ use std::io::{Read, Write, self};
use std::fs::{File, self, OpenOptions};
use std::path::Path;
use clap::Parser;
use errors::AviaryUploadError;
use itertools::{Itertools, Either};
use parse::{CreateArgs, Command, DownloadArgs};
@ -38,7 +37,7 @@ fn trim_url<'a>(base_url: &str, url: &'a str) -> Option<&'a str> {
}
fn main() {
let args = parse::Args::parse();
let args: parse::Args = argh::from_env();
let server_no_trailing_slash = args.server.trim_end_matches('/');
let full_server = if server_no_trailing_slash.starts_with("http") {
Cow::Borrowed(server_no_trailing_slash)

View File

@ -1,70 +1,68 @@
use std::path::PathBuf;
use clap::{Parser, Subcommand};
use argh_derive::FromArgs;
#[derive(Clone, Debug, Parser)]
#[clap(name = "aviary")]
/// Create and download E2E encrypted image galleries
#[derive(FromArgs)]
/// Create Aviary galleries
pub struct Args {
/// The null pointer server to use
#[clap(long, short, default_value = "0x0.corviform.gay")]
/// the null pointer server to use
#[argh(option, short = 's', default = "\"envs.sh\".to_owned()")]
pub server: String,
#[clap(subcommand)]
#[argh(subcommand)]
pub command: Command,
}
#[derive(Clone, Debug, Subcommand)]
#[derive(FromArgs)]
#[argh(subcommand)]
pub enum Command {
Create(CreateArgs),
Download(DownloadArgs),
}
#[derive(Clone, Debug, Parser)]
/// Upload a series of images to a new gallery
#[derive(FromArgs)]
#[argh(subcommand, name = "create")]
/// upload a series of images to a new gallery
pub struct CreateArgs {
/// The title of the gallery
#[clap(long, short)]
/// the title of the gallery
#[argh(option, short = 't')]
pub title: Option<String>,
/// A list of image files to post
#[clap(required = true, min_values = 1)]
pub images: Vec<PathBuf>,
#[argh(positional)]
pub images: Vec<String>,
}
#[derive(Clone, Debug, Parser)]
/// Download a gallery
#[derive(FromArgs)]
#[argh(subcommand, name = "download")]
/// download a gallery
pub struct DownloadArgs {
/// The file id
#[argh(positional)]
/// the file id
///
/// This is a short series of characters that identifies the file
/// For the url:
///
/// https://0x0.st/asdj.bin#omONdEzrY6SfdBgHn/2P6yG33PeIhuj3/SGm/lDhd2U=
///
/// the file id is asdj
#[clap(required = true)]
pub id: String,
/// The encryption key
#[argh(positional)]
/// the encryption key
///
/// This is the text after the # sign which is the secret for decrypting the pictures.
/// For the url:
///
/// https://0x0.st/asdj.bin#omONdEzrY6SfdBgHn/2P6yG33PeIhuj3/SGm/lDhd2U=
///
/// the encryption key is omONdEzrY6SfdBgHn/2P6yG33PeIhuj3/SGm/lDhd2U=
#[clap(required = true)]
pub key: String,
/// The directory to put the new files into
#[argh(option, short='o')]
/// the directory to put the new files into
///
/// A directory will be generated based on the name of the gallery if this is not set
#[clap(long, short)]
pub output: Option<PathBuf>,
/// Overwrite any existing files in the output directory
#[clap(long, short)]
#[argh(switch, short='f')]
/// overwrite any existing files in the output directory
pub force: bool,
}