Browse Source

Update Rust, Crates and other deps (#5709)

- Updated Rust to v1.85.1
- Updated crates and fixed breaking changes
- Updated datatables js
- Updated GitHub Actions

Signed-off-by: BlackDex <black.dex@gmail.com>
main
Mathijs van Veluw 1 day ago
committed by GitHub
parent
commit
8dfe805954
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      .github/workflows/build.yml
  2. 2
      .github/workflows/hadolint.yml
  3. 28
      .github/workflows/release.yml
  4. 2
      .github/workflows/trivy.yml
  5. 2
      .pre-commit-config.yaml
  6. 277
      Cargo.lock
  7. 8
      Cargo.toml
  8. 2
      docker/DockerSettings.yaml
  9. 8
      docker/Dockerfile.alpine
  10. 2
      docker/Dockerfile.debian
  11. 2
      rust-toolchain.toml
  12. 10
      src/http_client.rs
  13. 26
      src/static/scripts/datatables.css
  14. 503
      src/static/scripts/datatables.js

6
.github/workflows/build.yml

@ -80,7 +80,7 @@ jobs:
# Only install the clippy and rustfmt components on the default rust-toolchain
- name: "Install rust-toolchain version"
uses: dtolnay/rust-toolchain@c5a29ddb4d9d194e7c84ec8c3fba61b1c31fee8c # master @ Jan 30, 2025, 8:16 PM GMT+1
uses: dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0 # master @ Mar 18, 2025, 8:14 PM GMT+1
if: ${{ matrix.channel == 'rust-toolchain' }}
with:
toolchain: "${{steps.toolchain.outputs.RUST_TOOLCHAIN}}"
@ -90,7 +90,7 @@ jobs:
# Install the any other channel to be used for which we do not execute clippy and rustfmt
- name: "Install MSRV version"
uses: dtolnay/rust-toolchain@c5a29ddb4d9d194e7c84ec8c3fba61b1c31fee8c # master @ Jan 30, 2025, 8:16 PM GMT+1
uses: dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0 # master @ Mar 18, 2025, 8:14 PM GMT+1
if: ${{ matrix.channel != 'rust-toolchain' }}
with:
toolchain: "${{steps.toolchain.outputs.RUST_TOOLCHAIN}}"
@ -115,7 +115,7 @@ jobs:
# Enable Rust Caching
- name: Rust Caching
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
with:
# Use a custom prefix-key to force a fresh start. This is sometimes needed with bigger changes.
# Like changing the build host from Ubuntu 20.04 to 22.04 for example.

2
.github/workflows/hadolint.yml

@ -14,7 +14,7 @@ jobs:
steps:
# Start Docker Buildx
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
# https://github.com/moby/buildkit/issues/3969
# Also set max parallelism to 2, the default of 4 breaks GitHub Actions and causes OOMKills
with:

28
.github/workflows/release.yml

@ -70,13 +70,13 @@ jobs:
steps:
- name: Initialize QEMU binfmt support
uses: docker/setup-qemu-action@53851d14592bedcffcf25ea515637cff71ef929a # v3.3.0
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
with:
platforms: "arm64,arm"
# Start Docker Buildx
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
# https://github.com/moby/buildkit/issues/3969
# Also set max parallelism to 2, the default of 4 breaks GitHub Actions and causes OOMKills
with:
@ -120,7 +120,7 @@ jobs:
# Login to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
@ -136,7 +136,7 @@ jobs:
# Login to GitHub Container Registry
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
@ -153,7 +153,7 @@ jobs:
# Login to Quay.io
- name: Login to Quay.io
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
@ -192,7 +192,7 @@ jobs:
- name: Bake ${{ matrix.base_image }} containers
id: bake_vw
uses: docker/bake-action@7bff531c65a5cda33e52e43950a795b91d450f63 # v6.3.0
uses: docker/bake-action@4ba453fbc2db7735392b93edf935aaf9b1e8f747 # v6.5.0
env:
BASE_TAGS: "${{ env.BASE_TAGS }}"
SOURCE_COMMIT: "${{ env.SOURCE_COMMIT }}"
@ -220,7 +220,7 @@ jobs:
# Attest container images
- name: Attest - docker.io - ${{ matrix.base_image }}
if: ${{ env.HAVE_DOCKERHUB_LOGIN == 'true' && steps.bake_vw.outputs.metadata != ''}}
uses: actions/attest-build-provenance@520d128f165991a6c774bcb264f323e3d70747f4 # v2.2.0
uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
with:
subject-name: ${{ vars.DOCKERHUB_REPO }}
subject-digest: ${{ env.DIGEST_SHA }}
@ -228,7 +228,7 @@ jobs:
- name: Attest - ghcr.io - ${{ matrix.base_image }}
if: ${{ env.HAVE_GHCR_LOGIN == 'true' && steps.bake_vw.outputs.metadata != ''}}
uses: actions/attest-build-provenance@520d128f165991a6c774bcb264f323e3d70747f4 # v2.2.0
uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
with:
subject-name: ${{ vars.GHCR_REPO }}
subject-digest: ${{ env.DIGEST_SHA }}
@ -236,7 +236,7 @@ jobs:
- name: Attest - quay.io - ${{ matrix.base_image }}
if: ${{ env.HAVE_QUAY_LOGIN == 'true' && steps.bake_vw.outputs.metadata != ''}}
uses: actions/attest-build-provenance@520d128f165991a6c774bcb264f323e3d70747f4 # v2.2.0
uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
with:
subject-name: ${{ vars.QUAY_REPO }}
subject-digest: ${{ env.DIGEST_SHA }}
@ -290,31 +290,31 @@ jobs:
# Upload artifacts to Github Actions and Attest the binaries
- name: "Upload amd64 artifact ${{ matrix.base_image }}"
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4.6.1
with:
name: vaultwarden-${{ env.SOURCE_VERSION }}-linux-amd64-${{ matrix.base_image }}
path: vaultwarden-amd64-${{ matrix.base_image }}
- name: "Upload arm64 artifact ${{ matrix.base_image }}"
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4.6.1
with:
name: vaultwarden-${{ env.SOURCE_VERSION }}-linux-arm64-${{ matrix.base_image }}
path: vaultwarden-arm64-${{ matrix.base_image }}
- name: "Upload armv7 artifact ${{ matrix.base_image }}"
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4.6.1
with:
name: vaultwarden-${{ env.SOURCE_VERSION }}-linux-armv7-${{ matrix.base_image }}
path: vaultwarden-armv7-${{ matrix.base_image }}
- name: "Upload armv6 artifact ${{ matrix.base_image }}"
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4.6.1
with:
name: vaultwarden-${{ env.SOURCE_VERSION }}-linux-armv6-${{ matrix.base_image }}
path: vaultwarden-armv6-${{ matrix.base_image }}
- name: "Attest artifacts ${{ matrix.base_image }}"
uses: actions/attest-build-provenance@520d128f165991a6c774bcb264f323e3d70747f4 # v2.2.0
uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
with:
subject-path: vaultwarden-*
# End Upload artifacts to Github Actions

2
.github/workflows/trivy.yml

@ -36,7 +36,7 @@ jobs:
persist-credentials: false
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # v0.29.0
uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0
env:
TRIVY_DB_REPOSITORY: docker.io/aquasec/trivy-db:2,public.ecr.aws/aquasecurity/trivy-db:2,ghcr.io/aquasecurity/trivy-db:2
TRIVY_JAVA_DB_REPOSITORY: docker.io/aquasec/trivy-java-db:1,public.ecr.aws/aquasecurity/trivy-java-db:1,ghcr.io/aquasecurity/trivy-java-db:1

2
.pre-commit-config.yaml

@ -1,7 +1,7 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: check-json

277
Cargo.lock

@ -200,6 +200,17 @@ dependencies = [
"tracing",
]
[[package]]
name = "async-recursion"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "async-signal"
version = "0.2.10"
@ -624,6 +635,12 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "critical-section"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
[[package]]
name = "cron"
version = "0.12.1"
@ -635,6 +652,24 @@ dependencies = [
"once_cell",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.21"
@ -714,9 +749,9 @@ checksum = "5c297a1c74b71ae29df00c3e22dd9534821d60eb9af5a0192823fa2acea70c2a"
[[package]]
name = "deranged"
version = "0.3.11"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e"
dependencies = [
"powerfmt",
]
@ -1223,6 +1258,19 @@ dependencies = [
"windows 0.48.0",
]
[[package]]
name = "generator"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc6bd114ceda131d3b1d665eba35788690ad37f5916457286b32ab6fd3c438dd"
dependencies = [
"cfg-if",
"libc",
"log",
"rustversion",
"windows 0.58.0",
]
[[package]]
name = "generic-array"
version = "0.14.7"
@ -1248,16 +1296,16 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8"
checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi 0.13.3+wasi-0.2.2",
"r-efi",
"wasi 0.14.2+wasi-0.2.4",
"wasm-bindgen",
"windows-targets 0.52.6",
]
[[package]]
@ -1295,7 +1343,7 @@ dependencies = [
"futures-sink",
"futures-timer",
"futures-util",
"getrandom 0.3.1",
"getrandom 0.3.2",
"no-std-compat",
"nonzero_ext",
"parking_lot",
@ -1404,12 +1452,14 @@ checksum = "fbd780fe5cc30f81464441920d82ac8740e2e46b29a6fad543ddd075229ce37e"
[[package]]
name = "hickory-proto"
version = "0.24.4"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92652067c9ce6f66ce53cc38d1169daa36e6e7eb7dd3b63b5103bd9d97117248"
checksum = "6d844af74f7b799e41c78221be863bade11c430d46042c3b49ca8ae0c6d27287"
dependencies = [
"async-recursion",
"async-trait",
"cfg-if",
"critical-section",
"data-encoding",
"enum-as-inner",
"futures-channel",
@ -1418,8 +1468,9 @@ dependencies = [
"idna",
"ipnet",
"once_cell",
"rand 0.8.5",
"thiserror 1.0.69",
"rand 0.9.0",
"ring",
"thiserror 2.0.12",
"tinyvec",
"tokio",
"tracing",
@ -1428,21 +1479,21 @@ dependencies = [
[[package]]
name = "hickory-resolver"
version = "0.24.4"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbb117a1ca520e111743ab2f6688eddee69db4e0ea242545a604dce8a66fd22e"
checksum = "a128410b38d6f931fcc6ca5c107a3b02cabd6c05967841269a4ad65d23c44331"
dependencies = [
"cfg-if",
"futures-util",
"hickory-proto",
"ipconfig",
"lru-cache",
"moka",
"once_cell",
"parking_lot",
"rand 0.8.5",
"rand 0.9.0",
"resolv-conf",
"smallvec",
"thiserror 1.0.69",
"thiserror 2.0.12",
"tokio",
"tracing",
]
@ -1650,7 +1701,7 @@ dependencies = [
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"windows-core",
"windows-core 0.52.0",
]
[[package]]
@ -1970,9 +2021,9 @@ checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa"
[[package]]
name = "libmimalloc-sys"
version = "0.1.39"
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23aa6811d3bd4deb8a84dde645f943476d13b248d818edcf8ce0b2f37f036b44"
checksum = "07d0e07885d6a754b9c7993f2625187ad694ee985d60f23355ff0e7077261502"
dependencies = [
"cc",
"libc",
@ -1989,12 +2040,6 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "linked-hash-map"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "linux-raw-sys"
version = "0.4.15"
@ -2045,7 +2090,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5"
dependencies = [
"cfg-if",
"generator",
"generator 0.7.5",
"scoped-tls",
"serde",
"serde_json",
@ -2054,12 +2099,16 @@ dependencies = [
]
[[package]]
name = "lru-cache"
version = "0.1.2"
name = "loom"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c"
checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca"
dependencies = [
"linked-hash-map",
"cfg-if",
"generator 0.8.4",
"scoped-tls",
"tracing",
"tracing-subscriber",
]
[[package]]
@ -2108,9 +2157,9 @@ dependencies = [
[[package]]
name = "mimalloc"
version = "0.1.43"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68914350ae34959d83f732418d51e2427a794055d0b9529f48259ac07af65633"
checksum = "99585191385958383e13f6b822e6b6d8d9cf928e7d286ceb092da92b43c87bc1"
dependencies = [
"libmimalloc-sys",
]
@ -2147,6 +2196,25 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "moka"
version = "0.12.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9321642ca94a4282428e6ea4af8cc2ca4eac48ac7a6a4ea8f33f76d0ce70926"
dependencies = [
"crossbeam-channel",
"crossbeam-epoch",
"crossbeam-utils",
"loom 0.7.2",
"parking_lot",
"portable-atomic",
"rustc_version",
"smallvec",
"tagptr",
"thiserror 1.0.69",
"uuid",
]
[[package]]
name = "multer"
version = "3.1.0"
@ -2327,6 +2395,10 @@ name = "once_cell"
version = "1.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc"
dependencies = [
"critical-section",
"portable-atomic",
]
[[package]]
name = "openssl"
@ -2743,6 +2815,12 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "640c9bd8497b02465aeef5375144c26062e0dcd5939dfcbb0f5db76cb8c17c73"
[[package]]
name = "r-efi"
version = "5.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
[[package]]
name = "r2d2"
version = "0.8.10"
@ -2811,7 +2889,7 @@ version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
dependencies = [
"getrandom 0.3.1",
"getrandom 0.3.2",
]
[[package]]
@ -2909,9 +2987,9 @@ dependencies = [
[[package]]
name = "reqwest"
version = "0.12.14"
version = "0.12.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "989e327e510263980e231de548a33e63d34962d29ae61b467389a1a09627a254"
checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb"
dependencies = [
"async-compression",
"base64 0.22.1",
@ -3124,6 +3202,15 @@ version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]]
name = "rustc_version"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
dependencies = [
"semver",
]
[[package]]
name = "rustix"
version = "0.38.44"
@ -3139,9 +3226,9 @@ dependencies = [
[[package]]
name = "rustix"
version = "1.0.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7178faa4b75a30e269c71e61c353ce2748cf3d76f0c44c393f4e60abf49b825"
checksum = "e56a18552996ac8d29ecc3b190b4fdbb2d91ca4ec396de7bbffaf43f3d637e96"
dependencies = [
"bitflags",
"errno",
@ -3504,9 +3591,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "stacker"
version = "0.1.19"
version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9156ebd5870ef293bfb43f91c7a74528d363ec0d424afe24160ed5a4343d08a"
checksum = "601f9201feb9b09c00266478bf459952b9ef9a6b94edb2f21eba14ab681a60a9"
dependencies = [
"cc",
"cfg-if",
@ -3521,7 +3608,7 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b8c4a4445d81357df8b1a650d0d0d6fbbbfe99d064aa5e02f3e4022061476d8"
dependencies = [
"loom",
"loom 0.5.6",
]
[[package]]
@ -3600,6 +3687,12 @@ dependencies = [
"libc",
]
[[package]]
name = "tagptr"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
[[package]]
name = "tempfile"
version = "3.19.0"
@ -3607,9 +3700,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "488960f40a3fd53d72c2a29a58722561dee8afdd175bd88e3db4677d7b2ba600"
dependencies = [
"fastrand",
"getrandom 0.3.1",
"getrandom 0.3.2",
"once_cell",
"rustix 1.0.2",
"rustix 1.0.3",
"windows-sys 0.59.0",
]
@ -3674,9 +3767,9 @@ dependencies = [
[[package]]
name = "time"
version = "0.3.39"
version = "0.3.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dad298b01a40a23aac4580b67e3dbedb7cc8402f3592d7f49469de2ea4aecdd8"
checksum = "9d9c75b47bdff86fa3334a3db91356b8d7d86a9b839dab7d0bdc5c3d3a077618"
dependencies = [
"deranged",
"itoa",
@ -3691,15 +3784,15 @@ dependencies = [
[[package]]
name = "time-core"
version = "0.1.3"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "765c97a5b985b7c11d7bc27fa927dc4fe6af3a6dfb021d28deb60d3bf51e76ef"
checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c"
[[package]]
name = "time-macros"
version = "0.2.20"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8093bc3e81c3bc5f7879de09619d06c9a5a5e45ca44dfeeb7225bae38005c5c"
checksum = "29aa485584182073ed57fd5004aa09c371f021325014694e432313345865fd04"
dependencies = [
"num-conv",
"time-core",
@ -4082,7 +4175,7 @@ version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9"
dependencies = [
"getrandom 0.3.1",
"getrandom 0.3.2",
]
[[package]]
@ -4203,9 +4296,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasi"
version = "0.13.3+wasi-0.2.2"
version = "0.14.2+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2"
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
dependencies = [
"wit-bindgen-rt",
]
@ -4397,7 +4490,17 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
dependencies = [
"windows-core",
"windows-core 0.52.0",
"windows-targets 0.52.6",
]
[[package]]
name = "windows"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
dependencies = [
"windows-core 0.58.0",
"windows-targets 0.52.6",
]
@ -4410,11 +4513,46 @@ dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-core"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
dependencies = [
"windows-implement",
"windows-interface",
"windows-result 0.2.0",
"windows-strings 0.1.0",
"windows-targets 0.52.6",
]
[[package]]
name = "windows-implement"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "windows-interface"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "windows-link"
version = "0.1.0"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dccfd733ce2b1753b03b6d3c65edf020262ea35e20ccdf3e288043e6dd620e3"
checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
[[package]]
name = "windows-registry"
@ -4422,20 +4560,39 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3"
dependencies = [
"windows-result",
"windows-strings",
"windows-result 0.3.2",
"windows-strings 0.3.1",
"windows-targets 0.53.0",
]
[[package]]
name = "windows-result"
version = "0.3.1"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-result"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06374efe858fab7e4f881500e6e86ec8bc28f9462c47e5a9941a0142ad86b189"
checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252"
dependencies = [
"windows-link",
]
[[package]]
name = "windows-strings"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
dependencies = [
"windows-result 0.2.0",
"windows-targets 0.52.6",
]
[[package]]
name = "windows-strings"
version = "0.3.1"
@ -4684,9 +4841,9 @@ checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904"
[[package]]
name = "wit-bindgen-rt"
version = "0.33.0"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
dependencies = [
"bitflags",
]

8
Cargo.toml

@ -99,7 +99,7 @@ uuid = { version = "1.16.0", features = ["v4"] }
# Date and time libraries
chrono = { version = "0.4.40", features = ["clock", "serde"], default-features = false }
chrono-tz = "0.10.1"
time = "0.3.39"
time = "0.3.40"
# Job scheduler
job_scheduler_ng = "2.0.5"
@ -131,8 +131,8 @@ email_address = "0.2.9"
handlebars = { version = "6.3.2", features = ["dir_source"] }
# HTTP client (Used for favicons, version check, DUO and HIBP API)
reqwest = { version = "0.12.12", features = ["native-tls-alpn", "stream", "json", "gzip", "brotli", "socks", "cookies"] }
hickory-resolver = "0.24.4"
reqwest = { version = "0.12.15", features = ["native-tls-alpn", "stream", "json", "gzip", "brotli", "socks", "cookies"] }
hickory-resolver = "0.25.1"
# Favicon extraction libraries
html5gum = "0.7.0"
@ -162,7 +162,7 @@ semver = "1.0.26"
# Allow overriding the default memory allocator
# Mainly used for the musl builds, since the default musl malloc is very slow
mimalloc = { version = "0.1.43", features = ["secure"], default-features = false, optional = true }
mimalloc = { version = "0.1.44", features = ["secure"], default-features = false, optional = true }
which = "7.0.2"
# Argon2 library with support for the PHC format

2
docker/DockerSettings.yaml

@ -5,7 +5,7 @@ vault_image_digest: "sha256:cb6b2095a4afc1d9d243a33f6d09211f40e3d82c7ae829fd025d
# We use the linux/amd64 platform shell scripts since there is no difference between the different platform scripts
# https://github.com/tonistiigi/xx | https://hub.docker.com/r/tonistiigi/xx/tags
xx_image_digest: "sha256:9c207bead753dda9430bdd15425c6518fc7a03d866103c516a2c6889188f5894"
rust_version: 1.85.0 # Rust version to be used
rust_version: 1.85.1 # Rust version to be used
debian_version: bookworm # Debian release name to be used
alpine_version: "3.21" # Alpine version to be used
# For which platforms/architectures will we try to build images

8
docker/Dockerfile.alpine

@ -32,10 +32,10 @@ FROM --platform=linux/amd64 docker.io/vaultwarden/web-vault@sha256:cb6b2095a4afc
########################## ALPINE BUILD IMAGES ##########################
## NOTE: The Alpine Base Images do not support other platforms then linux/amd64
## And for Alpine we define all build images here, they will only be loaded when actually used
FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:x86_64-musl-stable-1.85.0 AS build_amd64
FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:aarch64-musl-stable-1.85.0 AS build_arm64
FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:armv7-musleabihf-stable-1.85.0 AS build_armv7
FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:arm-musleabi-stable-1.85.0 AS build_armv6
FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:x86_64-musl-stable-1.85.1 AS build_amd64
FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:aarch64-musl-stable-1.85.1 AS build_arm64
FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:armv7-musleabihf-stable-1.85.1 AS build_armv7
FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:arm-musleabi-stable-1.85.1 AS build_armv6
########################## BUILD IMAGE ##########################
# hadolint ignore=DL3006

2
docker/Dockerfile.debian

@ -36,7 +36,7 @@ FROM --platform=linux/amd64 docker.io/tonistiigi/xx@sha256:9c207bead753dda9430bd
########################## BUILD IMAGE ##########################
# hadolint ignore=DL3006
FROM --platform=$BUILDPLATFORM docker.io/library/rust:1.85.0-slim-bookworm AS build
FROM --platform=$BUILDPLATFORM docker.io/library/rust:1.85.1-slim-bookworm AS build
COPY --from=xx / /
ARG TARGETARCH
ARG TARGETVARIANT

2
rust-toolchain.toml

@ -1,4 +1,4 @@
[toolchain]
channel = "1.85.0"
channel = "1.85.1"
components = [ "rustfmt", "clippy" ]
profile = "minimal"

10
src/http_client.rs

@ -6,7 +6,7 @@ use std::{
time::Duration,
};
use hickory_resolver::{system_conf::read_system_conf, TokioAsyncResolver};
use hickory_resolver::{name_server::TokioConnectionProvider, TokioResolver};
use once_cell::sync::Lazy;
use regex::Regex;
use reqwest::{
@ -173,7 +173,7 @@ impl std::error::Error for CustomHttpClientError {}
#[derive(Debug, Clone)]
enum CustomDnsResolver {
Default(),
Hickory(Arc<TokioAsyncResolver>),
Hickory(Arc<TokioResolver>),
}
type BoxError = Box<dyn std::error::Error + Send + Sync>;
@ -184,9 +184,9 @@ impl CustomDnsResolver {
}
fn new() -> Arc<Self> {
match read_system_conf() {
Ok((config, opts)) => {
let resolver = TokioAsyncResolver::tokio(config.clone(), opts.clone());
match TokioResolver::builder(TokioConnectionProvider::default()) {
Ok(builder) => {
let resolver = builder.build();
Arc::new(Self::Hickory(Arc::new(resolver)))
}
Err(e) => {

26
src/static/scripts/datatables.css

@ -4,13 +4,12 @@
*
* To rebuild or modify this file with the latest versions of the included
* software please visit:
* https://datatables.net/download/#bs5/dt-2.1.8
* https://datatables.net/download/#bs5/dt-2.2.2
*
* Included libraries:
* DataTables 2.1.8
* DataTables 2.2.2
*/
@charset "UTF-8";
:root {
--dt-row-selected: 13, 110, 253;
--dt-row-selected-text: 255, 255, 255;
@ -43,6 +42,9 @@ table.dataTable tr.dt-hasChild td.dt-control:before {
border-bottom: 0px solid transparent;
border-right: 5px solid transparent;
}
table.dataTable tfoot:empty {
display: none;
}
html.dark table.dataTable td.dt-control:before,
:root[data-bs-theme=dark] table.dataTable td.dt-control:before,
@ -90,8 +92,8 @@ table.dataTable thead > tr > td.dt-ordering-asc span.dt-column-order:before {
position: absolute;
display: block;
bottom: 50%;
content: "";
content: ""/"";
content: "\25B2";
content: "\25B2"/"";
}
table.dataTable thead > tr > th.dt-orderable-desc span.dt-column-order:after, table.dataTable thead > tr > th.dt-ordering-desc span.dt-column-order:after,
table.dataTable thead > tr > td.dt-orderable-desc span.dt-column-order:after,
@ -99,8 +101,8 @@ table.dataTable thead > tr > td.dt-ordering-desc span.dt-column-order:after {
position: absolute;
display: block;
top: 50%;
content: "";
content: ""/"";
content: "\25BC";
content: "\25BC"/"";
}
table.dataTable thead > tr > th.dt-orderable-asc, table.dataTable thead > tr > th.dt-orderable-desc, table.dataTable thead > tr > th.dt-ordering-asc, table.dataTable thead > tr > th.dt-ordering-desc,
table.dataTable thead > tr > td.dt-orderable-asc,
@ -251,6 +253,11 @@ table.dataTable th,
table.dataTable td {
box-sizing: border-box;
}
table.dataTable th.dt-type-numeric, table.dataTable th.dt-type-date,
table.dataTable td.dt-type-numeric,
table.dataTable td.dt-type-date {
text-align: right;
}
table.dataTable th.dt-left,
table.dataTable td.dt-left {
text-align: left;
@ -276,11 +283,6 @@ table.dataTable td.dt-empty {
text-align: center;
vertical-align: top;
}
table.dataTable th.dt-type-numeric, table.dataTable th.dt-type-date,
table.dataTable td.dt-type-numeric,
table.dataTable td.dt-type-date {
text-align: right;
}
table.dataTable thead th,
table.dataTable thead td,
table.dataTable tfoot th,

503
src/static/scripts/datatables.js

@ -4,34 +4,16 @@
*
* To rebuild or modify this file with the latest versions of the included
* software please visit:
* https://datatables.net/download/#bs5/dt-2.1.8
* https://datatables.net/download/#bs5/dt-2.2.2
*
* Included libraries:
* DataTables 2.1.8
* DataTables 2.2.2
*/
/*! DataTables 2.1.8
/*! DataTables 2.2.2
* © SpryMedia Ltd - datatables.net/license
*/
/**
* @summary DataTables
* @description Paginate, search and order HTML tables
* @version 2.1.8
* @author SpryMedia Ltd
* @contact www.datatables.net
* @copyright SpryMedia Ltd.
*
* This source file is free software, available under the following license:
* MIT license - https://datatables.net/license
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*
* For details please refer to: https://www.datatables.net
*/
(function( factory ) {
"use strict";
@ -441,7 +423,6 @@
thead = $('<thead/>').appendTo($this);
}
oSettings.nTHead = thead[0];
$('tr', thead).addClass(oClasses.thead.row);
var tbody = $this.children('tbody');
if ( tbody.length === 0 ) {
@ -456,7 +437,6 @@
tfoot = $('<tfoot/>').appendTo($this);
}
oSettings.nTFoot = tfoot[0];
$('tr', tfoot).addClass(oClasses.tfoot.row);
// Copy the data index array
oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
@ -539,7 +519,7 @@
*
* @type string
*/
builder: "bs5/dt-2.1.8",
builder: "bs5/dt-2.2.2",
/**
@ -2173,6 +2153,10 @@
var width = _fnColumnsSumWidth(settings, [i], false, false);
cols[i].colEl.css('width', width);
if (settings.oScroll.sX) {
cols[i].colEl.css('min-width', width);
}
}
}
@ -3240,9 +3224,13 @@
// Add the number of cells needed to make up to the number of columns
if (row.length === 1) {
var cells = $('td, th', row);
var cellCount = 0;
$('td, th', row).each(function () {
cellCount += this.colSpan;
});
for ( i=cells.length, ien=columns.length ; i<ien ; i++ ) {
for ( i=cellCount, ien=columns.length ; i<ien ; i++ ) {
$('<th/>')
.html( columns[i][titleProp] || '' )
.appendTo( row );
@ -3254,9 +3242,11 @@
if (side === 'header') {
settings.aoHeader = detected;
$('tr', target).addClass(classes.thead.row);
}
else {
settings.aoFooter = detected;
$('tr', target).addClass(classes.tfoot.row);
}
// Every cell needs to be passed through the renderer
@ -4519,7 +4509,7 @@
// So the array reference doesn't break set the results into the
// existing array
displayRows.length = 0;
displayRows.push.apply(displayRows, rows);
_fnArrayApply(displayRows, rows);
}
}
@ -5247,8 +5237,11 @@
// [].find, but it wasn't supported in Chrome until Sept 2015, and DT has 10 year
// browser support
var firstTr = null;
var start = _fnDataSource( settings ) !== 'ssp'
? settings._iDisplayStart
: 0;
for (i=settings._iDisplayStart ; i<settings.aiDisplay.length ; i++) {
for (i=start ; i<start + settings.aiDisplay.length ; i++) {
var idx = settings.aiDisplay[i];
var tr = settings.aoData[idx].nTr;
@ -5263,7 +5256,7 @@
return {
idx: _fnVisibleToColumnIndex(settings, vis),
width: $(this).outerWidth()
}
};
});
// Check against what the colgroup > col is set to and correct if needed
@ -5273,6 +5266,10 @@
if (colWidth !== colSizes[i].width) {
colEl.style.width = colSizes[i].width + 'px';
if (scroll.sX) {
colEl.style.minWidth = colSizes[i].width + 'px';
}
}
}
}
@ -5365,6 +5362,14 @@
i, column, columnIdx;
var styleWidth = table.style.width;
var containerWidth = _fnWrapperWidth(settings);
// Don't re-run for the same width as the last time
if (containerWidth === settings.containerWidth) {
return false;
}
settings.containerWidth = containerWidth;
// If there is no width applied as a CSS style or as an attribute, we assume that
// the width is intended to be 100%, which is usually is in CSS, but it is very
@ -5422,6 +5427,8 @@
// browser will collapse it. If this width is smaller than the
// width the column requires, then it will have no effect
if ( scrollX ) {
this.style.minWidth = width;
$( this ).append( $('<div/>').css( {
width: width,
margin: 0,
@ -5490,15 +5497,15 @@
// If there is no width attribute or style, then allow the table to
// collapse
if ( tmpTable.width() < tableContainer.clientWidth && tableWidthAttr ) {
tmpTable.width( tableContainer.clientWidth );
if ( tmpTable.outerWidth() < tableContainer.clientWidth && tableWidthAttr ) {
tmpTable.outerWidth( tableContainer.clientWidth );
}
}
else if ( scrollY ) {
tmpTable.width( tableContainer.clientWidth );
tmpTable.outerWidth( tableContainer.clientWidth );
}
else if ( tableWidthAttr ) {
tmpTable.width( tableWidthAttr );
tmpTable.outerWidth( tableWidthAttr );
}
// Get the width of each column in the constructed table
@ -5531,20 +5538,64 @@
}
if ( (tableWidthAttr || scrollX) && ! settings._reszEvt ) {
var bindResize = function () {
$(window).on('resize.DT-'+settings.sInstance, DataTable.util.throttle( function () {
if (! settings.bDestroying) {
_fnAdjustColumnSizing( settings );
var resize = DataTable.util.throttle( function () {
var newWidth = _fnWrapperWidth(settings);
// Don't do it if destroying or the container width is 0
if (! settings.bDestroying && newWidth !== 0) {
_fnAdjustColumnSizing( settings );
}
} );
// For browsers that support it (~2020 onwards for wide support) we can watch for the
// container changing width.
if (window.ResizeObserver) {
// This is a tricky beast - if the element is visible when `.observe()` is called,
// then the callback is immediately run. Which we don't want. If the element isn't
// visible, then it isn't run, but we want it to run when it is then made visible.
// This flag allows the above to be satisfied.
var first = $(settings.nTableWrapper).is(':visible');
// Use an empty div to attach the observer so it isn't impacted by height changes
var resizer = $('<div>')
.css({
width: '100%',
height: 0
})
.addClass('dt-autosize')
.appendTo(settings.nTableWrapper);
settings.resizeObserver = new ResizeObserver(function (e) {
if (first) {
first = false;
}
} ) );
};
else {
resize();
}
});
bindResize();
settings.resizeObserver.observe(resizer[0]);
}
else {
// For old browsers, the best we can do is listen for a window resize
$(window).on('resize.DT-'+settings.sInstance, resize);
}
settings._reszEvt = true;
}
}
/**
* Get the width of the DataTables wrapper element
*
* @param {*} settings DataTables settings object
* @returns Width
*/
function _fnWrapperWidth(settings) {
return $(settings.nTableWrapper).is(':visible')
? $(settings.nTableWrapper).width()
: 0;
}
/**
* Get the maximum strlen for each data column
@ -5855,10 +5906,14 @@
displayMaster = oSettings.aiDisplayMaster,
aSort;
// Make sure the columns all have types defined
_fnColumnTypes(oSettings);
// Allow a specific column to be sorted, which will _not_ alter the display
// master
if (col !== undefined) {
var srcCol = oSettings.aoColumns[col];
aSort = [{
src: col,
col: col,
@ -6153,15 +6208,26 @@
return;
}
// Sort state saving uses [[idx, order]] structure.
var sorting = [];
_fnSortResolve(settings, sorting, settings.aaSorting );
/* Store the interesting variables */
var columns = settings.aoColumns;
var state = {
time: +new Date(),
start: settings._iDisplayStart,
length: settings._iDisplayLength,
order: $.extend( true, [], settings.aaSorting ),
order: sorting.map(function (sort) {
// If a column name is available, use it
return columns[sort[0]] && columns[sort[0]].sName
? [ columns[sort[0]].sName, sort[1] ]
: sort.slice();
} ),
search: $.extend({}, settings.oPreviousSearch),
columns: settings.aoColumns.map( function ( col, i ) {
return {
name: col.sName,
visible: col.bVisible,
search: $.extend({}, settings.aoPreSearchCols[i])
};
@ -6209,6 +6275,8 @@
function _fnImplementState ( settings, s, callback) {
var i, ien;
var columns = settings.aoColumns;
var currentNames = _pluck(settings.aoColumns, 'sName');
settings._bLoadingState = true;
// When StateRestore was introduced the state could now be implemented at any time
@ -6238,13 +6306,6 @@
return;
}
// Number of columns have changed - all bets are off, no restore of settings
if ( s.columns && columns.length !== s.columns.length ) {
settings._bLoadingState = false;
callback();
return;
}
// Store the saved state so it might be accessed at any time
settings.oLoadedState = $.extend( true, {}, s );
@ -6278,10 +6339,23 @@
if ( s.order !== undefined ) {
settings.aaSorting = [];
$.each( s.order, function ( i, col ) {
settings.aaSorting.push( col[0] >= columns.length ?
[ 0, col[1] ] :
col
);
var set = [ col[0], col[1] ];
// A column name was stored and should be used for restore
if (typeof col[0] === 'string') {
var idx = currentNames.indexOf(col[0]);
// Find the name from the current list of column names, or fallback to index 0
set[0] = idx >= 0
? idx
: 0;
}
else if (set[0] >= columns.length) {
// If a column name, but it is out of bounds, set to 0
set[0] = 0;
}
settings.aaSorting.push(set);
} );
}
@ -6292,31 +6366,65 @@
// Columns
if ( s.columns ) {
for ( i=0, ien=s.columns.length ; i<ien ; i++ ) {
var col = s.columns[i];
// Visibility
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);
var set = s.columns;
var incoming = _pluck(s.columns, 'name');
// Check if it is a 2.2 style state object with a `name` property for the columns, and if
// the name was defined. If so, then create a new array that will map the state object
// given, to the current columns (don't bother if they are already matching tho).
if (incoming.join('').length && incoming.join('') !== currentNames.join('')) {
set = [];
// For each column, try to find the name in the incoming array
for (i=0 ; i<currentNames.length ; i++) {
if (currentNames[i] != '') {
var idx = incoming.indexOf(currentNames[i]);
if (idx >= 0) {
set.push(s.columns[idx]);
}
else {
// No matching column name in the state's columns, so this might be a new
// column and thus can't have a state already.
set.push({});
}
}
else {
columns[i].bVisible = col.visible;
// If no name, but other columns did have a name, then there is no knowing
// where this one came from originally so it can't be restored.
set.push({});
}
}
}
// If the number of columns to restore is different from current, then all bets are off.
if (set.length === columns.length) {
for ( i=0, ien=set.length ; i<ien ; i++ ) {
var col = set[i];
// Visibility
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;
}
}
// Search
if ( col.search !== undefined ) {
$.extend( settings.aoPreSearchCols[i], col.search );
}
}
// Search
if ( col.search !== undefined ) {
$.extend( settings.aoPreSearchCols[i], 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();
}
}
// 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;
@ -6633,6 +6741,30 @@
replace(/_ENTRIES-TOTAL_/g, settings.api.i18n('entries', '', vis) );
}
/**
* Add elements to an array as quickly as possible, but stack stafe.
*
* @param {*} arr Array to add the data to
* @param {*} data Data array that is to be added
* @returns
*/
function _fnArrayApply(arr, data) {
if (! data) {
return;
}
// Chrome can throw a max stack error if apply is called with
// too large an array, but apply is faster.
if (data.length < 10000) {
arr.push.apply(arr, data);
}
else {
for (i=0 ; i<data.length ; i++) {
arr.push(data[i]);
}
}
}
/**
@ -6825,18 +6957,7 @@
: settings;
// Initial data
if ( data ) {
// Chrome can throw a max stack error if apply is called with
// too large an array, but apply is faster.
if (data.length < 10000) {
this.push.apply(this, data);
}
else {
for (i=0 ; i<data.length ; i++) {
this.push(data[i]);
}
}
}
_fnArrayApply(this, data);
// selector
this.selector = {
@ -7217,7 +7338,7 @@
selector.forEach(function (sel) {
var inner = __table_selector(sel, a);
result.push.apply(result, inner);
_fnArrayApply(result, inner);
});
return result.filter( function (item) {
@ -8071,7 +8192,7 @@
// Return an Api.rows() extended instance, so rows().nodes() etc can be used
var modRows = this.rows( -1 );
modRows.pop();
modRows.push.apply(modRows, newRows);
_fnArrayApply(modRows, newRows);
return modRows;
} );
@ -8584,7 +8705,10 @@
.map( function () {
return _fnColumnsFromHeader( this ); // `nodes` is column index complete and in order
} )
.toArray();
.toArray()
.sort(function (a, b) {
return a - b;
});
if ( jqResult.length || ! s.nodeName ) {
return jqResult;
@ -8838,6 +8962,10 @@
_api_register( 'columns.adjust()', function () {
return this.iterator( 'table', function ( settings ) {
// Force a column sizing to happen with a manual call - otherwise it can skip
// if the size hasn't changed
settings.containerWidth = -1;
_fnAdjustColumnSizing( settings );
}, 1 );
} );
@ -9403,6 +9531,10 @@
} );
} );
// Can be assigned in DateTable.use() - note luxon and moment vars are in helpers.js
var __bootstrap;
var __foundation;
/**
* Set the libraries that DataTables uses, or the global objects.
* Note that the arguments can be either way around (legacy support)
@ -9436,6 +9568,14 @@
case 'moment':
return __moment;
case 'bootstrap':
// Use local if set, otherwise try window, which could be undefined
return __bootstrap || window.bootstrap;
case 'foundation':
// Ditto
return __foundation || window.Foundation;
default:
return null;
}
@ -9445,7 +9585,7 @@
if (type === 'lib' || type === 'jq' || (module && module.fn && module.fn.jquery)) {
$ = module;
}
else if (type == 'win' || (module && module.document)) {
else if (type === 'win' || (module && module.document)) {
window = module;
document = module.document;
}
@ -9458,6 +9598,14 @@
else if (type === 'moment' || (module && module.isMoment)) {
__moment = module;
}
else if (type === 'bootstrap' || (module && module.Modal && module.Modal.NAME === 'modal'))
{
// This is currently for BS5 only. BS3/4 attach to jQuery, so no need to use `.use()`
__bootstrap = module;
}
else if (type === 'foundation' || (module && module.Reveal)) {
__foundation = module;
}
}
/**
@ -9709,12 +9857,14 @@
// Function to run either once the table becomes ready or
// immediately if it is already ready.
return this.tables().every(function () {
var api = this;
if (this.context[0]._bInitComplete) {
fn.call(this);
fn.call(api);
}
else {
this.on('init.dt.DT', function () {
fn.call(this);
fn.call(api);
});
}
} );
@ -9748,6 +9898,11 @@
new _Api( settings ).columns().visible( true );
}
// Container width change listener
if (settings.resizeObserver) {
settings.resizeObserver.disconnect();
}
// Blitz all `DT` namespaced events (these are internal events, the
// lowercase, `dt` events are user subscribed and they are responsible
// for removing them
@ -9765,20 +9920,37 @@
jqTable.append( tfoot );
}
// Clean up the header
$(thead).find('span.dt-column-order').remove();
$(thead).find('span.dt-column-title').each(function () {
var title = $(this).html();
$(this).parent().append(title);
$(this).remove();
});
settings.colgroup.remove();
settings.aaSorting = [];
settings.aaSortingFixed = [];
_fnSortingClasses( settings );
$(jqTable).find('th, td').removeClass(
$.map(DataTable.ext.type.className, function (v) {
return v;
}).join(' ')
);
$('th, td', thead)
.removeClass(
orderClasses.none + ' ' +
orderClasses.canAsc + ' ' +
orderClasses.canDesc + ' ' +
orderClasses.isAsc + ' ' +
orderClasses.isDesc
)
.css('width', '');
.css('width', '')
.removeAttr('data-dt-column')
.removeAttr('aria-sort');
// Add the TR elements back into the table in their original order
jqTbody.children().detach();
@ -9866,7 +10038,7 @@
* @type string
* @default Version number
*/
DataTable.version = "2.1.8";
DataTable.version = "2.2.2";
/**
* Private data store, containing all of the settings objects that are
@ -11969,7 +12141,13 @@
deferLoading: null,
/** Allow auto type detection */
typeDetect: true
typeDetect: true,
/** ResizeObserver for the container div */
resizeObserver: null,
/** Keep a record of the last size of the container, so we can skip duplicates */
containerWidth: -1
};
/**
@ -12111,8 +12289,8 @@
var __mlWarning = false;
var __luxon; // Can be assigned in DateTeble.use()
var __moment; // Can be assigned in DateTeble.use()
var __luxon; // Can be assigned in DateTable.use()
var __moment; // Can be assigned in DateTable.use()
/**
*
@ -12148,7 +12326,7 @@
return null;
}
dt.setLocale(locale);
dt = dt.setLocale(locale);
}
else if (! format) {
// No format given, must be ISO
@ -12531,6 +12709,13 @@
});
}
var __diacriticHtmlSort = function (a, b) {
a = _stripHtml(a);
b = _stripHtml(b);
return __diacriticSort(a, b);
}
//
// Built in data types
//
@ -12601,6 +12786,31 @@
});
DataTable.type('html-utf8', {
detect: {
allOf: function ( d ) {
return _empty( d ) || (typeof d === 'string' && d.indexOf('<') !== -1);
},
oneOf: function ( d ) {
// At least one data point must contain a `<` and a non-ASCII character
// eslint-disable-next-line compat/compat
return navigator.languages &&
! _empty( d ) &&
typeof d === 'string' &&
d.indexOf('<') !== -1 &&
typeof d === 'string' && d.match(/[^\x00-\x7F]/);
}
},
order: {
asc: __diacriticHtmlSort,
desc: function (a, b) {
return __diacriticHtmlSort(a, b) * -1;
}
},
search: _filterString(true, true)
});
DataTable.type('date', {
className: 'dt-type-date',
detect: {
@ -12811,6 +13021,7 @@
var indexes = columns.indexes();
var sortDirs = columns.orderable(true).flatten();
var orderedColumns = _pluck(sorting, 'col');
var tabIndex = settings.iTabIndex;
cell
.removeClass(
@ -12868,15 +13079,20 @@
cell.removeAttr('aria-sort');
}
cell.attr('aria-label', orderable
? col.ariaTitle + ctx.api.i18n('oAria.orderable' + ariaType)
: col.ariaTitle
);
// Make the headers tab-able for keyboard navigation
if (orderable) {
cell.find('.dt-column-title').attr('role', 'button');
cell.attr('tabindex', 0)
var orderSpan = cell.find('.dt-column-order');
orderSpan
.attr('role', 'button')
.attr('aria-label', orderable
? col.ariaTitle + ctx.api.i18n('oAria.orderable' + ariaType)
: col.ariaTitle
);
if (tabIndex !== -1) {
orderSpan.attr('tabindex', tabIndex);
}
}
} );
}
@ -12890,7 +13106,7 @@
.addClass(items.className || classes.row)
.appendTo( container );
$.each( items, function (key, val) {
DataTable.ext.renderer.layout._forLayoutRow(items, function (key, val) {
if (key === 'id' || key === 'className') {
return;
}
@ -12921,7 +13137,31 @@
})
.append( val.contents )
.appendTo( row );
} );
});
},
// Shared for use by the styling frameworks
_forLayoutRow: function (items, fn) {
// As we are inserting dom elements, we need start / end in a
// specific order, this function is used for sorting the layout
// keys.
var layoutEnum = function (x) {
switch (x) {
case '': return 0;
case 'start': return 1;
case 'end': return 2;
default: return 3;
}
};
Object
.keys(items)
.sort(function (a, b) {
return layoutEnum(a) - layoutEnum(b);
})
.forEach(function (key) {
fn(key, items[key]);
});
}
}
} );
@ -13273,7 +13513,7 @@
'data-dt-idx': button,
'tabIndex': btnInfo.disabled
? -1
: settings.iTabIndex
: settings.iTabIndex && btn.clicker[0].nodeName.toLowerCase() !== 'span'
? settings.iTabIndex
: null, // `0` doesn't need a tabIndex since it is the default
});
@ -13307,12 +13547,16 @@
// Responsive - check if the buttons are over two lines based on the
// height of the buttons and the container.
if (
buttonEls.length && // any buttons
opts.buttons > 1 && // prevent infinite
$(host).height() >= ($(buttonEls[0]).outerHeight() * 2) - 10
) {
_pagingDraw(settings, host, $.extend({}, opts, { buttons: opts.buttons - 2 }));
if (buttonEls.length) {
var outerHeight = $(buttonEls[0]).outerHeight();
if (
opts.buttons > 1 && // prevent infinite
outerHeight > 0 && // will be 0 if hidden
$(host).height() >= (outerHeight * 2) - 10
) {
_pagingDraw(settings, host, $.extend({}, opts, { buttons: opts.buttons - 2 }));
}
}
}
@ -13336,7 +13580,6 @@
switch ( button ) {
case 'ellipsis':
o.display = '&#x2026;';
o.disabled = true;
break;
case 'first':
@ -13523,7 +13766,7 @@
// Save text node content for macro updating
var textNodes = [];
Array.from(div.find('label')[0].childNodes).forEach(function (el) {
Array.prototype.slice.call(div.find('label')[0].childNodes).forEach(function (el) {
if (el.nodeType === Node.TEXT_NODE) {
textNodes.push({
el: el,
@ -13541,7 +13784,6 @@
// Next, the select itself, along with the options
var select = $('<select/>', {
'name': tableId+'_length',
'aria-controls': tableId,
'class': classes.select
} );
@ -13732,41 +13974,6 @@ DataTable.ext.renderer.pagingContainer.bootstrap = function (settings, buttonEls
return $('<ul/>').addClass('pagination').append(buttonEls);
};
// DataTable.ext.renderer.layout.bootstrap = function ( settings, container, items ) {
// var row = $( '<div/>', {
// "class": items.full ?
// 'row mt-2 justify-content-md-center' :
// 'row mt-2 justify-content-between'
// } )
// .appendTo( container );
// $.each( items, function (key, val) {
// var klass;
// var cellClass = '';
// // Apply start / end (left / right when ltr) margins
// if (val.table) {
// klass = 'col-12';
// }
// else if (key === 'start') {
// klass = '' + cellClass;
// }
// else if (key === 'end') {
// klass = '' + cellClass;
// }
// else {
// klass = ' ' + cellClass;
// }
// $( '<div/>', {
// id: val.id || null,
// "class": klass + ' ' + (val.className || '')
// } )
// .append( val.contents )
// .appendTo( row );
// } );
// };
return DataTable;
}));

Loading…
Cancel
Save