Add debian packaging (Closes #13) #14
6 changed files with 13 additions and 13 deletions
|
@ -70,7 +70,7 @@ pub(crate) async fn run(data: Arc<RwLock<SharedData>>) {
|
||||||
Ok(data) => data,
|
Ok(data) => data,
|
||||||
Err(e) => panic!("{}", e),
|
Err(e) => panic!("{}", e),
|
||||||
};
|
};
|
||||||
let message = Message::Info("Config reloaded".to_string());
|
let message = Message::Info("Config reloaded".to_owned());
|
||||||
if !write.messages.contains(&message) {
|
if !write.messages.contains(&message) {
|
||||||
write.messages.push(message);
|
write.messages.push(message);
|
||||||
};
|
};
|
||||||
|
@ -106,7 +106,7 @@ pub(crate) async fn run(data: Arc<RwLock<SharedData>>) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let message = Message::Info("Communities reloaded".to_string());
|
let message = Message::Info("Communities reloaded".to_owned());
|
||||||
if !read.messages.contains(&message) {
|
if !read.messages.contains(&message) {
|
||||||
drop(read);
|
drop(read);
|
||||||
let mut write = data.write().await;
|
let mut write = data.write().await;
|
||||||
|
|
|
@ -32,7 +32,7 @@ impl Config {
|
||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Config {
|
Config {
|
||||||
instance: "".to_string(),
|
instance: "".to_owned(),
|
||||||
status_post_url: None,
|
status_post_url: None,
|
||||||
config_reload_seconds: 21600,
|
config_reload_seconds: 21600,
|
||||||
protected_communities: vec![],
|
protected_communities: vec![],
|
||||||
|
|
|
@ -12,13 +12,13 @@ static PAST_DAYS_ELIGIBLE: u8 = 4;
|
||||||
|
|
||||||
macro_rules! api_url {
|
macro_rules! api_url {
|
||||||
() => {
|
() => {
|
||||||
"https://labs.j-novel.club/app/v1".to_string()
|
"https://labs.j-novel.club/app/v1".to_owned()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! jnc_base_url {
|
macro_rules! jnc_base_url {
|
||||||
() => {
|
() => {
|
||||||
"https://j-novel.club".to_string()
|
"https://j-novel.club".to_owned()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ pub(crate) async fn login(credentials: &Credentials, instance: &str) -> Result<L
|
||||||
};
|
};
|
||||||
|
|
||||||
let response = match HTTP_CLIENT
|
let response = match HTTP_CLIENT
|
||||||
.post(instance.to_string() + "/api/v3/user/login")
|
.post(instance.to_owned() + "/api/v3/user/login")
|
||||||
.json(&login_params)
|
.json(&login_params)
|
||||||
.send()
|
.send()
|
||||||
.await {
|
.await {
|
||||||
|
@ -62,7 +62,7 @@ pub(crate) async fn login(credentials: &Credentials, instance: &str) -> Result<L
|
||||||
match data.jwt {
|
match data.jwt {
|
||||||
Some(token) => Ok(Lemmy {
|
Some(token) => Ok(Lemmy {
|
||||||
jwt_token: token.clone(),
|
jwt_token: token.clone(),
|
||||||
instance: instance.to_string(),
|
instance: instance.to_owned(),
|
||||||
}),
|
}),
|
||||||
None => panic!("Login did not return JWT token. Are the credentials valid?")
|
None => panic!("Login did not return JWT token. Are the credentials valid?")
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ impl SharedData {
|
||||||
SharedData {
|
SharedData {
|
||||||
messages: vec![],
|
messages: vec![],
|
||||||
config: Config {
|
config: Config {
|
||||||
instance: "".to_string(),
|
instance: "".to_owned(),
|
||||||
status_post_url: None,
|
status_post_url: None,
|
||||||
config_reload_seconds: 0,
|
config_reload_seconds: 0,
|
||||||
protected_communities: vec![],
|
protected_communities: vec![],
|
||||||
|
@ -98,7 +98,7 @@ async fn main() {
|
||||||
tui_thread.abort();
|
tui_thread.abort();
|
||||||
|
|
||||||
data = persistent_data.read().await.clone();
|
data = persistent_data.read().await.clone();
|
||||||
data.messages.push(Message::Error("Bot crashed due to unknown Error, restarting thread after wait...".to_string()));
|
data.messages.push(Message::Error("Bot crashed due to unknown Error, restarting thread after wait...".to_owned()));
|
||||||
sleep(Duration::seconds(5).to_std().expect("Conversion should always work since static")).await;
|
sleep(Duration::seconds(5).to_std().expect("Conversion should always work since static")).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ impl SeriesHistory {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn set_series(&mut self, series: &str, data: PostHistory) {
|
pub(crate) fn set_series(&mut self, series: &str, data: PostHistory) {
|
||||||
self.series.entry(series.to_string()).and_modify(|val| {
|
self.series.entry(series.to_owned()).and_modify(|val| {
|
||||||
*val = data.clone()
|
*val = data.clone()
|
||||||
})
|
})
|
||||||
.or_insert(data);
|
.or_insert(data);
|
||||||
|
@ -88,14 +88,14 @@ impl PostHistory {
|
||||||
match self.parts.get(part) {
|
match self.parts.get(part) {
|
||||||
Some(history) => history.clone(),
|
Some(history) => history.clone(),
|
||||||
None => PostHistoryInner {
|
None => PostHistoryInner {
|
||||||
volume: "".to_string(),
|
volume: "".to_owned(),
|
||||||
chapter: "".to_string(),
|
chapter: "".to_owned(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn set_part(&mut self, part: &str, data: PostHistoryInner) {
|
pub(crate) fn set_part(&mut self, part: &str, data: PostHistoryInner) {
|
||||||
self.parts.entry(part.to_string()).and_modify(|val| {
|
self.parts.entry(part.to_owned()).and_modify(|val| {
|
||||||
*val = data.clone()
|
*val = data.clone()
|
||||||
})
|
})
|
||||||
.or_insert(data);
|
.or_insert(data);
|
||||||
|
|
Loading…
Reference in a new issue