aboutsummaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/compat/youtube.rs6
-rw-r--r--server/src/ui/home.rs27
2 files changed, 31 insertions, 2 deletions
diff --git a/server/src/compat/youtube.rs b/server/src/compat/youtube.rs
index 9d27235..a5f540b 100644
--- a/server/src/compat/youtube.rs
+++ b/server/src/compat/youtube.rs
@@ -38,7 +38,8 @@ pub fn r_youtube_watch(ri: RequestInfo<'_>, v: &str) -> MyResult<Redirect> {
}
#[get("/channel/<id>")]
-pub fn r_youtube_channel(ri: RequestInfo<'_>, id: &str) -> MyResult<Redirect> {
+pub fn r_youtube_channel(_ri: RequestInfo<'_>, id: &str) -> MyResult<Redirect> {
+ let _ = id;
// let Some(id) = (if id.starts_with("UC") {
// get_node_by_eid(&session.0, IdentifierType::YoutubeChannel, id)?
// } else if id.starts_with("@") {
@@ -54,7 +55,8 @@ pub fn r_youtube_channel(ri: RequestInfo<'_>, id: &str) -> MyResult<Redirect> {
}
#[get("/embed/<v>")]
-pub fn r_youtube_embed(ri: RequestInfo<'_>, v: &str) -> MyResult<Redirect> {
+pub fn r_youtube_embed(_ri: RequestInfo<'_>, v: &str) -> MyResult<Redirect> {
+ let _ = v;
// if v.len() != 11 {
// Err(anyhow!("video id length incorrect"))?
// }
diff --git a/server/src/ui/home.rs b/server/src/ui/home.rs
index f6340be..0fd4432 100644
--- a/server/src/ui/home.rs
+++ b/server/src/ui/home.rs
@@ -45,6 +45,15 @@ pub fn r_home(ri: RequestInfo<'_>) -> MyResult<UiResponse> {
);
page.push(
VIEW_NODE_LIST,
+ home_row_highlight(
+ &ri,
+ "home.bin.daily_random",
+ "FILTER (visi = visi AND kind = movi) SORT RANDOM",
+ )?
+ .as_object(),
+ );
+ page.push(
+ VIEW_NODE_LIST,
home_row(
&ri,
"home.bin.max_rating",
@@ -77,3 +86,21 @@ fn home_row(ri: &RequestInfo<'_>, title: &str, query: &str) -> Result<ObjectBuff
})?;
Ok(res)
}
+
+fn home_row_highlight(ri: &RequestInfo<'_>, title: &str, query: &str) -> Result<ObjectBuffer> {
+ let q = Query::from_str(query).context("parse query")?;
+ let mut res = ObjectBuffer::empty();
+ ri.state.database.transaction(&mut |txn| {
+ let Some(row) = txn.query(q.clone())?.next() else {
+ return Ok(());
+ };
+ let row = row?.0;
+ let node = txn.get(row)?.unwrap();
+ let nku = ObjectBuffer::new(&mut [(NKU_NODE.0, &node.as_object())]);
+ res = Object::EMPTY.insert(NODELIST_DISPLAYSTYLE, NLSTYLE_HIGHLIGHT);
+ res = res.as_object().insert(NODELIST_TITLE, title);
+ res = res.as_object().insert(NODELIST_ITEM, nku.as_object());
+ Ok(())
+ })?;
+ Ok(res)
+}