/* This file is part of jellything (https://codeberg.org/metamuffin/jellything) which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2025 metamuffin */ use super::{error::MyResult, node::DatabaseNodeUserDataExt}; use crate::{api::AcceptJson, database::Database, locale::AcceptLanguage, logic::session::Session}; use anyhow::Context; use chrono::{Datelike, Utc}; use jellycommon::{api::ApiHomeResponse, user::WatchedState, NodeID, NodeKind, Rating, Visibility}; use rocket::{get, serde::json::Json, Either, State}; #[get("/home")] pub fn r_home( sess: Session, db: &State, aj: AcceptJson, lang: AcceptLanguage, ) -> MyResult>> { let AcceptLanguage(lang) = lang; Ok(if *aj { Either::Right(Json(ApiHomeResponse { toplevel, categories, })) } else { Either::Left() }) }