chore: bit of cleanup
parent
bf100049b1
commit
32e27978ec
|
@ -1,4 +1,4 @@
|
||||||
use crate::repo::{MetaRepoMgr, RepoGroupManager};
|
use crate::repo::MetaRepoMgr;
|
||||||
use crate::{Config, Global};
|
use crate::{Config, Global};
|
||||||
|
|
||||||
use axum::extract::FromRef;
|
use axum::extract::FromRef;
|
||||||
|
@ -82,7 +82,6 @@ impl Cli {
|
||||||
|
|
||||||
let config = Config {
|
let config = Config {
|
||||||
data_dir: self.data_dir.clone(),
|
data_dir: self.data_dir.clone(),
|
||||||
api_key: self.api_key.clone(),
|
|
||||||
};
|
};
|
||||||
let repo_manager = MetaRepoMgr::new(&self.data_dir.join("repos"));
|
let repo_manager = MetaRepoMgr::new(&self.data_dir.join("repos"));
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,10 @@ pub struct Filter {
|
||||||
|
|
||||||
impl IntoCondition for Filter {
|
impl IntoCondition for Filter {
|
||||||
fn into_condition(self) -> Condition {
|
fn into_condition(self) -> Condition {
|
||||||
Condition::all().add_option(self.name.map(|name| package::Column::Name.like(name)))
|
Condition::all().add_option(
|
||||||
|
self.name
|
||||||
|
.map(|name| repo::Column::Name.like(format!("%{}%", name))),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ mod repo;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
pub use error::{Result, ServerError};
|
pub use error::{Result, ServerError};
|
||||||
use repo::MetaRepoMgr;
|
use repo::MetaRepoMgr;
|
||||||
use repo::RepoGroupManager;
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
|
@ -15,7 +14,6 @@ use tokio::sync::RwLock;
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
data_dir: PathBuf,
|
data_dir: PathBuf,
|
||||||
api_key: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|
|
@ -1,17 +1,10 @@
|
||||||
use std::io::{self, Write};
|
use std::io;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use tokio::sync::{mpsc, oneshot};
|
|
||||||
|
|
||||||
use libarchive::write::{Builder, FileWriter, WriteEntry};
|
use libarchive::write::{Builder, FileWriter, WriteEntry};
|
||||||
use libarchive::{Entry, WriteFilter, WriteFormat};
|
use libarchive::{Entry, WriteFilter, WriteFormat};
|
||||||
|
|
||||||
enum Message {
|
|
||||||
AppendFilesEntry(oneshot::Sender<io::Result<()>>, String),
|
|
||||||
AppendLine(oneshot::Sender<io::Result<()>>, String),
|
|
||||||
Close(oneshot::Sender<io::Result<()>>),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Struct to abstract away the intrinsics of writing entries to an archive file
|
/// Struct to abstract away the intrinsics of writing entries to an archive file
|
||||||
pub struct RepoArchiveWriter {
|
pub struct RepoArchiveWriter {
|
||||||
ar: Arc<Mutex<FileWriter>>,
|
ar: Arc<Mutex<FileWriter>>,
|
||||||
|
|
|
@ -3,13 +3,9 @@ mod manager;
|
||||||
mod manager_new;
|
mod manager_new;
|
||||||
pub mod package;
|
pub mod package;
|
||||||
|
|
||||||
pub use manager::RepoGroupManager;
|
|
||||||
pub use manager_new::MetaRepoMgr;
|
pub use manager_new::MetaRepoMgr;
|
||||||
use tokio_util::io::StreamReader;
|
use tokio_util::io::StreamReader;
|
||||||
|
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
use crate::db;
|
|
||||||
use axum::body::Body;
|
use axum::body::Body;
|
||||||
use axum::extract::{Path, State};
|
use axum::extract::{Path, State};
|
||||||
use axum::http::Request;
|
use axum::http::Request;
|
||||||
|
@ -18,17 +14,9 @@ use axum::response::IntoResponse;
|
||||||
use axum::routing::{delete, post};
|
use axum::routing::{delete, post};
|
||||||
use axum::Router;
|
use axum::Router;
|
||||||
use futures::TryStreamExt;
|
use futures::TryStreamExt;
|
||||||
use futures::{Stream, StreamExt};
|
|
||||||
use regex::Regex;
|
|
||||||
use sea_orm::ModelTrait;
|
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::{fs, io::AsyncWriteExt};
|
|
||||||
use tower::util::ServiceExt;
|
use tower::util::ServiceExt;
|
||||||
use tower_http::services::{ServeDir, ServeFile};
|
use tower_http::services::ServeFile;
|
||||||
use tower_http::validate_request::ValidateRequestHeaderLayer;
|
use tower_http::validate_request::ValidateRequestHeaderLayer;
|
||||||
use uuid::Uuid;
|
|
||||||
|
|
||||||
const DB_FILE_EXTS: [&str; 4] = [".db", ".files", ".db.tar.gz", ".files.tar.gz"];
|
|
||||||
|
|
||||||
pub fn router(api_key: &str) -> Router<crate::Global> {
|
pub fn router(api_key: &str) -> Router<crate::Global> {
|
||||||
Router::new()
|
Router::new()
|
||||||
|
|
Loading…
Reference in New Issue