Compare commits

..

7 Commits

Author SHA1 Message Date
Alie d60df6bb31 Merge tag 'v0.3.1' into develop
tag 0.3.1
2024-01-29 13:16:59 +01:00
Alie fec0b0b0b8 Merge branch 'release/v0.3.1' 2024-01-29 13:16:48 +01:00
Alie 1c0596a746 change version 2024-01-29 13:16:42 +01:00
Alie 11d740b0d6 deleted some useless lines 2024-01-29 13:15:09 +01:00
Alie a56a6b1ea9 added the alias fr this time 2024-01-26 19:07:46 +01:00
Alie 619dca1bfe clippy 2024-01-26 18:58:32 +01:00
Alie 35e2ce36e9 Merge tag 'v0.3.0' into develop
tag
2024-01-26 18:54:21 +01:00
4 changed files with 8 additions and 13 deletions

2
.cargo/config.toml Normal file
View File

@ -0,0 +1,2 @@
[alias]
t="test -- --test-threads=1"

View File

@ -1,11 +1,8 @@
[package] [package]
name = "mastodon-image-uploader-bot" name = "mastodon-image-uploader-bot"
version = "0.3.0" version = "0.3.1"
edition = "2021" 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 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]

View File

@ -10,13 +10,13 @@ spec:
spec: spec:
containers: containers:
- name: bot-job - 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: volumeMounts:
- name: config-toml - name: config-toml
mountPath: /app/ mountPath: /app/config.toml
readOnly: true readOnly: true
- name: mastodon-token - name: mastodon-token
mountPath: /app/ mountPath: /app/mastodon-data.toml
readOnly: true readOnly: true
restartPolicy: Never restartPolicy: Never
volumes: volumes:

View File

@ -1,15 +1,11 @@
use async_std;
use log;
use mastodon_async::entities::visibility::Visibility; use mastodon_async::entities::visibility::Visibility;
use mastodon_async::helpers::{cli, toml as masto_toml}; use mastodon_async::helpers::{cli, toml as masto_toml};
use mastodon_async::prelude::*; use mastodon_async::prelude::*;
use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::HashSet; use std::collections::HashSet;
use std::io::{Cursor, Write}; use std::io::{Cursor, Write};
use std::process::exit; use std::process::exit;
use std::time::Duration; use std::time::Duration;
use toml;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
struct AccountUpdate { struct AccountUpdate {
@ -176,7 +172,7 @@ fn set_url_as_posted(config: &Config, url: &String) -> DynResult<()> {
.write(true) .write(true)
.append(true) // This is needed to append to file .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 .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); log::info!("Set url {} as posted", url);
Ok(()) Ok(())
} }
@ -284,7 +280,7 @@ mod tests {
let client = reqwest::Client::new(); let client = reqwest::Client::new();
let config = get_config(); let config = get_config();
let account = get_account(&config).await; 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 status = post(&account, &msg, Visibility::Direct).await.unwrap();
let response = client let response = client