aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/src/lib.rs4
-rw-r--r--server/src/import.rs17
-rw-r--r--server/src/routes/ui/node.rs6
3 files changed, 20 insertions, 7 deletions
diff --git a/client/src/lib.rs b/client/src/lib.rs
index 4b111d1..39bd1fd 100644
--- a/client/src/lib.rs
+++ b/client/src/lib.rs
@@ -1,5 +1,5 @@
use anyhow::Result;
-use jellycommon::Node;
+use jellycommon::NodePublic;
use reqwest::{
header::{HeaderMap, HeaderValue},
Client,
@@ -69,7 +69,7 @@ impl Session {
format!("session={}", self.session_token)
}
- pub async fn node(&self, id: &str) -> Result<Node> {
+ pub async fn node(&self, id: &str) -> Result<NodePublic> {
Ok(self
.client
.get(format!("{}/n/{id}", self.instance.base()))
diff --git a/server/src/import.rs b/server/src/import.rs
index a172ad9..98e0504 100644
--- a/server/src/import.rs
+++ b/server/src/import.rs
@@ -6,7 +6,7 @@
use crate::{database::Database, federation::Federation, CONF};
use anyhow::{anyhow, bail, Context, Ok};
use async_recursion::async_recursion;
-use jellycommon::{Node, RemoteImportOptions};
+use jellycommon::{MediaSource, Node, NodePrivate, RemoteImportOptions};
use log::{error, info};
use std::{ffi::OsStr, fs::File, os::unix::prelude::OsStrExt, path::PathBuf, sync::LazyLock};
use tokio::sync::Semaphore;
@@ -119,9 +119,22 @@ async fn import_remote(
.context("creating session")?;
let node = sess.node(&opts.id).await.context("fetching remote node")?;
- if !node.public.children.is_empty() {
+ if !node.children.is_empty() {
todo!()
}
+ let node = Node {
+ public: node,
+ private: NodePrivate {
+ backdrop: None,
+ poster: None,
+ import: None,
+ source: Some(MediaSource::Remote {
+ host: opts.host,
+ remote_id: opts.id,
+ }),
+ },
+ };
+
Ok(node)
}
diff --git a/server/src/routes/ui/node.rs b/server/src/routes/ui/node.rs
index 93186bf..a784482 100644
--- a/server/src/routes/ui/node.rs
+++ b/server/src/routes/ui/node.rs
@@ -17,7 +17,7 @@ use crate::{
uri,
};
use anyhow::{anyhow, Context};
-use jellycommon::{Node, NodeKind};
+use jellycommon::{Node, NodeKind, NodePublic};
use rocket::{get, serde::json::Json, Either, State};
#[get("/n/<id>")]
@@ -26,7 +26,7 @@ pub async fn r_library_node(
id: String,
db: &State<Database>,
aj: AcceptJson,
-) -> Result<Either<DynLayoutPage<'_>, Json<Node>>, MyError> {
+) -> Result<Either<DynLayoutPage<'_>, Json<NodePublic>>, MyError> {
let node = db
.node
.get(&id)
@@ -34,7 +34,7 @@ pub async fn r_library_node(
.ok_or(anyhow!("node does not exist"))?;
if *aj {
- return Ok(Either::Right(Json(node)));
+ return Ok(Either::Right(Json(node.public)));
}
let children = node