diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..c9ca2d1 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[alias] +t="test -- --test-threads=1" \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 3addf43..aaa6ee2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,8 @@ [package] name = "mastodon-image-uploader-bot" -version = "0.3.0" +version = "0.3.1" edition = "2021" -[alias] -test = "cargo test -- --test-threads=1" - # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/cron.yaml b/cron.yaml index e6c4adc..0991435 100644 --- a/cron.yaml +++ b/cron.yaml @@ -10,13 +10,13 @@ spec: spec: containers: - name: bot-job - image: git.fai.st/fedi-image-bot/mastodon-image-uploader-bot:latest + image: git.fai.st/fedi-image-bot/mastodon-image-uploader-bot:v1.0.0 volumeMounts: - name: config-toml - mountPath: /app/ + mountPath: /app/config.toml readOnly: true - name: mastodon-token - mountPath: /app/ + mountPath: /app/mastodon-data.toml readOnly: true restartPolicy: Never volumes: diff --git a/src/main.rs b/src/main.rs index 540e562..433851f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,15 +1,11 @@ -use async_std; -use log; use mastodon_async::entities::visibility::Visibility; use mastodon_async::helpers::{cli, toml as masto_toml}; use mastodon_async::prelude::*; -use reqwest; use serde::{Deserialize, Serialize}; use std::collections::HashSet; use std::io::{Cursor, Write}; use std::process::exit; use std::time::Duration; -use toml; #[derive(Debug, Serialize)] struct AccountUpdate { @@ -176,7 +172,7 @@ fn set_url_as_posted(config: &Config, url: &String) -> DynResult<()> { .write(true) .append(true) // This is needed to append to file .open(&config.files.posted)?; //.expect("Cannot open posted file"); // Maybe we should retry just in case - write!(file, "{}\n", url)?; //.expect("Cannot write to posted file"); // maybe we should retry tbh + writeln!(file, "{}", url)?; //.expect("Cannot write to posted file"); // maybe we should retry tbh log::info!("Set url {} as posted", url); Ok(()) } @@ -284,7 +280,7 @@ mod tests { let client = reqwest::Client::new(); let config = get_config(); let account = get_account(&config).await; - let msg = format!("Test!"); + let msg = "Test!".to_string(); let status = post(&account, &msg, Visibility::Direct).await.unwrap(); let response = client