Enabled trust-dns and some updates.

- Enabled trust-dns feature which seems to help a bit when DNS is
causing long timeouts. Though in the blocking version it is less visible
then on the async branch.
- Updated crates
- Removed some redundant code
- Updated javascript/css libraries

Resolves #2118
Resolves #2119
pull/2125/head
BlackDex 3 years ago
parent ead2f02cbd
commit e327583aa5
No known key found for this signature in database
GPG Key ID: 58C80A2AA6C765E1

307
Cargo.lock generated

@ -55,6 +55,17 @@ dependencies = [
"tokio", "tokio",
] ]
[[package]]
name = "async-trait"
version = "0.1.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e"
dependencies = [
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.82",
]
[[package]] [[package]]
name = "atty" name = "atty"
version = "0.2.14" version = "0.2.14"
@ -230,9 +241,9 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.71" version = "1.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd" checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@ -322,9 +333,9 @@ dependencies = [
[[package]] [[package]]
name = "cookie_store" name = "cookie_store"
version = "0.15.0" version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55b4ac5559dd39f7bdc516f769cb412b151585d8886d216871a8435ed7f862cd" checksum = "b3f7034c0932dc36f5bd8ec37368d971346809435824f277cb3b8299fc56167c"
dependencies = [ dependencies = [
"cookie 0.15.1", "cookie 0.15.1",
"idna 0.2.3", "idna 0.2.3",
@ -363,9 +374,9 @@ dependencies = [
[[package]] [[package]]
name = "crc32fast" name = "crc32fast"
version = "1.2.1" version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
] ]
@ -409,8 +420,9 @@ checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57"
[[package]] [[package]]
name = "data-url" name = "data-url"
version = "0.1.0" version = "0.1.1"
source = "git+https://github.com/servo/rust-url?rev=eb7330b5296c0d43816d1346211b74182bb4ae37#eb7330b5296c0d43816d1346211b74182bb4ae37" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a30bfce702bcfa94e906ef82421f2c0e61c076ad76030c16ee5d2e9a32fe193"
dependencies = [ dependencies = [
"matches", "matches",
] ]
@ -441,7 +453,7 @@ dependencies = [
"bitflags", "bitflags",
"proc-macro2 1.0.32", "proc-macro2 1.0.32",
"quote 1.0.10", "quote 1.0.10",
"syn 1.0.81", "syn 1.0.82",
] ]
[[package]] [[package]]
@ -469,7 +481,7 @@ checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3"
dependencies = [ dependencies = [
"proc-macro2 1.0.32", "proc-macro2 1.0.32",
"quote 1.0.10", "quote 1.0.10",
"syn 1.0.81", "syn 1.0.82",
] ]
[[package]] [[package]]
@ -527,6 +539,18 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
] ]
[[package]]
name = "enum-as-inner"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595"
dependencies = [
"heck",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.82",
]
[[package]] [[package]]
name = "error-chain" name = "error-chain"
version = "0.11.0" version = "0.11.0"
@ -638,9 +662,9 @@ dependencies = [
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.17" version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca" checksum = "8cd0210d8c325c245ff06fd95a3b13689a1a276ac8cfa8e8720cb840bfb84b9e"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -653,9 +677,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-channel" name = "futures-channel"
version = "0.3.17" version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888" checksum = "7fc8cd39e3dbf865f7340dce6a2d401d24fd37c6fe6c4f0ee0de8bfca2252d27"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@ -663,15 +687,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.17" version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d" checksum = "629316e42fe7c2a0b9a65b47d159ceaa5453ab14e8f0a3c5eedbb8cd55b4a445"
[[package]] [[package]]
name = "futures-executor" name = "futures-executor"
version = "0.3.17" version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c" checksum = "7b808bf53348a36cab739d7e04755909b9fcaaa69b7d7e588b37b6ec62704c97"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
@ -680,42 +704,39 @@ dependencies = [
[[package]] [[package]]
name = "futures-io" name = "futures-io"
version = "0.3.17" version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377" checksum = "e481354db6b5c353246ccf6a728b0c5511d752c08da7260546fc0933869daa11"
[[package]] [[package]]
name = "futures-macro" name = "futures-macro"
version = "0.3.17" version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" checksum = "a89f17b21645bc4ed773c69af9c9a0effd4a3f1a3876eadd453469f8854e7fdd"
dependencies = [ dependencies = [
"autocfg",
"proc-macro-hack",
"proc-macro2 1.0.32", "proc-macro2 1.0.32",
"quote 1.0.10", "quote 1.0.10",
"syn 1.0.81", "syn 1.0.82",
] ]
[[package]] [[package]]
name = "futures-sink" name = "futures-sink"
version = "0.3.17" version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11" checksum = "996c6442437b62d21a32cd9906f9c41e7dc1e19a9579843fad948696769305af"
[[package]] [[package]]
name = "futures-task" name = "futures-task"
version = "0.3.17" version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99" checksum = "dabf1872aaab32c886832f2276d2f5399887e2bd613698a02359e4ea83f8de12"
[[package]] [[package]]
name = "futures-util" name = "futures-util"
version = "0.3.17" version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" checksum = "41d22213122356472061ac0f1ab2cee28d2bac8491410fd68c2af53d1cedb83e"
dependencies = [ dependencies = [
"autocfg",
"futures-channel", "futures-channel",
"futures-core", "futures-core",
"futures-io", "futures-io",
@ -725,8 +746,6 @@ dependencies = [
"memchr", "memchr",
"pin-project-lite", "pin-project-lite",
"pin-utils", "pin-utils",
"proc-macro-hack",
"proc-macro-nested",
"slab", "slab",
] ]
@ -810,9 +829,9 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
[[package]] [[package]]
name = "handlebars" name = "handlebars"
version = "4.1.3" version = "4.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66b09e2322d20d14bc2572401ce7c1d60b4748580a76c230ed9c1f8938f0c833" checksum = "8ad84da8f63da982543fc85fcabaee2ad1fdd809d99d64a48887e2e942ddfe46"
dependencies = [ dependencies = [
"log 0.4.14", "log 0.4.14",
"pest", "pest",
@ -829,6 +848,15 @@ version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]]
name = "heck"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
dependencies = [
"unicode-segmentation",
]
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.19" version = "0.1.19"
@ -880,7 +908,7 @@ dependencies = [
"markup5ever", "markup5ever",
"proc-macro2 1.0.32", "proc-macro2 1.0.32",
"quote 1.0.10", "quote 1.0.10",
"syn 1.0.81", "syn 1.0.82",
] ]
[[package]] [[package]]
@ -913,9 +941,9 @@ checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503"
[[package]] [[package]]
name = "httpdate" name = "httpdate"
version = "1.0.1" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
[[package]] [[package]]
name = "hyper" name = "hyper"
@ -938,9 +966,9 @@ dependencies = [
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "0.14.14" version = "0.14.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b91bb1f221b6ea1f1e4371216b70f40748774c2fb5971b450c07773fb92d26b" checksum = "436ec0091e4f20e655156a30a0df3770fe2900aa301e548e08446ec794b6953c"
dependencies = [ dependencies = [
"bytes 1.1.0", "bytes 1.1.0",
"futures-channel", "futures-channel",
@ -953,7 +981,7 @@ dependencies = [
"httpdate", "httpdate",
"itoa", "itoa",
"pin-project-lite", "pin-project-lite",
"socket2", "socket2 0.4.2",
"tokio", "tokio",
"tower-service", "tower-service",
"tracing", "tracing",
@ -979,7 +1007,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
dependencies = [ dependencies = [
"bytes 1.1.0", "bytes 1.1.0",
"hyper 0.14.14", "hyper 0.14.15",
"native-tls", "native-tls",
"tokio", "tokio",
"tokio-native-tls", "tokio-native-tls",
@ -1035,6 +1063,18 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "ipconfig"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7"
dependencies = [
"socket2 0.3.19",
"widestring",
"winapi 0.3.9",
"winreg 0.6.2",
]
[[package]] [[package]]
name = "ipnet" name = "ipnet"
version = "2.3.1" version = "2.3.1"
@ -1131,9 +1171,9 @@ dependencies = [
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.106" version = "0.2.108"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a60553f9a9e039a333b4e9b20573b9e9b9c0bb3a11e201ccc48ef4283456d673" checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119"
[[package]] [[package]]
name = "libsqlite3-sys" name = "libsqlite3-sys"
@ -1146,6 +1186,12 @@ dependencies = [
"vcpkg", "vcpkg",
] ]
[[package]]
name = "linked-hash-map"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
[[package]] [[package]]
name = "lock_api" name = "lock_api"
version = "0.4.5" version = "0.4.5"
@ -1173,6 +1219,15 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
] ]
[[package]]
name = "lru-cache"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c"
dependencies = [
"linked-hash-map",
]
[[package]] [[package]]
name = "mac" name = "mac"
version = "0.1.1" version = "0.1.1"
@ -1253,7 +1308,7 @@ dependencies = [
"migrations_internals", "migrations_internals",
"proc-macro2 1.0.32", "proc-macro2 1.0.32",
"quote 1.0.10", "quote 1.0.10",
"syn 1.0.81", "syn 1.0.82",
] ]
[[package]] [[package]]
@ -1473,7 +1528,7 @@ checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d"
dependencies = [ dependencies = [
"proc-macro2 1.0.32", "proc-macro2 1.0.32",
"quote 1.0.10", "quote 1.0.10",
"syn 1.0.81", "syn 1.0.82",
] ]
[[package]] [[package]]
@ -1563,9 +1618,9 @@ dependencies = [
[[package]] [[package]]
name = "openssl-sys" name = "openssl-sys"
version = "0.9.70" version = "0.9.71"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6517987b3f8226b5da3661dad65ff7f300cc59fb5ea8333ca191fc65fde3edf" checksum = "7df13d165e607909b363a4757a6f133f8a818a74e9d3a98d09c6128e15fa4c73"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cc", "cc",
@ -1660,9 +1715,9 @@ dependencies = [
[[package]] [[package]]
name = "paste" name = "paste"
version = "1.0.5" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5"
[[package]] [[package]]
name = "pear" name = "pear"
@ -1738,7 +1793,7 @@ dependencies = [
"pest_meta", "pest_meta",
"proc-macro2 1.0.32", "proc-macro2 1.0.32",
"quote 1.0.10", "quote 1.0.10",
"syn 1.0.81", "syn 1.0.82",
] ]
[[package]] [[package]]
@ -1880,12 +1935,6 @@ version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]]
name = "proc-macro-nested"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "0.4.30" version = "0.4.30"
@ -1906,9 +1955,9 @@ dependencies = [
[[package]] [[package]]
name = "psl-types" name = "psl-types"
version = "2.0.7" version = "2.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66b398073e7cdd6f05934389a8f5961e3aabfa66675b6f440df4e2c793d51a4f" checksum = "4af8f675df9e68626b5059f8909ae261b8f5c3e8ab14813ad7f6cc7a134dcafb"
[[package]] [[package]]
name = "publicsuffix" name = "publicsuffix"
@ -1954,9 +2003,9 @@ dependencies = [
[[package]] [[package]]
name = "quoted_printable" name = "quoted_printable"
version = "0.4.3" version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1238256b09923649ec89b08104c4dfe9f6cb2fea734a5db5384e44916d59e9c5" checksum = "3fee2dce59f7a43418e3382c766554c614e06a552d53a8f07ef499ea4b332c0f"
[[package]] [[package]]
name = "r2d2" name = "r2d2"
@ -2134,9 +2183,9 @@ dependencies = [
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.11.6" version = "0.11.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66d2927ca2f685faf0fc620ac4834690d29e7abb153add10f5812eef20b5e280" checksum = "07bea77bc708afa10e59905c3d4af7c8fd43c9214251673095ff8b14345fcbc5"
dependencies = [ dependencies = [
"async-compression", "async-compression",
"base64 0.13.0", "base64 0.13.0",
@ -2148,7 +2197,7 @@ dependencies = [
"futures-util", "futures-util",
"http", "http",
"http-body", "http-body",
"hyper 0.14.14", "hyper 0.14.15",
"hyper-tls", "hyper-tls",
"ipnet", "ipnet",
"js-sys", "js-sys",
@ -2158,19 +2207,30 @@ dependencies = [
"native-tls", "native-tls",
"percent-encoding 2.1.0", "percent-encoding 2.1.0",
"pin-project-lite", "pin-project-lite",
"proc-macro-hack",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"time 0.2.27",
"tokio", "tokio",
"tokio-native-tls", "tokio-native-tls",
"tokio-socks", "tokio-socks",
"tokio-util", "tokio-util",
"trust-dns-resolver",
"url 2.2.2", "url 2.2.2",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures", "wasm-bindgen-futures",
"web-sys", "web-sys",
"winreg", "winreg 0.7.0",
]
[[package]]
name = "resolv-conf"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00"
dependencies = [
"hostname",
"quick-error 1.2.3",
] ]
[[package]] [[package]]
@ -2301,9 +2361,9 @@ dependencies = [
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.5" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" checksum = "3c9613b5a66ab9ba26415184cfc41156594925a9cf3a2057e57f31ff145f6568"
[[package]] [[package]]
name = "safemem" name = "safemem"
@ -2429,14 +2489,14 @@ checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
dependencies = [ dependencies = [
"proc-macro2 1.0.32", "proc-macro2 1.0.32",
"quote 1.0.10", "quote 1.0.10",
"syn 1.0.81", "syn 1.0.82",
] ]
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.68" version = "1.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8" checksum = "d0ffa0837f2dfa6fb90868c2b5468cad482e175f7dad97e7421951e663f2b527"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@ -2537,6 +2597,17 @@ 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 = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
[[package]]
name = "socket2"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e"
dependencies = [
"cfg-if 1.0.0",
"libc",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.4.2" version = "0.4.2"
@ -2598,7 +2669,7 @@ dependencies = [
"quote 1.0.10", "quote 1.0.10",
"serde", "serde",
"serde_derive", "serde_derive",
"syn 1.0.81", "syn 1.0.82",
] ]
[[package]] [[package]]
@ -2614,7 +2685,7 @@ dependencies = [
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"sha1", "sha1",
"syn 1.0.81", "syn 1.0.82",
] ]
[[package]] [[package]]
@ -2668,9 +2739,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.81" version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966" checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59"
dependencies = [ dependencies = [
"proc-macro2 1.0.32", "proc-macro2 1.0.32",
"quote 1.0.10", "quote 1.0.10",
@ -2731,7 +2802,7 @@ checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
dependencies = [ dependencies = [
"proc-macro2 1.0.32", "proc-macro2 1.0.32",
"quote 1.0.10", "quote 1.0.10",
"syn 1.0.81", "syn 1.0.82",
] ]
[[package]] [[package]]
@ -2789,14 +2860,14 @@ dependencies = [
"proc-macro2 1.0.32", "proc-macro2 1.0.32",
"quote 1.0.10", "quote 1.0.10",
"standback", "standback",
"syn 1.0.81", "syn 1.0.82",
] ]
[[package]] [[package]]
name = "tinyvec" name = "tinyvec"
version = "1.5.0" version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f83b2a3d4d9091d0abd7eba4dc2710b1718583bd4d8992e2190720ea38f391f7" checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
dependencies = [ dependencies = [
"tinyvec_macros", "tinyvec_macros",
] ]
@ -2809,9 +2880,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.13.0" version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "588b2d10a336da58d877567cd8fb8a14b463e2104910f8132cd054b4b96e29ee" checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"bytes 1.1.0", "bytes 1.1.0",
@ -2907,7 +2978,7 @@ checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e"
dependencies = [ dependencies = [
"proc-macro2 1.0.32", "proc-macro2 1.0.32",
"quote 1.0.10", "quote 1.0.10",
"syn 1.0.81", "syn 1.0.82",
] ]
[[package]] [[package]]
@ -2925,6 +2996,51 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079"
[[package]]
name = "trust-dns-proto"
version = "0.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad0d7f5db438199a6e2609debe3f69f808d074e0a2888ee0bccb45fe234d03f4"
dependencies = [
"async-trait",
"cfg-if 1.0.0",
"data-encoding",
"enum-as-inner",
"futures-channel",
"futures-io",
"futures-util",
"idna 0.2.3",
"ipnet",
"lazy_static",
"log 0.4.14",
"rand 0.8.4",
"smallvec 1.7.0",
"thiserror",
"tinyvec",
"tokio",
"url 2.2.2",
]
[[package]]
name = "trust-dns-resolver"
version = "0.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6ad17b608a64bd0735e67bde16b0636f8aa8591f831a25d18443ed00a699770"
dependencies = [
"cfg-if 1.0.0",
"futures-util",
"ipconfig",
"lazy_static",
"log 0.4.14",
"lru-cache",
"parking_lot 0.11.2",
"resolv-conf",
"smallvec 1.7.0",
"thiserror",
"tokio",
"trust-dns-proto",
]
[[package]] [[package]]
name = "try-lock" name = "try-lock"
version = "0.2.3" version = "0.2.3"
@ -3017,6 +3133,12 @@ dependencies = [
"tinyvec", "tinyvec",
] ]
[[package]]
name = "unicode-segmentation"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
version = "0.1.0" version = "0.1.0"
@ -3201,7 +3323,7 @@ dependencies = [
"log 0.4.14", "log 0.4.14",
"proc-macro2 1.0.32", "proc-macro2 1.0.32",
"quote 1.0.10", "quote 1.0.10",
"syn 1.0.81", "syn 1.0.82",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -3235,7 +3357,7 @@ checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab"
dependencies = [ dependencies = [
"proc-macro2 1.0.32", "proc-macro2 1.0.32",
"quote 1.0.10", "quote 1.0.10",
"syn 1.0.81", "syn 1.0.82",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -3295,6 +3417,12 @@ dependencies = [
"webpki", "webpki",
] ]
[[package]]
name = "widestring"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c"
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.2.8" version = "0.2.8"
@ -3338,6 +3466,15 @@ 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 = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "winreg"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9"
dependencies = [
"winapi 0.3.9",
]
[[package]] [[package]]
name = "winreg" name = "winreg"
version = "0.7.0" version = "0.7.0"

@ -34,11 +34,11 @@ rocket = { version = "=0.5.0-dev", features = ["tls"], default-features = false
rocket_contrib = "=0.5.0-dev" rocket_contrib = "=0.5.0-dev"
# HTTP client # HTTP client
reqwest = { version = "0.11.6", features = ["blocking", "json", "gzip", "brotli", "socks", "cookies"] } reqwest = { version = "0.11.7", features = ["blocking", "json", "gzip", "brotli", "socks", "cookies", "trust-dns"] }
# Used for custom short lived cookie jar # Used for custom short lived cookie jar
cookie = "0.15.1" cookie = "0.15.1"
cookie_store = "0.15.0" cookie_store = "0.15.1"
bytes = "1.1.0" bytes = "1.1.0"
url = "2.2.2" url = "2.2.2"
@ -56,7 +56,7 @@ chashmap = "2.2.2"
# A generic serialization/deserialization framework # A generic serialization/deserialization framework
serde = { version = "1.0.130", features = ["derive"] } serde = { version = "1.0.130", features = ["derive"] }
serde_json = "1.0.68" serde_json = "1.0.72"
# Logging # Logging
log = "0.4.14" log = "0.4.14"
@ -115,13 +115,13 @@ tracing = { version = "0.1.29", features = ["log"] } # Needed to have lettre tra
lettre = { version = "0.10.0-rc.4", features = ["smtp-transport", "builder", "serde", "native-tls", "hostname", "tracing"], default-features = false } lettre = { version = "0.10.0-rc.4", features = ["smtp-transport", "builder", "serde", "native-tls", "hostname", "tracing"], default-features = false }
# Template library # Template library
handlebars = { version = "4.1.3", features = ["dir_source"] } handlebars = { version = "4.1.5", features = ["dir_source"] }
# For favicon extraction from main website # For favicon extraction from main website
html5ever = "0.25.1" html5ever = "0.25.1"
markup5ever_rcdom = "0.1.0" markup5ever_rcdom = "0.1.0"
regex = { version = "1.5.4", features = ["std", "perf", "unicode-perl"], default-features = false } regex = { version = "1.5.4", features = ["std", "perf", "unicode-perl"], default-features = false }
data-url = "0.1.0" data-url = "0.1.1"
# Used by U2F, JWT and Postgres # Used by U2F, JWT and Postgres
openssl = "0.10.38" openssl = "0.10.38"
@ -138,16 +138,13 @@ pico-args = "0.4.2"
backtrace = "0.3.63" backtrace = "0.3.63"
# Macro ident concatenation # Macro ident concatenation
paste = "1.0.5" paste = "1.0.6"
[patch.crates-io] [patch.crates-io]
# Use newest ring # Use newest ring
rocket = { git = 'https://github.com/SergioBenitez/Rocket', rev = '263e39b5b429de1913ce7e3036575a7b4d88b6d7' } rocket = { git = 'https://github.com/SergioBenitez/Rocket', rev = '263e39b5b429de1913ce7e3036575a7b4d88b6d7' }
rocket_contrib = { git = 'https://github.com/SergioBenitez/Rocket', rev = '263e39b5b429de1913ce7e3036575a7b4d88b6d7' } rocket_contrib = { git = 'https://github.com/SergioBenitez/Rocket', rev = '263e39b5b429de1913ce7e3036575a7b4d88b6d7' }
# For favicon extraction from main website
data-url = { git = 'https://github.com/servo/rust-url', package="data-url", rev = 'eb7330b5296c0d43816d1346211b74182bb4ae37' }
# The maintainer of the `job_scheduler` crate doesn't seem to have responded # The maintainer of the `job_scheduler` crate doesn't seem to have responded
# to any issues or PRs for almost a year (as of April 2021). This hopefully # to any issues or PRs for almost a year (as of April 2021). This hopefully
# temporary fork updates Cargo.toml to use more up-to-date dependencies. # temporary fork updates Cargo.toml to use more up-to-date dependencies.

@ -1,7 +1,7 @@
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use serde::de::DeserializeOwned; use serde::de::DeserializeOwned;
use serde_json::Value; use serde_json::Value;
use std::{env, time::Duration}; use std::env;
use rocket::{ use rocket::{
http::{Cookie, Cookies, SameSite, Status}, http::{Cookie, Cookies, SameSite, Status},
@ -462,13 +462,13 @@ struct GitCommit {
fn get_github_api<T: DeserializeOwned>(url: &str) -> Result<T, Error> { fn get_github_api<T: DeserializeOwned>(url: &str) -> Result<T, Error> {
let github_api = get_reqwest_client(); let github_api = get_reqwest_client();
Ok(github_api.get(url).timeout(Duration::from_secs(10)).send()?.error_for_status()?.json::<T>()?) Ok(github_api.get(url).send()?.error_for_status()?.json::<T>()?)
} }
fn has_http_access() -> bool { fn has_http_access() -> bool {
let http_access = get_reqwest_client(); let http_access = get_reqwest_client();
match http_access.head("https://github.com/dani-garcia/vaultwarden").timeout(Duration::from_secs(10)).send() { match http_access.head("https://github.com/dani-garcia/vaultwarden").send() {
Ok(r) => r.status().is_success(), Ok(r) => r.status().is_success(),
_ => false, _ => false,
} }

@ -108,6 +108,14 @@ fn launch_info() {
} }
fn init_logging(level: log::LevelFilter) -> Result<(), fern::InitError> { fn init_logging(level: log::LevelFilter) -> Result<(), fern::InitError> {
// Depending on the main log level we either want to disable or enable logging for trust-dns.
// Else if there are timeouts it will clutter the logs since trust-dns uses warn for this.
let trust_dns_level = if level >= log::LevelFilter::Debug {
level
} else {
log::LevelFilter::Off
};
let mut logger = fern::Dispatch::new() let mut logger = fern::Dispatch::new()
.level(level) .level(level)
// Hide unknown certificate errors if using self-signed // Hide unknown certificate errors if using self-signed
@ -126,6 +134,8 @@ fn init_logging(level: log::LevelFilter) -> Result<(), fern::InitError> {
.level_for("hyper::client", log::LevelFilter::Off) .level_for("hyper::client", log::LevelFilter::Off)
// Prevent cookie_store logs // Prevent cookie_store logs
.level_for("cookie_store", log::LevelFilter::Off) .level_for("cookie_store", log::LevelFilter::Off)
// Variable level for trust-dns used by reqwest
.level_for("trust_dns_proto", trust_dns_level)
.chain(std::io::stdout()); .chain(std::io::stdout());
// Enable smtp debug logging only specifically for smtp when need. // Enable smtp debug logging only specifically for smtp when need.

@ -1,5 +1,5 @@
/*! /*!
* Native JavaScript for Bootstrap v4.0.6 (https://thednp.github.io/bootstrap.native/) * Native JavaScript for Bootstrap v4.0.8 (https://thednp.github.io/bootstrap.native/)
* Copyright 2015-2021 © dnp_theme * Copyright 2015-2021 © dnp_theme
* Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE)
*/ */
@ -7,7 +7,7 @@
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) : typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BSN = factory()); (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BSN = factory());
}(this, (function () { 'use strict'; })(this, (function () { 'use strict';
const transitionEndEvent = 'webkitTransition' in document.head.style ? 'webkitTransitionEnd' : 'transitionend'; const transitionEndEvent = 'webkitTransition' in document.head.style ? 'webkitTransitionEnd' : 'transitionend';
@ -188,7 +188,7 @@
element.dispatchEvent(closedAlertEvent); element.dispatchEvent(closedAlertEvent);
self.dispose(); self.dispose();
element.parentNode.removeChild(element); element.remove();
} }
// ALERT PRIVATE METHOD // ALERT PRIVATE METHOD
@ -1022,9 +1022,9 @@
function isEmptyAnchor(elem) { function isEmptyAnchor(elem) {
const parentAnchor = elem.closest('A'); const parentAnchor = elem.closest('A');
// anchor href starts with # // anchor href starts with #
return elem && ((elem.href && elem.href.slice(-1) === '#') return elem && ((elem.hasAttribute('href') && elem.href.slice(-1) === '#')
// OR a child of an anchor with href starts with # // OR a child of an anchor with href starts with #
|| (parentAnchor && parentAnchor.href && parentAnchor.href.slice(-1) === '#')); || (parentAnchor && parentAnchor.hasAttribute('href') && parentAnchor.href.slice(-1) === '#'));
} }
function setFocus(element) { function setFocus(element) {
@ -1487,7 +1487,7 @@
function appendOverlay(hasFade, isModal) { function appendOverlay(hasFade, isModal) {
toggleOverlayType(isModal); toggleOverlayType(isModal);
document.body.appendChild(overlay); document.body.append(overlay);
if (hasFade) addClass(overlay, fadeClass); if (hasFade) addClass(overlay, fadeClass);
} }
@ -1501,12 +1501,11 @@
} }
function removeOverlay() { function removeOverlay() {
const bd = document.body;
const currentOpen = getCurrentOpen(); const currentOpen = getCurrentOpen();
if (!currentOpen) { if (!currentOpen) {
removeClass(overlay, fadeClass); removeClass(overlay, fadeClass);
bd.removeChild(overlay); overlay.remove();
resetScrollbar(); resetScrollbar();
} }
} }
@ -1928,7 +1927,7 @@
if ((!element.contains(target) && options.backdrop if ((!element.contains(target) && options.backdrop
&& (!trigger || (trigger && !triggers.includes(trigger)))) && (!trigger || (trigger && !triggers.includes(trigger))))
|| offCanvasDismiss.contains(target)) { || (offCanvasDismiss && offCanvasDismiss.contains(target))) {
self.relatedTarget = target === offCanvasDismiss ? offCanvasDismiss : null; self.relatedTarget = target === offCanvasDismiss ? offCanvasDismiss : null;
self.hide(); self.hide();
} }
@ -2122,19 +2121,6 @@
.some((mediaType) => element instanceof mediaType); .some((mediaType) => element instanceof mediaType);
} }
function closestRelative(element) {
let retval = null;
let el = element;
while (el !== document.body) {
el = el.parentElement;
if (getComputedStyle(el).position === 'relative') {
retval = el;
break;
}
}
return retval;
}
// both popovers and tooltips (this, event) // both popovers and tooltips (this, event)
function styleTip(self, e) { function styleTip(self, e) {
const tipClasses = /\b(top|bottom|start|end)+/; const tipClasses = /\b(top|bottom|start|end)+/;
@ -2148,32 +2134,32 @@
let tipDimensions = { w: tip.offsetWidth, h: tip.offsetHeight }; let tipDimensions = { w: tip.offsetWidth, h: tip.offsetHeight };
const windowWidth = (document.documentElement.clientWidth || document.body.clientWidth); const windowWidth = (document.documentElement.clientWidth || document.body.clientWidth);
const windowHeight = (document.documentElement.clientHeight || document.body.clientHeight); const windowHeight = (document.documentElement.clientHeight || document.body.clientHeight);
const { element, options, arrow } = self; const {
element, options, arrow, positions,
} = self;
let { container, placement } = options; let { container, placement } = options;
let parentIsBody = container === document.body; let parentIsBody = container === document.body;
const targetPosition = getComputedStyle(element).position;
const parentPosition = getComputedStyle(container).position; const { elementPosition, containerIsStatic, relContainer } = positions;
const staticParent = !parentIsBody && parentPosition === 'static'; let { containerIsRelative } = positions;
let relativeParent = !parentIsBody && parentPosition === 'relative';
const relContainer = staticParent && closestRelative(container);
// static containers should refer to another relative container or the body // static containers should refer to another relative container or the body
container = relContainer || container; container = relContainer || container;
relativeParent = staticParent && relContainer ? 1 : relativeParent; containerIsRelative = containerIsStatic && relContainer ? 1 : containerIsRelative;
parentIsBody = container === document.body; parentIsBody = container === document.body;
const parentRect = container.getBoundingClientRect(); const parentRect = container.getBoundingClientRect();
const leftBoundry = relativeParent ? parentRect.left : 0; const leftBoundry = containerIsRelative ? parentRect.left : 0;
const rightBoundry = relativeParent ? parentRect.right : windowWidth; const rightBoundry = containerIsRelative ? parentRect.right : windowWidth;
// this case should not be possible // this case should not be possible
// absoluteParent = !parentIsBody && parentPosition === 'absolute', // containerIsAbsolute = !parentIsBody && containerPosition === 'absolute',
// this case requires a container with placement: relative // this case requires a container with position: relative
const absoluteTarget = targetPosition === 'absolute'; const absoluteTarget = elementPosition === 'absolute';
const targetRect = element.getBoundingClientRect(); const targetRect = element.getBoundingClientRect();
const scroll = parentIsBody const scroll = parentIsBody
? { x: window.pageXOffset, y: window.pageYOffset } ? { x: window.pageXOffset, y: window.pageYOffset }
: { x: container.scrollLeft, y: container.scrollTop }; : { x: container.scrollLeft, y: container.scrollTop };
const elemDimensions = { w: element.offsetWidth, h: element.offsetHeight }; const elemDimensions = { w: element.offsetWidth, h: element.offsetHeight };
const top = relativeParent ? element.offsetTop : targetRect.top; const top = containerIsRelative ? element.offsetTop : targetRect.top;
const left = relativeParent ? element.offsetLeft : targetRect.left; const left = containerIsRelative ? element.offsetLeft : targetRect.left;
// reset arrow style // reset arrow style
arrow.style.top = ''; arrow.style.top = '';
arrow.style.left = ''; arrow.style.left = '';
@ -2245,8 +2231,12 @@
} }
} else if (['top', 'bottom'].includes(placement)) { } else if (['top', 'bottom'].includes(placement)) {
if (e && isMedia(element)) { if (e && isMedia(element)) {
const eX = !relativeParent ? e.pageX : e.layerX + (absoluteTarget ? element.offsetLeft : 0); const eX = !containerIsRelative
const eY = !relativeParent ? e.pageY : e.layerY + (absoluteTarget ? element.offsetTop : 0); ? e.pageX
: e.layerX + (absoluteTarget ? element.offsetLeft : 0);
const eY = !containerIsRelative
? e.pageY
: e.layerY + (absoluteTarget ? element.offsetTop : 0);
if (placement === 'top') { if (placement === 'top') {
topPosition = eY - tipDimensions.h - (isPopover ? arrowWidth : arrowHeight); topPosition = eY - tipDimensions.h - (isPopover ? arrowWidth : arrowHeight);
@ -2323,6 +2313,36 @@
return modal || navbarFixed || document.body; return modal || navbarFixed || document.body;
} }
function closestRelative(element) {
let retval = null;
let el = element;
while (el !== document.body) {
el = el.parentElement;
if (getComputedStyle(el).position === 'relative') {
retval = el;
break;
}
}
return retval;
}
function setHtml(element, content, sanitizeFn) {
if (typeof content === 'string' && !content.length) return;
if (typeof content === 'object') {
element.append(content);
} else {
let dirty = content.trim(); // fixing #233
if (typeof sanitizeFn === 'function') dirty = sanitizeFn(dirty);
const domParser = new DOMParser();
const tempDocument = domParser.parseFromString(dirty, 'text/html');
const method = tempDocument.children.length ? 'innerHTML' : 'innerText';
element[method] = tempDocument.body[method];
}
}
/* Native JavaScript for Bootstrap 5 | Popover /* Native JavaScript for Bootstrap 5 | Popover
---------------------------------------------- */ ---------------------------------------------- */
@ -2335,12 +2355,13 @@
template: '<div class="popover" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>', // string template: '<div class="popover" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>', // string
title: null, // string title: null, // string
content: null, // string content: null, // string
sanitizeFn: null, // function
customClass: null, // string customClass: null, // string
dismissible: false, // boolean
animation: true, // boolean
trigger: 'hover', // string trigger: 'hover', // string
placement: 'top', // string placement: 'top', // string
btnClose: '<button class="btn-close" aria-label="Close"></button>', // string
sanitizeFn: null, // function
dismissible: false, // boolean
animation: true, // boolean
delay: 200, // number delay: 200, // number
}; };
@ -2350,11 +2371,8 @@
const isIphone = navigator.userAgentData const isIphone = navigator.userAgentData
? navigator.userAgentData.brands.some((x) => appleBrands.test(x.brand)) ? navigator.userAgentData.brands.some((x) => appleBrands.test(x.brand))
: appleBrands.test(navigator.userAgent); : appleBrands.test(navigator.userAgent);
// popoverArrowClass = `${popoverString}-arrow`,
const popoverHeaderClass = `${popoverString}-header`; const popoverHeaderClass = `${popoverString}-header`;
const popoverBodyClass = `${popoverString}-body`; const popoverBodyClass = `${popoverString}-body`;
// close btn for dissmissible popover
let popoverCloseButton = '<button type="button" class="btn-close"></button>';
// POPOVER CUSTOM EVENTS // POPOVER CUSTOM EVENTS
// ===================== // =====================
@ -2387,51 +2405,59 @@
const { const {
animation, customClass, sanitizeFn, placement, dismissible, animation, customClass, sanitizeFn, placement, dismissible,
} = options; } = options;
let { title, content, template } = options; let {
title, content,
} = options;
const {
template, btnClose,
} = options;
// set initial popover class // set initial popover class
const placementClass = `bs-${popoverString}-${tipClassPositions[placement]}`; const placementClass = `bs-${popoverString}-${tipClassPositions[placement]}`;
// fixing #233 // load template
title = title ? title.trim() : null; let popoverTemplate;
content = content ? content.trim() : null; if (typeof template === 'object') {
popoverTemplate = template;
// sanitize title && content } else {
if (sanitizeFn) { const htmlMarkup = document.createElement('div');
title = title ? sanitizeFn(title) : null; setHtml(htmlMarkup, template, sanitizeFn);
content = content ? sanitizeFn(content) : null; popoverTemplate = htmlMarkup.firstChild;
template = template ? sanitizeFn(template) : null;
popoverCloseButton = sanitizeFn(popoverCloseButton);
} }
// set popover markup
self.popover = popoverTemplate.cloneNode(true);
self.popover = document.createElement('div');
const { popover } = self; const { popover } = self;
// set id and aria-describedby // set id and role attributes
popover.setAttribute('id', id); popover.setAttribute('id', id);
popover.setAttribute('role', 'tooltip'); popover.setAttribute('role', 'tooltip');
// load template
const popoverTemplate = document.createElement('div');
popoverTemplate.innerHTML = template.trim();
popover.className = popoverTemplate.firstChild.className;
popover.innerHTML = popoverTemplate.firstChild.innerHTML;
const popoverHeader = queryElement(`.${popoverHeaderClass}`, popover); const popoverHeader = queryElement(`.${popoverHeaderClass}`, popover);
const popoverBody = queryElement(`.${popoverBodyClass}`, popover); const popoverBody = queryElement(`.${popoverBodyClass}`, popover);
// set arrow // set arrow and enable access for styleTip
self.arrow = queryElement(`.${popoverString}-arrow`, popover); self.arrow = queryElement(`.${popoverString}-arrow`, popover);
// set dismissible button // set dismissible button
if (dismissible) { if (dismissible) {
title = title ? title + popoverCloseButton : title; if (title) {
content = title === null ? +popoverCloseButton : content; if (title instanceof Element) setHtml(title, btnClose, sanitizeFn);
else title += btnClose;
} else {
if (popoverHeader) popoverHeader.remove();
if (content instanceof Element) setHtml(content, btnClose, sanitizeFn);
else content += btnClose;
}
} }
// fill the template with content from data attributes // fill the template with content from options / data attributes
if (title && popoverHeader) popoverHeader.innerHTML = title.trim(); // also sanitize title && content
if (content && popoverBody) popoverBody.innerHTML = content.trim(); if (title && popoverHeader) setHtml(popoverHeader, title, sanitizeFn);
if (content && popoverBody) setHtml(popoverBody, content, sanitizeFn);
// set btn and enable access for styleTip
[self.btn] = popover.getElementsByClassName('btn-close');
// set popover animation and placement // set popover animation and placement
if (!hasClass(popover, popoverString)) addClass(popover, popoverString); if (!hasClass(popover, popoverString)) addClass(popover, popoverString);
@ -2443,9 +2469,9 @@
} }
function removePopover(self) { function removePopover(self) {
const { element, popover, options } = self; const { element, popover } = self;
element.removeAttribute(ariaDescribedBy); element.removeAttribute(ariaDescribedBy);
options.container.removeChild(popover); popover.remove();
self.timer = null; self.timer = null;
} }
@ -2470,12 +2496,11 @@
function dismissHandlerToggle(self, add) { function dismissHandlerToggle(self, add) {
const action = add ? addEventListener : removeEventListener; const action = add ? addEventListener : removeEventListener;
const { options, element, popover } = self; const { options, element, btn } = self;
const { trigger, dismissible } = options; const { trigger, dismissible } = options;
if (dismissible) { if (dismissible) {
const [btnClose] = popover.getElementsByClassName('btn-close'); if (btn) btn[action]('click', self.hide);
if (btnClose) btnClose[action]('click', self.hide);
} else { } else {
if (trigger === 'focus') element[action]('focusout', self.hide); if (trigger === 'focus') element[action]('focusout', self.hide);
if (trigger === 'hover') document[action]('touchstart', popoverTouchHandler, passiveHandler); if (trigger === 'hover') document[action]('touchstart', popoverTouchHandler, passiveHandler);
@ -2488,12 +2513,10 @@
} }
function popoverShowTrigger(self) { function popoverShowTrigger(self) {
dismissHandlerToggle(self, 1);
self.element.dispatchEvent(shownPopoverEvent); self.element.dispatchEvent(shownPopoverEvent);
} }
function popoverHideTrigger(self) { function popoverHideTrigger(self) {
dismissHandlerToggle(self);
removePopover(self); removePopover(self);
self.element.dispatchEvent(hiddenPopoverEvent); self.element.dispatchEvent(hiddenPopoverEvent);
} }
@ -2514,6 +2537,7 @@
self.timer = null; self.timer = null;
self.popover = null; self.popover = null;
self.arrow = null; self.arrow = null;
self.btn = null;
self.enabled = false; self.enabled = false;
// set unique ID for aria-describedby // set unique ID for aria-describedby
self.id = `${popoverString}-${getUID(element)}`; self.id = `${popoverString}-${getUID(element)}`;
@ -2535,6 +2559,21 @@
// crate popover // crate popover
createPopover(self); createPopover(self);
// set positions
const { container } = self.options;
const elementPosition = getComputedStyle(element).position;
const containerPosition = getComputedStyle(container).position;
const parentIsBody = container === document.body;
const containerIsStatic = !parentIsBody && containerPosition === 'static';
const containerIsRelative = !parentIsBody && containerPosition === 'relative';
const relContainer = containerIsStatic && closestRelative(container);
self.positions = {
elementPosition,
containerIsRelative,
containerIsStatic,
relContainer,
};
// bind // bind
self.update = self.update.bind(self); self.update = self.update.bind(self);
@ -2563,23 +2602,21 @@
const { container } = options; const { container } = options;
clearTimeout(self.timer); clearTimeout(self.timer);
self.timer = setTimeout(() => {
if (!isVisibleTip(popover, container)) { if (!isVisibleTip(popover, container)) {
element.dispatchEvent(showPopoverEvent); element.dispatchEvent(showPopoverEvent);
if (showPopoverEvent.defaultPrevented) return; if (showPopoverEvent.defaultPrevented) return;
// append to the container // append to the container
container.appendChild(popover); container.append(popover);
element.setAttribute(ariaDescribedBy, id); element.setAttribute(ariaDescribedBy, id);
self.update(e); self.update(e);
if (!hasClass(popover, showClass)) addClass(popover, showClass); if (!hasClass(popover, showClass)) addClass(popover, showClass);
dismissHandlerToggle(self, 1);
if (options.animation) emulateTransitionEnd(popover, () => popoverShowTrigger(self)); if (options.animation) emulateTransitionEnd(popover, () => popoverShowTrigger(self));
else popoverShowTrigger(self); else popoverShowTrigger(self);
} }
}, 17);
} }
hide(e) { hide(e) {
@ -2596,13 +2633,13 @@
const { element, popover, options } = self; const { element, popover, options } = self;
clearTimeout(self.timer); clearTimeout(self.timer);
self.timer = setTimeout(() => { self.timer = setTimeout(() => {
if (isVisibleTip(popover, options.container)) { if (isVisibleTip(popover, options.container)) {
element.dispatchEvent(hidePopoverEvent); element.dispatchEvent(hidePopoverEvent);
if (hidePopoverEvent.defaultPrevented) return; if (hidePopoverEvent.defaultPrevented) return;
removeClass(popover, showClass); removeClass(popover, showClass);
dismissHandlerToggle(self);
if (options.animation) emulateTransitionEnd(popover, () => popoverHideTrigger(self)); if (options.animation) emulateTransitionEnd(popover, () => popoverHideTrigger(self));
else popoverHideTrigger(self); else popoverHideTrigger(self);
@ -2648,7 +2685,7 @@
const { popover, options } = self; const { popover, options } = self;
const { container, animation } = options; const { container, animation } = options;
if (animation && isVisibleTip(popover, container)) { if (animation && isVisibleTip(popover, container)) {
options.delay = 0; // reset delay self.options.delay = 0; // reset delay
self.hide(); self.hide();
emulateTransitionEnd(popover, () => togglePopoverHandlers(self)); emulateTransitionEnd(popover, () => togglePopoverHandlers(self));
} else { } else {
@ -3067,7 +3104,7 @@
const toastSelector = `.${toastString}`; const toastSelector = `.${toastString}`;
const toastDismissSelector = `[${dataBsDismiss}="${toastString}"]`; const toastDismissSelector = `[${dataBsDismiss}="${toastString}"]`;
const showingClass = 'showing'; const showingClass = 'showing';
const hideClass = 'hide'; const hideClass = 'hide'; // marked as deprecated
const toastDefaultOptions = { const toastDefaultOptions = {
animation: true, animation: true,
autohide: true, autohide: true,
@ -3085,10 +3122,7 @@
// ===================== // =====================
function showToastComplete(self) { function showToastComplete(self) {
const { element, options } = self; const { element, options } = self;
if (!options.animation) {
removeClass(element, showingClass); removeClass(element, showingClass);
addClass(element, showClass);
}
element.dispatchEvent(shownToastEvent); element.dispatchEvent(shownToastEvent);
if (options.autohide) self.hide(); if (options.autohide) self.hide();
@ -3096,13 +3130,15 @@
function hideToastComplete(self) { function hideToastComplete(self) {
const { element } = self; const { element } = self;
addClass(element, hideClass); removeClass(element, showingClass);
removeClass(element, showClass);
addClass(element, hideClass); // B/C
element.dispatchEvent(hiddenToastEvent); element.dispatchEvent(hiddenToastEvent);
} }
function closeToast(self) { function hideToast(self) {
const { element, options } = self; const { element, options } = self;
removeClass(element, showClass); addClass(element, showingClass);
if (options.animation) { if (options.animation) {
reflow(element); reflow(element);
@ -3112,15 +3148,14 @@
} }
} }
function openToast(self) { function showToast(self) {
const { element, options } = self; const { element, options } = self;
removeClass(element, hideClass); removeClass(element, hideClass); // B/C
if (options.animation) {
reflow(element); reflow(element);
addClass(element, showingClass);
addClass(element, showClass); addClass(element, showClass);
addClass(element, showingClass);
if (options.animation) {
emulateTransitionEnd(element, () => showToastComplete(self)); emulateTransitionEnd(element, () => showToastComplete(self));
} else { } else {
showToastComplete(self); showToastComplete(self);
@ -3148,9 +3183,13 @@
super(toastComponent, target, toastDefaultOptions, config); super(toastComponent, target, toastDefaultOptions, config);
// bind // bind
const self = this; const self = this;
const { element, options } = self;
// set fadeClass, the options.animation will override the markup
if (options.animation && !hasClass(element, fadeClass)) addClass(element, fadeClass);
else if (!options.animation && hasClass(element, fadeClass)) removeClass(element, fadeClass);
// dismiss button // dismiss button
self.dismiss = queryElement(toastDismissSelector, self.element); self.dismiss = queryElement(toastDismissSelector, element);
// bind // bind
self.show = self.show.bind(self); self.show = self.show.bind(self);
@ -3165,13 +3204,12 @@
show() { show() {
const self = this; const self = this;
const { element } = self; const { element } = self;
if (element && hasClass(element, hideClass)) { if (element && !hasClass(element, showClass)) {
element.dispatchEvent(showToastEvent); element.dispatchEvent(showToastEvent);
if (showToastEvent.defaultPrevented) return; if (showToastEvent.defaultPrevented) return;
addClass(element, fadeClass);
clearTimeout(self.timer); clearTimeout(self.timer);
self.timer = setTimeout(() => openToast(self), 10); self.timer = setTimeout(() => showToast(self), 10);
} }
} }
@ -3184,7 +3222,7 @@
if (hideToastEvent.defaultPrevented) return; if (hideToastEvent.defaultPrevented) return;
clearTimeout(self.timer); clearTimeout(self.timer);
self.timer = setTimeout(() => closeToast(self), self.timer = setTimeout(() => hideToast(self),
noTimer ? 10 : options.delay); noTimer ? 10 : options.delay);
} }
} }
@ -3192,7 +3230,7 @@
dispose() { dispose() {
const self = this; const self = this;
const { element, options } = self; const { element, options } = self;
self.hide(); self.hide(1);
if (options.animation) emulateTransitionEnd(element, () => completeDisposeToast(self)); if (options.animation) emulateTransitionEnd(element, () => completeDisposeToast(self));
else completeDisposeToast(self); else completeDisposeToast(self);
@ -3221,13 +3259,14 @@
const titleAttr = 'title'; const titleAttr = 'title';
const tooltipInnerClass = `${tooltipString}-inner`; const tooltipInnerClass = `${tooltipString}-inner`;
const tooltipDefaultOptions = { const tooltipDefaultOptions = {
title: null,
template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
placement: 'top', title: null, // string
animation: true, customClass: null, // string | null
customClass: null, placement: 'top', // string
delay: 200, sanitizeFn: null, // function
sanitizeFn: null, animation: true, // bool
html: false, // bool
delay: 200, // number
}; };
// TOOLTIP CUSTOM EVENTS // TOOLTIP CUSTOM EVENTS
@ -3241,51 +3280,48 @@
// ======================= // =======================
function createTooltip(self) { function createTooltip(self) {
const { options, id } = self; const { options, id } = self;
const placementClass = `bs-${tooltipString}-${tipClassPositions[options.placement]}`; const {
let titleString = options.title.trim(); title, template, customClass, animation, placement, sanitizeFn,
} = options;
const placementClass = `bs-${tooltipString}-${tipClassPositions[placement]}`;
// sanitize stuff if (!title) return;
if (options.sanitizeFn) {
titleString = options.sanitizeFn(titleString);
options.template = options.sanitizeFn(options.template);
}
if (!titleString) return; // load template
let tooltipTemplate;
if (typeof template === 'object') {
tooltipTemplate = template;
} else {
const htmlMarkup = document.createElement('div');
setHtml(htmlMarkup, template, sanitizeFn);
tooltipTemplate = htmlMarkup.firstChild;
}
// create tooltip // create tooltip
self.tooltip = document.createElement('div'); self.tooltip = tooltipTemplate.cloneNode(true);
const { tooltip } = self; const { tooltip } = self;
// set title
// set aria setHtml(queryElement(`.${tooltipInnerClass}`, tooltip), title, sanitizeFn);
// set id & role attribute
tooltip.setAttribute('id', id); tooltip.setAttribute('id', id);
tooltip.setAttribute('role', tooltipString);
// set markup
const tooltipMarkup = document.createElement('div');
tooltipMarkup.innerHTML = options.template.trim();
tooltip.className = tooltipMarkup.firstChild.className;
tooltip.innerHTML = tooltipMarkup.firstChild.innerHTML;
queryElement(`.${tooltipInnerClass}`, tooltip).innerHTML = titleString;
// set arrow // set arrow
self.arrow = queryElement(`.${tooltipString}-arrow`, tooltip); self.arrow = queryElement(`.${tooltipString}-arrow`, tooltip);
// set class and role attribute
tooltip.setAttribute('role', tooltipString);
// set classes // set classes
if (!hasClass(tooltip, tooltipString)) addClass(tooltip, tooltipString); if (!hasClass(tooltip, tooltipString)) addClass(tooltip, tooltipString);
if (options.animation && !hasClass(tooltip, fadeClass)) addClass(tooltip, fadeClass); if (animation && !hasClass(tooltip, fadeClass)) addClass(tooltip, fadeClass);
if (options.customClass && !hasClass(tooltip, options.customClass)) { if (customClass && !hasClass(tooltip, customClass)) {
addClass(tooltip, options.customClass); addClass(tooltip, customClass);
} }
if (!hasClass(tooltip, placementClass)) addClass(tooltip, placementClass); if (!hasClass(tooltip, placementClass)) addClass(tooltip, placementClass);
} }
function removeTooltip(self) { function removeTooltip(self) {
const { element, options, tooltip } = self; const { element, tooltip } = self;
element.removeAttribute(ariaDescribedBy); element.removeAttribute(ariaDescribedBy);
options.container.removeChild(tooltip); tooltip.remove();
self.timer = null; self.timer = null;
} }
@ -3387,6 +3423,21 @@
self.id = `${tooltipString}-${getUID(element)}`; self.id = `${tooltipString}-${getUID(element)}`;
createTooltip(self); createTooltip(self);
// set positions
const { container } = self.options;
const elementPosition = getComputedStyle(element).position;
const containerPosition = getComputedStyle(container).position;
const parentIsBody = container === document.body;
const containerIsStatic = !parentIsBody && containerPosition === 'static';
const containerIsRelative = !parentIsBody && containerPosition === 'relative';
const relContainer = containerIsStatic && closestRelative(container);
self.positions = {
elementPosition,
containerIsRelative,
containerIsStatic,
relContainer,
};
// attach events // attach events
toggleTooltipHandlers(self, 1); toggleTooltipHandlers(self, 1);
} }
@ -3398,22 +3449,23 @@
const { const {
options, tooltip, element, id, options, tooltip, element, id,
} = self; } = self;
const {
container, animation,
} = options;
clearTimeout(self.timer); clearTimeout(self.timer);
self.timer = setTimeout(() => { if (!isVisibleTip(tooltip, container)) {
if (!isVisibleTip(tooltip, options.container)) {
element.dispatchEvent(showTooltipEvent); element.dispatchEvent(showTooltipEvent);
if (showTooltipEvent.defaultPrevented) return; if (showTooltipEvent.defaultPrevented) return;
// append to container // append to container
options.container.appendChild(tooltip); container.append(tooltip);
element.setAttribute(ariaDescribedBy, id); element.setAttribute(ariaDescribedBy, id);
self.update(e); self.update(e);
if (!hasClass(tooltip, showClass)) addClass(tooltip, showClass); if (!hasClass(tooltip, showClass)) addClass(tooltip, showClass);
if (options.animation) emulateTransitionEnd(tooltip, () => tooltipShownAction(self)); if (animation) emulateTransitionEnd(tooltip, () => tooltipShownAction(self));
else tooltipShownAction(self); else tooltipShownAction(self);
} }
}, 20);
} }
hide(e) { hide(e) {
@ -3498,20 +3550,9 @@
constructor: Tooltip, constructor: Tooltip,
}; };
var version = "4.0.6"; var version = "4.0.8";
// import { alertInit } from '../components/alert-native.js'; const Version = version;
// import { buttonInit } from '../components/button-native.js';
// import { carouselInit } from '../components/carousel-native.js';
// import { collapseInit } from '../components/collapse-native.js';
// import { dropdownInit } from '../components/dropdown-native.js';
// import { modalInit } from '../components/modal-native.js';
// import { offcanvasInit } from '../components/offcanvas-native.js';
// import { popoverInit } from '../components/popover-native.js';
// import { scrollSpyInit } from '../components/scrollspy-native.js';
// import { tabInit } from '../components/tab-native.js';
// import { toastInit } from '../components/toast-native.js';
// import { tooltipInit } from '../components/tooltip-native.js';
const componentsInit = { const componentsInit = {
Alert: Alert.init, Alert: Alert.init,
@ -3547,7 +3588,7 @@
document.addEventListener('DOMContentLoaded', () => initCallback(), { once: true }); document.addEventListener('DOMContentLoaded', () => initCallback(), { once: true });
} }
var index = { const BSN = {
Alert, Alert,
Button, Button,
Carousel, Carousel,
@ -3562,9 +3603,9 @@
Tooltip, Tooltip,
initCallback, initCallback,
Version: version, Version,
}; };
return index; return BSN;
}))); }));

File diff suppressed because it is too large Load Diff

@ -4,10 +4,10 @@
* *
* To rebuild or modify this file with the latest versions of the included * To rebuild or modify this file with the latest versions of the included
* software please visit: * software please visit:
* https://datatables.net/download/#bs5/dt-1.11.2 * https://datatables.net/download/#bs5/dt-1.11.3
* *
* Included libraries: * Included libraries:
* DataTables 1.11.2 * DataTables 1.11.3
*/ */
@charset "UTF-8"; @charset "UTF-8";

@ -4,20 +4,20 @@
* *
* To rebuild or modify this file with the latest versions of the included * To rebuild or modify this file with the latest versions of the included
* software please visit: * software please visit:
* https://datatables.net/download/#bs5/dt-1.11.2 * https://datatables.net/download/#bs5/dt-1.11.3
* *
* Included libraries: * Included libraries:
* DataTables 1.11.2 * DataTables 1.11.3
*/ */
/*! DataTables 1.11.2 /*! DataTables 1.11.3
* ©2008-2021 SpryMedia Ltd - datatables.net/license * ©2008-2021 SpryMedia Ltd - datatables.net/license
*/ */
/** /**
* @summary DataTables * @summary DataTables
* @description Paginate, search and order HTML tables * @description Paginate, search and order HTML tables
* @version 1.11.2 * @version 1.11.3
* @file jquery.dataTables.js * @file jquery.dataTables.js
* @author SpryMedia Ltd * @author SpryMedia Ltd
* @contact www.datatables.net * @contact www.datatables.net
@ -1626,6 +1626,14 @@
return out; return out;
} }
var _includes = function (search, start) {
if (start === undefined) {
start = 0;
}
return this.indexOf(search, start) !== -1;
};
// Array.isArray polyfill. // Array.isArray polyfill.
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
if (! Array.isArray) { if (! Array.isArray) {
@ -1634,6 +1642,10 @@
}; };
} }
if (! Array.prototype.includes) {
Array.prototype.includes = _includes;
}
// .trim() polyfill // .trim() polyfill
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim
if (!String.prototype.trim) { if (!String.prototype.trim) {
@ -1642,6 +1654,10 @@
}; };
} }
if (! String.prototype.includes) {
String.prototype.includes = _includes;
}
/** /**
* DataTables utility methods * DataTables utility methods
* *
@ -2808,9 +2824,18 @@
return cellData.call( rowData ); return cellData.call( rowData );
} }
if ( cellData === null && type == 'display' ) { if ( cellData === null && type === 'display' ) {
return ''; return '';
} }
if ( type === 'filter' ) {
var fomatters = DataTable.ext.type.search;
if ( fomatters[ col.sType ] ) {
cellData = fomatters[ col.sType ]( cellData );
}
}
return cellData; return cellData;
} }
@ -4565,7 +4590,6 @@
var columns = settings.aoColumns; var columns = settings.aoColumns;
var column; var column;
var i, j, ien, jen, filterData, cellData, row; var i, j, ien, jen, filterData, cellData, row;
var fomatters = DataTable.ext.type.search;
var wasInvalidated = false; var wasInvalidated = false;
for ( i=0, ien=settings.aoData.length ; i<ien ; i++ ) { for ( i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
@ -4580,10 +4604,6 @@
if ( column.bSearchable ) { if ( column.bSearchable ) {
cellData = _fnGetCellData( settings, i, j, 'filter' ); cellData = _fnGetCellData( settings, i, j, 'filter' );
if ( fomatters[ column.sType ] ) {
cellData = fomatters[ column.sType ]( cellData );
}
// Search in DataTables 1.10 is string based. In 1.11 this // Search in DataTables 1.10 is string based. In 1.11 this
// should be altered to also allow strict type checking. // should be altered to also allow strict type checking.
if ( cellData === null ) { if ( cellData === null ) {
@ -6374,6 +6394,10 @@
*/ */
function _fnSaveState ( settings ) function _fnSaveState ( settings )
{ {
if (settings._bLoadingState) {
return;
}
/* Store the interesting variables */ /* Store the interesting variables */
var state = { var state = {
time: +new Date(), time: +new Date(),
@ -6408,10 +6432,36 @@
*/ */
function _fnLoadState ( settings, oInit, callback ) function _fnLoadState ( settings, oInit, callback )
{ {
if ( ! settings.oFeatures.bStateSave ) {
callback();
return;
}
var loaded = function(state) {
_fnImplementState(settings, state, callback);
}
var state = settings.fnStateLoadCallback.call( settings.oInstance, settings, loaded );
if ( state !== undefined ) {
_fnImplementState( settings, state, callback );
}
// otherwise, wait for the loaded callback to be executed
return true;
}
function _fnImplementState ( settings, s, callback) {
var i, ien; var i, ien;
var columns = settings.aoColumns; var columns = settings.aoColumns;
var loaded = function ( s ) { settings._bLoadingState = true;
// When StateRestore was introduced the state could now be implemented at any time
// Not just initialisation. To do this an api instance is required in some places
var api = settings._bInitComplete ? new DataTable.Api(settings) : null;
if ( ! s || ! s.time ) { if ( ! s || ! s.time ) {
settings._bLoadingState = false;
callback(); callback();
return; return;
} }
@ -6420,6 +6470,7 @@
// cancelling of loading by returning false // cancelling of loading by returning false
var abStateLoad = _fnCallbackFire( settings, 'aoStateLoadParams', 'stateLoadParams', [settings, s] ); var abStateLoad = _fnCallbackFire( settings, 'aoStateLoadParams', 'stateLoadParams', [settings, s] );
if ( $.inArray( false, abStateLoad ) !== -1 ) { if ( $.inArray( false, abStateLoad ) !== -1 ) {
settings._bLoadingState = false;
callback(); callback();
return; return;
} }
@ -6427,12 +6478,14 @@
// Reject old data // Reject old data
var duration = settings.iStateDuration; var duration = settings.iStateDuration;
if ( duration > 0 && s.time < +new Date() - (duration*1000) ) { if ( duration > 0 && s.time < +new Date() - (duration*1000) ) {
settings._bLoadingState = false;
callback(); callback();
return; return;
} }
// Number of columns have changed - all bets are off, no restore of settings // Number of columns have changed - all bets are off, no restore of settings
if ( s.columns && columns.length !== s.columns.length ) { if ( s.columns && columns.length !== s.columns.length ) {
settings._bLoadingState = false;
callback(); callback();
return; return;
} }
@ -6444,8 +6497,10 @@
// subscribed events // subscribed events
if ( s.start !== undefined ) { if ( s.start !== undefined ) {
settings._iDisplayStart = s.start; settings._iDisplayStart = s.start;
if(api === null) {
settings.iInitDisplayStart = s.start; settings.iInitDisplayStart = s.start;
} }
}
if ( s.length !== undefined ) { if ( s.length !== undefined ) {
settings._iDisplayLength = s.length; settings._iDisplayLength = s.length;
} }
@ -6467,40 +6522,39 @@
} }
// Columns // Columns
//
if ( s.columns ) { if ( s.columns ) {
for ( i=0, ien=s.columns.length ; i<ien ; i++ ) { for ( i=0, ien=s.columns.length ; i<ien ; i++ ) {
var col = s.columns[i]; var col = s.columns[i];
// Visibility // Visibility
if ( col.visible !== undefined ) { if ( col.visible !== undefined ) {
// If the api is defined, the table has been initialised so we need to use it rather than internal settings
if (api) {
// Don't redraw the columns on every iteration of this loop, we will do this at the end instead
api.column(i).visible(col.visible, false);
}
else {
columns[i].bVisible = col.visible; columns[i].bVisible = col.visible;
} }
}
// Search // Search
if ( col.search !== undefined ) { if ( col.search !== undefined ) {
$.extend( settings.aoPreSearchCols[i], _fnSearchToHung( col.search ) ); $.extend( settings.aoPreSearchCols[i], _fnSearchToHung( col.search ) );
} }
} }
// If the api is defined then we need to adjust the columns once the visibility has been changed
if (api) {
api.columns.adjust();
}
} }
settings._bLoadingState = false;
_fnCallbackFire( settings, 'aoStateLoaded', 'stateLoaded', [settings, s] ); _fnCallbackFire( settings, 'aoStateLoaded', 'stateLoaded', [settings, s] );
callback(); callback();
}; };
if ( ! settings.oFeatures.bStateSave ) {
callback();
return;
}
var state = settings.fnStateLoadCallback.call( settings.oInstance, settings, loaded );
if ( state !== undefined ) {
loaded( state );
}
// otherwise, wait for the loaded callback to be executed
}
/** /**
* Return the settings object for a particular table * Return the settings object for a particular table
@ -9590,7 +9644,7 @@
* @type string * @type string
* @default Version number * @default Version number
*/ */
DataTable.version = "1.11.2"; DataTable.version = "1.11.3";
/** /**
* Private data store, containing all of the settings objects that are * Private data store, containing all of the settings objects that are
@ -14015,7 +14069,7 @@
* *
* @type string * @type string
*/ */
build:"bs5/dt-1.11.2", build:"bs5/dt-1.11.3",
/** /**
@ -15048,6 +15102,10 @@
*/ */
var __htmlEscapeEntities = function ( d ) { var __htmlEscapeEntities = function ( d ) {
if (Array.isArray(d)) {
d = d.join(',');
}
return typeof d === 'string' ? return typeof d === 'string' ?
d d
.replace(/&/g, '&amp;') .replace(/&/g, '&amp;')
@ -15242,6 +15300,7 @@
_fnSortData: _fnSortData, _fnSortData: _fnSortData,
_fnSaveState: _fnSaveState, _fnSaveState: _fnSaveState,
_fnLoadState: _fnLoadState, _fnLoadState: _fnLoadState,
_fnImplementState: _fnImplementState,
_fnSettingsFromNode: _fnSettingsFromNode, _fnSettingsFromNode: _fnSettingsFromNode,
_fnLog: _fnLog, _fnLog: _fnLog,
_fnMap: _fnMap, _fnMap: _fnMap,

@ -150,7 +150,7 @@
<dt class="col-sm-5">Domain configuration <dt class="col-sm-5">Domain configuration
<span class="badge bg-success d-none" id="domain-success" title="The domain variable matches the browser location and seems to be configured correctly.">Match</span> <span class="badge bg-success d-none" id="domain-success" title="The domain variable matches the browser location and seems to be configured correctly.">Match</span>
<span class="badge bg-danger d-none" id="domain-warning" title="The domain variable does not matches the browsers location.&#013;&#010;The domain variable does not seem to be configured correctly.&#013;&#010;Some features may not work as expected!">No Match</span> <span class="badge bg-danger d-none" id="domain-warning" title="The domain variable does not match the browser location.&#013;&#010;The domain variable does not seem to be configured correctly.&#013;&#010;Some features may not work as expected!">No Match</span>
<span class="badge bg-success d-none" id="https-success" title="Configurued to use HTTPS">HTTPS</span> <span class="badge bg-success d-none" id="https-success" title="Configurued to use HTTPS">HTTPS</span>
<span class="badge bg-danger d-none" id="https-warning" title="Not configured to use HTTPS.&#013;&#010;Some features may not work as expected!">No HTTPS</span> <span class="badge bg-danger d-none" id="https-warning" title="Not configured to use HTTPS.&#013;&#010;Some features may not work as expected!">No HTTPS</span>
</dt> </dt>

Loading…
Cancel
Save