aboutsummaryrefslogtreecommitdiff
path: root/server/src/ui/search.rs
blob: 8ec2697db82393004d3f1abcb0e16b357780894f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
    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) 2026 metamuffin <metamuffin.org>
*/
use super::error::MyResult;
use crate::request_info::RequestInfo;
use anyhow::anyhow;
use rocket::{Either, get, response::content::RawHtml, serde::json::Json};

#[get("/search?<query>&<page>")]
pub async fn r_search(
    ri: RequestInfo<'_>,
    query: Option<&str>,
    page: Option<usize>,
) -> MyResult<RawHtml<String>> {
    // let r = query
    //     .map(|query| search(&ri.session, query, page))
    //     .transpose()?;

    // Ok(if ri.accept.is_json() {
    //     let Some(r) = r else {
    //         Err(anyhow!("no query"))?
    //     };
    //     Either::Right(Json(r))
    // } else {
    //     Either::Left(RawHtml(render_page(
    //         &SearchPage {
    //             lang: &ri.lang,
    //             query: &query.map(|s| s.to_string()),
    //             r,
    //         },
    //         ri.render_info(),
    //     )))
    // })
    todo!()
}