Famous people: admin page, own prompt, one photo, public pages
- Admin "Híres emberek": birth data, one photo (S3: DigitalOcean Spaces in production, RustFS in development), a face point that every crop keeps in view, publishing, and a detailed portrait written with its own `celebrity` prompt (third person, by name, from the chart alone). - The photo is stored once (upright JPEG, at most 2000 px, no metadata); next/image makes the sizes from it, so Cloudflare can cache those. - Public list and pages (/hires-emberek), in the sitemap, with a share image showing the face and the chart. - Share images: the wheel's glyphs and numbers are drawn with the card's fonts (inside the SVG image they came out as boxes, on every card). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -17,7 +17,9 @@ mod models;
|
||||
mod oidc;
|
||||
mod packages;
|
||||
mod persons;
|
||||
mod photo;
|
||||
mod routes;
|
||||
mod storage;
|
||||
mod stripe;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
@@ -52,6 +54,8 @@ pub struct AppState {
|
||||
pub share_visits: LoginLimiter,
|
||||
pub models: models::Catalog,
|
||||
pub stripe: stripe::Client,
|
||||
/// Uploaded photos; `None` when no object storage is configured.
|
||||
pub storage: Option<storage::Storage>,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
@@ -66,6 +70,7 @@ impl AppState {
|
||||
share_visits: LoginLimiter::new(1, Duration::from_secs(30 * 60)),
|
||||
models: models::Catalog::new(&config.openrouter_models_url),
|
||||
stripe: stripe::Client::default(),
|
||||
storage: config.storage.clone().map(storage::Storage::new),
|
||||
db,
|
||||
config,
|
||||
}
|
||||
@@ -91,7 +96,14 @@ async fn main() -> anyhow::Result<()> {
|
||||
if std::env::args().nth(1).as_deref() == Some("recalculate") {
|
||||
return routes::recalculate(&AppState::new(pool, config)).await;
|
||||
}
|
||||
let app = routes::router(Arc::new(AppState::new(pool, config)));
|
||||
let state = AppState::new(pool, config);
|
||||
if state.config.storage_create_bucket
|
||||
&& let Some(storage) = &state.storage
|
||||
&& let Err(e) = storage.ensure_bucket().await
|
||||
{
|
||||
tracing::warn!(error = %e, "creating the object storage bucket failed");
|
||||
}
|
||||
let app = routes::router(Arc::new(state));
|
||||
let listener = tokio::net::TcpListener::bind(addr).await.with_context(|| format!("binding {addr}"))?;
|
||||
tracing::info!(%addr, "listening");
|
||||
axum::serve(listener, app).with_graceful_shutdown(service_kit::shutdown_signal()).await?;
|
||||
|
||||
Reference in New Issue
Block a user