From d0229866f8bab443f3e98df82b25fba1a0527495 Mon Sep 17 00:00:00 2001 From: raikasdev Date: Tue, 12 Mar 2024 23:40:26 +0200 Subject: [PATCH 01/11] feat: serverside hidden activities --- Cargo.lock | 569 +++++++----- Cargo.toml | 2 +- docs/APISPEC.md | 879 +++++++++++------- .../down.sql | 9 + .../up.sql | 11 + src/api/activity.rs | 20 + src/api/friends.rs | 5 +- src/api/users.rs | 17 +- src/database/activity.rs | 36 +- src/main.rs | 1 + src/models.rs | 2 + src/requests.rs | 1 + src/schema.rs | 10 + src/tests/activity.rs | 67 +- 14 files changed, 1029 insertions(+), 600 deletions(-) create mode 100644 migrations/2024-03-12-174132_serverside_hidden/down.sql create mode 100644 migrations/2024-03-12-174132_serverside_hidden/up.sql diff --git a/Cargo.lock b/Cargo.lock index ca52fda..2e86f17 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,11 +4,11 @@ version = 3 [[package]] name = "actix-codec" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "617a8268e3537fe1d8c9ead925fca49ef6400927ee7bc26750e90ecee14ce4b8" +checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "bytes", "futures-core", "futures-sink", @@ -36,9 +36,9 @@ dependencies = [ [[package]] name = "actix-http" -version = "3.4.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92ef85799cba03f76e4f7c10f533e66d87c9a7e7055f3391f09000ad8351bc9" +checksum = "d223b13fd481fc0d1f83bb12659ae774d9e3601814c68a0bc539731698cca743" dependencies = [ "actix-codec", "actix-rt", @@ -47,7 +47,7 @@ dependencies = [ "actix-utils", "ahash", "base64", - "bitflags 2.4.1", + "bitflags 2.4.2", "brotli", "bytes", "bytestring", @@ -56,7 +56,7 @@ dependencies = [ "flate2", "futures-core", "h2", - "http", + "http 0.2.12", "httparse", "httpdate", "itoa", @@ -81,17 +81,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.41", + "syn 2.0.52", ] [[package]] name = "actix-router" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799" +checksum = "d22475596539443685426b6bdadb926ad0ecaefdfc5fb05e5e3441f15463c511" dependencies = [ "bytestring", - "http", + "http 0.2.12", "regex", "serde", "tracing", @@ -137,19 +137,18 @@ dependencies = [ [[package]] name = "actix-tls" -version = "3.1.1" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72616e7fbec0aa99c6f3164677fa48ff5a60036d0799c98cab894a44f3e0efc3" +checksum = "d4cce60a2f2b477bc72e5cde0af1812a6e82d8fd85b5570a5dcf2a5bf2c5be5f" dependencies = [ "actix-rt", "actix-service", "actix-utils", "futures-core", - "http", + "http 0.2.12", + "http 1.1.0", "impl-more", "pin-project-lite", - "rustls 0.21.10", - "rustls-webpki", "tokio", "tokio-rustls", "tokio-util", @@ -169,9 +168,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.4.0" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4a5b5e29603ca8c94a77c65cf874718ceb60292c5a5c3e5f4ace041af462b9" +checksum = "43a6556ddebb638c2358714d853257ed226ece6023ef9364f23f0c70737ea984" dependencies = [ "actix-codec", "actix-http", @@ -217,7 +216,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.52", ] [[package]] @@ -237,9 +236,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "getrandom", @@ -300,13 +299,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.52", ] [[package]] @@ -328,9 +327,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "awc" -version = "3.2.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fa3c705a9c7917ac0f41c0757a0a747b43bbc29b0b364b081bd7c5fc67fb223" +checksum = "68c09cc97310b926f01621faee652f3d1b0962545a3cec6c9ac07def9ea36c2c" dependencies = [ "actix-codec", "actix-http", @@ -346,14 +345,14 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", + "http 0.2.12", "itoa", "log", "mime", "percent-encoding", "pin-project-lite", "rand", - "rustls 0.20.9", + "rustls", "serde", "serde_json", "serde_urlencoded", @@ -377,9 +376,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -395,9 +394,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "blake2" @@ -440,9 +439,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" [[package]] name = "byteorder" @@ -467,9 +466,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" dependencies = [ "jobserver", "libc", @@ -483,9 +482,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" dependencies = [ "android-tzdata", "iana-time-zone", @@ -493,7 +492,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets", + "windows-targets 0.52.4", ] [[package]] @@ -521,30 +520,27 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-utils" -version = "0.8.17" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crypto-common" @@ -590,9 +586,9 @@ checksum = "63dfa964fe2a66f3fde91fc70b267fe193d822c7e603e2a675a49a7f46ad3f49" [[package]] name = "deranged" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", ] @@ -616,7 +612,7 @@ version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62c6fcf842f17f8c78ecf7c81d75c5ce84436b41ee07e03f490fbb5f5a8731d8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "byteorder", "chrono", "diesel_derives", @@ -648,7 +644,7 @@ dependencies = [ "diesel_table_macro_syntax", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.52", ] [[package]] @@ -657,7 +653,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" dependencies = [ - "syn 2.0.41", + "syn 2.0.52", ] [[package]] @@ -679,9 +675,9 @@ checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "encoding_rs" @@ -750,9 +746,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -765,9 +761,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -775,15 +771,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -792,44 +788,44 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.52", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-timer" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -855,9 +851,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -872,9 +868,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "governor" -version = "0.6.0" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "821239e5672ff23e2a7060901fa622950bbd80b649cdaadd78d1c1767ed14eb4" +checksum = "68a7f542ee6b35af73b06abc0dad1c1bae89964e4e253bc4b587b91c9637867b" dependencies = [ "cfg-if", "dashmap", @@ -883,23 +879,25 @@ dependencies = [ "no-std-compat", "nonzero_ext", "parking_lot", + "portable-atomic", "quanta", "rand", "smallvec", + "spinning_top", ] [[package]] name = "h2" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.12", "indexmap", "slab", "tokio", @@ -924,9 +922,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hmac" @@ -939,9 +937,20 @@ dependencies = [ [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -968,9 +977,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1007,9 +1016,9 @@ checksum = "206ca75c9c03ba3d4ace2460e57b189f39f43de612c2f85836e65c929701bb2d" [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown", @@ -1032,18 +1041,18 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -1056,9 +1065,9 @@ checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "local-channel" @@ -1089,18 +1098,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "mach2" -version = "0.4.1" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" -dependencies = [ - "libc", -] +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "md-5" @@ -1114,9 +1114,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "mime" @@ -1126,23 +1126,23 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "log", "wasi", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1157,11 +1157,17 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -1172,15 +1178,15 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi 0.3.9", "libc", ] [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -1211,7 +1217,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -1257,22 +1263,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.52", ] [[package]] @@ -1289,9 +1295,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" [[package]] name = "postgres-protocol" @@ -1336,22 +1348,21 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] [[package]] name = "quanta" -version = "0.11.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" +checksum = "9ca0b7bac0b97248c40bb77288fc52029cf1459c0461ea1b05ee32ccf011de2c" dependencies = [ "crossbeam-utils", "libc", - "mach2", "once_cell", "raw-cpuid", "wasi", @@ -1361,9 +1372,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1400,11 +1411,11 @@ dependencies = [ [[package]] name = "raw-cpuid" -version = "10.7.0" +version = "11.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" +checksum = "9d86a7c4638d42c44551f4791a20e687dbb4c3de1f33c43dd71e355cd429def1" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", ] [[package]] @@ -1418,9 +1429,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", @@ -1430,9 +1441,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -1468,16 +1479,17 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", "getrandom", "libc", "spin 0.9.8", "untrusted 0.9.0", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1507,33 +1519,11 @@ dependencies = [ "webpki", ] -[[package]] -name = "rustls" -version = "0.21.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" -dependencies = [ - "log", - "ring 0.17.7", - "rustls-webpki", - "sct", -] - -[[package]] -name = "rustls-webpki" -version = "0.101.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" -dependencies = [ - "ring 0.17.7", - "untrusted 0.9.0", -] - [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "scoped-futures" @@ -1557,41 +1547,41 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.7", + "ring 0.17.8", "untrusted 0.9.0", ] [[package]] name = "semver" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.52", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -1658,18 +1648,18 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1684,6 +1674,15 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +[[package]] +name = "spinning_top" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300" +dependencies = [ + "lock_api", +] + [[package]] name = "stringprep" version = "0.1.4" @@ -1714,9 +1713,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.41" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -1725,9 +1724,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] @@ -1749,7 +1748,7 @@ dependencies = [ "futures", "futures-util", "governor", - "http", + "http 0.2.12", "itertools", "log", "rand", @@ -1766,32 +1765,33 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.51" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.51" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.52", ] [[package]] name = "time" -version = "0.3.30" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -1806,10 +1806,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -1830,9 +1831,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.0" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -1842,7 +1843,7 @@ dependencies = [ "pin-project-lite", "signal-hook-registry", "socket2", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1877,7 +1878,7 @@ version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "rustls 0.20.9", + "rustls", "tokio", "webpki", ] @@ -1937,7 +1938,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.52", ] [[package]] @@ -1957,9 +1958,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -1969,9 +1970,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] @@ -2001,9 +2002,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ "getrandom", ] @@ -2020,11 +2021,17 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2032,24 +2039,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.52", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2057,28 +2064,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.52", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -2090,7 +2097,7 @@ version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring 0.17.7", + "ring 0.17.8", "untrusted 0.9.0", ] @@ -2105,11 +2112,12 @@ dependencies = [ [[package]] name = "whoami" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" +checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" dependencies = [ - "wasm-bindgen", + "redox_syscall", + "wasite", "web-sys", ] @@ -2146,11 +2154,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets", + "windows-targets 0.52.4", ] [[package]] @@ -2159,7 +2167,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.4", ] [[package]] @@ -2168,13 +2185,28 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +dependencies = [ + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] [[package]] @@ -2183,78 +2215,119 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" + [[package]] name = "zerocopy" -version = "0.7.31" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c4061bedbb353041c12f413700357bec76df2c7e2ca8e4df8bac24c6bf68e3d" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.31" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.52", ] [[package]] name = "zstd" -version = "0.12.4" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "6.0.6" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" dependencies = [ - "libc", "zstd-sys", ] diff --git a/Cargo.toml b/Cargo.toml index c60cb88..8281062 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ testausid = ["dep:awc"] lto = true [dependencies] -actix-web = { version = "4.2.1", features = ["macros", "rustls"] } +actix-web = { version = "4.5.1", features = ["macros", "rustls"] } awc = { version = "3.0.0", features = ["rustls"], optional = true } actix-cors = "0.6" http = "0.2" diff --git a/docs/APISPEC.md b/docs/APISPEC.md index 5baf0ca..9350ca5 100644 --- a/docs/APISPEC.md +++ b/docs/APISPEC.md @@ -3,6 +3,7 @@ ## General info Testaustime API gives 5 different routes: + - [/auth/](#auth) - [/users/](#users) - [/activity/](#activity) @@ -12,45 +13,49 @@ Testaustime API gives 5 different routes: Basic path: `https://api.testaustime.fi` Limits: + - Usual Ratelimit: 10 req/m. -## Auth +## Auth Contains various user authorization operations ### Endpoints -| Endpoint| Method | Description | -| --- | --- | --- | -| [/auth/register](#register) | POST | Creating a new user and returns the user auth token, friend code and registration time | -| [/auth/login](#login) | POST | Loging user to system and returns the user auth token and friend code | -| [/auth/securedaccess](#securedaccess) | POST | Generating secured access token | -| [/auth/changeusername](#changeusername) | POST | Changing user username | -| [/auth/changepassword](#changepassword) | POST | Changing user password | -| [/auth/regenerate](#regenerate) | POST | Regenerating user auth token | +| Endpoint | Method | Description | +| --------------------------------------- | ------ | -------------------------------------------------------------------------------------- | +| [/auth/register](#register) | POST | Creating a new user and returns the user auth token, friend code and registration time | +| [/auth/login](#login) | POST | Loging user to system and returns the user auth token and friend code | +| [/auth/securedaccess](#securedaccess) | POST | Generating secured access token | +| [/auth/changeusername](#changeusername) | POST | Changing user username | +| [/auth/changepassword](#changepassword) | POST | Changing user password | +| [/auth/regenerate](#regenerate) | POST | Regenerating user auth token | -#### [1. POST /auth/register](#auth) +#### [1. POST /auth/register](#auth) Creating a new user and returns the user auth token, friend code and registration time. Ratelimit: 1 req/24h
Header params -| Name | Value | -| --- | --- | +| Name | Value | +| ------------ | ---------------- | | Content-Type | application/json | +
Body params -| Param | Type | Required | Description | -| --- | --- | --- | --- | -| username | string | Yes | Usename has to be between 2 and 32 characters long | -| password | string | Yes | Password has to be between 8 and 128 characters long | +| Param | Type | Required | Description | +| -------- | ------ | -------- | ---------------------------------------------------- | +| username | string | Yes | Usename has to be between 2 and 32 characters long | +| password | string | Yes | Password has to be between 8 and 128 characters long | +
**Sample request** + ```curl curl --request POST https://api.testaustime.fi/auth/register' \ --header 'Content-Type: application/json' \ @@ -59,7 +64,9 @@ curl --request POST https://api.testaustime.fi/auth/register' \ "password": "password" } ``` + **Sample response** + ```JSON { "auth_token": "", @@ -68,40 +75,44 @@ curl --request POST https://api.testaustime.fi/auth/register' \ "registration_time": "YYYY-MM-DDTHH:MM:SS.sssssssssZ" } ``` +
Response definitions -| Response Item | Type | Description | -| --- | --- | --- | -| auth_token | string | Authentication token for identifying the user | -| username | string | Username | -| friend_code | string | With this code other users can add user to the friend list | -| registration_time | string | Time of registration in ISO 8601 format | -
+| Response Item | Type | Description | +| ----------------- | ------ | ---------------------------------------------------------- | +| auth_token | string | Authentication token for identifying the user | +| username | string | Username | +| friend_code | string | With this code other users can add user to the friend list | +| registration_time | string | Time of registration in ISO 8601 format | + -#### [2. POST /auth/login](#auth) +#### [2. POST /auth/login](#auth) Logins to a users account and returning the authentication token
Header params - | Name | Value | -| --- | --- | +| Name | Value | +| ------------ | ---------------- | | Content-Type | application/json | +
Body params -| Param | Type | Required | Description | -| --- | --- | --- | --- | -| username | string | Yes | Usename has to be between 2 and 32 characters long | -| password | string | Yes | Password has to be between 8 and 128 characters long | +| Param | Type | Required | Description | +| -------- | ------ | -------- | ---------------------------------------------------- | +| username | string | Yes | Usename has to be between 2 and 32 characters long | +| password | string | Yes | Password has to be between 8 and 128 characters long | +
**Sample request** + ```curl curl --request POST 'https://api.testaustime.fi/auth/login' \ --header 'Content-Type: application/json' \ @@ -111,7 +122,9 @@ curl --request POST 'https://api.testaustime.fi/auth/login' \ }' ``` + **Sample response** + ```JSON { "id": 0, @@ -125,37 +138,41 @@ curl --request POST 'https://api.testaustime.fi/auth/login' \
Response definitions -| Response Item | Type | Description | -| --- | --- | --- | -| id | int| User id | -| auth_token | string | Authentication token for identifying the user | -| username | string | Username | -| friend_code | string | With this code other users can add user to the friend list | -| registration_time | string | Time of registration in ISO 8601 format | +| Response Item | Type | Description | +| ----------------- | ------ | ---------------------------------------------------------- | +| id | int | User id | +| auth_token | string | Authentication token for identifying the user | +| username | string | Username | +| friend_code | string | With this code other users can add user to the friend list | +| registration_time | string | Time of registration in ISO 8601 format | +
-#### [3. POST /auth/securedaccess](#auth) +#### [3. POST /auth/securedaccess](#auth) Generates new secured access token, each token is valid for 1 hour. Used for confirming user identity when doing critical changes.
Header params - | Name | Value | -| --- | --- | +| Name | Value | +| ------------ | ---------------- | | Content-Type | application/json | +
Body params -| Param | Type | Required | Description | -| --- | --- | --- | --- | -| username | string | Yes | Usename has to be between 2 and 32 characters long | -| password | string | Yes | Password has to be between 8 and 128 characters long | +| Param | Type | Required | Description | +| -------- | ------ | -------- | ---------------------------------------------------- | +| username | string | Yes | Usename has to be between 2 and 32 characters long | +| password | string | Yes | Password has to be between 8 and 128 characters long | +
**Sample request** + ```curl curl --request POST 'https://api.testaustime.fi/auth/securedaccess' \ --header 'Content-Type: application/json' \ @@ -165,7 +182,9 @@ curl --request POST 'https://api.testaustime.fi/auth/securedaccess' \ }' ``` + **Sample response** + ```JSON { "token": "" @@ -175,33 +194,37 @@ curl --request POST 'https://api.testaustime.fi/auth/securedaccess' \
Response definitions -| Response Item | Type | Description | -| --- | --- | --- | -| token | string | Secured access token | +| Response Item | Type | Description | +| ------------- | ------ | -------------------- | +| token | string | Secured access token | +
-#### [4. POST /auth/changeusername](#auth) +#### [4. POST /auth/changeusername](#auth) Changes username, requires secured access token
Header params: -| Name | Value | -| --- | --- | -| Content-Type | application/json | +| Name | Value | +| ------------- | -------------------- | +| Content-Type | application/json | | Authorization | Bearer `` | +
Body params: -| Param | Type | Required | Description | -| --- | --- | --- | --- | -| new | string | Yes | New username. Usename has to be between 2 and 32 characters long | +| Param | Type | Required | Description | +| ----- | ------ | -------- | ---------------------------------------------------------------- | +| new | string | Yes | New username. Usename has to be between 2 and 32 characters long | +
**Sample request** + ```curl curl --request POST 'https://api.testaustime.fi/auth/changeusername' \ --header 'Content-Type: application/json' \ @@ -211,41 +234,47 @@ curl --request POST 'https://api.testaustime.fi/auth/changeusername' \ ``` **Sample response** + ```http 200 OK ``` +
Error examples: -| Error | Error code | Body | -| --- | --- | --- | -| "new" has <2 or >32 symbols | 400 Bad Request | `{"error" : "Username is not between 2 and 32 chars"}` | -| "new" is using existing username| 403 Forbidden | `"error"» : "User exists"` | +| Error | Error code | Body | +| -------------------------------- | --------------- | ------------------------------------------------------ | +| "new" has <2 or >32 symbols | 400 Bad Request | `{"error" : "Username is not between 2 and 32 chars"}` | +| "new" is using existing username | 403 Forbidden | `"error"» : "User exists"` | +
-#### [5. POST /auth/changepassword](#auth) +#### [5. POST /auth/changepassword](#auth) Changes users password, requires secured access token
Header params: -| Name | Value | -| --- | --- | -| Content-Type | application/json | +| Name | Value | +| ------------- | -------------------- | +| Content-Type | application/json | | Authorization | Bearer `` | +
Body params: -| Param | Type | Required | Description | -| --- | --- | --- | --- | -| old | string | Yes | Current password | -| new | string | Yes | New password. Password has to be between 8 and 128 characters long | +| Param | Type | Required | Description | +| ----- | ------ | -------- | ------------------------------------------------------------------ | +| old | string | Yes | Current password | +| new | string | Yes | New password. Password has to be between 8 and 128 characters long | +
**Sample request** + ```curl curl --request POST 'https://api.testaustime.fi/auth/changepassword' \ --header 'Content-Type: application/json' \ @@ -257,6 +286,7 @@ curl --request POST 'https://api.testaustime.fi/auth/changepassword' \ ``` **Sample response** + ```http 200 OK ``` @@ -264,25 +294,28 @@ curl --request POST 'https://api.testaustime.fi/auth/changepassword' \
Error examples: -| Error | Error code | Body | -| --- | --- | --- | -| "new" has < 8 or >132 symbols | 400 Bad Request | `{"error": "Password is not between 8 and 132 chars"}` | -| "old" is incorrect| 401 Unathorized | `{"error": "You are not authorized"}` | +| Error | Error code | Body | +| ----------------------------- | --------------- | ------------------------------------------------------ | +| "new" has < 8 or >132 symbols | 400 Bad Request | `{"error": "Password is not between 8 and 132 chars"}` | +| "old" is incorrect | 401 Unathorized | `{"error": "You are not authorized"}` | +
-#### [6. POST /auth/regenerate](#auth) +#### [6. POST /auth/regenerate](#auth) Regenerates users authentication token, requires secured access token
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | -------------------- | | Authorization | Bearer `` | +
**Sample request** + ```curl curl --request POST 'https://api.testaustime.fi/auth/regenerate' \ --header 'Content-Type: application/json' @@ -290,6 +323,7 @@ curl --request POST 'https://api.testaustime.fi/auth/regenerate' \ ``` **Sample response** + ```JSON { "token": "" @@ -299,19 +333,20 @@ curl --request POST 'https://api.testaustime.fi/auth/regenerate' \
Response definitions: -| Response Item | Type | Description | -| --- | --- | --- | -| token | string | New Authentication token used for identifying user | +| Response Item | Type | Description | +| ------------- | ------ | -------------------------------------------------- | +| token | string | New Authentication token used for identifying user | +
-## Users +## Users Contains various mostly read-operations with user data ### Endpoints | Endpoint | Method | Description | -| --- | --- | --- | +| ------------------------------------------------------- | ------ | ----------------------------------------------- | | [/users/@me](#me) | GET | Geting data about authorized user | | [/users/@me/leaderboards](#my_leaderboards) | GET | Geting list of user leaderboards | | [/users/{username}/activity/data](#activity_data) | GET | Geting user or user friend coding activity data | @@ -319,25 +354,28 @@ Contains various mostly read-operations with user data | [/users/{username}/activity/current](#activity_cur) | GET | Get a users current coding session | | [/users/@me/delete](#delete_myself) | DELETE | Deleting user account | -#### [1. GET /users/@me](#users) +#### [1. GET /users/@me](#users) Gets data about authorized user
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | --------------------- | | Authorization | Bearer `` | +
**Sample request** + ```curl curl --location --request GET 'https://api.testaustime.fi/users/@me' \ --header 'Authorization: Bearer ``' ``` **Sample response** + ```JSON { "id": 0, @@ -346,36 +384,41 @@ curl --location --request GET 'https://api.testaustime.fi/users/@me' \ "registration_time": "YYYY-MM-DDTHH:MM:SS.ssssssZ" } ``` +
Response definitions: -| Response Item | Type | Description | -| --- | --- | --- | -| id | int | User id | -| friend_code | string | With this code other users can add user to the friend list | -| username | string | Username | -| registration_time | string | Time of registration in ISO 8601 format | +| Response Item | Type | Description | +| ----------------- | ------ | ---------------------------------------------------------- | +| id | int | User id | +| friend_code | string | With this code other users can add user to the friend list | +| username | string | Username | +| registration_time | string | Time of registration in ISO 8601 format | +
-#### [2. GET /users/@me/leaderboards](#users) +#### [2. GET /users/@me/leaderboards](#users) Gets list of user leaderboards
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | --------------------- | | Authorization | Bearer `` | +
**Sample request** + ```curl curl --location --request GET 'https://api.testaustime.fi/users/@me/leaderboards' \ --header 'Authorization: Bearer ' ``` **Sample response** + ```JSON [ { @@ -388,44 +431,50 @@ curl --location --request GET 'https://api.testaustime.fi/users/@me/leaderboards
Response definitions: -| Response Item | Type | Description | -| --- | --- | --- | -| name | string | Name of leaderboard in which the user is a member | -| member_count | int | Number of users in the leaderboard | +| Response Item | Type | Description | +| ------------- | ------ | ------------------------------------------------- | +| name | string | Name of leaderboard in which the user is a member | +| member_count | int | Number of users in the leaderboard | +
Required headers: + ``` Authorization: Bearer ``` -#### [3. GET /users/{username}/activity/data](#users) +#### [3. GET /users/{username}/activity/data](#users) Geting user or user friend coding activity data
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | --------------------- | | Authorization | Bearer `` | +
Path params: -| Path param | Description | -| --- | --- | -| Username | Own or friend username. Also own username can be replaced on `@me`| +| Path param | Description | +| ---------- | ------------------------------------------------------------------ | +| Username | Own or friend username. Also own username can be replaced on `@me` | +
**Sample request** + ```curl curl --location --request GET 'https://api.testaustime.fi/users/@me/activity/data' \ --header 'Authorization: Bearer ' ``` **Sample response** + ```JSON [ { @@ -435,7 +484,8 @@ curl --location --request GET 'https://api.testaustime.fi/users/@me/activity/dat "project_name": "project_name", "language": "language", "editor_name": "editor_name", - "hostname": "hostname" + "hostname": "hostname", + "hidden": false } ] ``` @@ -443,44 +493,50 @@ curl --location --request GET 'https://api.testaustime.fi/users/@me/activity/dat
Response definitions: -| Response Item | Type | Description | -| --- | --- | --- | -| id | int | ID of user code session | -| start_time | string | Start time (time of sending first heartbeat) of user code session in ISO 8601 format | -| duration | int | Duration of user code session in seconds | -| project_name | string | Name of the project in which user have a code session | -| language | string | Code language of the code session | -| editor_name | string | Name of IDE (Visual Studio Code, IntelliJ, Neovim, etc.) in which user is coding | -| hostname | string | User hostname | +| Response Item | Type | Description | +| ------------- | ------- | ------------------------------------------------------------------------------------ | +| id | int | ID of user code session | +| start_time | string | Start time (time of sending first heartbeat) of user code session in ISO 8601 format | +| duration | int | Duration of user code session in seconds | +| project_name | string | Name of the project in which user have a code session. Empty string if hidden. | +| language | string | Code language of the code session | +| editor_name | string | Name of IDE (Visual Studio Code, IntelliJ, Neovim, etc.) in which user is coding | +| hostname | string | User hostname | +| hidden | boolean | Is this project hidden? | +
-#### [4. GET /users/{username}/activity/summary](#users) +#### [4. GET /users/{username}/activity/summary](#users) Get a summary of a users activity
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | --------------------- | | Authorization | Bearer `` | +
Path params: | Path param | Description | -| --- | --- | +| ---------- | --------------------------------------------------------------------- | | Username | Own or a friends username. Own username can be substituted with `@me` | +
**Sample request** + ```curl curl --location --request GET 'https://api.testaustime.fi/users/@me/activity/summary' \ --header 'Authorization: Bearer ' ``` **Sample response** + ```JSON { "all_time": { @@ -510,42 +566,47 @@ curl --location --request GET 'https://api.testaustime.fi/users/@me/activity/sum
Response definitions: -| Response Item | Type | Description | -| --- | --- | --- | -| all_time | Object | All time coding activity summary for the user | -| languages | Object | Contains fields named after languages that have the coding time as their value | -| total | int | The total coding time of the given period | -| last_month | Object | Similar to `all_time` | -| last_week | Object | Similar to `all_time` and `last_month` | +| Response Item | Type | Description | +| ------------- | ------ | ------------------------------------------------------------------------------ | +| all_time | Object | All time coding activity summary for the user | +| languages | Object | Contains fields named after languages that have the coding time as their value | +| total | int | The total coding time of the given period | +| last_month | Object | Similar to `all_time` | +| last_week | Object | Similar to `all_time` and `last_month` | +
-#### [5. GET /users/{username}/activity/current](#users) +#### [5. GET /users/{username}/activity/current](#users) Gets details of the ongoing coding session if there is one.
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | --------------------- | | Authorization | Bearer `` | +
Path params: -| Path param | Description | -| --- | --- | -| Username | Own or a friends username. Own username can also be replaced with `@me`| +| Path param | Description | +| ---------- | ----------------------------------------------------------------------- | +| Username | Own or a friends username. Own username can also be replaced with `@me` | +
**Sample request** + ```curl curl --request GET 'https://api.testaustime.fi/users/@me/activity/current' \ --header 'Authorization: Bearer ' ``` **Sample response** + ```JSON { "started": "YYYY-MM-DDTHH:MM:SS.ssssssZ", @@ -554,7 +615,8 @@ curl --request GET 'https://api.testaustime.fi/users/@me/activity/current' \ "language": "c", "hostname": "hostname1", "editor_name": "Neovim", - "project_name": "cool_project22" + "project_name": "cool_project22", + "hidden": false } } ``` @@ -563,34 +625,38 @@ curl --request GET 'https://api.testaustime.fi/users/@me/activity/current' \ Response definitions: | Response Item | Type | Description | -| --- | --- | --- | +| ------------- | ------ | ------------------------------------------------------------------------------------ | | started | string | Start time (time of sending first heartbeat) of user code session in ISO 8601 format | | duration | int | Duration of user code session in seconds | | heartbeat | Object | The HeartBeat object described [here](#activity_up) | + -#### [6. DELETE /users/@me/delete](#users) +#### [6. DELETE /users/@me/delete](#users) Deletes user account
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------ | ---------------- | | Content-Type | application/json | +
Body params: -| Param | Type | Required | Description | -| --- | --- | --- | --- | -| username| string | Yes | Username | -| password | string | Yes | User password | +| Param | Type | Required | Description | +| -------- | ------ | -------- | ------------- | +| username | string | Yes | Username | +| password | string | Yes | User password | +
**Sample request** + ```curl curl --request DELETE 'https://api.testaustime.fi/users/@me/delete' \ --header 'Content-Type: application/json' \ @@ -601,47 +667,52 @@ curl --request DELETE 'https://api.testaustime.fi/users/@me/delete' \ ``` **Sample response** + ```http 200 OK ``` -## Activity +## Activity Contains main operations with activity heartbeats on which this service is based on ### Endpoints -| Endpoint | Method | Description | -| --- | --- | --- | -| [/activity/update](#activity_up) | POST | Creating code session and logs current activity in that | -| [/activity/flush](#activity_fl) | POST | Flushing any currently active coding session | -| [/activity/rename](#activity_rename) | POST | Rename all activities with matching `project_name` | -| [/activity/delete](#activity_del) | DELETE | Deleting selected code session | +| Endpoint | Method | Description | +| ------------------------------------ | ------ | ------------------------------------------------------------ | +| [/activity/update](#activity_up) | POST | Creating code session and logs current activity in that | +| [/activity/flush](#activity_fl) | POST | Flushing any currently active coding session | +| [/activity/rename](#activity_rename) | POST | Rename all activities with matching `project_name` | +| [/activity/delete](#activity_del) | DELETE | Deleting selected code session | +| [/activity/hide](#activity_hide) | POST | Hides or reveals all activities with matching `project_name` | -#### [1. POST /activity/update](#activity) +#### [1. POST /activity/update](#activity) Main endpoint of the service. Creates code session and logs current activity in that. ->*The desired interval at which to send heartbeats is immediately when editing a file, and after that at max every 30 seconds, and only when the user does something actively in the editor* +> _The desired interval at which to send heartbeats is immediately when editing a file, and after that at max every 30 seconds, and only when the user does something actively in the editor_
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | --------------------- | | Authorization | Bearer `` | -| Content-Type | application/json | +| Content-Type | application/json | +
Body params: -| Param | Type | Description | -| --- | --- | --- | -| language | string | Code language of the code session | -| hostname | string | User hostname | -| editor_name | string | Name of IDE (Visual Studio Code, IntelliJ, Neovim, etc.) in which user is coding | -| project_name | string| Name of the project in which user have a code session | +| Param | Type | Description | +| ------------ | ------- | -------------------------------------------------------------------------------- | +| language | string | Code language of the code session | +| hostname | string | User hostname | +| editor_name | string | Name of IDE (Visual Studio Code, IntelliJ, Neovim, etc.) in which user is coding | +| project_name | string | Name of the project in which user have a code session. | +| hidden | boolean | Should this project be hidden? | +
**Sample first request** @@ -661,6 +732,7 @@ curl --request POST 'https://api.testaustime.fi/activity/update' \ ``` **Sample first response** + ```HTTP 200 OK ``` @@ -680,47 +752,52 @@ curl --request POST 'https://api.testaustime.fi/activity/update' \ ``` **Sample next response** + ```HTTP 200 OK Body: PT7.420699439S //duration of the user code session in seconds to nanoseconds ``` -#### [2. POST /activity/flush](#activity) +#### [2. POST /activity/flush](#activity) Flushes/stops any currently active coding session ->*Active coding session can be flushed/stoped automatically without any activity updates for a long time. Also can be flushed automatically in case of starting new code session* +> _Active coding session can be flushed/stoped automatically without any activity updates for a long time. Also can be flushed automatically in case of starting new code session_
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | --------------------- | | Authorization | Bearer `` | +
**Sample request** + ```curl curl --request POST 'https://api.testaustime.fi/activity/flush' \ --header 'Authorization: Bearer ' ``` **Sample response** + ```HTTP 200 OK ``` -#### [3. POST /activity/rename](#activity) +#### [3. POST /activity/rename](#activity) Rename all activities that have a matching `project_name`
Header params: -| Name | Value | -| --- | --- | -| Content-Type | application/json | +| Name | Value | +| ------------- | --------------------- | +| Content-Type | application/json | | Authorization | Bearer `` | +
@@ -731,8 +808,8 @@ Rename all activities that have a matching `project_name` | to | string | Yes | new name |
- **Sample request** + ```curl curl --request POST 'https://api.testaustime.fi/activity/rename' \ --header 'Content-Type: application/json' \ @@ -744,6 +821,7 @@ curl --request POST 'https://api.testaustime.fi/activity/rename' \ ``` **Sample response** + ```JSON { "affected_activities": 20 @@ -757,27 +835,30 @@ curl --request POST 'https://api.testaustime.fi/activity/rename' \ | affected_activities | int | Number of activities renamed | -#### [4. POST /activity/delete](#activity) +#### [4. POST /activity/delete](#activity) Deletes selected code session, requires secured access token
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | -------------------- | | Authorization | Bearer `` | +
Body params: | Param | Type | Description | -| --- | --- | --- | +| -------- | ------ | --------------------------------------------------------------------------------- | | raw text | string | Activity id from response [`GET /users/{username}/activity/data`](#activity_data) | +
**Sample request** + ```curl curl --request DELETE 'https://api.testaustime.fi/activity/delete' \ --header 'Authorization: Bearer ' \ @@ -785,41 +866,93 @@ curl --request DELETE 'https://api.testaustime.fi/activity/delete' \ ``` **Sample response** + ```HTTP 200 OK ``` -## Friends +#### [5. POST /activity/hide](#activity) + +Hide or reveal all activities that have a matching `project_name` + +
+ Header params: + +| Name | Value | +| ------------- | --------------------- | +| Content-Type | application/json | +| Authorization | Bearer `` | + +
+ +
+ Body params: +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| target_project | string | Yes | Project name | +| hidden | boolean | Yes | Should the project be hidden? | +
+ +**Sample request** + +```curl +curl --request POST 'https://api.testaustime.fi/activity/hide' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer ' \ +--data-raw '{ + "project_name": "super_secret_project", + "hidden": true +}' +``` + +**Sample response** + +```JSON +{ + "affected_activities": 100 +} +``` + +
+ Response definitions: +| Response Item | Type | Description | +| --- | --- | --- | +| affected_activities | int | Number of activities hidden/revealed | +
+ +## Friends Containts CRUD-operations with user friends ### Endpoints -| Endpoint| Method | Description | -| --- | --- | --- | -| [/friends/add](#add_friend) | POST | Adding the holder of the friend_token as a friend of authorized user | -| [/friends/list](#list_friends) | GET | Geting a list of added user friends | -| [/friends/regenerate](#regenerate_fc) | POST | Regenerateing the authorized user's friend code | -| [/friends/remove](#remove_friend) | DELETE | Removing another user from user friend list | +| Endpoint | Method | Description | +| ------------------------------------- | ------ | -------------------------------------------------------------------- | +| [/friends/add](#add_friend) | POST | Adding the holder of the friend_token as a friend of authorized user | +| [/friends/list](#list_friends) | GET | Geting a list of added user friends | +| [/friends/regenerate](#regenerate_fc) | POST | Regenerateing the authorized user's friend code | +| [/friends/remove](#remove_friend) | DELETE | Removing another user from user friend list | -#### [1. POST /friends/add](#friends) +#### [1. POST /friends/add](#friends) Adds the holder of the friend token as a friend of the authenticating user
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | --------------------- | | Authorization | Bearer `` | +
Body params: -| Param | Type | Description | -| --- | --- | --- | +| Param | Type | Description | +| -------- | ------ | ----------------------------------------------- | | raw text | string | Should contain friend code without any prefixes | +
**Sample request** @@ -856,23 +989,25 @@ curl --request POST 'https://api.testaustime.fi/friends/add' \
Error examples: -| Error | Error code | Body | -| --- | --- | --- | -| Friendcode is already used for adding a friend | 403 Forbidden | { "error": "Already friends"} | -| Friendcode from body request is not found | 404 Not Found | { "error": "User not found"} | +| Error | Error code | Body | +| -------------------------------------------------------------- | ------------- | ------------------------------------- | +| Friendcode is already used for adding a friend | 403 Forbidden | { "error": "Already friends"} | +| Friendcode from body request is not found | 404 Not Found | { "error": "User not found"} | | Friendcode matches with friendcode of authorized user themself | 403 Forbidden | { "error": "You cannot add yourself"} | +
-#### [2. GET friends/list](#friends) +#### [2. GET friends/list](#friends) Gets a list of added user friends
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | --------------------- | | Authorization | Bearer `` | +
**Sample request** @@ -883,6 +1018,7 @@ curl --request GET ''https://api.testaustime.fi/friends/list' \ ``` **Sample response** + ```JSON [ { @@ -909,42 +1045,47 @@ curl --request GET ''https://api.testaustime.fi/friends/list' \
Response definitions: -| Response Item | Type | Description | -| --- | --- | --- | -| username | string | Friend's username | -| coding_time | Object | Coding friend's time by total, past month and past week | -| all_time | int | Total duration of user code sessions in seconds | -| past_month | int| Total duration of user code sessions in seconds for past month | -| past_week | int| Total duration of user code sessions in seconds for past week | -| status | Object | Information about the user's current activity | -| started | string | Timestamp of when the session start | -| duration | int | Duration of user code session in seconds | -| heartbeat | Object | Information about the latest heartbeat | -| project_name | string| Name of the project in which user have a code session | -| language | string| Code language of the code session | -| editor_name | string| Name of IDE (Visual Studio Code, IntelliJ, Neovim, etc.) in which user is coding | -| hostname | string| User hostname | -
- -#### [3. POST /friends/regenerate](#friends) +| Response Item | Type | Description | +| ------------- | ------- | -------------------------------------------------------------------------------- | +| username | string | Friend's username | +| coding_time | Object | Coding friend's time by total, past month and past week | +| all_time | int | Total duration of user code sessions in seconds | +| past_month | int | Total duration of user code sessions in seconds for past month | +| past_week | int | Total duration of user code sessions in seconds for past week | +| status | Object | Information about the user's current activity | +| started | string | Timestamp of when the session start | +| duration | int | Duration of user code session in seconds | +| heartbeat | Object | Information about the latest heartbeat | +| project_name | string | Name of the project in which user have a code session. Empty string if hidden. | +| language | string | Code language of the code session | +| editor_name | string | Name of IDE (Visual Studio Code, IntelliJ, Neovim, etc.) in which user is coding | +| hostname | string | User hostname | +| hidden | boolean | Is the project hidden? | + + + +#### [3. POST /friends/regenerate](#friends) Regenerates the authorized user's friend code, requires secured access token
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | -------------------- | | Authorization | Bearer `` | +
**Sample request** + ```curl curl --request POST 'https://api.testaustime.fi/friends/regenerate' \ --header 'Authorization: Bearer ' ``` **Sample response** + ```JSON { "friend_code": "friend_code" @@ -954,32 +1095,36 @@ curl --request POST 'https://api.testaustime.fi/friends/regenerate' \
Response definitions: -| Response Item | Type | Description | -| --- | --- | --- | -| friend_code | string| New friend code. Using for the all next create friends paire operations | +| Response Item | Type | Description | +| ------------- | ------ | ----------------------------------------------------------------------- | +| friend_code | string | New friend code. Using for the all next create friends paire operations | +
-#### [4. DELETE /friends/remove](#friends) +#### [4. DELETE /friends/remove](#friends) Removes another user from your friend list, requires secured access token
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | -------------------- | | Authorization | Bearer `` | +
Body: -| Param | Type | Description | -| --- | --- | --- | +| Param | Type | Description | +| -------- | ------ | -------------------------------------------- | | raw text | string | Should contain username without any prefixes | +
**Sample request** + ```curl curl --request DELETE 'https://api.testaustime.fi/friends/remove' \ --header 'Authorization: Bearer ' \ @@ -987,50 +1132,54 @@ curl --request DELETE 'https://api.testaustime.fi/friends/remove' \ ``` **Sample response** + ```HTTP 200 OK ``` -## Leaderboards +## Leaderboards Containts CRUD-operations with leaderboards consisting of other Testaustime users ### Endpoints -| Endpoint| Method | Description | -| --- | --- | --- | -| [/leaderboards/create](#create_lb) | POST | Adding new leaderboard | -| [/leaderboard/join](#join_lb) | POST | Joining leaderboard by it's invite code | -| [/leaderboards/{name}](#read_lb) | GET | Getting info about leaderboard if authorized user is a member | -| [/leaderboard/{name}](#delete_lb) | DELETE | Deleting leaderboard if authorized user has admin rights | -| [/leaderboards/{name}/leave](#leave_lb) | POST | Leaving the leaderboard | -| [/leaderboards/{name}/regenerate](#regenerate_lb) | POST | Regenerating invite code of the leaderboard if authorized user has admin rights | -| [/leaderboards/{name}/promote](#promote_lb) | POST | Promoting member of a leaderboard to admin if authorized user has admin rights | -| [/leaderboards/{name}/demote](#demote_lb) | POST | Demoting promoted admin to regular member of the leaderboard if authorized user has admin rights | -| [/leaderboards/{name}/kick](#kick_lb) | POST | Kicking user from leaderboard if authorized user has root admin rights | +| Endpoint | Method | Description | +| ------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------ | +| [/leaderboards/create](#create_lb) | POST | Adding new leaderboard | +| [/leaderboard/join](#join_lb) | POST | Joining leaderboard by it's invite code | +| [/leaderboards/{name}](#read_lb) | GET | Getting info about leaderboard if authorized user is a member | +| [/leaderboard/{name}](#delete_lb) | DELETE | Deleting leaderboard if authorized user has admin rights | +| [/leaderboards/{name}/leave](#leave_lb) | POST | Leaving the leaderboard | +| [/leaderboards/{name}/regenerate](#regenerate_lb) | POST | Regenerating invite code of the leaderboard if authorized user has admin rights | +| [/leaderboards/{name}/promote](#promote_lb) | POST | Promoting member of a leaderboard to admin if authorized user has admin rights | +| [/leaderboards/{name}/demote](#demote_lb) | POST | Demoting promoted admin to regular member of the leaderboard if authorized user has admin rights | +| [/leaderboards/{name}/kick](#kick_lb) | POST | Kicking user from leaderboard if authorized user has root admin rights | -#### [1. POST /leaderboards/create](#leaderboards) +#### [1. POST /leaderboards/create](#leaderboards) Adds new leaderboard
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | --------------------- | | Authorization | Bearer `` | -| Content-Type | application/json | +| Content-Type | application/json | +
Body params: -| Param | Type | Description | -| --- | --- | --- | -| name| string | Name of creating leaderboard | +| Param | Type | Description | +| ----- | ------ | ---------------------------- | +| name | string | Name of creating leaderboard | +
**Sample request** + ```curl curl --request POST 'https://api.testaustime.fi/leaderboards/create' \ --header 'Authorization: Bearer ' \ @@ -1041,46 +1190,52 @@ curl --request POST 'https://api.testaustime.fi/leaderboards/create' \ ``` **Sample response** + ```JSON { "invite_code": "invite_code" } ``` +
Response definitions: -| Response Item | Type | Description | -| --- | --- | --- | -| invite_code | string| Invite code for joining leaderboard | +| Response Item | Type | Description | +| ------------- | ------ | ----------------------------------- | +| invite_code | string | Invite code for joining leaderboard | +
Error examples: -| Error | Error code | Body | -| --- | --- | --- | -| "Name" of the leaderboard is already used| 403 Forbidden | { "error": "Leaderboard exists"} | +| Error | Error code | Body | +| ----------------------------------------- | ------------- | -------------------------------- | +| "Name" of the leaderboard is already used | 403 Forbidden | { "error": "Leaderboard exists"} | +
-#### [2. POST /leaderboard/join](#leaderboards) +#### [2. POST /leaderboard/join](#leaderboards) Joins leaderboard by it's invite code
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | --------------------- | | Authorization | Bearer `` | -| Content-Type | application/json | +| Content-Type | application/json | +
Body params: -| Param | Type | Description | -| --- | --- | --- | +| Param | Type | Description | +| ------ | ------ | ----------------------------------- | | invite | string | Invite code for joining leaderboard | +
**Sample request** @@ -1095,6 +1250,7 @@ curl --request POST 'https://api.testaustime.fi/leaderboards/join' \ ``` **Sample response** + ```JSON { "member_count": 0, @@ -1106,39 +1262,43 @@ curl --request POST 'https://api.testaustime.fi/leaderboards/join' \
Response definitions: -| Response Item | Type | Description | -| --- | --- | --- | -| member_count | int| Number of leaderboard members | -| name | string| Leaderboard name | +| Response Item | Type | Description | +| ------------- | ------ | ----------------------------- | +| member_count | int | Number of leaderboard members | +| name | string | Leaderboard name | +
Error examples: -| Error | Error code | Body | -| --- | --- | --- | +| Error | Error code | Body | +| -------------------------------------------------- | ------------- | ------------------------------------- | | Authorized user is already part of the leaderboard | 403 Forbidden | { "error": "You're already a member"} | -| Leaderboard not found by invite code | 404 Not Found | { "error": "Leaderboard not found"} | +| Leaderboard not found by invite code | 404 Not Found | { "error": "Leaderboard not found"} | +
-#### [3. GET /leaderboards/{name}](#leaderboards) +#### [3. GET /leaderboards/{name}](#leaderboards) Gets info about leaderboard if authorized user is a member
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | --------------------- | | Authorization | Bearer `` | +
Path params: -| Path param | Description | -| --- | --- | -| {name} | Leaderboard name | +| Path param | Description | +| ---------- | ---------------- | +| {name} | Leaderboard name | +
**Sample request** @@ -1149,6 +1309,7 @@ curl --request GET 'https://api.testaustime.fi/leaderboards/{name}' \ ``` **Sample response** + ```JSON { "name": "name", @@ -1163,49 +1324,54 @@ curl --request GET 'https://api.testaustime.fi/leaderboards/{name}' \ ] } ``` +
Response definitions: -| Response Item | Type | Description | -| --- | --- | --- | -| name | int| Leaderboard name | -| invite | int| Invite code for joining leaderboard | -| creation_time| string (ISO 8601 format) | Time of leaderboard creation to microsends | -| members | array object| Information about leaderboard members | -| username| string| Member username| -| admin | boolean| Rights of leaderboard member: admin or regular | -| time_coded | int| Total duration of user code sessions in second | +| Response Item | Type | Description | +| ------------- | ------------------------ | ---------------------------------------------- | +| name | int | Leaderboard name | +| invite | int | Invite code for joining leaderboard | +| creation_time | string (ISO 8601 format) | Time of leaderboard creation to microsends | +| members | array object | Information about leaderboard members | +| username | string | Member username | +| admin | boolean | Rights of leaderboard member: admin or regular | +| time_coded | int | Total duration of user code sessions in second | +
Error examples: -| Error | Error code | Body | -| --- | --- | --- | +| Error | Error code | Body | +| ----------------------------------------------- | ---------------- | ------------------------------------ | | Authorized user is not part of this leaderboard | 401 Unauthorized | { "error": "You are not authorized"} | -| Leaderboard not found by name | 404 Not Found | { "error": "Leaderboard not found"} | +| Leaderboard not found by name | 404 Not Found | { "error": "Leaderboard not found"} | +
-#### [4. DELETE /leaderboard/{name}](#leaderboards) +#### [4. DELETE /leaderboard/{name}](#leaderboards) Deletes leaderboard if authorized user has admin rights, requires secured access token ->*Note: Leaderboard can be deleted either by root administrator or by promoted one* +> _Note: Leaderboard can be deleted either by root administrator or by promoted one_
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | -------------------- | | Authorization | Bearer `` | +
Path params: -| Path param | Description | -| --- | --- | -| {name} | Leaderboard name | +| Path param | Description | +| ---------- | ---------------- | +| {name} | Leaderboard name | +
**Sample request** @@ -1216,6 +1382,7 @@ curl --request DELETE 'https://api.testaustime.fi/leaderboards/{name}' \ ``` **Sample response** + ```HTTP 200 OK ``` @@ -1223,30 +1390,33 @@ curl --request DELETE 'https://api.testaustime.fi/leaderboards/{name}' \
Error examples: -| Error | Error code | Body | -| --- | --- | --- | +| Error | Error code | Body | +| ----------------------------------------------- | ---------------- | ------------------------------------ | | Authorized user is not part of this leaderboard | 401 Unauthorized | { "error": "You are not authorized"} | -| Leaderboard not found by name | 404 Not Found | { "error": "Leaderboard not found"} | +| Leaderboard not found by name | 404 Not Found | { "error": "Leaderboard not found"} | +
-#### [5. POST /leaderboards/{name}/leave](#leaderboards) +#### [5. POST /leaderboards/{name}/leave](#leaderboards) Leaves the leaderboard, requires secured access token
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | -------------------- | | Authorization | Bearer `` | +
Path params: -| Path param | Description | -| --- | --- | -| {name} | Leaderboard name | +| Path param | Description | +| ---------- | ---------------- | +| {name} | Leaderboard name | +
**Sample request** @@ -1257,6 +1427,7 @@ curl --request POST 'https://api.testaustime.fi/leaderboards/{name}/leave' \ ``` **Sample response** + ```HTTP 200 OK ``` @@ -1264,31 +1435,34 @@ curl --request POST 'https://api.testaustime.fi/leaderboards/{name}/leave' \
Error examples: -| Error | Error code | Body | -| --- | --- | --- | -| Authorized user is the last admin in leaderboard| 403 Forbidden | { "error": "There are no more admins left, you cannot leave"} | -| User is not the part of the leaderboard | 403 Frobidden | { "error": "You're not a member"} | -| Leaderboard not found by name | 404 Not Found | { "error": "Leaderboard not found"} | +| Error | Error code | Body | +| ------------------------------------------------ | ------------- | ------------------------------------------------------------- | +| Authorized user is the last admin in leaderboard | 403 Forbidden | { "error": "There are no more admins left, you cannot leave"} | +| User is not the part of the leaderboard | 403 Frobidden | { "error": "You're not a member"} | +| Leaderboard not found by name | 404 Not Found | { "error": "Leaderboard not found"} | +
-#### [6. POST /leaderboards/{name}/regenerate](#leaderboards) +#### [6. POST /leaderboards/{name}/regenerate](#leaderboards) Regenerates invite code of the leaderboard if authorized user has admin rights, requires secured access token
Header params: -| Name | Value | -| --- | --- | +| Name | Value | +| ------------- | -------------------- | | Authorization | Bearer `` | +
Path params: -| Path param | Description | -| --- | --- | -| {name} | Leaderboard name | +| Path param | Description | +| ---------- | ---------------- | +| {name} | Leaderboard name | +
**Sample request** @@ -1299,51 +1473,58 @@ curl --request POST 'https://api.testaustime.fi/leaderboards/{name}/regenerate' ``` **Sample response** + ```JSON { "invite_code": "" } ``` +
Error examples: -| Error | Error code | Body | -| --- | --- | --- | +| Error | Error code | Body | +| ------------------------------------------------------------------------ | ---------------- | ------------------------------------ | | Authorized user is not part of found leaderboard or user is not an admin | 401 Unauthorized | { "error": "You are not authorized"} | -| Leaderboard not found by name | 404 Not Found | { "error": "Leaderboard not found"} | +| Leaderboard not found by name | 404 Not Found | { "error": "Leaderboard not found"} | +
-#### [7. POST /leaderboards/{name}/promote](#leaderboards) +#### [7. POST /leaderboards/{name}/promote](#leaderboards) Promotes member of a leaderboard to admin if authorized user has admin rights. Be careful of promoting users, root admin (creator of the leaderboard) can be demoted/kicked by a promoted one. Requires secured access token. ->*This request is idempotent, it means that you can: ->1. *Promote user that is already admin and have in response 200 OK* ->2. *Promote yourself to admin being already admin and have in response 200 OK* +> \*This request is idempotent, it means that you can: +> +> 1. _Promote user that is already admin and have in response 200 OK_ +> 2. _Promote yourself to admin being already admin and have in response 200 OK_
Header params: -| Name | Value | -| --- | --- | -| Content-Type | application/json | +| Name | Value | +| ------------- | -------------------- | +| Content-Type | application/json | | Authorization | Bearer `` | +
Path params: -| Path param | Description | -| --- | --- | -| {name} | Leaderboard name | +| Path param | Description | +| ---------- | ---------------- | +| {name} | Leaderboard name | +
Body params: -| Param | Type | Description | -| --- | --- | --- | -| user | string | Username of a leaderboard member you want to promote | +| Param | Type | Description | +| ----- | ------ | ---------------------------------------------------- | +| user | string | Username of a leaderboard member you want to promote | +
**Sample request** @@ -1358,46 +1539,52 @@ curl --request POST 'https://api.testaustime.fi/leaderboards/{name}/promote' \ ``` **Sample response** + ```HTTP 200 OK ``` +
Error examples: -| Error | Error code | Body | -| --- | --- | --- | +| Error | Error code | Body | +| ------------------------------------------------------------------------ | ---------------- | ------------------------------------ | | Authorized user is not part of found leaderboard or user is not an admin | 401 Unauthorized | { "error": "You are not authorized"} | -| Promoting user is not the leaderboard member | 403 Forbidden | { "error": "You're not a member"} | +| Promoting user is not the leaderboard member | 403 Forbidden | { "error": "You're not a member"} | +
-#### [8. POST /leaderboards/{name}/demote](#leaderboards) +#### [8. POST /leaderboards/{name}/demote](#leaderboards) Demotes admin to regular member in the leaderboard if authorized user has admin rights. Be careful of promoting users, root admin (creator of the leaderboard) can be demoted by a promoted one. Requires secured access token.
Header params: -| Name | Value | -| --- | --- | -| Content-Type | application/json | +| Name | Value | +| ------------- | -------------------- | +| Content-Type | application/json | | Authorization | Bearer `` | +
Path params: -| Path param | Description | -| --- | --- | -| {name} | Leaderboard name | +| Path param | Description | +| ---------- | ---------------- | +| {name} | Leaderboard name | +
Body params: -| Param | Type | Description | -| --- | --- | --- | -| user | string | Username of a leaderboard admin you want to demote| +| Param | Type | Description | +| ----- | ------ | -------------------------------------------------- | +| user | string | Username of a leaderboard admin you want to demote | +
**Sample request** @@ -1412,6 +1599,7 @@ curl --request POST 'https://api.testaustime.fi/leaderboards/{name}/demote' \ ``` **Sample response** + ```HTTP 200 OK @@ -1420,39 +1608,43 @@ curl --request POST 'https://api.testaustime.fi/leaderboards/{name}/demote' \
Error examples: -| Error | Error code | Body | -| --- | --- | --- | +| Error | Error code | Body | +| ------------------------------------------------------------------------ | ---------------- | ------------------------------------ | | Authorized user is not part of found leaderboard or user is not an admin | 401 Unauthorized | { "error": "You are not authorized"} | -| Demoting user is not the leaderboard member | 403 Forbidden | { "error": "You're not a member"} | +| Demoting user is not the leaderboard member | 403 Forbidden | { "error": "You're not a member"} | +
-#### [9. POST /leaderboards/{name}/kick](#leaderboards) +#### [9. POST /leaderboards/{name}/kick](#leaderboards) Kicks user from leaderboard if authorized user has admin rights, requires secured access token
Header params: -| Name | Value | -| --- | --- | -| Content-Type | application/json | +| Name | Value | +| ------------- | -------------------- | +| Content-Type | application/json | | Authorization | Bearer `` | +
Path params: -| Path param | Description | -| --- | --- | -| {name} | Leaderboard name | +| Path param | Description | +| ---------- | ---------------- | +| {name} | Leaderboard name | +
Body params: -| Param | Type | Description | -| --- | --- | --- | -| user | string | Username of a leaderboard member you want to kick| +| Param | Type | Description | +| ----- | ------ | ------------------------------------------------- | +| user | string | Username of a leaderboard member you want to kick | +
**Sample request** @@ -1467,15 +1659,18 @@ curl --request POST 'https://api.testaustime.fi/leaderboards/{name}/kick' \ ``` **Sample response** + ```HTTP 200 OK ``` +
Error examples: -| Error | Error code | Body | -| --- | --- | --- | +| Error | Error code | Body | +| ------------------------------------------------------------------------ | ---------------- | ------------------------------------ | | Authorized user is not part of found leaderboard or user is not an admin | 401 Unauthorized | { "error": "You are not authorized"} | -| Kicking user is not the leaderboard member | 403 Forbidden | { "error": "You're not a member"} | +| Kicking user is not the leaderboard member | 403 Forbidden | { "error": "You're not a member"} | +
diff --git a/migrations/2024-03-12-174132_serverside_hidden/down.sql b/migrations/2024-03-12-174132_serverside_hidden/down.sql new file mode 100644 index 0000000..0aba391 --- /dev/null +++ b/migrations/2024-03-12-174132_serverside_hidden/down.sql @@ -0,0 +1,9 @@ +-- This file should undo anything in `up.sql` +ALTER TABLE "coding_activities" DROP COLUMN "hidden"; + + + + + + + diff --git a/migrations/2024-03-12-174132_serverside_hidden/up.sql b/migrations/2024-03-12-174132_serverside_hidden/up.sql new file mode 100644 index 0000000..ca7713b --- /dev/null +++ b/migrations/2024-03-12-174132_serverside_hidden/up.sql @@ -0,0 +1,11 @@ +-- Your SQL goes here +ALTER TABLE "coding_activities" ADD COLUMN "hidden" BOOL; +UPDATE "coding_activities" SET "hidden" = false WHERE hidden IS NULL; +ALTER TABLE "coding_activities" ALTER COLUMN hidden SET NOT NULL; + + + + + + + diff --git a/src/api/activity.rs b/src/api/activity.rs index e9f0bba..1791e0c 100644 --- a/src/api/activity.rs +++ b/src/api/activity.rs @@ -20,6 +20,12 @@ pub struct RenameRequest { to: String, } +#[derive(Deserialize)] +pub struct HideRequest { + target_project: String, + hidden: bool, +} + #[post("/update")] pub async fn update( user: UserId, @@ -55,6 +61,7 @@ pub async fn update( )); } } + match heartbeats.get(&user.id) { Some(activity) => { let (current_heartbeat, start, mut duration) = activity.to_owned(); @@ -172,3 +179,16 @@ pub async fn rename_project( Ok(web::Json(json!({ "affected_activities": renamed }))) } + +#[post("/hide")] +pub async fn hide_project( + user: UserId, + db: DatabaseWrapper, + body: Json, +) -> Result { + let renamed = db + .set_project_hidden(user.id, body.target_project.clone(), body.hidden.clone()) + .await?; + + Ok(web::Json(json!({ "affected_activities": renamed }))) +} diff --git a/src/api/friends.rs b/src/api/friends.rs index 201fac6..9bb9174 100644 --- a/src/api/friends.rs +++ b/src/api/friends.rs @@ -69,8 +69,11 @@ pub async fn get_friends( username: fwt.user.username, coding_time: fwt.coding_time, status: heartbeats.get(&fwt.user.id).map(|heartbeat| { - let (inner_heartbeat, start_time, duration) = heartbeat.to_owned(); + let (mut inner_heartbeat, start_time, duration) = heartbeat.to_owned(); drop(heartbeat); + if inner_heartbeat.hidden == Some(true) { + inner_heartbeat.project_name = Some("".to_string()); + } CurrentActivity { started: start_time, duration: duration.num_seconds(), diff --git a/src/api/users.rs b/src/api/users.rs index 9a41cec..037710b 100644 --- a/src/api/users.rs +++ b/src/api/users.rs @@ -71,8 +71,11 @@ pub async fn get_current_activity( db: DatabaseWrapper, heartbeats: Data, ) -> Result { + let mut is_self: bool = false; let target_user = if let Some(user) = opt_user.identity { if path.0 == "@me" { + is_self = true; + user.id } else { let target_user = db @@ -84,6 +87,7 @@ pub async fn get_current_activity( || target_user.is_public || db.are_friends(user.id, target_user.id).await? { + is_self = target_user.id == user.id; target_user.id } else { return Err(TimeError::Unauthorized); @@ -115,11 +119,16 @@ pub async fn get_current_activity( heartbeats.remove(&target_user); Err(TimeError::NotActive) } else { - let current_heartbeat = CurrentActivity { + let mut current_heartbeat = CurrentActivity { started: start, duration: duration.num_seconds(), heartbeat: inner_heartbeat, }; + + if !is_self && current_heartbeat.heartbeat.hidden == Some(true) { + current_heartbeat.heartbeat.project_name = Some("".to_string()); + } + Ok(web::Json(Some(current_heartbeat))) } } @@ -141,14 +150,14 @@ pub async fn get_activities( .map_err(|_| TimeError::UserNotFound)?; if target_user.is_public { - return Ok(web::Json(db.get_activity(data, target_user.id).await?)); + return Ok(web::Json(db.get_activity(data, target_user.id, false).await?)); } else { return Err(TimeError::UserNotFound); }; }; let data = if path.0 == "@me" { - db.get_activity(data, user.id).await? + db.get_activity(data, user.id, true).await? } else { //FIXME: This is technically not required when the username equals the username of the //authenticated user @@ -161,7 +170,7 @@ pub async fn get_activities( || target_user.is_public || db.are_friends(user.id, target_user.id).await? { - db.get_activity(data, target_user.id).await? + db.get_activity(data, target_user.id, target_user.id == user.id).await? } else { return Err(TimeError::Unauthorized); } diff --git a/src/database/activity.rs b/src/database/activity.rs index 706169c..6e7eef0 100644 --- a/src/database/activity.rs +++ b/src/database/activity.rs @@ -5,7 +5,7 @@ use diesel_async::RunQueryDsl; use crate::{ error::TimeError, models::*, - requests::{DataRequest, HeartBeat}, + requests::{DataRequest, HeartBeat} }; impl super::DatabaseWrapper { @@ -24,6 +24,7 @@ impl super::DatabaseWrapper { language: heartbeat.language, editor_name: heartbeat.editor_name, hostname: heartbeat.hostname, + hidden: heartbeat.hidden.unwrap_or(false), }; let mut conn = self.db.get().await?; @@ -42,6 +43,7 @@ impl super::DatabaseWrapper { let mut conn = self.db.get().await?; use crate::schema::coding_activities::dsl::*; + Ok(coding_activities .filter(user_id.eq(user)) .load::(&mut conn) @@ -52,6 +54,7 @@ impl super::DatabaseWrapper { &self, request: DataRequest, user: i32, + is_self: bool, ) -> Result, TimeError> { use crate::schema::coding_activities::dsl::*; let mut query = coding_activities.into_boxed().filter(user_id.eq(user)); @@ -78,7 +81,19 @@ impl super::DatabaseWrapper { }; let mut conn = self.db.get().await?; - Ok(query.load::(&mut conn).await?) + let mut activities = query.load::(&mut conn).await?; + + // Change hidden entries project name + if is_self == false { + for act in &mut activities { + if act.hidden { + // Empty string instead of None() to make sure we don't make everything into "undefined" :D + act.project_name = Some("".to_string()); + } + } + } + + Ok(activities) } pub async fn get_user_coding_time_since( @@ -141,6 +156,23 @@ impl super::DatabaseWrapper { .await?) } + pub async fn set_project_hidden( + &self, + target_user_id: i32, + target_project: String, + to: bool, + ) -> Result { + let mut conn = self.db.get().await?; + + use crate::schema::coding_activities::dsl::*; + Ok(diesel::update(coding_activities) + .filter(user_id.eq(target_user_id)) + .filter(project_name.eq(target_project)) + .set(hidden.eq(to)) + .execute(&mut conn) + .await?) + } + pub async fn delete_activity(&self, userid: i32, activity: i32) -> Result { let mut conn = self.db.get().await?; diff --git a/src/main.rs b/src/main.rs index a984174..22bcaf6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -144,6 +144,7 @@ async fn main() -> std::io::Result<()> { .service(api::activity::delete) .service(api::activity::flush) .service(api::activity::rename_project) + .service(api::activity::hide_project) }) .service(api::auth::login) .service(api::auth::regenerate) diff --git a/src/models.rs b/src/models.rs index a2ffb34..89062b1 100644 --- a/src/models.rs +++ b/src/models.rs @@ -147,6 +147,7 @@ pub struct CodingActivity { pub language: Option, pub editor_name: Option, pub hostname: Option, + pub hidden: bool, } use crate::schema::coding_activities; @@ -161,6 +162,7 @@ pub struct NewCodingActivity { pub language: Option, pub editor_name: Option, pub hostname: Option, + pub hidden: bool, } #[derive(Queryable, Clone, Debug, Serialize, Hash, Eq, PartialEq, Identifiable)] diff --git a/src/requests.rs b/src/requests.rs index 7ddcddb..74d3f47 100644 --- a/src/requests.rs +++ b/src/requests.rs @@ -8,6 +8,7 @@ pub struct HeartBeat { pub language: Option, pub editor_name: Option, pub hostname: Option, + pub hidden: Option, } fn project_deserialize<'de, D>(deserializer: D) -> Result, D::Error> diff --git a/src/schema.rs b/src/schema.rs index 0637d90..b3bc6a2 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -6,10 +6,15 @@ diesel::table! { user_id -> Int4, start_time -> Timestamp, duration -> Int4, + #[max_length = 64] project_name -> Nullable, + #[max_length = 32] language -> Nullable, + #[max_length = 32] editor_name -> Nullable, + #[max_length = 32] hostname -> Nullable, + hidden -> Bool, } } @@ -33,7 +38,9 @@ diesel::table! { diesel::table! { leaderboards (id) { id -> Int4, + #[max_length = 32] name -> Varchar, + #[max_length = 32] invite_code -> Varchar, creation_time -> Timestamp, } @@ -60,8 +67,11 @@ diesel::table! { diesel::table! { user_identities (id) { id -> Int4, + #[max_length = 32] auth_token -> Bpchar, + #[max_length = 24] friend_code -> Bpchar, + #[max_length = 32] username -> Varchar, registration_time -> Timestamp, is_public -> Bool, diff --git a/src/tests/activity.rs b/src/tests/activity.rs index 12975e5..800d7c9 100644 --- a/src/tests/activity.rs +++ b/src/tests/activity.rs @@ -5,7 +5,7 @@ use serde_json::json; use super::{macros::*, *}; use crate::{ - models::{CurrentActivity, NewUserIdentity}, + models::{CurrentActivity, NewUserIdentity, SecuredAccessTokenResponse}, requests::HeartBeat, }; @@ -23,6 +23,7 @@ async fn updating_activity_works() { project_name: Some(String::from("cool project")), language: Some(String::from("rust")), editor_name: Some(String::from("nvim")), + hidden: Some(false), }; let resp = request_auth!( @@ -88,6 +89,7 @@ async fn updating_activity_works() { project_name: Some(String::from("another project")), language: Some(String::from("rust")), editor_name: Some(String::from("nvim")), + hidden: Some(false), }; let resp = request_auth!( app, @@ -138,6 +140,7 @@ async fn flushing_works() { project_name: Some(String::from("cool project")), language: Some(String::from("rust")), editor_name: Some(String::from("nvim")), + hidden: Some(false), }; let resp = request_auth!( @@ -170,4 +173,64 @@ async fn flushing_works() { assert!(resp.status().is_success(), "Failed to delete user"); } -// TODO: write tests for /activity/delete and /activity/rename +#[actix_web::test] +async fn hidden_works() { + let app = test::init_service(App::new().configure(init_test_services)).await; + let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 80u16); + + let body = json!({"username": "activeuser3", "password": "password"}); + let resp = request!(app, addr, post, "/auth/register", body); + let user: NewUserIdentity = test::read_body_json(resp).await; + + let heartbeat = HeartBeat { + hostname: Some(String::from("nsa-supercomputer")), + project_name: Some(String::from("prism2")), + language: Some(String::from("rust")), + editor_name: Some(String::from("nvim")), + hidden: Some(true), + }; + + let resp = request_auth!( + app, + addr, + post, + "/activity/update", + user.auth_token, + heartbeat + ); + assert!( + resp.status().is_success(), + "Sending heartbeat should succeed" + ); + + let resp = request_auth!(app, addr, get, "/users/@me/activity/data", user.auth_token); + let data: Vec = test::read_body_json(resp).await; + + assert!(data.is_empty(), "No session should exist"); + + let resp = request_auth!(app, addr, post, "/activity/flush", user.auth_token); + assert!(resp.status().is_success(), "Flushing should work"); + + let resp = request!(app, addr, post, "/auth/securedaccess", body); + assert!( + resp.status().is_success(), + "Getting secured access token failed" + ); + let sat: SecuredAccessTokenResponse = test::read_body_json(resp).await; + + let change = json!({"public_profile": true}); + let resp = request_auth!(app, addr, post, "/account/settings", sat.token, change); + + assert!(resp.status().is_success(), "Making profile public failed"); + + let resp = request!(app, addr, get, "/users/activeuser3/activity/data", user.auth_token); + let data: Vec = test::read_body_json(resp).await; + + assert!(!data.is_empty(), "Session should be saved after a flush"); + assert!(data[0].get("project_name").unwrap_or(&json!("not_empty")) == &json!(""), "Activity project name should be empty string"); + + let resp = request!(app, addr, delete, "/users/@me/delete", body); + assert!(resp.status().is_success(), "Failed to delete user"); +} + +// TODO: write tests for /activity/delete and /activity/rename and /activity/hide From 54003c31d3111d4c8a350b0618535e6dc1619754 Mon Sep 17 00:00:00 2001 From: raikasdev Date: Tue, 12 Mar 2024 23:44:42 +0200 Subject: [PATCH 02/11] style: format --- src/api/users.rs | 7 +++++-- src/database/activity.rs | 4 ++-- src/tests/activity.rs | 15 ++++++++++++--- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/api/users.rs b/src/api/users.rs index 037710b..8928f79 100644 --- a/src/api/users.rs +++ b/src/api/users.rs @@ -150,7 +150,9 @@ pub async fn get_activities( .map_err(|_| TimeError::UserNotFound)?; if target_user.is_public { - return Ok(web::Json(db.get_activity(data, target_user.id, false).await?)); + return Ok(web::Json( + db.get_activity(data, target_user.id, false).await?, + )); } else { return Err(TimeError::UserNotFound); }; @@ -170,7 +172,8 @@ pub async fn get_activities( || target_user.is_public || db.are_friends(user.id, target_user.id).await? { - db.get_activity(data, target_user.id, target_user.id == user.id).await? + db.get_activity(data, target_user.id, target_user.id == user.id) + .await? } else { return Err(TimeError::Unauthorized); } diff --git a/src/database/activity.rs b/src/database/activity.rs index 6e7eef0..33082bc 100644 --- a/src/database/activity.rs +++ b/src/database/activity.rs @@ -5,7 +5,7 @@ use diesel_async::RunQueryDsl; use crate::{ error::TimeError, models::*, - requests::{DataRequest, HeartBeat} + requests::{DataRequest, HeartBeat}, }; impl super::DatabaseWrapper { @@ -82,7 +82,7 @@ impl super::DatabaseWrapper { let mut conn = self.db.get().await?; let mut activities = query.load::(&mut conn).await?; - + // Change hidden entries project name if is_self == false { for act in &mut activities { diff --git a/src/tests/activity.rs b/src/tests/activity.rs index 800d7c9..44e90b4 100644 --- a/src/tests/activity.rs +++ b/src/tests/activity.rs @@ -217,17 +217,26 @@ async fn hidden_works() { "Getting secured access token failed" ); let sat: SecuredAccessTokenResponse = test::read_body_json(resp).await; - + let change = json!({"public_profile": true}); let resp = request_auth!(app, addr, post, "/account/settings", sat.token, change); assert!(resp.status().is_success(), "Making profile public failed"); - let resp = request!(app, addr, get, "/users/activeuser3/activity/data", user.auth_token); + let resp = request!( + app, + addr, + get, + "/users/activeuser3/activity/data", + user.auth_token + ); let data: Vec = test::read_body_json(resp).await; assert!(!data.is_empty(), "Session should be saved after a flush"); - assert!(data[0].get("project_name").unwrap_or(&json!("not_empty")) == &json!(""), "Activity project name should be empty string"); + assert!( + data[0].get("project_name").unwrap_or(&json!("not_empty")) == &json!(""), + "Activity project name should be empty string" + ); let resp = request!(app, addr, delete, "/users/@me/delete", body); assert!(resp.status().is_success(), "Failed to delete user"); From da617035bc2bd385497c54b3fa31175b6578d7b8 Mon Sep 17 00:00:00 2001 From: raikasdev Date: Tue, 12 Mar 2024 23:46:40 +0200 Subject: [PATCH 03/11] feat: add hidden protection to friend add route --- docs/APISPEC.md | 6 ++++-- src/api/friends.rs | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/APISPEC.md b/docs/APISPEC.md index 9350ca5..972e220 100644 --- a/docs/APISPEC.md +++ b/docs/APISPEC.md @@ -980,7 +980,8 @@ curl --request POST 'https://api.testaustime.fi/friends/add' \ "project_name": "My Project", "language": "javascript", "editor_name": "vscode", - "hostname": "mylaptop" + "hostname": "mylaptop", + "hidden": false } } } @@ -1035,7 +1036,8 @@ curl --request GET ''https://api.testaustime.fi/friends/list' \ "project_name": "My Project", "language": "javascript", "editor_name": "vscode", - "hostname": "mylaptop" + "hostname": "mylaptop", + "hidden": true } } } diff --git a/src/api/friends.rs b/src/api/friends.rs index 9bb9174..3e0b67d 100644 --- a/src/api/friends.rs +++ b/src/api/friends.rs @@ -39,8 +39,11 @@ pub async fn add_friend( username: friend.username.clone(), coding_time: db.get_coding_time_steps(friend.id).await, status: heartbeats.get(&friend.id).map(|heartbeat| { - let (inner_heartbeat, start_time, duration) = heartbeat.to_owned(); + let (mut inner_heartbeat, start_time, duration) = heartbeat.to_owned(); drop(heartbeat); + if inner_heartbeat.hidden == Some(true) { + inner_heartbeat.project_name = Some("".to_string()); + } CurrentActivity { started: start_time, duration: duration.num_seconds(), From 401d22bf643574792917d4bae0ad72f7ba5e6ffa Mon Sep 17 00:00:00 2001 From: raikasdev Date: Tue, 12 Mar 2024 23:48:19 +0200 Subject: [PATCH 04/11] fix: add hidden to api update example --- docs/APISPEC.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/APISPEC.md b/docs/APISPEC.md index 972e220..1a15340 100644 --- a/docs/APISPEC.md +++ b/docs/APISPEC.md @@ -727,7 +727,8 @@ curl --request POST 'https://api.testaustime.fi/activity/update' \ "language": "Python", "hostname": "Hostname1", "editor_name": "IntelliJ", - "project_name": "example_project" + "project_name": "example_project", + "hidden": false }' ``` @@ -747,7 +748,8 @@ curl --request POST 'https://api.testaustime.fi/activity/update' \ "language": "Python", "hostname": "Hostname1", "editor_name": "IntelliJ", - "project_name": "example_project" + "project_name": "example_project", + "hidden": false }' ``` From 0190fe09ddaee2b110de9e947cb7c5b2fa9655a5 Mon Sep 17 00:00:00 2001 From: raikasdev Date: Tue, 12 Mar 2024 23:49:20 +0200 Subject: [PATCH 05/11] fix: clean up quality:tm: code --- src/database/activity.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/database/activity.rs b/src/database/activity.rs index 33082bc..33c6916 100644 --- a/src/database/activity.rs +++ b/src/database/activity.rs @@ -84,7 +84,7 @@ impl super::DatabaseWrapper { let mut activities = query.load::(&mut conn).await?; // Change hidden entries project name - if is_self == false { + if !is_self { for act in &mut activities { if act.hidden { // Empty string instead of None() to make sure we don't make everything into "undefined" :D From ed4c74e8b04ccf5d4bb72ebacc5d7d8faa6da1dc Mon Sep 17 00:00:00 2001 From: raikasdev Date: Fri, 15 Mar 2024 19:37:04 +0200 Subject: [PATCH 06/11] fix: fixes skill issues with styling --- migrations/2024-03-12-174132_serverside_hidden/down.sql | 9 +-------- migrations/2024-03-12-174132_serverside_hidden/up.sql | 9 +-------- src/api/friends.rs | 4 ++-- src/api/users.rs | 2 +- src/database/activity.rs | 3 +-- 5 files changed, 6 insertions(+), 21 deletions(-) diff --git a/migrations/2024-03-12-174132_serverside_hidden/down.sql b/migrations/2024-03-12-174132_serverside_hidden/down.sql index 0aba391..b8fb975 100644 --- a/migrations/2024-03-12-174132_serverside_hidden/down.sql +++ b/migrations/2024-03-12-174132_serverside_hidden/down.sql @@ -1,9 +1,2 @@ -- This file should undo anything in `up.sql` -ALTER TABLE "coding_activities" DROP COLUMN "hidden"; - - - - - - - +ALTER TABLE "coding_activities" DROP COLUMN "hidden"; \ No newline at end of file diff --git a/migrations/2024-03-12-174132_serverside_hidden/up.sql b/migrations/2024-03-12-174132_serverside_hidden/up.sql index ca7713b..fc443b0 100644 --- a/migrations/2024-03-12-174132_serverside_hidden/up.sql +++ b/migrations/2024-03-12-174132_serverside_hidden/up.sql @@ -1,11 +1,4 @@ -- Your SQL goes here ALTER TABLE "coding_activities" ADD COLUMN "hidden" BOOL; UPDATE "coding_activities" SET "hidden" = false WHERE hidden IS NULL; -ALTER TABLE "coding_activities" ALTER COLUMN hidden SET NOT NULL; - - - - - - - +ALTER TABLE "coding_activities" ALTER COLUMN hidden SET NOT NULL; \ No newline at end of file diff --git a/src/api/friends.rs b/src/api/friends.rs index 3e0b67d..c582de4 100644 --- a/src/api/friends.rs +++ b/src/api/friends.rs @@ -42,7 +42,7 @@ pub async fn add_friend( let (mut inner_heartbeat, start_time, duration) = heartbeat.to_owned(); drop(heartbeat); if inner_heartbeat.hidden == Some(true) { - inner_heartbeat.project_name = Some("".to_string()); + inner_heartbeat.project_name = Some(String::from("hidden")); } CurrentActivity { started: start_time, @@ -75,7 +75,7 @@ pub async fn get_friends( let (mut inner_heartbeat, start_time, duration) = heartbeat.to_owned(); drop(heartbeat); if inner_heartbeat.hidden == Some(true) { - inner_heartbeat.project_name = Some("".to_string()); + inner_heartbeat.project_name = Some(String::from("hidden")); } CurrentActivity { started: start_time, diff --git a/src/api/users.rs b/src/api/users.rs index 8928f79..eb34613 100644 --- a/src/api/users.rs +++ b/src/api/users.rs @@ -126,7 +126,7 @@ pub async fn get_current_activity( }; if !is_self && current_heartbeat.heartbeat.hidden == Some(true) { - current_heartbeat.heartbeat.project_name = Some("".to_string()); + current_heartbeat.heartbeat.project_name = Some(String::from("hidden")); } Ok(web::Json(Some(current_heartbeat))) diff --git a/src/database/activity.rs b/src/database/activity.rs index 33c6916..e2e647a 100644 --- a/src/database/activity.rs +++ b/src/database/activity.rs @@ -87,8 +87,7 @@ impl super::DatabaseWrapper { if !is_self { for act in &mut activities { if act.hidden { - // Empty string instead of None() to make sure we don't make everything into "undefined" :D - act.project_name = Some("".to_string()); + act.project_name = Some(String::from("hidden")); } } } From cd02d17dbfe03622c317fb6fc6b5df88a6399a0d Mon Sep 17 00:00:00 2001 From: raikasdev Date: Mon, 27 May 2024 18:00:52 +0300 Subject: [PATCH 07/11] fix: hidden test --- src/tests/activity.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tests/activity.rs b/src/tests/activity.rs index 44e90b4..57f16ad 100644 --- a/src/tests/activity.rs +++ b/src/tests/activity.rs @@ -233,8 +233,9 @@ async fn hidden_works() { let data: Vec = test::read_body_json(resp).await; assert!(!data.is_empty(), "Session should be saved after a flush"); + // Print the actual value of the project name to see what it is assert!( - data[0].get("project_name").unwrap_or(&json!("not_empty")) == &json!(""), + data[0].get("project_name").unwrap_or(&json!("not_hidden")) == &json!("hidden"), "Activity project name should be empty string" ); From facfcf5a3722aadbcb39d39c3ff69a08d0f3c422 Mon Sep 17 00:00:00 2001 From: DrVilepis Date: Tue, 28 May 2024 12:00:25 +0300 Subject: [PATCH 08/11] update lockfile --- Cargo.lock | 423 ++++++++++++++++++++++++++++------------------------- 1 file changed, 227 insertions(+), 196 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2e86f17..98ddf24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "bytes", "futures-core", "futures-sink", @@ -36,9 +36,9 @@ dependencies = [ [[package]] name = "actix-http" -version = "3.6.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d223b13fd481fc0d1f83bb12659ae774d9e3601814c68a0bc539731698cca743" +checksum = "4eb9843d84c775696c37d9a418bbb01b932629d01870722c0f13eb3f95e2536d" dependencies = [ "actix-codec", "actix-rt", @@ -46,8 +46,8 @@ dependencies = [ "actix-tls", "actix-utils", "ahash", - "base64", - "bitflags 2.4.2", + "base64 0.22.1", + "bitflags 2.5.0", "brotli", "bytes", "bytestring", @@ -81,18 +81,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.52", + "syn 2.0.66", ] [[package]] name = "actix-router" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22475596539443685426b6bdadb926ad0ecaefdfc5fb05e5e3441f15463c511" +checksum = "13d324164c51f63867b57e73ba5936ea151b8a41a1d23d1031eeb9f70d0236f8" dependencies = [ "bytestring", + "cfg-if", "http 0.2.12", "regex", + "regex-lite", "serde", "tracing", ] @@ -137,9 +139,9 @@ dependencies = [ [[package]] name = "actix-tls" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4cce60a2f2b477bc72e5cde0af1812a6e82d8fd85b5570a5dcf2a5bf2c5be5f" +checksum = "ac453898d866cdbecdbc2334fe1738c747b4eba14a677261f2b768ba05329389" dependencies = [ "actix-rt", "actix-service", @@ -168,9 +170,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.5.1" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a6556ddebb638c2358714d853257ed226ece6023ef9364f23f0c70737ea984" +checksum = "b1cf67dadb19d7c95e5a299e2dda24193b89d5d4f33a3b9800888ede9e19aa32" dependencies = [ "actix-codec", "actix-http", @@ -198,6 +200,7 @@ dependencies = [ "once_cell", "pin-project-lite", "regex", + "regex-lite", "serde", "serde_json", "serde_urlencoded", @@ -216,7 +219,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.66", ] [[package]] @@ -249,9 +252,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -299,13 +302,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.66", ] [[package]] @@ -321,15 +324,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "awc" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68c09cc97310b926f01621faee652f3d1b0962545a3cec6c9ac07def9ea36c2c" +checksum = "fe6b67e44fb95d1dc9467e3930383e115f9b4ed60ca689db41409284e967a12d" dependencies = [ "actix-codec", "actix-http", @@ -337,7 +340,7 @@ dependencies = [ "actix-service", "actix-tls", "actix-utils", - "base64", + "base64 0.22.1", "bytes", "cfg-if", "cookie", @@ -361,9 +364,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -380,6 +383,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64ct" version = "1.6.0" @@ -394,9 +403,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "blake2" @@ -418,9 +427,9 @@ dependencies = [ [[package]] name = "brotli" -version = "3.4.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" +checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -429,9 +438,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.5.1" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" +checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -439,9 +448,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.15.4" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byteorder" @@ -451,9 +460,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "bytestring" @@ -466,12 +475,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.90" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" +checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" dependencies = [ "jobserver", "libc", + "once_cell", ] [[package]] @@ -482,9 +492,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.35" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", @@ -492,7 +502,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -529,18 +539,18 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crypto-common" @@ -580,9 +590,9 @@ dependencies = [ [[package]] name = "deadpool-runtime" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63dfa964fe2a66f3fde91fc70b267fe193d822c7e603e2a675a49a7f46ad3f49" +checksum = "092966b41edc516079bdf31ec78a2e0588d1d0c08f78b91d8307215928642b2b" [[package]] name = "deranged" @@ -608,11 +618,11 @@ dependencies = [ [[package]] name = "diesel" -version = "2.1.4" +version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62c6fcf842f17f8c78ecf7c81d75c5ce84436b41ee07e03f490fbb5f5a8731d8" +checksum = "ff236accb9a5069572099f0b350a92e9560e8e63a9b8d546162f4a5e03026bb2" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "byteorder", "chrono", "diesel_derives", @@ -637,14 +647,14 @@ dependencies = [ [[package]] name = "diesel_derives" -version = "2.1.2" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8337737574f55a468005a83499da720f20c65586241ffea339db9ecdfd2b44" +checksum = "14701062d6bed917b5c7103bdffaee1e4609279e240488ad24e7bd979ca6866c" dependencies = [ "diesel_table_macro_syntax", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.66", ] [[package]] @@ -653,7 +663,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" dependencies = [ - "syn 2.0.52", + "syn 2.0.66", ] [[package]] @@ -675,15 +685,15 @@ checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] name = "either" -version = "1.10.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" [[package]] name = "encoding_rs" -version = "0.8.33" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ "cfg-if", ] @@ -713,17 +723,11 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" -[[package]] -name = "finl_unicode" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" - [[package]] name = "flate2" -version = "1.0.28" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", "miniz_oxide", @@ -800,7 +804,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.66", ] [[package]] @@ -851,9 +855,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -888,9 +892,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", @@ -907,9 +911,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "hermit-abi" @@ -1016,9 +1020,9 @@ checksum = "206ca75c9c03ba3d4ace2460e57b189f39f43de612c2f85836e65c929701bb2d" [[package]] name = "indexmap" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown", @@ -1035,15 +1039,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.28" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ "libc", ] @@ -1065,9 +1069,9 @@ checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "local-channel" @@ -1088,9 +1092,9 @@ checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -1114,9 +1118,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "mime" @@ -1126,9 +1130,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" dependencies = [ "adler", ] @@ -1165,9 +1169,9 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -1199,9 +1203,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -1209,15 +1213,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.5.1", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] @@ -1233,9 +1237,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "percent-encoding" @@ -1278,14 +1282,14 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.66", ] [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -1311,7 +1315,7 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49b6c5ef183cd3ab4ba005f1ca64c21e8bd97ce4699cfea9e8d9a2c4958ca520" dependencies = [ - "base64", + "base64 0.21.7", "byteorder", "bytes", "fallible-iterator", @@ -1348,18 +1352,18 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6" dependencies = [ "unicode-ident", ] [[package]] name = "quanta" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca0b7bac0b97248c40bb77288fc52029cf1459c0461ea1b05ee32ccf011de2c" +checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" dependencies = [ "crossbeam-utils", "libc", @@ -1372,9 +1376,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -1411,11 +1415,11 @@ dependencies = [ [[package]] name = "raw-cpuid" -version = "11.0.1" +version = "11.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d86a7c4638d42c44551f4791a20e687dbb4c3de1f33c43dd71e355cd429def1" +checksum = "e29830cbb1290e404f24c73af91c5d8d631ce7e128691e9477556b540cd01ecd" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", ] [[package]] @@ -1427,11 +1431,20 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +dependencies = [ + "bitflags 2.5.0", +] + [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -1450,11 +1463,17 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "regex-lite" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b661b2f27137bdbc16f00eda72866a92bb28af1753ffbd56744fb6e2e9cd8e" + [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "retain_mut" @@ -1494,9 +1513,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc_version" @@ -1521,9 +1540,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "scoped-futures" @@ -1553,35 +1572,35 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.66", ] [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -1624,9 +1643,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] @@ -1648,15 +1667,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", "windows-sys 0.52.0", @@ -1685,13 +1704,13 @@ dependencies = [ [[package]] name = "stringprep" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" dependencies = [ - "finl_unicode", "unicode-bidi", "unicode-normalization", + "unicode-properties", ] [[package]] @@ -1713,9 +1732,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.52" +version = "2.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" dependencies = [ "proc-macro2", "quote", @@ -1765,29 +1784,29 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.58" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.58" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.66", ] [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -1806,9 +1825,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", @@ -1831,9 +1850,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.36.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -1885,16 +1904,15 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] @@ -1938,7 +1956,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.66", ] [[package]] @@ -1977,6 +1995,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-properties" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4259d9d4425d9f0661581b804cb85fe66a4c631cadd8f490d1c13a35d5d9291" + [[package]] name = "untrusted" version = "0.7.1" @@ -2002,9 +2026,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom", ] @@ -2048,7 +2072,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.66", "wasm-bindgen-shared", ] @@ -2070,7 +2094,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.66", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2116,7 +2140,7 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" dependencies = [ - "redox_syscall", + "redox_syscall 0.4.1", "wasite", "web-sys", ] @@ -2139,11 +2163,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -2158,7 +2182,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -2176,7 +2200,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -2196,17 +2220,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.4", - "windows_aarch64_msvc 0.52.4", - "windows_i686_gnu 0.52.4", - "windows_i686_msvc 0.52.4", - "windows_x86_64_gnu 0.52.4", - "windows_x86_64_gnullvm 0.52.4", - "windows_x86_64_msvc 0.52.4", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -2217,9 +2242,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -2229,9 +2254,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -2241,9 +2266,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.4" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -2253,9 +2284,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -2265,9 +2296,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -2277,9 +2308,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -2289,53 +2320,53 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.66", ] [[package]] name = "zstd" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" +checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "7.0.0" +version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" +checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a" dependencies = [ "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" +version = "2.0.10+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" dependencies = [ "cc", "pkg-config", From c5ff78e1603e01a13b4f0583636602fcbc8efbee Mon Sep 17 00:00:00 2001 From: DrVilepis Date: Tue, 28 May 2024 12:01:43 +0300 Subject: [PATCH 09/11] transition from nightly to beta --- rustfmt.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/rustfmt.toml b/rustfmt.toml index 4853316..3a26366 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,4 +1 @@ edition = "2021" -imports_granularity = "Crate" -group_imports = "StdExternalCrate" -unstable_features = true From 3d2e127a503e50080f61095051de5639be669f4f Mon Sep 17 00:00:00 2001 From: DrVilepis Date: Tue, 28 May 2024 12:03:49 +0300 Subject: [PATCH 10/11] remove LazyLock and remove clones --- Cargo.toml | 2 +- src/api/activity.rs | 6 ++---- src/api/auth.rs | 12 +++++------- src/api/friends.rs | 2 +- src/api/leaderboards.rs | 34 +++++++++++++++------------------- src/api/mod.rs | 7 +++---- src/api/oauth.rs | 25 +++++++++++-------------- src/api/users.rs | 12 ++++++------ src/database/activity.rs | 25 ++++++++----------------- src/database/auth.rs | 9 +++------ src/database/friends.rs | 3 +-- src/database/leaderboards.rs | 13 ++++++------- src/main.rs | 9 ++++++--- src/requests.rs | 5 ----- 14 files changed, 68 insertions(+), 96 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8281062..4d14f8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,5 +42,5 @@ url = "2.2" itertools = "0.10.3" governor = "0.6.0" -diesel = { version = "2.1.0", features = ["chrono", "serde_json"] } +diesel = { version = "2.1.0", features = ["chrono", "serde_json", "postgres_backend"] } diesel-async = { version = "0.4.1", features = ["postgres", "deadpool"] } diff --git a/src/api/activity.rs b/src/api/activity.rs index 1791e0c..779217b 100644 --- a/src/api/activity.rs +++ b/src/api/activity.rs @@ -173,9 +173,7 @@ pub async fn rename_project( db: DatabaseWrapper, body: Json, ) -> Result { - let renamed = db - .rename_project(user.id, body.from.clone(), body.to.clone()) - .await?; + let renamed = db.rename_project(user.id, &body.from, &body.to).await?; Ok(web::Json(json!({ "affected_activities": renamed }))) } @@ -187,7 +185,7 @@ pub async fn hide_project( body: Json, ) -> Result { let renamed = db - .set_project_hidden(user.id, body.target_project.clone(), body.hidden.clone()) + .set_project_hidden(user.id, &body.target_project, body.hidden) .await?; Ok(web::Json(json!({ "affected_activities": renamed }))) diff --git a/src/api/auth.rs b/src/api/auth.rs index f0c4153..eaa8a89 100644 --- a/src/api/auth.rs +++ b/src/api/auth.rs @@ -158,12 +158,11 @@ pub async fn register( "Password has to be between 8 and 128 characters long".to_string(), )); } - if !super::VALID_NAME_REGEX.is_match(&data.username) { + if !super::REGEX.with(|r| r.is_match(&data.username)) { return Err(TimeError::BadUsername); } - let username = data.username.clone(); - if db.get_user_by_name(username).await.is_ok() { + if db.get_user_by_name(&data.username).await.is_ok() { return Err(TimeError::UserExists); } @@ -206,17 +205,16 @@ pub async fn changeusername( "Username is not between 2 and 32 chars".to_string(), )); } - if !super::VALID_NAME_REGEX.is_match(&data.new) { + if !super::REGEX.with(|r| r.is_match(&data.new)) { return Err(TimeError::BadUsername); } - let username = data.new.clone(); - if db.get_user_by_name(username).await.is_ok() { + if db.get_user_by_name(&data.new).await.is_ok() { return Err(TimeError::UserExists); } let user = db.get_user_by_id(user.identity.id).await?; - db.change_username(user.id, data.new.clone()).await?; + db.change_username(user.id, &data.new).await?; Ok(HttpResponse::Ok().finish()) } diff --git a/src/api/friends.rs b/src/api/friends.rs index c582de4..b5f888b 100644 --- a/src/api/friends.rs +++ b/src/api/friends.rs @@ -106,7 +106,7 @@ pub async fn remove( db: DatabaseWrapper, body: String, ) -> Result { - let friend = db.get_user_by_name(body.clone()).await?; + let friend = db.get_user_by_name(&body).await?; let deleted = db.remove_friend(user.identity.id, friend.id).await?; if deleted { diff --git a/src/api/leaderboards.rs b/src/api/leaderboards.rs index 2a3a0d9..39d03f3 100644 --- a/src/api/leaderboards.rs +++ b/src/api/leaderboards.rs @@ -31,12 +31,11 @@ pub async fn create_leaderboard( body: Json, db: DatabaseWrapper, ) -> Result { - if !super::VALID_NAME_REGEX.is_match(&body.name) { + if !super::REGEX.with(|r| r.is_match(&body.name)) { return Err(TimeError::BadLeaderboardName); } - let lname = body.name.clone(); - if db.get_leaderboard_id_by_name(lname).await.is_ok() { + if db.get_leaderboard_id_by_name(&body.name).await.is_ok() { return Err(TimeError::LeaderboardExists); } @@ -62,12 +61,12 @@ pub async fn get_leaderboard( db: DatabaseWrapper, ) -> Result { let lid = db - .get_leaderboard_id_by_name(path.0.clone()) + .get_leaderboard_id_by_name(&path.0) .await .map_err(|_| TimeError::LeaderboardNotFound)?; if db.is_leaderboard_member(user.id, lid).await? { - let board = db.get_leaderboard(path.0.clone()).await?; + let board = db.get_leaderboard(&path.0).await?; Ok(web::Json(board)) } else { Err(TimeError::Unauthorized) @@ -81,12 +80,12 @@ pub async fn delete_leaderboard( db: DatabaseWrapper, ) -> Result { let lid = db - .get_leaderboard_id_by_name(path.0.clone()) + .get_leaderboard_id_by_name(&path.0) .await .map_err(|_| TimeError::LeaderboardNotFound)?; if db.is_leaderboard_admin(user.identity.id, lid).await? { - db.delete_leaderboard(path.0.clone()).await?; + db.delete_leaderboard(&path.0).await?; Ok(HttpResponse::Ok().finish()) } else { Err(TimeError::Unauthorized) @@ -100,10 +99,7 @@ pub async fn join_leaderboard( db: DatabaseWrapper, ) -> Result { match db - .add_user_to_leaderboard( - user.id, - body.invite.trim().trim_start_matches("ttlic_").to_string(), - ) + .add_user_to_leaderboard(user.id, body.invite.trim().trim_start_matches("ttlic_")) .await { Err(e) => { @@ -130,7 +126,7 @@ pub async fn leave_leaderboard( db: DatabaseWrapper, ) -> Result { let lid = db - .get_leaderboard_id_by_name(path.0.clone()) + .get_leaderboard_id_by_name(&path.0) .await .map_err(|_| TimeError::LeaderboardNotFound)?; @@ -158,13 +154,13 @@ pub async fn promote_member( promotion: Json, ) -> Result { let lid = db - .get_leaderboard_id_by_name(path.0.clone()) + .get_leaderboard_id_by_name(&path.0) .await .map_err(|_| TimeError::LeaderboardNotFound)?; if db.is_leaderboard_admin(user.identity.id, lid).await? { let newadmin = db - .get_user_by_name(promotion.user.clone()) + .get_user_by_name(&promotion.user) .await .map_err(|_| TimeError::UserNotFound)?; @@ -190,13 +186,13 @@ pub async fn demote_member( demotion: Json, ) -> Result { let lid = db - .get_leaderboard_id_by_name(path.0.clone()) + .get_leaderboard_id_by_name(&path.0) .await .map_err(|_| TimeError::LeaderboardNotFound)?; if db.is_leaderboard_admin(user.identity.id, lid).await? { let oldadmin = db - .get_user_by_name(demotion.user.clone()) + .get_user_by_name(&demotion.user) .await .map_err(|_| TimeError::UserNotFound)?; @@ -222,13 +218,13 @@ pub async fn kick_member( kick: Json, ) -> Result { let lid = db - .get_leaderboard_id_by_name(path.0.clone()) + .get_leaderboard_id_by_name(&path.0) .await .map_err(|_| TimeError::LeaderboardNotFound)?; if db.is_leaderboard_admin(user.identity.id, lid).await? { let kmember = db - .get_user_by_name(kick.user.clone()) + .get_user_by_name(&kick.user) .await .map_err(|_| TimeError::UserNotFound)?; @@ -248,7 +244,7 @@ pub async fn regenerate_invite( db: DatabaseWrapper, ) -> Result { let lid = db - .get_leaderboard_id_by_name(path.0.clone()) + .get_leaderboard_id_by_name(&path.0) .await .map_err(|_| TimeError::LeaderboardNotFound)?; diff --git a/src/api/mod.rs b/src/api/mod.rs index de3c261..afd13ed 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1,5 +1,3 @@ -use std::sync::LazyLock; - use actix_web::{HttpResponse, Responder}; use regex::Regex; @@ -14,8 +12,9 @@ pub mod search; pub mod stats; pub mod users; -static VALID_NAME_REGEX: LazyLock = - LazyLock::new(|| Regex::new("^[[:word:]]{2,32}$").unwrap()); +thread_local! { + pub static REGEX: Regex = Regex::new("^[[:word:]]{2,32}$").unwrap(); +} #[get("/health")] async fn health() -> impl Responder { diff --git a/src/api/oauth.rs b/src/api/oauth.rs index 58ae93a..d9d9a90 100644 --- a/src/api/oauth.rs +++ b/src/api/oauth.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, sync::LazyLock}; +use std::collections::HashMap; use actix_web::{ cookie::Cookie, @@ -21,13 +21,14 @@ struct TokenResponse { token: String, } -#[derive(Deserialize)] -struct ClientInfo { +#[cfg(feature = "testausid")] +#[derive(Debug, Deserialize, Clone)] +pub struct ClientInfo { #[serde(rename = "client_id")] - id: String, + pub id: String, #[serde(rename = "client_secret")] - secret: String, - redirect_uri: String, + pub secret: String, + pub redirect_uri: String, } #[derive(Deserialize, Debug)] @@ -42,15 +43,11 @@ struct TestausIdPlatformInfo { id: String, } -static CLIENT_INFO: LazyLock = LazyLock::new(|| { - toml::from_str(&std::fs::read_to_string("settings.toml").expect("Missing settings.toml")) - .expect("Invalid Toml in settings.toml") -}); - #[get("/auth/callback")] async fn callback( request: Query, client: Data, + oauth_client: Data, db: DatabaseWrapper, ) -> Result { if request.code.chars().any(|c| !c.is_alphanumeric()) { @@ -62,9 +59,9 @@ async fn callback( .insert_header(("content-type", "application/x-www-form-urlencoded")) .send_form(&HashMap::from([ ("code", &request.code), - ("redirect_uri", &CLIENT_INFO.redirect_uri), - ("client_id", &CLIENT_INFO.id), - ("client_secret", &CLIENT_INFO.secret), + ("redirect_uri", &oauth_client.redirect_uri), + ("client_id", &oauth_client.id), + ("client_secret", &oauth_client.secret), ])) .await .unwrap() diff --git a/src/api/users.rs b/src/api/users.rs index eb34613..5ee5e03 100644 --- a/src/api/users.rs +++ b/src/api/users.rs @@ -79,7 +79,7 @@ pub async fn get_current_activity( user.id } else { let target_user = db - .get_user_by_name(path.0.clone()) + .get_user_by_name(&path.0) .await .map_err(|_| TimeError::UserNotFound)?; @@ -95,7 +95,7 @@ pub async fn get_current_activity( } } else { let target_user = db - .get_user_by_name(path.0.clone()) + .get_user_by_name(&path.0) .await .map_err(|_| TimeError::UserNotFound)?; @@ -145,7 +145,7 @@ pub async fn get_activities( ) -> Result { let Some(user) = opt_user.identity else { let target_user = db - .get_user_by_name(path.0.clone()) + .get_user_by_name(&path.0) .await .map_err(|_| TimeError::UserNotFound)?; @@ -164,7 +164,7 @@ pub async fn get_activities( //FIXME: This is technically not required when the username equals the username of the //authenticated user let target_user = db - .get_user_by_name(path.0.clone()) + .get_user_by_name(&path.0) .await .map_err(|_| TimeError::UserNotFound)?; @@ -193,7 +193,7 @@ pub async fn get_activity_summary( db.get_all_activity(user.id).await? } else { let target_user = db - .get_user_by_name(path.0.clone()) + .get_user_by_name(&path.0) .await .map_err(|_| TimeError::UserNotFound)?; @@ -208,7 +208,7 @@ pub async fn get_activity_summary( } } else { let target_user = db - .get_user_by_name(path.0.clone()) + .get_user_by_name(&path.0) .await .map_err(|_| TimeError::UserNotFound)?; diff --git a/src/database/activity.rs b/src/database/activity.rs index e2e647a..51c5b65 100644 --- a/src/database/activity.rs +++ b/src/database/activity.rs @@ -98,14 +98,14 @@ impl super::DatabaseWrapper { pub async fn get_user_coding_time_since( &self, uid: i32, - since: chrono::NaiveDateTime, + since: chrono::DateTime, ) -> Result { let mut conn = self.db.get().await?; use crate::schema::coding_activities::dsl::*; Ok(coding_activities - .filter(user_id.eq(uid).and(start_time.ge(since))) + .filter(user_id.eq(uid).and(start_time.ge(since.naive_local()))) .select(diesel::dsl::sum(duration)) .first::>(&mut conn) .await? @@ -115,24 +115,15 @@ impl super::DatabaseWrapper { pub async fn get_coding_time_steps(&self, uid: i32) -> CodingTimeSteps { CodingTimeSteps { all_time: self - .get_user_coding_time_since( - uid, - chrono::NaiveDateTime::from_timestamp_opt(0, 0).unwrap(), - ) + .get_user_coding_time_since(uid, chrono::DateTime::default()) .await .unwrap_or(0), past_month: self - .get_user_coding_time_since( - uid, - chrono::Local::now().naive_local() - chrono::Duration::days(30), - ) + .get_user_coding_time_since(uid, chrono::Local::now() - chrono::Duration::days(30)) .await .unwrap_or(0), past_week: self - .get_user_coding_time_since( - uid, - chrono::Local::now().naive_local() - chrono::Duration::days(7), - ) + .get_user_coding_time_since(uid, chrono::Local::now() - chrono::Duration::days(7)) .await .unwrap_or(0), } @@ -141,8 +132,8 @@ impl super::DatabaseWrapper { pub async fn rename_project( &self, target_user_id: i32, - from: String, - to: String, + from: &str, + to: &str, ) -> Result { let mut conn = self.db.get().await?; @@ -158,7 +149,7 @@ impl super::DatabaseWrapper { pub async fn set_project_hidden( &self, target_user_id: i32, - target_project: String, + target_project: &str, to: bool, ) -> Result { let mut conn = self.db.get().await?; diff --git a/src/database/auth.rs b/src/database/auth.rs index 3049d7f..8a4d185 100644 --- a/src/database/auth.rs +++ b/src/database/auth.rs @@ -25,10 +25,7 @@ impl super::DatabaseWrapper { .is_some()) } - pub async fn get_user_by_name( - &self, - target_username: String, - ) -> Result { + pub async fn get_user_by_name(&self, target_username: &str) -> Result { let mut conn = self.db.get().await?; use crate::schema::user_identities::dsl::*; sql_function!(fn lower(x: diesel::sql_types::Text) -> Text); @@ -158,7 +155,7 @@ impl super::DatabaseWrapper { Ok(new_user) } - pub async fn change_username(&self, user: i32, new_username: String) -> Result<(), TimeError> { + pub async fn change_username(&self, user: i32, new_username: &str) -> Result<(), TimeError> { let mut conn = self.db.get().await?; conn.build_transaction() @@ -168,7 +165,7 @@ impl super::DatabaseWrapper { use crate::schema::user_identities::dsl::*; if (user_identities - .filter(username.eq(new_username.clone())) + .filter(username.eq(new_username)) .first::(&mut conn) .await) .is_ok() diff --git a/src/database/friends.rs b/src/database/friends.rs index 119f460..4c81205 100644 --- a/src/database/friends.rs +++ b/src/database/friends.rs @@ -159,12 +159,11 @@ impl super::DatabaseWrapper { pub async fn regenerate_friend_code(&self, userid: i32) -> Result { use crate::schema::user_identities::dsl::*; let code = crate::utils::generate_friend_code(); - let code_clone = code.clone(); let mut conn = self.db.get().await?; diesel::update(user_identities.find(userid)) - .set(friend_code.eq(code_clone)) + .set(friend_code.eq(&code)) .execute(&mut conn) .await?; diff --git a/src/database/leaderboards.rs b/src/database/leaderboards.rs index 6ff5151..5501686 100644 --- a/src/database/leaderboards.rs +++ b/src/database/leaderboards.rs @@ -23,6 +23,7 @@ impl super::DatabaseWrapper { name: &str, ) -> Result { let code = crate::utils::generate_token(); + let board = NewLeaderboard { name: name.to_string(), creation_time: chrono::Local::now().naive_local(), @@ -65,20 +66,18 @@ impl super::DatabaseWrapper { pub async fn regenerate_leaderboard_invite(&self, lid: i32) -> Result { let newinvite = crate::utils::generate_token(); - let newinvite_clone = newinvite.clone(); - let mut conn = self.db.get().await?; use crate::schema::leaderboards::dsl::*; diesel::update(leaderboards.find(lid)) - .set(invite_code.eq(newinvite_clone)) + .set(invite_code.eq(&newinvite)) .execute(&mut conn) .await?; Ok(newinvite) } - pub async fn delete_leaderboard(&self, lname: String) -> Result { + pub async fn delete_leaderboard(&self, lname: &str) -> Result { let mut conn = self.db.get().await?; use crate::schema::leaderboards::dsl::*; @@ -89,7 +88,7 @@ impl super::DatabaseWrapper { != 0) } - pub async fn get_leaderboard_id_by_name(&self, lname: String) -> Result { + pub async fn get_leaderboard_id_by_name(&self, lname: &str) -> Result { sql_function!(fn lower(x: diesel::sql_types::Text) -> Text); use crate::schema::leaderboards::dsl::*; @@ -102,7 +101,7 @@ impl super::DatabaseWrapper { .await?) } - pub async fn get_leaderboard(&self, lname: String) -> Result { + pub async fn get_leaderboard(&self, lname: &str) -> Result { sql_function!(fn lower(x: diesel::sql_types::Text) -> Text); let mut conn = self.db.get().await?; @@ -157,7 +156,7 @@ impl super::DatabaseWrapper { pub async fn add_user_to_leaderboard( &self, uid: i32, - invite: String, + invite: &str, ) -> Result { use crate::schema::leaderboards::dsl::{invite_code, leaderboards}; diff --git a/src/main.rs b/src/main.rs index 22bcaf6..69643d4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,3 @@ -#![feature(lazy_cell, addr_parse_ascii, async_closure)] - mod api; mod auth; mod database; @@ -23,8 +21,9 @@ use actix_web::{ web::{Data, QueryConfig}, App, HttpMessage, HttpServer, }; -use auth::{secured_access::SecuredAccessTokenStorage, AuthMiddleware, Authentication}; #[cfg(feature = "testausid")] +use api::oauth::ClientInfo; +use auth::{secured_access::SecuredAccessTokenStorage, AuthMiddleware, Authentication}; use awc::Client; use chrono::NaiveDateTime; use dashmap::DashMap; @@ -55,6 +54,9 @@ pub struct TimeConfig { pub address: String, pub database_url: String, pub allowed_origin: String, + #[cfg(feature = "testausid")] + #[serde(flatten)] + pub oauth_client_info: ClientInfo, } pub struct TestaustimeRootSpanBuilder; @@ -187,6 +189,7 @@ async fn main() -> std::io::Result<()> { #[cfg(feature = "testausid")] { app.app_data(Data::new(client)) + .app_data(Data::new(config.oauth_client_info.clone())) } #[cfg(not(feature = "testausid"))] { diff --git a/src/requests.rs b/src/requests.rs index 74d3f47..161d41f 100644 --- a/src/requests.rs +++ b/src/requests.rs @@ -56,8 +56,3 @@ pub struct PasswordChangeRequest { pub old: String, pub new: String, } - -#[derive(Deserialize, Debug)] -pub struct FriendRequest { - pub code: String, -} From 5b0dcf5b7514a69bc685dd66773c6449def82161 Mon Sep 17 00:00:00 2001 From: DrVilepis Date: Tue, 28 May 2024 12:25:18 +0300 Subject: [PATCH 11/11] trailing newlines --- migrations/2024-03-12-174132_serverside_hidden/down.sql | 2 +- migrations/2024-03-12-174132_serverside_hidden/up.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/migrations/2024-03-12-174132_serverside_hidden/down.sql b/migrations/2024-03-12-174132_serverside_hidden/down.sql index b8fb975..baf78c9 100644 --- a/migrations/2024-03-12-174132_serverside_hidden/down.sql +++ b/migrations/2024-03-12-174132_serverside_hidden/down.sql @@ -1,2 +1,2 @@ -- This file should undo anything in `up.sql` -ALTER TABLE "coding_activities" DROP COLUMN "hidden"; \ No newline at end of file +ALTER TABLE "coding_activities" DROP COLUMN "hidden"; diff --git a/migrations/2024-03-12-174132_serverside_hidden/up.sql b/migrations/2024-03-12-174132_serverside_hidden/up.sql index fc443b0..f8a9c19 100644 --- a/migrations/2024-03-12-174132_serverside_hidden/up.sql +++ b/migrations/2024-03-12-174132_serverside_hidden/up.sql @@ -1,4 +1,4 @@ -- Your SQL goes here ALTER TABLE "coding_activities" ADD COLUMN "hidden" BOOL; UPDATE "coding_activities" SET "hidden" = false WHERE hidden IS NULL; -ALTER TABLE "coding_activities" ALTER COLUMN hidden SET NOT NULL; \ No newline at end of file +ALTER TABLE "coding_activities" ALTER COLUMN hidden SET NOT NULL;