From 619dca1bfeab59dc58914f32c8ba315e545bf18f Mon Sep 17 00:00:00 2001 From: Alie Date: Fri, 26 Jan 2024 18:58:32 +0100 Subject: [PATCH 1/4] clippy --- src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 540e562..1aabc3f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,15 +1,15 @@ -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 +176,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 +284,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 From a56a6b1ea9aa7af888daf7ec0807d411dc0cd796 Mon Sep 17 00:00:00 2001 From: Alie Date: Fri, 26 Jan 2024 19:07:46 +0100 Subject: [PATCH 2/4] added the alias fr this time --- .cargo/config.toml | 2 ++ Cargo.toml | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 .cargo/config.toml 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..0ff4737 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,9 +3,6 @@ name = "mastodon-image-uploader-bot" version = "0.3.0" 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] From 11d740b0d670b4dfabd0a268d9b23d96803e15f9 Mon Sep 17 00:00:00 2001 From: Alie Date: Mon, 29 Jan 2024 13:15:09 +0100 Subject: [PATCH 3/4] deleted some useless lines --- cron.yaml | 6 +++--- src/main.rs | 4 ---- 2 files changed, 3 insertions(+), 7 deletions(-) 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 1aabc3f..433851f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,16 +1,12 @@ - - use mastodon_async::entities::visibility::Visibility; use mastodon_async::helpers::{cli, toml as masto_toml}; use mastodon_async::prelude::*; - use serde::{Deserialize, Serialize}; use std::collections::HashSet; use std::io::{Cursor, Write}; use std::process::exit; use std::time::Duration; - #[derive(Debug, Serialize)] struct AccountUpdate { note: String, From 1c0596a746651b8520bfefa41ae023472b442bba Mon Sep 17 00:00:00 2001 From: Alie Date: Mon, 29 Jan 2024 13:16:42 +0100 Subject: [PATCH 4/4] change version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0ff4737..aaa6ee2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mastodon-image-uploader-bot" -version = "0.3.0" +version = "0.3.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html