Compare commits
1 Commits
e6c2eb76e9
...
ad118fbec9
Author | SHA1 | Date |
---|---|---|
Sam W | ad118fbec9 |
|
@ -881,15 +881,6 @@ version = "0.4.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "home"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb"
|
||||
dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "html5ever"
|
||||
version = "0.26.0"
|
||||
|
@ -1137,18 +1128,16 @@ checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
|
|||
|
||||
[[package]]
|
||||
name = "jni"
|
||||
version = "0.21.1"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97"
|
||||
checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c"
|
||||
dependencies = [
|
||||
"cesu8",
|
||||
"cfg-if",
|
||||
"combine",
|
||||
"jni-sys",
|
||||
"log",
|
||||
"thiserror",
|
||||
"walkdir",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3269,19 +3258,16 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "webbrowser"
|
||||
version = "0.8.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd222aa310eb7532e3fd427a5d7db7e44bc0b0cf1c1e21139c345325511a85b6"
|
||||
version = "0.8.2"
|
||||
dependencies = [
|
||||
"core-foundation",
|
||||
"home",
|
||||
"jni",
|
||||
"log",
|
||||
"ndk-context",
|
||||
"objc",
|
||||
"raw-window-handle",
|
||||
"url",
|
||||
"web-sys",
|
||||
"widestring",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3309,6 +3295,12 @@ version = "0.1.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
|
||||
|
||||
[[package]]
|
||||
name = "widestring"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
|
42
flake.nix
42
flake.nix
|
@ -52,45 +52,5 @@
|
|||
packages = with pkgs; [rust rust-analyzer];
|
||||
};
|
||||
formatter = pkgs.alejandra;
|
||||
}) // {
|
||||
overlays.default = final: prev: {
|
||||
iso7010-a-day = self.packages.${prev.system}.default;
|
||||
};
|
||||
|
||||
nixosModules.default = {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.services.iso7010-a-day;
|
||||
in {
|
||||
options.services.iso7010-a-day = {
|
||||
enable = mkEnableOption "Enable the iso7010 bot";
|
||||
environmentFile = mkOption {
|
||||
type = types.path;
|
||||
description = "Path to the environment file";
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
nixpkgs.overlays = [self.overlays.default];
|
||||
systemd.services.iso7010-a-day = {
|
||||
description = "Samw's ISO7010 bot";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
DynamicUser = true;
|
||||
User = "iso7010";
|
||||
ExecStart = "${pkgs.iso7010-a-day}/bin/iso7010_a_day run-bot";
|
||||
EnvironmentFile = cfg.environmentFile;
|
||||
};
|
||||
};
|
||||
systemd.timers.iso7010-a-day = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
partOf = [ "iso7010-a-day.service" ];
|
||||
timerConfig.OnCalendar = [ "*-*-* 12:00:00" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::borrow::Cow;
|
||||
|
||||
use megalodon::entities::UploadMedia;
|
||||
use megalodon::entities::{Attachment, UploadMedia};
|
||||
use megalodon::generator;
|
||||
use megalodon::megalodon::PostStatusInputOptions;
|
||||
use megalodon::{self, megalodon::UploadMediaInputOptions};
|
||||
|
@ -28,7 +28,7 @@ pub async fn toot(text: &str, img: Option<Cow<'static, [u8]>>) -> StdError<()> {
|
|||
let mut ops = PostStatusInputOptions::default();
|
||||
if let Some(img) = img {
|
||||
let media = client
|
||||
.upload_media_bytes(
|
||||
.upload_media_raw(
|
||||
// TODO: get better at lifetimes
|
||||
Box::leak(Box::new(img)),
|
||||
Some(&UploadMediaInputOptions::default()),
|
||||
|
|
Loading…
Reference in New Issue