diff --git a/Cargo.lock b/Cargo.lock index 5a3801867..ebe7183f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,9 +10,9 @@ checksum = "8f27d075294830fcab6f66e320dab524bc6d048f4a151698e153205559113772" [[package]] name = "activitypub_federation" -version = "0.7.0-beta.1" +version = "0.7.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3d1e6d079f6242abad4eee5b56b89556dcb97eca352dff0ad5dfe0d1661cef5" +checksum = "97a43194e54834c0efa258af64a64487a4d255cf53596c70615c7e0872d56132" dependencies = [ "activitystreams-kinds", "actix-web", @@ -36,7 +36,7 @@ dependencies = [ "pin-project-lite", "rand 0.8.5", "regex", - "reqwest 0.12.18", + "reqwest 0.12.19", "reqwest-middleware", "rsa", "serde", @@ -64,7 +64,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "bytes", "futures-core", "futures-sink", @@ -102,7 +102,7 @@ dependencies = [ "actix-tls", "actix-utils", "base64 0.22.1", - "bitflags 2.8.0", + "bitflags 2.9.1", "brotli", "bytes", "bytestring", @@ -121,7 +121,7 @@ dependencies = [ "mime", "percent-encoding", "pin-project-lite", - "rand 0.9.0", + "rand 0.9.1", "sha1", "smallvec", "tokio", @@ -137,7 +137,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -183,12 +183,11 @@ dependencies = [ [[package]] name = "actix-service" -version = "2.0.2" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b894941f818cfdc7ccc4b9e60fa7e53b5042a2e8567270f9147d5591893373a" +checksum = "9e46f36bf0e5af44bdc4bdb36fbbd421aa98c79a9bce724e1edeb3894e10dc7f" dependencies = [ "futures-core", - "paste", "pin-project-lite", ] @@ -206,7 +205,7 @@ dependencies = [ "pin-project-lite", "rustls-pki-types", "tokio", - "tokio-rustls 0.26.1", + "tokio-rustls 0.26.2", "tokio-util", "tracing", ] @@ -273,7 +272,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -324,12 +323,6 @@ dependencies = [ "gimli 0.31.1", ] -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "adler2" version = "2.0.0" @@ -338,14 +331,14 @@ checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "ahash" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy 0.7.35", + "zerocopy", ] [[package]] @@ -401,9 +394,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.15" +version = "0.6.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" dependencies = [ "anstyle", "anstyle-parse", @@ -416,36 +409,37 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" [[package]] name = "anstyle-parse" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.4" +version = "3.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "once_cell_polyfill", + "windows-sys 0.59.0", ] [[package]] @@ -481,9 +475,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.18" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df895a515f70646414f4b45c0b79082783b80552b373a68283012928df56f522" +checksum = "b37fc50485c4f3f736a4fb14199f6d5f5ba008d7f28fe710306c92780f004c07" dependencies = [ "flate2", "futures-core", @@ -511,20 +505,20 @@ checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] name = "atom_syndication" -version = "0.12.6" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec03a6e158ee0f38bfba811976ae909bc2505a4a2f4049c7e8df47df3497b119" +checksum = "d2f68d23e2cb4fd958c705b91a6b4c80ceeaf27a9e11651272a8389d5ce1a4a3" dependencies = [ "chrono", "derive_builder", "diligent-date-parser", "never", - "quick-xml 0.37.2", + "quick-xml 0.37.5", ] [[package]] @@ -535,27 +529,25 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "aws-lc-rs" -version = "1.12.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f409eb70b561706bf8abba8ca9c112729c481595893fd06a2dd9af8ed8441148" +checksum = "93fcc8f365936c834db5514fc45aee5b1202d677e6b40e48468aaaa8183ca8c7" dependencies = [ "aws-lc-sys", - "paste", "zeroize", ] [[package]] name = "aws-lc-sys" -version = "0.24.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "923ded50f602b3007e5e63e3f094c479d9c8a9b42d7f4034e4afe456aa48bfd2" +checksum = "61b1d86e7705efe1be1b569bab41d4fa1e14e220b60a160f78de2db687add079" dependencies = [ "bindgen", "cc", "cmake", "dunce", "fs_extra", - "paste", ] [[package]] @@ -567,7 +559,7 @@ dependencies = [ "addr2line 0.24.2", "cfg-if", "libc", - "miniz_oxide 0.8.3", + "miniz_oxide", "object", "rustc-demangle", "windows-targets 0.52.6", @@ -599,9 +591,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" -version = "1.6.0" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3" [[package]] name = "bcrypt" @@ -611,7 +603,7 @@ checksum = "92758ad6077e4c76a6cadbce5005f666df70d4f13b19976b1a8062eef880040f" dependencies = [ "base64 0.22.1", "blowfish", - "getrandom 0.3.1", + "getrandom 0.3.3", "subtle", "zeroize", ] @@ -631,7 +623,7 @@ version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "cexpr", "clang-sys", "itertools 0.12.1", @@ -644,7 +636,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.96", + "syn 2.0.101", "which", ] @@ -671,9 +663,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "block-buffer" @@ -717,15 +709,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "793db76d6187cd04dff33004d8e6c9cc4e05cd330500379d2394209271b4aeee" [[package]] name = "bytemuck" -version = "1.18.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" +checksum = "9134a6ef01ce4b366b50689c94f82c14bc72bc5d0386829828a2e2752ef7958c" [[package]] name = "byteorder" @@ -741,18 +733,18 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "bytestring" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d80203ea6b29df88012294f62733de21cfeab47f17b41af3a38bc30a03ee72" +checksum = "e465647ae23b2823b0753f50decb2d5a86d2bb2cac04788fafd1f80e45378e5f" dependencies = [ "bytes", ] [[package]] name = "cap-fs-ext" -version = "3.4.2" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f78efdd7378980d79c0f36b519e51191742d2c9f91ffa5e228fba9f3806d2e1" +checksum = "e41cc18551193fe8fa6f15c1e3c799bc5ec9e2cfbfaa8ed46f37013e3e6c173c" dependencies = [ "cap-primitives", "cap-std", @@ -762,9 +754,9 @@ dependencies = [ [[package]] name = "cap-primitives" -version = "3.4.2" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc15faeed2223d8b8e8cc1857f5861935a06d06713c4ac106b722ae9ce3c369" +checksum = "0a1e394ed14f39f8bc26f59d4c0c010dbe7f0a1b9bafff451b1f98b67c8af62a" dependencies = [ "ambient-authority", "fs-set-times", @@ -772,16 +764,17 @@ dependencies = [ "io-lifetimes", "ipnet", "maybe-owned", - "rustix 0.38.43", + "rustix 1.0.7", + "rustix-linux-procfs", "windows-sys 0.59.0", "winx", ] [[package]] name = "cap-rand" -version = "3.4.2" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea13372b49df066d1ae654e5c6e41799c1efd9f6b36794b921e877ea4037977" +checksum = "0acb89ccf798a28683f00089d0630dfaceec087234eae0d308c05ddeaa941b40" dependencies = [ "ambient-authority", "rand 0.8.5", @@ -789,27 +782,27 @@ dependencies = [ [[package]] name = "cap-std" -version = "3.4.2" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3dbd3e8e8d093d6ccb4b512264869e1281cdb032f7940bd50b2894f96f25609" +checksum = "07c0355ca583dd58f176c3c12489d684163861ede3c9efa6fd8bba314c984189" dependencies = [ "cap-primitives", "io-extras", "io-lifetimes", - "rustix 0.38.43", + "rustix 1.0.7", ] [[package]] name = "cap-time-ext" -version = "3.4.2" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd736b20fc033f564a1995fb82fc349146de43aabba19c7368b4cb17d8f9ea53" +checksum = "491af520b8770085daa0466978c75db90368c71896523f2464214e38359b1a5b" dependencies = [ "ambient-authority", "cap-primitives", "iana-time-zone", "once_cell", - "rustix 0.38.43", + "rustix 1.0.7", "winx", ] @@ -823,7 +816,7 @@ dependencies = [ "hound", "image", "lodepng", - "rand 0.9.0", + "rand 0.9.1", "serde_json", ] @@ -834,22 +827,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fce8dd7fcfcbf3a0a87d8f515194b49d6135acab73e18bd380d1d93bb1a15eb" dependencies = [ "heck 0.4.1", - "indexmap 2.7.0", + "indexmap 2.9.0", "log", "proc-macro2", "quote", "serde", "serde_json", - "syn 2.0.96", + "syn 2.0.101", "tempfile", "toml", ] [[package]] name = "cc" -version = "1.2.9" +version = "1.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b" +checksum = "956a5e21988b87f372569b66183b78babf23ebc2e744b733e4350a752c4dafac" dependencies = [ "jobserver", "libc", @@ -888,6 +881,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "chrono" version = "0.4.41" @@ -965,7 +964,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -999,9 +998,9 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.52" +version = "0.1.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" +checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0" dependencies = [ "cc", ] @@ -1020,9 +1019,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "colorchoice" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "combine" @@ -1119,9 +1118,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] @@ -1259,9 +1258,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.13" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" dependencies = [ "crossbeam-utils", ] @@ -1287,9 +1286,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crypto-common" @@ -1313,12 +1312,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.10" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core 0.20.11", + "darling_macro 0.20.11", ] [[package]] @@ -1337,16 +1336,16 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.10" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -1362,13 +1361,13 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.10" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ - "darling_core 0.20.10", + "darling_core 0.20.11", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -1402,9 +1401,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" dependencies = [ "const-oid", "der_derive", @@ -1421,14 +1420,14 @@ checksum = "8034092389675178f570469e6c3b0465d3d30b4505c294a6550db47f3c17ad18" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] name = "deranged" -version = "0.3.11" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" dependencies = [ "powerfmt", "serde", @@ -1453,7 +1452,7 @@ checksum = "2cdc8d50f426189eef89dac62fabfa0abb27d5cc008f25bf4156a0203325becc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -1471,10 +1470,10 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" dependencies = [ - "darling 0.20.10", + "darling 0.20.11", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -1484,20 +1483,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] name = "derive_more" -version = "0.99.18" +version = "0.99.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f" dependencies = [ "convert_case", "proc-macro2", "quote", "rustc_version", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -1517,7 +1516,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", "unicode-xid", ] @@ -1536,7 +1535,7 @@ version = "2.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff3e1edb1f37b4953dd5176916347289ed43d7119cc2e6c7c3f7849ff44ea506" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "byteorder", "chrono", "diesel_derives", @@ -1570,7 +1569,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -1581,20 +1580,20 @@ checksum = "d5adf688c584fe33726ce0e2898f608a2a92578ac94a4a92fcecf73214fe0716" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] name = "diesel_derives" -version = "2.2.3" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f2c3de51e2ba6bf2a648285696137aaf0f5f487bcbea93972fe8a364e131a4" +checksum = "68d4216021b3ea446fd2047f5c8f8fe6e98af34508a254a01e4d6bc1e844f84d" dependencies = [ "diesel_table_macro_syntax", "dsl_auto_type", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -1624,7 +1623,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25" dependencies = [ - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -1643,7 +1642,7 @@ dependencies = [ "diff", "regex", "same-file", - "unicode-width 0.1.13", + "unicode-width 0.1.14", ] [[package]] @@ -1716,7 +1715,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -1757,16 +1756,16 @@ checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] name = "dsl_auto_type" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5d9abe6314103864cc2d8901b7ae224e0ab1a103a0a416661b4097b0779b607" +checksum = "139ae9aca7527f85f26dd76483eb38533fd84bd571065da1739656ef71c5ff5b" dependencies = [ - "darling 0.20.10", + "darling 0.20.11", "either", "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -1856,7 +1855,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -1885,15 +1884,15 @@ dependencies = [ [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.10" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" dependencies = [ "libc", "windows-sys 0.59.0", @@ -1901,9 +1900,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "5.3.1" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" dependencies = [ "concurrent-queue", "parking", @@ -1912,9 +1911,9 @@ dependencies = [ [[package]] name = "event-listener-strategy" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" dependencies = [ "event-listener", "pin-project-lite", @@ -1969,7 +1968,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -2017,33 +2016,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78" dependencies = [ "cfg-if", - "rustix 1.0.2", + "rustix 1.0.7", "windows-sys 0.59.0", ] [[package]] name = "fdeflate" -version = "0.3.4" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" dependencies = [ "simd-adler32", ] [[package]] name = "flagset" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3ea1ec5f8307826a5b71094dd91fc04d4ae75d5709b20ad351c7fb4815c86ec" +checksum = "b7ac824320a75a52197e8f2d787f6a38b6718bb6897a35142d749af3c0e8f4fe" [[package]] name = "flate2" -version = "1.0.35" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" +checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" dependencies = [ "crc32fast", - "miniz_oxide 0.8.3", + "miniz_oxide", ] [[package]] @@ -2054,9 +2053,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foldhash" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "form_urlencoded" @@ -2069,9 +2068,9 @@ dependencies = [ [[package]] name = "fragile" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" +checksum = "28dd6caf6059519a65843af8fe2a3ae298b14b80179855aeb4adc2c1934ee619" [[package]] name = "fs-set-times" @@ -2080,7 +2079,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a" dependencies = [ "io-lifetimes", - "rustix 1.0.2", + "rustix 1.0.7", "windows-sys 0.59.0", ] @@ -2156,7 +2155,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -2204,7 +2203,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "debugid", "fxhash", "serde", @@ -2213,10 +2212,11 @@ dependencies = [ [[package]] name = "generator" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6bd114ceda131d3b1d665eba35788690ad37f5916457286b32ab6fd3c438dd" +checksum = "d18470a76cb7f8ff746cf1f7470914f900252ec36bbc40b569d74b1258446827" dependencies = [ + "cc", "cfg-if", "libc", "log", @@ -2236,9 +2236,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "js-sys", @@ -2249,14 +2249,16 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", + "js-sys", "libc", - "wasi 0.13.3+wasi-0.2.2", - "windows-targets 0.52.6", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", + "wasm-bindgen", ] [[package]] @@ -2266,7 +2268,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" dependencies = [ "fallible-iterator 0.3.0", - "indexmap 2.7.0", + "indexmap 2.9.0", "stable_deref_trait", ] @@ -2293,7 +2295,7 @@ checksum = "53010ccb100b96a67bc32c0175f0ed1426b31b655d562898e57325f81c023ac0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -2314,7 +2316,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.7.0", + "indexmap 2.9.0", "slab", "tokio", "tokio-util", @@ -2349,9 +2351,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" dependencies = [ "foldhash", ] @@ -2370,9 +2372,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.3.9" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08" [[package]] name = "hex" @@ -2429,12 +2431,11 @@ dependencies = [ [[package]] name = "html2text" -version = "0.14.0" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eacd0d94e37b02109daef505556923edda7785047f24d9634b84835a8122da7a" +checksum = "c1637acec3b965bab873352189d887b12c87b4f8d7571f4d185e796be5654ad8" dependencies = [ - "html5ever 0.29.0", - "markup5ever 0.14.0", + "html5ever 0.31.0", "tendril", "thiserror 2.0.12", "unicode-width 0.2.0", @@ -2465,21 +2466,19 @@ dependencies = [ "markup5ever 0.12.1", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] name = "html5ever" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e15626aaf9c351bc696217cbe29cb9b5e86c43f8a46b5e2f5c6c5cf7cb904ce" +checksum = "953cbbe631aae7fc0a112702ad5d3aaf09da38beaf45ea84610d6e1c358f569c" dependencies = [ "log", "mac", - "markup5ever 0.14.0", - "proc-macro2", - "quote", - "syn 2.0.96", + "markup5ever 0.16.1", + "match_token", ] [[package]] @@ -2527,12 +2526,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", - "futures-util", + "futures-core", "http 1.3.1", "http-body 1.0.1", "pin-project-lite", @@ -2557,7 +2556,7 @@ dependencies = [ "base64 0.22.1", "http-signature-normalization", "httpdate", - "reqwest 0.12.18", + "reqwest 0.12.19", "reqwest-middleware", "sha2", "thiserror 2.0.12", @@ -2566,9 +2565,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "httpdate" @@ -2635,27 +2634,26 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.3" +version = "0.27.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" dependencies = [ - "futures-util", "http 1.3.1", "hyper 1.6.0", "hyper-util", - "rustls 0.23.23", + "rustls 0.23.27", "rustls-pki-types", "tokio", - "tokio-rustls 0.26.1", + "tokio-rustls 0.26.2", "tower-service", - "webpki-roots 0.26.7", + "webpki-roots 1.0.0", ] [[package]] name = "hyper-util" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c293b6b3d21eca78250dc7dbebd6b9210ec5530e038cbfe0661b5c47ab06e8" +checksum = "dc2fdfdbff08affe55bb779f33b053aa1fe5dd5b54c257343c17edfa55711bdb" dependencies = [ "base64 0.22.1", "bytes", @@ -2687,26 +2685,27 @@ dependencies = [ [[package]] name = "i-love-jesus-macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8215279f83f9b829403812f845aa2d0dd5966332aa2fd0334a375256f3dd0322" +checksum = "f7c7baa75cd83700828568381ac84fe5c068d4cfd67cdfbdc4aa29db98d0facd" dependencies = [ "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] name = "iana-time-zone" -version = "0.1.61" +version = "0.1.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", - "windows-core 0.52.0", + "windows-core", ] [[package]] @@ -2759,9 +2758,9 @@ dependencies = [ [[package]] name = "icu_locid_transform_data" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" +checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" [[package]] name = "icu_normalizer" @@ -2783,9 +2782,9 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" +checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" [[package]] name = "icu_properties" @@ -2804,9 +2803,9 @@ dependencies = [ [[package]] name = "icu_properties_data" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" +checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" [[package]] name = "icu_provider" @@ -2833,7 +2832,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -2894,9 +2893,9 @@ dependencies = [ [[package]] name = "impl-more" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206ca75c9c03ba3d4ace2460e57b189f39f43de612c2f85836e65c929701bb2d" +checksum = "e8a5a9a0ff0086c7a148acb942baaabeadf9504d10400b5a05645853729b9cd2" [[package]] name = "indexmap" @@ -2911,12 +2910,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.7.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", - "hashbrown 0.15.2", + "hashbrown 0.15.4", "serde", ] @@ -2931,9 +2930,9 @@ dependencies = [ [[package]] name = "inout" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ "generic-array", ] @@ -2956,9 +2955,9 @@ checksum = "06432fb54d3be7964ecd3649233cddf80db2832f47fec34c01f65b3d9d774983" [[package]] name = "ipnet" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "iri-string" @@ -2996,9 +2995,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "ittapi" @@ -3042,10 +3041,11 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "jobserver" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" dependencies = [ + "getrandom 0.3.3", "libc", ] @@ -3122,10 +3122,11 @@ dependencies = [ "either", "elementtree", "hound", - "lemmy_api_common", "lemmy_api_crud", + "lemmy_api_utils", "lemmy_db_schema", "lemmy_db_schema_file", + "lemmy_db_views_api_misc", "lemmy_db_views_comment", "lemmy_db_views_community", "lemmy_db_views_community_follower", @@ -3160,58 +3161,32 @@ dependencies = [ name = "lemmy_api_common" version = "1.0.0-alpha.5" dependencies = [ - "activitypub_federation", - "actix-web", - "actix-web-httpauth", - "anyhow", - "chrono", - "either", - "encoding_rs", - "enum-map", - "extism", - "extism-convert", - "futures", - "infer", - "jsonwebtoken", "lemmy_db_schema", "lemmy_db_schema_file", + "lemmy_db_views_api_misc", "lemmy_db_views_comment", "lemmy_db_views_community", "lemmy_db_views_community_follower", "lemmy_db_views_community_moderator", - "lemmy_db_views_community_person_ban", "lemmy_db_views_custom_emoji", + "lemmy_db_views_inbox_combined", "lemmy_db_views_local_image", "lemmy_db_views_local_user", + "lemmy_db_views_modlog_combined", "lemmy_db_views_person", + "lemmy_db_views_person_content_combined", + "lemmy_db_views_person_liked_combined", + "lemmy_db_views_person_saved_combined", "lemmy_db_views_post", "lemmy_db_views_private_message", + "lemmy_db_views_readable_federation_state", "lemmy_db_views_registration_applications", "lemmy_db_views_report_combined", "lemmy_db_views_reports", + "lemmy_db_views_search_combined", "lemmy_db_views_site", "lemmy_db_views_vote", - "lemmy_email", "lemmy_utils", - "mime", - "mime_guess", - "moka", - "once_cell", - "pretty_assertions", - "regex", - "reqwest 0.12.18", - "reqwest-middleware", - "serde", - "serde_json", - "serde_with", - "serial_test", - "tokio", - "tracing", - "ts-rs", - "url", - "urlencoding", - "webmention", - "webpage", ] [[package]] @@ -3227,9 +3202,10 @@ dependencies = [ "diesel-async", "futures", "futures-util", - "lemmy_api_common", + "lemmy_api_utils", "lemmy_db_schema", "lemmy_db_schema_file", + "lemmy_db_views_api_misc", "lemmy_db_views_comment", "lemmy_db_views_community", "lemmy_db_views_community_follower", @@ -3239,6 +3215,7 @@ dependencies = [ "lemmy_db_views_person", "lemmy_db_views_post", "lemmy_db_views_private_message", + "lemmy_db_views_registration_applications", "lemmy_db_views_search_combined", "lemmy_db_views_site", "lemmy_email", @@ -3251,6 +3228,58 @@ dependencies = [ "uuid", ] +[[package]] +name = "lemmy_api_utils" +version = "1.0.0-alpha.5" +dependencies = [ + "activitypub_federation", + "actix-web", + "actix-web-httpauth", + "anyhow", + "chrono", + "either", + "encoding_rs", + "enum-map", + "extism", + "extism-convert", + "futures", + "infer", + "jsonwebtoken", + "lemmy_db_schema", + "lemmy_db_schema_file", + "lemmy_db_views_api_misc", + "lemmy_db_views_comment", + "lemmy_db_views_community", + "lemmy_db_views_community_follower", + "lemmy_db_views_community_moderator", + "lemmy_db_views_community_person_ban", + "lemmy_db_views_local_image", + "lemmy_db_views_local_user", + "lemmy_db_views_person", + "lemmy_db_views_post", + "lemmy_db_views_private_message", + "lemmy_db_views_site", + "lemmy_email", + "lemmy_utils", + "mime", + "mime_guess", + "moka", + "once_cell", + "pretty_assertions", + "regex", + "reqwest 0.12.19", + "reqwest-middleware", + "serde", + "serde_json", + "serial_test", + "tokio", + "tracing", + "url", + "urlencoding", + "webmention", + "webpage", +] + [[package]] name = "lemmy_apub" version = "1.0.0-alpha.5" @@ -3266,10 +3295,11 @@ dependencies = [ "futures", "futures-util", "itertools 0.14.0", - "lemmy_api_common", + "lemmy_api_utils", "lemmy_apub_objects", "lemmy_db_schema", "lemmy_db_schema_file", + "lemmy_db_views_api_misc", "lemmy_db_views_comment", "lemmy_db_views_community", "lemmy_db_views_community_follower", @@ -3309,7 +3339,7 @@ dependencies = [ "html2md", "html2text", "itertools 0.14.0", - "lemmy_api_common", + "lemmy_api_utils", "lemmy_db_schema", "lemmy_db_schema_file", "lemmy_db_views_community_moderator", @@ -3367,7 +3397,7 @@ dependencies = [ "moka", "pretty_assertions", "regex", - "rustls 0.23.23", + "rustls 0.23.27", "serde", "serde_json", "serde_with", @@ -3402,6 +3432,27 @@ dependencies = [ "ts-rs", ] +[[package]] +name = "lemmy_db_views_api_misc" +version = "1.0.0-alpha.5" +dependencies = [ + "extism", + "extism-convert", + "lemmy_db_schema", + "lemmy_db_schema_file", + "lemmy_db_views_comment", + "lemmy_db_views_community", + "lemmy_db_views_community_follower", + "lemmy_db_views_community_moderator", + "lemmy_db_views_local_user", + "lemmy_db_views_person", + "lemmy_db_views_post", + "serde", + "serde_with", + "ts-rs", + "url", +] + [[package]] name = "lemmy_db_views_comment" version = "1.0.0-alpha.5" @@ -3413,6 +3464,7 @@ dependencies = [ "lemmy_db_schema", "lemmy_db_schema_file", "lemmy_db_views_local_user", + "lemmy_db_views_vote", "lemmy_utils", "pretty_assertions", "serde", @@ -3431,6 +3483,8 @@ dependencies = [ "i-love-jesus", "lemmy_db_schema", "lemmy_db_schema_file", + "lemmy_db_views_community_moderator", + "lemmy_db_views_person", "lemmy_utils", "serde", "serde_with", @@ -3493,7 +3547,9 @@ dependencies = [ "lemmy_db_schema_file", "lemmy_utils", "serde", + "serde_with", "ts-rs", + "url", ] [[package]] @@ -3528,6 +3584,7 @@ dependencies = [ "serde", "serde_with", "ts-rs", + "url", ] [[package]] @@ -3543,6 +3600,7 @@ dependencies = [ "lemmy_utils", "pretty_assertions", "serde", + "serde_with", "serial_test", "tokio", "ts-rs", @@ -3575,9 +3633,11 @@ dependencies = [ "i-love-jesus", "lemmy_db_schema", "lemmy_db_schema_file", + "lemmy_db_views_community_moderator", "lemmy_utils", "pretty_assertions", "serde", + "serde_with", "serial_test", "tokio", "ts-rs", @@ -3657,7 +3717,9 @@ dependencies = [ "i-love-jesus", "lemmy_db_schema", "lemmy_db_schema_file", + "lemmy_db_views_community", "lemmy_db_views_local_user", + "lemmy_db_views_vote", "lemmy_utils", "pretty_assertions", "serde", @@ -3683,6 +3745,18 @@ dependencies = [ "ts-rs", ] +[[package]] +name = "lemmy_db_views_readable_federation_state" +version = "1.0.0-alpha.5" +dependencies = [ + "chrono", + "lemmy_db_schema", + "lemmy_utils", + "serde", + "serde_with", + "ts-rs", +] + [[package]] name = "lemmy_db_views_registration_applications" version = "1.0.0-alpha.5" @@ -3716,6 +3790,7 @@ dependencies = [ "lemmy_utils", "pretty_assertions", "serde", + "serde_with", "serial_test", "tokio", "ts-rs", @@ -3763,13 +3838,19 @@ dependencies = [ name = "lemmy_db_views_site" version = "1.0.0-alpha.5" dependencies = [ + "chrono", "diesel", "diesel-async", "lemmy_db_schema", "lemmy_db_schema_file", + "lemmy_db_views_api_misc", + "lemmy_db_views_person", + "lemmy_db_views_readable_federation_state", "lemmy_utils", "serde", + "serde_with", "ts-rs", + "url", ] [[package]] @@ -3818,7 +3899,7 @@ dependencies = [ "diesel", "diesel-async", "futures", - "lemmy_api_common", + "lemmy_api_utils", "lemmy_apub_objects", "lemmy_db_schema", "lemmy_db_schema_file", @@ -3826,7 +3907,7 @@ dependencies = [ "lemmy_utils", "mockall", "moka", - "reqwest 0.12.18", + "reqwest 0.12.19", "serde", "serde_json", "serial_test", @@ -3855,10 +3936,13 @@ dependencies = [ "futures", "futures-util", "http 1.3.1", - "lemmy_api_common", + "lemmy_api_utils", "lemmy_db_schema", "lemmy_db_schema_file", + "lemmy_db_views_api_misc", + "lemmy_db_views_community", "lemmy_db_views_inbox_combined", + "lemmy_db_views_local_image", "lemmy_db_views_local_user", "lemmy_db_views_modlog_combined", "lemmy_db_views_person_content_combined", @@ -3867,7 +3951,7 @@ dependencies = [ "lemmy_utils", "pretty_assertions", "prometheus", - "reqwest 0.12.18", + "reqwest 0.12.19", "reqwest-middleware", "rss", "serde", @@ -3885,8 +3969,8 @@ dependencies = [ "actix-web", "clap", "lemmy_api", - "lemmy_api_common", "lemmy_api_crud", + "lemmy_api_utils", "lemmy_apub", "lemmy_apub_objects", "lemmy_db_schema", @@ -3897,7 +3981,7 @@ dependencies = [ "mimalloc", "reqwest-middleware", "reqwest-tracing", - "rustls 0.23.23", + "rustls 0.23.27", "serde_json", "tokio", "tracing", @@ -3945,9 +4029,9 @@ dependencies = [ [[package]] name = "lettre" -version = "0.11.15" +version = "0.11.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759bc2b8eabb6a30b235d6f716f7f36479f4b38cbe65b8747aefee51f89e8437" +checksum = "cb2a0354e9ece2fcdcf9fa53417f6de587230c0c248068eb058fa26c4a753179" dependencies = [ "async-trait", "base64 0.22.1", @@ -3963,12 +4047,12 @@ dependencies = [ "nom 8.0.0", "percent-encoding", "quoted_printable", - "rustls 0.23.23", + "rustls 0.23.27", "socket2", "tokio", - "tokio-rustls 0.26.1", + "tokio-rustls 0.26.2", "url", - "webpki-roots 0.26.7", + "webpki-roots 1.0.0", ] [[package]] @@ -3979,19 +4063,19 @@ checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "libloading" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.53.0", ] [[package]] name = "libm" -version = "0.2.11" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" [[package]] name = "libmimalloc-sys" @@ -4009,7 +4093,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "libc", ] @@ -4036,15 +4120,15 @@ checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "linux-raw-sys" -version = "0.9.2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9c683daf087dc577b7506e9695b3d556a9f3849903fa28186283afd6809e9" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] name = "litemap" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" +checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" [[package]] name = "local-channel" @@ -4065,9 +4149,9 @@ checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" [[package]] name = "lock_api" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" dependencies = [ "autocfg", "scopeguard", @@ -4075,9 +4159,9 @@ dependencies = [ [[package]] name = "lodepng" -version = "3.10.7" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b2dea7cda68e381418c985fd8f32a9c279a21ae8c715f2376adb20c27a0fad3" +checksum = "a7720115060cd38dcfe5c758525a43fd34dc615d0566374212ff0dc3b6151eac" dependencies = [ "crc32fast", "flate2", @@ -4087,9 +4171,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.25" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "loom" @@ -4104,6 +4188,12 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + [[package]] name = "mac" version = "0.1.1" @@ -4128,7 +4218,7 @@ dependencies = [ "manyhow-macros", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -4151,7 +4241,7 @@ dependencies = [ "argparse", "const_format", "derivative", - "derive_more 0.99.18", + "derive_more 0.99.20", "downcast-rs", "entities", "html-escape", @@ -4242,16 +4332,13 @@ dependencies = [ [[package]] name = "markup5ever" -version = "0.14.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82c88c6129bd24319e62a0359cb6b958fa7e8be6e19bb1663bc396b90883aca5" +checksum = "d0a8096766c229e8c88a3900c9b44b7e06aa7f7343cc229158c3e58ef8f9973a" dependencies = [ "log", - "phf 0.11.3", - "phf_codegen 0.11.3", - "string_cache", - "string_cache_codegen", "tendril", + "web_atoms", ] [[package]] @@ -4278,6 +4365,17 @@ dependencies = [ "xml5ever 0.18.1", ] +[[package]] +name = "match_token" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a9689d8d44bf9964484516275f5cd4c9b59457a6940c1d5d0ecbb94510a36b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + [[package]] name = "matchers" version = "0.1.0" @@ -4289,9 +4387,9 @@ dependencies = [ [[package]] name = "matchit" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" +checksum = "2f926ade0c4e170215ae43342bf13b9310a437609c81f29f86c5df6657582ef9" [[package]] name = "maybe-owned" @@ -4332,7 +4430,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.38.43", + "rustix 0.38.44", ] [[package]] @@ -4389,33 +4487,24 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" dependencies = [ - "adler", + "adler2", "simd-adler32", ] -[[package]] -name = "miniz_oxide" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8402cab7aefae129c6977bb0ff1b8fd9a04eb5b51efc50a70bea51cda0c7924" -dependencies = [ - "adler2", -] - [[package]] name = "mio" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4441,7 +4530,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -4578,9 +4667,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" dependencies = [ "hermit-abi", "libc", @@ -4593,8 +4682,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "crc32fast", - "hashbrown 0.15.2", - "indexmap 2.7.0", + "hashbrown 0.15.4", + "indexmap 2.9.0", "memchr", ] @@ -4604,6 +4693,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + [[package]] name = "overload" version = "0.1.1" @@ -4618,9 +4713,9 @@ checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" dependencies = [ "lock_api", "parking_lot_core", @@ -4628,9 +4723,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.10" +version = "0.9.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" dependencies = [ "cfg-if", "libc", @@ -4647,9 +4742,9 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pem" -version = "3.0.4" +version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" +checksum = "38af38e8470ac9dee3ce1bae1af9c1671fffc44ddfd8bd1d0a3445bf349a8ef3" dependencies = [ "base64 0.22.1", "serde", @@ -4748,22 +4843,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -4801,18 +4896,18 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "plist" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016" +checksum = "eac26e981c03a6e53e0aee43c113e3202f5581d5360dae7bd2c70e800dd0451d" dependencies = [ "base64 0.22.1", - "indexmap 2.7.0", + "indexmap 2.9.0", "quick-xml 0.32.0", "serde", "time", @@ -4820,22 +4915,22 @@ dependencies = [ [[package]] name = "png" -version = "0.17.13" +version = "0.17.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1" +checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" dependencies = [ "bitflags 1.3.2", "crc32fast", "fdeflate", "flate2", - "miniz_oxide 0.7.4", + "miniz_oxide", ] [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" [[package]] name = "postcard" @@ -4862,7 +4957,7 @@ dependencies = [ "hmac", "md-5", "memchr", - "rand 0.9.0", + "rand 0.9.1", "sha2", "stringprep", ] @@ -4886,18 +4981,18 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy 0.7.35", + "zerocopy", ] [[package]] name = "pq-sys" -version = "0.4.8" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0052426df997c0cbd30789eb44ca097e3541717a7b8fa36b1c464ee7edebd" +checksum = "f6cc05d7ea95200187117196eee9edd0644424911821aeb28a18ce60ea0b8793" dependencies = [ "vcpkg", ] @@ -4946,12 +5041,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.29" +version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6924ced06e1f7dfe3fa48d57b9f74f55d8915f5036121bef647ef4b204895fac" +checksum = "9dee91521343f4c5c6a63edd65e54f31f5c92fe8978c40a4282f8372194c6a7d" dependencies = [ "proc-macro2", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -4976,9 +5071,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.93" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -4989,11 +5084,11 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "731e0d9356b0c25f16f33b5be79b1c57b562f141ebfcdb0ad8ac2c13a24293b4" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "hex", "lazy_static", "procfs-core", - "rustix 0.38.43", + "rustix 0.38.44", ] [[package]] @@ -5002,7 +5097,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3554923a69f4ce04c4a754260c338f505ce22642d3830e049a399fc2059a29" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "hex", ] @@ -5043,7 +5138,7 @@ dependencies = [ "itertools 0.14.0", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -5054,9 +5149,9 @@ checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" [[package]] name = "psm" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200b9ff220857e53e184257720a14553b2f4aa02577d2ed9842d45d4b9654810" +checksum = "6e944464ec8536cd1beb0bbfd96987eb5e3b72f2ecdafdc5c769a37f1fa2ae1f" dependencies = [ "cc", ] @@ -5072,9 +5167,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.37.2" +version = "0.37.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165859e9e55f79d67b96c5d96f4e88b6f2695a1972849c15a6a3f5c59fc2c003" +checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb" dependencies = [ "encoding_rs", "memchr", @@ -5082,45 +5177,52 @@ dependencies = [ [[package]] name = "quinn" -version = "0.11.5" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" +checksum = "626214629cda6781b6dc1d316ba307189c85ba657213ce642d9c77670f8202c8" dependencies = [ "bytes", + "cfg_aliases", "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash 2.0.0", - "rustls 0.23.23", + "rustc-hash 2.1.1", + "rustls 0.23.27", "socket2", - "thiserror 1.0.69", + "thiserror 2.0.12", "tokio", "tracing", + "web-time", ] [[package]] name = "quinn-proto" -version = "0.11.8" +version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" +checksum = "49df843a9161c85bb8aae55f101bc0bac8bcafd637a620d9122fd7e0b2f7422e" dependencies = [ "bytes", - "rand 0.8.5", + "getrandom 0.3.3", + "lru-slab", + "rand 0.9.1", "ring", - "rustc-hash 2.0.0", - "rustls 0.23.23", + "rustc-hash 2.1.1", + "rustls 0.23.27", + "rustls-pki-types", "slab", - "thiserror 1.0.69", + "thiserror 2.0.12", "tinyvec", "tracing", + "web-time", ] [[package]] name = "quinn-udp" -version = "0.5.5" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" +checksum = "ee4e529991f949c5e25755532370b8af5d114acae52326361d68d47af64aa842" dependencies = [ + "cfg_aliases", "libc", "once_cell", "socket2", @@ -5130,9 +5232,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] @@ -5143,6 +5245,12 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "640c9bd8497b02465aeef5375144c26062e0dcd5939dfcbb0f5db76cb8c17c73" +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + [[package]] name = "rand" version = "0.8.5" @@ -5156,13 +5264,12 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" dependencies = [ "rand_chacha 0.9.0", - "rand_core 0.9.0", - "zerocopy 0.8.17", + "rand_core 0.9.3", ] [[package]] @@ -5182,7 +5289,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core 0.9.0", + "rand_core 0.9.3", ] [[package]] @@ -5191,17 +5298,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.2.16", ] [[package]] name = "rand_core" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b08f3c9802962f7e1b25113931d94f43ed9725bebc59db9d0c3e9a23b67e15ff" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ - "getrandom 0.3.1", - "zerocopy 0.8.17", + "getrandom 0.3.3", ] [[package]] @@ -5226,22 +5332,22 @@ dependencies = [ [[package]] name = "readonly" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a25d631e41bfb5fdcde1d4e2215f62f7f0afa3ff11e26563765bd6ea1d229aeb" +checksum = "f2a62d85ed81ca5305dc544bd42c8804c5060b78ffa5ad3c64b0fb6a8c13d062" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] name = "redox_syscall" -version = "0.5.8" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", ] [[package]] @@ -5250,7 +5356,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.2.16", "libredox", "thiserror 1.0.69", ] @@ -5361,9 +5467,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.18" +version = "0.12.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e98ff6b0dbbe4d5a37318f433d4fc82babd21631f194d370409ceb2e40b2f0b5" +checksum = "a2f8e5513d63f2e5b386eb5106dc67eaf3f84e95258e210489136b8b92ad6119" dependencies = [ "async-compression", "base64 0.22.1", @@ -5375,7 +5481,7 @@ dependencies = [ "http-body 1.0.1", "http-body-util", "hyper 1.6.0", - "hyper-rustls 0.27.3", + "hyper-rustls 0.27.7", "hyper-util", "ipnet", "js-sys", @@ -5385,14 +5491,14 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.23", + "rustls 0.23.27", "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "tokio", - "tokio-rustls 0.26.1", + "tokio-rustls 0.26.2", "tokio-util", "tower", "tower-http", @@ -5414,7 +5520,7 @@ dependencies = [ "anyhow", "async-trait", "http 1.3.1", - "reqwest 0.12.18", + "reqwest 0.12.19", "serde", "thiserror 1.0.69", "tower-service", @@ -5422,16 +5528,16 @@ dependencies = [ [[package]] name = "reqwest-tracing" -version = "0.5.5" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73e6153390585f6961341b50e5a1931d6be6dee4292283635903c26ef9d980d2" +checksum = "d75b0eee96990cfb4c09545847385e89b2d2d2e571143d55264a05d77c713780" dependencies = [ "anyhow", "async-trait", - "getrandom 0.2.15", + "getrandom 0.2.16", "http 1.3.1", "matchit", - "reqwest 0.12.18", + "reqwest 0.12.19", "reqwest-middleware", "tracing", ] @@ -5447,15 +5553,14 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.8" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.15", + "getrandom 0.2.16", "libc", - "spin", "untrusted", "windows-sys 0.52.0", ] @@ -5531,7 +5636,7 @@ dependencies = [ "atom_syndication", "derive_builder", "never", - "quick-xml 0.37.2", + "quick-xml 0.37.5", ] [[package]] @@ -5548,9 +5653,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hash" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustc_version" @@ -5563,32 +5668,40 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.43" +version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "errno", - "itoa", "libc", "linux-raw-sys 0.4.15", - "once_cell", "windows-sys 0.59.0", ] [[package]] name = "rustix" -version = "1.0.2" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7178faa4b75a30e269c71e61c353ce2748cf3d76f0c44c393f4e60abf49b825" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "errno", "libc", - "linux-raw-sys 0.9.2", + "linux-raw-sys 0.9.4", "windows-sys 0.59.0", ] +[[package]] +name = "rustix-linux-procfs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc84bf7e9aa16c4f2c758f27412dc9841341e16aa682d9c7ac308fe3ee12056" +dependencies = [ + "once_cell", + "rustix 1.0.7", +] + [[package]] name = "rustls" version = "0.21.12" @@ -5603,16 +5716,16 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.23" +version = "0.23.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47796c98c480fce5406ef69d1c76378375492c3b0a0de587be0c1d9feb12f395" +checksum = "730944ca083c1c233a75c09f199e973ca499344a2b7ba9e755c457e86fb4a321" dependencies = [ "aws-lc-rs", "log", "once_cell", "ring", "rustls-pki-types", - "rustls-webpki 0.102.8", + "rustls-webpki 0.103.3", "subtle", "zeroize", ] @@ -5628,9 +5741,13 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.10.1" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" +checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +dependencies = [ + "web-time", + "zeroize", +] [[package]] name = "rustls-webpki" @@ -5644,9 +5761,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.8" +version = "0.103.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +checksum = "e4a72fe2bcf7a6ac6fd7d0b9e5cb68aeb7d4c0a0271730218b3e92d43b4eb435" dependencies = [ "aws-lc-rs", "ring", @@ -5656,15 +5773,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" [[package]] name = "ryu" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "same-file" @@ -5677,21 +5794,20 @@ dependencies = [ [[package]] name = "scc" -version = "2.1.17" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c947adb109a8afce5fc9c7bf951f87f146e9147b3a6a58413105628fb1d1e66" +checksum = "22b2d775fb28f245817589471dd49c5edf64237f4a19d10ce9a92ff4651a27f4" dependencies = [ "sdd", ] [[package]] name = "scoped-futures" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1473e24c637950c9bd38763220bea91ec3e095a89f672bbd7a10d03e77ba467" +checksum = "1b24aae2d0636530f359e9d5ef0c04669d11c5e756699b27a6a6d845d8329091" dependencies = [ - "cfg-if", - "pin-utils", + "pin-project-lite", ] [[package]] @@ -5718,15 +5834,15 @@ dependencies = [ [[package]] name = "sdd" -version = "3.0.3" +version = "3.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a7b59a5d9b0099720b417b6325d91a52cbf5b3dcb5041d864be53eefa58abc" +checksum = "584e070911c7017da6cb2eb0788d09f43d789029b5877d3e5ecc8acf86ceee21" [[package]] name = "select" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f9da09dc3f4dfdb6374cbffff7a2cffcec316874d4429899eefdc97b3b94dcd" +checksum = "5910c1d91bd7e6e178c0f8eb9e4ad01f814064b4a1c0ae3c906224a3cbf12879" dependencies = [ "bit-set", "html5ever 0.26.0", @@ -5759,7 +5875,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -5768,7 +5884,7 @@ version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ - "indexmap 2.7.0", + "indexmap 2.9.0", "itoa", "memchr", "ryu", @@ -5777,9 +5893,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" dependencies = [ "serde", ] @@ -5806,7 +5922,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.7.0", + "indexmap 2.9.0", "serde", "serde_derive", "serde_json", @@ -5820,10 +5936,10 @@ version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" dependencies = [ - "darling 0.20.10", + "darling 0.20.11", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -5848,7 +5964,7 @@ checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -5899,9 +6015,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.2" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +checksum = "9203b8055f63a2a00e2f593bb0510367fe707d7ff1e5c872de2f537b339e5410" dependencies = [ "libc", ] @@ -5924,13 +6040,13 @@ checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "simple_asn1" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" +checksum = "297f631f50729c8c99b84667867963997ec0b50f32b2a7dbcab828ef0541e8bb" dependencies = [ "num-bigint", "num-traits", - "thiserror 1.0.69", + "thiserror 2.0.12", "time", ] @@ -5973,9 +6089,9 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "smallvec" -version = "1.13.2" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" dependencies = [ "serde", ] @@ -5988,7 +6104,7 @@ checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -6031,9 +6147,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "stacker" -version = "0.1.17" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799c883d55abdb5e98af1a7b3f23b9b6de8ecada0ecac058672d7635eb48ca7b" +checksum = "cddb07e32ddb770749da91081d8d0ac3a16f1a569a18b20348cd371f5dead06b" dependencies = [ "cc", "cfg-if", @@ -6050,26 +6166,25 @@ checksum = "7a8348af2d9fc3258c8733b8d9d8db2e56f54b2363a4b5b81585c7875ed65e65" [[package]] name = "string_cache" -version = "0.8.7" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" dependencies = [ "new_debug_unreachable", - "once_cell", "parking_lot", - "phf_shared 0.10.0", + "phf_shared 0.11.3", "precomputed-hash", "serde", ] [[package]] name = "string_cache_codegen" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" +checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0" dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", + "phf_generator 0.11.3", + "phf_shared 0.11.3", "proc-macro2", "quote", ] @@ -6105,24 +6220,24 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.27.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce1475c515a4f03a8a7129bb5228b81a781a86cb0b3fbbc19e1c556d491a401f" +checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.27.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9688894b43459159c82bfa5a5fa0435c19cbe3c9b427fa1dd7b1ce0c279b18a7" +checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", "rustversion", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -6144,9 +6259,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.96" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", @@ -6161,22 +6276,22 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "sync_wrapper" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" dependencies = [ "futures-core", ] [[package]] name = "synstructure" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -6228,12 +6343,12 @@ version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc4592f674ce18521c2a81483873a49596655b179f71c5e05d10c1fe66c78745" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "cap-fs-ext", "cap-std", "fd-lock", "io-lifetimes", - "rustix 0.38.43", + "rustix 0.38.44", "windows-sys 0.59.0", "winx", ] @@ -6252,15 +6367,14 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.18.0" +version = "3.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c317e0a526ee6120d8dabad239c8dadca62b24b6f168914bbbc8e2fb1f0e567" +checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" dependencies = [ - "cfg-if", "fastrand", - "getrandom 0.3.1", + "getrandom 0.3.3", "once_cell", - "rustix 1.0.2", + "rustix 1.0.7", "windows-sys 0.59.0", ] @@ -6308,7 +6422,7 @@ checksum = "97e0639209021e54dbe19cafabfc0b5574b078c37358945e6d473eabe39bb974" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -6337,7 +6451,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -6348,7 +6462,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -6363,9 +6477,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.37" +version = "0.3.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" +checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" dependencies = [ "deranged", "itoa", @@ -6378,15 +6492,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" [[package]] name = "time-macros" -version = "0.2.19" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" +checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" dependencies = [ "num-conv", "time-core", @@ -6410,9 +6524,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "022db8904dfa342efe721985167e9fcd16c29b226db4397ed752a761cfce81e8" +checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" dependencies = [ "tinyvec_macros", ] @@ -6425,9 +6539,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tls_codec" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e78c9c330f8c85b2bae7c8368f2739157db9991235123aa1b15ef9502bfb6a" +checksum = "0de2e01245e2bb89d6f05801c564fa27624dbd7b1846859876c7dad82e90bf6b" dependencies = [ "tls_codec_derive", "zeroize", @@ -6435,13 +6549,13 @@ dependencies = [ [[package]] name = "tls_codec_derive" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9ef545650e79f30233c0003bcc2504d7efac6dad25fca40744de773fe2049c" +checksum = "2d2e76690929402faae40aebdda620a2c0e25dd6d3b9afe48867dfd95991f4bd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -6470,7 +6584,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -6492,7 +6606,7 @@ dependencies = [ "pin-project-lite", "postgres-protocol", "postgres-types", - "rand 0.9.0", + "rand 0.9.1", "socket2", "tokio", "tokio-util", @@ -6507,10 +6621,10 @@ checksum = "27d684bad428a0f2481f42241f821db42c54e2dc81d8c00db8536c506b0a0144" dependencies = [ "const-oid", "ring", - "rustls 0.23.23", + "rustls 0.23.27", "tokio", "tokio-postgres", - "tokio-rustls 0.26.1", + "tokio-rustls 0.26.2", "x509-cert", ] @@ -6526,11 +6640,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" +checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" dependencies = [ - "rustls 0.23.23", + "rustls 0.23.27", "tokio", ] @@ -6549,9 +6663,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.19" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" dependencies = [ "serde", "serde_spanned", @@ -6561,26 +6675,33 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.8" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.24" +version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ - "indexmap 2.7.0", + "indexmap 2.9.0", "serde", "serde_spanned", "toml_datetime", + "toml_write", "winnow", ] +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + [[package]] name = "totp-rs" version = "5.7.0" @@ -6590,7 +6711,7 @@ dependencies = [ "base32", "constant_time_eq", "hmac", - "rand 0.9.0", + "rand 0.9.1", "sha1", "sha2", "url", @@ -6606,7 +6727,7 @@ dependencies = [ "futures-core", "futures-util", "pin-project-lite", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "tokio", "tower-layer", "tower-service", @@ -6614,11 +6735,11 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc2d9e086a412a451384326f521c8123a99a466b329941a9403696bff9b0da2" +checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "bytes", "futures-util", "http 1.3.1", @@ -6669,20 +6790,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.28" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +checksum = "1b1ffbcf9c6f6b99d386e7444eb608ba646ae452a36b39737deb9663b610f662" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] name = "tracing-core" -version = "0.1.33" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" dependencies = [ "once_cell", "valuable", @@ -6748,7 +6869,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04659ddb06c87d233c566112c1c9c5b9e98256d9af50ec3bc9c8327f873a7568" dependencies = [ "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -6778,7 +6899,7 @@ checksum = "0e9d8656589772eeec2cf7a8264d9cda40fb28b9bc53118ceb9e8c07f8f38730" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", "termcolor", ] @@ -6790,15 +6911,15 @@ checksum = "676ac81d5454c4dcf37955d34fa8626ede3490f744b86ca14a7b90168d2a08aa" [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "unicase" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicode-bidi" @@ -6814,9 +6935,9 @@ checksum = "2281c8c1d221438e373249e065ca4989c4c36952c211ff21a0ee91c44a3869e7" [[package]] name = "unicode-ident" -version = "1.0.14" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "unicode-normalization" @@ -6829,9 +6950,9 @@ dependencies = [ [[package]] name = "unicode-properties" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ea75f83c0137a9b98608359a5f1af8144876eb67bcb1ce837368e906a9f524" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" [[package]] name = "unicode-segmentation" @@ -6841,9 +6962,9 @@ checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "unicode-width" @@ -6873,10 +6994,10 @@ dependencies = [ "flate2", "log", "once_cell", - "rustls 0.23.23", + "rustls 0.23.27", "rustls-pki-types", "url", - "webpki-roots 0.26.7", + "webpki-roots 0.26.11", ] [[package]] @@ -6929,19 +7050,21 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.13.1" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced87ca4be083373936a67f8de945faa23b6b42384bd5b64434850802c6dccd0" +checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" dependencies = [ - "getrandom 0.3.1", + "getrandom 0.3.3", + "js-sys", "serde", + "wasm-bindgen", ] [[package]] name = "valuable" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "vcpkg" @@ -6982,9 +7105,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi" -version = "0.13.3+wasi-0.2.2" +version = "0.14.2+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" dependencies = [ "wit-bindgen-rt", ] @@ -6996,7 +7119,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ddca85a537113179aae69f1faf916401113acb66e4b52b86483344bc5ae43fa" dependencies = [ "anyhow", - "bitflags 2.8.0", + "bitflags 2.9.1", "cap-fs-ext", "cap-rand", "cap-std", @@ -7006,7 +7129,7 @@ dependencies = [ "io-lifetimes", "log", "once_cell", - "rustix 0.38.43", + "rustix 0.38.44", "system-interface", "thiserror 1.0.69", "tracing", @@ -7043,18 +7166,19 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] @@ -7077,7 +7201,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -7102,19 +7226,19 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.227.1" +version = "0.233.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80bb72f02e7fbf07183443b27b0f3d4144abf8c114189f2e088ed95b696a7822" +checksum = "9679ae3cf7cfa2ca3a327f7fab97f27f3294d402fd1a76ca8ab514e17973e4d3" dependencies = [ "leb128fmt", - "wasmparser 0.227.1", + "wasmparser 0.233.0", ] [[package]] name = "wasm-streams" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" dependencies = [ "futures-util", "js-sys", @@ -7130,21 +7254,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" dependencies = [ "ahash", - "bitflags 2.8.0", + "bitflags 2.9.1", "hashbrown 0.14.5", - "indexmap 2.7.0", + "indexmap 2.9.0", "semver", "serde", ] [[package]] name = "wasmparser" -version = "0.227.1" +version = "0.233.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f51cad774fb3c9461ab9bccc9c62dfb7388397b5deda31bf40e8108ccd678b2" +checksum = "b51cb03afce7964bbfce46602d6cb358726f36430b6ba084ac6020d8ce5bc102" dependencies = [ - "bitflags 2.8.0", - "indexmap 2.7.0", + "bitflags 2.9.1", + "indexmap 2.9.0", "semver", ] @@ -7168,7 +7292,7 @@ dependencies = [ "addr2line 0.21.0", "anyhow", "async-trait", - "bitflags 2.8.0", + "bitflags 2.9.1", "bumpalo", "cc", "cfg-if", @@ -7176,7 +7300,7 @@ dependencies = [ "fxprof-processed-profile", "gimli 0.28.1", "hashbrown 0.14.5", - "indexmap 2.7.0", + "indexmap 2.9.0", "ittapi", "libc", "libm", @@ -7189,7 +7313,7 @@ dependencies = [ "postcard", "psm", "rayon", - "rustix 0.38.43", + "rustix 0.38.44", "semver", "serde", "serde_derive", @@ -7235,7 +7359,7 @@ dependencies = [ "directories-next", "log", "postcard", - "rustix 0.38.43", + "rustix 0.38.44", "serde", "serde_derive", "sha2", @@ -7253,7 +7377,7 @@ dependencies = [ "anyhow", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", "wasmtime-component-util", "wasmtime-wit-bindgen", "wit-parser", @@ -7300,7 +7424,7 @@ dependencies = [ "cranelift-bitset", "cranelift-entity", "gimli 0.28.1", - "indexmap 2.7.0", + "indexmap 2.9.0", "log", "object", "postcard", @@ -7325,7 +7449,7 @@ dependencies = [ "anyhow", "cc", "cfg-if", - "rustix 0.38.43", + "rustix 0.38.44", "wasmtime-asm-macros", "wasmtime-versioned-export-macros", "windows-sys 0.52.0", @@ -7339,7 +7463,7 @@ checksum = "2383b29fd973222293b5ff562f81a67c7e558b669685ca13f8cb80d04ea24b2d" dependencies = [ "object", "once_cell", - "rustix 0.38.43", + "rustix 0.38.44", "wasmtime-versioned-export-macros", ] @@ -7383,7 +7507,7 @@ checksum = "a2bde986038b819bc43a21fef0610aeb47aabfe3ea09ca3533a7b81023b84ec6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -7411,7 +7535,7 @@ checksum = "8f88e49a9b81746ec0cede5505e40a4012c92cb5054cd7ef4300dc57c36f26b1" dependencies = [ "anyhow", "heck 0.4.1", - "indexmap 2.7.0", + "indexmap 2.9.0", "wit-parser", ] @@ -7426,36 +7550,58 @@ dependencies = [ [[package]] name = "wast" -version = "227.0.1" +version = "233.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c14e5042b16c9d267da3b9b0f4529870455178415286312c25c34dfc1b2816" +checksum = "2eaf4099d8d0c922b83bf3c90663f5666f0769db9e525184284ebbbdb1dd2180" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width 0.2.0", - "wasm-encoder 0.227.1", + "wasm-encoder 0.233.0", ] [[package]] name = "wat" -version = "1.227.1" +version = "1.233.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d394d5bef7006ff63338d481ca10f1af76601e65ebdf5ed33d29302994e9cc" +checksum = "3d9bc80f5e4b25ea086ef41b91ccd244adde45d931c384d94a8ff64ab8bd7d87" dependencies = [ - "wast 227.0.1", + "wast 233.0.0", ] [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web_atoms" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57ffde1dc01240bdf9992e3205668b235e59421fd085e8a317ed98da0178d414" +dependencies = [ + "phf 0.11.3", + "phf_codegen 0.11.3", + "string_cache", + "string_cache_codegen", +] + [[package]] name = "webmention" version = "0.6.0" @@ -7492,11 +7638,11 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "webpki-roots" -version = "0.26.7" +version = "0.26.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" dependencies = [ - "rustls-pki-types", + "webpki-roots 1.0.0", ] [[package]] @@ -7517,14 +7663,14 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.43", + "rustix 0.38.44", ] [[package]] name = "whoami" -version = "1.5.2" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" +checksum = "6994d13118ab492c3c80c1f81928718159254c53c472bf9ce36f8dae4add02a7" dependencies = [ "redox_syscall", "wasite", @@ -7539,7 +7685,7 @@ checksum = "522bdb5756a42b3e01e9e3097f0d8a2a6b00ffdea50c6aa1a301497813c81cf8" dependencies = [ "anyhow", "async-trait", - "bitflags 2.8.0", + "bitflags 2.9.1", "thiserror 1.0.69", "tracing", "wasmtime", @@ -7558,7 +7704,7 @@ dependencies = [ "proc-macro2", "quote", "shellexpand", - "syn 2.0.96", + "syn 2.0.101", "witx", ] @@ -7570,7 +7716,7 @@ checksum = "f8f8feabe94ce6f07d62669d1acf469e0d3249f786562b4263dff3537a4e77ae" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", "wiggle-generate", ] @@ -7596,7 +7742,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -7624,81 +7770,104 @@ dependencies = [ [[package]] name = "windows" -version = "0.58.0" +version = "0.61.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +checksum = "c5ee8f3d025738cb02bad7868bbb5f8a6327501e870bf51f1b455b0a2454a419" dependencies = [ - "windows-core 0.58.0", - "windows-targets 0.52.6", + "windows-collections", + "windows-core", + "windows-future", + "windows-link", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core", ] [[package]] name = "windows-core" -version = "0.52.0" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-core" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", + "windows-link", "windows-result", "windows-strings", - "windows-targets 0.52.6", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", ] [[package]] name = "windows-implement" -version = "0.58.0" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] name = "windows-interface" -version = "0.58.0" +version = "0.59.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] name = "windows-link" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dccfd733ce2b1753b03b6d3c65edf020262ea35e20ccdf3e288043e6dd620e3" +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" + +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core", + "windows-link", +] [[package]] name = "windows-result" -version = "0.2.0" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-targets 0.52.6", + "windows-link", ] [[package]] name = "windows-strings" -version = "0.1.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-result", - "windows-targets 0.52.6", + "windows-link", ] [[package]] @@ -7752,13 +7921,38 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" +dependencies = [ + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -7771,6 +7965,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -7783,6 +7983,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -7795,12 +8001,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -7813,6 +8031,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -7825,6 +8049,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -7837,6 +8067,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -7850,10 +8086,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "winnow" -version = "0.7.3" +name = "windows_x86_64_msvc" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7f4ea97f6f78012141bcdb6a216b2609f0979ada50b20ca5b52dde2eac2bb1" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + +[[package]] +name = "winnow" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec" dependencies = [ "memchr", ] @@ -7874,17 +8116,17 @@ version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f3fd376f71958b862e7afb20cfe5a22830e1963462f3a17f49d82a6c1d1f42d" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", "windows-sys 0.59.0", ] [[package]] name = "wit-bindgen-rt" -version = "0.33.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.1", ] [[package]] @@ -7895,7 +8137,7 @@ checksum = "ceeb0424aa8679f3fcf2d6e3cfa381f3d6fa6179976a2c05a6249dd2bb426716" dependencies = [ "anyhow", "id-arena", - "indexmap 2.7.0", + "indexmap 2.9.0", "log", "semver", "serde", @@ -8004,69 +8246,48 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", "synstructure", ] [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" dependencies = [ - "byteorder", - "zerocopy-derive 0.7.35", -] - -[[package]] -name = "zerocopy" -version = "0.8.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa91407dacce3a68c56de03abe2760159582b846c6a4acd2f456618087f12713" -dependencies = [ - "zerocopy-derive 0.8.17", + "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06718a168365cad3d5ff0bb133aad346959a2074bd4a85c121255a11304a8626" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] name = "zerofrom" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", "synstructure", ] @@ -8087,7 +8308,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] @@ -8109,32 +8330,32 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.101", ] [[package]] name = "zstd" -version = "0.13.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "7.2.1" +version = "7.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" dependencies = [ "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.13+zstd.1.5.6" +version = "2.0.15+zstd.1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +checksum = "eb81183ddd97d0c74cedf1d50d85c8d08c1b8b68ee863bdee9e706eedba1a237" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index 45399697b..c1d9cf4e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,6 +51,7 @@ members = [ "crates/db_perf", "crates/db_schema", "crates/db_schema_file", + "crates/db_views/api_misc", "crates/db_views/private_message", "crates/db_views/local_user", "crates/db_views/local_image", @@ -113,32 +114,34 @@ lemmy_apub_objects = { version = "=1.0.0-alpha.5", path = "./crates/apub_objects lemmy_utils = { version = "=1.0.0-alpha.5", path = "./crates/utils", default-features = false } lemmy_db_schema = { version = "=1.0.0-alpha.5", path = "./crates/db_schema" } lemmy_db_schema_file = { version = "=1.0.0-alpha.5", path = "./crates/db_schema_file" } -lemmy_api_common = { version = "=1.0.0-alpha.5", path = "./crates/api_common" } +lemmy_api_utils = { version = "=1.0.0-alpha.5", path = "./crates/api_utils" } lemmy_routes = { version = "=1.0.0-alpha.5", path = "./crates/routes" } lemmy_federate = { version = "=1.0.0-alpha.5", path = "./crates/federate" } lemmy_email = { version = "=1.0.0-alpha.5", path = "./crates/email" } -lemmy_db_views_private_message = { version = "=1.0.0-alpha.5", path = "./crates/db_views/private_message" } -lemmy_db_views_registration_applications = { version = "=1.0.0-alpha.5", path = "./crates/db_views/registration_applications" } +lemmy_db_views_api_misc = { version = "=1.0.0-alpha.5", path = "./crates/db_views/api_misc" } lemmy_db_views_comment = { version = "=1.0.0-alpha.5", path = "./crates/db_views/comment" } -lemmy_db_views_local_user = { version = "=1.0.0-alpha.5", path = "./crates/db_views/local_user" } -lemmy_db_views_person = { version = "=1.0.0-alpha.5", path = "./crates/db_views/person" } -lemmy_db_views_custom_emoji = { version = "=1.0.0-alpha.5", path = "./crates/db_views/custom_emoji" } -lemmy_db_views_post = { version = "=1.0.0-alpha.5", path = "./crates/db_views/post" } -lemmy_db_views_vote = { version = "=1.0.0-alpha.5", path = "./crates/db_views/vote" } lemmy_db_views_community = { version = "=1.0.0-alpha.5", path = "./crates/db_views/community" } -lemmy_db_views_community_moderator = { version = "=1.0.0-alpha.5", path = "./crates/db_views/community_moderator" } lemmy_db_views_community_follower = { version = "=1.0.0-alpha.5", path = "./crates/db_views/community_follower" } +lemmy_db_views_community_moderator = { version = "=1.0.0-alpha.5", path = "./crates/db_views/community_moderator" } lemmy_db_views_community_person_ban = { version = "=1.0.0-alpha.5", path = "./crates/db_views/community_person_ban" } -lemmy_db_views_reports = { version = "=1.0.0-alpha.5", path = "./crates/db_views/reports" } -lemmy_db_views_local_image = { version = "=1.0.0-alpha.5", path = "./crates/db_views/local_image" } +lemmy_db_views_custom_emoji = { version = "=1.0.0-alpha.5", path = "./crates/db_views/custom_emoji" } lemmy_db_views_inbox_combined = { version = "=1.0.0-alpha.5", path = "./crates/db_views/inbox_combined" } +lemmy_db_views_local_image = { version = "=1.0.0-alpha.5", path = "./crates/db_views/local_image" } +lemmy_db_views_local_user = { version = "=1.0.0-alpha.5", path = "./crates/db_views/local_user" } lemmy_db_views_modlog_combined = { version = "=1.0.0-alpha.5", path = "./crates/db_views/modlog_combined" } +lemmy_db_views_person = { version = "=1.0.0-alpha.5", path = "./crates/db_views/person" } lemmy_db_views_person_content_combined = { version = "=1.0.0-alpha.5", path = "./crates/db_views/person_content_combined" } -lemmy_db_views_person_saved_combined = { version = "=1.0.0-alpha.5", path = "./crates/db_views/person_saved_combined" } lemmy_db_views_person_liked_combined = { version = "=1.0.0-alpha.5", path = "./crates/db_views/person_liked_combined" } +lemmy_db_views_person_saved_combined = { version = "=1.0.0-alpha.5", path = "./crates/db_views/person_saved_combined" } +lemmy_db_views_post = { version = "=1.0.0-alpha.5", path = "./crates/db_views/post" } +lemmy_db_views_private_message = { version = "=1.0.0-alpha.5", path = "./crates/db_views/private_message" } +lemmy_db_views_readable_federation_state = { version = "=1.0.0-alpha.5", path = "./crates/db_views/readable_federation_state" } +lemmy_db_views_registration_applications = { version = "=1.0.0-alpha.5", path = "./crates/db_views/registration_applications" } lemmy_db_views_report_combined = { version = "=1.0.0-alpha.5", path = "./crates/db_views/report_combined" } +lemmy_db_views_reports = { version = "=1.0.0-alpha.5", path = "./crates/db_views/reports" } lemmy_db_views_search_combined = { version = "=1.0.0-alpha.5", path = "./crates/db_views/search_combined" } lemmy_db_views_site = { version = "=1.0.0-alpha.5", path = "./crates/db_views/site" } +lemmy_db_views_vote = { version = "=1.0.0-alpha.5", path = "./crates/db_views/vote" } activitypub_federation = { version = "0.7.0-beta.1", default-features = false, features = [ "actix-web", ] } @@ -172,7 +175,7 @@ reqwest = { version = "0.12.18", default-features = false, features = [ "rustls-tls", ] } reqwest-middleware = "0.4.2" -reqwest-tracing = "0.5.5" +reqwest-tracing = "0.5.7" clokwerk = "0.4.0" doku = { version = "0.21.1", features = ["url-2"] } bcrypt = "0.17.0" @@ -225,7 +228,7 @@ lemmy_apub_objects = { workspace = true } lemmy_utils = { workspace = true } lemmy_db_schema = { workspace = true } lemmy_db_schema_file = { workspace = true } -lemmy_api_common = { workspace = true } +lemmy_api_utils = { workspace = true } lemmy_routes = { workspace = true } lemmy_federate = { workspace = true } activitypub_federation = { workspace = true } diff --git a/crates/api/Cargo.toml b/crates/api/Cargo.toml index 7dfb4fe19..2d7bd864c 100644 --- a/crates/api/Cargo.toml +++ b/crates/api/Cargo.toml @@ -19,6 +19,7 @@ doctest = false workspace = true [dependencies] +lemmy_db_views_api_misc = { workspace = true, features = ["full"] } lemmy_db_views_comment = { workspace = true, features = ["full"] } lemmy_db_views_community = { workspace = true, features = ["full"] } lemmy_db_views_community_moderator = { workspace = true, features = ["full"] } @@ -41,7 +42,7 @@ lemmy_db_views_registration_applications = { workspace = true, features = [ ] } lemmy_utils = { workspace = true } lemmy_db_schema = { workspace = true, features = ["full"] } -lemmy_api_common = { workspace = true, features = ["full"] } +lemmy_api_utils = { workspace = true, features = ["full"] } lemmy_db_schema_file = { workspace = true } lemmy_email = { workspace = true } activitypub_federation = { workspace = true } diff --git a/crates/api/src/comment/distinguish.rs b/crates/api/src/comment/distinguish.rs index 63430f433..186fa47e9 100644 --- a/crates/api/src/comment/distinguish.rs +++ b/crates/api/src/comment/distinguish.rs @@ -1,7 +1,6 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ - comment::{CommentResponse, DistinguishComment}, +use lemmy_api_utils::{ context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, utils::{check_community_mod_action, check_community_user_action}, @@ -10,7 +9,10 @@ use lemmy_db_schema::{ source::comment::{Comment, CommentUpdateForm}, traits::Crud, }; -use lemmy_db_views_comment::CommentView; +use lemmy_db_views_comment::{ + api::{CommentResponse, DistinguishComment}, + CommentView, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api/src/comment/like.rs b/crates/api/src/comment/like.rs index 28eccd21f..83ea54d53 100644 --- a/crates/api/src/comment/like.rs +++ b/crates/api/src/comment/like.rs @@ -1,8 +1,7 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::build_comment_response, - comment::{CommentResponse, CreateCommentLike}, context::LemmyContext, plugins::{plugin_hook_after, plugin_hook_before}, send_activity::{ActivityChannel, SendActivityData}, @@ -16,7 +15,10 @@ use lemmy_db_schema::{ }, traits::Likeable, }; -use lemmy_db_views_comment::CommentView; +use lemmy_db_views_comment::{ + api::{CommentResponse, CreateCommentLike}, + CommentView, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::SiteView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/comment/list_comment_likes.rs b/crates/api/src/comment/list_comment_likes.rs index 38b0c8d37..8947af710 100644 --- a/crates/api/src/comment/list_comment_likes.rs +++ b/crates/api/src/comment/list_comment_likes.rs @@ -1,10 +1,9 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ - comment::{ListCommentLikes, ListCommentLikesResponse}, - context::LemmyContext, - utils::is_mod_or_admin, +use lemmy_api_utils::{context::LemmyContext, utils::is_mod_or_admin}; +use lemmy_db_views_comment::{ + api::{ListCommentLikes, ListCommentLikesResponse}, + CommentView, }; -use lemmy_db_views_comment::CommentView; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_vote::VoteView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/comment/save.rs b/crates/api/src/comment/save.rs index 15e58f583..41782f85d 100644 --- a/crates/api/src/comment/save.rs +++ b/crates/api/src/comment/save.rs @@ -1,13 +1,13 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - comment::{CommentResponse, SaveComment}, - context::LemmyContext, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::comment::{CommentActions, CommentSavedForm}, traits::Saveable, }; -use lemmy_db_views_comment::CommentView; +use lemmy_db_views_comment::{ + api::{CommentResponse, SaveComment}, + CommentView, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/community/add_mod.rs b/crates/api/src/community/add_mod.rs index b8963d3fb..5bea6e3e7 100644 --- a/crates/api/src/community/add_mod.rs +++ b/crates/api/src/community/add_mod.rs @@ -1,8 +1,7 @@ use activitypub_federation::config::Data; use actix_web::web::Json; use diesel_async::scoped_futures::ScopedFutureExt; -use lemmy_api_common::{ - community::{AddModToCommunity, AddModToCommunityResponse}, +use lemmy_api_utils::{ context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, utils::check_community_mod_action, @@ -16,6 +15,7 @@ use lemmy_db_schema::{ traits::{Crud, Joinable}, utils::get_conn, }; +use lemmy_db_views_community::api::{AddModToCommunity, AddModToCommunityResponse}; use lemmy_db_views_community_moderator::CommunityModeratorView; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/community/ban.rs b/crates/api/src/community/ban.rs index 54cb12fb1..887e68e69 100644 --- a/crates/api/src/community/ban.rs +++ b/crates/api/src/community/ban.rs @@ -1,8 +1,7 @@ use activitypub_federation::config::Data; use actix_web::web::Json; use diesel_async::scoped_futures::ScopedFutureExt; -use lemmy_api_common::{ - community::{BanFromCommunity, BanFromCommunityResponse}, +use lemmy_api_utils::{ context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, utils::{ @@ -20,6 +19,7 @@ use lemmy_db_schema::{ traits::{Bannable, Crud, Followable}, utils::get_conn, }; +use lemmy_db_views_community::api::{BanFromCommunity, BanFromCommunityResponse}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_person::PersonView; use lemmy_utils::{error::LemmyResult, utils::validation::is_valid_body_field}; diff --git a/crates/api/src/community/block.rs b/crates/api/src/community/block.rs index b19865fc2..60ccd5837 100644 --- a/crates/api/src/community/block.rs +++ b/crates/api/src/community/block.rs @@ -1,8 +1,7 @@ use activitypub_federation::config::Data; use actix_web::web::Json; use diesel_async::scoped_futures::ScopedFutureExt; -use lemmy_api_common::{ - community::{BlockCommunity, BlockCommunityResponse}, +use lemmy_api_utils::{ context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, }; @@ -11,7 +10,10 @@ use lemmy_db_schema::{ traits::{Blockable, Followable}, utils::get_conn, }; -use lemmy_db_views_community::CommunityView; +use lemmy_db_views_community::{ + api::{BlockCommunity, BlockCommunityResponse}, + CommunityView, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/community/follow.rs b/crates/api/src/community/follow.rs index dc1a0e3d5..bc4e2e07b 100644 --- a/crates/api/src/community/follow.rs +++ b/crates/api/src/community/follow.rs @@ -1,7 +1,6 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ - community::{CommunityResponse, FollowCommunity}, +use lemmy_api_utils::{ context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, utils::{check_community_deleted_removed, check_local_user_valid}, @@ -14,7 +13,10 @@ use lemmy_db_schema::{ traits::{Crud, Followable}, }; use lemmy_db_schema_file::enums::{CommunityFollowerState, CommunityVisibility}; -use lemmy_db_views_community::CommunityView; +use lemmy_db_views_community::{ + api::{CommunityResponse, FollowCommunity}, + CommunityView, +}; use lemmy_db_views_community_person_ban::CommunityPersonBanView; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/community/pending_follows/approve.rs b/crates/api/src/community/pending_follows/approve.rs index ef27a9f4d..9dcb19dc4 100644 --- a/crates/api/src/community/pending_follows/approve.rs +++ b/crates/api/src/community/pending_follows/approve.rs @@ -1,13 +1,13 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ - community::ApproveCommunityPendingFollower, +use lemmy_api_utils::{ context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, utils::is_mod_or_admin, - SuccessResponse, }; use lemmy_db_schema::{source::community::CommunityActions, traits::Followable}; +use lemmy_db_views_api_misc::SuccessResponse; +use lemmy_db_views_community::api::ApproveCommunityPendingFollower; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/community/pending_follows/count.rs b/crates/api/src/community/pending_follows/count.rs index 7be736c2f..65ef8b00a 100644 --- a/crates/api/src/community/pending_follows/count.rs +++ b/crates/api/src/community/pending_follows/count.rs @@ -1,10 +1,9 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ - community::{GetCommunityPendingFollowsCount, GetCommunityPendingFollowsCountResponse}, - context::LemmyContext, - utils::is_mod_or_admin, +use lemmy_api_utils::{context::LemmyContext, utils::is_mod_or_admin}; +use lemmy_db_views_community_follower::{ + api::{GetCommunityPendingFollowsCount, GetCommunityPendingFollowsCountResponse}, + CommunityFollowerView, }; -use lemmy_db_views_community_follower::CommunityFollowerView; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/community/pending_follows/list.rs b/crates/api/src/community/pending_follows/list.rs index b79bd189a..bd4644b20 100644 --- a/crates/api/src/community/pending_follows/list.rs +++ b/crates/api/src/community/pending_follows/list.rs @@ -1,11 +1,11 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ - community::{ListCommunityPendingFollows, ListCommunityPendingFollowsResponse}, - context::LemmyContext, - utils::check_community_mod_of_any_or_admin_action, -}; +use lemmy_api_utils::{context::LemmyContext, utils::check_community_mod_of_any_or_admin_action}; use lemmy_db_schema::traits::PaginationCursorBuilder; -use lemmy_db_views_community_follower::{CommunityFollowerView, PendingFollow}; +use lemmy_db_views_community_follower::{ + api::{ListCommunityPendingFollows, ListCommunityPendingFollowsResponse}, + CommunityFollowerView, + PendingFollow, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/community/random.rs b/crates/api/src/community/random.rs index 7ad27e22c..abe69e229 100644 --- a/crates/api/src/community/random.rs +++ b/crates/api/src/community/random.rs @@ -1,12 +1,14 @@ use activitypub_federation::config::Data; use actix_web::web::{Json, Query}; -use lemmy_api_common::{ - community::{CommunityResponse, GetRandomCommunity}, +use lemmy_api_utils::{ context::LemmyContext, utils::{check_private_instance, is_mod_or_admin_opt}, }; use lemmy_db_schema::source::{actor_language::CommunityLanguage, community::Community}; -use lemmy_db_views_community::CommunityView; +use lemmy_db_views_community::{ + api::{CommunityResponse, GetRandomCommunity}, + CommunityView, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::SiteView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/community/tag.rs b/crates/api/src/community/tag.rs index b194b3c05..d33aeeab3 100644 --- a/crates/api/src/community/tag.rs +++ b/crates/api/src/community/tag.rs @@ -1,11 +1,7 @@ use activitypub_federation::config::Data; use actix_web::web::Json; use chrono::Utc; -use lemmy_api_common::{ - community::{CreateCommunityTag, DeleteCommunityTag, UpdateCommunityTag}, - context::LemmyContext, - utils::check_community_mod_action, -}; +use lemmy_api_utils::{context::LemmyContext, utils::check_community_mod_action}; use lemmy_db_schema::{ source::{ community::Community, @@ -13,6 +9,7 @@ use lemmy_db_schema::{ }, traits::Crud, }; +use lemmy_db_views_community::api::{CreateCommunityTag, DeleteCommunityTag, UpdateCommunityTag}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::{error::LemmyResult, utils::validation::tag_name_length_check}; diff --git a/crates/api/src/community/transfer.rs b/crates/api/src/community/transfer.rs index 2b1788f19..ad3a9ec82 100644 --- a/crates/api/src/community/transfer.rs +++ b/crates/api/src/community/transfer.rs @@ -1,8 +1,7 @@ use actix_web::web::{Data, Json}; use anyhow::Context; use diesel_async::scoped_futures::ScopedFutureExt; -use lemmy_api_common::{ - community::{GetCommunityResponse, TransferCommunity}, +use lemmy_api_utils::{ context::LemmyContext, utils::{check_community_user_action, is_admin, is_top_mod}, }; @@ -14,7 +13,10 @@ use lemmy_db_schema::{ traits::{Crud, Joinable}, utils::get_conn, }; -use lemmy_db_views_community::CommunityView; +use lemmy_db_views_community::{ + api::{GetCommunityResponse, TransferCommunity}, + CommunityView, +}; use lemmy_db_views_community_moderator::CommunityModeratorView; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::{ @@ -22,7 +24,7 @@ use lemmy_utils::{ location_info, }; -// TODO: we dont do anything for federation here, it should be updated the next time the community +// TODO: we don't do anything for federation here, it should be updated the next time the community // gets fetched. i hope we can get rid of the community creator role soon. pub async fn transfer_community( diff --git a/crates/api/src/local_user/add_admin.rs b/crates/api/src/local_user/add_admin.rs index 8b7b80c47..fbd886e66 100644 --- a/crates/api/src/local_user/add_admin.rs +++ b/crates/api/src/local_user/add_admin.rs @@ -1,9 +1,5 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - person::{AddAdmin, AddAdminResponse}, - utils::is_admin, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::{ source::{ local_user::{LocalUser, LocalUserUpdateForm}, @@ -12,7 +8,10 @@ use lemmy_db_schema::{ traits::Crud, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_person::impls::PersonQuery; +use lemmy_db_views_person::{ + api::{AddAdmin, AddAdminResponse}, + impls::PersonQuery, +}; use lemmy_utils::error::LemmyResult; pub async fn add_admin( diff --git a/crates/api/src/local_user/ban_person.rs b/crates/api/src/local_user/ban_person.rs index f3dc3cb26..53daee474 100644 --- a/crates/api/src/local_user/ban_person.rs +++ b/crates/api/src/local_user/ban_person.rs @@ -1,8 +1,7 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - person::{BanPerson, BanPersonResponse}, send_activity::{ActivityChannel, SendActivityData}, utils::{check_expire_time, is_admin, remove_or_restore_user_data}, }; @@ -15,7 +14,10 @@ use lemmy_db_schema::{ traits::{Bannable, Crud}, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_person::PersonView; +use lemmy_db_views_person::{ + api::{BanPerson, BanPersonResponse}, + PersonView, +}; use lemmy_utils::{error::LemmyResult, utils::validation::is_valid_body_field}; pub async fn ban_from_site( diff --git a/crates/api/src/local_user/block.rs b/crates/api/src/local_user/block.rs index a496b53e1..bdd72f193 100644 --- a/crates/api/src/local_user/block.rs +++ b/crates/api/src/local_user/block.rs @@ -1,14 +1,14 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - person::{BlockPerson, BlockPersonResponse}, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::person::{PersonActions, PersonBlockForm}, traits::Blockable, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_person::PersonView; +use lemmy_db_views_person::{ + api::{BlockPerson, BlockPersonResponse}, + PersonView, +}; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; pub async fn user_block_person( diff --git a/crates/api/src/local_user/change_password.rs b/crates/api/src/local_user/change_password.rs index 47fd5be56..75dba5c45 100644 --- a/crates/api/src/local_user/change_password.rs +++ b/crates/api/src/local_user/change_password.rs @@ -3,13 +3,9 @@ use actix_web::{ HttpRequest, }; use bcrypt::verify; -use lemmy_api_common::{ - claims::Claims, - context::LemmyContext, - person::{ChangePassword, LoginResponse}, - utils::password_length_check, -}; +use lemmy_api_utils::{claims::Claims, context::LemmyContext, utils::password_length_check}; use lemmy_db_schema::source::{local_user::LocalUser, login_token::LoginToken}; +use lemmy_db_views_api_misc::{ChangePassword, LoginResponse}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api/src/local_user/change_password_after_reset.rs b/crates/api/src/local_user/change_password_after_reset.rs index 5524da33b..0ab190399 100644 --- a/crates/api/src/local_user/change_password_after_reset.rs +++ b/crates/api/src/local_user/change_password_after_reset.rs @@ -1,15 +1,11 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - person::PasswordChangeAfterReset, - utils::password_length_check, - SuccessResponse, -}; +use lemmy_api_utils::{context::LemmyContext, utils::password_length_check}; use lemmy_db_schema::source::{ local_user::LocalUser, login_token::LoginToken, password_reset_request::PasswordResetRequest, }; +use lemmy_db_views_api_misc::{PasswordChangeAfterReset, SuccessResponse}; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; pub async fn change_password_after_reset( diff --git a/crates/api/src/local_user/donation_dialog_shown.rs b/crates/api/src/local_user/donation_dialog_shown.rs index 0634e6570..0688338a0 100644 --- a/crates/api/src/local_user/donation_dialog_shown.rs +++ b/crates/api/src/local_user/donation_dialog_shown.rs @@ -1,7 +1,8 @@ use actix_web::web::{Data, Json}; use chrono::Utc; -use lemmy_api_common::{context::LemmyContext, SuccessResponse}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::source::local_user::{LocalUser, LocalUserUpdateForm}; +use lemmy_db_views_api_misc::SuccessResponse; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/local_user/generate_totp_secret.rs b/crates/api/src/local_user/generate_totp_secret.rs index 454214546..1ec381a65 100644 --- a/crates/api/src/local_user/generate_totp_secret.rs +++ b/crates/api/src/local_user/generate_totp_secret.rs @@ -1,11 +1,12 @@ use crate::{build_totp_2fa, generate_totp_2fa_secret}; use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{context::LemmyContext, person::GenerateTotpSecretResponse}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::source::{ local_user::{LocalUser, LocalUserUpdateForm}, site::Site, }; +use lemmy_db_views_api_misc::GenerateTotpSecretResponse; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api/src/local_user/get_captcha.rs b/crates/api/src/local_user/get_captcha.rs index eb6369b29..42e0d21a0 100644 --- a/crates/api/src/local_user/get_captcha.rs +++ b/crates/api/src/local_user/get_captcha.rs @@ -9,14 +9,11 @@ use actix_web::{ HttpResponseBuilder, }; use captcha::{generate, Difficulty}; -use lemmy_api_common::{ - context::LemmyContext, - person::{CaptchaResponse, GetCaptchaResponse}, - LemmyErrorType, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::source::captcha_answer::{CaptchaAnswer, CaptchaAnswerForm}; +use lemmy_db_views_api_misc::{CaptchaResponse, GetCaptchaResponse}; use lemmy_db_views_site::SiteView; -use lemmy_utils::error::LemmyResult; +use lemmy_utils::error::{LemmyErrorType, LemmyResult}; pub async fn get_captcha(context: Data) -> LemmyResult { let local_site = SiteView::read_local(&mut context.pool()).await?.local_site; diff --git a/crates/api/src/local_user/list_hidden.rs b/crates/api/src/local_user/list_hidden.rs index 0312de8e7..4e1768602 100644 --- a/crates/api/src/local_user/list_hidden.rs +++ b/crates/api/src/local_user/list_hidden.rs @@ -1,10 +1,8 @@ use activitypub_federation::config::Data; use actix_web::web::{Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - person::{ListPersonHidden, ListPersonHiddenResponse}, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::source::post::PostActions; +use lemmy_db_views_api_misc::{ListPersonHidden, ListPersonHiddenResponse}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_post::PostView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/local_user/list_liked.rs b/crates/api/src/local_user/list_liked.rs index 10a7fdee4..ae4664677 100644 --- a/crates/api/src/local_user/list_liked.rs +++ b/crates/api/src/local_user/list_liked.rs @@ -1,6 +1,6 @@ use activitypub_federation::config::Data; use actix_web::web::{Json, Query}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::traits::PaginationCursorBuilder; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_person_liked_combined::{ diff --git a/crates/api/src/local_user/list_logins.rs b/crates/api/src/local_user/list_logins.rs index b505850c3..9ba4af653 100644 --- a/crates/api/src/local_user/list_logins.rs +++ b/crates/api/src/local_user/list_logins.rs @@ -1,6 +1,7 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{context::LemmyContext, person::ListLoginsResponse}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::source::login_token::LoginToken; +use lemmy_db_views_api_misc::ListLoginsResponse; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/local_user/list_media.rs b/crates/api/src/local_user/list_media.rs index a537f538a..3cd2f9634 100644 --- a/crates/api/src/local_user/list_media.rs +++ b/crates/api/src/local_user/list_media.rs @@ -1,10 +1,10 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - person::{ListMedia, ListMediaResponse}, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::traits::PaginationCursorBuilder; -use lemmy_db_views_local_image::LocalImageView; +use lemmy_db_views_local_image::{ + api::{ListMedia, ListMediaResponse}, + LocalImageView, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/local_user/list_read.rs b/crates/api/src/local_user/list_read.rs index b6513a8a5..a69b930df 100644 --- a/crates/api/src/local_user/list_read.rs +++ b/crates/api/src/local_user/list_read.rs @@ -1,10 +1,8 @@ use activitypub_federation::config::Data; use actix_web::web::{Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - person::{ListPersonRead, ListPersonReadResponse}, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::source::post::PostActions; +use lemmy_db_views_api_misc::{ListPersonRead, ListPersonReadResponse}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_post::PostView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/local_user/list_saved.rs b/crates/api/src/local_user/list_saved.rs index d340a2259..0273169f4 100644 --- a/crates/api/src/local_user/list_saved.rs +++ b/crates/api/src/local_user/list_saved.rs @@ -1,6 +1,6 @@ use activitypub_federation::config::Data; use actix_web::web::{Json, Query}; -use lemmy_api_common::{context::LemmyContext, utils::check_private_instance}; +use lemmy_api_utils::{context::LemmyContext, utils::check_private_instance}; use lemmy_db_schema::traits::PaginationCursorBuilder; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_person_saved_combined::{ diff --git a/crates/api/src/local_user/login.rs b/crates/api/src/local_user/login.rs index 5f87d0fbc..4a8d6218c 100644 --- a/crates/api/src/local_user/login.rs +++ b/crates/api/src/local_user/login.rs @@ -4,12 +4,12 @@ use actix_web::{ HttpRequest, }; use bcrypt::verify; -use lemmy_api_common::{ +use lemmy_api_utils::{ claims::Claims, context::LemmyContext, - person::{Login, LoginResponse}, utils::{check_email_verified, check_local_user_deleted, check_registration_application}, }; +use lemmy_db_views_api_misc::{Login, LoginResponse}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::SiteView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api/src/local_user/logout.rs b/crates/api/src/local_user/logout.rs index 8ad3b4034..27936f491 100644 --- a/crates/api/src/local_user/logout.rs +++ b/crates/api/src/local_user/logout.rs @@ -1,11 +1,11 @@ use activitypub_federation::config::Data; use actix_web::{cookie::Cookie, HttpRequest, HttpResponse}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, utils::{read_auth_token, AUTH_COOKIE_NAME}, - SuccessResponse, }; use lemmy_db_schema::source::login_token::LoginToken; +use lemmy_db_views_api_misc::SuccessResponse; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api/src/local_user/notifications/list_inbox.rs b/crates/api/src/local_user/notifications/list_inbox.rs index a72dd8c33..841a3680b 100644 --- a/crates/api/src/local_user/notifications/list_inbox.rs +++ b/crates/api/src/local_user/notifications/list_inbox.rs @@ -1,5 +1,5 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::traits::PaginationCursorBuilder; use lemmy_db_views_inbox_combined::{ impls::InboxCombinedQuery, diff --git a/crates/api/src/local_user/notifications/mark_all_read.rs b/crates/api/src/local_user/notifications/mark_all_read.rs index 106c8524c..86de7562f 100644 --- a/crates/api/src/local_user/notifications/mark_all_read.rs +++ b/crates/api/src/local_user/notifications/mark_all_read.rs @@ -1,11 +1,12 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{context::LemmyContext, SuccessResponse}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::source::{ comment_reply::CommentReply, person_comment_mention::PersonCommentMention, person_post_mention::PersonPostMention, private_message::PrivateMessage, }; +use lemmy_db_views_api_misc::SuccessResponse; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/local_user/notifications/mark_comment_mention_read.rs b/crates/api/src/local_user/notifications/mark_comment_mention_read.rs index 97aa2519c..1bbef99ae 100644 --- a/crates/api/src/local_user/notifications/mark_comment_mention_read.rs +++ b/crates/api/src/local_user/notifications/mark_comment_mention_read.rs @@ -1,13 +1,11 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - person::MarkPersonCommentMentionAsRead, - SuccessResponse, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::person_comment_mention::{PersonCommentMention, PersonCommentMentionUpdateForm}, traits::Crud, }; +use lemmy_db_views_api_misc::SuccessResponse; +use lemmy_db_views_inbox_combined::api::MarkPersonCommentMentionAsRead; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api/src/local_user/notifications/mark_post_mention_read.rs b/crates/api/src/local_user/notifications/mark_post_mention_read.rs index 668126b63..810c78868 100644 --- a/crates/api/src/local_user/notifications/mark_post_mention_read.rs +++ b/crates/api/src/local_user/notifications/mark_post_mention_read.rs @@ -1,13 +1,11 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - person::MarkPersonPostMentionAsRead, - SuccessResponse, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::person_post_mention::{PersonPostMention, PersonPostMentionUpdateForm}, traits::Crud, }; +use lemmy_db_views_api_misc::SuccessResponse; +use lemmy_db_views_inbox_combined::api::MarkPersonPostMentionAsRead; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api/src/local_user/notifications/mark_reply_read.rs b/crates/api/src/local_user/notifications/mark_reply_read.rs index a1bb44049..a313eb96c 100644 --- a/crates/api/src/local_user/notifications/mark_reply_read.rs +++ b/crates/api/src/local_user/notifications/mark_reply_read.rs @@ -1,9 +1,11 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{context::LemmyContext, person::MarkCommentReplyAsRead, SuccessResponse}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::comment_reply::{CommentReply, CommentReplyUpdateForm}, traits::Crud, }; +use lemmy_db_views_api_misc::SuccessResponse; +use lemmy_db_views_inbox_combined::api::MarkCommentReplyAsRead; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api/src/local_user/notifications/unread_count.rs b/crates/api/src/local_user/notifications/unread_count.rs index 4c60ae826..6877f8406 100644 --- a/crates/api/src/local_user/notifications/unread_count.rs +++ b/crates/api/src/local_user/notifications/unread_count.rs @@ -1,6 +1,6 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{context::LemmyContext, person::GetUnreadCountResponse}; -use lemmy_db_views_inbox_combined::InboxCombinedViewInternal; +use lemmy_api_utils::context::LemmyContext; +use lemmy_db_views_inbox_combined::{api::GetUnreadCountResponse, InboxCombinedViewInternal}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/local_user/report_count.rs b/crates/api/src/local_user/report_count.rs index d9d9da704..1e1d21076 100644 --- a/crates/api/src/local_user/report_count.rs +++ b/crates/api/src/local_user/report_count.rs @@ -1,11 +1,8 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - person::{GetReportCount, GetReportCountResponse}, - utils::check_community_mod_of_any_or_admin_action, -}; +use lemmy_api_utils::{context::LemmyContext, utils::check_community_mod_of_any_or_admin_action}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_report_combined::ReportCombinedViewInternal; +use lemmy_db_views_reports::api::{GetReportCount, GetReportCountResponse}; use lemmy_utils::error::LemmyResult; pub async fn report_count( diff --git a/crates/api/src/local_user/resend_verification_email.rs b/crates/api/src/local_user/resend_verification_email.rs index 7b6c66237..8d8f96f94 100644 --- a/crates/api/src/local_user/resend_verification_email.rs +++ b/crates/api/src/local_user/resend_verification_email.rs @@ -1,5 +1,6 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{context::LemmyContext, person::ResendVerificationEmail, SuccessResponse}; +use lemmy_api_utils::context::LemmyContext; +use lemmy_db_views_api_misc::{ResendVerificationEmail, SuccessResponse}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::SiteView; use lemmy_email::account::send_verification_email_if_required; diff --git a/crates/api/src/local_user/reset_password.rs b/crates/api/src/local_user/reset_password.rs index b8e9d85dd..88f440a63 100644 --- a/crates/api/src/local_user/reset_password.rs +++ b/crates/api/src/local_user/reset_password.rs @@ -1,10 +1,6 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - person::PasswordReset, - utils::check_email_verified, - SuccessResponse, -}; +use lemmy_api_utils::{context::LemmyContext, utils::check_email_verified}; +use lemmy_db_views_api_misc::{PasswordReset, SuccessResponse}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::SiteView; use lemmy_email::account::send_password_reset_email; diff --git a/crates/api/src/local_user/save_settings.rs b/crates/api/src/local_user/save_settings.rs index e6a6c016b..7f8800d51 100644 --- a/crates/api/src/local_user/save_settings.rs +++ b/crates/api/src/local_user/save_settings.rs @@ -1,10 +1,8 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - person::SaveUserSettings, utils::{get_url_blocklist, process_markdown_opt, slur_regex}, - SuccessResponse, }; use lemmy_db_schema::{ source::{ @@ -16,6 +14,7 @@ use lemmy_db_schema::{ traits::Crud, utils::{diesel_opt_number_update, diesel_string_update}, }; +use lemmy_db_views_api_misc::{SaveUserSettings, SuccessResponse}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::SiteView; use lemmy_email::account::send_verification_email; diff --git a/crates/api/src/local_user/update_totp.rs b/crates/api/src/local_user/update_totp.rs index a02fd6b6f..a2f0e7d24 100644 --- a/crates/api/src/local_user/update_totp.rs +++ b/crates/api/src/local_user/update_totp.rs @@ -1,10 +1,8 @@ use crate::check_totp_2fa_valid; use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - person::{UpdateTotp, UpdateTotpResponse}, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::source::local_user::{LocalUser, LocalUserUpdateForm}; +use lemmy_db_views_api_misc::{UpdateTotp, UpdateTotpResponse}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/local_user/user_block_instance.rs b/crates/api/src/local_user/user_block_instance.rs index 9029b6aa4..93b905c96 100644 --- a/crates/api/src/local_user/user_block_instance.rs +++ b/crates/api/src/local_user/user_block_instance.rs @@ -1,10 +1,11 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{context::LemmyContext, site::UserBlockInstanceParams, SuccessResponse}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::instance::{InstanceActions, InstanceBlockForm}, traits::Blockable, }; +use lemmy_db_views_api_misc::{SuccessResponse, UserBlockInstanceParams}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api/src/local_user/validate_auth.rs b/crates/api/src/local_user/validate_auth.rs index 0467c5d9b..c2fc043c2 100644 --- a/crates/api/src/local_user/validate_auth.rs +++ b/crates/api/src/local_user/validate_auth.rs @@ -2,11 +2,11 @@ use actix_web::{ web::{Data, Json}, HttpRequest, }; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, utils::{local_user_view_from_jwt, read_auth_token}, - SuccessResponse, }; +use lemmy_db_views_api_misc::SuccessResponse; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; /// Returns an error message if the auth token is invalid for any reason. Necessary because other diff --git a/crates/api/src/local_user/verify_email.rs b/crates/api/src/local_user/verify_email.rs index e7c74cd88..b72973077 100644 --- a/crates/api/src/local_user/verify_email.rs +++ b/crates/api/src/local_user/verify_email.rs @@ -1,9 +1,10 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{context::LemmyContext, person::VerifyEmail, SuccessResponse}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::source::{ email_verification::EmailVerification, local_user::{LocalUser, LocalUserUpdateForm}, }; +use lemmy_db_views_api_misc::{SuccessResponse, VerifyEmail}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::SiteView; use lemmy_email::{account::send_email_verified_email, admin::send_new_applicant_email_to_admins}; diff --git a/crates/api/src/post/feature.rs b/crates/api/src/post/feature.rs index 80b823264..55ee1d035 100644 --- a/crates/api/src/post/feature.rs +++ b/crates/api/src/post/feature.rs @@ -1,9 +1,8 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::build_post_response, context::LemmyContext, - post::{FeaturePost, PostResponse}, send_activity::{ActivityChannel, SendActivityData}, utils::{check_community_mod_action, is_admin}, }; @@ -17,6 +16,7 @@ use lemmy_db_schema::{ PostFeatureType, }; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_post::api::{FeaturePost, PostResponse}; use lemmy_utils::error::LemmyResult; pub async fn feature_post( diff --git a/crates/api/src/post/get_link_metadata.rs b/crates/api/src/post/get_link_metadata.rs index 8a6339385..d532007e7 100644 --- a/crates/api/src/post/get_link_metadata.rs +++ b/crates/api/src/post/get_link_metadata.rs @@ -1,10 +1,7 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - post::{GetSiteMetadata, GetSiteMetadataResponse}, - request::fetch_link_metadata, -}; +use lemmy_api_utils::{context::LemmyContext, request::fetch_link_metadata}; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_post::api::{GetSiteMetadata, GetSiteMetadataResponse}; use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult}; use url::Url; diff --git a/crates/api/src/post/hide.rs b/crates/api/src/post/hide.rs index 3e55dde0b..1239b973f 100644 --- a/crates/api/src/post/hide.rs +++ b/crates/api/src/post/hide.rs @@ -1,14 +1,14 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - post::{HidePost, PostResponse}, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::post::{PostActions, PostHideForm}, traits::Hideable, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_post::PostView; +use lemmy_db_views_post::{ + api::{HidePost, PostResponse}, + PostView, +}; use lemmy_utils::error::LemmyResult; pub async fn hide_post( diff --git a/crates/api/src/post/like.rs b/crates/api/src/post/like.rs index 87c9328d9..de7108ee9 100644 --- a/crates/api/src/post/like.rs +++ b/crates/api/src/post/like.rs @@ -1,10 +1,9 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::build_post_response, context::LemmyContext, plugins::{plugin_hook_after, plugin_hook_before}, - post::{CreatePostLike, PostResponse}, send_activity::{ActivityChannel, SendActivityData}, utils::{check_bot_account, check_community_user_action, check_local_vote_mode}, }; @@ -14,7 +13,10 @@ use lemmy_db_schema::{ traits::{Likeable, Readable}, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_post::PostView; +use lemmy_db_views_post::{ + api::{CreatePostLike, PostResponse}, + PostView, +}; use lemmy_db_views_site::SiteView; use lemmy_utils::error::LemmyResult; use std::ops::Deref; diff --git a/crates/api/src/post/list_post_likes.rs b/crates/api/src/post/list_post_likes.rs index 9ee5c7508..7aac7b439 100644 --- a/crates/api/src/post/list_post_likes.rs +++ b/crates/api/src/post/list_post_likes.rs @@ -1,11 +1,8 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - post::{ListPostLikes, ListPostLikesResponse}, - utils::is_mod_or_admin, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_mod_or_admin}; use lemmy_db_schema::{source::post::Post, traits::Crud}; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_post::api::{ListPostLikes, ListPostLikesResponse}; use lemmy_db_views_vote::VoteView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/post/lock.rs b/crates/api/src/post/lock.rs index d424fdb35..5eb767cf9 100644 --- a/crates/api/src/post/lock.rs +++ b/crates/api/src/post/lock.rs @@ -1,9 +1,8 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::build_post_response, context::LemmyContext, - post::{LockPost, PostResponse}, send_activity::{ActivityChannel, SendActivityData}, utils::check_community_mod_action, }; @@ -15,7 +14,10 @@ use lemmy_db_schema::{ traits::Crud, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_post::PostView; +use lemmy_db_views_post::{ + api::{LockPost, PostResponse}, + PostView, +}; use lemmy_utils::error::LemmyResult; pub async fn lock_post( diff --git a/crates/api/src/post/mark_many_read.rs b/crates/api/src/post/mark_many_read.rs index c0fd4da8c..009c39f69 100644 --- a/crates/api/src/post/mark_many_read.rs +++ b/crates/api/src/post/mark_many_read.rs @@ -1,7 +1,9 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{context::LemmyContext, post::MarkManyPostsAsRead, SuccessResponse}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{source::post::PostActions, traits::Readable}; +use lemmy_db_views_api_misc::SuccessResponse; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_post::api::MarkManyPostsAsRead; use lemmy_utils::error::{LemmyErrorType, LemmyResult, MAX_API_PARAM_ELEMENTS}; pub async fn mark_posts_as_read( diff --git a/crates/api/src/post/mark_read.rs b/crates/api/src/post/mark_read.rs index 0b64c6e90..5d96e797e 100644 --- a/crates/api/src/post/mark_read.rs +++ b/crates/api/src/post/mark_read.rs @@ -1,14 +1,14 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - post::{MarkPostAsRead, PostResponse}, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::post::{PostActions, PostReadForm}, traits::Readable, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_post::PostView; +use lemmy_db_views_post::{ + api::{MarkPostAsRead, PostResponse}, + PostView, +}; use lemmy_utils::error::LemmyResult; pub async fn mark_post_as_read( diff --git a/crates/api/src/post/save.rs b/crates/api/src/post/save.rs index 8f78af951..7ac6bdd4b 100644 --- a/crates/api/src/post/save.rs +++ b/crates/api/src/post/save.rs @@ -1,14 +1,14 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - post::{PostResponse, SavePost}, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::post::{PostActions, PostReadForm, PostSavedForm}, traits::{Readable, Saveable}, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_post::PostView; +use lemmy_db_views_post::{ + api::{PostResponse, SavePost}, + PostView, +}; use lemmy_utils::error::LemmyResult; pub async fn save_post( diff --git a/crates/api/src/private_message/mark_read.rs b/crates/api/src/private_message/mark_read.rs index 17636fe4f..6aa509560 100644 --- a/crates/api/src/private_message/mark_read.rs +++ b/crates/api/src/private_message/mark_read.rs @@ -1,13 +1,11 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - private_message::MarkPrivateMessageAsRead, - SuccessResponse, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::private_message::{PrivateMessage, PrivateMessageUpdateForm}, traits::Crud, }; +use lemmy_db_views_api_misc::SuccessResponse; +use lemmy_db_views_inbox_combined::api::MarkPrivateMessageAsRead; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api/src/reports/comment_report/create.rs b/crates/api/src/reports/comment_report/create.rs index acf827c26..ad2a84828 100644 --- a/crates/api/src/reports/comment_report/create.rs +++ b/crates/api/src/reports/comment_report/create.rs @@ -2,9 +2,8 @@ use crate::check_report_reason; use activitypub_federation::config::Data; use actix_web::web::Json; use either::Either; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - reports::comment::{CommentReportResponse, CreateCommentReport}, send_activity::{ActivityChannel, SendActivityData}, utils::{check_comment_deleted_or_removed, check_community_user_action, slur_regex}, }; @@ -14,7 +13,10 @@ use lemmy_db_schema::{ }; use lemmy_db_views_comment::CommentView; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_reports::CommentReportView; +use lemmy_db_views_reports::{ + api::{CommentReportResponse, CreateCommentReport}, + CommentReportView, +}; use lemmy_db_views_site::SiteView; use lemmy_email::admin::send_new_report_email_to_admins; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/reports/comment_report/resolve.rs b/crates/api/src/reports/comment_report/resolve.rs index 459fadda9..c6ec97230 100644 --- a/crates/api/src/reports/comment_report/resolve.rs +++ b/crates/api/src/reports/comment_report/resolve.rs @@ -1,15 +1,17 @@ use activitypub_federation::config::Data; use actix_web::web::Json; use either::Either; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - reports::comment::{CommentReportResponse, ResolveCommentReport}, send_activity::{ActivityChannel, SendActivityData}, utils::check_community_mod_action, }; use lemmy_db_schema::{source::comment_report::CommentReport, traits::Reportable}; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_reports::CommentReportView; +use lemmy_db_views_reports::{ + api::{CommentReportResponse, ResolveCommentReport}, + CommentReportView, +}; use lemmy_utils::error::LemmyResult; /// Resolves or unresolves a comment report and notifies the moderators of the community diff --git a/crates/api/src/reports/community_report/create.rs b/crates/api/src/reports/community_report/create.rs index a206407f5..860709153 100644 --- a/crates/api/src/reports/community_report/create.rs +++ b/crates/api/src/reports/community_report/create.rs @@ -2,9 +2,8 @@ use crate::check_report_reason; use activitypub_federation::config::Data; use actix_web::web::Json; use either::Either; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - reports::community::{CommunityReportResponse, CreateCommunityReport}, send_activity::{ActivityChannel, SendActivityData}, utils::slur_regex, }; @@ -17,7 +16,10 @@ use lemmy_db_schema::{ traits::{Crud, Reportable}, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_reports::CommunityReportView; +use lemmy_db_views_reports::{ + api::{CommunityReportResponse, CreateCommunityReport}, + CommunityReportView, +}; use lemmy_db_views_site::SiteView; use lemmy_email::admin::send_new_report_email_to_admins; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/reports/community_report/resolve.rs b/crates/api/src/reports/community_report/resolve.rs index 3bee1a901..e46719d57 100644 --- a/crates/api/src/reports/community_report/resolve.rs +++ b/crates/api/src/reports/community_report/resolve.rs @@ -1,9 +1,8 @@ use activitypub_federation::config::Data; use actix_web::web::Json; use either::Either; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - reports::community::{CommunityReportResponse, ResolveCommunityReport}, send_activity::{ActivityChannel, SendActivityData}, utils::is_admin, }; @@ -12,7 +11,10 @@ use lemmy_db_schema::{ traits::Reportable, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_reports::CommunityReportView; +use lemmy_db_views_reports::{ + api::{CommunityReportResponse, ResolveCommunityReport}, + CommunityReportView, +}; use lemmy_utils::error::LemmyResult; pub async fn resolve_community_report( diff --git a/crates/api/src/reports/post_report/create.rs b/crates/api/src/reports/post_report/create.rs index b700f3612..83874cf36 100644 --- a/crates/api/src/reports/post_report/create.rs +++ b/crates/api/src/reports/post_report/create.rs @@ -2,9 +2,8 @@ use crate::check_report_reason; use activitypub_federation::config::Data; use actix_web::web::Json; use either::Either; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - reports::post::{CreatePostReport, PostReportResponse}, send_activity::{ActivityChannel, SendActivityData}, utils::{check_community_user_action, check_post_deleted_or_removed, slur_regex}, }; @@ -14,7 +13,10 @@ use lemmy_db_schema::{ }; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_post::PostView; -use lemmy_db_views_reports::PostReportView; +use lemmy_db_views_reports::{ + api::{CreatePostReport, PostReportResponse}, + PostReportView, +}; use lemmy_db_views_site::SiteView; use lemmy_email::admin::send_new_report_email_to_admins; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/reports/post_report/resolve.rs b/crates/api/src/reports/post_report/resolve.rs index 94f867be7..0c2f6c5d0 100644 --- a/crates/api/src/reports/post_report/resolve.rs +++ b/crates/api/src/reports/post_report/resolve.rs @@ -1,15 +1,17 @@ use activitypub_federation::config::Data; use actix_web::web::Json; use either::Either; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - reports::post::{PostReportResponse, ResolvePostReport}, send_activity::{ActivityChannel, SendActivityData}, utils::check_community_mod_action, }; use lemmy_db_schema::{source::post_report::PostReport, traits::Reportable}; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_reports::PostReportView; +use lemmy_db_views_reports::{ + api::{PostReportResponse, ResolvePostReport}, + PostReportView, +}; use lemmy_utils::error::LemmyResult; /// Resolves or unresolves a post report and notifies the moderators of the community diff --git a/crates/api/src/reports/private_message_report/create.rs b/crates/api/src/reports/private_message_report/create.rs index 77783aaf1..704557a7c 100644 --- a/crates/api/src/reports/private_message_report/create.rs +++ b/crates/api/src/reports/private_message_report/create.rs @@ -1,10 +1,6 @@ use crate::check_report_reason; use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - reports::private_message::{CreatePrivateMessageReport, PrivateMessageReportResponse}, - utils::slur_regex, -}; +use lemmy_api_utils::{context::LemmyContext, utils::slur_regex}; use lemmy_db_schema::{ source::{ private_message::PrivateMessage, @@ -13,7 +9,10 @@ use lemmy_db_schema::{ traits::{Crud, Reportable}, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_reports::PrivateMessageReportView; +use lemmy_db_views_reports::{ + api::{CreatePrivateMessageReport, PrivateMessageReportResponse}, + PrivateMessageReportView, +}; use lemmy_db_views_site::SiteView; use lemmy_email::admin::send_new_report_email_to_admins; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api/src/reports/private_message_report/resolve.rs b/crates/api/src/reports/private_message_report/resolve.rs index 8e5189f9c..cb2b46cbf 100644 --- a/crates/api/src/reports/private_message_report/resolve.rs +++ b/crates/api/src/reports/private_message_report/resolve.rs @@ -1,12 +1,11 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - reports::private_message::{PrivateMessageReportResponse, ResolvePrivateMessageReport}, - utils::is_admin, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::{source::private_message_report::PrivateMessageReport, traits::Reportable}; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_reports::PrivateMessageReportView; +use lemmy_db_views_reports::{ + api::{PrivateMessageReportResponse, ResolvePrivateMessageReport}, + PrivateMessageReportView, +}; use lemmy_utils::error::LemmyResult; pub async fn resolve_pm_report( diff --git a/crates/api/src/reports/report_combined/list.rs b/crates/api/src/reports/report_combined/list.rs index fac9de671..8e6c5de2f 100644 --- a/crates/api/src/reports/report_combined/list.rs +++ b/crates/api/src/reports/report_combined/list.rs @@ -1,12 +1,12 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - reports::combined::{ListReports, ListReportsResponse}, - utils::check_community_mod_of_any_or_admin_action, -}; +use lemmy_api_utils::{context::LemmyContext, utils::check_community_mod_of_any_or_admin_action}; use lemmy_db_schema::traits::PaginationCursorBuilder; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_report_combined::{impls::ReportCombinedQuery, ReportCombinedView}; +use lemmy_db_views_report_combined::{ + api::{ListReports, ListReportsResponse}, + impls::ReportCombinedQuery, + ReportCombinedView, +}; use lemmy_utils::error::LemmyResult; /// Lists reports for a community if an id is supplied diff --git a/crates/api/src/site/admin_allow_instance.rs b/crates/api/src/site/admin_allow_instance.rs index dcec52397..1a24603d7 100644 --- a/crates/api/src/site/admin_allow_instance.rs +++ b/crates/api/src/site/admin_allow_instance.rs @@ -1,12 +1,6 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ - context::LemmyContext, - site::AdminAllowInstanceParams, - utils::is_admin, - LemmyErrorType, - SuccessResponse, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::{ source::{ federation_allowlist::{FederationAllowList, FederationAllowListForm}, @@ -15,8 +9,10 @@ use lemmy_db_schema::{ }, traits::Crud, }; +use lemmy_db_views_api_misc::SuccessResponse; use lemmy_db_views_local_user::LocalUserView; -use lemmy_utils::error::LemmyResult; +use lemmy_db_views_site::api::AdminAllowInstanceParams; +use lemmy_utils::error::{LemmyErrorType, LemmyResult}; pub async fn admin_allow_instance( data: Json, diff --git a/crates/api/src/site/admin_block_instance.rs b/crates/api/src/site/admin_block_instance.rs index 72ce2d259..4b5fa1eda 100644 --- a/crates/api/src/site/admin_block_instance.rs +++ b/crates/api/src/site/admin_block_instance.rs @@ -1,12 +1,6 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ - context::LemmyContext, - site::AdminBlockInstanceParams, - utils::is_admin, - LemmyErrorType, - SuccessResponse, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::{ source::{ federation_blocklist::{FederationBlockList, FederationBlockListForm}, @@ -15,8 +9,10 @@ use lemmy_db_schema::{ }, traits::Crud, }; +use lemmy_db_views_api_misc::SuccessResponse; use lemmy_db_views_local_user::LocalUserView; -use lemmy_utils::error::LemmyResult; +use lemmy_db_views_site::api::AdminBlockInstanceParams; +use lemmy_utils::error::{LemmyErrorType, LemmyResult}; pub async fn admin_block_instance( data: Json, diff --git a/crates/api/src/site/admin_list_users.rs b/crates/api/src/site/admin_list_users.rs index 62a4772d6..b918449fb 100644 --- a/crates/api/src/site/admin_list_users.rs +++ b/crates/api/src/site/admin_list_users.rs @@ -1,11 +1,11 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - site::{AdminListUsers, AdminListUsersResponse}, - utils::is_admin, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::traits::PaginationCursorBuilder; -use lemmy_db_views_local_user::{impls::LocalUserQuery, LocalUserView}; +use lemmy_db_views_local_user::{ + api::{AdminListUsers, AdminListUsersResponse}, + impls::LocalUserQuery, + LocalUserView, +}; use lemmy_db_views_person::PersonView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/site/federated_instances.rs b/crates/api/src/site/federated_instances.rs index 714fc72cd..946980323 100644 --- a/crates/api/src/site/federated_instances.rs +++ b/crates/api/src/site/federated_instances.rs @@ -1,10 +1,6 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{ - context::LemmyContext, - site::GetFederatedInstancesResponse, - utils::build_federated_instances, -}; -use lemmy_db_views_site::SiteView; +use lemmy_api_utils::{context::LemmyContext, utils::build_federated_instances}; +use lemmy_db_views_site::{api::GetFederatedInstancesResponse, SiteView}; use lemmy_utils::error::LemmyResult; pub async fn get_federated_instances( diff --git a/crates/api/src/site/leave_admin.rs b/crates/api/src/site/leave_admin.rs index 4660b946e..9fd83a2a0 100644 --- a/crates/api/src/site/leave_admin.rs +++ b/crates/api/src/site/leave_admin.rs @@ -1,5 +1,5 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{context::LemmyContext, site::GetSiteResponse, utils::is_admin}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::{ source::{ actor_language::SiteLanguage, @@ -14,7 +14,7 @@ use lemmy_db_schema::{ }; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_person::impls::PersonQuery; -use lemmy_db_views_site::SiteView; +use lemmy_db_views_site::{api::GetSiteResponse, SiteView}; use lemmy_utils::{ error::{LemmyErrorType, LemmyResult}, VERSION, diff --git a/crates/api/src/site/list_all_media.rs b/crates/api/src/site/list_all_media.rs index 3e91c5403..648d1408a 100644 --- a/crates/api/src/site/list_all_media.rs +++ b/crates/api/src/site/list_all_media.rs @@ -1,11 +1,10 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - person::{ListMedia, ListMediaResponse}, - utils::is_admin, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::traits::PaginationCursorBuilder; -use lemmy_db_views_local_image::LocalImageView; +use lemmy_db_views_local_image::{ + api::{ListMedia, ListMediaResponse}, + LocalImageView, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/site/mod_log.rs b/crates/api/src/site/mod_log.rs index 082468b0e..0922eeaca 100644 --- a/crates/api/src/site/mod_log.rs +++ b/crates/api/src/site/mod_log.rs @@ -1,14 +1,13 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - site::GetModlog, utils::{check_private_instance, is_mod_or_admin_opt}, }; use lemmy_db_schema::traits::PaginationCursorBuilder; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_modlog_combined::{ + api::{GetModlog, GetModlogResponse}, impls::ModlogCombinedQuery, - GetModlogResponse, ModlogCombinedView, }; use lemmy_db_views_site::SiteView; @@ -85,7 +84,7 @@ pub async fn get_mod_log( #[cfg(test)] mod tests { use super::*; - use lemmy_api_common::utils::remove_or_restore_user_data; + use lemmy_api_utils::utils::remove_or_restore_user_data; use lemmy_db_schema::{ source::{ comment::{Comment, CommentInsertForm}, diff --git a/crates/api/src/site/purge/comment.rs b/crates/api/src/site/purge/comment.rs index b09e6b01f..3674b9ed9 100644 --- a/crates/api/src/site/purge/comment.rs +++ b/crates/api/src/site/purge/comment.rs @@ -1,11 +1,9 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, - site::PurgeComment, utils::is_admin, - SuccessResponse, }; use lemmy_db_schema::{ source::{ @@ -15,7 +13,8 @@ use lemmy_db_schema::{ }, traits::Crud, }; -use lemmy_db_views_comment::CommentView; +use lemmy_db_views_api_misc::SuccessResponse; +use lemmy_db_views_comment::{api::PurgeComment, CommentView}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/site/purge/community.rs b/crates/api/src/site/purge/community.rs index 8aa203b4f..52ee08b5b 100644 --- a/crates/api/src/site/purge/community.rs +++ b/crates/api/src/site/purge/community.rs @@ -1,11 +1,9 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, - site::PurgeCommunity, utils::is_admin, - SuccessResponse, }; use lemmy_db_schema::{ newtypes::PersonId, @@ -16,6 +14,8 @@ use lemmy_db_schema::{ }, traits::Crud, }; +use lemmy_db_views_api_misc::SuccessResponse; +use lemmy_db_views_community::api::PurgeCommunity; use lemmy_db_views_community_moderator::CommunityModeratorView; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/site/purge/person.rs b/crates/api/src/site/purge/person.rs index 89dc05ce6..113563c67 100644 --- a/crates/api/src/site/purge/person.rs +++ b/crates/api/src/site/purge/person.rs @@ -1,11 +1,9 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, - site::PurgePerson, utils::{is_admin, purge_user_account}, - SuccessResponse, }; use lemmy_db_schema::{ source::{ @@ -16,7 +14,9 @@ use lemmy_db_schema::{ }, traits::{Bannable, Crud}, }; +use lemmy_db_views_api_misc::SuccessResponse; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_person::api::PurgePerson; use lemmy_utils::error::LemmyResult; pub async fn purge_person( diff --git a/crates/api/src/site/purge/post.rs b/crates/api/src/site/purge/post.rs index c62295324..99ddd608a 100644 --- a/crates/api/src/site/purge/post.rs +++ b/crates/api/src/site/purge/post.rs @@ -1,11 +1,9 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, - site::PurgePost, utils::{is_admin, purge_post_images}, - SuccessResponse, }; use lemmy_db_schema::{ source::{ @@ -15,7 +13,9 @@ use lemmy_db_schema::{ }, traits::Crud, }; +use lemmy_db_views_api_misc::SuccessResponse; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_post::api::PurgePost; use lemmy_utils::error::LemmyResult; pub async fn purge_post( diff --git a/crates/api/src/site/registration_applications/approve.rs b/crates/api/src/site/registration_applications/approve.rs index 116ee9190..eaf4ffcc3 100644 --- a/crates/api/src/site/registration_applications/approve.rs +++ b/crates/api/src/site/registration_applications/approve.rs @@ -1,11 +1,7 @@ use activitypub_federation::config::Data; use actix_web::web::Json; use diesel_async::scoped_futures::ScopedFutureExt; -use lemmy_api_common::{ - context::LemmyContext, - site::{ApproveRegistrationApplication, RegistrationApplicationResponse}, - utils::is_admin, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::{ source::{ local_user::{LocalUser, LocalUserUpdateForm}, @@ -15,7 +11,10 @@ use lemmy_db_schema::{ utils::{diesel_string_update, get_conn}, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_registration_applications::RegistrationApplicationView; +use lemmy_db_views_registration_applications::{ + api::{ApproveRegistrationApplication, RegistrationApplicationResponse}, + RegistrationApplicationView, +}; use lemmy_email::account::{send_application_approved_email, send_application_denied_email}; use lemmy_utils::error::LemmyResult; diff --git a/crates/api/src/site/registration_applications/get.rs b/crates/api/src/site/registration_applications/get.rs index 173351d0d..294e2f048 100644 --- a/crates/api/src/site/registration_applications/get.rs +++ b/crates/api/src/site/registration_applications/get.rs @@ -1,11 +1,10 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - site::{GetRegistrationApplication, RegistrationApplicationResponse}, - utils::is_admin, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_registration_applications::RegistrationApplicationView; +use lemmy_db_views_registration_applications::{ + api::{GetRegistrationApplication, RegistrationApplicationResponse}, + RegistrationApplicationView, +}; use lemmy_utils::error::LemmyResult; /// Lists registration applications, filterable by undenied only. diff --git a/crates/api/src/site/registration_applications/list.rs b/crates/api/src/site/registration_applications/list.rs index 8da60ec44..1c3bf293d 100644 --- a/crates/api/src/site/registration_applications/list.rs +++ b/crates/api/src/site/registration_applications/list.rs @@ -1,13 +1,10 @@ use activitypub_federation::config::Data; use actix_web::web::{Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - site::{ListRegistrationApplications, ListRegistrationApplicationsResponse}, - utils::is_admin, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::traits::PaginationCursorBuilder; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_registration_applications::{ + api::{ListRegistrationApplications, ListRegistrationApplicationsResponse}, impls::RegistrationApplicationQuery, RegistrationApplicationView, }; diff --git a/crates/api/src/site/registration_applications/tests.rs b/crates/api/src/site/registration_applications/tests.rs index ad439ab55..5ce764b61 100644 --- a/crates/api/src/site/registration_applications/tests.rs +++ b/crates/api/src/site/registration_applications/tests.rs @@ -5,16 +5,8 @@ use crate::site::registration_applications::{ }; use activitypub_federation::config::Data; use actix_web::web::{Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - site::{ - ApproveRegistrationApplication, - EditSite, - GetUnreadRegistrationApplicationCountResponse, - ListRegistrationApplicationsResponse, - }, -}; use lemmy_api_crud::site::update::update_site; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ newtypes::InstanceId, source::{ @@ -30,7 +22,13 @@ use lemmy_db_schema::{ utils::DbPool, }; use lemmy_db_schema_file::enums::RegistrationMode; +use lemmy_db_views_inbox_combined::api::GetUnreadRegistrationApplicationCountResponse; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_registration_applications::api::{ + ApproveRegistrationApplication, + ListRegistrationApplicationsResponse, +}; +use lemmy_db_views_site::api::EditSite; use lemmy_utils::{ error::{LemmyErrorType, LemmyResult}, CACHE_DURATION_API, diff --git a/crates/api/src/site/registration_applications/unread_count.rs b/crates/api/src/site/registration_applications/unread_count.rs index 657dc3d5b..6e97f4018 100644 --- a/crates/api/src/site/registration_applications/unread_count.rs +++ b/crates/api/src/site/registration_applications/unread_count.rs @@ -1,10 +1,7 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ - context::LemmyContext, - site::GetUnreadRegistrationApplicationCountResponse, - utils::is_admin, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; +use lemmy_db_views_inbox_combined::api::GetUnreadRegistrationApplicationCountResponse; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_registration_applications::RegistrationApplicationView; use lemmy_db_views_site::SiteView; diff --git a/crates/api/src/sitemap.rs b/crates/api/src/sitemap.rs index 4d3799b1b..170a694a7 100644 --- a/crates/api/src/sitemap.rs +++ b/crates/api/src/sitemap.rs @@ -3,7 +3,7 @@ use actix_web::{ web::Data, HttpResponse, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{newtypes::DbUrl, source::post::Post}; use lemmy_utils::error::LemmyResult; use sitemap_rs::{url::Url, url_set::UrlSet}; diff --git a/crates/api_common/Cargo.toml b/crates/api_common/Cargo.toml index 70c70d3dc..ba8de2bcd 100644 --- a/crates/api_common/Cargo.toml +++ b/crates/api_common/Cargo.toml @@ -19,102 +19,58 @@ workspace = true [features] full = [ - "tracing", - "activitypub_federation", - "encoding_rs", - "reqwest-middleware", - "webpage", - "ts-rs", - "tokio", - "reqwest", - "actix-web", - "futures", - "jsonwebtoken", - "mime", - "moka", - "actix-web-httpauth", - "webmention", - "extism", - "extism-convert", - "once_cell", - "serde_json", - "lemmy_email", + "lemmy_utils/full", "lemmy_db_schema/full", "lemmy_db_schema_file/full", - "lemmy_utils/full", + "lemmy_db_views_api_misc/full", "lemmy_db_views_comment/full", "lemmy_db_views_community/full", - "lemmy_db_views_community_moderator/full", "lemmy_db_views_community_follower/full", - "lemmy_db_views_community_person_ban/full", - "lemmy_db_views_post/full", - "lemmy_db_views_vote/full", - "lemmy_db_views_local_user/full", - "lemmy_db_views_person/full", + "lemmy_db_views_community_moderator/full", "lemmy_db_views_custom_emoji/full", - "lemmy_db_views_reports/full", - "lemmy_db_views_private_message/full", + "lemmy_db_views_inbox_combined/full", "lemmy_db_views_local_image/full", - "lemmy_db_views_report_combined/full", - "lemmy_db_views_site/full", + "lemmy_db_views_local_user/full", + "lemmy_db_views_modlog_combined/full", + "lemmy_db_views_person/full", + "lemmy_db_views_person_content_combined/full", + "lemmy_db_views_person_liked_combined/full", + "lemmy_db_views_person_saved_combined/full", + "lemmy_db_views_post/full", + "lemmy_db_views_private_message/full", + "lemmy_db_views_readable_federation_state/full", "lemmy_db_views_registration_applications/full", + "lemmy_db_views_report_combined/full", + "lemmy_db_views_reports/full", + "lemmy_db_views_search_combined/full", + "lemmy_db_views_site/full", + "lemmy_db_views_vote/full", ] [dependencies] -lemmy_db_views_comment = { workspace = true } -lemmy_db_views_community = { workspace = true } -lemmy_db_views_community_moderator = { workspace = true } -lemmy_db_views_community_follower = { workspace = true } -lemmy_db_views_community_person_ban = { workspace = true } -lemmy_db_views_post = { workspace = true } -lemmy_db_views_vote = { workspace = true } -lemmy_db_views_local_user = { workspace = true } -lemmy_db_views_person = { workspace = true } -lemmy_db_views_custom_emoji = { workspace = true } -lemmy_db_views_reports = { workspace = true } -lemmy_db_views_private_message = { workspace = true } -lemmy_db_views_local_image = { workspace = true } -lemmy_db_views_report_combined = { workspace = true } -lemmy_db_views_site = { workspace = true } -lemmy_db_views_registration_applications = { workspace = true } -lemmy_db_schema = { workspace = true } -lemmy_utils = { workspace = true } -lemmy_db_schema_file = { workspace = true } -lemmy_email = { workspace = true, optional = true } -activitypub_federation = { workspace = true, optional = true } -serde = { workspace = true } -serde_with = { workspace = true } -url = { workspace = true } -chrono = { workspace = true } -tracing = { workspace = true, optional = true } -reqwest-middleware = { workspace = true, optional = true } -regex = { workspace = true } -futures = { workspace = true, optional = true } -tokio = { workspace = true, optional = true } -reqwest = { workspace = true, optional = true } -ts-rs = { workspace = true, optional = true } -moka = { workspace = true, optional = true } -anyhow.workspace = true -enum-map = { workspace = true } -actix-web = { workspace = true, optional = true } -urlencoding = { workspace = true } -serde_json = { workspace = true, optional = true } -mime = { version = "0.3.17", optional = true } -mime_guess = "2.0.5" -infer = "0.19.0" -webpage = { version = "2.0", default-features = false, optional = true, features = [ - "serde", -] } -encoding_rs = { version = "0.8.35", optional = true } -jsonwebtoken = { version = "9.3.1", optional = true } -actix-web-httpauth = { version = "0.8.2", optional = true } -webmention = { version = "0.6.0", optional = true } -extism = { git = "https://github.com/extism/extism.git", branch = "pool", optional = true } -extism-convert = { git = "https://github.com/extism/extism.git", branch = "pool", optional = true } -once_cell = { version = "1.21.3", optional = true } -either = { workspace = true } - -[dev-dependencies] -serial_test = { workspace = true } -reqwest-middleware = { workspace = true } -pretty_assertions = { workspace = true } +lemmy_utils.workspace = true +lemmy_db_schema.workspace = true +lemmy_db_schema_file.workspace = true +lemmy_db_views_api_misc.workspace = true +lemmy_db_views_comment.workspace = true +lemmy_db_views_community.workspace = true +lemmy_db_views_community_follower.workspace = true +lemmy_db_views_community_moderator.workspace = true +lemmy_db_views_custom_emoji.workspace = true +lemmy_db_views_inbox_combined.workspace = true +lemmy_db_views_local_image.workspace = true +lemmy_db_views_local_user.workspace = true +lemmy_db_views_modlog_combined.workspace = true +lemmy_db_views_person.workspace = true +lemmy_db_views_person_content_combined.workspace = true +lemmy_db_views_person_liked_combined.workspace = true +lemmy_db_views_person_saved_combined.workspace = true +lemmy_db_views_post.workspace = true +lemmy_db_views_private_message.workspace = true +lemmy_db_views_readable_federation_state.workspace = true +lemmy_db_views_registration_applications.workspace = true +lemmy_db_views_report_combined.workspace = true +lemmy_db_views_reports.workspace = true +lemmy_db_views_search_combined.workspace = true +lemmy_db_views_site.workspace = true +lemmy_db_views_vote.workspace = true diff --git a/crates/api_common/src/account.rs b/crates/api_common/src/account.rs new file mode 100644 index 000000000..c000d9322 --- /dev/null +++ b/crates/api_common/src/account.rs @@ -0,0 +1,39 @@ +pub use lemmy_db_views_api_misc::{ + DeleteAccount, + ListPersonHidden, + ListPersonHiddenResponse, + ListPersonRead, + ListPersonReadResponse, + MyUserInfo, + SaveUserSettings, +}; +pub use lemmy_db_views_person_liked_combined::{ + ListPersonLiked, + ListPersonLikedResponse, + PersonLikedCombinedView, +}; +pub use lemmy_db_views_person_saved_combined::{ + ListPersonSaved, + ListPersonSavedResponse, + PersonSavedCombinedView, +}; + +pub mod auth { + pub use lemmy_db_schema::source::login_token::LoginToken; + pub use lemmy_db_views_api_misc::{ + CaptchaResponse, + ChangePassword, + GenerateTotpSecretResponse, + GetCaptchaResponse, + ListLoginsResponse, + Login, + LoginResponse, + PasswordChangeAfterReset, + PasswordReset, + ResendVerificationEmail, + UpdateTotp, + UpdateTotpResponse, + VerifyEmail, + }; + pub use lemmy_db_views_registration_applications::api::Register; +} diff --git a/crates/api_common/src/comment.rs b/crates/api_common/src/comment.rs index 63d458ffc..6b03e7227 100644 --- a/crates/api_common/src/comment.rs +++ b/crates/api_common/src/comment.rs @@ -1,196 +1,29 @@ -use lemmy_db_schema::newtypes::{ - CommentId, - CommunityId, - LanguageId, - LocalUserId, - PaginationCursor, - PostId, +pub use lemmy_db_schema::{ + newtypes::CommentId, + source::comment::{Comment, CommentActions}, +}; +pub use lemmy_db_views_comment::{ + api::{CommentResponse, GetComment, GetComments, GetCommentsResponse, GetCommentsSlimResponse}, + CommentSlimView, + CommentView, }; -use lemmy_db_schema_file::enums::{CommentSortType, ListingType}; -use lemmy_db_views_comment::{CommentSlimView, CommentView}; -use lemmy_db_views_vote::VoteView; -use serde::{Deserialize, Serialize}; -use serde_with::skip_serializing_none; -#[cfg(feature = "full")] -use ts_rs::TS; -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Create a comment. -pub struct CreateComment { - pub content: String, - pub post_id: PostId, - #[cfg_attr(feature = "full", ts(optional))] - pub parent_id: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub language_id: Option, -} +pub mod actions { + pub use lemmy_db_views_comment::api::{ + CreateComment, + CreateCommentLike, + DeleteComment, + EditComment, + SaveComment, + }; -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, Copy, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Fetch an individual comment. -pub struct GetComment { - pub id: CommentId, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Edit a comment. -pub struct EditComment { - pub comment_id: CommentId, - #[cfg_attr(feature = "full", ts(optional))] - pub content: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub language_id: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Distinguish a comment (IE speak as moderator). -pub struct DistinguishComment { - pub comment_id: CommentId, - pub distinguished: bool, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Delete your own comment. -pub struct DeleteComment { - pub comment_id: CommentId, - pub deleted: bool, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Remove a comment (only doable by mods). -pub struct RemoveComment { - pub comment_id: CommentId, - pub removed: bool, - #[cfg_attr(feature = "full", ts(optional))] - pub reason: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Save / bookmark a comment. -pub struct SaveComment { - pub comment_id: CommentId, - pub save: bool, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A comment response. -pub struct CommentResponse { - pub comment_view: CommentView, - pub recipient_ids: Vec, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Like a comment. -pub struct CreateCommentLike { - pub comment_id: CommentId, - /// Must be -1, 0, or 1 . - pub score: i16, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Get a list of comments. -pub struct GetComments { - #[cfg_attr(feature = "full", ts(optional))] - pub type_: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub sort: Option, - #[cfg_attr(feature = "full", ts(optional))] - /// Filter to within a given time range, in seconds. - /// IE 60 would give results for the past minute. - pub time_range_seconds: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub max_depth: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_cursor: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_back: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub limit: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub community_id: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub community_name: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub post_id: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub parent_id: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The comment list response. -pub struct GetCommentsResponse { - pub comments: Vec, - #[cfg_attr(feature = "full", ts(optional))] - pub next_page: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub prev_page: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A slimmer comment list response, without the post or community. -pub struct GetCommentsSlimResponse { - pub comments: Vec, - #[cfg_attr(feature = "full", ts(optional))] - pub next_page: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub prev_page: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// List comment likes. Admins-only. -pub struct ListCommentLikes { - pub comment_id: CommentId, - #[cfg_attr(feature = "full", ts(optional))] - pub page_cursor: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_back: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub limit: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The comment likes response -pub struct ListCommentLikesResponse { - pub comment_likes: Vec, - /// the pagination cursor to use to fetch the next page - #[cfg_attr(feature = "full", ts(optional))] - pub next_page: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub prev_page: Option, + pub mod moderation { + pub use lemmy_db_views_comment::api::{ + DistinguishComment, + ListCommentLikes, + ListCommentLikesResponse, + PurgeComment, + RemoveComment, + }; + } } diff --git a/crates/api_common/src/community.rs b/crates/api_common/src/community.rs index d9d2c35e0..30df2db38 100644 --- a/crates/api_common/src/community.rs +++ b/crates/api_common/src/community.rs @@ -1,364 +1,60 @@ -use lemmy_db_schema::{ - newtypes::{CommunityId, LanguageId, PaginationCursor, PersonId, TagId}, - source::site::Site, - CommunitySortType, +pub use lemmy_db_schema::{ + newtypes::{CommunityId, TagId}, + source::{ + community::{Community, CommunityActions}, + tag::{Tag, TagsView}, + }, }; -use lemmy_db_schema_file::enums::{CommunityVisibility, ListingType}; -use lemmy_db_views_community::CommunityView; -use lemmy_db_views_community_follower::PendingFollow; -use lemmy_db_views_community_moderator::CommunityModeratorView; -use lemmy_db_views_person::PersonView; -use serde::{Deserialize, Serialize}; -use serde_with::skip_serializing_none; -#[cfg(feature = "full")] -use ts_rs::TS; +pub use lemmy_db_schema_file::enums::CommunityVisibility; +pub use lemmy_db_views_community::{ + api::{ + CommunityResponse, + GetCommunity, + GetCommunityResponse, + GetRandomCommunity, + ListCommunities, + ListCommunitiesResponse, + }, + CommunityView, +}; +pub use lemmy_db_views_community_follower::PendingFollow; +pub use lemmy_db_views_community_moderator::CommunityModeratorView; -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Create a tag for a community. -pub struct CreateCommunityTag { - pub community_id: CommunityId, - pub display_name: String, -} +pub mod actions { + pub use lemmy_db_views_community::api::{ + BlockCommunity, + BlockCommunityResponse, + CreateCommunity, + FollowCommunity, + HideCommunity, + }; -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Update a community tag. -pub struct UpdateCommunityTag { - pub tag_id: TagId, - pub display_name: String, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Delete a community tag. -pub struct DeleteCommunityTag { - pub tag_id: TagId, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -// TODO make this into a tagged enum -/// Get a community. Must provide either an id, or a name. -pub struct GetCommunity { - #[cfg_attr(feature = "full", ts(optional))] - pub id: Option, - /// Example: star_trek , or star_trek@xyz.tld - #[cfg_attr(feature = "full", ts(optional))] - pub name: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The community response. -pub struct GetCommunityResponse { - pub community_view: CommunityView, - #[cfg_attr(feature = "full", ts(optional))] - pub site: Option, - pub moderators: Vec, - pub discussion_languages: Vec, -} - -#[skip_serializing_none] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -/// Create a community. -pub struct CreateCommunity { - /// The unique name. - pub name: String, - /// A longer title. - pub title: String, - /// A sidebar for the community in markdown. - #[cfg_attr(feature = "full", ts(optional))] - pub sidebar: Option, - /// A shorter, one line description of your community. - #[cfg_attr(feature = "full", ts(optional))] - pub description: Option, - /// An icon URL. - #[cfg_attr(feature = "full", ts(optional))] - pub icon: Option, - /// A banner URL. - #[cfg_attr(feature = "full", ts(optional))] - pub banner: Option, - /// Whether its an NSFW community. - #[cfg_attr(feature = "full", ts(optional))] - pub nsfw: Option, - /// Whether to restrict posting only to moderators. - #[cfg_attr(feature = "full", ts(optional))] - pub posting_restricted_to_mods: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub discussion_languages: Option>, - #[cfg_attr(feature = "full", ts(optional))] - pub visibility: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A simple community response. -pub struct CommunityResponse { - pub community_view: CommunityView, - pub discussion_languages: Vec, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Fetches a list of communities. -pub struct ListCommunities { - #[cfg_attr(feature = "full", ts(optional))] - pub type_: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub sort: Option, - #[cfg_attr(feature = "full", ts(optional))] - /// Filter to within a given time range, in seconds. - /// IE 60 would give results for the past minute. - pub time_range_seconds: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub show_nsfw: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_cursor: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_back: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub limit: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The response for listing communities. -pub struct ListCommunitiesResponse { - pub communities: Vec, - /// the pagination cursor to use to fetch the next page - #[cfg_attr(feature = "full", ts(optional))] - pub next_page: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub prev_page: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Ban a user from a community. -pub struct BanFromCommunity { - pub community_id: CommunityId, - pub person_id: PersonId, - pub ban: bool, - /// Optionally remove or restore all their data. Useful for new troll accounts. - /// If ban is true, then this means remove. If ban is false, it means restore. - #[cfg_attr(feature = "full", ts(optional))] - pub remove_or_restore_data: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub reason: Option, - /// A time that the ban will expire, in unix epoch seconds. - /// - /// An i64 unix timestamp is used for a simpler API client implementation. - #[cfg_attr(feature = "full", ts(optional))] - pub expires: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The response for banning a user from a community. -pub struct BanFromCommunityResponse { - pub person_view: PersonView, - pub banned: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Add a moderator to a community. -pub struct AddModToCommunity { - pub community_id: CommunityId, - pub person_id: PersonId, - pub added: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The response of adding a moderator to a community. -pub struct AddModToCommunityResponse { - pub moderators: Vec, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Edit a community. -pub struct EditCommunity { - pub community_id: CommunityId, - /// A longer title. - #[cfg_attr(feature = "full", ts(optional))] - pub title: Option, - /// A sidebar for the community in markdown. - #[cfg_attr(feature = "full", ts(optional))] - pub sidebar: Option, - /// A shorter, one line description of your community. - #[cfg_attr(feature = "full", ts(optional))] - pub description: Option, - /// Whether its an NSFW community. - #[cfg_attr(feature = "full", ts(optional))] - pub nsfw: Option, - /// Whether to restrict posting only to moderators. - #[cfg_attr(feature = "full", ts(optional))] - pub posting_restricted_to_mods: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub discussion_languages: Option>, - #[cfg_attr(feature = "full", ts(optional))] - pub visibility: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Hide a community from the main view. -pub struct HideCommunity { - pub community_id: CommunityId, - pub hidden: bool, - #[cfg_attr(feature = "full", ts(optional))] - pub reason: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Delete your own community. -pub struct DeleteCommunity { - pub community_id: CommunityId, - pub deleted: bool, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Remove a community (only doable by moderators). -pub struct RemoveCommunity { - pub community_id: CommunityId, - pub removed: bool, - #[cfg_attr(feature = "full", ts(optional))] - pub reason: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Follow / subscribe to a community. -pub struct FollowCommunity { - pub community_id: CommunityId, - pub follow: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Block a community. -pub struct BlockCommunity { - pub community_id: CommunityId, - pub block: bool, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The block community response. -pub struct BlockCommunityResponse { - pub community_view: CommunityView, - pub blocked: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Transfer a community to a new owner. -pub struct TransferCommunity { - pub community_id: CommunityId, - pub person_id: PersonId, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Fetches a random community -pub struct GetRandomCommunity { - #[cfg_attr(feature = "full", ts(optional))] - pub type_: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub show_nsfw: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct ListCommunityPendingFollows { - /// Only shows the unapproved applications - #[cfg_attr(feature = "full", ts(optional))] - pub pending_only: Option, - // Only for admins, show pending follows for communities which you dont moderate - #[cfg_attr(feature = "full", ts(optional))] - pub all_communities: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_cursor: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_back: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub limit: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct GetCommunityPendingFollowsCount { - pub community_id: CommunityId, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct GetCommunityPendingFollowsCountResponse { - pub count: i64, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct ListCommunityPendingFollowsResponse { - pub items: Vec, - /// the pagination cursor to use to fetch the next page - #[cfg_attr(feature = "full", ts(optional))] - pub next_page: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub prev_page: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct ApproveCommunityPendingFollower { - pub community_id: CommunityId, - pub follower_id: PersonId, - pub approve: bool, + pub mod moderation { + pub use lemmy_db_schema_file::enums::CommunityFollowerState; + pub use lemmy_db_views_community::api::{ + AddModToCommunity, + AddModToCommunityResponse, + ApproveCommunityPendingFollower, + BanFromCommunity, + BanFromCommunityResponse, + CommunityIdQuery, + CreateCommunityTag, + DeleteCommunity, + DeleteCommunityTag, + EditCommunity, + PurgeCommunity, + RemoveCommunity, + TransferCommunity, + UpdateCommunityTag, + }; + pub use lemmy_db_views_community_follower::{ + api::{ + GetCommunityPendingFollowsCount, + GetCommunityPendingFollowsCountResponse, + ListCommunityPendingFollows, + ListCommunityPendingFollowsResponse, + }, + CommunityFollowerView, + }; + } } diff --git a/crates/api_common/src/custom_emoji.rs b/crates/api_common/src/custom_emoji.rs index 272528e3f..06b5d05e0 100644 --- a/crates/api_common/src/custom_emoji.rs +++ b/crates/api_common/src/custom_emoji.rs @@ -1,67 +1,14 @@ -use lemmy_db_schema::newtypes::CustomEmojiId; -use lemmy_db_views_custom_emoji::CustomEmojiView; -use serde::{Deserialize, Serialize}; -use serde_with::skip_serializing_none; -#[cfg(feature = "full")] -use ts_rs::TS; -use url::Url; - -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Create a custom emoji. -pub struct CreateCustomEmoji { - pub category: String, - pub shortcode: String, - #[cfg_attr(feature = "full", ts(type = "string"))] - pub image_url: Url, - pub alt_text: String, - pub keywords: Vec, -} - -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Edit a custom emoji. -pub struct EditCustomEmoji { - pub id: CustomEmojiId, - pub category: String, - #[cfg_attr(feature = "full", ts(type = "string"))] - pub image_url: Url, - pub alt_text: String, - pub keywords: Vec, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Delete a custom emoji. -pub struct DeleteCustomEmoji { - pub id: CustomEmojiId, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A response for a custom emoji. -pub struct CustomEmojiResponse { - pub custom_emoji: CustomEmojiView, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A response for custom emojis. -pub struct ListCustomEmojisResponse { - pub custom_emojis: Vec, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Fetches a list of custom emojis. -pub struct ListCustomEmojis { - #[cfg_attr(feature = "full", ts(optional))] - pub category: Option, -} +pub use lemmy_db_schema::{ + newtypes::CustomEmojiId, + source::{custom_emoji::CustomEmoji, custom_emoji_keyword::CustomEmojiKeyword}, +}; +pub use lemmy_db_views_custom_emoji::{ + api::{ + CreateCustomEmoji, + DeleteCustomEmoji, + EditCustomEmoji, + ListCustomEmojis, + ListCustomEmojisResponse, + }, + CustomEmojiView, +}; diff --git a/crates/api_common/src/error.rs b/crates/api_common/src/error.rs new file mode 100644 index 000000000..dd370feb1 --- /dev/null +++ b/crates/api_common/src/error.rs @@ -0,0 +1 @@ +pub use lemmy_utils::error::{FederationError, LemmyErrorType}; diff --git a/crates/api_common/src/federation.rs b/crates/api_common/src/federation.rs new file mode 100644 index 000000000..ace2ca86f --- /dev/null +++ b/crates/api_common/src/federation.rs @@ -0,0 +1,21 @@ +pub use lemmy_db_schema::{ + newtypes::{ActivityId, InstanceId}, + source::{ + federation_allowlist::FederationAllowList, + federation_blocklist::FederationBlockList, + federation_queue_state::FederationQueueState, + instance::{Instance, InstanceActions}, + }, +}; +pub use lemmy_db_schema_file::enums::FederationMode; +pub use lemmy_db_views_api_misc::{ResolveObject, ResolveObjectResponse, UserBlockInstanceParams}; +pub use lemmy_db_views_readable_federation_state::ReadableFederationState; +pub use lemmy_db_views_site::api::{ + FederatedInstances, + GetFederatedInstancesResponse, + InstanceWithFederationState, +}; + +pub mod administration { + pub use lemmy_db_views_site::api::{AdminAllowInstanceParams, AdminBlockInstanceParams}; +} diff --git a/crates/api_common/src/inbox.rs b/crates/api_common/src/inbox.rs new file mode 100644 index 000000000..be3cd6bf8 --- /dev/null +++ b/crates/api_common/src/inbox.rs @@ -0,0 +1,24 @@ +pub use lemmy_db_schema::{ + newtypes::{CommentReplyId, PersonCommentMentionId, PersonPostMentionId}, + source::{ + comment_reply::CommentReply, + person_comment_mention::PersonCommentMention, + person_post_mention::PersonPostMention, + }, + InboxDataType, +}; +pub use lemmy_db_views_inbox_combined::{ + api::{ + GetUnreadCountResponse, + MarkCommentReplyAsRead, + MarkPersonCommentMentionAsRead, + MarkPersonPostMentionAsRead, + MarkPrivateMessageAsRead, + }, + CommentReplyView, + InboxCombinedView, + ListInbox, + ListInboxResponse, + PersonCommentMentionView, + PersonPostMentionView, +}; diff --git a/crates/api_common/src/language.rs b/crates/api_common/src/language.rs new file mode 100644 index 000000000..05257d67d --- /dev/null +++ b/crates/api_common/src/language.rs @@ -0,0 +1 @@ +pub use lemmy_db_schema::{newtypes::LanguageId, source::language::Language}; diff --git a/crates/api_common/src/lib.rs b/crates/api_common/src/lib.rs index 9f49c1c68..26498ff26 100644 --- a/crates/api_common/src/lib.rs +++ b/crates/api_common/src/lib.rs @@ -1,85 +1,24 @@ -#[cfg(feature = "full")] -pub mod build_response; -#[cfg(feature = "full")] -pub mod claims; +pub mod account; pub mod comment; pub mod community; -#[cfg(feature = "full")] -pub mod context; pub mod custom_emoji; -pub mod image; -pub mod oauth_provider; +pub mod error; +pub mod federation; +pub mod inbox; +pub mod language; +pub mod media; +pub mod modlog; +pub mod oauth; pub mod person; -#[cfg(feature = "full")] -pub mod plugins; +pub mod plugin; pub mod post; pub mod private_message; -pub mod reports; -#[cfg(feature = "full")] -pub mod request; -#[cfg(feature = "full")] -pub mod send_activity; +pub mod report; +pub mod search; pub mod site; pub mod tagline; -#[cfg(feature = "full")] -pub mod tags; -#[cfg(feature = "full")] -pub mod utils; -pub extern crate lemmy_db_schema; -pub extern crate lemmy_utils; - -pub use lemmy_utils::error::LemmyErrorType; -use serde::{Deserialize, Serialize}; -use std::{cmp::min, time::Duration}; - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(ts_rs::TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A response that completes successfully. -pub struct SuccessResponse { - pub success: bool, -} - -impl Default for SuccessResponse { - fn default() -> Self { - SuccessResponse { success: true } - } -} - -// TODO: use from_days once stabilized -// https://github.com/rust-lang/rust/issues/120301 -const DAY: Duration = Duration::from_secs(24 * 60 * 60); - -/// Calculate how long to sleep until next federation send based on how many -/// retries have already happened. Uses exponential backoff with maximum of one day. The first -/// error is ignored. -pub fn federate_retry_sleep_duration(retry_count: i32) -> Duration { - debug_assert!(retry_count != 0); - if retry_count == 1 { - return Duration::from_secs(0); - } - let retry_count = retry_count - 1; - let pow = 1.25_f64.powf(retry_count.into()); - let pow = Duration::try_from_secs_f64(pow).unwrap_or(DAY); - min(DAY, pow) -} - -#[cfg(test)] -pub(crate) mod tests { - use super::*; - - #[test] - fn test_federate_retry_sleep_duration() { - assert_eq!(Duration::from_secs(0), federate_retry_sleep_duration(1)); - assert_eq!( - Duration::new(1, 250000000), - federate_retry_sleep_duration(2) - ); - assert_eq!( - Duration::new(2, 441406250), - federate_retry_sleep_duration(5) - ); - assert_eq!(DAY, federate_retry_sleep_duration(100)); - } -} +pub use lemmy_db_schema::{newtypes::DbUrl, sensitive::SensitiveString}; +pub use lemmy_db_schema_file::enums::VoteShow; +pub use lemmy_db_views_api_misc::SuccessResponse; +pub use lemmy_db_views_vote::VoteView; diff --git a/crates/api_common/src/media.rs b/crates/api_common/src/media.rs new file mode 100644 index 000000000..a4b96d249 --- /dev/null +++ b/crates/api_common/src/media.rs @@ -0,0 +1,12 @@ +pub use lemmy_db_schema::source::images::{ImageDetails, LocalImage, RemoteImage}; +pub use lemmy_db_views_local_image::{ + api::{ + DeleteImageParams, + ImageGetParams, + ImageProxyParams, + ListMedia, + ListMediaResponse, + UploadImageResponse, + }, + LocalImageView, +}; diff --git a/crates/api_common/src/modlog.rs b/crates/api_common/src/modlog.rs new file mode 100644 index 000000000..0bd7bab8c --- /dev/null +++ b/crates/api_common/src/modlog.rs @@ -0,0 +1,70 @@ +pub use lemmy_db_schema::{ + newtypes::{ + AdminAllowInstanceId, + AdminBlockInstanceId, + AdminPurgeCommentId, + AdminPurgeCommunityId, + AdminPurgePersonId, + AdminPurgePostId, + ModAddCommunityId, + ModAddId, + ModBanFromCommunityId, + ModBanId, + ModChangeCommunityVisibilityId, + ModFeaturePostId, + ModLockPostId, + ModRemoveCommentId, + ModRemoveCommunityId, + ModRemovePostId, + ModTransferCommunityId, + ModlogCombinedId, + }, + source::{ + combined::modlog::ModlogCombined, + mod_log::{ + admin::{ + AdminAllowInstance, + AdminBlockInstance, + AdminPurgeComment, + AdminPurgeCommunity, + AdminPurgePerson, + AdminPurgePost, + }, + moderator::{ + ModAdd, + ModAddCommunity, + ModBan, + ModBanFromCommunity, + ModChangeCommunityVisibility, + ModFeaturePost, + ModLockPost, + ModRemoveComment, + ModRemoveCommunity, + ModRemovePost, + ModTransferCommunity, + }, + }, + }, + ModlogActionType, +}; +pub use lemmy_db_views_modlog_combined::{ + api::{GetModlog, GetModlogResponse}, + AdminAllowInstanceView, + AdminBlockInstanceView, + AdminPurgeCommentView, + AdminPurgeCommunityView, + AdminPurgePersonView, + AdminPurgePostView, + ModAddCommunityView, + ModAddView, + ModBanFromCommunityView, + ModBanView, + ModChangeCommunityVisibilityView, + ModFeaturePostView, + ModLockPostView, + ModRemoveCommentView, + ModRemoveCommunityView, + ModRemovePostView, + ModTransferCommunityView, + ModlogCombinedView, +}; diff --git a/crates/api_common/src/oauth.rs b/crates/api_common/src/oauth.rs new file mode 100644 index 000000000..e91d5acd2 --- /dev/null +++ b/crates/api_common/src/oauth.rs @@ -0,0 +1,13 @@ +pub use lemmy_db_schema::{ + newtypes::OAuthProviderId, + source::{ + oauth_account::OAuthAccount, + oauth_provider::{OAuthProvider, PublicOAuthProvider}, + }, +}; +pub use lemmy_db_views_site::api::{ + AuthenticateWithOauth, + CreateOAuthProvider, + DeleteOAuthProvider, + EditOAuthProvider, +}; diff --git a/crates/api_common/src/oauth_provider.rs b/crates/api_common/src/oauth_provider.rs deleted file mode 100644 index 2f3344802..000000000 --- a/crates/api_common/src/oauth_provider.rs +++ /dev/null @@ -1,91 +0,0 @@ -use lemmy_db_schema::newtypes::OAuthProviderId; -use serde::{Deserialize, Serialize}; -use serde_with::skip_serializing_none; -#[cfg(feature = "full")] -use ts_rs::TS; -use url::Url; - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Create an external auth method. -pub struct CreateOAuthProvider { - pub display_name: String, - pub issuer: String, - pub authorization_endpoint: String, - pub token_endpoint: String, - pub userinfo_endpoint: String, - pub id_claim: String, - pub client_id: String, - pub client_secret: String, - pub scopes: String, - #[cfg_attr(feature = "full", ts(optional))] - pub auto_verify_email: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub account_linking_enabled: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub use_pkce: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub enabled: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Edit an external auth method. -pub struct EditOAuthProvider { - pub id: OAuthProviderId, - #[cfg_attr(feature = "full", ts(optional))] - pub display_name: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub authorization_endpoint: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub token_endpoint: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub userinfo_endpoint: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub id_claim: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub client_secret: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub scopes: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub auto_verify_email: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub account_linking_enabled: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub use_pkce: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub enabled: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Default)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Delete an external auth method. -pub struct DeleteOAuthProvider { - pub id: OAuthProviderId, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Logging in with an OAuth 2.0 authorization -pub struct AuthenticateWithOauth { - pub code: String, - pub oauth_provider_id: OAuthProviderId, - pub redirect_uri: Url, - #[cfg_attr(feature = "full", ts(optional))] - pub show_nsfw: Option, - /// Username is mandatory at registration time - #[cfg_attr(feature = "full", ts(optional))] - pub username: Option, - /// An answer is mandatory if require application is enabled on the server - #[cfg_attr(feature = "full", ts(optional))] - pub answer: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub pkce_code_verifier: Option, -} diff --git a/crates/api_common/src/person.rs b/crates/api_common/src/person.rs index c9beb2acd..0460dfd99 100644 --- a/crates/api_common/src/person.rs +++ b/crates/api_common/src/person.rs @@ -1,524 +1,35 @@ -use lemmy_db_schema::{ - newtypes::{ - CommentReplyId, - CommunityId, - LanguageId, - PaginationCursor, - PersonCommentMentionId, - PersonId, - PersonPostMentionId, +pub use lemmy_db_schema::{ + newtypes::{LocalUserId, PersonId}, + source::{ + local_user::LocalUser, + person::{Person, PersonActions}, }, - sensitive::SensitiveString, - source::{login_token::LoginToken, site::Site}, + PersonContentType, }; -use lemmy_db_schema_file::enums::{ - CommentSortType, - ListingType, - PostListingMode, - PostSortType, - VoteShow, +pub use lemmy_db_views_local_user::LocalUserView; +pub use lemmy_db_views_person::{ + api::{GetPersonDetails, GetPersonDetailsResponse}, + PersonView, }; -use lemmy_db_views_community_moderator::CommunityModeratorView; -use lemmy_db_views_local_image::LocalImageView; -use lemmy_db_views_person::PersonView; -use lemmy_db_views_post::PostView; -use serde::{Deserialize, Serialize}; -use serde_with::skip_serializing_none; -#[cfg(feature = "full")] -use ts_rs::TS; -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Logging into lemmy. -/// -/// Note: Banned users can still log in, to be able to do certain things like delete -/// their account. -pub struct Login { - pub username_or_email: SensitiveString, - pub password: SensitiveString, - /// May be required, if totp is enabled for their account. - #[cfg_attr(feature = "full", ts(optional))] - pub totp_2fa_token: Option, -} +pub mod actions { + pub use lemmy_db_schema::newtypes::PersonContentCombinedId; + pub use lemmy_db_views_person::api::{BlockPerson, BlockPersonResponse}; + pub use lemmy_db_views_person_content_combined::{ + ListPersonContent, + ListPersonContentResponse, + PersonContentCombinedView, + }; -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Register / Sign up to lemmy. -pub struct Register { - pub username: String, - pub password: SensitiveString, - pub password_verify: SensitiveString, - #[cfg_attr(feature = "full", ts(optional))] - pub show_nsfw: Option, - /// email is mandatory if email verification is enabled on the server - #[cfg_attr(feature = "full", ts(optional))] - pub email: Option, - /// The UUID of the captcha item. - #[cfg_attr(feature = "full", ts(optional))] - pub captcha_uuid: Option, - /// Your captcha answer. - #[cfg_attr(feature = "full", ts(optional))] - pub captcha_answer: Option, - /// A form field to trick signup bots. Should be None. - #[cfg_attr(feature = "full", ts(optional))] - pub honeypot: Option, - /// An answer is mandatory if require application is enabled on the server - #[cfg_attr(feature = "full", ts(optional))] - pub answer: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A wrapper for the captcha response. -pub struct GetCaptchaResponse { - /// Will be None if captchas are disabled. - #[cfg_attr(feature = "full", ts(optional))] - pub ok: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A captcha response. -pub struct CaptchaResponse { - /// A Base64 encoded png - pub png: String, - /// A Base64 encoded wav audio - pub wav: String, - /// The UUID for the captcha item. - pub uuid: String, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Saves settings for your user. -pub struct SaveUserSettings { - /// Show nsfw posts. - #[cfg_attr(feature = "full", ts(optional))] - pub show_nsfw: Option, - /// Blur nsfw posts. - #[cfg_attr(feature = "full", ts(optional))] - pub blur_nsfw: Option, - /// Your user's theme. - #[cfg_attr(feature = "full", ts(optional))] - pub theme: Option, - /// The default post listing type, usually "local" - #[cfg_attr(feature = "full", ts(optional))] - pub default_listing_type: Option, - /// A post-view mode that changes how multiple post listings look. - #[cfg_attr(feature = "full", ts(optional))] - pub post_listing_mode: Option, - /// The default post sort, usually "active" - #[cfg_attr(feature = "full", ts(optional))] - pub default_post_sort_type: Option, - /// A default time range limit to apply to post sorts, in seconds. 0 means none. - #[cfg_attr(feature = "full", ts(optional))] - pub default_post_time_range_seconds: Option, - /// The default comment sort, usually "hot" - #[cfg_attr(feature = "full", ts(optional))] - pub default_comment_sort_type: Option, - /// The language of the lemmy interface - #[cfg_attr(feature = "full", ts(optional))] - pub interface_language: Option, - /// Your display name, which can contain strange characters, and does not need to be unique. - #[cfg_attr(feature = "full", ts(optional))] - pub display_name: Option, - /// Your email. - #[cfg_attr(feature = "full", ts(optional))] - pub email: Option, - /// Your bio / info, in markdown. - #[cfg_attr(feature = "full", ts(optional))] - pub bio: Option, - /// Your matrix user id. Ex: @my_user:matrix.org - #[cfg_attr(feature = "full", ts(optional))] - pub matrix_user_id: Option, - /// Whether to show or hide avatars. - #[cfg_attr(feature = "full", ts(optional))] - pub show_avatars: Option, - /// Sends notifications to your email. - #[cfg_attr(feature = "full", ts(optional))] - pub send_notifications_to_email: Option, - /// Whether this account is a bot account. Users can hide these accounts easily if they wish. - #[cfg_attr(feature = "full", ts(optional))] - pub bot_account: Option, - /// Whether to show bot accounts. - #[cfg_attr(feature = "full", ts(optional))] - pub show_bot_accounts: Option, - /// Whether to show read posts. - #[cfg_attr(feature = "full", ts(optional))] - pub show_read_posts: Option, - /// A list of languages you are able to see discussion in. - #[cfg_attr(feature = "full", ts(optional))] - pub discussion_languages: Option>, - // A list of keywords used for blocking posts having them in title,url or body. - #[cfg_attr(feature = "full", ts(optional))] - pub blocking_keywords: Option>, - /// Open links in a new tab - #[cfg_attr(feature = "full", ts(optional))] - pub open_links_in_new_tab: Option, - /// Enable infinite scroll - #[cfg_attr(feature = "full", ts(optional))] - pub infinite_scroll_enabled: Option, - /// Whether to allow keyboard navigation (for browsing and interacting with posts and comments). - #[cfg_attr(feature = "full", ts(optional))] - pub enable_keyboard_navigation: Option, - /// Whether user avatars or inline images in the UI that are gifs should be allowed to play or - /// should be paused - #[cfg_attr(feature = "full", ts(optional))] - pub enable_animated_images: Option, - /// Whether a user can send / receive private messages - #[cfg_attr(feature = "full", ts(optional))] - pub enable_private_messages: Option, - /// Whether to auto-collapse bot comments. - #[cfg_attr(feature = "full", ts(optional))] - pub collapse_bot_comments: Option, - /// Some vote display mode settings - #[cfg_attr(feature = "full", ts(optional))] - pub show_scores: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub show_upvotes: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub show_downvotes: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub show_upvote_percentage: Option, - /// Whether to automatically mark fetched posts as read. - #[cfg_attr(feature = "full", ts(optional))] - pub auto_mark_fetched_posts_as_read: Option, - /// Whether to hide posts containing images/videos. - #[cfg_attr(feature = "full", ts(optional))] - pub hide_media: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Changes your account password. -pub struct ChangePassword { - pub new_password: SensitiveString, - pub new_password_verify: SensitiveString, - pub old_password: SensitiveString, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A response for your login. -pub struct LoginResponse { - /// This is None in response to `Register` if email verification is enabled, or the server - /// requires registration applications. - #[cfg_attr(feature = "full", ts(optional))] - pub jwt: Option, - /// If registration applications are required, this will return true for a signup response. - pub registration_created: bool, - /// If email verifications are required, this will return true for a signup response. - pub verify_email_sent: bool, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Gets a person's details. -/// -/// Either person_id, or username are required. -pub struct GetPersonDetails { - #[cfg_attr(feature = "full", ts(optional))] - pub person_id: Option, - /// Example: dessalines , or dessalines@xyz.tld - #[cfg_attr(feature = "full", ts(optional))] - pub username: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A person's details response. -pub struct GetPersonDetailsResponse { - pub person_view: PersonView, - #[cfg_attr(feature = "full", ts(optional))] - pub site: Option, - pub moderates: Vec, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Gets your read posts. -pub struct ListPersonRead { - #[cfg_attr(feature = "full", ts(optional))] - pub page_cursor: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_back: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub limit: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// You read posts response. -pub struct ListPersonReadResponse { - pub read: Vec, - /// the pagination cursor to use to fetch the next page - #[cfg_attr(feature = "full", ts(optional))] - pub next_page: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub prev_page: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Gets your hidden posts. -pub struct ListPersonHidden { - #[cfg_attr(feature = "full", ts(optional))] - pub page_cursor: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_back: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub limit: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// You hidden posts response. -pub struct ListPersonHiddenResponse { - pub hidden: Vec, - /// the pagination cursor to use to fetch the next page - #[cfg_attr(feature = "full", ts(optional))] - pub next_page: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub prev_page: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Adds an admin to a site. -pub struct AddAdmin { - pub person_id: PersonId, - pub added: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The response of current admins. -pub struct AddAdminResponse { - pub admins: Vec, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Ban a person from the site. -pub struct BanPerson { - pub person_id: PersonId, - pub ban: bool, - /// Optionally remove or restore all their data. Useful for new troll accounts. - /// If ban is true, then this means remove. If ban is false, it means restore. - #[cfg_attr(feature = "full", ts(optional))] - pub remove_or_restore_data: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub reason: Option, - /// A time that the ban will expire, in unix epoch seconds. - /// - /// An i64 unix timestamp is used for a simpler API client implementation. - #[cfg_attr(feature = "full", ts(optional))] - pub expires: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A response for a banned person. -pub struct BanPersonResponse { - pub person_view: PersonView, - pub banned: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Block a person. -pub struct BlockPerson { - pub person_id: PersonId, - pub block: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The response for a person block. -pub struct BlockPersonResponse { - pub person_view: PersonView, - pub blocked: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Mark a person mention as read. -pub struct MarkPersonCommentMentionAsRead { - pub person_comment_mention_id: PersonCommentMentionId, - pub read: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Mark a person mention as read. -pub struct MarkPersonPostMentionAsRead { - pub person_post_mention_id: PersonPostMentionId, - pub read: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Mark a comment reply as read. -pub struct MarkCommentReplyAsRead { - pub comment_reply_id: CommentReplyId, - pub read: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Delete your account. -pub struct DeleteAccount { - pub password: SensitiveString, - pub delete_content: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Reset your password via email. -pub struct PasswordReset { - pub email: SensitiveString, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Change your password after receiving a reset request. -pub struct PasswordChangeAfterReset { - pub token: SensitiveString, - pub password: SensitiveString, - pub password_verify: SensitiveString, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Get a count of the number of reports. -pub struct GetReportCount { - #[cfg_attr(feature = "full", ts(optional))] - pub community_id: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A response for the number of reports. -pub struct GetReportCountResponse { - pub count: i64, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A response containing a count of unread notifications. -pub struct GetUnreadCountResponse { - pub count: i64, -} - -#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Verify your email. -pub struct VerifyEmail { - pub token: String, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct GenerateTotpSecretResponse { - pub totp_secret_url: SensitiveString, -} - -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct UpdateTotp { - pub totp_token: String, - pub enabled: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct UpdateTotpResponse { - pub enabled: bool, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Get your user's image / media uploads. -pub struct ListMedia { - #[cfg_attr(feature = "full", ts(optional))] - pub page_cursor: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_back: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub limit: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct ListMediaResponse { - pub images: Vec, - /// the pagination cursor to use to fetch the next page - #[cfg_attr(feature = "full", ts(optional))] - pub next_page: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub prev_page: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct ListLoginsResponse { - pub logins: Vec, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Make a request to resend your verification email. -pub struct ResendVerificationEmail { - pub email: SensitiveString, + pub mod moderation { + pub use lemmy_db_schema::{ + newtypes::RegistrationApplicationId, + source::registration_application::RegistrationApplication, + }; + pub use lemmy_db_views_person::api::{BanPerson, BanPersonResponse, PurgePerson}; + pub use lemmy_db_views_registration_applications::{ + api::{GetRegistrationApplication, RegistrationApplicationResponse}, + RegistrationApplicationView, + }; + } } diff --git a/crates/api_common/src/plugin.rs b/crates/api_common/src/plugin.rs new file mode 100644 index 000000000..35efa7936 --- /dev/null +++ b/crates/api_common/src/plugin.rs @@ -0,0 +1 @@ +pub use lemmy_db_views_api_misc::PluginMetadata; diff --git a/crates/api_common/src/post.rs b/crates/api_common/src/post.rs index f58a61975..fa5b34028 100644 --- a/crates/api_common/src/post.rs +++ b/crates/api_common/src/post.rs @@ -1,328 +1,44 @@ -use lemmy_db_schema::{ - newtypes::{CommentId, CommunityId, DbUrl, LanguageId, PaginationCursor, PostId, TagId}, +pub use lemmy_db_schema::{ + newtypes::PostId, + source::post::{Post, PostActions}, PostFeatureType, }; -use lemmy_db_schema_file::enums::{ListingType, PostSortType}; -use lemmy_db_views_community::CommunityView; -use lemmy_db_views_post::PostView; -use lemmy_db_views_vote::VoteView; -use serde::{Deserialize, Serialize}; -use serde_with::skip_serializing_none; -#[cfg(feature = "full")] -use ts_rs::TS; +pub use lemmy_db_schema_file::enums::PostListingMode; +pub use lemmy_db_views_post::{ + api::{ + GetPost, + GetPostResponse, + GetPosts, + GetPostsResponse, + GetSiteMetadata, + GetSiteMetadataResponse, + LinkMetadata, + OpenGraphData, + PostResponse, + }, + PostView, +}; -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Create a post. -pub struct CreatePost { - pub name: String, - pub community_id: CommunityId, - #[cfg_attr(feature = "full", ts(optional))] - pub url: Option, - /// An optional body for the post in markdown. - #[cfg_attr(feature = "full", ts(optional))] - pub body: Option, - /// An optional alt_text, usable for image posts. - #[cfg_attr(feature = "full", ts(optional))] - pub alt_text: Option, - /// A honeypot to catch bots. Should be None. - #[cfg_attr(feature = "full", ts(optional))] - pub honeypot: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub nsfw: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub language_id: Option, - /// Instead of fetching a thumbnail, use a custom one. - #[cfg_attr(feature = "full", ts(optional))] - pub custom_thumbnail: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub tags: Option>, - /// Time when this post should be scheduled. Null means publish immediately. - #[cfg_attr(feature = "full", ts(optional))] - pub scheduled_publish_time: Option, -} +pub mod actions { + pub use lemmy_db_views_post::api::{ + CreatePost, + CreatePostLike, + DeletePost, + EditPost, + HidePost, + MarkManyPostsAsRead, + MarkPostAsRead, + SavePost, + }; -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct PostResponse { - pub post_view: PostView, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -// TODO this should be made into a tagged enum -/// Get a post. Needs either the post id, or comment_id. -pub struct GetPost { - #[cfg_attr(feature = "full", ts(optional))] - pub id: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub comment_id: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The post response. -pub struct GetPostResponse { - pub post_view: PostView, - pub community_view: CommunityView, - /// A list of cross-posts, or other times / communities this link has been posted to. - pub cross_posts: Vec, -} - -#[skip_serializing_none] -#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Get a list of posts. -pub struct GetPosts { - #[cfg_attr(feature = "full", ts(optional))] - pub type_: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub sort: Option, - #[cfg_attr(feature = "full", ts(optional))] - /// Filter to within a given time range, in seconds. - /// IE 60 would give results for the past minute. - /// Use Zero to override the local_site and local_user time_range. - pub time_range_seconds: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub community_id: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub community_name: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub show_hidden: Option, - /// If true, then show the read posts (even if your user setting is to hide them) - #[cfg_attr(feature = "full", ts(optional))] - pub show_read: Option, - /// If true, then show the nsfw posts (even if your user setting is to hide them) - #[cfg_attr(feature = "full", ts(optional))] - pub show_nsfw: Option, - /// If false, then show posts with media attached (even if your user setting is to hide them) - #[cfg_attr(feature = "full", ts(optional))] - pub hide_media: Option, - /// Whether to automatically mark fetched posts as read. - #[cfg_attr(feature = "full", ts(optional))] - pub mark_as_read: Option, - #[cfg_attr(feature = "full", ts(optional))] - /// If true, then only show posts with no comments - pub no_comments_only: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_cursor: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_back: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub limit: Option, -} - -#[skip_serializing_none] -#[derive(Serialize, Deserialize, Debug, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The post list response. -pub struct GetPostsResponse { - pub posts: Vec, - /// the pagination cursor to use to fetch the next page - #[cfg_attr(feature = "full", ts(optional))] - pub next_page: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub prev_page: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Like a post. -pub struct CreatePostLike { - pub post_id: PostId, - /// Score must be -1, 0, or 1. - pub score: i16, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Edit a post. -pub struct EditPost { - pub post_id: PostId, - #[cfg_attr(feature = "full", ts(optional))] - pub name: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub url: Option, - /// An optional body for the post in markdown. - #[cfg_attr(feature = "full", ts(optional))] - pub body: Option, - /// An optional alt_text, usable for image posts. - #[cfg_attr(feature = "full", ts(optional))] - pub alt_text: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub nsfw: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub language_id: Option, - /// Instead of fetching a thumbnail, use a custom one. - #[cfg_attr(feature = "full", ts(optional))] - pub custom_thumbnail: Option, - /// Time when this post should be scheduled. Null means publish immediately. - #[cfg_attr(feature = "full", ts(optional))] - pub scheduled_publish_time: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub tags: Option>, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Delete a post. -pub struct DeletePost { - pub post_id: PostId, - pub deleted: bool, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Remove a post (only doable by mods). -pub struct RemovePost { - pub post_id: PostId, - pub removed: bool, - #[cfg_attr(feature = "full", ts(optional))] - pub reason: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Mark a post as read. -pub struct MarkPostAsRead { - pub post_id: PostId, - pub read: bool, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Mark several posts as read. -pub struct MarkManyPostsAsRead { - pub post_ids: Vec, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Hide a post from list views -pub struct HidePost { - pub post_id: PostId, - pub hide: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Lock a post (prevent new comments). -pub struct LockPost { - pub post_id: PostId, - pub locked: bool, - #[cfg_attr(feature = "full", ts(optional))] - pub reason: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Feature a post (stickies / pins to the top). -pub struct FeaturePost { - pub post_id: PostId, - pub featured: bool, - pub feature_type: PostFeatureType, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Save / bookmark a post. -pub struct SavePost { - pub post_id: PostId, - pub save: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Get metadata for a given site. -pub struct GetSiteMetadata { - pub url: String, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The site metadata response. -pub struct GetSiteMetadataResponse { - pub metadata: LinkMetadata, -} - -#[skip_serializing_none] -#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone, Default, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Site metadata, from its opengraph tags. -pub struct LinkMetadata { - #[serde(flatten)] - pub opengraph_data: OpenGraphData, - #[cfg_attr(feature = "full", ts(optional))] - pub content_type: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone, Default, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Site metadata, from its opengraph tags. -pub struct OpenGraphData { - #[cfg_attr(feature = "full", ts(optional))] - pub title: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub description: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub(crate) image: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub embed_video_url: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// List post likes. Admins-only. -pub struct ListPostLikes { - pub post_id: PostId, - #[cfg_attr(feature = "full", ts(optional))] - pub page_cursor: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_back: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub limit: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The post likes response -pub struct ListPostLikesResponse { - pub post_likes: Vec, - /// the pagination cursor to use to fetch the next page - #[cfg_attr(feature = "full", ts(optional))] - pub next_page: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub prev_page: Option, + pub mod moderation { + pub use lemmy_db_views_post::api::{ + FeaturePost, + ListPostLikes, + ListPostLikesResponse, + LockPost, + PurgePost, + RemovePost, + }; + } } diff --git a/crates/api_common/src/private_message.rs b/crates/api_common/src/private_message.rs index 92d088afe..6ab75f6d1 100644 --- a/crates/api_common/src/private_message.rs +++ b/crates/api_common/src/private_message.rs @@ -1,49 +1,10 @@ -use lemmy_db_schema::newtypes::{PersonId, PrivateMessageId}; -use lemmy_db_views_private_message::PrivateMessageView; -use serde::{Deserialize, Serialize}; -#[cfg(feature = "full")] -use ts_rs::TS; +pub use lemmy_db_schema::{newtypes::PrivateMessageId, source::private_message::PrivateMessage}; +pub use lemmy_db_views_private_message::{api::PrivateMessageResponse, PrivateMessageView}; -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Create a private message. -pub struct CreatePrivateMessage { - pub content: String, - pub recipient_id: PersonId, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Edit a private message. -pub struct EditPrivateMessage { - pub private_message_id: PrivateMessageId, - pub content: String, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Delete a private message. -pub struct DeletePrivateMessage { - pub private_message_id: PrivateMessageId, - pub deleted: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Mark a private message as read. -pub struct MarkPrivateMessageAsRead { - pub private_message_id: PrivateMessageId, - pub read: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A single private message response. -pub struct PrivateMessageResponse { - pub private_message_view: PrivateMessageView, +pub mod actions { + pub use lemmy_db_views_private_message::api::{ + CreatePrivateMessage, + DeletePrivateMessage, + EditPrivateMessage, + }; } diff --git a/crates/api_common/src/report.rs b/crates/api_common/src/report.rs new file mode 100644 index 000000000..eaf571c96 --- /dev/null +++ b/crates/api_common/src/report.rs @@ -0,0 +1,36 @@ +pub use lemmy_db_schema::{ + newtypes::{CommentReportId, CommunityReportId, PostReportId, PrivateMessageReportId}, + source::{ + comment_report::CommentReport, + community_report::CommunityReport, + post_report::PostReport, + private_message_report::PrivateMessageReport, + }, + ReportType, +}; +pub use lemmy_db_views_report_combined::{ + api::{ListReports, ListReportsResponse}, + ReportCombinedView, +}; +pub use lemmy_db_views_reports::{ + api::{ + CommentReportResponse, + CommunityReportResponse, + CreateCommentReport, + CreateCommunityReport, + CreatePostReport, + CreatePrivateMessageReport, + GetReportCount, + GetReportCountResponse, + PostReportResponse, + PrivateMessageReportResponse, + ResolveCommentReport, + ResolveCommunityReport, + ResolvePostReport, + ResolvePrivateMessageReport, + }, + CommentReportView, + CommunityReportView, + PostReportView, + PrivateMessageReportView, +}; diff --git a/crates/api_common/src/reports/comment.rs b/crates/api_common/src/reports/comment.rs deleted file mode 100644 index 418b9411e..000000000 --- a/crates/api_common/src/reports/comment.rs +++ /dev/null @@ -1,33 +0,0 @@ -use lemmy_db_schema::newtypes::{CommentId, CommentReportId}; -use lemmy_db_views_reports::CommentReportView; -use serde::{Deserialize, Serialize}; -#[cfg(feature = "full")] -use ts_rs::TS; - -#[derive(Debug, Serialize, Deserialize, Clone, Default)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Report a comment. -pub struct CreateCommentReport { - pub comment_id: CommentId, - pub reason: String, - #[cfg_attr(feature = "full", ts(optional))] - pub violates_instance_rules: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The comment report response. -pub struct CommentReportResponse { - pub comment_report_view: CommentReportView, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Resolve a comment report (only doable by mods). -pub struct ResolveCommentReport { - pub report_id: CommentReportId, - pub resolved: bool, -} diff --git a/crates/api_common/src/reports/community.rs b/crates/api_common/src/reports/community.rs deleted file mode 100644 index e7aadad6a..000000000 --- a/crates/api_common/src/reports/community.rs +++ /dev/null @@ -1,31 +0,0 @@ -use lemmy_db_schema::newtypes::{CommunityId, CommunityReportId}; -use lemmy_db_views_reports::CommunityReportView; -use serde::{Deserialize, Serialize}; -#[cfg(feature = "full")] -use ts_rs::TS; - -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Create a report for a community. -pub struct CreateCommunityReport { - pub community_id: CommunityId, - pub reason: String, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A community report response. -pub struct CommunityReportResponse { - pub community_report_view: CommunityReportView, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Resolve a community report. -pub struct ResolveCommunityReport { - pub report_id: CommunityReportId, - pub resolved: bool, -} diff --git a/crates/api_common/src/reports/mod.rs b/crates/api_common/src/reports/mod.rs deleted file mode 100644 index a7139bc03..000000000 --- a/crates/api_common/src/reports/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod combined; -pub mod comment; -pub mod community; -pub mod post; -pub mod private_message; diff --git a/crates/api_common/src/reports/post.rs b/crates/api_common/src/reports/post.rs deleted file mode 100644 index 31ce72833..000000000 --- a/crates/api_common/src/reports/post.rs +++ /dev/null @@ -1,33 +0,0 @@ -use lemmy_db_schema::newtypes::{PostId, PostReportId}; -use lemmy_db_views_reports::PostReportView; -use serde::{Deserialize, Serialize}; -#[cfg(feature = "full")] -use ts_rs::TS; - -#[derive(Debug, Serialize, Deserialize, Clone, Default)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Create a post report. -pub struct CreatePostReport { - pub post_id: PostId, - pub reason: String, - #[cfg_attr(feature = "full", ts(optional))] - pub violates_instance_rules: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The post report response. -pub struct PostReportResponse { - pub post_report_view: PostReportView, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Resolve a post report (mods only). -pub struct ResolvePostReport { - pub report_id: PostReportId, - pub resolved: bool, -} diff --git a/crates/api_common/src/reports/private_message.rs b/crates/api_common/src/reports/private_message.rs deleted file mode 100644 index 790df6602..000000000 --- a/crates/api_common/src/reports/private_message.rs +++ /dev/null @@ -1,31 +0,0 @@ -use lemmy_db_schema::newtypes::{PrivateMessageId, PrivateMessageReportId}; -use lemmy_db_views_reports::PrivateMessageReportView; -use serde::{Deserialize, Serialize}; -#[cfg(feature = "full")] -use ts_rs::TS; - -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Create a report for a private message. -pub struct CreatePrivateMessageReport { - pub private_message_id: PrivateMessageId, - pub reason: String, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A private message report response. -pub struct PrivateMessageReportResponse { - pub private_message_report_view: PrivateMessageReportView, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Resolve a private message report. -pub struct ResolvePrivateMessageReport { - pub report_id: PrivateMessageReportId, - pub resolved: bool, -} diff --git a/crates/api_common/src/search.rs b/crates/api_common/src/search.rs new file mode 100644 index 000000000..9426e352c --- /dev/null +++ b/crates/api_common/src/search.rs @@ -0,0 +1,10 @@ +pub use lemmy_db_schema::{ + newtypes::{PaginationCursor, SearchCombinedId}, + source::combined::search::SearchCombined, + CommunitySortType, + PersonContentType, + SearchSortType, + SearchType, +}; +pub use lemmy_db_schema_file::enums::{CommentSortType, ListingType, PostSortType}; +pub use lemmy_db_views_search_combined::{Search, SearchCombinedView, SearchResponse}; diff --git a/crates/api_common/src/site.rs b/crates/api_common/src/site.rs index d0049a22a..409809b45 100644 --- a/crates/api_common/src/site.rs +++ b/crates/api_common/src/site.rs @@ -1,621 +1,26 @@ -use crate::federate_retry_sleep_duration; -use chrono::{DateTime, Utc}; -use lemmy_db_schema::{ - newtypes::{ - CommentId, - CommunityId, - InstanceId, - LanguageId, - PaginationCursor, - PersonId, - PostId, - RegistrationApplicationId, - }, +pub use lemmy_db_schema::{ + newtypes::{LocalSiteId, OAuthProviderId, SiteId}, source::{ - community::Community, - federation_queue_state::FederationQueueState, - instance::Instance, - language::Language, + local_site::LocalSite, + local_site_rate_limit::LocalSiteRateLimit, local_site_url_blocklist::LocalSiteUrlBlocklist, - oauth_provider::{OAuthProvider, PublicOAuthProvider}, - person::Person, - tagline::Tagline, + site::Site, }, - ModlogActionType, }; -use lemmy_db_schema_file::enums::{ - CommentSortType, - FederationMode, - ListingType, - PostListingMode, - PostSortType, - RegistrationMode, +pub use lemmy_db_schema_file::enums::RegistrationMode; +pub use lemmy_db_views_site::{ + api::{GetSiteResponse, SiteResponse}, + SiteView, }; -use lemmy_db_views_comment::CommentView; -use lemmy_db_views_community::CommunityView; -use lemmy_db_views_community_follower::CommunityFollowerView; -use lemmy_db_views_community_moderator::CommunityModeratorView; -use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_person::PersonView; -use lemmy_db_views_post::PostView; -use lemmy_db_views_registration_applications::RegistrationApplicationView; -use lemmy_db_views_site::SiteView; -use serde::{Deserialize, Serialize}; -use serde_with::skip_serializing_none; -use url::Url; -#[cfg(feature = "full")] -use {extism::FromBytes, extism_convert::encoding, extism_convert::Json, ts_rs::TS}; -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Does an apub fetch for an object. -pub struct ResolveObject { - /// Can be the full url, or a shortened version like: !fediverse@lemmy.ml - pub q: String, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Default)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -// TODO Change this to an enum -/// The response of an apub object fetch. -pub struct ResolveObjectResponse { - #[cfg_attr(feature = "full", ts(optional))] - pub comment: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub post: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub community: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub person: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Fetches the modlog. -pub struct GetModlog { - /// Filter by the moderator. - #[cfg_attr(feature = "full", ts(optional))] - pub mod_person_id: Option, - /// Filter by the community. - #[cfg_attr(feature = "full", ts(optional))] - pub community_id: Option, - /// Filter by the modlog action type. - #[cfg_attr(feature = "full", ts(optional))] - pub type_: Option, - /// Filter by listing type. When not using All, it will remove the non-community modlog entries, - /// such as site bans, instance blocks, adding an admin, etc. - #[cfg_attr(feature = "full", ts(optional))] - pub listing_type: Option, - /// Filter by the other / modded person. - #[cfg_attr(feature = "full", ts(optional))] - pub other_person_id: Option, - /// Filter by post. Will include comments of that post. - #[cfg_attr(feature = "full", ts(optional))] - pub post_id: Option, - /// Filter by comment. - #[cfg_attr(feature = "full", ts(optional))] - pub comment_id: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_cursor: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_back: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub limit: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Creates a site. Should be done after first running lemmy. -pub struct CreateSite { - pub name: String, - #[cfg_attr(feature = "full", ts(optional))] - pub sidebar: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub description: Option, - #[cfg_attr(feature = "full", ts(optional))] - #[cfg_attr(feature = "full", ts(optional))] - pub community_creation_admin_only: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub require_email_verification: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub application_question: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub private_instance: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub default_theme: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub default_post_listing_type: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub default_post_listing_mode: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub default_post_sort_type: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub default_post_time_range_seconds: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub default_comment_sort_type: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub legal_information: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub application_email_admins: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub discussion_languages: Option>, - #[cfg_attr(feature = "full", ts(optional))] - pub slur_filter_regex: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub actor_name_max_length: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_message: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_message_per_second: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_post: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_post_per_second: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_register: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_register_per_second: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_image: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_image_per_second: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_comment: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_comment_per_second: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_search: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_search_per_second: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub federation_enabled: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub captcha_enabled: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub captcha_difficulty: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub registration_mode: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub oauth_registration: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub content_warning: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub post_upvotes: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub post_downvotes: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub comment_upvotes: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub comment_downvotes: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub disallow_nsfw_content: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub disable_email_notifications: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Edits a site. -pub struct EditSite { - #[cfg_attr(feature = "full", ts(optional))] - pub name: Option, - /// A sidebar for the site, in markdown. - #[cfg_attr(feature = "full", ts(optional))] - pub sidebar: Option, - /// A shorter, one line description of your site. - #[cfg_attr(feature = "full", ts(optional))] - pub description: Option, - /// Limits community creation to admins only. - #[cfg_attr(feature = "full", ts(optional))] - pub community_creation_admin_only: Option, - /// Whether to require email verification. - #[cfg_attr(feature = "full", ts(optional))] - pub require_email_verification: Option, - /// Your application question form. This is in markdown, and can be many questions. - #[cfg_attr(feature = "full", ts(optional))] - pub application_question: Option, - /// Whether your instance is public, or private. - #[cfg_attr(feature = "full", ts(optional))] - pub private_instance: Option, - /// The default theme. Usually "browser" - #[cfg_attr(feature = "full", ts(optional))] - pub default_theme: Option, - /// The default post listing type, usually "local" - #[cfg_attr(feature = "full", ts(optional))] - pub default_post_listing_type: Option, - /// Default value for listing mode, usually "list" - #[cfg_attr(feature = "full", ts(optional))] - pub default_post_listing_mode: Option, - /// The default post sort, usually "active" - #[cfg_attr(feature = "full", ts(optional))] - pub default_post_sort_type: Option, - /// A default time range limit to apply to post sorts, in seconds. 0 means none. - #[cfg_attr(feature = "full", ts(optional))] - pub default_post_time_range_seconds: Option, - /// The default comment sort, usually "hot" - #[cfg_attr(feature = "full", ts(optional))] - pub default_comment_sort_type: Option, - /// An optional page of legal information - #[cfg_attr(feature = "full", ts(optional))] - pub legal_information: Option, - /// Whether to email admins when receiving a new application. - #[cfg_attr(feature = "full", ts(optional))] - pub application_email_admins: Option, - /// A list of allowed discussion languages. - #[cfg_attr(feature = "full", ts(optional))] - pub discussion_languages: Option>, - /// A regex string of items to filter. - #[cfg_attr(feature = "full", ts(optional))] - pub slur_filter_regex: Option, - /// The max length of actor names. - #[cfg_attr(feature = "full", ts(optional))] - pub actor_name_max_length: Option, - /// The number of messages allowed in a given time frame. - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_message: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_message_per_second: Option, - /// The number of posts allowed in a given time frame. - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_post: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_post_per_second: Option, - /// The number of registrations allowed in a given time frame. - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_register: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_register_per_second: Option, - /// The number of image uploads allowed in a given time frame. - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_image: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_image_per_second: Option, - /// The number of comments allowed in a given time frame. - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_comment: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_comment_per_second: Option, - /// The number of searches allowed in a given time frame. - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_search: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub rate_limit_search_per_second: Option, - /// Whether to enable federation. - #[cfg_attr(feature = "full", ts(optional))] - pub federation_enabled: Option, - /// Whether to enable captchas for signups. - #[cfg_attr(feature = "full", ts(optional))] - pub captcha_enabled: Option, - /// The captcha difficulty. Can be easy, medium, or hard - #[cfg_attr(feature = "full", ts(optional))] - pub captcha_difficulty: Option, - /// A list of blocked URLs - #[cfg_attr(feature = "full", ts(optional))] - pub blocked_urls: Option>, - #[cfg_attr(feature = "full", ts(optional))] - pub registration_mode: Option, - /// Whether to email admins for new reports. - #[cfg_attr(feature = "full", ts(optional))] - pub reports_email_admins: Option, - /// If present, nsfw content is visible by default. Should be displayed by frontends/clients - /// when the site is first opened by a user. - #[cfg_attr(feature = "full", ts(optional))] - pub content_warning: Option, - /// Whether or not external auth methods can auto-register users. - #[cfg_attr(feature = "full", ts(optional))] - pub oauth_registration: Option, - /// What kind of post upvotes your site allows. - #[cfg_attr(feature = "full", ts(optional))] - pub post_upvotes: Option, - /// What kind of post downvotes your site allows. - #[cfg_attr(feature = "full", ts(optional))] - pub post_downvotes: Option, - /// What kind of comment upvotes your site allows. - #[cfg_attr(feature = "full", ts(optional))] - pub comment_upvotes: Option, - /// What kind of comment downvotes your site allows. - #[cfg_attr(feature = "full", ts(optional))] - pub comment_downvotes: Option, - /// Block NSFW content being created - #[cfg_attr(feature = "full", ts(optional))] - pub disallow_nsfw_content: Option, - /// Dont send email notifications to users for new replies, mentions etc - #[cfg_attr(feature = "full", ts(optional))] - pub disable_email_notifications: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The response for a site. -pub struct SiteResponse { - pub site_view: SiteView, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// An expanded response for a site. -pub struct GetSiteResponse { - pub site_view: SiteView, - pub admins: Vec, - pub version: String, - #[cfg_attr(feature = "full", ts(skip))] - pub my_user: Option, - pub all_languages: Vec, - pub discussion_languages: Vec, - /// If the site has any taglines, a random one is included here for displaying - #[cfg_attr(feature = "full", ts(optional))] - pub tagline: Option, - /// A list of external auth methods your site supports. - pub oauth_providers: Vec, - pub admin_oauth_providers: Vec, - pub blocked_urls: Vec, - // If true then uploads for post images or markdown images are disabled. Only avatars, icons and - // banners can be set. - pub image_upload_disabled: bool, - pub active_plugins: Vec, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A response of federated instances. -pub struct GetFederatedInstancesResponse { - /// Optional, because federation may be disabled. - #[cfg_attr(feature = "full", ts(optional))] - pub federated_instances: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Your user info. -pub struct MyUserInfo { - pub local_user_view: LocalUserView, - pub follows: Vec, - pub moderates: Vec, - pub community_blocks: Vec, - pub instance_blocks: Vec, - pub person_blocks: Vec, - pub keyword_blocks: Vec, - pub discussion_languages: Vec, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A list of federated instances. -pub struct FederatedInstances { - pub linked: Vec, - pub allowed: Vec, - pub blocked: Vec, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct ReadableFederationState { - #[serde(flatten)] - internal_state: FederationQueueState, - /// timestamp of the next retry attempt (null if fail count is 0) - #[cfg_attr(feature = "full", ts(optional))] - next_retry: Option>, -} - -#[allow(clippy::expect_used)] -impl From for ReadableFederationState { - fn from(internal_state: FederationQueueState) -> Self { - ReadableFederationState { - next_retry: internal_state.last_retry.map(|r| { - r + chrono::Duration::from_std(federate_retry_sleep_duration(internal_state.fail_count)) - .expect("sleep duration longer than 2**63 ms (262 million years)") - }), - internal_state, - } - } -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct InstanceWithFederationState { - #[serde(flatten)] - pub instance: Instance, - /// if federation to this instance is or was active, show state of outgoing federation to this - /// instance - #[cfg_attr(feature = "full", ts(optional))] - pub federation_state: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Purges a person from the database. This will delete all content attached to that person. -pub struct PurgePerson { - pub person_id: PersonId, - #[cfg_attr(feature = "full", ts(optional))] - pub reason: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Purges a community from the database. This will delete all content attached to that community. -pub struct PurgeCommunity { - pub community_id: CommunityId, - #[cfg_attr(feature = "full", ts(optional))] - pub reason: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Purges a post from the database. This will delete all content attached to that post. -pub struct PurgePost { - pub post_id: PostId, - #[cfg_attr(feature = "full", ts(optional))] - pub reason: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Purges a comment from the database. This will delete all content attached to that comment. -pub struct PurgeComment { - pub comment_id: CommentId, - #[cfg_attr(feature = "full", ts(optional))] - pub reason: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Fetches a list of registration applications. -pub struct ListRegistrationApplications { - /// Only shows the unread applications (IE those without an admin actor) - #[cfg_attr(feature = "full", ts(optional))] - pub unread_only: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_cursor: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_back: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub limit: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The list of registration applications. -pub struct ListRegistrationApplicationsResponse { - pub registration_applications: Vec, - /// the pagination cursor to use to fetch the next page - #[cfg_attr(feature = "full", ts(optional))] - pub next_page: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub prev_page: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Gets a registration application for a person -pub struct GetRegistrationApplication { - pub person_id: PersonId, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Approves a registration application. -pub struct ApproveRegistrationApplication { - pub id: RegistrationApplicationId, - pub approve: bool, - #[cfg_attr(feature = "full", ts(optional))] - pub deny_reason: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The response of an action done to a registration application. -pub struct RegistrationApplicationResponse { - pub registration_application: RegistrationApplicationView, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The count of unread registration applications. -pub struct GetUnreadRegistrationApplicationCountResponse { - pub registration_applications: i64, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Block an instance as user -pub struct UserBlockInstanceParams { - pub instance_id: InstanceId, - pub block: bool, -} - -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct AdminBlockInstanceParams { - pub instance: String, - pub block: bool, - #[cfg_attr(feature = "full", ts(optional))] - pub reason: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub expires: Option>, -} - -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct AdminAllowInstanceParams { - pub instance: String, - pub allow: bool, - #[cfg_attr(feature = "full", ts(optional))] - pub reason: Option, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[cfg_attr(feature = "full", derive(TS, FromBytes))] -#[cfg_attr(feature = "full", ts(export))] -#[cfg_attr(feature = "full", encoding(Json))] -pub struct PluginMetadata { - name: String, - url: Url, - description: String, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct AdminListUsers { - #[cfg_attr(feature = "full", ts(optional))] - pub banned_only: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_cursor: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_back: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub limit: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct AdminListUsersResponse { - pub users: Vec, - /// the pagination cursor to use to fetch the next page - #[cfg_attr(feature = "full", ts(optional))] - pub next_page: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub prev_page: Option, +pub mod administration { + pub use lemmy_db_views_inbox_combined::api::GetUnreadRegistrationApplicationCountResponse; + pub use lemmy_db_views_local_user::api::{AdminListUsers, AdminListUsersResponse}; + pub use lemmy_db_views_person::api::{AddAdmin, AddAdminResponse}; + pub use lemmy_db_views_registration_applications::api::{ + ApproveRegistrationApplication, + ListRegistrationApplications, + ListRegistrationApplicationsResponse, + }; + pub use lemmy_db_views_site::api::{CreateSite, EditSite}; } diff --git a/crates/api_common/src/tagline.rs b/crates/api_common/src/tagline.rs index c7885ce7a..9b836c4ff 100644 --- a/crates/api_common/src/tagline.rs +++ b/crates/api_common/src/tagline.rs @@ -1,67 +1,6 @@ -use lemmy_db_schema::{ - newtypes::{PaginationCursor, TaglineId}, - source::tagline::Tagline, -}; -use serde::{Deserialize, Serialize}; -use serde_with::skip_serializing_none; -#[cfg(feature = "full")] -use ts_rs::TS; +pub use lemmy_db_schema::{newtypes::TaglineId, source::tagline::Tagline}; +pub use lemmy_db_views_site::api::{ListTaglines, ListTaglinesResponse, TaglineResponse}; -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Create a tagline -pub struct CreateTagline { - pub content: String, -} - -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Update a tagline -pub struct UpdateTagline { - pub id: TaglineId, - pub content: String, -} - -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Delete a tagline -pub struct DeleteTagline { - pub id: TaglineId, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct TaglineResponse { - pub tagline: Tagline, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// A response for taglines. -pub struct ListTaglinesResponse { - pub taglines: Vec, - /// the pagination cursor to use to fetch the next page - #[cfg_attr(feature = "full", ts(optional))] - pub next_page: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub prev_page: Option, -} - -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// Fetches a list of taglines. -pub struct ListTaglines { - #[cfg_attr(feature = "full", ts(optional))] - pub page_cursor: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub page_back: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub limit: Option, +pub mod aministration { + pub use lemmy_db_views_site::api::{CreateSite, DeleteTagline, UpdateTagline}; } diff --git a/crates/api_crud/Cargo.toml b/crates/api_crud/Cargo.toml index e1fde84af..36e4f7540 100644 --- a/crates/api_crud/Cargo.toml +++ b/crates/api_crud/Cargo.toml @@ -14,6 +14,7 @@ rust-version.workspace = true workspace = true [dependencies] +lemmy_db_views_api_misc = { workspace = true, features = ["full"] } lemmy_db_views_comment = { workspace = true, features = ["full"] } lemmy_db_views_community = { workspace = true, features = ["full"] } lemmy_db_views_community_moderator = { workspace = true, features = ["full"] } @@ -23,11 +24,14 @@ lemmy_db_views_local_user = { workspace = true, features = ["full"] } lemmy_db_views_person = { workspace = true, features = ["full"] } lemmy_db_views_custom_emoji = { workspace = true, features = ["full"] } lemmy_db_views_private_message = { workspace = true, features = ["full"] } +lemmy_db_views_registration_applications = { workspace = true, features = [ + "full", +] } lemmy_db_views_search_combined = { workspace = true, features = ["full"] } lemmy_db_views_site = { workspace = true, features = ["full"] } lemmy_utils = { workspace = true, features = ["full"] } lemmy_db_schema = { workspace = true, features = ["full"] } -lemmy_api_common = { workspace = true, features = ["full"] } +lemmy_api_utils = { workspace = true, features = ["full"] } lemmy_db_schema_file = { workspace = true } lemmy_email = { workspace = true } activitypub_federation = { workspace = true } diff --git a/crates/api_crud/src/comment/create.rs b/crates/api_crud/src/comment/create.rs index 5460df75f..a28b041ea 100644 --- a/crates/api_crud/src/comment/create.rs +++ b/crates/api_crud/src/comment/create.rs @@ -1,9 +1,8 @@ use crate::community_use_pending; use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::{build_comment_response, send_local_notifs}, - comment::{CommentResponse, CreateComment}, context::LemmyContext, plugins::{plugin_hook_after, plugin_hook_before}, send_activity::{ActivityChannel, SendActivityData}, @@ -27,6 +26,7 @@ use lemmy_db_schema::{ }, traits::{Crud, Likeable}, }; +use lemmy_db_views_comment::api::{CommentResponse, CreateComment}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_post::PostView; use lemmy_db_views_site::SiteView; diff --git a/crates/api_crud/src/comment/delete.rs b/crates/api_crud/src/comment/delete.rs index b257ca8b0..9362ce768 100644 --- a/crates/api_crud/src/comment/delete.rs +++ b/crates/api_crud/src/comment/delete.rs @@ -1,8 +1,7 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::{build_comment_response, send_local_notifs}, - comment::{CommentResponse, DeleteComment}, context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, utils::check_community_user_action, @@ -12,7 +11,10 @@ use lemmy_db_schema::{ source::comment::{Comment, CommentUpdateForm}, traits::Crud, }; -use lemmy_db_views_comment::CommentView; +use lemmy_db_views_comment::{ + api::{CommentResponse, DeleteComment}, + CommentView, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api_crud/src/comment/read.rs b/crates/api_crud/src/comment/read.rs index 0e5372fac..d4da80665 100644 --- a/crates/api_crud/src/comment/read.rs +++ b/crates/api_crud/src/comment/read.rs @@ -1,10 +1,10 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::build_comment_response, - comment::{CommentResponse, GetComment}, context::LemmyContext, utils::check_private_instance, }; +use lemmy_db_views_comment::api::{CommentResponse, GetComment}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::SiteView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api_crud/src/comment/remove.rs b/crates/api_crud/src/comment/remove.rs index 3b31e5f6f..5fa627074 100644 --- a/crates/api_crud/src/comment/remove.rs +++ b/crates/api_crud/src/comment/remove.rs @@ -1,8 +1,7 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::{build_comment_response, send_local_notifs}, - comment::{CommentResponse, RemoveComment}, context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, utils::check_community_mod_action, @@ -17,7 +16,10 @@ use lemmy_db_schema::{ }, traits::{Crud, Reportable}, }; -use lemmy_db_views_comment::CommentView; +use lemmy_db_views_comment::{ + api::{CommentResponse, RemoveComment}, + CommentView, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api_crud/src/comment/update.rs b/crates/api_crud/src/comment/update.rs index b3c386c19..be8f2eee7 100644 --- a/crates/api_crud/src/comment/update.rs +++ b/crates/api_crud/src/comment/update.rs @@ -1,9 +1,8 @@ use activitypub_federation::config::Data; use actix_web::web::Json; use chrono::Utc; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::{build_comment_response, send_local_notifs}, - comment::{CommentResponse, EditComment}, context::LemmyContext, plugins::{plugin_hook_after, plugin_hook_before}, send_activity::{ActivityChannel, SendActivityData}, @@ -15,7 +14,10 @@ use lemmy_db_schema::{ source::comment::{Comment, CommentUpdateForm}, traits::Crud, }; -use lemmy_db_views_comment::CommentView; +use lemmy_db_views_comment::{ + api::{CommentResponse, EditComment}, + CommentView, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::{ error::{LemmyErrorType, LemmyResult}, diff --git a/crates/api_crud/src/community/create.rs b/crates/api_crud/src/community/create.rs index b08282183..964560b0f 100644 --- a/crates/api_crud/src/community/create.rs +++ b/crates/api_crud/src/community/create.rs @@ -1,9 +1,8 @@ use super::check_community_visibility_allowed; use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::build_community_response, - community::{CommunityResponse, CreateCommunity}, context::LemmyContext, utils::{ check_nsfw_allowed, @@ -29,6 +28,7 @@ use lemmy_db_schema::{ traits::{ApubActor, Crud, Followable, Joinable}, }; use lemmy_db_schema_file::enums::CommunityFollowerState; +use lemmy_db_views_community::api::{CommunityResponse, CreateCommunity}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::SiteView; use lemmy_utils::{ diff --git a/crates/api_crud/src/community/delete.rs b/crates/api_crud/src/community/delete.rs index dcbd73a57..7dc0808cf 100644 --- a/crates/api_crud/src/community/delete.rs +++ b/crates/api_crud/src/community/delete.rs @@ -1,8 +1,7 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::build_community_response, - community::{CommunityResponse, DeleteCommunity}, context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, utils::{check_community_mod_action, is_top_mod}, @@ -11,6 +10,7 @@ use lemmy_db_schema::{ source::community::{Community, CommunityUpdateForm}, traits::Crud, }; +use lemmy_db_views_community::api::{CommunityResponse, DeleteCommunity}; use lemmy_db_views_community_moderator::CommunityModeratorView; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api_crud/src/community/list.rs b/crates/api_crud/src/community/list.rs index cc2363854..2c9f0b5f6 100644 --- a/crates/api_crud/src/community/list.rs +++ b/crates/api_crud/src/community/list.rs @@ -1,11 +1,11 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ - community::{ListCommunities, ListCommunitiesResponse}, - context::LemmyContext, - utils::check_private_instance, -}; +use lemmy_api_utils::{context::LemmyContext, utils::check_private_instance}; use lemmy_db_schema::traits::PaginationCursorBuilder; -use lemmy_db_views_community::{impls::CommunityQuery, CommunityView}; +use lemmy_db_views_community::{ + api::{ListCommunities, ListCommunitiesResponse}, + impls::CommunityQuery, + CommunityView, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::SiteView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api_crud/src/community/mod.rs b/crates/api_crud/src/community/mod.rs index 6a7bccd20..346908c9f 100644 --- a/crates/api_crud/src/community/mod.rs +++ b/crates/api_crud/src/community/mod.rs @@ -1,4 +1,4 @@ -use lemmy_api_common::utils::is_admin; +use lemmy_api_utils::utils::is_admin; use lemmy_db_schema_file::enums::CommunityVisibility; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api_crud/src/community/remove.rs b/crates/api_crud/src/community/remove.rs index f5a8fbcc5..34119f2c6 100644 --- a/crates/api_crud/src/community/remove.rs +++ b/crates/api_crud/src/community/remove.rs @@ -1,8 +1,7 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::build_community_response, - community::{CommunityResponse, RemoveCommunity}, context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, utils::{check_community_mod_action, is_admin}, @@ -15,6 +14,7 @@ use lemmy_db_schema::{ }, traits::{Crud, Reportable}, }; +use lemmy_db_views_community::api::{CommunityResponse, RemoveCommunity}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api_crud/src/community/update.rs b/crates/api_crud/src/community/update.rs index fe59fcd5a..0953db4f5 100644 --- a/crates/api_crud/src/community/update.rs +++ b/crates/api_crud/src/community/update.rs @@ -2,9 +2,8 @@ use super::check_community_visibility_allowed; use activitypub_federation::config::Data; use actix_web::web::Json; use chrono::Utc; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::build_community_response, - community::{CommunityResponse, EditCommunity}, context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, utils::{ @@ -24,6 +23,7 @@ use lemmy_db_schema::{ traits::Crud, utils::diesel_string_update, }; +use lemmy_db_views_community::api::{CommunityResponse, EditCommunity}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::SiteView; use lemmy_utils::{ diff --git a/crates/api_crud/src/custom_emoji/create.rs b/crates/api_crud/src/custom_emoji/create.rs index c334a7c3c..7c0d9b65e 100644 --- a/crates/api_crud/src/custom_emoji/create.rs +++ b/crates/api_crud/src/custom_emoji/create.rs @@ -1,10 +1,6 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ - context::LemmyContext, - custom_emoji::{CreateCustomEmoji, CustomEmojiResponse}, - utils::is_admin, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::{ source::{ custom_emoji::{CustomEmoji, CustomEmojiInsertForm}, @@ -12,7 +8,10 @@ use lemmy_db_schema::{ }, traits::Crud, }; -use lemmy_db_views_custom_emoji::CustomEmojiView; +use lemmy_db_views_custom_emoji::{ + api::{CreateCustomEmoji, CustomEmojiResponse}, + CustomEmojiView, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api_crud/src/custom_emoji/delete.rs b/crates/api_crud/src/custom_emoji/delete.rs index 37b01d9dc..79aa88907 100644 --- a/crates/api_crud/src/custom_emoji/delete.rs +++ b/crates/api_crud/src/custom_emoji/delete.rs @@ -1,12 +1,9 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ - context::LemmyContext, - custom_emoji::DeleteCustomEmoji, - utils::is_admin, - SuccessResponse, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::{source::custom_emoji::CustomEmoji, traits::Crud}; +use lemmy_db_views_api_misc::SuccessResponse; +use lemmy_db_views_custom_emoji::api::DeleteCustomEmoji; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api_crud/src/custom_emoji/list.rs b/crates/api_crud/src/custom_emoji/list.rs index ea20ee85f..c8b9adac0 100644 --- a/crates/api_crud/src/custom_emoji/list.rs +++ b/crates/api_crud/src/custom_emoji/list.rs @@ -1,9 +1,9 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - custom_emoji::{ListCustomEmojis, ListCustomEmojisResponse}, +use lemmy_api_utils::context::LemmyContext; +use lemmy_db_views_custom_emoji::{ + api::{ListCustomEmojis, ListCustomEmojisResponse}, + CustomEmojiView, }; -use lemmy_db_views_custom_emoji::CustomEmojiView; use lemmy_utils::error::LemmyError; pub async fn list_custom_emojis( diff --git a/crates/api_crud/src/custom_emoji/update.rs b/crates/api_crud/src/custom_emoji/update.rs index c580963ae..cc7244a92 100644 --- a/crates/api_crud/src/custom_emoji/update.rs +++ b/crates/api_crud/src/custom_emoji/update.rs @@ -1,10 +1,6 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ - context::LemmyContext, - custom_emoji::{CustomEmojiResponse, EditCustomEmoji}, - utils::is_admin, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::{ source::{ custom_emoji::{CustomEmoji, CustomEmojiUpdateForm}, @@ -12,7 +8,10 @@ use lemmy_db_schema::{ }, traits::Crud, }; -use lemmy_db_views_custom_emoji::CustomEmojiView; +use lemmy_db_views_custom_emoji::{ + api::{CustomEmojiResponse, EditCustomEmoji}, + CustomEmojiView, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/api_crud/src/lib.rs b/crates/api_crud/src/lib.rs index 250677eac..03d7190cc 100644 --- a/crates/api_crud/src/lib.rs +++ b/crates/api_crud/src/lib.rs @@ -1,4 +1,4 @@ -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::source::community::{Community, CommunityActions}; pub mod comment; diff --git a/crates/api_crud/src/oauth_provider/create.rs b/crates/api_crud/src/oauth_provider/create.rs index 215dd42ad..6bd8c31d3 100644 --- a/crates/api_crud/src/oauth_provider/create.rs +++ b/crates/api_crud/src/oauth_provider/create.rs @@ -1,15 +1,12 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ - context::LemmyContext, - oauth_provider::CreateOAuthProvider, - utils::is_admin, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::{ source::oauth_provider::{OAuthProvider, OAuthProviderInsertForm}, traits::Crud, }; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_site::api::CreateOAuthProvider; use lemmy_utils::error::LemmyError; use url::Url; diff --git a/crates/api_crud/src/oauth_provider/delete.rs b/crates/api_crud/src/oauth_provider/delete.rs index b8702b0c3..7458b5db4 100644 --- a/crates/api_crud/src/oauth_provider/delete.rs +++ b/crates/api_crud/src/oauth_provider/delete.rs @@ -1,13 +1,10 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ - context::LemmyContext, - oauth_provider::DeleteOAuthProvider, - utils::is_admin, - SuccessResponse, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::{source::oauth_provider::OAuthProvider, traits::Crud}; +use lemmy_db_views_api_misc::SuccessResponse; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_site::api::DeleteOAuthProvider; use lemmy_utils::error::LemmyError; pub async fn delete_oauth_provider( diff --git a/crates/api_crud/src/oauth_provider/update.rs b/crates/api_crud/src/oauth_provider/update.rs index 520770fc9..1a6542a54 100644 --- a/crates/api_crud/src/oauth_provider/update.rs +++ b/crates/api_crud/src/oauth_provider/update.rs @@ -1,13 +1,14 @@ use activitypub_federation::config::Data; use actix_web::web::Json; use chrono::Utc; -use lemmy_api_common::{context::LemmyContext, oauth_provider::EditOAuthProvider, utils::is_admin}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::{ source::oauth_provider::{OAuthProvider, OAuthProviderUpdateForm}, traits::Crud, utils::{diesel_required_string_update, diesel_required_url_update}, }; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_site::api::EditOAuthProvider; use lemmy_utils::error::LemmyError; pub async fn update_oauth_provider( diff --git a/crates/api_crud/src/post/create.rs b/crates/api_crud/src/post/create.rs index fefe82de3..853f04105 100644 --- a/crates/api_crud/src/post/create.rs +++ b/crates/api_crud/src/post/create.rs @@ -2,11 +2,10 @@ use super::convert_published_time; use crate::community_use_pending; use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::{build_post_response, send_local_notifs}, context::LemmyContext, plugins::{plugin_hook_after, plugin_hook_before}, - post::{CreatePost, PostResponse}, request::generate_post_link_metadata, send_activity::SendActivityData, tags::update_post_tags, @@ -30,6 +29,7 @@ use lemmy_db_schema::{ use lemmy_db_views_community::CommunityView; use lemmy_db_views_community_moderator::CommunityModeratorView; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_post::api::{CreatePost, PostResponse}; use lemmy_db_views_site::SiteView; use lemmy_utils::{ error::LemmyResult, diff --git a/crates/api_crud/src/post/delete.rs b/crates/api_crud/src/post/delete.rs index 0993857d5..5de1c1e92 100644 --- a/crates/api_crud/src/post/delete.rs +++ b/crates/api_crud/src/post/delete.rs @@ -1,9 +1,8 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::build_post_response, context::LemmyContext, - post::{DeletePost, PostResponse}, send_activity::{ActivityChannel, SendActivityData}, utils::check_community_user_action, }; @@ -15,6 +14,7 @@ use lemmy_db_schema::{ traits::Crud, }; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_post::api::{DeletePost, PostResponse}; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; pub async fn delete_post( diff --git a/crates/api_crud/src/post/mod.rs b/crates/api_crud/src/post/mod.rs index 825d7c1ba..a905387fb 100644 --- a/crates/api_crud/src/post/mod.rs +++ b/crates/api_crud/src/post/mod.rs @@ -1,5 +1,5 @@ use chrono::{DateTime, TimeZone, Utc}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::source::post::Post; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api_crud/src/post/read.rs b/crates/api_crud/src/post/read.rs index 7c8ef9ae3..12bc2907e 100644 --- a/crates/api_crud/src/post/read.rs +++ b/crates/api_crud/src/post/read.rs @@ -1,7 +1,6 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - post::{GetPost, GetPostResponse}, utils::{check_private_instance, is_mod_or_admin_opt, update_read_comments}, }; use lemmy_db_schema::{ @@ -14,7 +13,10 @@ use lemmy_db_schema::{ }; use lemmy_db_views_community::CommunityView; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_post::PostView; +use lemmy_db_views_post::{ + api::{GetPost, GetPostResponse}, + PostView, +}; use lemmy_db_views_search_combined::impls::SearchCombinedQuery; use lemmy_db_views_site::SiteView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api_crud/src/post/remove.rs b/crates/api_crud/src/post/remove.rs index 01ded489a..fb9b51c8c 100644 --- a/crates/api_crud/src/post/remove.rs +++ b/crates/api_crud/src/post/remove.rs @@ -1,9 +1,8 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::build_post_response, context::LemmyContext, - post::{PostResponse, RemovePost}, send_activity::{ActivityChannel, SendActivityData}, utils::check_community_mod_action, }; @@ -18,6 +17,7 @@ use lemmy_db_schema::{ traits::{Crud, Reportable}, }; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_post::api::{PostResponse, RemovePost}; use lemmy_utils::error::LemmyResult; pub async fn remove_post( diff --git a/crates/api_crud/src/post/update.rs b/crates/api_crud/src/post/update.rs index 096121645..638048055 100644 --- a/crates/api_crud/src/post/update.rs +++ b/crates/api_crud/src/post/update.rs @@ -2,11 +2,10 @@ use super::convert_published_time; use activitypub_federation::config::Data; use actix_web::web::Json; use chrono::Utc; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::{build_post_response, send_local_notifs}, context::LemmyContext, plugins::{plugin_hook_after, plugin_hook_before}, - post::{EditPost, PostResponse}, request::generate_post_link_metadata, send_activity::SendActivityData, tags::update_post_tags, @@ -31,7 +30,10 @@ use lemmy_db_schema::{ }; use lemmy_db_views_community::CommunityView; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_post::PostView; +use lemmy_db_views_post::{ + api::{EditPost, PostResponse}, + PostView, +}; use lemmy_db_views_site::SiteView; use lemmy_utils::{ error::{LemmyErrorType, LemmyResult}, diff --git a/crates/api_crud/src/private_message/create.rs b/crates/api_crud/src/private_message/create.rs index 754385b51..e55904803 100644 --- a/crates/api_crud/src/private_message/create.rs +++ b/crates/api_crud/src/private_message/create.rs @@ -1,9 +1,8 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, plugins::{plugin_hook_after, plugin_hook_before}, - private_message::{CreatePrivateMessage, PrivateMessageResponse}, send_activity::{ActivityChannel, SendActivityData}, utils::{check_private_messages_enabled, get_url_blocklist, process_markdown, slur_regex}, }; @@ -15,7 +14,10 @@ use lemmy_db_schema::{ traits::{Blockable, Crud}, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_private_message::PrivateMessageView; +use lemmy_db_views_private_message::{ + api::{CreatePrivateMessage, PrivateMessageResponse}, + PrivateMessageView, +}; use lemmy_email::notifications::send_private_message_email; use lemmy_utils::{error::LemmyResult, utils::validation::is_valid_body_field}; diff --git a/crates/api_crud/src/private_message/delete.rs b/crates/api_crud/src/private_message/delete.rs index 770854ac7..f0f5a0b08 100644 --- a/crates/api_crud/src/private_message/delete.rs +++ b/crates/api_crud/src/private_message/delete.rs @@ -1,8 +1,7 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - private_message::{DeletePrivateMessage, PrivateMessageResponse}, send_activity::{ActivityChannel, SendActivityData}, }; use lemmy_db_schema::{ @@ -10,7 +9,10 @@ use lemmy_db_schema::{ traits::Crud, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_private_message::PrivateMessageView; +use lemmy_db_views_private_message::{ + api::{DeletePrivateMessage, PrivateMessageResponse}, + PrivateMessageView, +}; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; pub async fn delete_private_message( diff --git a/crates/api_crud/src/private_message/update.rs b/crates/api_crud/src/private_message/update.rs index 1ebc1fd20..8d254b1ad 100644 --- a/crates/api_crud/src/private_message/update.rs +++ b/crates/api_crud/src/private_message/update.rs @@ -1,10 +1,9 @@ use activitypub_federation::config::Data; use actix_web::web::Json; use chrono::Utc; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, plugins::{plugin_hook_after, plugin_hook_before}, - private_message::{EditPrivateMessage, PrivateMessageResponse}, send_activity::{ActivityChannel, SendActivityData}, utils::{get_url_blocklist, process_markdown, slur_regex}, }; @@ -13,7 +12,10 @@ use lemmy_db_schema::{ traits::Crud, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_private_message::PrivateMessageView; +use lemmy_db_views_private_message::{ + api::{EditPrivateMessage, PrivateMessageResponse}, + PrivateMessageView, +}; use lemmy_utils::{ error::{LemmyErrorType, LemmyResult}, utils::validation::is_valid_body_field, diff --git a/crates/api_crud/src/site/create.rs b/crates/api_crud/src/site/create.rs index f741df361..528b6bfc3 100644 --- a/crates/api_crud/src/site/create.rs +++ b/crates/api_crud/src/site/create.rs @@ -3,9 +3,8 @@ use crate::site::{application_question_check, site_default_post_listing_type_che use activitypub_federation::{config::Data, http_signatures::generate_actor_keypair}; use actix_web::web::Json; use chrono::Utc; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - site::{CreateSite, SiteResponse}, utils::{ generate_inbox_url, get_url_blocklist, @@ -26,7 +25,10 @@ use lemmy_db_schema::{ utils::diesel_string_update, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_site::SiteView; +use lemmy_db_views_site::{ + api::{CreateSite, SiteResponse}, + SiteView, +}; use lemmy_utils::{ error::{LemmyErrorType, LemmyResult}, utils::{ @@ -180,9 +182,9 @@ fn validate_create_payload(local_site: &LocalSite, create_site: &CreateSite) -> mod tests { use crate::site::create::validate_create_payload; - use lemmy_api_common::site::CreateSite; use lemmy_db_schema::source::local_site::LocalSite; use lemmy_db_schema_file::enums::{ListingType, PostSortType, RegistrationMode}; + use lemmy_db_views_site::api::CreateSite; use lemmy_utils::error::LemmyErrorType; #[test] diff --git a/crates/api_crud/src/site/read.rs b/crates/api_crud/src/site/read.rs index 3eace9669..46155a5a6 100644 --- a/crates/api_crud/src/site/read.rs +++ b/crates/api_crud/src/site/read.rs @@ -1,5 +1,5 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{context::LemmyContext, plugins::plugin_metadata, site::GetSiteResponse}; +use lemmy_api_utils::{context::LemmyContext, plugins::plugin_metadata}; use lemmy_db_schema::source::{ actor_language::SiteLanguage, language::Language, @@ -9,7 +9,7 @@ use lemmy_db_schema::source::{ }; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_person::impls::PersonQuery; -use lemmy_db_views_site::SiteView; +use lemmy_db_views_site::{api::GetSiteResponse, SiteView}; use lemmy_utils::{build_cache, error::LemmyResult, CacheLock, VERSION}; use std::sync::LazyLock; diff --git a/crates/api_crud/src/site/update.rs b/crates/api_crud/src/site/update.rs index dd4c4c2fa..ee26ba086 100644 --- a/crates/api_crud/src/site/update.rs +++ b/crates/api_crud/src/site/update.rs @@ -3,9 +3,8 @@ use crate::site::{application_question_check, site_default_post_listing_type_che use activitypub_federation::config::Data; use actix_web::web::Json; use chrono::Utc; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - site::{EditSite, SiteResponse}, utils::{ get_url_blocklist, is_admin, @@ -28,7 +27,10 @@ use lemmy_db_schema::{ }; use lemmy_db_schema_file::enums::RegistrationMode; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_site::SiteView; +use lemmy_db_views_site::{ + api::{EditSite, SiteResponse}, + SiteView, +}; use lemmy_utils::{ error::LemmyResult, utils::{ @@ -222,9 +224,9 @@ fn validate_update_payload(local_site: &LocalSite, edit_site: &EditSite) -> Lemm mod tests { use crate::site::update::validate_update_payload; - use lemmy_api_common::site::EditSite; use lemmy_db_schema::source::local_site::LocalSite; use lemmy_db_schema_file::enums::{ListingType, PostSortType, RegistrationMode}; + use lemmy_db_views_site::api::EditSite; use lemmy_utils::error::LemmyErrorType; #[test] diff --git a/crates/api_crud/src/tagline/create.rs b/crates/api_crud/src/tagline/create.rs index fc24b639d..490480136 100644 --- a/crates/api_crud/src/tagline/create.rs +++ b/crates/api_crud/src/tagline/create.rs @@ -1,15 +1,16 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - tagline::{CreateTagline, TaglineResponse}, utils::{get_url_blocklist, is_admin, process_markdown, slur_regex}, }; use lemmy_db_schema::{ source::tagline::{Tagline, TaglineInsertForm}, traits::Crud, }; +use lemmy_db_views_api_misc::CreateTagline; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_site::api::TaglineResponse; use lemmy_utils::error::LemmyError; pub async fn create_tagline( diff --git a/crates/api_crud/src/tagline/delete.rs b/crates/api_crud/src/tagline/delete.rs index 01181b309..d351b7443 100644 --- a/crates/api_crud/src/tagline/delete.rs +++ b/crates/api_crud/src/tagline/delete.rs @@ -1,13 +1,10 @@ use activitypub_federation::config::Data; use actix_web::web::Json; -use lemmy_api_common::{ - context::LemmyContext, - tagline::DeleteTagline, - utils::is_admin, - SuccessResponse, -}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_db_schema::{source::tagline::Tagline, traits::Crud}; +use lemmy_db_views_api_misc::SuccessResponse; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_site::api::DeleteTagline; use lemmy_utils::error::LemmyError; pub async fn delete_tagline( diff --git a/crates/api_crud/src/tagline/list.rs b/crates/api_crud/src/tagline/list.rs index 647ef7403..2e1034047 100644 --- a/crates/api_crud/src/tagline/list.rs +++ b/crates/api_crud/src/tagline/list.rs @@ -1,9 +1,7 @@ use actix_web::web::{Data, Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - tagline::{ListTaglines, ListTaglinesResponse}, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::source::tagline::Tagline; +use lemmy_db_views_site::api::{ListTaglines, ListTaglinesResponse}; use lemmy_utils::error::LemmyError; pub async fn list_taglines( diff --git a/crates/api_crud/src/tagline/update.rs b/crates/api_crud/src/tagline/update.rs index c1d963336..cdf2c25bc 100644 --- a/crates/api_crud/src/tagline/update.rs +++ b/crates/api_crud/src/tagline/update.rs @@ -1,9 +1,8 @@ use activitypub_federation::config::Data; use actix_web::web::Json; use chrono::Utc; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - tagline::{TaglineResponse, UpdateTagline}, utils::{get_url_blocklist, is_admin, process_markdown, slur_regex}, }; use lemmy_db_schema::{ @@ -11,6 +10,7 @@ use lemmy_db_schema::{ traits::Crud, }; use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_site::api::{TaglineResponse, UpdateTagline}; use lemmy_utils::error::LemmyError; pub async fn update_tagline( diff --git a/crates/api_crud/src/user/create.rs b/crates/api_crud/src/user/create.rs index 30d811ad8..bc575fcfb 100644 --- a/crates/api_crud/src/user/create.rs +++ b/crates/api_crud/src/user/create.rs @@ -1,11 +1,9 @@ use activitypub_federation::config::Data; use actix_web::{web::Json, HttpRequest}; use diesel_async::{scoped_futures::ScopedFutureExt, AsyncPgConnection}; -use lemmy_api_common::{ +use lemmy_api_utils::{ claims::Claims, context::LemmyContext, - oauth_provider::AuthenticateWithOauth, - person::{LoginResponse, Register}, utils::{ check_email_verified, check_local_user_valid, @@ -33,8 +31,10 @@ use lemmy_db_schema::{ utils::get_conn, }; use lemmy_db_schema_file::enums::RegistrationMode; +use lemmy_db_views_api_misc::LoginResponse; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_site::SiteView; +use lemmy_db_views_registration_applications::api::Register; +use lemmy_db_views_site::{api::AuthenticateWithOauth, SiteView}; use lemmy_email::{ account::send_verification_email_if_required, admin::send_new_applicant_email_to_admins, diff --git a/crates/api_crud/src/user/delete.rs b/crates/api_crud/src/user/delete.rs index e5cc1233e..5dbf3288a 100644 --- a/crates/api_crud/src/user/delete.rs +++ b/crates/api_crud/src/user/delete.rs @@ -1,12 +1,10 @@ use activitypub_federation::config::Data; use actix_web::web::Json; use bcrypt::verify; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - person::DeleteAccount, send_activity::{ActivityChannel, SendActivityData}, utils::purge_user_account, - SuccessResponse, }; use lemmy_db_schema::source::{ community::CommunityActions, @@ -14,6 +12,7 @@ use lemmy_db_schema::source::{ oauth_account::OAuthAccount, person::Person, }; +use lemmy_db_views_api_misc::{DeleteAccount, SuccessResponse}; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/api_crud/src/user/my_user.rs b/crates/api_crud/src/user/my_user.rs index 481d0348c..bc8cdf533 100644 --- a/crates/api_crud/src/user/my_user.rs +++ b/crates/api_crud/src/user/my_user.rs @@ -1,5 +1,5 @@ use actix_web::web::{Data, Json}; -use lemmy_api_common::{context::LemmyContext, site::MyUserInfo, utils::check_local_user_valid}; +use lemmy_api_utils::{context::LemmyContext, utils::check_local_user_valid}; use lemmy_db_schema::{ source::{ actor_language::LocalUserLanguage, @@ -10,6 +10,7 @@ use lemmy_db_schema::{ }, traits::Blockable, }; +use lemmy_db_views_api_misc::MyUserInfo; use lemmy_db_views_community_follower::CommunityFollowerView; use lemmy_db_views_community_moderator::CommunityModeratorView; use lemmy_db_views_local_user::LocalUserView; diff --git a/crates/api_utils/Cargo.toml b/crates/api_utils/Cargo.toml new file mode 100644 index 000000000..94e5c0c6e --- /dev/null +++ b/crates/api_utils/Cargo.toml @@ -0,0 +1,106 @@ +[package] +name = "lemmy_api_utils" +publish = false +version.workspace = true +edition.workspace = true +description.workspace = true +license.workspace = true +homepage.workspace = true +documentation.workspace = true +repository.workspace = true + +[lib] +name = "lemmy_api_utils" +path = "src/lib.rs" +doctest = false + +[lints] +workspace = true + +[features] +full = [ + "once_cell", + "tokio", + "tracing", + "extism", + "extism-convert", + "lemmy_db_views_api_misc/full", + "lemmy_db_views_community/full", + "lemmy_db_views_community_follower/full", + "lemmy_db_views_community_moderator/full", + "lemmy_db_views_community_person_ban/full", + "lemmy_db_views_local_image/full", + "lemmy_db_views_local_user/full", + "lemmy_db_views_person/full", + "lemmy_db_views_site/full", + "lemmy_db_views_private_message/full", + "lemmy_db_views_comment/full", + "lemmy_db_views_post/full", + "serde_json", + "lemmy_db_schema/full", + "lemmy_db_schema_file/full", + "reqwest-middleware", + "activitypub_federation", + "mime", + "encoding_rs", + "futures", + "reqwest", + "actix-web", + "actix-web-httpauth", + "moka", + "webmention", + "webpage", + "jsonwebtoken", +] + +[dependencies] +lemmy_db_schema = { workspace = true } +lemmy_db_schema_file = { workspace = true } +lemmy_db_views_api_misc = { workspace = true } +lemmy_db_views_community = { workspace = true } +lemmy_db_views_community_follower = { workspace = true } +lemmy_db_views_community_moderator = { workspace = true } +lemmy_db_views_community_person_ban = { workspace = true } +lemmy_db_views_local_image = { workspace = true } +lemmy_db_views_local_user = { workspace = true } +lemmy_db_views_person = { workspace = true } +lemmy_db_views_site = { workspace = true } +lemmy_db_views_private_message = { workspace = true } +lemmy_db_views_comment = { workspace = true } +lemmy_db_views_post = { workspace = true } +lemmy_email = { workspace = true } +anyhow = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true, optional = true } +once_cell = { version = "1.21.3", optional = true } +tokio = { workspace = true, optional = true } +tracing = { workspace = true, optional = true } +lemmy_utils = { workspace = true } +extism = { git = "https://github.com/extism/extism.git", branch = "pool", optional = true } +extism-convert = { git = "https://github.com/extism/extism.git", branch = "pool", optional = true } +reqwest-middleware = { workspace = true, optional = true } +activitypub_federation = { workspace = true, optional = true } +mime = { version = "0.3.17", optional = true } +mime_guess = "2.0.5" +infer = "0.19.0" +chrono = { workspace = true } +encoding_rs = { version = "0.8.35", optional = true } +futures = { workspace = true, optional = true } +reqwest = { workspace = true, optional = true } +actix-web = { workspace = true, optional = true } +actix-web-httpauth = { version = "0.8.2", optional = true } +enum-map = { workspace = true } +url = { workspace = true } +moka = { workspace = true, optional = true } +webmention = { version = "0.6.0", optional = true } +urlencoding = { workspace = true } +webpage = { version = "2.0", default-features = false, optional = true, features = [ + "serde", +] } +regex = { workspace = true } +jsonwebtoken = { version = "9.3.1", optional = true } +either.workspace = true + +[dev-dependencies] +serial_test = { workspace = true } +pretty_assertions = { workspace = true } diff --git a/crates/api_common/src/build_response.rs b/crates/api_utils/src/build_response.rs similarity index 98% rename from crates/api_common/src/build_response.rs rename to crates/api_utils/src/build_response.rs index b4913e342..311291d4d 100644 --- a/crates/api_common/src/build_response.rs +++ b/crates/api_utils/src/build_response.rs @@ -1,8 +1,5 @@ use crate::{ - comment::CommentResponse, - community::CommunityResponse, context::LemmyContext, - post::PostResponse, utils::{check_person_instance_community_block, is_mod_or_admin}, }; use actix_web::web::Json; @@ -20,10 +17,10 @@ use lemmy_db_schema::{ }, traits::Crud, }; -use lemmy_db_views_comment::CommentView; -use lemmy_db_views_community::CommunityView; +use lemmy_db_views_comment::{api::CommentResponse, CommentView}; +use lemmy_db_views_community::{api::CommunityResponse, CommunityView}; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_post::PostView; +use lemmy_db_views_post::{api::PostResponse, PostView}; use lemmy_email::notifications::{ send_comment_reply_email, send_mention_email, diff --git a/crates/api_common/src/claims.rs b/crates/api_utils/src/claims.rs similarity index 100% rename from crates/api_common/src/claims.rs rename to crates/api_utils/src/claims.rs diff --git a/crates/api_common/src/context.rs b/crates/api_utils/src/context.rs similarity index 100% rename from crates/api_common/src/context.rs rename to crates/api_utils/src/context.rs diff --git a/crates/api_utils/src/lib.rs b/crates/api_utils/src/lib.rs new file mode 100644 index 000000000..4422e5177 --- /dev/null +++ b/crates/api_utils/src/lib.rs @@ -0,0 +1,16 @@ +#[cfg(feature = "full")] +pub mod build_response; +#[cfg(feature = "full")] +pub mod claims; +#[cfg(feature = "full")] +pub mod context; +#[cfg(feature = "full")] +pub mod plugins; +#[cfg(feature = "full")] +pub mod request; +#[cfg(feature = "full")] +pub mod send_activity; +#[cfg(feature = "full")] +pub mod tags; +#[cfg(feature = "full")] +pub mod utils; diff --git a/crates/api_common/src/plugins.rs b/crates/api_utils/src/plugins.rs similarity index 98% rename from crates/api_common/src/plugins.rs rename to crates/api_utils/src/plugins.rs index 13588b400..475482fc3 100644 --- a/crates/api_common/src/plugins.rs +++ b/crates/api_utils/src/plugins.rs @@ -1,9 +1,9 @@ -use crate::{site::PluginMetadata, LemmyErrorType}; use anyhow::anyhow; use extism::{Manifest, PluginBuilder, Pool}; use extism_convert::Json; +use lemmy_db_views_api_misc::PluginMetadata; use lemmy_utils::{ - error::{LemmyError, LemmyResult}, + error::{LemmyError, LemmyErrorType, LemmyResult}, settings::SETTINGS, VERSION, }; diff --git a/crates/api_common/src/request.rs b/crates/api_utils/src/request.rs similarity index 98% rename from crates/api_common/src/request.rs rename to crates/api_utils/src/request.rs index c41f367e1..a37ed24d7 100644 --- a/crates/api_common/src/request.rs +++ b/crates/api_utils/src/request.rs @@ -1,7 +1,5 @@ use crate::{ context::LemmyContext, - lemmy_db_schema::traits::Crud, - post::{LinkMetadata, OpenGraphData}, send_activity::{ActivityChannel, SendActivityData}, utils::proxy_image_link, }; @@ -9,11 +7,15 @@ use activitypub_federation::config::Data; use chrono::{DateTime, Utc}; use encoding_rs::{Encoding, UTF_8}; use futures::StreamExt; -use lemmy_db_schema::source::{ - images::{ImageDetailsInsertForm, LocalImage, LocalImageForm}, - post::{Post, PostUpdateForm}, - site::Site, +use lemmy_db_schema::{ + source::{ + images::{ImageDetailsInsertForm, LocalImage, LocalImageForm}, + post::{Post, PostUpdateForm}, + site::Site, + }, + traits::Crud, }; +use lemmy_db_views_post::api::{LinkMetadata, OpenGraphData}; use lemmy_utils::{ error::{FederationError, LemmyError, LemmyErrorExt, LemmyErrorType, LemmyResult}, settings::structs::{PictrsImageMode, Settings}, diff --git a/crates/api_common/src/send_activity.rs b/crates/api_utils/src/send_activity.rs similarity index 96% rename from crates/api_common/src/send_activity.rs rename to crates/api_utils/src/send_activity.rs index f953ce648..3bd83134f 100644 --- a/crates/api_common/src/send_activity.rs +++ b/crates/api_utils/src/send_activity.rs @@ -1,4 +1,4 @@ -use crate::{community::BanFromCommunity, context::LemmyContext, post::DeletePost}; +use crate::context::LemmyContext; use activitypub_federation::config::Data; use either::Either; use futures::future::BoxFuture; @@ -13,6 +13,8 @@ use lemmy_db_schema::{ site::Site, }, }; +use lemmy_db_views_community::api::BanFromCommunity; +use lemmy_db_views_post::api::DeletePost; use lemmy_db_views_private_message::PrivateMessageView; use lemmy_utils::error::LemmyResult; use std::sync::{LazyLock, OnceLock}; diff --git a/crates/api_common/src/tags.rs b/crates/api_utils/src/tags.rs similarity index 100% rename from crates/api_common/src/tags.rs rename to crates/api_utils/src/tags.rs diff --git a/crates/api_common/src/utils.rs b/crates/api_utils/src/utils.rs similarity index 99% rename from crates/api_common/src/utils.rs rename to crates/api_utils/src/utils.rs index b30240b35..36b73a48f 100644 --- a/crates/api_common/src/utils.rs +++ b/crates/api_utils/src/utils.rs @@ -2,7 +2,6 @@ use crate::{ claims::Claims, context::LemmyContext, request::{delete_image_alias, fetch_pictrs_proxied_image_details, purge_image_from_pictrs_url}, - site::{FederatedInstances, InstanceWithFederationState}, }; use actix_web::{http::header::Header, HttpRequest}; use actix_web_httpauth::headers::authorization::{Authorization, Bearer}; @@ -41,7 +40,10 @@ use lemmy_db_views_community_person_ban::CommunityPersonBanView; use lemmy_db_views_local_image::LocalImageView; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_person::PersonView; -use lemmy_db_views_site::SiteView; +use lemmy_db_views_site::{ + api::{FederatedInstances, InstanceWithFederationState}, + SiteView, +}; use lemmy_utils::{ error::{LemmyError, LemmyErrorExt, LemmyErrorExt2, LemmyErrorType, LemmyResult}, rate_limit::{ActionType, BucketConfig}, diff --git a/crates/apub/Cargo.toml b/crates/apub/Cargo.toml index a6af730aa..01ffbfd3d 100644 --- a/crates/apub/Cargo.toml +++ b/crates/apub/Cargo.toml @@ -19,6 +19,7 @@ doctest = false workspace = true [dependencies] +lemmy_db_views_api_misc = { workspace = true, features = ["full"] } lemmy_db_views_comment = { workspace = true, features = ["full"] } lemmy_db_views_community = { workspace = true, features = ["full"] } lemmy_db_views_community_moderator = { workspace = true, features = ["full"] } @@ -34,7 +35,7 @@ lemmy_db_views_person_content_combined = { workspace = true, features = [ lemmy_db_views_search_combined = { workspace = true, features = ["full"] } lemmy_utils = { workspace = true, features = ["full"] } lemmy_db_schema = { workspace = true, features = ["full"] } -lemmy_api_common = { workspace = true, features = ["full"] } +lemmy_api_utils = { workspace = true, features = ["full"] } lemmy_apub_objects = { workspace = true } activitypub_federation = { workspace = true } lemmy_db_schema_file = { workspace = true } diff --git a/crates/apub/src/activities/block/block_user.rs b/crates/apub/src/activities/block/block_user.rs index 37c0ac02b..8d22a3bd9 100644 --- a/crates/apub/src/activities/block/block_user.rs +++ b/crates/apub/src/activities/block/block_user.rs @@ -17,7 +17,7 @@ use activitypub_federation::{ traits::{ActivityHandler, Actor}, }; use chrono::{DateTime, Utc}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, utils::{remove_or_restore_user_data, remove_or_restore_user_data_in_community}, }; diff --git a/crates/apub/src/activities/block/mod.rs b/crates/apub/src/activities/block/mod.rs index 6ad9dbc1b..a77246e20 100644 --- a/crates/apub/src/activities/block/mod.rs +++ b/crates/apub/src/activities/block/mod.rs @@ -6,11 +6,7 @@ use activitypub_federation::{ traits::{Actor, Object}, }; use chrono::{DateTime, Utc}; -use lemmy_api_common::{ - community::BanFromCommunity, - context::LemmyContext, - utils::check_expire_time, -}; +use lemmy_api_utils::{context::LemmyContext, utils::check_expire_time}; use lemmy_apub_objects::{ objects::{community::ApubCommunity, instance::ApubSite}, protocol::{group::Group, instance::Instance}, @@ -22,6 +18,7 @@ use lemmy_db_schema::{ traits::Crud, utils::DbPool, }; +use lemmy_db_views_community::api::BanFromCommunity; use lemmy_utils::error::{LemmyError, LemmyResult}; use serde::Deserialize; use url::Url; diff --git a/crates/apub/src/activities/block/undo_block_user.rs b/crates/apub/src/activities/block/undo_block_user.rs index b364397cd..b9f90cc87 100644 --- a/crates/apub/src/activities/block/undo_block_user.rs +++ b/crates/apub/src/activities/block/undo_block_user.rs @@ -16,7 +16,7 @@ use activitypub_federation::{ protocol::verification::verify_domains_match, traits::{ActivityHandler, Actor}, }; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, utils::{remove_or_restore_user_data, remove_or_restore_user_data_in_community}, }; diff --git a/crates/apub/src/activities/community/announce.rs b/crates/apub/src/activities/community/announce.rs index 67e3a80d1..3716d3c85 100644 --- a/crates/apub/src/activities/community/announce.rs +++ b/crates/apub/src/activities/community/announce.rs @@ -12,7 +12,7 @@ use activitypub_federation::{ kinds::activity::AnnounceType, traits::{ActivityHandler, Actor}, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::community::ApubCommunity, utils::{ diff --git a/crates/apub/src/activities/community/collection_add.rs b/crates/apub/src/activities/community/collection_add.rs index b0d8572f6..32f91eafc 100644 --- a/crates/apub/src/activities/community/collection_add.rs +++ b/crates/apub/src/activities/community/collection_add.rs @@ -13,7 +13,7 @@ use activitypub_federation::{ kinds::activity::AddType, traits::{ActivityHandler, Actor}, }; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, utils::{generate_featured_url, generate_moderators_url}, }; diff --git a/crates/apub/src/activities/community/collection_remove.rs b/crates/apub/src/activities/community/collection_remove.rs index 17fd7abd1..be1b170d8 100644 --- a/crates/apub/src/activities/community/collection_remove.rs +++ b/crates/apub/src/activities/community/collection_remove.rs @@ -10,7 +10,7 @@ use activitypub_federation::{ kinds::activity::RemoveType, traits::{ActivityHandler, Actor}, }; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, utils::{generate_featured_url, generate_moderators_url}, }; diff --git a/crates/apub/src/activities/community/lock_page.rs b/crates/apub/src/activities/community/lock_page.rs index b988f68ec..9aff1e4ae 100644 --- a/crates/apub/src/activities/community/lock_page.rs +++ b/crates/apub/src/activities/community/lock_page.rs @@ -15,7 +15,7 @@ use activitypub_federation::{ kinds::activity::UndoType, traits::ActivityHandler, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::community::ApubCommunity, utils::{ diff --git a/crates/apub/src/activities/community/mod.rs b/crates/apub/src/activities/community/mod.rs index 29dd9ab30..70b6af10e 100644 --- a/crates/apub/src/activities/community/mod.rs +++ b/crates/apub/src/activities/community/mod.rs @@ -6,7 +6,7 @@ use crate::{ }; use activitypub_federation::{config::Data, fetch::object_id::ObjectId, traits::Actor}; use either::Either; -use lemmy_api_common::{context::LemmyContext, utils::is_admin}; +use lemmy_api_utils::{context::LemmyContext, utils::is_admin}; use lemmy_apub_objects::objects::{ community::ApubCommunity, instance::ApubSite, diff --git a/crates/apub/src/activities/community/report.rs b/crates/apub/src/activities/community/report.rs index 66531c0f9..c93487ba6 100644 --- a/crates/apub/src/activities/community/report.rs +++ b/crates/apub/src/activities/community/report.rs @@ -15,7 +15,7 @@ use activitypub_federation::{ traits::{ActivityHandler, Actor}, }; use either::Either; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, utils::{ check_comment_deleted_or_removed, diff --git a/crates/apub/src/activities/community/resolve_report.rs b/crates/apub/src/activities/community/resolve_report.rs index 705cb710c..55a913688 100644 --- a/crates/apub/src/activities/community/resolve_report.rs +++ b/crates/apub/src/activities/community/resolve_report.rs @@ -16,7 +16,7 @@ use activitypub_federation::{ traits::{ActivityHandler, Actor}, }; use either::Either; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{ community::ApubCommunity, diff --git a/crates/apub/src/activities/community/update.rs b/crates/apub/src/activities/community/update.rs index c7c2d584b..78488cae9 100644 --- a/crates/apub/src/activities/community/update.rs +++ b/crates/apub/src/activities/community/update.rs @@ -9,7 +9,7 @@ use activitypub_federation::{ kinds::activity::UpdateType, traits::{ActivityHandler, Actor, Object}, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{community::ApubCommunity, person::ApubPerson}, utils::{ diff --git a/crates/apub/src/activities/create_or_update/comment.rs b/crates/apub/src/activities/create_or_update/comment.rs index 13d27972c..3ad0cdad4 100644 --- a/crates/apub/src/activities/create_or_update/comment.rs +++ b/crates/apub/src/activities/create_or_update/comment.rs @@ -14,7 +14,7 @@ use activitypub_federation::{ protocol::verification::{verify_domains_match, verify_urls_match}, traits::{ActivityHandler, Actor, Object}, }; -use lemmy_api_common::{ +use lemmy_api_utils::{ build_response::send_local_notifs, context::LemmyContext, utils::{check_is_mod_or_admin, check_post_deleted_or_removed}, diff --git a/crates/apub/src/activities/create_or_update/note_wrapper.rs b/crates/apub/src/activities/create_or_update/note_wrapper.rs index 70b850de1..5cc0a4106 100644 --- a/crates/apub/src/activities/create_or_update/note_wrapper.rs +++ b/crates/apub/src/activities/create_or_update/note_wrapper.rs @@ -4,7 +4,7 @@ use crate::protocol::activities::create_or_update::{ private_message::CreateOrUpdatePrivateMessage, }; use activitypub_federation::{config::Data, traits::ActivityHandler}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{objects::community::ApubCommunity, utils::protocol::InCommunity}; use lemmy_utils::error::{LemmyError, LemmyResult}; use serde_json::{from_value, to_value}; diff --git a/crates/apub/src/activities/create_or_update/post.rs b/crates/apub/src/activities/create_or_update/post.rs index 8e8fdb37c..a03063b3a 100644 --- a/crates/apub/src/activities/create_or_update/post.rs +++ b/crates/apub/src/activities/create_or_update/post.rs @@ -13,7 +13,7 @@ use activitypub_federation::{ protocol::verification::{verify_domains_match, verify_urls_match}, traits::{ActivityHandler, Actor, Object}, }; -use lemmy_api_common::{build_response::send_local_notifs, context::LemmyContext}; +use lemmy_api_utils::{build_response::send_local_notifs, context::LemmyContext}; use lemmy_apub_objects::{ objects::{community::ApubCommunity, person::ApubPerson, post::ApubPost}, utils::{ diff --git a/crates/apub/src/activities/create_or_update/private_message.rs b/crates/apub/src/activities/create_or_update/private_message.rs index e40d20497..6988344c3 100644 --- a/crates/apub/src/activities/create_or_update/private_message.rs +++ b/crates/apub/src/activities/create_or_update/private_message.rs @@ -11,7 +11,7 @@ use activitypub_federation::{ protocol::verification::{verify_domains_match, verify_urls_match}, traits::{ActivityHandler, Actor, Object}, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::objects::{person::ApubPerson, private_message::ApubPrivateMessage}; use lemmy_db_schema::source::activity::ActivitySendTargets; use lemmy_db_views_private_message::PrivateMessageView; diff --git a/crates/apub/src/activities/deletion/delete.rs b/crates/apub/src/activities/deletion/delete.rs index 9810110e8..f478823c5 100644 --- a/crates/apub/src/activities/deletion/delete.rs +++ b/crates/apub/src/activities/deletion/delete.rs @@ -7,7 +7,7 @@ use crate::{ protocol::{activities::deletion::delete::Delete, IdOrNestedObject}, }; use activitypub_federation::{config::Data, kinds::activity::DeleteType, traits::ActivityHandler}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::objects::person::ApubPerson; use lemmy_db_schema::{ source::{ diff --git a/crates/apub/src/activities/deletion/mod.rs b/crates/apub/src/activities/deletion/mod.rs index c40833411..158bfeaae 100644 --- a/crates/apub/src/activities/deletion/mod.rs +++ b/crates/apub/src/activities/deletion/mod.rs @@ -15,7 +15,7 @@ use activitypub_federation::{ protocol::verification::{verify_domains_match, verify_urls_match}, traits::{Actor, Object}, }; -use lemmy_api_common::{context::LemmyContext, utils::purge_user_account}; +use lemmy_api_utils::{context::LemmyContext, utils::purge_user_account}; use lemmy_apub_objects::{ objects::{ comment::ApubComment, diff --git a/crates/apub/src/activities/deletion/undo_delete.rs b/crates/apub/src/activities/deletion/undo_delete.rs index 32c458559..d4d49b425 100644 --- a/crates/apub/src/activities/deletion/undo_delete.rs +++ b/crates/apub/src/activities/deletion/undo_delete.rs @@ -7,7 +7,7 @@ use crate::{ protocol::activities::deletion::{delete::Delete, undo_delete::UndoDelete}, }; use activitypub_federation::{config::Data, kinds::activity::UndoType, traits::ActivityHandler}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::objects::person::ApubPerson; use lemmy_db_schema::{ source::{ diff --git a/crates/apub/src/activities/following/accept.rs b/crates/apub/src/activities/following/accept.rs index 5bd9e5cf7..3b2d84eca 100644 --- a/crates/apub/src/activities/following/accept.rs +++ b/crates/apub/src/activities/following/accept.rs @@ -10,7 +10,7 @@ use activitypub_federation::{ protocol::verification::verify_urls_match, traits::{ActivityHandler, Actor}, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::{activity::ActivitySendTargets, community::CommunityActions}, traits::Followable, diff --git a/crates/apub/src/activities/following/follow.rs b/crates/apub/src/activities/following/follow.rs index 8e090a253..d8d7e1928 100644 --- a/crates/apub/src/activities/following/follow.rs +++ b/crates/apub/src/activities/following/follow.rs @@ -9,7 +9,7 @@ use activitypub_federation::{ protocol::verification::verify_urls_match, traits::{ActivityHandler, Actor}, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{community::ApubCommunity, person::ApubPerson, UserOrCommunity}, utils::functions::verify_person_in_community, diff --git a/crates/apub/src/activities/following/mod.rs b/crates/apub/src/activities/following/mod.rs index eafc4b7b9..3165b047a 100644 --- a/crates/apub/src/activities/following/mod.rs +++ b/crates/apub/src/activities/following/mod.rs @@ -6,7 +6,7 @@ use crate::protocol::activities::following::{ undo_follow::UndoFollow, }; use activitypub_federation::{config::Data, kinds::activity::FollowType, traits::ActivityHandler}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::objects::{community::ApubCommunity, person::ApubPerson, UserOrCommunity}; use lemmy_db_schema::{ newtypes::{CommunityId, PersonId}, diff --git a/crates/apub/src/activities/following/reject.rs b/crates/apub/src/activities/following/reject.rs index 1a7fbdf21..b2489d03e 100644 --- a/crates/apub/src/activities/following/reject.rs +++ b/crates/apub/src/activities/following/reject.rs @@ -10,7 +10,7 @@ use activitypub_federation::{ protocol::verification::verify_urls_match, traits::{ActivityHandler, Actor}, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::{activity::ActivitySendTargets, community::CommunityActions}, traits::Followable, diff --git a/crates/apub/src/activities/following/undo_follow.rs b/crates/apub/src/activities/following/undo_follow.rs index 9d3b790ee..43988980f 100644 --- a/crates/apub/src/activities/following/undo_follow.rs +++ b/crates/apub/src/activities/following/undo_follow.rs @@ -9,7 +9,7 @@ use activitypub_federation::{ protocol::verification::verify_urls_match, traits::{ActivityHandler, Actor}, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::objects::{community::ApubCommunity, person::ApubPerson, UserOrCommunity}; use lemmy_db_schema::{ source::{activity::ActivitySendTargets, community::CommunityActions, person::PersonActions}, diff --git a/crates/apub/src/activities/mod.rs b/crates/apub/src/activities/mod.rs index 9e92c7d66..56956ac61 100644 --- a/crates/apub/src/activities/mod.rs +++ b/crates/apub/src/activities/mod.rs @@ -29,7 +29,7 @@ use activitypub_federation::{ traits::{ActivityHandler, Actor}, }; use following::send_accept_or_reject_follow; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, utils::check_is_mod_or_admin, diff --git a/crates/apub/src/activities/voting/mod.rs b/crates/apub/src/activities/voting/mod.rs index 3cd193e20..54c6acb0c 100644 --- a/crates/apub/src/activities/voting/mod.rs +++ b/crates/apub/src/activities/voting/mod.rs @@ -7,7 +7,7 @@ use crate::{ }, }; use activitypub_federation::{config::Data, fetch::object_id::ObjectId}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, plugins::{plugin_hook_after, plugin_hook_before}, }; diff --git a/crates/apub/src/activities/voting/undo_vote.rs b/crates/apub/src/activities/voting/undo_vote.rs index 86ea099cb..f21ac435b 100644 --- a/crates/apub/src/activities/voting/undo_vote.rs +++ b/crates/apub/src/activities/voting/undo_vote.rs @@ -12,7 +12,7 @@ use activitypub_federation::{ protocol::verification::verify_urls_match, traits::{ActivityHandler, Actor}, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{person::ApubPerson, PostOrComment}, utils::{functions::verify_person_in_community, protocol::InCommunity}, diff --git a/crates/apub/src/activities/voting/vote.rs b/crates/apub/src/activities/voting/vote.rs index cc29de19a..b9a92a1dc 100644 --- a/crates/apub/src/activities/voting/vote.rs +++ b/crates/apub/src/activities/voting/vote.rs @@ -11,7 +11,7 @@ use activitypub_federation::{ fetch::object_id::ObjectId, traits::{ActivityHandler, Actor}, }; -use lemmy_api_common::{context::LemmyContext, utils::check_bot_account}; +use lemmy_api_utils::{context::LemmyContext, utils::check_bot_account}; use lemmy_apub_objects::{ objects::{person::ApubPerson, PostOrComment}, utils::{functions::verify_person_in_community, protocol::InCommunity}, diff --git a/crates/apub/src/activity_lists.rs b/crates/apub/src/activity_lists.rs index 2fdc448f4..e379f7129 100644 --- a/crates/apub/src/activity_lists.rs +++ b/crates/apub/src/activity_lists.rs @@ -20,7 +20,7 @@ use crate::protocol::activities::{ voting::{undo_vote::UndoVote, vote::Vote}, }; use activitypub_federation::{config::Data, traits::ActivityHandler}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::community::ApubCommunity, protocol::page::Page, diff --git a/crates/apub/src/api/list_comments.rs b/crates/apub/src/api/list_comments.rs index c7c3d67c5..71ec05721 100644 --- a/crates/apub/src/api/list_comments.rs +++ b/crates/apub/src/api/list_comments.rs @@ -2,18 +2,18 @@ use super::comment_sort_type_with_default; use crate::{api::listing_type_with_default, fetcher::resolve_ap_identifier}; use activitypub_federation::config::Data; use actix_web::web::{Json, Query}; -use lemmy_api_common::{ - comment::{GetComments, GetCommentsResponse, GetCommentsSlimResponse}, - context::LemmyContext, - utils::check_private_instance, -}; +use lemmy_api_utils::{context::LemmyContext, utils::check_private_instance}; use lemmy_apub_objects::objects::community::ApubCommunity; use lemmy_db_schema::{ newtypes::PaginationCursor, source::{comment::Comment, community::Community}, traits::{Crud, PaginationCursorBuilder}, }; -use lemmy_db_views_comment::{impls::CommentQuery, CommentView}; +use lemmy_db_views_comment::{ + api::{GetComments, GetCommentsResponse, GetCommentsSlimResponse}, + impls::CommentQuery, + CommentView, +}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::SiteView; use lemmy_utils::error::LemmyResult; diff --git a/crates/apub/src/api/list_person_content.rs b/crates/apub/src/api/list_person_content.rs index f7c581c99..708749a67 100644 --- a/crates/apub/src/api/list_person_content.rs +++ b/crates/apub/src/api/list_person_content.rs @@ -1,7 +1,7 @@ use super::resolve_person_id_from_id_or_username; use activitypub_federation::config::Data; use actix_web::web::{Json, Query}; -use lemmy_api_common::{context::LemmyContext, utils::check_private_instance}; +use lemmy_api_utils::{context::LemmyContext, utils::check_private_instance}; use lemmy_db_schema::traits::PaginationCursorBuilder; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_person_content_combined::{ diff --git a/crates/apub/src/api/list_posts.rs b/crates/apub/src/api/list_posts.rs index aa7d13fe2..725427eb1 100644 --- a/crates/apub/src/api/list_posts.rs +++ b/crates/apub/src/api/list_posts.rs @@ -8,11 +8,7 @@ use crate::{ }; use activitypub_federation::config::Data; use actix_web::web::{Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - post::{GetPosts, GetPostsResponse}, - utils::check_private_instance, -}; +use lemmy_api_utils::{context::LemmyContext, utils::check_private_instance}; use lemmy_apub_objects::objects::community::ApubCommunity; use lemmy_db_schema::{ newtypes::PostId, @@ -20,7 +16,11 @@ use lemmy_db_schema::{ traits::{PaginationCursorBuilder, Readable}, }; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_post::{impls::PostQuery, PostView}; +use lemmy_db_views_post::{ + api::{GetPosts, GetPostsResponse}, + impls::PostQuery, + PostView, +}; use lemmy_db_views_site::SiteView; use lemmy_utils::error::LemmyResult; diff --git a/crates/apub/src/api/mod.rs b/crates/apub/src/api/mod.rs index c4c219e19..17550a5b3 100644 --- a/crates/apub/src/api/mod.rs +++ b/crates/apub/src/api/mod.rs @@ -1,6 +1,6 @@ use crate::fetcher::resolve_ap_identifier; use activitypub_federation::config::Data; -use lemmy_api_common::{context::LemmyContext, LemmyErrorType}; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::objects::person::ApubPerson; use lemmy_db_schema::{ newtypes::{CommunityId, PersonId}, @@ -8,7 +8,7 @@ use lemmy_db_schema::{ }; use lemmy_db_schema_file::enums::{CommentSortType, ListingType, PostSortType}; use lemmy_db_views_local_user::LocalUserView; -use lemmy_utils::error::LemmyResult; +use lemmy_utils::error::{LemmyErrorType, LemmyResult}; pub mod list_comments; pub mod list_person_content; diff --git a/crates/apub/src/api/read_community.rs b/crates/apub/src/api/read_community.rs index 565e52aee..3c9743107 100644 --- a/crates/apub/src/api/read_community.rs +++ b/crates/apub/src/api/read_community.rs @@ -1,14 +1,16 @@ use crate::fetcher::resolve_ap_identifier; use activitypub_federation::config::Data; use actix_web::web::{Json, Query}; -use lemmy_api_common::{ - community::{GetCommunity, GetCommunityResponse}, +use lemmy_api_utils::{ context::LemmyContext, utils::{check_private_instance, is_mod_or_admin_opt, read_site_for_actor}, }; use lemmy_apub_objects::objects::community::ApubCommunity; use lemmy_db_schema::source::{actor_language::CommunityLanguage, community::Community}; -use lemmy_db_views_community::CommunityView; +use lemmy_db_views_community::{ + api::{GetCommunity, GetCommunityResponse}, + CommunityView, +}; use lemmy_db_views_community_moderator::CommunityModeratorView; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::SiteView; diff --git a/crates/apub/src/api/read_person.rs b/crates/apub/src/api/read_person.rs index 200a2bf4a..f600ebc9e 100644 --- a/crates/apub/src/api/read_person.rs +++ b/crates/apub/src/api/read_person.rs @@ -1,14 +1,16 @@ use super::resolve_person_id_from_id_or_username; use activitypub_federation::config::Data; use actix_web::web::{Json, Query}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - person::{GetPersonDetails, GetPersonDetailsResponse}, utils::{check_private_instance, is_admin, read_site_for_actor}, }; use lemmy_db_views_community_moderator::CommunityModeratorView; use lemmy_db_views_local_user::LocalUserView; -use lemmy_db_views_person::PersonView; +use lemmy_db_views_person::{ + api::{GetPersonDetails, GetPersonDetailsResponse}, + PersonView, +}; use lemmy_db_views_site::SiteView; use lemmy_utils::error::LemmyResult; diff --git a/crates/apub/src/api/resolve_object.rs b/crates/apub/src/api/resolve_object.rs index d01166dd9..5bd071b83 100644 --- a/crates/apub/src/api/resolve_object.rs +++ b/crates/apub/src/api/resolve_object.rs @@ -1,13 +1,10 @@ use crate::fetcher::search::{search_query_to_object_id, search_query_to_object_id_local}; use activitypub_federation::config::Data; use actix_web::web::{Json, Query}; -use lemmy_api_common::{ - context::LemmyContext, - site::{ResolveObject, ResolveObjectResponse}, - utils::check_private_instance, -}; +use lemmy_api_utils::{context::LemmyContext, utils::check_private_instance}; use lemmy_apub_objects::objects::{PostOrComment, SearchableObjects, UserOrCommunity}; use lemmy_db_schema::utils::DbPool; +use lemmy_db_views_api_misc::{ResolveObject, ResolveObjectResponse}; use lemmy_db_views_comment::CommentView; use lemmy_db_views_community::CommunityView; use lemmy_db_views_local_user::LocalUserView; @@ -81,7 +78,7 @@ async fn convert_response( mod tests { use crate::api::resolve_object::resolve_object; use actix_web::web::Query; - use lemmy_api_common::{context::LemmyContext, site::ResolveObject}; + use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::{ community::{Community, CommunityInsertForm}, @@ -91,6 +88,7 @@ mod tests { }, traits::Crud, }; + use lemmy_db_views_api_misc::ResolveObject; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::impls::create_test_instance; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/apub/src/api/search.rs b/crates/apub/src/api/search.rs index 25956af52..22bb99757 100644 --- a/crates/apub/src/api/search.rs +++ b/crates/apub/src/api/search.rs @@ -1,7 +1,7 @@ use crate::fetcher::resolve_ap_identifier; use activitypub_federation::config::Data; use actix_web::web::{Json, Query}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, utils::{check_conflicting_like_filters, check_private_instance}, }; diff --git a/crates/apub/src/api/user_settings_backup.rs b/crates/apub/src/api/user_settings_backup.rs index 9a290395c..44b41dc8a 100644 --- a/crates/apub/src/api/user_settings_backup.rs +++ b/crates/apub/src/api/user_settings_backup.rs @@ -2,7 +2,7 @@ use activitypub_federation::{config::Data, fetch::object_id::ObjectId, traits::O use actix_web::web::Json; use futures::{future::try_join_all, StreamExt}; use itertools::Itertools; -use lemmy_api_common::{context::LemmyContext, SuccessResponse}; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::objects::{ comment::ApubComment, community::ApubCommunity, @@ -22,6 +22,7 @@ use lemmy_db_schema::{ traits::{Blockable, Crud, Followable, Saveable}, }; use lemmy_db_schema_file::enums::CommunityFollowerState; +use lemmy_db_views_api_misc::SuccessResponse; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::{ error::{LemmyErrorType, LemmyResult, MAX_API_PARAM_ELEMENTS}, @@ -275,7 +276,7 @@ pub(crate) mod tests { use super::*; use crate::api::user_settings_backup::{export_settings, import_settings}; use actix_web::web::Json; - use lemmy_api_common::context::LemmyContext; + use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::{ community::{Community, CommunityActions, CommunityFollowerForm, CommunityInsertForm}, diff --git a/crates/apub/src/collections/community_featured.rs b/crates/apub/src/collections/community_featured.rs index df151b59d..1906c06f0 100644 --- a/crates/apub/src/collections/community_featured.rs +++ b/crates/apub/src/collections/community_featured.rs @@ -6,7 +6,7 @@ use activitypub_federation::{ traits::{Collection, Object}, }; use futures::future::{join_all, try_join_all}; -use lemmy_api_common::{context::LemmyContext, utils::generate_featured_url}; +use lemmy_api_utils::{context::LemmyContext, utils::generate_featured_url}; use lemmy_apub_objects::objects::{community::ApubCommunity, post::ApubPost}; use lemmy_db_schema::{ source::{community::Community, post::Post}, diff --git a/crates/apub/src/collections/community_follower.rs b/crates/apub/src/collections/community_follower.rs index 58f390114..e108bfc78 100644 --- a/crates/apub/src/collections/community_follower.rs +++ b/crates/apub/src/collections/community_follower.rs @@ -5,7 +5,7 @@ use activitypub_federation::{ protocol::verification::verify_domains_match, traits::Collection, }; -use lemmy_api_common::{context::LemmyContext, utils::generate_followers_url}; +use lemmy_api_utils::{context::LemmyContext, utils::generate_followers_url}; use lemmy_apub_objects::objects::community::ApubCommunity; use lemmy_db_schema::source::community::Community; use lemmy_db_views_community_follower::CommunityFollowerView; diff --git a/crates/apub/src/collections/community_moderators.rs b/crates/apub/src/collections/community_moderators.rs index 952efc9fc..4f9100f08 100644 --- a/crates/apub/src/collections/community_moderators.rs +++ b/crates/apub/src/collections/community_moderators.rs @@ -6,7 +6,7 @@ use activitypub_federation::{ protocol::verification::verify_domains_match, traits::Collection, }; -use lemmy_api_common::{context::LemmyContext, utils::generate_moderators_url}; +use lemmy_api_utils::{context::LemmyContext, utils::generate_moderators_url}; use lemmy_apub_objects::{ objects::{community::ApubCommunity, person::ApubPerson}, utils::functions::handle_community_moderators, diff --git a/crates/apub/src/collections/community_outbox.rs b/crates/apub/src/collections/community_outbox.rs index a7737bd52..fd767c5ba 100644 --- a/crates/apub/src/collections/community_outbox.rs +++ b/crates/apub/src/collections/community_outbox.rs @@ -16,7 +16,7 @@ use activitypub_federation::{ traits::{ActivityHandler, Collection}, }; use futures::future::join_all; -use lemmy_api_common::{context::LemmyContext, utils::generate_outbox_url}; +use lemmy_api_utils::{context::LemmyContext, utils::generate_outbox_url}; use lemmy_apub_objects::objects::community::ApubCommunity; use lemmy_db_schema::{source::site::Site, utils::FETCH_LIMIT_MAX}; use lemmy_db_schema_file::enums::PostSortType; diff --git a/crates/apub/src/collections/mod.rs b/crates/apub/src/collections/mod.rs index 99eeb8cb8..e84261781 100644 --- a/crates/apub/src/collections/mod.rs +++ b/crates/apub/src/collections/mod.rs @@ -6,7 +6,7 @@ use community_featured::ApubCommunityFeatured; use community_follower::ApubCommunityFollower; use community_moderators::ApubCommunityModerators; use community_outbox::ApubCommunityOutbox; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{community::ApubCommunity, person::ApubPerson}, protocol::group::Group, diff --git a/crates/apub/src/fetcher/mod.rs b/crates/apub/src/fetcher/mod.rs index 1bd02b457..7836253ce 100644 --- a/crates/apub/src/fetcher/mod.rs +++ b/crates/apub/src/fetcher/mod.rs @@ -5,11 +5,11 @@ use activitypub_federation::{ }; use diesel::NotFound; use itertools::Itertools; -use lemmy_api_common::{context::LemmyContext, LemmyErrorType}; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::objects::{SiteOrCommunityOrUser, UserOrCommunity}; use lemmy_db_schema::{newtypes::InstanceId, traits::ApubActor}; use lemmy_db_views_local_user::LocalUserView; -use lemmy_utils::error::{LemmyError, LemmyResult}; +use lemmy_utils::error::{LemmyError, LemmyErrorType, LemmyResult}; pub mod search; diff --git a/crates/apub/src/fetcher/search.rs b/crates/apub/src/fetcher/search.rs index f513673fa..adcd01111 100644 --- a/crates/apub/src/fetcher/search.rs +++ b/crates/apub/src/fetcher/search.rs @@ -2,7 +2,7 @@ use activitypub_federation::{ config::Data, fetch::{object_id::ObjectId, webfinger::webfinger_resolve_actor}, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::objects::{SearchableObjects, UserOrCommunity}; use lemmy_utils::error::LemmyResult; use url::Url; diff --git a/crates/apub/src/http/comment.rs b/crates/apub/src/http/comment.rs index 828788a93..c7a4d197e 100644 --- a/crates/apub/src/http/comment.rs +++ b/crates/apub/src/http/comment.rs @@ -2,7 +2,7 @@ use super::check_community_content_fetchable; use crate::http::{create_apub_response, create_apub_tombstone_response, redirect_remote_object}; use activitypub_federation::{config::Data, traits::Object}; use actix_web::{web::Path, HttpRequest, HttpResponse}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::objects::comment::ApubComment; use lemmy_db_schema::{ newtypes::CommentId, diff --git a/crates/apub/src/http/community.rs b/crates/apub/src/http/community.rs index 37f214782..0b5166b4b 100644 --- a/crates/apub/src/http/community.rs +++ b/crates/apub/src/http/community.rs @@ -20,7 +20,7 @@ use actix_web::{ HttpRequest, HttpResponse, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::objects::{community::ApubCommunity, SiteOrCommunityOrUser}; use lemmy_db_schema::{source::community::Community, traits::ApubActor}; use lemmy_db_schema_file::enums::CommunityVisibility; diff --git a/crates/apub/src/http/mod.rs b/crates/apub/src/http/mod.rs index dd61f7e72..0b5b4e8ea 100644 --- a/crates/apub/src/http/mod.rs +++ b/crates/apub/src/http/mod.rs @@ -7,7 +7,7 @@ use activitypub_federation::{ FEDERATION_CONTENT_TYPE, }; use actix_web::{web, web::Bytes, HttpRequest, HttpResponse}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{SiteOrCommunityOrUser, UserOrCommunity}, protocol::tombstone::Tombstone, diff --git a/crates/apub/src/http/person.rs b/crates/apub/src/http/person.rs index f378dc138..51294d9ca 100644 --- a/crates/apub/src/http/person.rs +++ b/crates/apub/src/http/person.rs @@ -4,7 +4,7 @@ use crate::{ }; use activitypub_federation::{config::Data, traits::Object}; use actix_web::{web, HttpResponse}; -use lemmy_api_common::{context::LemmyContext, utils::generate_outbox_url}; +use lemmy_api_utils::{context::LemmyContext, utils::generate_outbox_url}; use lemmy_apub_objects::objects::person::ApubPerson; use lemmy_db_schema::{source::person::Person, traits::ApubActor}; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; diff --git a/crates/apub/src/http/post.rs b/crates/apub/src/http/post.rs index 86bf8c940..73ce1b91d 100644 --- a/crates/apub/src/http/post.rs +++ b/crates/apub/src/http/post.rs @@ -2,7 +2,7 @@ use super::check_community_content_fetchable; use crate::http::{create_apub_response, create_apub_tombstone_response, redirect_remote_object}; use activitypub_federation::{config::Data, traits::Object}; use actix_web::{web, HttpRequest, HttpResponse}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::objects::post::ApubPost; use lemmy_db_schema::{ newtypes::PostId, diff --git a/crates/apub/src/http/site.rs b/crates/apub/src/http/site.rs index 61b37b9f5..f950acc01 100644 --- a/crates/apub/src/http/site.rs +++ b/crates/apub/src/http/site.rs @@ -1,7 +1,7 @@ use crate::{http::create_apub_response, protocol::collections::empty_outbox::EmptyOutbox}; use activitypub_federation::{config::Data, traits::Object}; use actix_web::HttpResponse; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::objects::instance::ApubSite; use lemmy_db_schema::source::site::Site; use lemmy_utils::error::LemmyResult; diff --git a/crates/apub/src/lib.rs b/crates/apub/src/lib.rs index ec28abdfe..ea9745b58 100644 --- a/crates/apub/src/lib.rs +++ b/crates/apub/src/lib.rs @@ -3,7 +3,7 @@ use activitypub_federation::{ error::Error as ActivityPubError, }; use async_trait::async_trait; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::utils::functions::{check_apub_id_valid, local_site_data_cached}; use lemmy_db_schema::{source::activity::ReceivedActivity, utils::ActualDbPool}; use lemmy_utils::error::{FederationError, LemmyError, LemmyErrorType, LemmyResult}; diff --git a/crates/apub/src/protocol/activities/block/block_user.rs b/crates/apub/src/protocol/activities/block/block_user.rs index 486aaa490..6e6d3c352 100644 --- a/crates/apub/src/protocol/activities/block/block_user.rs +++ b/crates/apub/src/protocol/activities/block/block_user.rs @@ -7,7 +7,7 @@ use activitypub_federation::{ }; use anyhow::anyhow; use chrono::{DateTime, Utc}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{community::ApubCommunity, person::ApubPerson}, utils::protocol::InCommunity, diff --git a/crates/apub/src/protocol/activities/community/collection_add.rs b/crates/apub/src/protocol/activities/community/collection_add.rs index 57c2496e9..c18456fe7 100644 --- a/crates/apub/src/protocol/activities/community/collection_add.rs +++ b/crates/apub/src/protocol/activities/community/collection_add.rs @@ -4,7 +4,7 @@ use activitypub_federation::{ kinds::activity::AddType, protocol::helpers::deserialize_one_or_many, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{community::ApubCommunity, person::ApubPerson}, utils::protocol::InCommunity, diff --git a/crates/apub/src/protocol/activities/community/collection_remove.rs b/crates/apub/src/protocol/activities/community/collection_remove.rs index d6a342c2e..2d42ff16c 100644 --- a/crates/apub/src/protocol/activities/community/collection_remove.rs +++ b/crates/apub/src/protocol/activities/community/collection_remove.rs @@ -4,7 +4,7 @@ use activitypub_federation::{ kinds::activity::RemoveType, protocol::helpers::deserialize_one_or_many, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{community::ApubCommunity, person::ApubPerson}, utils::protocol::InCommunity, diff --git a/crates/apub/src/protocol/activities/community/lock_page.rs b/crates/apub/src/protocol/activities/community/lock_page.rs index 63ae1ad52..0b6652bf7 100644 --- a/crates/apub/src/protocol/activities/community/lock_page.rs +++ b/crates/apub/src/protocol/activities/community/lock_page.rs @@ -4,7 +4,7 @@ use activitypub_federation::{ kinds::activity::UndoType, protocol::helpers::deserialize_one_or_many, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{community::ApubCommunity, person::ApubPerson, post::ApubPost}, utils::protocol::InCommunity, diff --git a/crates/apub/src/protocol/activities/community/report.rs b/crates/apub/src/protocol/activities/community/report.rs index f00e1973d..284406b25 100644 --- a/crates/apub/src/protocol/activities/community/report.rs +++ b/crates/apub/src/protocol/activities/community/report.rs @@ -5,7 +5,7 @@ use activitypub_federation::{ protocol::helpers::deserialize_one, }; use either::Either; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{community::ApubCommunity, instance::ApubSite, person::ApubPerson, ReportableObjects}, utils::protocol::InCommunity, diff --git a/crates/apub/src/protocol/activities/community/update.rs b/crates/apub/src/protocol/activities/community/update.rs index b23c6d91f..e0e038511 100644 --- a/crates/apub/src/protocol/activities/community/update.rs +++ b/crates/apub/src/protocol/activities/community/update.rs @@ -4,7 +4,7 @@ use activitypub_federation::{ kinds::activity::UpdateType, protocol::helpers::deserialize_one_or_many, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{community::ApubCommunity, person::ApubPerson}, protocol::group::Group, diff --git a/crates/apub/src/protocol/activities/create_or_update/note.rs b/crates/apub/src/protocol/activities/create_or_update/note.rs index 14905bee5..33e260fd1 100644 --- a/crates/apub/src/protocol/activities/create_or_update/note.rs +++ b/crates/apub/src/protocol/activities/create_or_update/note.rs @@ -4,7 +4,7 @@ use activitypub_federation::{ fetch::object_id::ObjectId, protocol::helpers::deserialize_one_or_many, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{community::ApubCommunity, person::ApubPerson}, protocol::note::Note, diff --git a/crates/apub/src/protocol/activities/create_or_update/page.rs b/crates/apub/src/protocol/activities/create_or_update/page.rs index c7aa72059..296d4905b 100644 --- a/crates/apub/src/protocol/activities/create_or_update/page.rs +++ b/crates/apub/src/protocol/activities/create_or_update/page.rs @@ -4,7 +4,7 @@ use activitypub_federation::{ fetch::object_id::ObjectId, protocol::helpers::deserialize_one_or_many, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{community::ApubCommunity, person::ApubPerson}, protocol::page::Page, diff --git a/crates/apub/src/protocol/activities/deletion/delete.rs b/crates/apub/src/protocol/activities/deletion/delete.rs index 3df5aa732..0cf60631e 100644 --- a/crates/apub/src/protocol/activities/deletion/delete.rs +++ b/crates/apub/src/protocol/activities/deletion/delete.rs @@ -6,7 +6,7 @@ use activitypub_federation::{ protocol::helpers::deserialize_one_or_many, }; use anyhow::anyhow; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{community::ApubCommunity, person::ApubPerson}, protocol::tombstone::Tombstone, diff --git a/crates/apub/src/protocol/activities/voting/vote.rs b/crates/apub/src/protocol/activities/voting/vote.rs index 113bd389d..69b7231c2 100644 --- a/crates/apub/src/protocol/activities/voting/vote.rs +++ b/crates/apub/src/protocol/activities/voting/vote.rs @@ -1,6 +1,6 @@ use activitypub_federation::{config::Data, fetch::object_id::ObjectId}; use either::Either; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::{ objects::{community::ApubCommunity, person::ApubPerson, PostOrComment}, utils::protocol::InCommunity, diff --git a/crates/apub/src/protocol/mod.rs b/crates/apub/src/protocol/mod.rs index 51238c110..8fa8561ed 100644 --- a/crates/apub/src/protocol/mod.rs +++ b/crates/apub/src/protocol/mod.rs @@ -1,5 +1,5 @@ use activitypub_federation::{config::Data, fetch::fetch_object_http}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::utils::protocol::Id; use lemmy_utils::error::LemmyResult; use serde::{de::DeserializeOwned, Deserialize, Serialize}; diff --git a/crates/apub_objects/Cargo.toml b/crates/apub_objects/Cargo.toml index 562120a73..7b96b4c50 100644 --- a/crates/apub_objects/Cargo.toml +++ b/crates/apub_objects/Cargo.toml @@ -25,7 +25,7 @@ lemmy_db_views_local_user = { workspace = true, features = ["full"] } lemmy_db_views_site = { workspace = true, features = ["full"] } lemmy_utils = { workspace = true, features = ["full"] } lemmy_db_schema = { workspace = true, features = ["full"] } -lemmy_api_common = { workspace = true, features = ["full"] } +lemmy_api_utils = { workspace = true, features = ["full"] } activitypub_federation = { workspace = true } lemmy_db_schema_file = { workspace = true } chrono = { workspace = true } diff --git a/crates/apub_objects/src/objects/comment.rs b/crates/apub_objects/src/objects/comment.rs index 9bcd2c680..7e9e68ed0 100644 --- a/crates/apub_objects/src/objects/comment.rs +++ b/crates/apub_objects/src/objects/comment.rs @@ -24,7 +24,7 @@ use activitypub_federation::{ traits::Object, }; use chrono::{DateTime, Utc}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, plugins::{plugin_hook_after, plugin_hook_before}, utils::{check_is_mod_or_admin, get_url_blocklist, process_markdown, slur_regex}, diff --git a/crates/apub_objects/src/objects/community.rs b/crates/apub_objects/src/objects/community.rs index 080d5f3a2..79de2667a 100644 --- a/crates/apub_objects/src/objects/community.rs +++ b/crates/apub_objects/src/objects/community.rs @@ -19,7 +19,7 @@ use activitypub_federation::{ traits::{Actor, Object}, }; use chrono::{DateTime, Utc}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, utils::{ check_nsfw_allowed, diff --git a/crates/apub_objects/src/objects/instance.rs b/crates/apub_objects/src/objects/instance.rs index 23dc534de..e2f677278 100644 --- a/crates/apub_objects/src/objects/instance.rs +++ b/crates/apub_objects/src/objects/instance.rs @@ -21,7 +21,7 @@ use activitypub_federation::{ traits::{Actor, Object}, }; use chrono::{DateTime, Utc}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, utils::{get_url_blocklist, process_markdown_opt, proxy_image_link_opt_apub, slur_regex}, }; diff --git a/crates/apub_objects/src/objects/person.rs b/crates/apub_objects/src/objects/person.rs index 71f390d3e..bec5065cf 100644 --- a/crates/apub_objects/src/objects/person.rs +++ b/crates/apub_objects/src/objects/person.rs @@ -17,7 +17,7 @@ use activitypub_federation::{ traits::{Actor, Object}, }; use chrono::{DateTime, Utc}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, utils::{ generate_outbox_url, diff --git a/crates/apub_objects/src/objects/post.rs b/crates/apub_objects/src/objects/post.rs index e7540d321..55285c31a 100644 --- a/crates/apub_objects/src/objects/post.rs +++ b/crates/apub_objects/src/objects/post.rs @@ -29,7 +29,7 @@ use activitypub_federation::{ use anyhow::anyhow; use chrono::{DateTime, Utc}; use html2text::{from_read_with_decorator, render::TrivialDecorator}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, plugins::{plugin_hook_after, plugin_hook_before}, request::generate_post_link_metadata, diff --git a/crates/apub_objects/src/objects/private_message.rs b/crates/apub_objects/src/objects/private_message.rs index e3dda2419..cd292868b 100644 --- a/crates/apub_objects/src/objects/private_message.rs +++ b/crates/apub_objects/src/objects/private_message.rs @@ -15,7 +15,7 @@ use activitypub_federation::{ traits::Object, }; use chrono::{DateTime, Utc}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, plugins::{plugin_hook_after, plugin_hook_before}, utils::{check_private_messages_enabled, get_url_blocklist, process_markdown, slur_regex}, diff --git a/crates/apub_objects/src/protocol/note.rs b/crates/apub_objects/src/protocol/note.rs index eec5aacbc..5645b8669 100644 --- a/crates/apub_objects/src/protocol/note.rs +++ b/crates/apub_objects/src/protocol/note.rs @@ -22,7 +22,7 @@ use activitypub_federation::{ }, }; use chrono::{DateTime, Utc}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::{community::Community, post::Post}, traits::Crud, diff --git a/crates/apub_objects/src/protocol/page.rs b/crates/apub_objects/src/protocol/page.rs index a62f40c62..b1a281178 100644 --- a/crates/apub_objects/src/protocol/page.rs +++ b/crates/apub_objects/src/protocol/page.rs @@ -24,7 +24,7 @@ use activitypub_federation::{ }; use chrono::{DateTime, Utc}; use itertools::Itertools; -use lemmy_api_common::{context::LemmyContext, utils::proxy_image_link}; +use lemmy_api_utils::{context::LemmyContext, utils::proxy_image_link}; use lemmy_utils::error::{FederationError, LemmyError, LemmyErrorType, LemmyResult}; use serde::{de::Error, Deserialize, Deserializer, Serialize}; use serde_with::skip_serializing_none; diff --git a/crates/apub_objects/src/utils/functions.rs b/crates/apub_objects/src/utils/functions.rs index 34dc1fdd9..bdf812acd 100644 --- a/crates/apub_objects/src/utils/functions.rs +++ b/crates/apub_objects/src/utils/functions.rs @@ -11,7 +11,7 @@ use activitypub_federation::{ }; use either::Either; use html2md::parse_html; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::{ community::{Community, CommunityActions, CommunityModeratorForm}, diff --git a/crates/apub_objects/src/utils/markdown_links.rs b/crates/apub_objects/src/utils/markdown_links.rs index afe583c14..eae0a270c 100644 --- a/crates/apub_objects/src/utils/markdown_links.rs +++ b/crates/apub_objects/src/utils/markdown_links.rs @@ -1,6 +1,6 @@ use crate::objects::{PostOrComment, SearchableObjects, UserOrCommunity}; use activitypub_federation::{config::Data, fetch::object_id::ObjectId}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::traits::ApubActor; use lemmy_utils::utils::markdown::image_links::{markdown_find_links, markdown_handle_title}; use url::Url; diff --git a/crates/apub_objects/src/utils/mentions.rs b/crates/apub_objects/src/utils/mentions.rs index ecdf8c1a0..9b751153f 100644 --- a/crates/apub_objects/src/utils/mentions.rs +++ b/crates/apub_objects/src/utils/mentions.rs @@ -5,7 +5,7 @@ use activitypub_federation::{ kinds::link::MentionType, traits::Actor, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::{comment::Comment, person::Person, post::Post}, traits::Crud, diff --git a/crates/apub_objects/src/utils/protocol.rs b/crates/apub_objects/src/utils/protocol.rs index 75fb9544a..6ca2eba12 100644 --- a/crates/apub_objects/src/utils/protocol.rs +++ b/crates/apub_objects/src/utils/protocol.rs @@ -5,7 +5,7 @@ use activitypub_federation::{ kinds::object::ImageType, protocol::values::MediaTypeMarkdown, }; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ impls::actor_language::UNDETERMINED_ID, newtypes::{DbUrl, LanguageId}, diff --git a/crates/apub_objects/src/utils/test.rs b/crates/apub_objects/src/utils/test.rs index 25809a04d..69c2fbb79 100644 --- a/crates/apub_objects/src/utils/test.rs +++ b/crates/apub_objects/src/utils/test.rs @@ -4,7 +4,7 @@ use crate::{ }; use activitypub_federation::{config::Data, protocol::context::WithContext, traits::Object}; use assert_json_diff::assert_json_include; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_utils::error::LemmyResult; use serde::{de::DeserializeOwned, Serialize}; use std::{collections::HashMap, fs::File, io::BufReader}; diff --git a/crates/db_schema/src/source/tag.rs b/crates/db_schema/src/source/tag.rs index 8b54633e1..1a9273ba0 100644 --- a/crates/db_schema/src/source/tag.rs +++ b/crates/db_schema/src/source/tag.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; #[cfg(feature = "full")] use { - diesel::{AsExpression, FromSqlRow}, + diesel::{sql_types::Nullable, AsExpression, FromSqlRow}, lemmy_db_schema_file::schema::tag, ts_rs::TS, }; diff --git a/crates/db_views/api_misc/Cargo.toml b/crates/db_views/api_misc/Cargo.toml new file mode 100644 index 000000000..5473d5b81 --- /dev/null +++ b/crates/db_views/api_misc/Cargo.toml @@ -0,0 +1,49 @@ +[package] +name = "lemmy_db_views_api_misc" +version.workspace = true +edition.workspace = true +description.workspace = true +license.workspace = true +homepage.workspace = true +documentation.workspace = true +repository.workspace = true + +[lib] +doctest = false + +[lints] +workspace = true + +[features] +full = [ + "lemmy_db_schema/full", + "lemmy_db_schema_file/full", + "lemmy_db_views_comment/full", + "lemmy_db_views_community/full", + "lemmy_db_views_community_follower/full", + "lemmy_db_views_community_moderator/full", + "lemmy_db_views_local_user/full", + "lemmy_db_views_person/full", + "lemmy_db_views_post/full", + "lemmy_db_views_post/full", + "extism", + "extism-convert", + "ts-rs", +] + +[dependencies] +lemmy_db_schema.workspace = true +lemmy_db_schema_file.workspace = true +lemmy_db_views_comment.workspace = true +lemmy_db_views_community.workspace = true +lemmy_db_views_community_follower.workspace = true +lemmy_db_views_community_moderator.workspace = true +lemmy_db_views_local_user.workspace = true +lemmy_db_views_person.workspace = true +lemmy_db_views_post.workspace = true +serde.workspace = true +serde_with.workspace = true +url.workspace = true +ts-rs = { workspace = true, optional = true } +extism = { git = "https://github.com/extism/extism.git", branch = "pool", optional = true } +extism-convert = { git = "https://github.com/extism/extism.git", branch = "pool", optional = true } diff --git a/crates/db_views/api_misc/src/lib.rs b/crates/db_views/api_misc/src/lib.rs new file mode 100644 index 000000000..b91294d83 --- /dev/null +++ b/crates/db_views/api_misc/src/lib.rs @@ -0,0 +1,406 @@ +use lemmy_db_schema::{ + newtypes::{InstanceId, LanguageId, PaginationCursor}, + sensitive::SensitiveString, + source::{community::Community, instance::Instance, login_token::LoginToken, person::Person}, +}; +use lemmy_db_schema_file::enums::{ + CommentSortType, + ListingType, + PostListingMode, + PostSortType, + VoteShow, +}; +use lemmy_db_views_comment::CommentView; +use lemmy_db_views_community::CommunityView; +use lemmy_db_views_community_follower::CommunityFollowerView; +use lemmy_db_views_community_moderator::CommunityModeratorView; +use lemmy_db_views_local_user::LocalUserView; +use lemmy_db_views_person::PersonView; +use lemmy_db_views_post::PostView; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +use url::Url; +#[cfg(feature = "full")] +use { + extism::FromBytes, + extism_convert::{encoding, Json}, + ts_rs::TS, +}; + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A captcha response. +pub struct CaptchaResponse { + /// A Base64 encoded png + pub png: String, + /// A Base64 encoded wav audio + pub wav: String, + /// The UUID for the captcha item. + pub uuid: String, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Changes your account password. +pub struct ChangePassword { + pub new_password: SensitiveString, + pub new_password_verify: SensitiveString, + pub old_password: SensitiveString, +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Create a tagline +pub struct CreateTagline { + pub content: String, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Delete your account. +pub struct DeleteAccount { + pub password: SensitiveString, + pub delete_content: bool, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A wrapper for the captcha response. +pub struct GetCaptchaResponse { + /// Will be None if captchas are disabled. + #[cfg_attr(feature = "full", ts(optional))] + pub ok: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct GenerateTotpSecretResponse { + pub totp_secret_url: SensitiveString, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct ListLoginsResponse { + pub logins: Vec, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Gets your hidden posts. +pub struct ListPersonHidden { + #[cfg_attr(feature = "full", ts(optional))] + pub page_cursor: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_back: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub limit: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// You hidden posts response. +pub struct ListPersonHiddenResponse { + pub hidden: Vec, + /// the pagination cursor to use to fetch the next page + #[cfg_attr(feature = "full", ts(optional))] + pub next_page: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub prev_page: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Gets your read posts. +pub struct ListPersonRead { + #[cfg_attr(feature = "full", ts(optional))] + pub page_cursor: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_back: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub limit: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// You read posts response. +pub struct ListPersonReadResponse { + pub read: Vec, + /// the pagination cursor to use to fetch the next page + #[cfg_attr(feature = "full", ts(optional))] + pub next_page: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub prev_page: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Logging into lemmy. +/// +/// Note: Banned users can still log in, to be able to do certain things like delete +/// their account. +pub struct Login { + pub username_or_email: SensitiveString, + pub password: SensitiveString, + /// May be required, if totp is enabled for their account. + #[cfg_attr(feature = "full", ts(optional))] + pub totp_2fa_token: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A response for your login. +pub struct LoginResponse { + /// This is None in response to `Register` if email verification is enabled, or the server + /// requires registration applications. + #[cfg_attr(feature = "full", ts(optional))] + pub jwt: Option, + /// If registration applications are required, this will return true for a signup response. + pub registration_created: bool, + /// If email verifications are required, this will return true for a signup response. + pub verify_email_sent: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Your user info. +pub struct MyUserInfo { + pub local_user_view: LocalUserView, + pub follows: Vec, + pub moderates: Vec, + pub community_blocks: Vec, + pub instance_blocks: Vec, + pub person_blocks: Vec, + pub keyword_blocks: Vec, + pub discussion_languages: Vec, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Change your password after receiving a reset request. +pub struct PasswordChangeAfterReset { + pub token: SensitiveString, + pub password: SensitiveString, + pub password_verify: SensitiveString, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Reset your password via email. +pub struct PasswordReset { + pub email: SensitiveString, +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +#[cfg_attr(feature = "full", derive(TS, FromBytes))] +#[cfg_attr(feature = "full", ts(export))] +#[cfg_attr(feature = "full", encoding(Json))] +pub struct PluginMetadata { + name: String, + url: Url, + description: String, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Make a request to resend your verification email. +pub struct ResendVerificationEmail { + pub email: SensitiveString, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Does an apub fetch for an object. +pub struct ResolveObject { + /// Can be the full url, or a shortened version like: !fediverse@lemmy.ml + pub q: String, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Default)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +// TODO Change this to an enum +/// The response of an apub object fetch. +pub struct ResolveObjectResponse { + #[cfg_attr(feature = "full", ts(optional))] + pub comment: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub post: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub community: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub person: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Saves settings for your user. +pub struct SaveUserSettings { + /// Show nsfw posts. + #[cfg_attr(feature = "full", ts(optional))] + pub show_nsfw: Option, + /// Blur nsfw posts. + #[cfg_attr(feature = "full", ts(optional))] + pub blur_nsfw: Option, + /// Your user's theme. + #[cfg_attr(feature = "full", ts(optional))] + pub theme: Option, + /// The default post listing type, usually "local" + #[cfg_attr(feature = "full", ts(optional))] + pub default_listing_type: Option, + /// A post-view mode that changes how multiple post listings look. + #[cfg_attr(feature = "full", ts(optional))] + pub post_listing_mode: Option, + /// The default post sort, usually "active" + #[cfg_attr(feature = "full", ts(optional))] + pub default_post_sort_type: Option, + /// A default time range limit to apply to post sorts, in seconds. 0 means none. + #[cfg_attr(feature = "full", ts(optional))] + pub default_post_time_range_seconds: Option, + /// The default comment sort, usually "hot" + #[cfg_attr(feature = "full", ts(optional))] + pub default_comment_sort_type: Option, + /// The language of the lemmy interface + #[cfg_attr(feature = "full", ts(optional))] + pub interface_language: Option, + /// Your display name, which can contain strange characters, and does not need to be unique. + #[cfg_attr(feature = "full", ts(optional))] + pub display_name: Option, + /// Your email. + #[cfg_attr(feature = "full", ts(optional))] + pub email: Option, + /// Your bio / info, in markdown. + #[cfg_attr(feature = "full", ts(optional))] + pub bio: Option, + /// Your matrix user id. Ex: @my_user:matrix.org + #[cfg_attr(feature = "full", ts(optional))] + pub matrix_user_id: Option, + /// Whether to show or hide avatars. + #[cfg_attr(feature = "full", ts(optional))] + pub show_avatars: Option, + /// Sends notifications to your email. + #[cfg_attr(feature = "full", ts(optional))] + pub send_notifications_to_email: Option, + /// Whether this account is a bot account. Users can hide these accounts easily if they wish. + #[cfg_attr(feature = "full", ts(optional))] + pub bot_account: Option, + /// Whether to show bot accounts. + #[cfg_attr(feature = "full", ts(optional))] + pub show_bot_accounts: Option, + /// Whether to show read posts. + #[cfg_attr(feature = "full", ts(optional))] + pub show_read_posts: Option, + /// A list of languages you are able to see discussion in. + #[cfg_attr(feature = "full", ts(optional))] + pub discussion_languages: Option>, + // A list of keywords used for blocking posts having them in title,url or body. + #[cfg_attr(feature = "full", ts(optional))] + pub blocking_keywords: Option>, + /// Open links in a new tab + #[cfg_attr(feature = "full", ts(optional))] + pub open_links_in_new_tab: Option, + /// Enable infinite scroll + #[cfg_attr(feature = "full", ts(optional))] + pub infinite_scroll_enabled: Option, + /// Whether to allow keyboard navigation (for browsing and interacting with posts and comments). + #[cfg_attr(feature = "full", ts(optional))] + pub enable_keyboard_navigation: Option, + /// Whether user avatars or inline images in the UI that are gifs should be allowed to play or + /// should be paused + #[cfg_attr(feature = "full", ts(optional))] + pub enable_animated_images: Option, + /// Whether a user can send / receive private messages + #[cfg_attr(feature = "full", ts(optional))] + pub enable_private_messages: Option, + /// Whether to auto-collapse bot comments. + #[cfg_attr(feature = "full", ts(optional))] + pub collapse_bot_comments: Option, + /// Some vote display mode settings + #[cfg_attr(feature = "full", ts(optional))] + pub show_scores: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub show_upvotes: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub show_downvotes: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub show_upvote_percentage: Option, + /// Whether to automatically mark fetched posts as read. + #[cfg_attr(feature = "full", ts(optional))] + pub auto_mark_fetched_posts_as_read: Option, + /// Whether to hide posts containing images/videos. + #[cfg_attr(feature = "full", ts(optional))] + pub hide_media: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A response that completes successfully. +pub struct SuccessResponse { + pub success: bool, +} + +impl Default for SuccessResponse { + fn default() -> Self { + SuccessResponse { success: true } + } +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct UpdateTotp { + pub totp_token: String, + pub enabled: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct UpdateTotpResponse { + pub enabled: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Block an instance as user +pub struct UserBlockInstanceParams { + pub instance_id: InstanceId, + pub block: bool, +} + +#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Verify your email. +pub struct VerifyEmail { + pub token: String, +} diff --git a/crates/db_views/comment/Cargo.toml b/crates/db_views/comment/Cargo.toml index e44663bc3..9ae2186c0 100644 --- a/crates/db_views/comment/Cargo.toml +++ b/crates/db_views/comment/Cargo.toml @@ -25,12 +25,14 @@ full = [ "i-love-jesus", "lemmy_db_schema/full", "lemmy_db_schema_file/full", + "lemmy_db_views_vote/full", ] [dependencies] lemmy_db_schema = { workspace = true } lemmy_utils = { workspace = true, optional = true } lemmy_db_schema_file = { workspace = true } +lemmy_db_views_vote = { workspace = true } diesel = { workspace = true, optional = true } diesel-async = { workspace = true, optional = true } diesel_ltree = { workspace = true, optional = true } diff --git a/crates/db_views/comment/src/api.rs b/crates/db_views/comment/src/api.rs new file mode 100644 index 000000000..9ebb29ce2 --- /dev/null +++ b/crates/db_views/comment/src/api.rs @@ -0,0 +1,207 @@ +use crate::{CommentSlimView, CommentView}; +use lemmy_db_schema::newtypes::{ + CommentId, + CommunityId, + LanguageId, + LocalUserId, + PaginationCursor, + PostId, +}; +use lemmy_db_schema_file::enums::{CommentSortType, ListingType}; +use lemmy_db_views_vote::VoteView; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +#[cfg(feature = "full")] +use ts_rs::TS; + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A comment response. +pub struct CommentResponse { + pub comment_view: CommentView, + pub recipient_ids: Vec, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Create a comment. +pub struct CreateComment { + pub content: String, + pub post_id: PostId, + #[cfg_attr(feature = "full", ts(optional))] + pub parent_id: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub language_id: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Like a comment. +pub struct CreateCommentLike { + pub comment_id: CommentId, + /// Must be -1, 0, or 1 . + pub score: i16, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Delete your own comment. +pub struct DeleteComment { + pub comment_id: CommentId, + pub deleted: bool, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Distinguish a comment (IE speak as moderator). +pub struct DistinguishComment { + pub comment_id: CommentId, + pub distinguished: bool, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, Copy, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Fetch an individual comment. +pub struct GetComment { + pub id: CommentId, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Get a list of comments. +pub struct GetComments { + #[cfg_attr(feature = "full", ts(optional))] + pub type_: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub sort: Option, + #[cfg_attr(feature = "full", ts(optional))] + /// Filter to within a given time range, in seconds. + /// IE 60 would give results for the past minute. + pub time_range_seconds: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub max_depth: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_cursor: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_back: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub limit: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub community_id: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub community_name: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub post_id: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub parent_id: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The comment list response. +pub struct GetCommentsResponse { + pub comments: Vec, + #[cfg_attr(feature = "full", ts(optional))] + pub next_page: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub prev_page: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A slimmer comment list response, without the post or community. +pub struct GetCommentsSlimResponse { + pub comments: Vec, + #[cfg_attr(feature = "full", ts(optional))] + pub next_page: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub prev_page: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// List comment likes. Admins-only. +pub struct ListCommentLikes { + pub comment_id: CommentId, + #[cfg_attr(feature = "full", ts(optional))] + pub page_cursor: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_back: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub limit: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The comment likes response +pub struct ListCommentLikesResponse { + pub comment_likes: Vec, + /// the pagination cursor to use to fetch the next page + #[cfg_attr(feature = "full", ts(optional))] + pub next_page: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub prev_page: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Purges a comment from the database. This will delete all content attached to that comment. +pub struct PurgeComment { + pub comment_id: CommentId, + #[cfg_attr(feature = "full", ts(optional))] + pub reason: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Remove a comment (only doable by mods). +pub struct RemoveComment { + pub comment_id: CommentId, + pub removed: bool, + #[cfg_attr(feature = "full", ts(optional))] + pub reason: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Save / bookmark a comment. +pub struct SaveComment { + pub comment_id: CommentId, + pub save: bool, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Edit a comment. +pub struct EditComment { + pub comment_id: CommentId, + #[cfg_attr(feature = "full", ts(optional))] + pub content: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub language_id: Option, +} diff --git a/crates/db_views/comment/src/lib.rs b/crates/db_views/comment/src/lib.rs index 73573ce66..a701aa7e1 100644 --- a/crates/db_views/comment/src/lib.rs +++ b/crates/db_views/comment/src/lib.rs @@ -29,6 +29,7 @@ use { ts_rs::TS, }; +pub mod api; #[cfg(feature = "full")] pub mod impls; diff --git a/crates/db_views/community/Cargo.toml b/crates/db_views/community/Cargo.toml index 7ef96ec90..8b46b764e 100644 --- a/crates/db_views/community/Cargo.toml +++ b/crates/db_views/community/Cargo.toml @@ -24,12 +24,16 @@ full = [ "i-love-jesus", "lemmy_db_schema/full", "lemmy_db_schema_file/full", + "lemmy_db_views_community_moderator/full", + "lemmy_db_views_person/full", ] [dependencies] lemmy_db_schema = { workspace = true } lemmy_utils = { workspace = true, optional = true } lemmy_db_schema_file = { workspace = true } +lemmy_db_views_community_moderator = { workspace = true } +lemmy_db_views_person = { workspace = true } diesel = { workspace = true, optional = true } diesel-async = { workspace = true, optional = true } serde = { workspace = true } diff --git a/crates/db_views/community/src/api.rs b/crates/db_views/community/src/api.rs new file mode 100644 index 000000000..8d69118f4 --- /dev/null +++ b/crates/db_views/community/src/api.rs @@ -0,0 +1,338 @@ +use crate::CommunityView; +use lemmy_db_schema::{ + newtypes::{CommunityId, LanguageId, PaginationCursor, PersonId, TagId}, + source::site::Site, + CommunitySortType, +}; +use lemmy_db_schema_file::enums::{CommunityVisibility, ListingType}; +use lemmy_db_views_community_moderator::CommunityModeratorView; +use lemmy_db_views_person::PersonView; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +#[cfg(feature = "full")] +use ts_rs::TS; + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Add a moderator to a community. +pub struct AddModToCommunity { + pub community_id: CommunityId, + pub person_id: PersonId, + pub added: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The response of adding a moderator to a community. +pub struct AddModToCommunityResponse { + pub moderators: Vec, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct ApproveCommunityPendingFollower { + pub community_id: CommunityId, + pub follower_id: PersonId, + pub approve: bool, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Ban a user from a community. +pub struct BanFromCommunity { + pub community_id: CommunityId, + pub person_id: PersonId, + pub ban: bool, + /// Optionally remove or restore all their data. Useful for new troll accounts. + /// If ban is true, then this means remove. If ban is false, it means restore. + #[cfg_attr(feature = "full", ts(optional))] + pub remove_or_restore_data: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub reason: Option, + /// A time that the ban will expire, in unix epoch seconds. + /// + /// An i64 unix timestamp is used for a simpler API client implementation. + #[cfg_attr(feature = "full", ts(optional))] + pub expires: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The response for banning a user from a community. +pub struct BanFromCommunityResponse { + pub person_view: PersonView, + pub banned: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Block a community. +pub struct BlockCommunity { + pub community_id: CommunityId, + pub block: bool, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The block community response. +pub struct BlockCommunityResponse { + pub community_view: CommunityView, + pub blocked: bool, +} + +/// Parameter for setting community icon or banner. Can't use POST data here as it already contains +/// the image data. +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct CommunityIdQuery { + pub id: CommunityId, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A simple community response. +pub struct CommunityResponse { + pub community_view: CommunityView, + pub discussion_languages: Vec, +} + +#[skip_serializing_none] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +/// Create a community. +pub struct CreateCommunity { + /// The unique name. + pub name: String, + /// A longer title. + pub title: String, + /// A sidebar for the community in markdown. + #[cfg_attr(feature = "full", ts(optional))] + pub sidebar: Option, + /// A shorter, one line description of your community. + #[cfg_attr(feature = "full", ts(optional))] + pub description: Option, + /// An icon URL. + #[cfg_attr(feature = "full", ts(optional))] + pub icon: Option, + /// A banner URL. + #[cfg_attr(feature = "full", ts(optional))] + pub banner: Option, + /// Whether its an NSFW community. + #[cfg_attr(feature = "full", ts(optional))] + pub nsfw: Option, + /// Whether to restrict posting only to moderators. + #[cfg_attr(feature = "full", ts(optional))] + pub posting_restricted_to_mods: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub discussion_languages: Option>, + #[cfg_attr(feature = "full", ts(optional))] + pub visibility: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Create a tag for a community. +pub struct CreateCommunityTag { + pub community_id: CommunityId, + pub display_name: String, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Delete your own community. +pub struct DeleteCommunity { + pub community_id: CommunityId, + pub deleted: bool, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Edit a community. +pub struct EditCommunity { + pub community_id: CommunityId, + /// A longer title. + #[cfg_attr(feature = "full", ts(optional))] + pub title: Option, + /// A sidebar for the community in markdown. + #[cfg_attr(feature = "full", ts(optional))] + pub sidebar: Option, + /// A shorter, one line description of your community. + #[cfg_attr(feature = "full", ts(optional))] + pub description: Option, + /// Whether its an NSFW community. + #[cfg_attr(feature = "full", ts(optional))] + pub nsfw: Option, + /// Whether to restrict posting only to moderators. + #[cfg_attr(feature = "full", ts(optional))] + pub posting_restricted_to_mods: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub discussion_languages: Option>, + #[cfg_attr(feature = "full", ts(optional))] + pub visibility: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Follow / subscribe to a community. +pub struct FollowCommunity { + pub community_id: CommunityId, + pub follow: bool, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +// TODO make this into a tagged enum +/// Get a community. Must provide either an id, or a name. +pub struct GetCommunity { + #[cfg_attr(feature = "full", ts(optional))] + pub id: Option, + /// Example: star_trek , or star_trek@xyz.tld + #[cfg_attr(feature = "full", ts(optional))] + pub name: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The community response. +pub struct GetCommunityResponse { + pub community_view: CommunityView, + #[cfg_attr(feature = "full", ts(optional))] + pub site: Option, + pub moderators: Vec, + pub discussion_languages: Vec, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Fetches a random community +pub struct GetRandomCommunity { + #[cfg_attr(feature = "full", ts(optional))] + pub type_: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub show_nsfw: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Hide a community from the main view. +pub struct HideCommunity { + pub community_id: CommunityId, + pub hidden: bool, + #[cfg_attr(feature = "full", ts(optional))] + pub reason: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Fetches a list of communities. +pub struct ListCommunities { + #[cfg_attr(feature = "full", ts(optional))] + pub type_: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub sort: Option, + #[cfg_attr(feature = "full", ts(optional))] + /// Filter to within a given time range, in seconds. + /// IE 60 would give results for the past minute. + pub time_range_seconds: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub show_nsfw: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_cursor: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_back: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub limit: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The response for listing communities. +pub struct ListCommunitiesResponse { + pub communities: Vec, + /// the pagination cursor to use to fetch the next page + #[cfg_attr(feature = "full", ts(optional))] + pub next_page: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub prev_page: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Purges a community from the database. This will delete all content attached to that community. +pub struct PurgeCommunity { + pub community_id: CommunityId, + #[cfg_attr(feature = "full", ts(optional))] + pub reason: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Remove a community (only doable by moderators). +pub struct RemoveCommunity { + pub community_id: CommunityId, + pub removed: bool, + #[cfg_attr(feature = "full", ts(optional))] + pub reason: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Transfer a community to a new owner. +pub struct TransferCommunity { + pub community_id: CommunityId, + pub person_id: PersonId, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Update a community tag. +pub struct UpdateCommunityTag { + pub tag_id: TagId, + pub display_name: String, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Delete a community tag. +pub struct DeleteCommunityTag { + pub tag_id: TagId, +} diff --git a/crates/db_views/community/src/lib.rs b/crates/db_views/community/src/lib.rs index ad8233e20..46e0eb578 100644 --- a/crates/db_views/community/src/lib.rs +++ b/crates/db_views/community/src/lib.rs @@ -12,6 +12,7 @@ use { ts_rs::TS, }; +pub mod api; #[cfg(feature = "full")] pub mod impls; diff --git a/crates/db_views/community_follower/src/api.rs b/crates/db_views/community_follower/src/api.rs new file mode 100644 index 000000000..24ab5abff --- /dev/null +++ b/crates/db_views/community_follower/src/api.rs @@ -0,0 +1,51 @@ +use crate::PendingFollow; +use lemmy_db_schema::newtypes::{CommunityId, PaginationCursor}; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +#[cfg(feature = "full")] +use ts_rs::TS; + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct GetCommunityPendingFollowsCount { + pub community_id: CommunityId, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct GetCommunityPendingFollowsCountResponse { + pub count: i64, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct ListCommunityPendingFollows { + /// Only shows the unapproved applications + #[cfg_attr(feature = "full", ts(optional))] + pub pending_only: Option, + // Only for admins, show pending follows for communities which you dont moderate + #[cfg_attr(feature = "full", ts(optional))] + pub all_communities: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_cursor: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_back: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub limit: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct ListCommunityPendingFollowsResponse { + pub items: Vec, + /// the pagination cursor to use to fetch the next page + #[cfg_attr(feature = "full", ts(optional))] + pub next_page: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub prev_page: Option, +} diff --git a/crates/db_views/community_follower/src/lib.rs b/crates/db_views/community_follower/src/lib.rs index d7a272592..c3fb3ed2f 100644 --- a/crates/db_views/community_follower/src/lib.rs +++ b/crates/db_views/community_follower/src/lib.rs @@ -8,6 +8,7 @@ use { ts_rs::TS, }; +pub mod api; #[cfg(feature = "full")] pub mod impls; diff --git a/crates/db_views/custom_emoji/Cargo.toml b/crates/db_views/custom_emoji/Cargo.toml index beff9534f..10199a6b5 100644 --- a/crates/db_views/custom_emoji/Cargo.toml +++ b/crates/db_views/custom_emoji/Cargo.toml @@ -32,4 +32,6 @@ lemmy_db_schema_file = { workspace = true } diesel = { workspace = true, optional = true } diesel-async = { workspace = true, optional = true } serde = { workspace = true } +serde_with = { workspace = true } ts-rs = { workspace = true, optional = true } +url = { workspace = true } diff --git a/crates/db_views/custom_emoji/src/api.rs b/crates/db_views/custom_emoji/src/api.rs new file mode 100644 index 000000000..9bd84c8a0 --- /dev/null +++ b/crates/db_views/custom_emoji/src/api.rs @@ -0,0 +1,67 @@ +use crate::CustomEmojiView; +use lemmy_db_schema::newtypes::CustomEmojiId; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +#[cfg(feature = "full")] +use ts_rs::TS; +use url::Url; + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Create a custom emoji. +pub struct CreateCustomEmoji { + pub category: String, + pub shortcode: String, + #[cfg_attr(feature = "full", ts(type = "string"))] + pub image_url: Url, + pub alt_text: String, + pub keywords: Vec, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A response for a custom emoji. +pub struct CustomEmojiResponse { + pub custom_emoji: CustomEmojiView, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Delete a custom emoji. +pub struct DeleteCustomEmoji { + pub id: CustomEmojiId, +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Edit a custom emoji. +pub struct EditCustomEmoji { + pub id: CustomEmojiId, + pub category: String, + #[cfg_attr(feature = "full", ts(type = "string"))] + pub image_url: Url, + pub alt_text: String, + pub keywords: Vec, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Fetches a list of custom emojis. +pub struct ListCustomEmojis { + #[cfg_attr(feature = "full", ts(optional))] + pub category: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A response for custom emojis. +pub struct ListCustomEmojisResponse { + pub custom_emojis: Vec, +} diff --git a/crates/db_views/custom_emoji/src/lib.rs b/crates/db_views/custom_emoji/src/lib.rs index 6633455d2..50cf865eb 100644 --- a/crates/db_views/custom_emoji/src/lib.rs +++ b/crates/db_views/custom_emoji/src/lib.rs @@ -6,6 +6,7 @@ use serde::{Deserialize, Serialize}; #[cfg(feature = "full")] use {diesel::Queryable, ts_rs::TS}; +pub mod api; #[cfg(feature = "full")] pub mod impls; diff --git a/crates/db_views/inbox_combined/src/api.rs b/crates/db_views/inbox_combined/src/api.rs new file mode 100644 index 000000000..52baf875b --- /dev/null +++ b/crates/db_views/inbox_combined/src/api.rs @@ -0,0 +1,61 @@ +use lemmy_db_schema::newtypes::{ + CommentReplyId, + PersonCommentMentionId, + PersonPostMentionId, + PrivateMessageId, +}; +use serde::{Deserialize, Serialize}; +#[cfg(feature = "full")] +use ts_rs::TS; + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A response containing a count of unread notifications. +pub struct GetUnreadCountResponse { + pub count: i64, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The count of unread registration applications. +pub struct GetUnreadRegistrationApplicationCountResponse { + pub registration_applications: i64, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Mark a comment reply as read. +pub struct MarkCommentReplyAsRead { + pub comment_reply_id: CommentReplyId, + pub read: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Mark a person mention as read. +pub struct MarkPersonCommentMentionAsRead { + pub person_comment_mention_id: PersonCommentMentionId, + pub read: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Mark a person mention as read. +pub struct MarkPersonPostMentionAsRead { + pub person_post_mention_id: PersonPostMentionId, + pub read: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Mark a private message as read. +pub struct MarkPrivateMessageAsRead { + pub private_message_id: PrivateMessageId, + pub read: bool, +} diff --git a/crates/db_views/inbox_combined/src/lib.rs b/crates/db_views/inbox_combined/src/lib.rs index 41adae0c3..cd7651314 100644 --- a/crates/db_views/inbox_combined/src/lib.rs +++ b/crates/db_views/inbox_combined/src/lib.rs @@ -41,6 +41,7 @@ use { ts_rs::TS, }; +pub mod api; #[cfg(feature = "full")] pub mod impls; diff --git a/crates/db_views/local_image/Cargo.toml b/crates/db_views/local_image/Cargo.toml index fe158bcaf..e2e14760f 100644 --- a/crates/db_views/local_image/Cargo.toml +++ b/crates/db_views/local_image/Cargo.toml @@ -36,3 +36,4 @@ serde = { workspace = true } serde_with = { workspace = true } ts-rs = { workspace = true, optional = true } i-love-jesus = { workspace = true, optional = true } +url = { workspace = true } diff --git a/crates/api_common/src/image.rs b/crates/db_views/local_image/src/api.rs similarity index 64% rename from crates/api_common/src/image.rs rename to crates/db_views/local_image/src/api.rs index 53ca38b01..f6ea9f282 100644 --- a/crates/api_common/src/image.rs +++ b/crates/db_views/local_image/src/api.rs @@ -1,10 +1,18 @@ -use lemmy_db_schema::newtypes::CommunityId; +use crate::LocalImageView; +use lemmy_db_schema::newtypes::PaginationCursor; use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; #[cfg(feature = "full")] use ts_rs::TS; use url::Url; +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct DeleteImageParams { + pub filename: String, +} + #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] #[cfg_attr(feature = "full", derive(TS))] @@ -16,13 +24,6 @@ pub struct ImageGetParams { pub max_size: Option, } -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct DeleteImageParams { - pub filename: String, -} - #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] #[cfg_attr(feature = "full", derive(TS))] @@ -35,6 +36,32 @@ pub struct ImageProxyParams { pub max_size: Option, } +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Get your user's image / media uploads. +pub struct ListMedia { + #[cfg_attr(feature = "full", ts(optional))] + pub page_cursor: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_back: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub limit: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct ListMediaResponse { + pub images: Vec, + /// the pagination cursor to use to fetch the next page + #[cfg_attr(feature = "full", ts(optional))] + pub next_page: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub prev_page: Option, +} + #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] #[cfg_attr(feature = "full", derive(TS))] @@ -43,12 +70,3 @@ pub struct UploadImageResponse { pub image_url: Url, pub filename: String, } - -/// Parameter for setting community icon or banner. Can't use POST data here as it already contains -/// the image data. -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -pub struct CommunityIdQuery { - pub id: CommunityId, -} diff --git a/crates/db_views/local_image/src/lib.rs b/crates/db_views/local_image/src/lib.rs index 035d64696..12ce8e0ed 100644 --- a/crates/db_views/local_image/src/lib.rs +++ b/crates/db_views/local_image/src/lib.rs @@ -7,6 +7,7 @@ use { ts_rs::TS, }; +pub mod api; #[cfg(feature = "full")] pub mod impls; diff --git a/crates/db_views/local_user/Cargo.toml b/crates/db_views/local_user/Cargo.toml index 2811aec27..aee05cf87 100644 --- a/crates/db_views/local_user/Cargo.toml +++ b/crates/db_views/local_user/Cargo.toml @@ -34,6 +34,7 @@ lemmy_db_schema_file = { workspace = true } diesel = { workspace = true, optional = true } diesel-async = { workspace = true, optional = true } serde = { workspace = true } +serde_with = { workspace = true } ts-rs = { workspace = true, optional = true } actix-web = { workspace = true, optional = true } i-love-jesus = { workspace = true, optional = true } diff --git a/crates/db_views/local_user/src/api.rs b/crates/db_views/local_user/src/api.rs new file mode 100644 index 000000000..a0dc6e39e --- /dev/null +++ b/crates/db_views/local_user/src/api.rs @@ -0,0 +1,33 @@ +use crate::LocalUserView; +use lemmy_db_schema::newtypes::PaginationCursor; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +#[cfg(feature = "full")] +use ts_rs::TS; + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct AdminListUsers { + #[cfg_attr(feature = "full", ts(optional))] + pub banned_only: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_cursor: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_back: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub limit: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct AdminListUsersResponse { + pub users: Vec, + /// the pagination cursor to use to fetch the next page + #[cfg_attr(feature = "full", ts(optional))] + pub next_page: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub prev_page: Option, +} diff --git a/crates/db_views/local_user/src/lib.rs b/crates/db_views/local_user/src/lib.rs index 190085163..944eab9e5 100644 --- a/crates/db_views/local_user/src/lib.rs +++ b/crates/db_views/local_user/src/lib.rs @@ -10,6 +10,7 @@ use { ts_rs::TS, }; +pub mod api; #[cfg(feature = "full")] pub mod impls; diff --git a/crates/db_views/modlog_combined/src/api.rs b/crates/db_views/modlog_combined/src/api.rs new file mode 100644 index 000000000..f1f02caf5 --- /dev/null +++ b/crates/db_views/modlog_combined/src/api.rs @@ -0,0 +1,59 @@ +use crate::ModlogCombinedView; +use lemmy_db_schema::{ + newtypes::{CommentId, CommunityId, PaginationCursor, PersonId, PostId}, + ModlogActionType, +}; +use lemmy_db_schema_file::enums::ListingType; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +#[cfg(feature = "full")] +use ts_rs::TS; + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Fetches the modlog. +pub struct GetModlog { + /// Filter by the moderator. + #[cfg_attr(feature = "full", ts(optional))] + pub mod_person_id: Option, + /// Filter by the community. + #[cfg_attr(feature = "full", ts(optional))] + pub community_id: Option, + /// Filter by the modlog action type. + #[cfg_attr(feature = "full", ts(optional))] + pub type_: Option, + /// Filter by listing type. When not using All, it will remove the non-community modlog entries, + /// such as site bans, instance blocks, adding an admin, etc. + #[cfg_attr(feature = "full", ts(optional))] + pub listing_type: Option, + /// Filter by the other / modded person. + #[cfg_attr(feature = "full", ts(optional))] + pub other_person_id: Option, + /// Filter by post. Will include comments of that post. + #[cfg_attr(feature = "full", ts(optional))] + pub post_id: Option, + /// Filter by comment. + #[cfg_attr(feature = "full", ts(optional))] + pub comment_id: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_cursor: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_back: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub limit: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The modlog fetch response. +pub struct GetModlogResponse { + pub modlog: Vec, + /// the pagination cursor to use to fetch the next page + #[cfg_attr(feature = "full", ts(optional))] + pub next_page: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub prev_page: Option, +} diff --git a/crates/db_views/modlog_combined/src/lib.rs b/crates/db_views/modlog_combined/src/lib.rs index 8cb7720b9..2dbad99e7 100644 --- a/crates/db_views/modlog_combined/src/lib.rs +++ b/crates/db_views/modlog_combined/src/lib.rs @@ -1,35 +1,32 @@ -use lemmy_db_schema::{ - newtypes::PaginationCursor, - source::{ - comment::Comment, - community::Community, - instance::Instance, - mod_log::{ - admin::{ - AdminAllowInstance, - AdminBlockInstance, - AdminPurgeComment, - AdminPurgeCommunity, - AdminPurgePerson, - AdminPurgePost, - }, - moderator::{ - ModAdd, - ModAddCommunity, - ModBan, - ModBanFromCommunity, - ModChangeCommunityVisibility, - ModFeaturePost, - ModLockPost, - ModRemoveComment, - ModRemoveCommunity, - ModRemovePost, - ModTransferCommunity, - }, +use lemmy_db_schema::source::{ + comment::Comment, + community::Community, + instance::Instance, + mod_log::{ + admin::{ + AdminAllowInstance, + AdminBlockInstance, + AdminPurgeComment, + AdminPurgeCommunity, + AdminPurgePerson, + AdminPurgePost, + }, + moderator::{ + ModAdd, + ModAddCommunity, + ModBan, + ModBanFromCommunity, + ModChangeCommunityVisibility, + ModFeaturePost, + ModLockPost, + ModRemoveComment, + ModRemoveCommunity, + ModRemovePost, + ModTransferCommunity, }, - person::Person, - post::Post, }, + person::Person, + post::Post, }; use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; @@ -40,6 +37,7 @@ use { ts_rs::TS, }; +pub mod api; #[cfg(feature = "full")] pub mod impls; @@ -360,16 +358,3 @@ pub enum ModlogCombinedView { ModRemovePost(ModRemovePostView), ModTransferCommunity(ModTransferCommunityView), } - -#[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] -#[cfg_attr(feature = "full", ts(export))] -/// The modlog fetch response. -pub struct GetModlogResponse { - pub modlog: Vec, - /// the pagination cursor to use to fetch the next page - #[cfg_attr(feature = "full", ts(optional))] - pub next_page: Option, - #[cfg_attr(feature = "full", ts(optional))] - pub prev_page: Option, -} diff --git a/crates/db_views/person/Cargo.toml b/crates/db_views/person/Cargo.toml index 5f0b5331a..77f3d9bab 100644 --- a/crates/db_views/person/Cargo.toml +++ b/crates/db_views/person/Cargo.toml @@ -24,15 +24,18 @@ full = [ "i-love-jesus", "lemmy_db_schema/full", "lemmy_db_schema_file/full", + "lemmy_db_views_community_moderator/full", ] [dependencies] lemmy_db_schema = { workspace = true } lemmy_utils = { workspace = true, optional = true } lemmy_db_schema_file = { workspace = true } +lemmy_db_views_community_moderator = { workspace = true } diesel = { workspace = true, optional = true } diesel-async = { workspace = true, optional = true } serde = { workspace = true } +serde_with = { workspace = true } ts-rs = { workspace = true, optional = true } i-love-jesus = { workspace = true, optional = true } diff --git a/crates/db_views/person/src/api.rs b/crates/db_views/person/src/api.rs new file mode 100644 index 000000000..5ffa45a18 --- /dev/null +++ b/crates/db_views/person/src/api.rs @@ -0,0 +1,110 @@ +use crate::PersonView; +use lemmy_db_schema::{newtypes::PersonId, source::site::Site}; +use lemmy_db_views_community_moderator::CommunityModeratorView; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +#[cfg(feature = "full")] +use ts_rs::TS; + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Adds an admin to a site. +pub struct AddAdmin { + pub person_id: PersonId, + pub added: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The response of current admins. +pub struct AddAdminResponse { + pub admins: Vec, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Ban a person from the site. +pub struct BanPerson { + pub person_id: PersonId, + pub ban: bool, + /// Optionally remove or restore all their data. Useful for new troll accounts. + /// If ban is true, then this means remove. If ban is false, it means restore. + #[cfg_attr(feature = "full", ts(optional))] + pub remove_or_restore_data: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub reason: Option, + /// A time that the ban will expire, in unix epoch seconds. + /// + /// An i64 unix timestamp is used for a simpler API client implementation. + #[cfg_attr(feature = "full", ts(optional))] + pub expires: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A response for a banned person. +pub struct BanPersonResponse { + pub person_view: PersonView, + pub banned: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Block a person. +pub struct BlockPerson { + pub person_id: PersonId, + pub block: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The response for a person block. +pub struct BlockPersonResponse { + pub person_view: PersonView, + pub blocked: bool, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Gets a person's details. +/// +/// Either person_id, or username are required. +pub struct GetPersonDetails { + #[cfg_attr(feature = "full", ts(optional))] + pub person_id: Option, + /// Example: dessalines , or dessalines@xyz.tld + #[cfg_attr(feature = "full", ts(optional))] + pub username: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A person's details response. +pub struct GetPersonDetailsResponse { + pub person_view: PersonView, + #[cfg_attr(feature = "full", ts(optional))] + pub site: Option, + pub moderates: Vec, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Purges a person from the database. This will delete all content attached to that person. +pub struct PurgePerson { + pub person_id: PersonId, + #[cfg_attr(feature = "full", ts(optional))] + pub reason: Option, +} diff --git a/crates/db_views/person/src/lib.rs b/crates/db_views/person/src/lib.rs index 8ba2f1c74..1a6d64e87 100644 --- a/crates/db_views/person/src/lib.rs +++ b/crates/db_views/person/src/lib.rs @@ -19,6 +19,7 @@ use { ts_rs::TS, }; +pub mod api; #[cfg(feature = "full")] pub mod impls; diff --git a/crates/db_views/post/Cargo.toml b/crates/db_views/post/Cargo.toml index a53e47fe8..ec8d9d50c 100644 --- a/crates/db_views/post/Cargo.toml +++ b/crates/db_views/post/Cargo.toml @@ -24,12 +24,16 @@ full = [ "i-love-jesus", "lemmy_db_schema/full", "lemmy_db_schema_file/full", + "lemmy_db_views_community/full", + "lemmy_db_views_vote/full", ] [dependencies] lemmy_db_schema = { workspace = true } lemmy_utils = { workspace = true, optional = true } lemmy_db_schema_file = { workspace = true } +lemmy_db_views_community = { workspace = true } +lemmy_db_views_vote = { workspace = true } diesel = { workspace = true, optional = true } diesel-async = { workspace = true, optional = true } serde = { workspace = true } diff --git a/crates/db_views/post/src/api.rs b/crates/db_views/post/src/api.rs new file mode 100644 index 000000000..e4bdb03b7 --- /dev/null +++ b/crates/db_views/post/src/api.rs @@ -0,0 +1,339 @@ +use crate::PostView; +use lemmy_db_schema::{ + newtypes::{CommentId, CommunityId, DbUrl, LanguageId, PaginationCursor, PostId, TagId}, + PostFeatureType, +}; +use lemmy_db_schema_file::enums::{ListingType, PostSortType}; +use lemmy_db_views_community::CommunityView; +use lemmy_db_views_vote::VoteView; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +#[cfg(feature = "full")] +use ts_rs::TS; + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Create a post. +pub struct CreatePost { + pub name: String, + pub community_id: CommunityId, + #[cfg_attr(feature = "full", ts(optional))] + pub url: Option, + /// An optional body for the post in markdown. + #[cfg_attr(feature = "full", ts(optional))] + pub body: Option, + /// An optional alt_text, usable for image posts. + #[cfg_attr(feature = "full", ts(optional))] + pub alt_text: Option, + /// A honeypot to catch bots. Should be None. + #[cfg_attr(feature = "full", ts(optional))] + pub honeypot: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub nsfw: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub language_id: Option, + /// Instead of fetching a thumbnail, use a custom one. + #[cfg_attr(feature = "full", ts(optional))] + pub custom_thumbnail: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub tags: Option>, + /// Time when this post should be scheduled. Null means publish immediately. + #[cfg_attr(feature = "full", ts(optional))] + pub scheduled_publish_time: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Like a post. +pub struct CreatePostLike { + pub post_id: PostId, + /// Score must be -1, 0, or 1. + pub score: i16, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Delete a post. +pub struct DeletePost { + pub post_id: PostId, + pub deleted: bool, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Edit a post. +pub struct EditPost { + pub post_id: PostId, + #[cfg_attr(feature = "full", ts(optional))] + pub name: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub url: Option, + /// An optional body for the post in markdown. + #[cfg_attr(feature = "full", ts(optional))] + pub body: Option, + /// An optional alt_text, usable for image posts. + #[cfg_attr(feature = "full", ts(optional))] + pub alt_text: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub nsfw: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub language_id: Option, + /// Instead of fetching a thumbnail, use a custom one. + #[cfg_attr(feature = "full", ts(optional))] + pub custom_thumbnail: Option, + /// Time when this post should be scheduled. Null means publish immediately. + #[cfg_attr(feature = "full", ts(optional))] + pub scheduled_publish_time: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub tags: Option>, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Feature a post (stickies / pins to the top). +pub struct FeaturePost { + pub post_id: PostId, + pub featured: bool, + pub feature_type: PostFeatureType, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +// TODO this should be made into a tagged enum +/// Get a post. Needs either the post id, or comment_id. +pub struct GetPost { + #[cfg_attr(feature = "full", ts(optional))] + pub id: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub comment_id: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The post response. +pub struct GetPostResponse { + pub post_view: PostView, + pub community_view: CommunityView, + /// A list of cross-posts, or other times / communities this link has been posted to. + pub cross_posts: Vec, +} + +#[skip_serializing_none] +#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Get a list of posts. +pub struct GetPosts { + #[cfg_attr(feature = "full", ts(optional))] + pub type_: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub sort: Option, + #[cfg_attr(feature = "full", ts(optional))] + /// Filter to within a given time range, in seconds. + /// IE 60 would give results for the past minute. + /// Use Zero to override the local_site and local_user time_range. + pub time_range_seconds: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub community_id: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub community_name: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub show_hidden: Option, + /// If true, then show the read posts (even if your user setting is to hide them) + #[cfg_attr(feature = "full", ts(optional))] + pub show_read: Option, + /// If true, then show the nsfw posts (even if your user setting is to hide them) + #[cfg_attr(feature = "full", ts(optional))] + pub show_nsfw: Option, + /// If false, then show posts with media attached (even if your user setting is to hide them) + #[cfg_attr(feature = "full", ts(optional))] + pub hide_media: Option, + /// Whether to automatically mark fetched posts as read. + #[cfg_attr(feature = "full", ts(optional))] + pub mark_as_read: Option, + #[cfg_attr(feature = "full", ts(optional))] + /// If true, then only show posts with no comments + pub no_comments_only: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_cursor: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_back: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub limit: Option, +} + +#[skip_serializing_none] +#[derive(Serialize, Deserialize, Debug, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The post list response. +pub struct GetPostsResponse { + pub posts: Vec, + /// the pagination cursor to use to fetch the next page + #[cfg_attr(feature = "full", ts(optional))] + pub next_page: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub prev_page: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Get metadata for a given site. +pub struct GetSiteMetadata { + pub url: String, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The site metadata response. +pub struct GetSiteMetadataResponse { + pub metadata: LinkMetadata, +} + +#[skip_serializing_none] +#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone, Default, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Site metadata, from its opengraph tags. +pub struct LinkMetadata { + #[serde(flatten)] + pub opengraph_data: OpenGraphData, + #[cfg_attr(feature = "full", ts(optional))] + pub content_type: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Hide a post from list views +pub struct HidePost { + pub post_id: PostId, + pub hide: bool, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// List post likes. Admins-only. +pub struct ListPostLikes { + pub post_id: PostId, + #[cfg_attr(feature = "full", ts(optional))] + pub page_cursor: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_back: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub limit: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The post likes response +pub struct ListPostLikesResponse { + pub post_likes: Vec, + /// the pagination cursor to use to fetch the next page + #[cfg_attr(feature = "full", ts(optional))] + pub next_page: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub prev_page: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Lock a post (prevent new comments). +pub struct LockPost { + pub post_id: PostId, + pub locked: bool, + #[cfg_attr(feature = "full", ts(optional))] + pub reason: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Mark a post as read. +pub struct MarkPostAsRead { + pub post_id: PostId, + pub read: bool, +} + +#[skip_serializing_none] +#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone, Default, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Site metadata, from its opengraph tags. +pub struct OpenGraphData { + #[cfg_attr(feature = "full", ts(optional))] + pub title: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub description: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub image: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub embed_video_url: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct PostResponse { + pub post_view: PostView, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Purges a post from the database. This will delete all content attached to that post. +pub struct PurgePost { + pub post_id: PostId, + #[cfg_attr(feature = "full", ts(optional))] + pub reason: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Remove a post (only doable by mods). +pub struct RemovePost { + pub post_id: PostId, + pub removed: bool, + #[cfg_attr(feature = "full", ts(optional))] + pub reason: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Save / bookmark a post. +pub struct SavePost { + pub post_id: PostId, + pub save: bool, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Mark several posts as read. +pub struct MarkManyPostsAsRead { + pub post_ids: Vec, +} diff --git a/crates/db_views/post/src/lib.rs b/crates/db_views/post/src/lib.rs index 7e2fb4460..616d901e5 100644 --- a/crates/db_views/post/src/lib.rs +++ b/crates/db_views/post/src/lib.rs @@ -28,6 +28,7 @@ use { ts_rs::TS, }; +pub mod api; #[cfg(feature = "full")] pub mod impls; diff --git a/crates/db_views/private_message/src/api.rs b/crates/db_views/private_message/src/api.rs new file mode 100644 index 000000000..23418c5dc --- /dev/null +++ b/crates/db_views/private_message/src/api.rs @@ -0,0 +1,40 @@ +use crate::PrivateMessageView; +use lemmy_db_schema::newtypes::{PersonId, PrivateMessageId}; +use serde::{Deserialize, Serialize}; +#[cfg(feature = "full")] +use ts_rs::TS; + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Create a private message. +pub struct CreatePrivateMessage { + pub content: String, + pub recipient_id: PersonId, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Delete a private message. +pub struct DeletePrivateMessage { + pub private_message_id: PrivateMessageId, + pub deleted: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Edit a private message. +pub struct EditPrivateMessage { + pub private_message_id: PrivateMessageId, + pub content: String, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A single private message response. +pub struct PrivateMessageResponse { + pub private_message_view: PrivateMessageView, +} diff --git a/crates/db_views/private_message/src/lib.rs b/crates/db_views/private_message/src/lib.rs index 634039895..b37b9f550 100644 --- a/crates/db_views/private_message/src/lib.rs +++ b/crates/db_views/private_message/src/lib.rs @@ -8,6 +8,7 @@ use { ts_rs::TS, }; +pub mod api; #[cfg(feature = "full")] pub mod impls; diff --git a/crates/db_views/readable_federation_state/Cargo.toml b/crates/db_views/readable_federation_state/Cargo.toml new file mode 100644 index 000000000..a3562538c --- /dev/null +++ b/crates/db_views/readable_federation_state/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "lemmy_db_views_readable_federation_state" +version.workspace = true +edition.workspace = true +description.workspace = true +license.workspace = true +homepage.workspace = true +documentation.workspace = true +repository.workspace = true + +[lib] +doctest = false + +[lints] +workspace = true + +[features] +full = ["ts-rs", "lemmy_db_schema/full", "lemmy_utils/full"] + +[dependencies] +lemmy_db_schema = { workspace = true } +lemmy_utils = { workspace = true } +serde = { workspace = true } +serde_with = { workspace = true } +ts-rs = { workspace = true, optional = true } +chrono = { workspace = true } diff --git a/crates/db_views/readable_federation_state/src/impls.rs b/crates/db_views/readable_federation_state/src/impls.rs new file mode 100644 index 000000000..2689ac6a1 --- /dev/null +++ b/crates/db_views/readable_federation_state/src/impls.rs @@ -0,0 +1,16 @@ +use crate::ReadableFederationState; +use lemmy_db_schema::source::federation_queue_state::FederationQueueState; +use lemmy_utils::federate_retry_sleep_duration; + +#[allow(clippy::expect_used)] +impl From for ReadableFederationState { + fn from(internal_state: FederationQueueState) -> Self { + ReadableFederationState { + next_retry: internal_state.last_retry.map(|r| { + r + chrono::Duration::from_std(federate_retry_sleep_duration(internal_state.fail_count)) + .expect("sleep duration longer than 2**63 ms (262 million years)") + }), + internal_state, + } + } +} diff --git a/crates/db_views/readable_federation_state/src/lib.rs b/crates/db_views/readable_federation_state/src/lib.rs new file mode 100644 index 000000000..0287d8877 --- /dev/null +++ b/crates/db_views/readable_federation_state/src/lib.rs @@ -0,0 +1,20 @@ +use chrono::{DateTime, Utc}; +use lemmy_db_schema::source::federation_queue_state::FederationQueueState; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +#[cfg(feature = "full")] +use ts_rs::TS; + +mod impls; + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct ReadableFederationState { + #[serde(flatten)] + internal_state: FederationQueueState, + /// timestamp of the next retry attempt (null if fail count is 0) + #[cfg_attr(feature = "full", ts(optional))] + next_retry: Option>, +} diff --git a/crates/db_views/registration_applications/src/api.rs b/crates/db_views/registration_applications/src/api.rs new file mode 100644 index 000000000..c48364b56 --- /dev/null +++ b/crates/db_views/registration_applications/src/api.rs @@ -0,0 +1,96 @@ +use crate::RegistrationApplicationView; +use lemmy_db_schema::{ + newtypes::{PaginationCursor, PersonId, RegistrationApplicationId}, + sensitive::SensitiveString, +}; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +#[cfg(feature = "full")] +use ts_rs::TS; + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Approves a registration application. +pub struct ApproveRegistrationApplication { + pub id: RegistrationApplicationId, + pub approve: bool, + #[cfg_attr(feature = "full", ts(optional))] + pub deny_reason: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Gets a registration application for a person +pub struct GetRegistrationApplication { + pub person_id: PersonId, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Fetches a list of registration applications. +pub struct ListRegistrationApplications { + /// Only shows the unread applications (IE those without an admin actor) + #[cfg_attr(feature = "full", ts(optional))] + pub unread_only: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_cursor: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_back: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub limit: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The list of registration applications. +pub struct ListRegistrationApplicationsResponse { + pub registration_applications: Vec, + /// the pagination cursor to use to fetch the next page + #[cfg_attr(feature = "full", ts(optional))] + pub next_page: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub prev_page: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Register / Sign up to lemmy. +pub struct Register { + pub username: String, + pub password: SensitiveString, + pub password_verify: SensitiveString, + #[cfg_attr(feature = "full", ts(optional))] + pub show_nsfw: Option, + /// email is mandatory if email verification is enabled on the server + #[cfg_attr(feature = "full", ts(optional))] + pub email: Option, + /// The UUID of the captcha item. + #[cfg_attr(feature = "full", ts(optional))] + pub captcha_uuid: Option, + /// Your captcha answer. + #[cfg_attr(feature = "full", ts(optional))] + pub captcha_answer: Option, + /// A form field to trick signup bots. Should be None. + #[cfg_attr(feature = "full", ts(optional))] + pub honeypot: Option, + /// An answer is mandatory if require application is enabled on the server + #[cfg_attr(feature = "full", ts(optional))] + pub answer: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The response of an action done to a registration application. +pub struct RegistrationApplicationResponse { + pub registration_application: RegistrationApplicationView, +} diff --git a/crates/db_views/registration_applications/src/lib.rs b/crates/db_views/registration_applications/src/lib.rs index 5f4da0917..d84c39c4a 100644 --- a/crates/db_views/registration_applications/src/lib.rs +++ b/crates/db_views/registration_applications/src/lib.rs @@ -12,6 +12,7 @@ use { ts_rs::TS, }; +pub mod api; #[cfg(feature = "full")] pub mod impls; diff --git a/crates/db_views/report_combined/Cargo.toml b/crates/db_views/report_combined/Cargo.toml index 320cef065..3439e2958 100644 --- a/crates/db_views/report_combined/Cargo.toml +++ b/crates/db_views/report_combined/Cargo.toml @@ -35,6 +35,7 @@ lemmy_db_schema_file = { workspace = true } diesel = { workspace = true, optional = true } diesel-async = { workspace = true, optional = true } serde = { workspace = true } +serde_with = { workspace = true } chrono = { workspace = true } ts-rs = { workspace = true, optional = true } i-love-jesus = { workspace = true, optional = true } diff --git a/crates/api_common/src/reports/combined.rs b/crates/db_views/report_combined/src/api.rs similarity index 97% rename from crates/api_common/src/reports/combined.rs rename to crates/db_views/report_combined/src/api.rs index 0b73bdcb0..441299208 100644 --- a/crates/api_common/src/reports/combined.rs +++ b/crates/db_views/report_combined/src/api.rs @@ -1,8 +1,8 @@ +use crate::ReportCombinedView; use lemmy_db_schema::{ newtypes::{CommunityId, PaginationCursor, PostId}, ReportType, }; -use lemmy_db_views_report_combined::ReportCombinedView; use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; #[cfg(feature = "full")] diff --git a/crates/db_views/report_combined/src/lib.rs b/crates/db_views/report_combined/src/lib.rs index c93c05b74..8caa0696c 100644 --- a/crates/db_views/report_combined/src/lib.rs +++ b/crates/db_views/report_combined/src/lib.rs @@ -35,6 +35,7 @@ use { ts_rs::TS, }; +pub mod api; #[cfg(feature = "full")] pub mod impls; diff --git a/crates/db_views/reports/src/api.rs b/crates/db_views/reports/src/api.rs new file mode 100644 index 000000000..789c940b3 --- /dev/null +++ b/crates/db_views/reports/src/api.rs @@ -0,0 +1,142 @@ +use crate::{CommentReportView, CommunityReportView, PostReportView, PrivateMessageReportView}; +use lemmy_db_schema::newtypes::{ + CommentId, + CommentReportId, + CommunityId, + CommunityReportId, + PostId, + PostReportId, + PrivateMessageId, + PrivateMessageReportId, +}; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +#[cfg(feature = "full")] +use ts_rs::TS; + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The comment report response. +pub struct CommentReportResponse { + pub comment_report_view: CommentReportView, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A community report response. +pub struct CommunityReportResponse { + pub community_report_view: CommunityReportView, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Report a comment. +pub struct CreateCommentReport { + pub comment_id: CommentId, + pub reason: String, + #[cfg_attr(feature = "full", ts(optional))] + pub violates_instance_rules: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Create a report for a community. +pub struct CreateCommunityReport { + pub community_id: CommunityId, + pub reason: String, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Create a post report. +pub struct CreatePostReport { + pub post_id: PostId, + pub reason: String, + #[cfg_attr(feature = "full", ts(optional))] + pub violates_instance_rules: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Get a count of the number of reports. +pub struct GetReportCount { + #[cfg_attr(feature = "full", ts(optional))] + pub community_id: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A response for the number of reports. +pub struct GetReportCountResponse { + pub count: i64, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Resolve a comment report (only doable by mods). +pub struct ResolveCommentReport { + pub report_id: CommentReportId, + pub resolved: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Resolve a community report. +pub struct ResolveCommunityReport { + pub report_id: CommunityReportId, + pub resolved: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Resolve a post report (mods only). +pub struct ResolvePostReport { + pub report_id: PostReportId, + pub resolved: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Resolve a private message report. +pub struct ResolvePrivateMessageReport { + pub report_id: PrivateMessageReportId, + pub resolved: bool, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Create a report for a private message. +pub struct CreatePrivateMessageReport { + pub private_message_id: PrivateMessageId, + pub reason: String, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A private message report response. +pub struct PrivateMessageReportResponse { + pub private_message_report_view: PrivateMessageReportView, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The post report response. +pub struct PostReportResponse { + pub post_report_view: PostReportView, +} diff --git a/crates/db_views/reports/src/lib.rs b/crates/db_views/reports/src/lib.rs index 85439329e..1808ea1eb 100644 --- a/crates/db_views/reports/src/lib.rs +++ b/crates/db_views/reports/src/lib.rs @@ -29,6 +29,7 @@ use { ts_rs::TS, }; +pub mod api; #[cfg(feature = "full")] pub mod comment_report_view; diff --git a/crates/db_views/site/Cargo.toml b/crates/db_views/site/Cargo.toml index 8e82b8be7..3880d7f72 100644 --- a/crates/db_views/site/Cargo.toml +++ b/crates/db_views/site/Cargo.toml @@ -23,13 +23,22 @@ full = [ "ts-rs", "lemmy_db_schema/full", "lemmy_db_schema_file/full", + "lemmy_db_views_api_misc/full", + "lemmy_db_views_person/full", + "lemmy_db_views_readable_federation_state/full", ] [dependencies] lemmy_db_schema = { workspace = true } lemmy_utils = { workspace = true, optional = true } lemmy_db_schema_file = { workspace = true } +lemmy_db_views_api_misc = { workspace = true } +lemmy_db_views_person = { workspace = true } +lemmy_db_views_readable_federation_state = { workspace = true } +chrono = { workspace = true } diesel = { workspace = true, optional = true } diesel-async = { workspace = true, optional = true } serde = { workspace = true } +serde_with = { workspace = true } ts-rs = { workspace = true, optional = true } +url = { workspace = true } diff --git a/crates/db_views/site/src/api.rs b/crates/db_views/site/src/api.rs new file mode 100644 index 000000000..ef2e6b02e --- /dev/null +++ b/crates/db_views/site/src/api.rs @@ -0,0 +1,484 @@ +use crate::SiteView; +use chrono::{DateTime, Utc}; +use lemmy_db_schema::{ + newtypes::{LanguageId, OAuthProviderId, PaginationCursor, TaglineId}, + source::{ + instance::Instance, + language::Language, + local_site_url_blocklist::LocalSiteUrlBlocklist, + oauth_provider::{OAuthProvider, PublicOAuthProvider}, + tagline::Tagline, + }, +}; +use lemmy_db_schema_file::enums::{ + CommentSortType, + FederationMode, + ListingType, + PostListingMode, + PostSortType, + RegistrationMode, +}; +use lemmy_db_views_api_misc::{MyUserInfo, PluginMetadata}; +use lemmy_db_views_person::PersonView; +use lemmy_db_views_readable_federation_state::ReadableFederationState; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +#[cfg(feature = "full")] +use ts_rs::TS; +use url::Url; + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct AdminAllowInstanceParams { + pub instance: String, + pub allow: bool, + #[cfg_attr(feature = "full", ts(optional))] + pub reason: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct AdminBlockInstanceParams { + pub instance: String, + pub block: bool, + #[cfg_attr(feature = "full", ts(optional))] + pub reason: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub expires: Option>, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Logging in with an OAuth 2.0 authorization +pub struct AuthenticateWithOauth { + pub code: String, + pub oauth_provider_id: OAuthProviderId, + pub redirect_uri: Url, + #[cfg_attr(feature = "full", ts(optional))] + pub show_nsfw: Option, + /// Username is mandatory at registration time + #[cfg_attr(feature = "full", ts(optional))] + pub username: Option, + /// An answer is mandatory if require application is enabled on the server + #[cfg_attr(feature = "full", ts(optional))] + pub answer: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub pkce_code_verifier: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Create an external auth method. +pub struct CreateOAuthProvider { + pub display_name: String, + pub issuer: String, + pub authorization_endpoint: String, + pub token_endpoint: String, + pub userinfo_endpoint: String, + pub id_claim: String, + pub client_id: String, + pub client_secret: String, + pub scopes: String, + #[cfg_attr(feature = "full", ts(optional))] + pub auto_verify_email: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub account_linking_enabled: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub use_pkce: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub enabled: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Creates a site. Should be done after first running lemmy. +pub struct CreateSite { + pub name: String, + #[cfg_attr(feature = "full", ts(optional))] + pub sidebar: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub description: Option, + #[cfg_attr(feature = "full", ts(optional))] + #[cfg_attr(feature = "full", ts(optional))] + pub community_creation_admin_only: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub require_email_verification: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub application_question: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub private_instance: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub default_theme: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub default_post_listing_type: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub default_post_listing_mode: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub default_post_sort_type: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub default_post_time_range_seconds: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub default_comment_sort_type: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub legal_information: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub application_email_admins: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub hide_modlog_mod_names: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub discussion_languages: Option>, + #[cfg_attr(feature = "full", ts(optional))] + pub slur_filter_regex: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub actor_name_max_length: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_message: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_message_per_second: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_post: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_post_per_second: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_register: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_register_per_second: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_image: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_image_per_second: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_comment: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_comment_per_second: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_search: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_search_per_second: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub federation_enabled: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub captcha_enabled: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub captcha_difficulty: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub registration_mode: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub oauth_registration: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub content_warning: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub post_upvotes: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub post_downvotes: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub comment_upvotes: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub comment_downvotes: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub disallow_nsfw_content: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub disable_email_notifications: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Default)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Delete an external auth method. +pub struct DeleteOAuthProvider { + pub id: OAuthProviderId, +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Delete a tagline +pub struct DeleteTagline { + pub id: TaglineId, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Edit an external auth method. +pub struct EditOAuthProvider { + pub id: OAuthProviderId, + #[cfg_attr(feature = "full", ts(optional))] + pub display_name: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub authorization_endpoint: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub token_endpoint: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub userinfo_endpoint: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub id_claim: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub client_secret: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub scopes: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub auto_verify_email: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub account_linking_enabled: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub use_pkce: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub enabled: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Edits a site. +pub struct EditSite { + #[cfg_attr(feature = "full", ts(optional))] + pub name: Option, + /// A sidebar for the site, in markdown. + #[cfg_attr(feature = "full", ts(optional))] + pub sidebar: Option, + /// A shorter, one line description of your site. + #[cfg_attr(feature = "full", ts(optional))] + pub description: Option, + /// Limits community creation to admins only. + #[cfg_attr(feature = "full", ts(optional))] + pub community_creation_admin_only: Option, + /// Whether to require email verification. + #[cfg_attr(feature = "full", ts(optional))] + pub require_email_verification: Option, + /// Your application question form. This is in markdown, and can be many questions. + #[cfg_attr(feature = "full", ts(optional))] + pub application_question: Option, + /// Whether your instance is public, or private. + #[cfg_attr(feature = "full", ts(optional))] + pub private_instance: Option, + /// The default theme. Usually "browser" + #[cfg_attr(feature = "full", ts(optional))] + pub default_theme: Option, + /// The default post listing type, usually "local" + #[cfg_attr(feature = "full", ts(optional))] + pub default_post_listing_type: Option, + /// Default value for listing mode, usually "list" + #[cfg_attr(feature = "full", ts(optional))] + pub default_post_listing_mode: Option, + /// The default post sort, usually "active" + #[cfg_attr(feature = "full", ts(optional))] + pub default_post_sort_type: Option, + /// A default time range limit to apply to post sorts, in seconds. 0 means none. + #[cfg_attr(feature = "full", ts(optional))] + pub default_post_time_range_seconds: Option, + /// The default comment sort, usually "hot" + #[cfg_attr(feature = "full", ts(optional))] + pub default_comment_sort_type: Option, + /// An optional page of legal information + #[cfg_attr(feature = "full", ts(optional))] + pub legal_information: Option, + /// Whether to email admins when receiving a new application. + #[cfg_attr(feature = "full", ts(optional))] + pub application_email_admins: Option, + /// Whether to hide moderator names from the modlog. + #[cfg_attr(feature = "full", ts(optional))] + pub hide_modlog_mod_names: Option, + /// A list of allowed discussion languages. + #[cfg_attr(feature = "full", ts(optional))] + pub discussion_languages: Option>, + /// A regex string of items to filter. + #[cfg_attr(feature = "full", ts(optional))] + pub slur_filter_regex: Option, + /// The max length of actor names. + #[cfg_attr(feature = "full", ts(optional))] + pub actor_name_max_length: Option, + /// The number of messages allowed in a given time frame. + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_message: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_message_per_second: Option, + /// The number of posts allowed in a given time frame. + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_post: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_post_per_second: Option, + /// The number of registrations allowed in a given time frame. + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_register: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_register_per_second: Option, + /// The number of image uploads allowed in a given time frame. + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_image: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_image_per_second: Option, + /// The number of comments allowed in a given time frame. + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_comment: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_comment_per_second: Option, + /// The number of searches allowed in a given time frame. + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_search: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub rate_limit_search_per_second: Option, + /// Whether to enable federation. + #[cfg_attr(feature = "full", ts(optional))] + pub federation_enabled: Option, + /// Whether to enable captchas for signups. + #[cfg_attr(feature = "full", ts(optional))] + pub captcha_enabled: Option, + /// The captcha difficulty. Can be easy, medium, or hard + #[cfg_attr(feature = "full", ts(optional))] + pub captcha_difficulty: Option, + /// A list of blocked URLs + #[cfg_attr(feature = "full", ts(optional))] + pub blocked_urls: Option>, + #[cfg_attr(feature = "full", ts(optional))] + pub registration_mode: Option, + /// Whether to email admins for new reports. + #[cfg_attr(feature = "full", ts(optional))] + pub reports_email_admins: Option, + /// If present, nsfw content is visible by default. Should be displayed by frontends/clients + /// when the site is first opened by a user. + #[cfg_attr(feature = "full", ts(optional))] + pub content_warning: Option, + /// Whether or not external auth methods can auto-register users. + #[cfg_attr(feature = "full", ts(optional))] + pub oauth_registration: Option, + /// What kind of post upvotes your site allows. + #[cfg_attr(feature = "full", ts(optional))] + pub post_upvotes: Option, + /// What kind of post downvotes your site allows. + #[cfg_attr(feature = "full", ts(optional))] + pub post_downvotes: Option, + /// What kind of comment upvotes your site allows. + #[cfg_attr(feature = "full", ts(optional))] + pub comment_upvotes: Option, + /// What kind of comment downvotes your site allows. + #[cfg_attr(feature = "full", ts(optional))] + pub comment_downvotes: Option, + /// Block NSFW content being created + #[cfg_attr(feature = "full", ts(optional))] + pub disallow_nsfw_content: Option, + /// Dont send email notifications to users for new replies, mentions etc + #[cfg_attr(feature = "full", ts(optional))] + pub disable_email_notifications: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A list of federated instances. +pub struct FederatedInstances { + pub linked: Vec, + pub allowed: Vec, + pub blocked: Vec, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A response of federated instances. +pub struct GetFederatedInstancesResponse { + /// Optional, because federation may be disabled. + #[cfg_attr(feature = "full", ts(optional))] + pub federated_instances: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// An expanded response for a site. +pub struct GetSiteResponse { + pub site_view: SiteView, + pub admins: Vec, + pub version: String, + #[cfg_attr(feature = "full", ts(skip))] + pub my_user: Option, + pub all_languages: Vec, + pub discussion_languages: Vec, + /// If the site has any taglines, a random one is included here for displaying + #[cfg_attr(feature = "full", ts(optional))] + pub tagline: Option, + /// A list of external auth methods your site supports. + pub oauth_providers: Vec, + pub admin_oauth_providers: Vec, + pub blocked_urls: Vec, + // If true then uploads for post images or markdown images are disabled. Only avatars, icons and + // banners can be set. + pub image_upload_disabled: bool, + pub active_plugins: Vec, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct InstanceWithFederationState { + #[serde(flatten)] + pub instance: Instance, + /// if federation to this instance is or was active, show state of outgoing federation to this + /// instance + #[cfg_attr(feature = "full", ts(optional))] + pub federation_state: Option, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Fetches a list of taglines. +pub struct ListTaglines { + #[cfg_attr(feature = "full", ts(optional))] + pub page_cursor: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub page_back: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub limit: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// A response for taglines. +pub struct ListTaglinesResponse { + pub taglines: Vec, + /// the pagination cursor to use to fetch the next page + #[cfg_attr(feature = "full", ts(optional))] + pub next_page: Option, + #[cfg_attr(feature = "full", ts(optional))] + pub prev_page: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// The response for a site. +pub struct SiteResponse { + pub site_view: SiteView, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +pub struct TaglineResponse { + pub tagline: Tagline, +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", ts(export))] +/// Update a tagline +pub struct UpdateTagline { + pub id: TaglineId, + pub content: String, +} diff --git a/crates/db_views/site/src/lib.rs b/crates/db_views/site/src/lib.rs index a7826e951..f28e5921d 100644 --- a/crates/db_views/site/src/lib.rs +++ b/crates/db_views/site/src/lib.rs @@ -11,6 +11,7 @@ use { ts_rs::TS, }; +pub mod api; #[cfg(feature = "full")] pub mod impls; diff --git a/crates/federate/Cargo.toml b/crates/federate/Cargo.toml index 3c39247af..7a817a945 100644 --- a/crates/federate/Cargo.toml +++ b/crates/federate/Cargo.toml @@ -17,7 +17,7 @@ workspace = true [dependencies] lemmy_db_views_community_follower = { workspace = true, features = ["full"] } -lemmy_api_common.workspace = true +lemmy_api_utils.workspace = true lemmy_apub_objects.workspace = true lemmy_db_schema = { workspace = true, features = ["full"] } lemmy_utils.workspace = true diff --git a/crates/federate/src/lib.rs b/crates/federate/src/lib.rs index dbb92949e..86d021ef6 100644 --- a/crates/federate/src/lib.rs +++ b/crates/federate/src/lib.rs @@ -1,11 +1,8 @@ use crate::{util::CancellableTask, worker::InstanceWorker}; use activitypub_federation::config::FederationConfig; -use lemmy_api_common::{ - context::LemmyContext, - lemmy_utils::settings::structs::FederationWorkerConfig, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{newtypes::InstanceId, source::instance::Instance}; -use lemmy_utils::error::LemmyResult; +use lemmy_utils::{error::LemmyResult, settings::structs::FederationWorkerConfig}; use stats::receive_print_stats; use std::{collections::HashMap, time::Duration}; use tokio::{ diff --git a/crates/federate/src/send.rs b/crates/federate/src/send.rs index 9351c087e..3a4bbcc78 100644 --- a/crates/federate/src/send.rs +++ b/crates/federate/src/send.rs @@ -7,10 +7,11 @@ use activitypub_federation::{ }; use anyhow::{Context, Result}; use chrono::{DateTime, Utc}; -use lemmy_api_common::{context::LemmyContext, federate_retry_sleep_duration}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{newtypes::ActivityId, source::activity::SentActivity}; use lemmy_utils::{ error::{LemmyError, LemmyResult}, + federate_retry_sleep_duration, FEDERATION_CONTEXT, }; use reqwest::Url; diff --git a/crates/federate/src/stats.rs b/crates/federate/src/stats.rs index f927f6ddf..a8fc578d9 100644 --- a/crates/federate/src/stats.rs +++ b/crates/federate/src/stats.rs @@ -1,11 +1,10 @@ use crate::util::{get_latest_activity_id, FederationQueueStateWithDomain}; use chrono::Local; -use lemmy_api_common::federate_retry_sleep_duration; use lemmy_db_schema::{ newtypes::InstanceId, utils::{ActualDbPool, DbPool}, }; -use lemmy_utils::error::LemmyResult; +use lemmy_utils::{error::LemmyResult, federate_retry_sleep_duration}; use std::{collections::HashMap, time::Duration}; use tokio::{sync::mpsc::UnboundedReceiver, time::interval}; use tracing::{debug, info, warn}; diff --git a/crates/federate/src/worker.rs b/crates/federate/src/worker.rs index 7874c7cba..f2ba32d76 100644 --- a/crates/federate/src/worker.rs +++ b/crates/federate/src/worker.rs @@ -11,11 +11,7 @@ use crate::{ use activitypub_federation::config::FederationConfig; use anyhow::{Context, Result}; use chrono::{DateTime, Days, TimeZone, Utc}; -use lemmy_api_common::{ - context::LemmyContext, - federate_retry_sleep_duration, - lemmy_utils::settings::structs::FederationWorkerConfig, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ newtypes::ActivityId, source::{ @@ -24,7 +20,11 @@ use lemmy_db_schema::{ }, utils::{ActualDbPool, DbPool}, }; -use lemmy_utils::error::LemmyResult; +use lemmy_utils::{ + error::LemmyResult, + federate_retry_sleep_duration, + settings::structs::FederationWorkerConfig, +}; use std::{cmp::max, collections::BinaryHeap, ops::Add, time::Duration}; use tokio::{ sync::mpsc::{self, UnboundedSender}, @@ -455,7 +455,7 @@ mod test { }; use actix_web::{dev::ServerHandle, web, App, HttpResponse, HttpServer}; use futures::future::try_join_all; - use lemmy_api_common::utils::generate_inbox_url; + use lemmy_api_utils::utils::generate_inbox_url; use lemmy_db_schema::{ newtypes::DbUrl, source::{ diff --git a/crates/routes/Cargo.toml b/crates/routes/Cargo.toml index dc639b781..a501934b2 100644 --- a/crates/routes/Cargo.toml +++ b/crates/routes/Cargo.toml @@ -17,7 +17,10 @@ doctest = false workspace = true [dependencies] +lemmy_db_views_api_misc = { workspace = true, features = ["full"] } +lemmy_db_views_community = { workspace = true, features = ["full"] } lemmy_db_views_post = { workspace = true, features = ["full"] } +lemmy_db_views_local_image = { workspace = true, features = ["full"] } lemmy_db_views_local_user = { workspace = true, features = ["full"] } lemmy_db_views_inbox_combined = { workspace = true, features = ["full"] } lemmy_db_views_modlog_combined = { workspace = true, features = ["full"] } @@ -27,7 +30,7 @@ lemmy_db_views_person_content_combined = { workspace = true, features = [ lemmy_db_views_site = { workspace = true, features = ["full"] } lemmy_utils = { workspace = true, features = ["full"] } lemmy_db_schema = { workspace = true } -lemmy_api_common = { workspace = true, features = ["full"] } +lemmy_api_utils = { workspace = true, features = ["full"] } lemmy_db_schema_file = { workspace = true } activitypub_federation = { workspace = true } actix-web = { workspace = true, features = ["cookies"] } diff --git a/crates/routes/src/feeds.rs b/crates/routes/src/feeds.rs index baa50d051..dcd647a55 100644 --- a/crates/routes/src/feeds.rs +++ b/crates/routes/src/feeds.rs @@ -1,7 +1,7 @@ use actix_web::{error::ErrorBadRequest, web, Error, HttpRequest, HttpResponse, Result}; use anyhow::anyhow; use chrono::{DateTime, Utc}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, utils::{check_private_instance, local_user_view_from_jwt}, }; diff --git a/crates/routes/src/images/delete.rs b/crates/routes/src/images/delete.rs index d0006dfe2..8890a3e47 100644 --- a/crates/routes/src/images/delete.rs +++ b/crates/routes/src/images/delete.rs @@ -1,11 +1,9 @@ use super::utils::delete_old_image; use actix_web::web::*; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - image::{CommunityIdQuery, DeleteImageParams}, request::{delete_image_alias, purge_image_from_pictrs}, utils::{is_admin, is_mod_or_admin}, - SuccessResponse, }; use lemmy_db_schema::{ source::{ @@ -16,6 +14,9 @@ use lemmy_db_schema::{ }, traits::Crud, }; +use lemmy_db_views_api_misc::SuccessResponse; +use lemmy_db_views_community::api::CommunityIdQuery; +use lemmy_db_views_local_image::api::DeleteImageParams; use lemmy_db_views_local_user::LocalUserView; use lemmy_utils::error::LemmyResult; diff --git a/crates/routes/src/images/download.rs b/crates/routes/src/images/download.rs index 5c3effc3b..569a5e48b 100644 --- a/crates/routes/src/images/download.rs +++ b/crates/routes/src/images/download.rs @@ -7,11 +7,9 @@ use actix_web::{ HttpResponse, Responder, }; -use lemmy_api_common::{ - context::LemmyContext, - image::{ImageGetParams, ImageProxyParams}, -}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::source::images::RemoteImage; +use lemmy_db_views_local_image::api::{ImageGetParams, ImageProxyParams}; use lemmy_db_views_local_user::LocalUserView; use lemmy_db_views_site::SiteView; use lemmy_utils::error::LemmyResult; diff --git a/crates/routes/src/images/mod.rs b/crates/routes/src/images/mod.rs index aefe42831..fff59e06b 100644 --- a/crates/routes/src/images/mod.rs +++ b/crates/routes/src/images/mod.rs @@ -1,5 +1,6 @@ use actix_web::web::*; -use lemmy_api_common::{context::LemmyContext, SuccessResponse}; +use lemmy_api_utils::context::LemmyContext; +use lemmy_db_views_api_misc::SuccessResponse; use lemmy_utils::error::LemmyResult; pub mod delete; diff --git a/crates/routes/src/images/upload.rs b/crates/routes/src/images/upload.rs index f07080f08..642114cf9 100644 --- a/crates/routes/src/images/upload.rs +++ b/crates/routes/src/images/upload.rs @@ -1,11 +1,9 @@ use super::utils::{adapt_request, delete_old_image, make_send}; use actix_web::{self, web::*, HttpRequest}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, - image::{CommunityIdQuery, UploadImageResponse}, request::PictrsResponse, utils::{is_admin, is_mod_or_admin}, - LemmyErrorType, }; use lemmy_db_schema::{ source::{ @@ -16,8 +14,10 @@ use lemmy_db_schema::{ }, traits::Crud, }; +use lemmy_db_views_community::api::CommunityIdQuery; +use lemmy_db_views_local_image::api::UploadImageResponse; use lemmy_db_views_local_user::LocalUserView; -use lemmy_utils::error::LemmyResult; +use lemmy_utils::error::{LemmyErrorType, LemmyResult}; use reqwest::Body; use std::time::Duration; use UploadType::*; diff --git a/crates/routes/src/images/utils.rs b/crates/routes/src/images/utils.rs index 0904edf33..ae586e1de 100644 --- a/crates/routes/src/images/utils.rs +++ b/crates/routes/src/images/utils.rs @@ -9,7 +9,7 @@ use actix_web::{ use diesel::NotFound; use futures::stream::{Stream, StreamExt}; use http::HeaderValue; -use lemmy_api_common::{context::LemmyContext, request::delete_image_alias}; +use lemmy_api_utils::{context::LemmyContext, request::delete_image_alias}; use lemmy_db_schema::newtypes::DbUrl; use lemmy_utils::{error::LemmyResult, REQWEST_TIMEOUT}; use reqwest_middleware::RequestBuilder; diff --git a/crates/routes/src/middleware/session.rs b/crates/routes/src/middleware/session.rs index 7019a64d5..f57211da3 100644 --- a/crates/routes/src/middleware/session.rs +++ b/crates/routes/src/middleware/session.rs @@ -7,7 +7,7 @@ use actix_web::{ }; use core::future::Ready; use futures_util::future::LocalBoxFuture; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, utils::{local_user_view_from_jwt, read_auth_token}, }; @@ -101,7 +101,7 @@ where mod tests { use actix_web::test::TestRequest; - use lemmy_api_common::{claims::Claims, context::LemmyContext}; + use lemmy_api_utils::{claims::Claims, context::LemmyContext}; use lemmy_db_schema::{ source::{ instance::Instance, diff --git a/crates/routes/src/nodeinfo.rs b/crates/routes/src/nodeinfo.rs index 193764d79..55e8c46bf 100644 --- a/crates/routes/src/nodeinfo.rs +++ b/crates/routes/src/nodeinfo.rs @@ -1,5 +1,5 @@ use actix_web::{web, Error, HttpResponse, Result}; -use lemmy_api_common::context::LemmyContext; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema_file::enums::RegistrationMode; use lemmy_db_views_site::SiteView; use lemmy_utils::{ diff --git a/crates/routes/src/utils/prometheus_metrics.rs b/crates/routes/src/utils/prometheus_metrics.rs index 6a23baf34..a58ffa6dc 100644 --- a/crates/routes/src/utils/prometheus_metrics.rs +++ b/crates/routes/src/utils/prometheus_metrics.rs @@ -1,7 +1,10 @@ use actix_web::{rt::System, web, App, HttpServer}; use actix_web_prom::{PrometheusMetrics, PrometheusMetricsBuilder}; -use lemmy_api_common::{context::LemmyContext, LemmyErrorType}; -use lemmy_utils::{error::LemmyResult, settings::structs::PrometheusConfig}; +use lemmy_api_utils::context::LemmyContext; +use lemmy_utils::{ + error::{LemmyErrorType, LemmyResult}, + settings::structs::PrometheusConfig, +}; use prometheus::{default_registry, Encoder, Gauge, Opts, TextEncoder}; use std::{sync::Arc, thread}; use tracing::error; diff --git a/crates/routes/src/utils/scheduled_tasks.rs b/crates/routes/src/utils/scheduled_tasks.rs index d7da55979..2e70dbb16 100644 --- a/crates/routes/src/utils/scheduled_tasks.rs +++ b/crates/routes/src/utils/scheduled_tasks.rs @@ -14,7 +14,7 @@ use diesel::{ QueryableByName, }; use diesel_async::{AsyncPgConnection, RunQueryDsl}; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, utils::send_webmention, @@ -537,7 +537,7 @@ async fn build_update_instance_form( mod tests { use super::*; - use lemmy_api_common::request::client_builder; + use lemmy_api_utils::request::client_builder; use lemmy_db_views_site::impls::create_test_instance; use lemmy_utils::{ error::{LemmyErrorType, LemmyResult}, diff --git a/crates/routes/src/utils/setup_local_site.rs b/crates/routes/src/utils/setup_local_site.rs index 6bef448a4..b2f469529 100644 --- a/crates/routes/src/utils/setup_local_site.rs +++ b/crates/routes/src/utils/setup_local_site.rs @@ -1,6 +1,6 @@ use activitypub_federation::http_signatures::generate_actor_keypair; use chrono::Utc; -use lemmy_api_common::utils::generate_inbox_url; +use lemmy_api_utils::utils::generate_inbox_url; use lemmy_db_schema::{ source::{ instance::Instance, diff --git a/crates/routes/src/webfinger.rs b/crates/routes/src/webfinger.rs index 2a3f0f1eb..c8c426519 100644 --- a/crates/routes/src/webfinger.rs +++ b/crates/routes/src/webfinger.rs @@ -3,14 +3,14 @@ use activitypub_federation::{ fetch::webfinger::{extract_webfinger_name, Webfinger, WebfingerLink, WEBFINGER_CONTENT_TYPE}, }; use actix_web::{web, web::Query, HttpResponse}; -use lemmy_api_common::{context::LemmyContext, LemmyErrorType}; +use lemmy_api_utils::context::LemmyContext; use lemmy_db_schema::{ source::{community::Community, person::Person}, traits::ApubActor, }; use lemmy_utils::{ cache_header::cache_3days, - error::{LemmyErrorExt, LemmyResult}, + error::{LemmyErrorExt, LemmyErrorType, LemmyResult}, }; use serde::Deserialize; use std::collections::HashMap; diff --git a/crates/utils/src/lib.rs b/crates/utils/src/lib.rs index 38c5578c3..0fba8f56e 100644 --- a/crates/utils/src/lib.rs +++ b/crates/utils/src/lib.rs @@ -1,4 +1,5 @@ use cfg_if::cfg_if; +use std::cmp::min; cfg_if! { if #[cfg(feature = "full")] { @@ -107,3 +108,40 @@ pub type CacheLock = std::sync::LazyLock>; } } + +// TODO: use from_days once stabilized +// https://github.com/rust-lang/rust/issues/120301 +const DAY: Duration = Duration::from_secs(24 * 60 * 60); + +/// Calculate how long to sleep until next federation send based on how many +/// retries have already happened. Uses exponential backoff with maximum of one day. The first +/// error is ignored. +pub fn federate_retry_sleep_duration(retry_count: i32) -> Duration { + debug_assert!(retry_count != 0); + if retry_count == 1 { + return Duration::from_secs(0); + } + let retry_count = retry_count - 1; + let pow = 1.25_f64.powf(retry_count.into()); + let pow = Duration::try_from_secs_f64(pow).unwrap_or(DAY); + min(DAY, pow) +} + +#[cfg(test)] +pub(crate) mod tests { + use super::*; + + #[test] + fn test_federate_retry_sleep_duration() { + assert_eq!(Duration::from_secs(0), federate_retry_sleep_duration(1)); + assert_eq!( + Duration::new(1, 250000000), + federate_retry_sleep_duration(2) + ); + assert_eq!( + Duration::new(2, 441406250), + federate_retry_sleep_duration(5) + ); + assert_eq!(DAY, federate_retry_sleep_duration(100)); + } +} diff --git a/src/lib.rs b/src/lib.rs index d2813f9d6..bec802721 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,7 +11,7 @@ use actix_web::{ }; use clap::{Parser, Subcommand}; use lemmy_api::sitemap::get_sitemap; -use lemmy_api_common::{ +use lemmy_api_utils::{ context::LemmyContext, request::client_builder, send_activity::{ActivityChannel, MATCH_OUTGOING_ACTIVITIES},