pub mod comment;
pub mod community;
+pub mod instance;
pub mod person;
pub mod post;
pub mod private_message;
};
use lemmy_websocket::{chat_server::ChatServer, LemmyContext};
use reqwest::Client;
+ use reqwest_middleware::ClientBuilder;
use serde::de::DeserializeOwned;
use std::{fs::File, io::BufReader, sync::Arc};
use tokio::sync::Mutex;
.user_agent(build_user_agent(&settings))
.build()
.unwrap();
+
+ let client = ClientBuilder::new(client).build();
let secret = Secret {
id: 0,
jwt_secret: "".to_string(),
LemmyContext::create(pool, chat_server, client, activity_queue, settings, secret)
}
- pub(crate) fn file_to_json_object<T: DeserializeOwned>(path: &str) -> T {
- let file = File::open(path).unwrap();
+ pub(crate) fn file_to_json_object<T: DeserializeOwned>(path: &str) -> Result<T, LemmyError> {
+ let file = File::open(path)?;
let reader = BufReader::new(file);
- serde_json::from_reader(reader).unwrap()
+ Ok(serde_json::from_reader(reader)?)
}
}