Reorganize workspace layout and split out blahd

This commit is contained in:
oxalica 2024-08-30 19:16:44 -04:00
parent 370722731b
commit 668b873b07
10 changed files with 89 additions and 66 deletions

View file

@ -4,14 +4,13 @@ version = "0.1.0"
edition = "2021"
[dependencies]
anyhow = "1.0.86"
bitflags = "2.6.0"
blah.path = ".."
clap = { version = "4.5.16", features = ["derive"] }
ed25519-dalek = { version = "2.1.1", features = ["pkcs8", "pem", "rand_core"] }
anyhow = "1"
clap = { version = "4", features = ["derive"] }
ed25519-dalek = { version = "2", features = ["pkcs8", "pem", "rand_core"] }
hex = "0.4"
rand = "0.8.5"
reqwest = { version = "0.12.7", features = ["json"] }
rusqlite = "0.32.1"
tokio = { version = "1.39.3", features = ["rt", "macros"] }
uuid = "1.10.0"
rand = "0.8"
reqwest = { version = "0.12", features = ["json"] }
rusqlite = "0.32"
tokio = { version = "1", features = ["rt", "macros"] }
blah = { path = "..", features = ["rusqlite"] }

View file

@ -3,11 +3,12 @@ use std::path::{Path, PathBuf};
use std::{fs, io};
use anyhow::{Context, Result};
use bitflags::Flags;
use blah::bitflags;
use blah::types::{
ChatPayload, CreateRoomPayload, MemberPermission, RichText, RoomAttrs, RoomMember,
RoomMemberList, ServerPermission, UserKey, WithSig,
};
use blah::uuid::Uuid;
use ed25519_dalek::pkcs8::spki::der::pem::LineEnding;
use ed25519_dalek::pkcs8::{DecodePrivateKey, DecodePublicKey, EncodePrivateKey, EncodePublicKey};
use ed25519_dalek::{SigningKey, VerifyingKey, PUBLIC_KEY_LENGTH};
@ -15,7 +16,6 @@ use rand::rngs::OsRng;
use reqwest::Url;
use rusqlite::{named_params, Connection};
use tokio::runtime::Runtime;
use uuid::Uuid;
/// NB. Sync with docs of [`User::url`].
const KEY_URL_SUBPATH: &str = "/.well-known/blah/key";
@ -66,7 +66,7 @@ enum DbCommand {
},
}
fn flag_parser<T: Flags>(s: &str) -> clap::error::Result<T> {
fn flag_parser<T: bitflags::Flags>(s: &str) -> clap::error::Result<T> {
bitflags::parser::from_str_strict(s)
.map_err(|_| clap::Error::new(clap::error::ErrorKind::InvalidValue))
}
@ -142,7 +142,7 @@ impl User {
}
}
static INIT_SQL: &str = include_str!("../../init.sql");
static INIT_SQL: &str = include_str!("../../blahd/init.sql");
fn main() -> Result<()> {
let cli = <Cli as clap::Parser>::parse();