add nasa IOTD service
This commit is contained in:
parent
821954b774
commit
183ddb322b
753
Cargo.lock
generated
753
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -10,6 +10,7 @@ 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"
|
||||||
|
@ -21,6 +22,8 @@ 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"] }
|
||||||
|
|
|
@ -2,6 +2,7 @@ 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};
|
||||||
|
@ -11,7 +12,6 @@ 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,12 +105,16 @@ 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(AppState::default())
|
.with_state(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(ctx))]
|
#[instrument(skip(ctx))]
|
||||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -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,14 +15,6 @@ 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)]
|
||||||
|
|
Loading…
Reference in a new issue