Rename all crates to start with letterbox-

This commit is contained in:
2025-02-13 09:48:24 -08:00
parent d1beaded09
commit 2076596f50
15 changed files with 82 additions and 73 deletions

View File

@@ -23,13 +23,13 @@ clap = { version = "4.5.23", features = ["derive"] }
css-inline = "0.14.0"
futures = "0.3.31"
html-escape = "0.2.13"
letterbox-notmuch = { path = "../notmuch" }
linkify = "0.10.0"
log = "0.4.17"
lol_html = "2.0.0"
mailparse = "0.16.0"
maplit = "1.0.2"
memmap = "0.7.0"
notmuch = { path = "../notmuch" }
opentelemetry = "0.28.0"
regex = "1.11.1"
reqwest = { version = "0.12.7", features = ["blocking"] }
@@ -38,7 +38,7 @@ rocket_cors = "0.6.0"
scraper = "0.22.0"
serde = { version = "1.0.147", features = ["derive"] }
serde_json = "1.0.87"
shared = { path = "../shared" }
letterbox-shared = { path = "../shared" }
sqlx = { version = "0.8.2", features = ["postgres", "runtime-tokio", "time"] }
tantivy = { version = "0.22.0", optional = true }
thiserror = "2.0.0"

View File

@@ -8,6 +8,7 @@ use std::{error::Error, io::Cursor, str::FromStr};
use async_graphql::{extensions, http::GraphiQLSource, EmptySubscription, Schema};
use async_graphql_rocket::{GraphQLQuery, GraphQLRequest, GraphQLResponse};
use cacher::FilesystemCacher;
use letterbox_notmuch::{Notmuch, NotmuchError, ThreadSet};
#[cfg(feature = "tantivy")]
use letterbox_server::tantivy::TantivyConnection;
use letterbox_server::{
@@ -16,7 +17,6 @@ use letterbox_server::{
graphql::{Attachment, GraphqlSchema, Mutation, QueryRoot},
nm::{attachment_bytes, cid_attachment_bytes},
};
use notmuch::{Notmuch, NotmuchError, ThreadSet};
use rocket::{
fairing::AdHoc,
http::{ContentType, Header},
@@ -179,7 +179,7 @@ async fn graphql_request(
async fn main() -> Result<(), Box<dyn Error>> {
let _guard = xtracing::init(env!("CARGO_BIN_NAME"))?;
build_info::build_info!(fn bi);
info!("Build Info: {}", shared::build_version(bi));
info!("Build Info: {}", letterbox_shared::build_version(bi));
let allowed_origins = AllowedOrigins::all();
let cors = rocket_cors::CorsOptions {
allowed_origins,
@@ -195,7 +195,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
let rkt = rocket::build()
.mount(
shared::urls::MOUNT_POINT,
letterbox_shared::urls::MOUNT_POINT,
routes![
original,
show_pretty,

View File

@@ -10,7 +10,7 @@ use crate::TransformError;
#[derive(Error, Debug)]
pub enum ServerError {
#[error("notmuch: {0}")]
NotmuchError(#[from] notmuch::NotmuchError),
NotmuchError(#[from] letterbox_notmuch::NotmuchError),
#[error("flatten")]
FlattenError,
#[error("mail parse error: {0}")]

View File

@@ -6,8 +6,8 @@ use async_graphql::{
SimpleObject, Union,
};
use cacher::FilesystemCacher;
use letterbox_notmuch::Notmuch;
use log::info;
use notmuch::Notmuch;
use serde::{Deserialize, Serialize};
use sqlx::postgres::PgPool;
use tokio::join;
@@ -283,7 +283,7 @@ pub struct QueryRoot;
impl QueryRoot {
async fn version<'ctx>(&self, _ctx: &Context<'ctx>) -> Result<String, Error> {
build_info::build_info!(fn bi);
Ok(shared::build_version(bi))
Ok(letterbox_shared::build_version(bi))
}
#[instrument(skip_all, fields(query=query))]
#[instrument(skip_all, fields(query=query, request_id=request_id()))]

View File

@@ -2,10 +2,10 @@ use std::collections::HashMap;
use cacher::FilesystemCacher;
use futures::{stream::FuturesUnordered, StreamExt};
use letterbox_shared::compute_color;
use log::{error, info};
use maplit::hashmap;
use scraper::Selector;
use shared::compute_color;
use sqlx::postgres::PgPool;
use tracing::instrument;
use url::Url;

View File

@@ -5,10 +5,10 @@ use std::{
time::Instant,
};
use letterbox_notmuch::Notmuch;
use log::{error, info, warn};
use mailparse::{parse_content_type, parse_mail, MailHeader, MailHeaderMap, ParsedMail};
use memmap::MmapOptions;
use notmuch::Notmuch;
use sqlx::PgPool;
use tracing::instrument;
@@ -43,7 +43,9 @@ pub fn is_notmuch_thread_or_id(id: &str) -> bool {
}
// TODO(wathiede): decide good error type
pub fn threadset_to_messages(thread_set: notmuch::ThreadSet) -> Result<Vec<Message>, ServerError> {
pub fn threadset_to_messages(
thread_set: letterbox_notmuch::ThreadSet,
) -> Result<Vec<Message>, ServerError> {
for t in thread_set.0 {
for _tn in t.0 {}
}
@@ -190,7 +192,7 @@ pub async fn thread(
.headers
.get_first_value("date")
.and_then(|d| mailparse::dateparse(&d).ok());
let cid_prefix = shared::urls::cid_prefix(None, &id);
let cid_prefix = letterbox_shared::urls::cid_prefix(None, &id);
let base_url = None;
let mut part_addr = Vec::new();
part_addr.push(id.to_string());