Compare commits

..

No commits in common. "main" and "3.2.1" have entirely different histories.
main ... 3.2.1

13 changed files with 670 additions and 375 deletions

543
Cargo.lock generated
View file

@ -17,6 +17,15 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "aho-corasick"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
dependencies = [
"memchr",
]
[[package]]
name = "android-tzdata"
version = "0.1.1"
@ -32,13 +41,24 @@ dependencies = [
"libc",
]
[[package]]
name = "anyhow"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
dependencies = [
"backtrace",
]
[[package]]
name = "aob-lemmy-bot"
version = "3.3.4"
version = "3.2.1"
dependencies = [
"async-trait",
"chrono",
"confy",
"lemmy_api_common",
"lemmy_db_schema",
"log",
"notify",
"once_cell",
@ -46,8 +66,6 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
"serde_with",
"strum",
"strum_macros",
"systemd-journal-logger",
"tokio",
@ -55,6 +73,17 @@ dependencies = [
"url",
]
[[package]]
name = "async-lock"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18"
dependencies = [
"event-listener",
"event-listener-strategy",
"pin-project-lite",
]
[[package]]
name = "async-trait"
version = "0.1.81"
@ -111,6 +140,12 @@ version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
version = "1.5.0"
@ -126,6 +161,17 @@ dependencies = [
"libc",
]
[[package]]
name = "cfb"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f"
dependencies = [
"byteorder",
"fnv",
"uuid",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -147,6 +193,29 @@ dependencies = [
"windows-targets 0.52.0",
]
[[package]]
name = "clearurls"
version = "0.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e291c00af89ac0a5b400d9ba46a682e38015ae3cd8926dbbe85b3b864d550be3"
dependencies = [
"linkify",
"percent-encoding",
"regex",
"serde",
"serde_json",
"url",
]
[[package]]
name = "concurrent-queue"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "confy"
version = "0.6.1"
@ -159,6 +228,12 @@ dependencies = [
"toml",
]
[[package]]
name = "convert_case"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]]
name = "core-foundation"
version = "0.9.4"
@ -184,6 +259,15 @@ dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.19"
@ -235,6 +319,17 @@ dependencies = [
"serde",
]
[[package]]
name = "derive-new"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cdc8d50f426189eef89dac62fabfa0abb27d5cc008f25bf4156a0203325becc"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "directories"
version = "5.0.1"
@ -276,6 +371,26 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "enum-map"
version = "2.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9"
dependencies = [
"enum-map-derive",
]
[[package]]
name = "enum-map-derive"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "equivalent"
version = "1.0.1"
@ -292,6 +407,27 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "event-listener"
version = "5.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba"
dependencies = [
"concurrent-queue",
"parking",
"pin-project-lite",
]
[[package]]
name = "event-listener-strategy"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1"
dependencies = [
"event-listener",
"pin-project-lite",
]
[[package]]
name = "fastrand"
version = "2.0.1"
@ -306,7 +442,7 @@ checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"redox_syscall 0.4.1",
"windows-sys 0.52.0",
]
@ -371,6 +507,17 @@ version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
[[package]]
name = "futures-macro"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "futures-sink"
version = "0.3.30"
@ -391,6 +538,7 @@ checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
dependencies = [
"futures-core",
"futures-io",
"futures-macro",
"futures-sink",
"futures-task",
"memchr",
@ -406,8 +554,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi",
"wasm-bindgen",
]
[[package]]
@ -751,6 +901,15 @@ dependencies = [
"serde",
]
[[package]]
name = "infer"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc150e5ce2330295b8616ce0e3f53250e53af31759a9dbedad1621ba29151847"
dependencies = [
"cfb",
]
[[package]]
name = "inotify"
version = "0.9.6"
@ -818,6 +977,101 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "lemmy_api_common"
version = "0.19.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06a7554d0a71b37c1f666125918a72fe92103a5f254668a988aaa31ed80d4b7b"
dependencies = [
"anyhow",
"chrono",
"enum-map",
"getrandom",
"infer",
"lemmy_db_schema",
"lemmy_db_views",
"lemmy_db_views_actor",
"lemmy_db_views_moderator",
"lemmy_utils",
"mime_guess",
"moka",
"regex",
"serde",
"serde_with",
"url",
"urlencoding",
]
[[package]]
name = "lemmy_db_schema"
version = "0.19.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5454e0df45ec4831b7c6502d965cb9865ecbe2cb181a20c616ad8235444c06e8"
dependencies = [
"anyhow",
"async-trait",
"chrono",
"derive-new",
"futures-util",
"moka",
"serde",
"serde_with",
"strum",
"tracing",
"typed-builder",
"url",
"uuid",
]
[[package]]
name = "lemmy_db_views"
version = "0.19.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4d348095887630617ef02b823887d422ae2e93dfff7a13a127e7524eec51d99"
dependencies = [
"chrono",
"lemmy_db_schema",
"serde",
"serde_with",
]
[[package]]
name = "lemmy_db_views_actor"
version = "0.19.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd7a42bf16a72d6f313f59116538e1333e6ce5f2efbeb9b834ddb147b2cdf986"
dependencies = [
"chrono",
"lemmy_db_schema",
"serde",
"serde_with",
"strum",
]
[[package]]
name = "lemmy_db_views_moderator"
version = "0.19.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b6a1a841c4ccac1947f7edfbb52b3113d32f218a2eede769ec5dce4a039cd43"
dependencies = [
"lemmy_db_schema",
"serde",
"serde_with",
]
[[package]]
name = "lemmy_utils"
version = "0.19.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee28dc456fac8d5c7ae67b4f596a1e9e2a0a9a6e1c4f8a024bdfb34cf25dfa5"
dependencies = [
"cfg-if",
"clearurls",
"rosetta-build",
"serde",
"strum",
]
[[package]]
name = "libc"
version = "0.2.155"
@ -832,7 +1086,16 @@ checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8"
dependencies = [
"bitflags 2.4.1",
"libc",
"redox_syscall",
"redox_syscall 0.4.1",
]
[[package]]
name = "linkify"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1dfa36d52c581e9ec783a7ce2a5e0143da6237be5811a0b3153fedfdbe9f780"
dependencies = [
"memchr",
]
[[package]]
@ -847,6 +1110,16 @@ version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856"
[[package]]
name = "lock_api"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.20"
@ -868,6 +1141,16 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "mime_guess"
version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"
dependencies = [
"mime",
"unicase",
]
[[package]]
name = "miniz_oxide"
version = "0.7.1"
@ -889,6 +1172,30 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "moka"
version = "0.12.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32cf62eb4dd975d2dde76432fb1075c49e3ee2331cf36f1f8fd4b66550d32b6f"
dependencies = [
"async-lock",
"async-trait",
"crossbeam-channel",
"crossbeam-epoch",
"crossbeam-utils",
"event-listener",
"futures-util",
"once_cell",
"parking_lot",
"quanta",
"rustc_version",
"smallvec",
"tagptr",
"thiserror",
"triomphe",
"uuid",
]
[[package]]
name = "native-tls"
version = "0.2.11"
@ -1016,6 +1323,35 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "parking"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae"
[[package]]
name = "parking_lot"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
dependencies = [
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
dependencies = [
"cfg-if",
"libc",
"redox_syscall 0.5.3",
"smallvec",
"windows-targets 0.52.0",
]
[[package]]
name = "percent-encoding"
version = "2.3.1"
@ -1075,6 +1411,21 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "quanta"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5"
dependencies = [
"crossbeam-utils",
"libc",
"once_cell",
"raw-cpuid",
"wasi",
"web-sys",
"winapi",
]
[[package]]
name = "quote"
version = "1.0.35"
@ -1084,6 +1435,15 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "raw-cpuid"
version = "11.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e29830cbb1290e404f24c73af91c5d8d631ce7e128691e9477556b540cd01ecd"
dependencies = [
"bitflags 2.4.1",
]
[[package]]
name = "redox_syscall"
version = "0.4.1"
@ -1093,6 +1453,15 @@ dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "redox_syscall"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4"
dependencies = [
"bitflags 2.4.1",
]
[[package]]
name = "redox_users"
version = "0.4.4"
@ -1104,6 +1473,35 @@ dependencies = [
"thiserror",
]
[[package]]
name = "regex"
version = "1.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "reqwest"
version = "0.12.4"
@ -1147,12 +1545,35 @@ dependencies = [
"winreg",
]
[[package]]
name = "rosetta-build"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24191a1fed7ae7a5d89f816366f5c03ebce70a7a4d7158534afdf8dd719749fe"
dependencies = [
"convert_case",
"lazy_static",
"proc-macro2",
"quote",
"regex",
"tinyjson",
]
[[package]]
name = "rustc-demangle"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
[[package]]
name = "rustc_version"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
"semver",
]
[[package]]
name = "rustix"
version = "0.38.28"
@ -1212,6 +1633,12 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "security-framework"
version = "2.9.2"
@ -1235,6 +1662,12 @@ dependencies = [
"libc",
]
[[package]]
name = "semver"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
[[package]]
name = "serde"
version = "1.0.204"
@ -1360,6 +1793,9 @@ name = "strum"
version = "0.26.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
dependencies = [
"strum_macros",
]
[[package]]
name = "strum_macros"
@ -1433,6 +1869,12 @@ dependencies = [
"rustix",
]
[[package]]
name = "tagptr"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
[[package]]
name = "tempfile"
version = "3.8.1"
@ -1441,7 +1883,7 @@ checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
dependencies = [
"cfg-if",
"fastrand",
"redox_syscall",
"redox_syscall 0.4.1",
"rustix",
"windows-sys 0.48.0",
]
@ -1497,6 +1939,12 @@ dependencies = [
"time-core",
]
[[package]]
name = "tinyjson"
version = "2.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ab95735ea2c8fd51154d01e39cf13912a78071c2d89abc49a7ef102a7dd725a"
[[package]]
name = "tinystr"
version = "0.7.6"
@ -1629,9 +2077,21 @@ checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
dependencies = [
"log",
"pin-project-lite",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tracing-core"
version = "0.1.32"
@ -1641,12 +2101,44 @@ dependencies = [
"once_cell",
]
[[package]]
name = "triomphe"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3"
[[package]]
name = "try-lock"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "typed-builder"
version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06fbd5b8de54c5f7c91f6fe4cebb949be2125d7758e630bb58b1d831dbce600"
dependencies = [
"typed-builder-macro",
]
[[package]]
name = "typed-builder-macro"
version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9534daa9fd3ed0bd911d462a37f172228077e7abf18c18a5f67199d959205f8"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "unicase"
version = "2.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539"
[[package]]
name = "unicode-ident"
version = "1.0.12"
@ -1662,8 +2154,15 @@ dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
"serde",
]
[[package]]
name = "urlencoding"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
[[package]]
name = "utf16_iter"
version = "1.0.5"
@ -1676,6 +2175,16 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]]
name = "uuid"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314"
dependencies = [
"getrandom",
"serde",
]
[[package]]
name = "value-bag"
version = "1.4.2"
@ -1789,6 +2298,22 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.8"
@ -1798,6 +2323,12 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-core"
version = "0.51.1"

View file

@ -1,7 +1,7 @@
[package]
authors = ["Neshura"]
name = "aob-lemmy-bot"
version = "3.3.4"
version = "3.2.1"
edition = "2021"
description = "Bot for automatically posting new chapters of 'Ascendance of a Bookworm' released by J-Novel Club"
license = "GPL-3.0-or-later"
@ -17,6 +17,8 @@ systemd-units = { enable = false }
[dependencies]
chrono = "^0.4"
lemmy_api_common = "0.19.9"
lemmy_db_schema = "0.19.9"
once_cell = "^1.19"
reqwest = { version = "^0.12", features = ["blocking", "json"] }
serde = "^1.0"
@ -30,6 +32,4 @@ toml = "^0.8"
systemd-journal-logger = "^2.1.1"
log = "^0.4"
async-trait = "^0.1"
notify = "6.1.1"
serde_with = "3.9.0"
strum = "0.26.3"
notify = "6.1.1"

View file

@ -1,5 +1,5 @@
use crate::{config::{Config}, HTTP_CLIENT};
use crate::piefed::{Piefed};
use crate::lemmy::{Lemmy};
use crate::post_history::{SeriesHistory};
use chrono::{DateTime, Duration, Utc};
use std::sync::{Arc, RwLock};
@ -79,15 +79,12 @@ impl Bot {
}
pub(crate) async fn run(&mut self) {
loop {
let mut piefed = match Piefed::new(&self.shared_config).await {
let mut lemmy = match Lemmy::new(&self.shared_config).await {
Ok(data) => data,
Err(_) => {
sleep(Duration::seconds(10).to_std().unwrap()).await;
continue;
},
Err(_) => continue,
};
piefed.get_communities().await;
lemmy.get_communities().await;
self.history = SeriesHistory::load_history();
@ -97,7 +94,7 @@ impl Bot {
self.ping_status().await;
let read_copy = self.shared_config.read().expect("Read Lock Failed").clone();
for series in read_copy.series {
series.update(&mut self.history, &piefed, &self.shared_config).await;
series.update(&mut self.history, &lemmy, &self.shared_config).await;
debug!("Done Updating Series");
self.wait(1, Wait::Absolute).await;
}
@ -109,7 +106,7 @@ impl Bot {
self.wait(30, Wait::Absolute).await;
}
piefed.logout().await;
lemmy.logout().await;
}
}

View file

@ -2,9 +2,10 @@ use std::path::PathBuf;
use std::sync::{Arc, RwLock};
use chrono::{Timelike, Utc};
use crate::config::PostBody::Description;
use crate::piefed_api::post::PostFeatureType;
use crate::piefed::{Piefed, PartInfo, PostType};
use lemmy_db_schema::PostFeatureType;
use lemmy_db_schema::sensitive::SensitiveString;
use serde_derive::{Deserialize, Serialize};
use crate::lemmy::{Lemmy, PartInfo, PostType};
use crate::post_history::{SeriesHistory};
use systemd_journal_logger::connected_to_journal;
use crate::fetchers::{FetcherTrait, Fetcher};
@ -49,8 +50,8 @@ macro_rules! error {
#[derive(Serialize, Deserialize, Clone, Debug)]
pub(crate) struct Config {
pub(crate) instance: String,
username: String,
password: String,
username: SensitiveString,
password: SensitiveString,
pub(crate) status_post_url: Option<String>,
pub(crate) config_reload_seconds: u32,
pub(crate) protected_communities: Vec<String>,
@ -88,11 +89,11 @@ impl Config {
confy::get_configuration_file_path(env!("CARGO_PKG_NAME"), "config").expect("Application will not without confy")
}
pub(crate) fn get_username(&self) -> String {
pub(crate) fn get_username(&self) -> SensitiveString {
self.username.clone()
}
pub(crate) fn get_password(&self) -> String {
pub(crate) fn get_password(&self) -> SensitiveString {
self.password.clone()
}
}
@ -101,8 +102,8 @@ impl Default for Config {
fn default() -> Self {
Config {
instance: "".to_owned(),
username: "".to_owned(),
password: "".to_owned(),
username: SensitiveString::from("".to_owned()),
password: SensitiveString::from("".to_owned()),
status_post_url: None,
config_reload_seconds: 21600,
protected_communities: vec![],
@ -121,7 +122,7 @@ pub(crate) struct SeriesConfig {
}
impl SeriesConfig {
pub(crate) async fn update(&self, history: &mut SeriesHistory, piefed: &Piefed, config: &Arc<RwLock<Config>>) {
pub(crate) async fn update(&self, history: &mut SeriesHistory, lemmy: &Lemmy, config: &Arc<RwLock<Config>>) {
let info_msg = format!("Checking {} for Updates", self.slug);
info!(info_msg);
@ -166,7 +167,7 @@ impl SeriesConfig {
continue
}
let post_data = post_info.get_post_data(self, piefed);
let post_data = post_info.get_post_data(self, lemmy);
let info = format!(
"Posting '{}' to {}",
@ -175,11 +176,11 @@ impl SeriesConfig {
);
info!(info);
let post_id = match piefed.post(post_data.clone()).await {
let post_id = match lemmy.post(post_data.clone()).await {
Some(data) => data,
None => {
error!("Error posting chapter, applying fix for Issue #27");
match piefed.check_community_for_post(post_data).await {
match lemmy.check_community_for_post(post_data).await {
Some(data) => data,
None => {
error!("Unable to find Post via API");
@ -202,17 +203,17 @@ impl SeriesConfig {
post_info.get_post_config(self).name.as_str()
);
info!(info);
let pinned_posts = piefed.get_community_pinned(piefed.get_community_id(&post_info.get_post_config(self).name)).await.unwrap_or_else(|| {
let pinned_posts = lemmy.get_community_pinned(lemmy.get_community_id(&post_info.get_post_config(self).name)).await.unwrap_or_else(|| {
error!("Pinning of Post to community failed");
vec![]
});
if !pinned_posts.is_empty() {
let community_pinned_post = &pinned_posts[0];
if piefed.unpin(community_pinned_post.post.id, PostFeatureType::Community).await.is_none() {
if lemmy.unpin(community_pinned_post.post.id, PostFeatureType::Community).await.is_none() {
error!("Error un-pinning post");
}
}
if piefed.pin(post_id, PostFeatureType::Community).await.is_none() {
if lemmy.pin(post_id, PostFeatureType::Community).await.is_none() {
error!("Error pinning post");
}
} else if read_config
@ -226,6 +227,39 @@ impl SeriesConfig {
warn!(message);
}
if post_info.get_post_config(self).pin_settings.pin_new_post_local {
let info = format!("Pinning '{}' to Instance", post_info.get_info().title);
info!(info);
let pinned_posts = match lemmy.get_local_pinned().await {
Some(data) => {data}
None => {
error!("Error fetching pinned posts");
vec![]
}
};
if !pinned_posts.is_empty() {
for pinned_post in pinned_posts {
if read_config
.protected_communities
.contains(&pinned_post.community.name)
{
continue;
} else {
let community_pinned_post = &pinned_post;
if lemmy.unpin(community_pinned_post.post.id, PostFeatureType::Local).await.is_none() {
error!("Error pinning post");
continue;
}
break;
}
}
}
if lemmy.pin(post_id, PostFeatureType::Local).await.is_none() {
error!("Error pinning post");
};
}
let mut series_history = history.get_series(self.slug.as_str());
let mut part_history = series_history.get_part(post_info.get_part_info().unwrap_or(PartInfo::NoParts).as_string().as_str());
@ -257,6 +291,7 @@ pub(crate) struct PostConfig {
#[derive(Debug, Serialize, Deserialize, Clone)]
pub(crate) struct PinConfig {
pub(crate) pin_new_post_local: bool,
pub(crate) pin_new_post_community: bool,
}

View file

@ -5,9 +5,9 @@ use std::collections::HashMap;
use std::ops::Sub;
use async_trait::async_trait;
use crate::fetchers::{FetcherTrait};
use crate::piefed::{PartInfo, PostInfo, PostInfoInner, PostType};
use crate::lemmy::{PartInfo, PostInfo, PostInfoInner, PostType};
use systemd_journal_logger::connected_to_journal;
use crate::piefed::PartInfo::{NoParts, Part};
use crate::lemmy::PartInfo::{NoParts, Part};
macro_rules! error {
($msg:tt) => {

View file

@ -3,7 +3,7 @@ use serde_derive::{Deserialize, Serialize};
use strum_macros::Display;
use crate::fetchers::Fetcher::Jnc;
use crate::fetchers::jnovel::JNovelFetcher;
use crate::piefed::{PostInfo};
use crate::lemmy::{PostInfo};
pub mod jnovel;

View file

@ -1,13 +1,16 @@
use std::cmp::Ordering;
use crate::config::{Config, PostBody, PostConfig, SeriesConfig};
use crate::{HTTP_CLIENT};
use crate::piefed_api::user::{Login, LoginResponse};
use crate::piefed_api::post::{PostView, CreatePost, FeaturePost, GetPosts, GetPostsResponse, PostFeatureType, ListingType, SortType, PostSortType};
use crate::piefed_api::types::{CommunityId, LanguageId, PostId};
use crate::piefed_api::community::{ListCommunitiesParams, ListCommunitiesResponse};
use lemmy_api_common::community::{ListCommunities, ListCommunitiesResponse};
use lemmy_api_common::lemmy_db_views::structs::PostView;
use lemmy_api_common::person::{Login, LoginResponse};
use lemmy_api_common::post::{CreatePost, FeaturePost, GetPosts, GetPostsResponse};
use lemmy_db_schema::newtypes::{CommunityId, LanguageId, PostId};
use lemmy_db_schema::{ListingType, PostFeatureType, SortType};
use reqwest::StatusCode;
use std::collections::HashMap;
use std::sync::{RwLock};
use lemmy_db_schema::sensitive::SensitiveString;
use serde::{Deserialize, Serialize};
use systemd_journal_logger::connected_to_journal;
@ -20,15 +23,6 @@ macro_rules! debug {
};
}
macro_rules! info {
($msg:tt) => {
match connected_to_journal() {
true => log::info!("[INFO] {}", $msg),
false => println!("[INFO] {}", $msg),
}
};
}
macro_rules! error {
($msg:tt) => {
match connected_to_journal() {
@ -38,8 +32,8 @@ macro_rules! error {
};
}
pub(crate) struct Piefed {
jwt_token: String,
pub(crate) struct Lemmy {
jwt_token: SensitiveString,
instance: String,
communities: HashMap<String, CommunityId>,
}
@ -152,7 +146,7 @@ impl PostInfo {
}
}
pub(crate) fn get_post_data(&self, series: &SeriesConfig, lemmy: &Piefed) -> CreatePost {
pub(crate) fn get_post_data(&self, series: &SeriesConfig, lemmy: &Lemmy) -> CreatePost {
let post_config = self.get_post_config(series);
let post_body = match &post_config.post_body {
@ -164,13 +158,15 @@ impl PostInfo {
let community_id: CommunityId = lemmy.get_community_id(&post_config.name);
CreatePost {
title: self.get_info().title.clone(),
name: self.get_info().title.clone(),
community_id,
url: Some(self.get_info().url),
//custom_thumbnail: self.get_info().thumbnail,
custom_thumbnail: self.get_info().thumbnail,
body: post_body,
nsfw: false,
language_id: LanguageId(37), // TODO get this id once every few hours per API request, the ordering of IDs suggests that the EN Id might change in the future
alt_text: None,
honeypot: None,
nsfw: None,
language_id: Some(LanguageId(37)), // TODO get this id once every few hours per API request, the ordering of IDs suggests that the EN Id might change in the future
}
}
}
@ -209,19 +205,20 @@ impl PartialOrd for PostInfo {
}
}
impl Piefed {
impl Lemmy {
pub(crate) fn get_community_id(&self, name: &str) -> CommunityId {
*self.communities.get(name).expect("Given community is invalid")
}
pub(crate) async fn new(config: &RwLock<Config>) -> Result<Self, ()> {
let read_config = config.read().expect("Read Lock Failed").clone();
let login_params = Login {
username: read_config.get_username(),
username_or_email: read_config.get_username(),
password: read_config.get_password(),
totp_2fa_token: None,
};
let response = match HTTP_CLIENT
.post(read_config.instance.to_owned() + "/api/alpha/user/login")
.post(read_config.instance.to_owned() + "/api/v3/user/login")
.json(&login_params)
.send()
.await
@ -237,11 +234,11 @@ impl Piefed {
match response.status() {
StatusCode::OK => {
let data: LoginResponse = response
.json::<LoginResponse>()
.json()
.await
.expect("Successful Login Request should return JSON");
match data.jwt {
Some(token) => Ok(Piefed {
Some(token) => Ok(Lemmy {
jwt_token: token.clone(),
instance: read_config.instance.to_owned(),
communities: HashMap::new(),
@ -262,12 +259,12 @@ impl Piefed {
}
pub(crate) async fn logout(&self) {
let _ = self.post_data_json("/api/alpha/user/logout", &"").await;
let _ = self.post_data_json("/api/v3/user/logout", &"").await;
}
pub(crate) async fn post(&self, post: CreatePost) -> Option<PostId> {
let response: String = match self.post_data_json("/api/alpha/post", &post).await {
let response: String = match self.post_data_json("/api/v3/post", &post).await {
Some(data) => data,
None => return None,
};
@ -280,7 +277,7 @@ impl Piefed {
}
async fn feature(&self, params: FeaturePost) -> Option<PostView> {
let response: String = match self.post_data_json("/api/alpha/post/feature", &params).await {
let response: String = match self.post_data_json("/api/v3/post/feature", &params).await {
Some(data) => data,
None => return None,
};
@ -317,7 +314,7 @@ impl Piefed {
..Default::default()
};
let response: String = match self.get_data_query("/api/alpha/post/list", &list_params).await {
let response: String = match self.get_data_query("/api/v3/post/list", &list_params).await {
Some(data) => data,
None => return None,
};
@ -329,21 +326,41 @@ impl Piefed {
Some(json_data
.posts
.iter()
.filter(|post| post.post.sticky)
.filter(|post| post.post.featured_community)
.cloned()
.collect())
}
pub(crate) async fn get_local_pinned(&self) -> Option<Vec<PostView>> {
let list_params = GetPosts {
type_: Some(ListingType::Local),
..Default::default()
};
let response: String = match self.get_data_query("/api/v3/post/list", &list_params).await {
Some(data) => data,
None => return None,
};
let json_data: GetPostsResponse = match self.parse_json(&response).await {
Some(data) => data,
None => return None,
};
Some(json_data
.posts
.iter()
.filter(|post| post.post.featured_local)
.cloned()
.collect())
}
pub(crate) async fn get_communities(&mut self) {
let list_params = ListCommunitiesParams {
let list_params = ListCommunities {
type_: Some(ListingType::Local),
sort: Some(SortType::New),
show_nsfw: Some(false),
page: Some(0),
limit: Some(100)
..Default::default()
};
let response: String = match self.get_data_query("/api/alpha/community/list", &list_params).await {
let response: String = match self.get_data_query("/api/v3/community/list", &list_params).await {
Some(data) => data,
None => return,
};
@ -364,44 +381,40 @@ impl Piefed {
pub(crate) async fn check_community_for_post(&self, post: CreatePost) -> Option<PostId> {
let get_params: GetPosts = GetPosts {
type_: None,
sort: Some(PostSortType::New),
sort: Some(SortType::New),
page: None,
limit: None,
community_id: Some(post.community_id),
person_id: None,
community_name: None,
saved_only: None,
liked_only: None,
disliked_only: None,
show_hidden: None,
show_read: None,
show_nsfw: None,
page_cursor: None,
};
let response: String = match self.get_data_query("/api/alpha/post/list", &get_params).await {
let response: String = match self.get_data_query("/api/v3/post/list", &get_params).await {
Some(data) => data,
None => {
error!("Unable to query post list");
return None
},
None => return None,
};
let json_data: GetPostsResponse = match self.parse_json(&response).await {
Some(data) => data,
None => {
error!("Unable to parse post data");
return None
},
None => return None,
};
for api_post in json_data.posts {
if api_post.post.title == post.title {
return Some(api_post.post.id);
}
if json_data.posts[0].post.name == post.name {
Some(json_data.posts[0].post.id)
} else {
None
}
let msg = format!("Unable to find post {}", post.title);
info!(msg);
None
}
async fn post_data_json<T: Serialize>(&self, route: &str, json: &T ) -> Option<String> {
let res = HTTP_CLIENT
.post(format!("{}{route}", &self.instance))
.bearer_auth(self.jwt_token.to_string())
.bearer_auth(&self.jwt_token.to_string())
.json(&json)
.send()
.await;
@ -411,7 +424,7 @@ impl Piefed {
async fn get_data_query<T: Serialize>(&self, route: &str, param: &T ) -> Option<String> {
let res = HTTP_CLIENT
.get(format!("{}{route}", &self.instance))
.bearer_auth(self.jwt_token.to_string())
.bearer_auth(&self.jwt_token.to_string())
.query(&param)
.send()
.await;

View file

@ -7,10 +7,9 @@ use crate::bot::Bot;
mod bot;
mod config;
mod piefed;
mod lemmy;
mod post_history;
mod fetchers;
mod piefed_api;
pub static HTTP_CLIENT: Lazy<Client> = Lazy::new(|| {
Client::builder()

View file

@ -1,63 +0,0 @@
use serde_derive::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use crate::piefed_api::post::{ListingType, SortType};
use crate::piefed_api::types::{CommunityId, PostId, SubscribedType};
#[skip_serializing_none]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct CommunityCounts {
pub id: CommunityId,
pub post_count: i32,
pub post_reply_count: i32,
pub subscriptions_count: i32,
pub published: String,
}
#[skip_serializing_none]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct Community {
pub actor_id: String,
pub ap_domain: String,
pub banned: bool,
pub banner: Option<String>,
pub deleted: bool,
pub description: Option<String>,
pub hidden: bool,
pub icon: Option<String>,
pub id: CommunityId,
pub instance_id: u32,
pub local: bool,
pub name: String,
pub nsfw: bool,
pub published: String,
pub removed: bool,
pub restricted_to_mods: bool,
pub title: String,
pub updated: String,
}
#[skip_serializing_none]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct ListCommunitiesParams {
pub type_: Option<ListingType>,
pub sort: Option<SortType>,
pub show_nsfw: Option<bool>,
pub page: Option<i32>,
pub limit: Option<i32>,
}
#[skip_serializing_none]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct ListCommunitiesResponse {
pub communities: Vec<CommunityView>,
}
#[skip_serializing_none]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct CommunityView {
pub community: Community,
pub subscribed: SubscribedType,
pub blocked: bool,
pub counts: CommunityCounts,
pub activity_alert: bool
}

View file

@ -1,4 +0,0 @@
pub mod user;
pub mod post;
pub mod types;
pub mod community;

View file

@ -1,161 +0,0 @@
use serde_derive::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use strum_macros::{Display, EnumString};
use crate::piefed_api::community::Community;
use crate::piefed_api::types::{CommunityId, LanguageId, PaginationCursor, PersonId, PostId, SubscribedType};
use crate::piefed_api::user::Person;
#[derive(
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash,
)]
pub enum PostFeatureType {
#[default]
Local,
Community,
}
#[derive(
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
)]
pub enum ListingType {
All,
#[default]
Local,
Subscribed,
ModeratorView,
}
#[derive(
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
)]
pub enum SortType {
#[default]
Active,
Hot,
New,
Old,
TopDay,
TopWeek,
TopMonth,
TopYear,
TopAll,
MostComments,
NewComments,
TopHour,
TopSixHour,
TopTwelveHour,
TopThreeMonths,
TopSixMonths,
TopNineMonths,
Controversial,
Scaled,
}
#[derive(
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
)]
pub enum PostSortType {
#[default]
Active,
Hot,
New,
Old,
Top,
MostComments,
NewComments,
Controversial,
Scaled,
}
#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, Hash)]
pub struct GetPosts {
pub type_: Option<ListingType>,
pub sort: Option<PostSortType>,
pub page: Option<PaginationCursor>,
pub limit: Option<i64>,
pub community_id: Option<CommunityId>,
pub person_id: Option<PersonId>,
pub community_name: Option<String>,
pub liked_only: Option<bool>,
}
#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GetPostsResponse {
pub posts: Vec<PostView>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
pub struct FeaturePost {
pub post_id: PostId,
pub featured: bool,
pub feature_type: PostFeatureType,
}
#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
pub struct CreatePost {
pub title: String,
pub community_id: CommunityId,
pub url: Option<String>,
pub body: Option<String>,
pub nsfw: bool,
pub language_id: LanguageId,
}
#[skip_serializing_none]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct PostView {
pub post: Post,
pub creator: Person,
pub community: Community,
pub creator_banned_from_community: bool,
pub banned_from_community: bool,
pub creator_is_moderator: bool,
pub creator_is_admin: bool,
pub counts: PostCounts,
pub subscribed: SubscribedType,
pub saved: bool,
pub activity_alert: bool,
pub read: bool,
pub hidden: bool,
pub my_vote: i32,
pub unread_comments: i32,
}
#[skip_serializing_none]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct PostCounts {
pub post_id: PostId,
pub comments: i32,
pub score: i32,
pub upvotes: i32,
pub downvotes: i32,
pub published: String,
pub newest_comment_time: String,
}
#[skip_serializing_none]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct Post {
pub id: PostId,
pub title: String,
pub url: Option<String>,
pub body: Option<String>,
pub user_id: PersonId,
pub community_id: CommunityId,
pub removed: bool,
pub locked: bool,
pub published: String,
pub updated: Option<String>,
pub deleted: bool,
pub nsfw: bool,
pub thumbnail_url: Option<String>,
pub ap_id: String,
pub local: bool,
pub language_id: Option<LanguageId>,
pub sticky: bool,
pub alt_text: Option<String>,
}

View file

@ -1,19 +0,0 @@
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
pub struct CommunityId(pub i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
pub struct PersonId(pub i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
/// The post id.
pub struct PostId(pub i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
pub struct LanguageId(pub i32);
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
pub struct PaginationCursor(pub String);
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
pub enum SubscribedType {
Subscribed,
NotSubscribed,
}

View file

@ -1,33 +0,0 @@
use serde_derive::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use crate::piefed_api::types::PersonId;
#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
pub struct Login {
pub username: String,
pub password: String,
}
#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct LoginResponse {
pub jwt: Option<String>,
}
#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
pub struct Person {
pub actor_id: String,
pub avatar: Option<String>,
pub banned: bool,
pub banner: Option<String>,
pub bot: bool,
pub deleted: bool,
pub id: PersonId,
pub instance_id: u32,
pub local: bool,
pub published: String,
pub title: String,
pub user_name: String,
}