Compare commits
14 Commits
Author | SHA1 | Date |
---|---|---|
Renovate Bot | 926959fa7e | |
bizcochito | 94e3f53d19 | |
Renovate Bot | e83b20081b | |
Renovate Bot | 3a7a39d170 | |
bizcochito | 22e2dd92e6 | |
bizcochito | cffc5e04e0 | |
Renovate Bot | 1a384cfdfe | |
bizcochito | 27f0b1bfe6 | |
Renovate Bot | a2aa2654ff | |
bizcochito | d50c1d7e61 | |
bizcochito | 9aa7be030a | |
Renovate Bot | f4e463abc1 | |
Renovate Bot | 5d91a9979e | |
Alie | 9b9ddc1d42 |
|
@ -43,7 +43,7 @@ jobs:
|
||||||
username: ${{ secrets.DOCKER_USER }}
|
username: ${{ secrets.DOCKER_USER }}
|
||||||
password: ${{ secrets.DOCKER_PASS }}
|
password: ${{ secrets.DOCKER_PASS }}
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6
|
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6
|
||||||
with:
|
with:
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
context: .
|
context: .
|
||||||
|
|
|
@ -646,9 +646,9 @@ checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.22"
|
version = "0.4.25"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mastodon-image-uploader-bot"
|
name = "mastodon-image-uploader-bot"
|
||||||
|
@ -1201,9 +1201,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.42.0"
|
version = "1.43.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551"
|
checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
@ -1217,9 +1217,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-macros"
|
name = "tokio-macros"
|
||||||
version = "2.4.0"
|
version = "2.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
|
checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
@ -6,9 +6,9 @@ edition = "2021"
|
||||||
# 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]
|
||||||
tokio = { version = "=1.42.0", features = ["macros", "rt-multi-thread"] }
|
tokio = { version = "=1.43.0", features = ["macros", "rt-multi-thread"] }
|
||||||
reqwest = { version = "=0.12.12", features = ["json", "multipart", "stream"] }
|
reqwest = { version = "=0.12.12", features = ["json", "multipart", "stream"] }
|
||||||
serde = { version = "=1.0.217", features = ["derive"] }
|
serde = { version = "=1.0.217", features = ["derive"] }
|
||||||
toml = "=0.8.19"
|
toml = "=0.8.19"
|
||||||
log = "=0.4.22"
|
log = "=0.4.25"
|
||||||
stderrlog = "=0.6.0"
|
stderrlog = "=0.6.0"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
FROM rust:1.83.0-slim-bullseye AS deps
|
FROM rust:1.84.0-slim-bullseye AS deps
|
||||||
RUN apt update && apt install pkg-config ca-certificates openssl libssl-dev -y
|
RUN apt update && apt install pkg-config ca-certificates openssl libssl-dev -y
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY Cargo.toml Cargo.toml
|
COPY Cargo.toml Cargo.toml
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": ["config:recommended", "helpers:pinGitHubActionDigests"],
|
"extends": ["config:recommended", "helpers:pinGitHubActionDigests"],
|
||||||
"rangeStrategy": "pin"
|
"rangeStrategy": "pin",
|
||||||
|
"automerge": true
|
||||||
}
|
}
|
12
src/main.rs
12
src/main.rs
|
@ -65,7 +65,7 @@ struct Errors {
|
||||||
retry: u8,
|
retry: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main] // requires `features = ["mt"]
|
#[tokio::main]
|
||||||
async fn main() -> DynResult<()> {
|
async fn main() -> DynResult<()> {
|
||||||
stderrlog::new()
|
stderrlog::new()
|
||||||
.module(module_path!())
|
.module(module_path!())
|
||||||
|
@ -175,8 +175,8 @@ fn generate_config() -> DynResult<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_config(filename: &str) -> DynResult<Config> {
|
fn parse_config(filename: &str) -> DynResult<Config> {
|
||||||
let toml_file = std::fs::read_to_string(filename)?; //.expect("No config file, consider getting the original one and modifing it");
|
let toml_file = std::fs::read_to_string(filename)?;
|
||||||
Ok(toml::from_str(&toml_file)?) //("Malformed config file, check the original one for reference")
|
Ok(toml::from_str(&toml_file)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_next_url(config: &Config) -> DynResult<Option<Image>> {
|
async fn get_next_url(config: &Config) -> DynResult<Option<Image>> {
|
||||||
|
@ -384,8 +384,8 @@ async fn register(client: &Client, config: &Config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_mastodon_data(filename: &str) -> DynResult<MastodonData> {
|
fn parse_mastodon_data(filename: &str) -> DynResult<MastodonData> {
|
||||||
let toml_file = std::fs::read_to_string(filename)?; //.expect("No config file, consider getting the original one and modifing it");
|
let toml_file = std::fs::read_to_string(filename)?;
|
||||||
Ok(toml::from_str(&toml_file)?) //("Malformed config file, check the original one for reference")
|
Ok(toml::from_str(&toml_file)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -598,7 +598,6 @@ mod tests {
|
||||||
const IMAGE: &str = "https://picsum.photos/id/1";
|
const IMAGE: &str = "https://picsum.photos/id/1";
|
||||||
let expected = insert_image(&config, IMAGE).await.unwrap();
|
let expected = insert_image(&config, IMAGE).await.unwrap();
|
||||||
|
|
||||||
// Get test url
|
|
||||||
let image = get_next_url(&config).await.unwrap().unwrap();
|
let image = get_next_url(&config).await.unwrap().unwrap();
|
||||||
assert_eq!(image.url, IMAGE);
|
assert_eq!(image.url, IMAGE);
|
||||||
|
|
||||||
|
@ -613,7 +612,6 @@ mod tests {
|
||||||
let image = image.image;
|
let image = image.image;
|
||||||
assert_eq!(image.status, "consumed");
|
assert_eq!(image.status, "consumed");
|
||||||
|
|
||||||
// Test that now it does not get it
|
|
||||||
let image = get_next_url(&config).await.unwrap();
|
let image = get_next_url(&config).await.unwrap();
|
||||||
assert_eq!(image, None);
|
assert_eq!(image, None);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue