Compare commits

..

No commits in common. "183ddb322bd0b222ea1369145cf162aa23cb1015" and "01df079b3507e26407229e6d116790e301afa02c" have entirely different histories.

5 changed files with 27 additions and 748 deletions

1
.gitignore vendored
View file

@ -1,3 +1,2 @@
/target /target
result result
display.bmp

753
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -10,7 +10,6 @@ anyhow = "1.0.86"
axum = { version = "0.7.5", features = ["macros", "multipart"] } axum = { version = "0.7.5", features = ["macros", "multipart"] }
axum-macros = "0.4.1" axum-macros = "0.4.1"
base64 = "0.22.1" base64 = "0.22.1"
bytes = "1.7.1"
clap = { version = "4.5.7", features = ["derive"] } clap = { version = "4.5.7", features = ["derive"] }
epd-waveshare = { git = "https://github.com/caemor/epd-waveshare.git"} epd-waveshare = { git = "https://github.com/caemor/epd-waveshare.git"}
image = "0.25.1" image = "0.25.1"
@ -22,8 +21,6 @@ minijinja = { version = "2.1.0", features = ["loader"] }
minijinja-embed = "2.1.1" minijinja-embed = "2.1.1"
palette = "0.7.6" palette = "0.7.6"
rayon = "1.10.0" rayon = "1.10.0"
reqwest = { version = "0.12.5", features = ["multipart"] }
rss = "2.0.8"
rusqlite = { version = "0.32.1", features = ["bundled"] } rusqlite = { version = "0.32.1", features = ["bundled"] }
serde = { version = "1.0.204", features = ["derive"] } serde = { version = "1.0.204", features = ["derive"] }
strum = { version = "0.26.3", features = ["derive"] } strum = { version = "0.26.3", features = ["derive"] }

View file

@ -2,7 +2,6 @@ use crate::api;
use crate::display::create_display_thread; use crate::display::create_display_thread;
use crate::dither::{DitherMethod, DitheredImage}; use crate::dither::{DitherMethod, DitheredImage};
use crate::eink::Palette; use crate::eink::Palette;
use crate::imageprovider::nasa_task;
use axum::extract::{Path, State}; use axum::extract::{Path, State};
use axum::http::{header, StatusCode}; use axum::http::{header, StatusCode};
use axum::response::{IntoResponse, Response}; use axum::response::{IntoResponse, Response};
@ -12,6 +11,7 @@ use base64::{engine::general_purpose::STANDARD, Engine as _};
use image::imageops::{resize, FilterType}; use image::imageops::{resize, FilterType};
use include_dir::{include_dir, Dir, DirEntry}; use include_dir::{include_dir, Dir, DirEntry};
use minijinja::{context, Environment}; use minijinja::{context, Environment};
use mime_guess::Mime;
use std::io::Cursor; use std::io::Cursor;
use std::sync::mpsc; use std::sync::mpsc;
use std::sync::Arc; use std::sync::Arc;
@ -105,16 +105,12 @@ fn make_environment() -> Result<Environment<'static>, anyhow::Error> {
} }
pub fn make_app_router() -> Router { pub fn make_app_router() -> Router {
let context = AppState::default();
tokio::task::spawn(nasa_task(context.clone()));
Router::new() Router::new()
.route("/app", get(app_handler)) .route("/app", get(app_handler))
.route("/app/preview", post(app_preview)) .route("/app/preview", post(app_preview))
.nest("/api", api::router()) .nest("/api", api::router())
.route("/static/*path", get(asset_handler)) .route("/static/*path", get(asset_handler))
.with_state(context) .with_state(AppState::default())
} }
#[instrument(skip(ctx))] #[instrument(skip(ctx))]

View file

@ -3,8 +3,8 @@ pub mod app;
pub mod display; pub mod display;
pub mod dither; pub mod dither;
pub mod eink; pub mod eink;
pub mod imageprovider;
use serde::Deserialize;
use std::path::PathBuf; use std::path::PathBuf;
use tower_http::trace::TraceLayer; use tower_http::trace::TraceLayer;
@ -15,6 +15,14 @@ use clap::{Args, Parser, Subcommand};
use image::RgbImage; use image::RgbImage;
use tracing::{error, info}; use tracing::{error, info};
/// Application config, including sqlite db path, scan folders, and scheduling.
#[derive(Deserialize, Debug)]
struct Config {
database_path: PathBuf,
search_paths: Vec<PathBuf>,
host: String,
}
/// Display images on E-Ink Displays /// Display images on E-Ink Displays
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[command(version, about)] #[command(version, about)]