update dependencies

This commit is contained in:
jude 2022-04-19 15:23:27 +01:00
parent 4c4f0927f1
commit ded750aa2d
13 changed files with 325 additions and 326 deletions

231
Cargo.lock generated
View File

@ -135,7 +135,7 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c"
dependencies = [ dependencies = [
"autocfg 1.1.0", "autocfg",
] ]
[[package]] [[package]]
@ -149,15 +149,6 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "autocfg"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78"
dependencies = [
"autocfg 1.1.0",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
@ -172,9 +163,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]] [[package]]
name = "base64ct" name = "base64ct"
version = "1.1.1" version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6b4d9b1225d28d360ec6a231d65af1fd99a2a095154c8040689617290569c5c" checksum = "dea908e7347a8c64e378c17e30ef880ad73e3b4498346b055c2c00ea342f3179"
[[package]] [[package]]
name = "bigdecimal" name = "bigdecimal"
@ -347,9 +338,9 @@ dependencies = [
[[package]] [[package]]
name = "const-oid" name = "const-oid"
version = "0.6.2" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d6f2aa4d0537bcc1c74df8755072bd31c1ef1a3a1b85a68e8404a8c353b7b8b" checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3"
[[package]] [[package]]
name = "cookie" name = "cookie"
@ -440,12 +431,11 @@ dependencies = [
[[package]] [[package]]
name = "crypto-bigint" name = "crypto-bigint"
version = "0.2.11" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f83bd3bb4314701c568e340cd8cf78c975aa0ca79e03d3f6d1677d5b0c9c0c03" checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21"
dependencies = [ dependencies = [
"generic-array 0.14.5", "generic-array 0.14.5",
"rand_core 0.6.3",
"subtle", "subtle",
] ]
@ -517,12 +507,13 @@ dependencies = [
[[package]] [[package]]
name = "der" name = "der"
version = "0.4.5" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79b71cca7d95d7681a4b3b9cdf63c8dbc3730d0584c2c74e31416d64a90493f4" checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c"
dependencies = [ dependencies = [
"const-oid", "const-oid",
"crypto-bigint", "crypto-bigint",
"pem-rfc7468",
] ]
[[package]] [[package]]
@ -638,6 +629,12 @@ dependencies = [
"termcolor", "termcolor",
] ]
[[package]]
name = "event-listener"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71"
[[package]] [[package]]
name = "fake-simd" name = "fake-simd"
version = "0.1.2" version = "0.1.2"
@ -669,9 +666,9 @@ dependencies = [
[[package]] [[package]]
name = "filetime" name = "filetime"
version = "0.2.15" version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98" checksum = "c0408e2626025178a6a7f7ffc05a25bc47103229f19c113755de7bf63816290c"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
@ -681,9 +678,9 @@ dependencies = [
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.22" version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"crc32fast", "crc32fast",
@ -968,9 +965,9 @@ dependencies = [
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.3.3" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
dependencies = [ dependencies = [
"unicode-segmentation", "unicode-segmentation",
] ]
@ -1032,9 +1029,9 @@ dependencies = [
[[package]] [[package]]
name = "httparse" name = "httparse"
version = "1.6.0" version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4" checksum = "6330e8a36bd8c859f3fa6d9382911fbb7147ec39807f63b923933a247240b9ba"
[[package]] [[package]]
name = "httpdate" name = "httpdate"
@ -1145,7 +1142,7 @@ version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee"
dependencies = [ dependencies = [
"autocfg 1.1.0", "autocfg",
"hashbrown", "hashbrown",
"serde", "serde",
] ]
@ -1196,9 +1193,9 @@ dependencies = [
[[package]] [[package]]
name = "ipnet" name = "ipnet"
version = "2.4.0" version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35e70ee094dc02fd9c13fdad4940090f22dbd6ac7c9e7094a46cf0232a50bc7c" checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b"
[[package]] [[package]]
name = "itertools" name = "itertools"
@ -1257,9 +1254,9 @@ checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.122" version = "0.2.124"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec647867e2bf0772e28c8bcde4f0d19a9216916e890543b5a03ed8ef27b8f259" checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50"
[[package]] [[package]]
name = "libm" name = "libm"
@ -1273,7 +1270,7 @@ version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53"
dependencies = [ dependencies = [
"autocfg 1.1.0", "autocfg",
"scopeguard", "scopeguard",
] ]
@ -1352,12 +1349,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.4.4" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082"
dependencies = [ dependencies = [
"adler", "adler",
"autocfg 1.1.0",
] ]
[[package]] [[package]]
@ -1440,7 +1436,7 @@ dependencies = [
"log", "log",
"memchr", "memchr",
"mime", "mime",
"spin 0.9.2", "spin 0.9.3",
"tokio", "tokio",
"tokio-util 0.6.9", "tokio-util 0.6.9",
"version_check", "version_check",
@ -1527,18 +1523,17 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3"
dependencies = [ dependencies = [
"autocfg 1.1.0", "autocfg",
"num-integer", "num-integer",
"num-traits", "num-traits",
] ]
[[package]] [[package]]
name = "num-bigint-dig" name = "num-bigint-dig"
version = "0.7.0" version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4547ee5541c18742396ae2c895d0717d0f886d8823b8399cdaf7b07d63ad0480" checksum = "566d173b2f9406afbc5510a90925d5a2cd80cae4605631f1212303df265de011"
dependencies = [ dependencies = [
"autocfg 0.1.8",
"byteorder", "byteorder",
"lazy_static", "lazy_static",
"libm", "libm",
@ -1556,7 +1551,7 @@ version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
dependencies = [ dependencies = [
"autocfg 1.1.0", "autocfg",
"num-traits", "num-traits",
] ]
@ -1566,7 +1561,7 @@ version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59"
dependencies = [ dependencies = [
"autocfg 1.1.0", "autocfg",
"num-integer", "num-integer",
"num-traits", "num-traits",
] ]
@ -1577,7 +1572,7 @@ version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
dependencies = [ dependencies = [
"autocfg 1.1.0", "autocfg",
"libm", "libm",
] ]
@ -1664,7 +1659,7 @@ version = "0.9.72"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb"
dependencies = [ dependencies = [
"autocfg 1.1.0", "autocfg",
"cc", "cc",
"libc", "libc",
"pkg-config", "pkg-config",
@ -1768,9 +1763,9 @@ dependencies = [
[[package]] [[package]]
name = "pem-rfc7468" name = "pem-rfc7468"
version = "0.2.4" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84e93a3b1cc0510b03020f33f21e62acdde3dcaef432edc95bea377fbd4c2cd4" checksum = "01de5d978f34aa4b2296576379fcc416034702fd94117c56ffd8a1a767cefb30"
dependencies = [ dependencies = [
"base64ct", "base64ct",
] ]
@ -1877,24 +1872,22 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]] [[package]]
name = "pkcs1" name = "pkcs1"
version = "0.2.4" version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "116bee8279d783c0cf370efa1a94632f2108e5ef0bb32df31f051647810a4e2c" checksum = "a78f66c04ccc83dd4486fd46c33896f4e17b24a7a3a6400dedc48ed0ddd72320"
dependencies = [ dependencies = [
"der", "der",
"pem-rfc7468", "pkcs8",
"zeroize", "zeroize",
] ]
[[package]] [[package]]
name = "pkcs8" name = "pkcs8"
version = "0.7.6" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee3ef9b64d26bad0536099c816c6734379e45bbd5f14798def6809e5cc350447" checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0"
dependencies = [ dependencies = [
"der", "der",
"pem-rfc7468",
"pkcs1",
"spki", "spki",
"zeroize", "zeroize",
] ]
@ -1908,7 +1901,7 @@ checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
[[package]] [[package]]
name = "poise" name = "poise"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/kangalioo/poise?branch=develop#040003164dbb39cc0bad83b21a551dc2f8f2b059" source = "git+https://github.com/kangalioo/poise?branch=master#0f526b77e5e354fa2a7d2a3fb6bdfac5bf0fb226"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"derivative", "derivative",
@ -1925,7 +1918,7 @@ dependencies = [
[[package]] [[package]]
name = "poise_macros" name = "poise_macros"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/kangalioo/poise?branch=develop#040003164dbb39cc0bad83b21a551dc2f8f2b059" source = "git+https://github.com/kangalioo/poise?branch=master#0f526b77e5e354fa2a7d2a3fb6bdfac5bf0fb226"
dependencies = [ dependencies = [
"darling", "darling",
"proc-macro2", "proc-macro2",
@ -1993,9 +1986,9 @@ dependencies = [
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.17" version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -2242,12 +2235,13 @@ dependencies = [
[[package]] [[package]]
name = "rmp" name = "rmp"
version = "0.8.10" version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f55e5fa1446c4d5dd1f5daeed2a4fe193071771a2636274d0d7a3b082aa7ad6" checksum = "44519172358fd6d58656c86ab8e7fbc9e1490c3e8f14d35ed78ca0dd07403c9f"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"num-traits", "num-traits",
"paste",
] ]
[[package]] [[package]]
@ -2264,7 +2258,7 @@ dependencies = [
[[package]] [[package]]
name = "rocket" name = "rocket"
version = "0.5.0-rc.1" version = "0.5.0-rc.1"
source = "git+https://github.com/SergioBenitez/Rocket?branch=master#ae0ccf43f11be5c00bb9cd49996c8bb06a7e1651" source = "git+https://github.com/SergioBenitez/Rocket?branch=master#49d138de14074d40fb9223467434a5626782f51a"
dependencies = [ dependencies = [
"async-stream", "async-stream",
"async-trait", "async-trait",
@ -2302,7 +2296,7 @@ dependencies = [
[[package]] [[package]]
name = "rocket_codegen" name = "rocket_codegen"
version = "0.5.0-rc.1" version = "0.5.0-rc.1"
source = "git+https://github.com/SergioBenitez/Rocket?branch=master#ae0ccf43f11be5c00bb9cd49996c8bb06a7e1651" source = "git+https://github.com/SergioBenitez/Rocket?branch=master#49d138de14074d40fb9223467434a5626782f51a"
dependencies = [ dependencies = [
"devise", "devise",
"glob", "glob",
@ -2317,7 +2311,7 @@ dependencies = [
[[package]] [[package]]
name = "rocket_dyn_templates" name = "rocket_dyn_templates"
version = "0.1.0-rc.1" version = "0.1.0-rc.1"
source = "git+https://github.com/SergioBenitez/Rocket?branch=master#ae0ccf43f11be5c00bb9cd49996c8bb06a7e1651" source = "git+https://github.com/SergioBenitez/Rocket?branch=master#49d138de14074d40fb9223467434a5626782f51a"
dependencies = [ dependencies = [
"glob", "glob",
"normpath", "normpath",
@ -2329,7 +2323,7 @@ dependencies = [
[[package]] [[package]]
name = "rocket_http" name = "rocket_http"
version = "0.5.0-rc.1" version = "0.5.0-rc.1"
source = "git+https://github.com/SergioBenitez/Rocket?branch=master#ae0ccf43f11be5c00bb9cd49996c8bb06a7e1651" source = "git+https://github.com/SergioBenitez/Rocket?branch=master#49d138de14074d40fb9223467434a5626782f51a"
dependencies = [ dependencies = [
"cookie", "cookie",
"either", "either",
@ -2356,20 +2350,20 @@ dependencies = [
[[package]] [[package]]
name = "rsa" name = "rsa"
version = "0.5.0" version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e05c2603e2823634ab331437001b411b9ed11660fbc4066f3908c84a9439260d" checksum = "4cf22754c49613d2b3b119f0e5d46e34a2c628a937e3024b8762de4e7d8c710b"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"digest 0.9.0", "digest 0.10.3",
"lazy_static",
"num-bigint-dig", "num-bigint-dig",
"num-integer", "num-integer",
"num-iter", "num-iter",
"num-traits", "num-traits",
"pkcs1", "pkcs1",
"pkcs8", "pkcs8",
"rand 0.8.5", "rand_core 0.6.3",
"smallvec",
"subtle", "subtle",
"zeroize", "zeroize",
] ]
@ -2569,8 +2563,9 @@ dependencies = [
[[package]] [[package]]
name = "serenity" name = "serenity"
version = "0.10.10" version = "0.11.1"
source = "git+https://github.com/serenity-rs/serenity?branch=next#cf5585266e7ba502099da12bdaa91213741b1c59" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96455fdd03a3cb8c3270c47adf21d748b65067affc6c911ed4ed4ae05f097cab"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"async-tungstenite", "async-tungstenite",
@ -2609,19 +2604,6 @@ dependencies = [
"opaque-debug 0.2.3", "opaque-debug 0.2.3",
] ]
[[package]]
name = "sha-1"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6"
dependencies = [
"block-buffer 0.9.0",
"cfg-if 1.0.0",
"cpufeatures",
"digest 0.9.0",
"opaque-debug 0.3.0",
]
[[package]] [[package]]
name = "sha-1" name = "sha-1"
version = "0.10.0" version = "0.10.0"
@ -2720,16 +2702,17 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]] [[package]]
name = "spin" name = "spin"
version = "0.9.2" version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "511254be0c5bcf062b019a6c89c01a664aa359ded62f78aa72c6fc137c0590e5" checksum = "c530c2b0d0bf8b69304b39fe2001993e267461948b890cd037d8ad4293fa1a0d"
[[package]] [[package]]
name = "spki" name = "spki"
version = "0.4.1" version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c01a0c15da1b0b0e1494112e7af814a678fec9bd157881b49beac661e9b6f32" checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27"
dependencies = [ dependencies = [
"base64ct",
"der", "der",
] ]
@ -2746,9 +2729,9 @@ dependencies = [
[[package]] [[package]]
name = "sqlx" name = "sqlx"
version = "0.5.11" version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc15591eb44ffb5816a4a70a7efd5dd87bfd3aa84c4c200401c4396140525826" checksum = "551873805652ba0d912fec5bbb0f8b4cdd96baf8e2ebf5970e5671092966019b"
dependencies = [ dependencies = [
"sqlx-core", "sqlx-core",
"sqlx-macros", "sqlx-macros",
@ -2756,9 +2739,9 @@ dependencies = [
[[package]] [[package]]
name = "sqlx-core" name = "sqlx-core"
version = "0.5.11" version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "195183bf6ff8328bb82c0511a83faf60aacf75840103388851db61d7a9854ae3" checksum = "e48c61941ccf5ddcada342cd59e3e5173b007c509e1e8e990dafc830294d9dc5"
dependencies = [ dependencies = [
"ahash", "ahash",
"atoi", "atoi",
@ -2769,8 +2752,9 @@ dependencies = [
"chrono", "chrono",
"crc", "crc",
"crossbeam-queue", "crossbeam-queue",
"digest 0.9.0", "digest 0.10.3",
"either", "either",
"event-listener",
"futures-channel", "futures-channel",
"futures-core", "futures-core",
"futures-intrusive", "futures-intrusive",
@ -2792,8 +2776,8 @@ dependencies = [
"rustls 0.19.1", "rustls 0.19.1",
"serde", "serde",
"serde_json", "serde_json",
"sha-1 0.9.8", "sha-1 0.10.0",
"sha2 0.9.9", "sha2 0.10.2",
"smallvec", "smallvec",
"sqlformat", "sqlformat",
"sqlx-rt", "sqlx-rt",
@ -2807,9 +2791,9 @@ dependencies = [
[[package]] [[package]]
name = "sqlx-macros" name = "sqlx-macros"
version = "0.5.11" version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eee35713129561f5e55c554bba1c378e2a7e67f81257b7311183de98c50e6f94" checksum = "bc0fba2b0cae21fc00fe6046f8baa4c7fcb49e379f0f592b04696607f69ed2e1"
dependencies = [ dependencies = [
"dotenv", "dotenv",
"either", "either",
@ -2818,7 +2802,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"serde_json", "serde_json",
"sha2 0.9.9", "sha2 0.10.2",
"sqlx-core", "sqlx-core",
"sqlx-rt", "sqlx-rt",
"syn", "syn",
@ -2827,9 +2811,9 @@ dependencies = [
[[package]] [[package]]
name = "sqlx-rt" name = "sqlx-rt"
version = "0.5.11" version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b555e70fbbf84e269ec3858b7a6515bcfe7a166a7cc9c636dd6efd20431678b6" checksum = "4db708cd3e459078f85f39f96a00960bd841f66ee2a669e90bf36907f5a79aae"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"tokio", "tokio",
@ -2887,18 +2871,6 @@ dependencies = [
"unicode-xid", "unicode-xid",
] ]
[[package]]
name = "synstructure"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
dependencies = [
"proc-macro2",
"quote",
"syn",
"unicode-xid",
]
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.3.0" version = "3.3.0"
@ -3121,9 +3093,9 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.5.8" version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
dependencies = [ dependencies = [
"serde", "serde",
] ]
@ -3136,9 +3108,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6"
[[package]] [[package]]
name = "tracing" name = "tracing"
version = "0.1.32" version = "0.1.34"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"log", "log",
@ -3160,9 +3132,9 @@ dependencies = [
[[package]] [[package]]
name = "tracing-core" name = "tracing-core"
version = "0.1.24" version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90442985ee2f57c9e1b548ee72ae842f4a9a20e3f417cc38dbc5dc684d9bb4ee" checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"valuable", "valuable",
@ -3181,9 +3153,9 @@ dependencies = [
[[package]] [[package]]
name = "tracing-subscriber" name = "tracing-subscriber"
version = "0.3.10" version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9df98b037d039d03400d9dd06b0f8ce05486b5f25e9a2d7d36196e142ebbc52" checksum = "4bc28f93baff38037f64e6f43d34cfa1605f27a49c34e8a04c5e78b0babf2596"
dependencies = [ dependencies = [
"ansi_term", "ansi_term",
"lazy_static", "lazy_static",
@ -3672,21 +3644,6 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
[[package]] [[package]]
name = "zeroize" name = "zeroize"
version = "1.4.3" version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619" checksum = "7eb5728b8afd3f280a869ce1d4c554ffaed35f45c231fc41bfbd0381bef50317"
dependencies = [
"zeroize_derive",
]
[[package]]
name = "zeroize_derive"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17"
dependencies = [
"proc-macro2",
"quote",
"syn",
"synstructure",
]

View File

@ -5,7 +5,7 @@ authors = ["jellywx <judesouthworth@pm.me>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
poise = { git = "https://github.com/kangalioo/poise", branch = "develop" } poise = { git = "https://github.com/kangalioo/poise", branch = "master" }
dotenv = "0.15" dotenv = "0.15"
tokio = { version = "1", features = ["process", "full"] } tokio = { version = "1", features = ["process", "full"] }
reqwest = "0.11" reqwest = "0.11"

View File

@ -14,21 +14,5 @@ lazy_static = "1.4"
num-integer = "0.1" num-integer = "0.1"
serde = "1.0" serde = "1.0"
serde_json = "1.0" serde_json = "1.0"
sqlx = { version = "0.5.10", features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "chrono", "json"]} sqlx = { version = "0.5", features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "chrono", "json"]}
serenity = { version = "0.11.1", default-features = false, features = ["builder", "cache", "client", "gateway", "http", "model", "utils", "rustls_backend"] }
[dependencies.serenity]
git = "https://github.com/serenity-rs/serenity"
branch = "next"
default-features = false
features = [
"builder",
"client",
"cache",
"gateway",
"http",
"model",
"utils",
"rustls_backend",
"collector",
"unstable_discord_api"
]

View File

@ -2,81 +2,22 @@ use std::{collections::HashMap, env, sync::atomic::Ordering};
use log::{error, info, warn}; use log::{error, info, warn};
use poise::{ use poise::{
async_trait,
serenity::{model::interactions::Interaction, utils::shard_id}, serenity::{model::interactions::Interaction, utils::shard_id},
serenity_prelude as serenity, serenity_prelude as serenity,
}; };
use crate::{component_models::ComponentDataModel, Data, Error, GuildId}; use crate::{component_models::ComponentDataModel, Data, Error};
struct Handler;
#[async_trait]
impl serenity::EventHandler for Handler {
async fn guild_create(&self, ctx: serenity::Context, guild: serenity::Guild, is_new: bool) {
if is_new {
let guild_id = guild.id.as_u64().to_owned();
// todo
// sqlx::query!("INSERT INTO guilds (guild) VALUES (?)", guild_id)
// .execute(&data.database)
// .await
// .unwrap();
//if let Ok(token) = env::var("DISCORDBOTS_TOKEN") {
// let shard_count = ctx.cache.shard_count();
// let current_shard_id = shard_id(guild_id, shard_count);
// let guild_count = ctx
// .cache
// .guilds()
// .iter()
// .filter(|g| {
// shard_id(g.as_u64().to_owned(), shard_count) == current_shard_id
// })
// .count() as u64;
// let mut hm = HashMap::new();
// hm.insert("server_count", guild_count);
// hm.insert("shard_id", current_shard_id);
// hm.insert("shard_count", shard_count);
// let response = data
// .http
// .post(
// format!(
// "https://top.gg/api/bots/{}/stats",
// ctx.cache.current_user_id().as_u64()
// )
// .as_str(),
// )
// .header("Authorization", token)
// .json(&hm)
// .send()
// .await;
// if let Err(res) = response {
// println!("DiscordBots Response: {:?}", res);
// }
//}
}
}
}
pub async fn listener( pub async fn listener(
ctx: &serenity::Context, ctx: &serenity::Context,
event: &serenity::Event, event: &poise::Event<'_>,
data: &Data, data: &Data,
) -> Result<(), Error> { ) -> Result<(), Error> {
match event { match event {
serenity::Event::Ready(_) => { poise::Event::CacheReady { .. } => {
info!("Cache Ready! Preparing extra processes"); info!("Cache Ready! Preparing extra processes");
if data if !data.is_loop_running.load(Ordering::Relaxed) {
.is_loop_running
.compare_exchange(false, true, Ordering::Relaxed, Ordering::Relaxed)
.is_ok()
{
let kill_tx = data.broadcast.clone(); let kill_tx = data.broadcast.clone();
let kill_recv = data.broadcast.subscribe(); let kill_recv = data.broadcast.subscribe();
@ -108,24 +49,73 @@ pub async fn listener(
} else { } else {
warn!("Not running web") warn!("Not running web")
} }
data.is_loop_running.swap(true, Ordering::Relaxed);
} }
} }
serenity::Event::ChannelDelete(event) => { poise::Event::ChannelDelete { channel } => {
sqlx::query!("DELETE FROM channels WHERE channel = ?", event.channel.id().0) sqlx::query!("DELETE FROM channels WHERE channel = ?", channel.id.as_u64())
.execute(&data.database) .execute(&data.database)
.await .await
.unwrap(); .unwrap();
} }
serenity::Event::GuildDelete(event) => { poise::Event::GuildCreate { guild, is_new } => {
let _ = sqlx::query!("DELETE FROM guilds WHERE guild = ?", event.guild.id.0) if *is_new {
let guild_id = guild.id.as_u64().to_owned();
sqlx::query!("INSERT INTO guilds (guild) VALUES (?)", guild_id)
.execute(&data.database)
.await
.unwrap();
if let Ok(token) = env::var("DISCORDBOTS_TOKEN") {
let shard_count = ctx.cache.shard_count();
let current_shard_id = shard_id(guild_id, shard_count);
let guild_count = ctx
.cache
.guilds()
.iter()
.filter(|g| {
shard_id(g.as_u64().to_owned(), shard_count) == current_shard_id
})
.count() as u64;
let mut hm = HashMap::new();
hm.insert("server_count", guild_count);
hm.insert("shard_id", current_shard_id);
hm.insert("shard_count", shard_count);
let response = data
.http
.post(
format!(
"https://top.gg/api/bots/{}/stats",
ctx.cache.current_user_id().as_u64()
)
.as_str(),
)
.header("Authorization", token)
.json(&hm)
.send()
.await;
if let Err(res) = response {
println!("DiscordBots Response: {:?}", res);
}
}
}
}
poise::Event::GuildDelete { incomplete, .. } => {
let _ = sqlx::query!("DELETE FROM guilds WHERE guild = ?", incomplete.id.0)
.execute(&data.database) .execute(&data.database)
.await; .await;
} }
serenity::Event::InteractionCreate(event) => match &event.interaction { poise::Event::InteractionCreate { interaction } => match interaction {
Interaction::MessageComponent(component) => { Interaction::MessageComponent(component) => {
let component_model = ComponentDataModel::from_custom_id(&component.data.custom_id); let component_model = ComponentDataModel::from_custom_id(&component.data.custom_id);
component_model.act(ctx, data, &component).await; component_model.act(ctx, data, component).await;
} }
_ => {} _ => {}
}, },

View File

@ -75,7 +75,7 @@ async fn check_self_permissions(ctx: Context<'_>) -> bool {
}) })
.flatten() .flatten()
.map_or((false, false, false), |p| { .map_or((false, false, false), |p| {
(p.read_messages(), p.send_messages(), p.embed_links()) (p.view_channel(), p.send_messages(), p.embed_links())
}); });
if manage_webhooks && send_messages && embed_links { if manage_webhooks && send_messages && embed_links {

View File

@ -194,7 +194,7 @@ async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
}) })
}) })
.options(options) .options(options)
.client_settings(move |client_builder| client_builder.intents(GatewayIntents::GUILDS)) .intents(GatewayIntents::GUILDS)
.run_autosharded() .run_autosharded()
.await?; .await?;

View File

@ -7,7 +7,7 @@ edition = "2018"
[dependencies] [dependencies]
rocket = { git = "https://github.com/SergioBenitez/Rocket", branch = "master", features = ["tls", "secrets", "json"] } rocket = { git = "https://github.com/SergioBenitez/Rocket", branch = "master", features = ["tls", "secrets", "json"] }
rocket_dyn_templates = { git = "https://github.com/SergioBenitez/Rocket", branch = "master", features = ["tera"] } rocket_dyn_templates = { git = "https://github.com/SergioBenitez/Rocket", branch = "master", features = ["tera"] }
serenity = { git = "https://github.com/serenity-rs/serenity", branch = "next", default-features = false, features = ["builder", "cache", "client", "gateway", "http", "model", "utils", "rustls_backend"] } serenity = { version = "0.11.1", default-features = false, features = ["builder", "cache", "client", "gateway", "http", "model", "utils", "rustls_backend"] }
oauth2 = "4" oauth2 = "4"
log = "0.4" log = "0.4"
reqwest = "0.11" reqwest = "0.11"

View File

@ -1,7 +1,6 @@
pub const DISCORD_OAUTH_TOKEN: &'static str = "https://discord.com/api/oauth2/token"; pub const DISCORD_OAUTH_TOKEN: &'static str = "https://discord.com/api/oauth2/token";
pub const DISCORD_OAUTH_AUTHORIZE: &'static str = "https://discord.com/api/oauth2/authorize"; pub const DISCORD_OAUTH_AUTHORIZE: &'static str = "https://discord.com/api/oauth2/authorize";
pub const DISCORD_API: &'static str = "https://discord.com/api"; pub const DISCORD_API: &'static str = "https://discord.com/api";
pub const DISCORD_CDN: &'static str = "https://cdn.discordapp.com/avatars";
pub const MAX_CONTENT_LENGTH: usize = 2000; pub const MAX_CONTENT_LENGTH: usize = 2000;
pub const MAX_EMBED_DESCRIPTION_LENGTH: usize = 4096; pub const MAX_EMBED_DESCRIPTION_LENGTH: usize = 4096;

View File

@ -137,6 +137,7 @@ pub async fn initialize(
routes::dashboard::user::get_user_info, routes::dashboard::user::get_user_info,
routes::dashboard::user::update_user_info, routes::dashboard::user::update_user_info,
routes::dashboard::user::get_user_guilds, routes::dashboard::user::get_user_guilds,
routes::dashboard::guild::get_guild_patreon,
routes::dashboard::guild::get_guild_channels, routes::dashboard::guild::get_guild_channels,
routes::dashboard::guild::get_guild_roles, routes::dashboard::guild::get_guild_roles,
routes::dashboard::guild::get_reminder_templates, routes::dashboard::guild::get_reminder_templates,

View File

@ -1,3 +1,5 @@
use std::env;
use base64; use base64;
use chrono::Utc; use chrono::Utc;
use rocket::{ use rocket::{
@ -10,7 +12,7 @@ use serenity::{
client::Context, client::Context,
model::{ model::{
channel::GuildChannel, channel::GuildChannel,
id::{ChannelId, GuildId}, id::{ChannelId, GuildId, RoleId},
}, },
}; };
use sqlx::{MySql, Pool}; use sqlx::{MySql, Pool};
@ -18,10 +20,10 @@ use sqlx::{MySql, Pool};
use crate::{ use crate::{
check_guild_subscription, check_subscription, check_guild_subscription, check_subscription,
consts::{ consts::{
DAY, DISCORD_CDN, MAX_CONTENT_LENGTH, MAX_EMBED_AUTHOR_LENGTH, DAY, MAX_CONTENT_LENGTH, MAX_EMBED_AUTHOR_LENGTH, MAX_EMBED_DESCRIPTION_LENGTH,
MAX_EMBED_DESCRIPTION_LENGTH, MAX_EMBED_FIELDS, MAX_EMBED_FIELD_TITLE_LENGTH, MAX_EMBED_FIELDS, MAX_EMBED_FIELD_TITLE_LENGTH, MAX_EMBED_FIELD_VALUE_LENGTH,
MAX_EMBED_FIELD_VALUE_LENGTH, MAX_EMBED_FOOTER_LENGTH, MAX_EMBED_TITLE_LENGTH, MAX_EMBED_FOOTER_LENGTH, MAX_EMBED_TITLE_LENGTH, MAX_URL_LENGTH, MAX_USERNAME_LENGTH,
MAX_URL_LENGTH, MAX_USERNAME_LENGTH, MIN_INTERVAL, MIN_INTERVAL,
}, },
routes::dashboard::{ routes::dashboard::{
create_database_channel, generate_uid, name_default, template_name_default, DeleteReminder, create_database_channel, generate_uid, name_default, template_name_default, DeleteReminder,
@ -37,19 +39,45 @@ struct ChannelInfo {
webhook_name: Option<String>, webhook_name: Option<String>,
} }
#[get("/api/guild/<id>/channels")] #[get("/api/guild/<id>/patreon")]
pub async fn get_guild_channels( pub async fn get_guild_patreon(
id: u64, id: u64,
cookies: &CookieJar<'_>, cookies: &CookieJar<'_>,
ctx: &State<Context>, ctx: &State<Context>,
pool: &State<Pool<MySql>>,
) -> JsonValue { ) -> JsonValue {
check_authorization!(cookies, ctx.inner(), id); check_authorization!(cookies, ctx.inner(), id);
match GuildId(id).to_guild_cached(ctx.inner()) { match GuildId(id).to_guild_cached(ctx.inner()) {
Some(guild) => { Some(guild) => {
let mut channel_info = vec![]; let member_res = GuildId(env::var("PATREON_GUILD_ID").unwrap().parse().unwrap())
.member(&ctx.inner(), guild.owner_id)
.await;
let patreon = member_res.map_or(false, |member| {
member
.roles
.contains(&RoleId(env::var("PATREON_ROLE_ID").unwrap().parse().unwrap()))
});
json!({ "patreon": patreon })
}
None => {
json!({"error": "Bot not in guild"})
}
}
}
#[get("/api/guild/<id>/channels")]
pub async fn get_guild_channels(
id: u64,
cookies: &CookieJar<'_>,
ctx: &State<Context>,
) -> JsonValue {
check_authorization!(cookies, ctx.inner(), id);
match GuildId(id).to_guild_cached(ctx.inner()) {
Some(guild) => {
let mut channels = guild let mut channels = guild
.channels .channels
.iter() .iter()
@ -59,17 +87,15 @@ pub async fn get_guild_channels(
channels.sort_by(|(_, c1), (_, c2)| c1.position.cmp(&c2.position)); channels.sort_by(|(_, c1), (_, c2)| c1.position.cmp(&c2.position));
// todo change to map let channel_info = channels
for (channel_id, channel) in channels { .iter()
let mut ch = ChannelInfo { .map(|(channel_id, channel)| ChannelInfo {
name: channel.name.to_string(), name: channel.name.to_string(),
id: channel_id.to_string(), id: channel_id.to_string(),
webhook_avatar: None, webhook_avatar: None,
webhook_name: None, webhook_name: None,
}; })
.collect::<Vec<ChannelInfo>>();
channel_info.push(ch);
}
json!(channel_info) json!(channel_info)
} }

View File

@ -563,3 +563,16 @@ textarea, input {
.button.is-outlined.is-success { .button.is-outlined.is-success {
background-color: white; background-color: white;
} }
.is-locked {
pointer-events: none;
opacity: 0.4;
}
.is-locked .foreground {
pointer-events: auto;
}
.is-locked .field:last-of-type {
display: none;
}

View File

@ -17,6 +17,8 @@ let channels = [];
let roles = []; let roles = [];
let templates = {}; let templates = {};
let globalPatreon = false;
function guildId() { function guildId() {
return document.querySelector(".guildList a.is-active").dataset["guild"]; return document.querySelector(".guildList a.is-active").dataset["guild"];
} }
@ -221,6 +223,10 @@ async function serialize_reminder(node, mode) {
if (node.querySelector('input[name="attachment"]').files.length > 0) { if (node.querySelector('input[name="attachment"]').files.length > 0) {
let file = node.querySelector('input[name="attachment"]').files[0]; let file = node.querySelector('input[name="attachment"]').files[0];
if (file.size >= 8 * 1024 * 1024) {
return { error: "File too large." };
}
attachment = await new Promise((resolve) => { attachment = await new Promise((resolve) => {
let fileReader = new FileReader(); let fileReader = new FileReader();
fileReader.onload = (e) => resolve(fileReader.result); fileReader.onload = (e) => resolve(fileReader.result);
@ -240,6 +246,34 @@ async function serialize_reminder(node, mode) {
enabled = true; enabled = true;
} }
const content = node.querySelector('textarea[name="content"]').value;
const embed_author_url = has_source(node.querySelector("img.embed_author_url").src);
const embed_author = node.querySelector('textarea[name="embed_author"]').value;
const embed_description = node.querySelector(
'textarea[name="embed_description"]'
).value;
const embed_footer = node.querySelector('textarea[name="embed_footer"]').value;
const embed_footer_url = has_source(node.querySelector("img.embed_footer_url").src);
const embed_image_url = has_source(node.querySelector("img.embed_image_url").src);
const embed_thumbnail_url = has_source(
node.querySelector("img.embed_thumbnail_url").src
);
const embed_title = node.querySelector('textarea[name="embed_title"]').value;
if (
attachment === null &&
content.length == 0 &&
embed_author_url === null &&
embed_author.length == 0 &&
embed_description.length == 0 &&
embed_footer.length == 0 &&
embed_footer_url === null &&
embed_image_url === null &&
embed_thumbnail_url === null
) {
return { error: "Reminder needs content." };
}
return { return {
// if we're creating a reminder, ignore this field // if we're creating a reminder, ignore this field
uid: uid, uid: uid,
@ -250,18 +284,16 @@ async function serialize_reminder(node, mode) {
attachment_name: attachment_name, attachment_name: attachment_name,
avatar: has_source(node.querySelector("img.discord-avatar").src), avatar: has_source(node.querySelector("img.discord-avatar").src),
channel: node.querySelector("select.channel-selector").value, channel: node.querySelector("select.channel-selector").value,
content: node.querySelector('textarea[name="content"]').value, content: content,
embed_author_url: has_source(node.querySelector("img.embed_author_url").src), embed_author_url: embed_author_url,
embed_author: node.querySelector('textarea[name="embed_author"]').value, embed_author: embed_author,
embed_color: color, embed_color: color,
embed_description: node.querySelector('textarea[name="embed_description"]').value, embed_description: embed_description,
embed_footer: node.querySelector('textarea[name="embed_footer"]').value, embed_footer: embed_footer,
embed_footer_url: has_source(node.querySelector("img.embed_footer_url").src), embed_footer_url: embed_footer_url,
embed_image_url: has_source(node.querySelector("img.embed_image_url").src), embed_image_url: embed_image_url,
embed_thumbnail_url: has_source( embed_thumbnail_url: embed_thumbnail_url,
node.querySelector("img.embed_thumbnail_url").src embed_title: embed_title,
),
embed_title: node.querySelector('textarea[name="embed_title"]').value,
embed_fields: fields, embed_fields: fields,
expires: expiration_time, expires: expiration_time,
interval_seconds: mode !== "template" ? interval.seconds : null, interval_seconds: mode !== "template" ? interval.seconds : null,
@ -325,7 +357,7 @@ function deserialize_reminder(reminder, frame, mode) {
}).setZone(timezone); }).setZone(timezone);
timeInput.value = localTime.toFormat("yyyy-LL-dd'T'HH:mm:ss"); timeInput.value = localTime.toFormat("yyyy-LL-dd'T'HH:mm:ss");
if (reminder['expires']) { if (reminder["expires"]) {
let expiresInput = frame.querySelector('input[name="time"]'); let expiresInput = frame.querySelector('input[name="time"]');
let expiresTime = luxon.DateTime.fromISO(reminder["expires"], { let expiresTime = luxon.DateTime.fromISO(reminder["expires"], {
zone: "UTC", zone: "UTC",
@ -522,6 +554,8 @@ document.addEventListener("DOMContentLoaded", () => {
} else { } else {
if (data.timezone !== null) botTimezone = data.timezone; if (data.timezone !== null) botTimezone = data.timezone;
globalPatreon = data.patreon;
update_times(); update_times();
} }
}); });
@ -722,19 +756,20 @@ $deleteTemplateBtn.addEventListener("click", (ev) => {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
body: JSON.stringify({id: parseInt($templateSelect.value)}), body: JSON.stringify({ id: parseInt($templateSelect.value) }),
}) })
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((data) => {
if (data.error) { if (data.error) {
show_error(data.error) show_error(data.error);
} else { } else {
$templateSelect.querySelector(`option[value="${$templateSelect.value}"]`).remove(); $templateSelect
.querySelector(`option[value="${$templateSelect.value}"]`)
.remove();
} }
}) });
}); });
document.querySelectorAll("textarea.autoresize").forEach((element) => { document.querySelectorAll("textarea.autoresize").forEach((element) => {
element.addEventListener("input", () => { element.addEventListener("input", () => {
element.style.height = ""; element.style.height = "";
@ -785,16 +820,6 @@ document.addEventListener("remindersLoaded", () => {
}); });
}); });
const $showInterval = document.querySelectorAll("a.intervalLabel");
$showInterval.forEach((element) => {
element.addEventListener("click", () => {
element.querySelector("i").classList.toggle("fa-chevron-right");
element.querySelector("i").classList.toggle("fa-chevron-down");
element.nextElementSibling.classList.toggle("is-hidden");
});
});
document.querySelectorAll(".change-color").forEach((element) => { document.querySelectorAll(".change-color").forEach((element) => {
element.addEventListener("click", (e) => { element.addEventListener("click", (e) => {
e.preventDefault(); e.preventDefault();

View File

@ -158,43 +158,45 @@
</div> </div>
<div class="collapses"> <div class="collapses">
<div class="field"> <div class="is-locked">
<a class="intervalLabel"><label class="label">Interval <i class="fas fa-chevron-down"></i></label></a> <div class="field">
<div class="control intervalSelector" style="min-width: 400px;" > <label class="label">Interval <a class="foreground" href="/help/interval"><i class="fas fa-question-circle"></i></a></label>
<div class="input interval-group"> <div class="control intervalSelector" style="min-width: 400px;" >
<div class="interval-group-left"> <div class="input interval-group">
<label> <div class="interval-group-left">
<span class="is-sr-only">Interval months</span> <label>
<input class="w2" type="text" pattern="\d*" name="interval_months" maxlength="2" placeholder=""> <span class="half-rem"></span> months, <span class="half-rem"></span> <span class="is-sr-only">Interval months</span>
</label> <input class="w2" type="text" pattern="\d*" name="interval_months" maxlength="2" placeholder=""> <span class="half-rem"></span> months, <span class="half-rem"></span>
<label> </label>
<span class="is-sr-only">Interval days</span> <label>
<input class="w3" type="text" pattern="\d*" name="interval_days" maxlength="4" placeholder=""> <span class="half-rem"></span> days, <span class="half-rem"></span> <span class="is-sr-only">Interval days</span>
</label> <input class="w3" type="text" pattern="\d*" name="interval_days" maxlength="4" placeholder=""> <span class="half-rem"></span> days, <span class="half-rem"></span>
<label> </label>
<span class="is-sr-only">Interval hours</span> <label>
<input class="w2" type="text" pattern="\d*" name="interval_hours" maxlength="2" placeholder="HH">: <span class="is-sr-only">Interval hours</span>
</label> <input class="w2" type="text" pattern="\d*" name="interval_hours" maxlength="2" placeholder="HH">:
<label> </label>
<span class="is-sr-only">Interval minutes</span> <label>
<input class="w2" type="text" pattern="\d*" name="interval_minutes" maxlength="2" placeholder="MM">: <span class="is-sr-only">Interval minutes</span>
</label> <input class="w2" type="text" pattern="\d*" name="interval_minutes" maxlength="2" placeholder="MM">:
<label> </label>
<span class="is-sr-only">Interval seconds</span> <label>
<input class="w2" type="text" pattern="\d*" name="interval_seconds" maxlength="2" placeholder="SS"> <span class="is-sr-only">Interval seconds</span>
</label> <input class="w2" type="text" pattern="\d*" name="interval_seconds" maxlength="2" placeholder="SS">
</label>
</div>
<button class="clear"><span class="is-sr-only">Clear interval</span><span class="icon"><i class="fas fa-trash"></i></span></button>
</div> </div>
<button class="clear"><span class="is-sr-only">Clear interval</span><span class="icon"><i class="fas fa-trash"></i></span></button>
</div> </div>
</div> </div>
</div>
<div class="field"> <div class="field">
<div class="control"> <div class="control">
<label class="label"> <label class="label">
Expiration Expiration
<input class="input" type="datetime-local" step="1" name="expiration"> <input class="input" type="datetime-local" step="1" name="expiration">
</label> </label>
</div>
</div> </div>
</div> </div>
@ -226,27 +228,29 @@
</div> </div>
</div> </div>
<span class="pad-left"></span> <div>
{% if creating %} <span class="pad-left"></span>
<button class="button is-success" id="createReminder"> {% if creating %}
<span>Create Reminder</span> <span class="icon"><i class="fas fa-sparkles"></i></span> <button class="button is-success" id="createReminder">
</button> <span>Create Reminder</span> <span class="icon"><i class="fas fa-sparkles"></i></span>
<button class="button is-success is-outlined" id="createTemplate"> </button>
<span>Create Template</span> <span class="icon"><i class="fas fa-file-spreadsheet"></i></span> <button class="button is-success is-outlined" id="createTemplate">
</button> <span>Create Template</span> <span class="icon"><i class="fas fa-file-spreadsheet"></i></span>
<button class="button is-outlined show-modal is-pulled-right" data-modal="chooseTemplateModal"> </button>
Load Template <button class="button is-outlined show-modal is-pulled-right" data-modal="chooseTemplateModal">
</button> Load Template
{% else %} </button>
<button class="button is-success save-btn"> {% else %}
<span>Save</span> <span class="icon"><i class="fas fa-save"></i></span> <button class="button is-success save-btn">
</button> <span>Save</span> <span class="icon"><i class="fas fa-save"></i></span>
<button class="button is-warning disable-enable"> </button>
</button> <button class="button is-warning disable-enable">
<button class="button is-danger delete-reminder"> </button>
Delete <button class="button is-danger delete-reminder">
</button> Delete
{% endif %} </button>
{% endif %}
</div>
</div> </div>
</div> </div>
</div> </div>