Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
Alie | d60df6bb31 | |
Alie | fec0b0b0b8 | |
Alie | 1c0596a746 | |
Alie | 11d740b0d6 | |
Alie | a56a6b1ea9 | |
Alie | 619dca1bfe | |
Alie | 35e2ce36e9 |
|
@ -0,0 +1,2 @@
|
||||||
|
[alias]
|
||||||
|
t="test -- --test-threads=1"
|
|
@ -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]
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue