├── .dockerignore ├── .github └── workflows │ ├── docker-build-push.yaml │ └── rust.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── Dockerfile ├── LICENSE ├── README.md ├── docker-compose.yaml ├── inv_sig_helper.service └── src ├── consts.rs ├── jobs.rs ├── main.rs ├── opcode.rs └── player.rs /.dockerignore: -------------------------------------------------------------------------------- 1 | # Rust build artifacts 2 | /target 3 | 4 | # Git files 5 | .git 6 | .gitignore 7 | 8 | # Docker Compose file 9 | docker-compose.yaml 10 | 11 | # Documentation 12 | README.md 13 | LICENSE 14 | -------------------------------------------------------------------------------- /.github/workflows/docker-build-push.yaml: -------------------------------------------------------------------------------- 1 | name: Build and Push Docker Image 2 | 3 | # Define when this workflow will run 4 | on: 5 | push: 6 | branches: 7 | - master # Trigger on pushes to master branch 8 | tags: 9 | - '[0-9]+.[0-9]+.[0-9]+' # Trigger on semantic version tags 10 | paths-ignore: 11 | - 'Cargo.lock' 12 | - 'LICENSE' 13 | - 'README.md' 14 | - 'docker-compose.yml' 15 | workflow_dispatch: # Allow manual triggering of the workflow 16 | 17 | # Define environment variables used throughout the workflow 18 | env: 19 | REGISTRY: quay.io 20 | IMAGE_NAME: invidious/inv-sig-helper 21 | 22 | jobs: 23 | build-and-push: 24 | runs-on: ubuntu-latest 25 | 26 | steps: 27 | # Step 1: Check out the repository code 28 | - name: Checkout code 29 | uses: actions/checkout@v3 30 | 31 | # Step 2: Set up QEMU for multi-architecture builds 32 | - name: Set up QEMU 33 | uses: docker/setup-qemu-action@v2 34 | 35 | # Step 3: Set up Docker Buildx for enhanced build capabilities 36 | - name: Set up Docker Buildx 37 | uses: docker/setup-buildx-action@v2 38 | 39 | # Step 4: Authenticate with Quay.io registry 40 | - name: Log in to Quay.io 41 | uses: docker/login-action@v2 42 | with: 43 | registry: ${{ env.REGISTRY }} 44 | username: ${{ secrets.QUAY_USERNAME }} 45 | password: ${{ secrets.QUAY_PASSWORD }} 46 | 47 | # Step 5: Extract metadata for Docker image tagging and labeling 48 | - name: Extract metadata for Docker 49 | id: meta 50 | uses: docker/metadata-action@v4 51 | with: 52 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} 53 | # Define tagging strategy 54 | tags: | 55 | type=semver,pattern={{version}} 56 | type=semver,pattern={{major}}.{{minor}} 57 | type=semver,pattern={{major}} 58 | type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} 59 | type=sha,prefix={{branch}}- 60 | # Define labels 61 | labels: | 62 | quay.expires-after=12w 63 | 64 | # Step 6: Build and push the Docker image 65 | - name: Build and push Docker image 66 | uses: docker/build-push-action@v4 67 | with: 68 | context: . 69 | push: true 70 | platforms: linux/amd64,linux/arm64 # Build for multiple architectures 71 | tags: ${{ steps.meta.outputs.tags }} 72 | labels: ${{ steps.meta.outputs.labels }} 73 | -------------------------------------------------------------------------------- /.github/workflows/rust.yml: -------------------------------------------------------------------------------- 1 | name: Build and test inv_sig_helper 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | paths-ignore: 7 | - 'LICENSE' 8 | - 'README.md' 9 | - 'docker-compose.yml' 10 | pull_request: 11 | branches: [ "master" ] 12 | schedule: 13 | # every 2 hours 14 | - cron: "0 */2 * * *" 15 | workflow_dispatch: # Allow manual triggering of the workflow 16 | 17 | 18 | env: 19 | CARGO_TERM_COLOR: always 20 | 21 | jobs: 22 | build: 23 | 24 | runs-on: ubuntu-latest 25 | 26 | steps: 27 | - uses: actions/checkout@v4 28 | - name: Build 29 | run: cargo build --verbose 30 | - name: Test server 31 | run: target/debug/inv_sig_helper_rust --test 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 4 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.21.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "aho-corasick" 22 | version = "1.1.3" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" 25 | dependencies = [ 26 | "memchr", 27 | ] 28 | 29 | [[package]] 30 | name = "anstream" 31 | version = "0.6.15" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" 34 | dependencies = [ 35 | "anstyle", 36 | "anstyle-parse", 37 | "anstyle-query", 38 | "anstyle-wincon", 39 | "colorchoice", 40 | "is_terminal_polyfill", 41 | "utf8parse", 42 | ] 43 | 44 | [[package]] 45 | name = "anstyle" 46 | version = "1.0.8" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" 49 | 50 | [[package]] 51 | name = "anstyle-parse" 52 | version = "0.2.5" 53 | source = "registry+https://github.com/rust-lang/crates.io-index" 54 | checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" 55 | dependencies = [ 56 | "utf8parse", 57 | ] 58 | 59 | [[package]] 60 | name = "anstyle-query" 61 | version = "1.1.1" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" 64 | dependencies = [ 65 | "windows-sys 0.52.0", 66 | ] 67 | 68 | [[package]] 69 | name = "anstyle-wincon" 70 | version = "3.0.4" 71 | source = "registry+https://github.com/rust-lang/crates.io-index" 72 | checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" 73 | dependencies = [ 74 | "anstyle", 75 | "windows-sys 0.52.0", 76 | ] 77 | 78 | [[package]] 79 | name = "async-lock" 80 | version = "3.4.0" 81 | source = "registry+https://github.com/rust-lang/crates.io-index" 82 | checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" 83 | dependencies = [ 84 | "event-listener", 85 | "event-listener-strategy", 86 | "pin-project-lite", 87 | ] 88 | 89 | [[package]] 90 | name = "autocfg" 91 | version = "1.2.0" 92 | source = "registry+https://github.com/rust-lang/crates.io-index" 93 | checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" 94 | 95 | [[package]] 96 | name = "backtrace" 97 | version = "0.3.71" 98 | source = "registry+https://github.com/rust-lang/crates.io-index" 99 | checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" 100 | dependencies = [ 101 | "addr2line", 102 | "cc", 103 | "cfg-if", 104 | "libc", 105 | "miniz_oxide", 106 | "object", 107 | "rustc-demangle", 108 | ] 109 | 110 | [[package]] 111 | name = "base64" 112 | version = "0.22.0" 113 | source = "registry+https://github.com/rust-lang/crates.io-index" 114 | checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" 115 | 116 | [[package]] 117 | name = "bindgen" 118 | version = "0.69.5" 119 | source = "registry+https://github.com/rust-lang/crates.io-index" 120 | checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" 121 | dependencies = [ 122 | "bitflags 2.5.0", 123 | "cexpr", 124 | "clang-sys", 125 | "itertools", 126 | "lazy_static", 127 | "lazycell", 128 | "log", 129 | "prettyplease", 130 | "proc-macro2", 131 | "quote", 132 | "regex", 133 | "rustc-hash", 134 | "shlex", 135 | "syn 2.0.60", 136 | "which", 137 | ] 138 | 139 | [[package]] 140 | name = "bitflags" 141 | version = "1.3.2" 142 | source = "registry+https://github.com/rust-lang/crates.io-index" 143 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 144 | 145 | [[package]] 146 | name = "bitflags" 147 | version = "2.5.0" 148 | source = "registry+https://github.com/rust-lang/crates.io-index" 149 | checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" 150 | 151 | [[package]] 152 | name = "bumpalo" 153 | version = "3.16.0" 154 | source = "registry+https://github.com/rust-lang/crates.io-index" 155 | checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" 156 | 157 | [[package]] 158 | name = "bytes" 159 | version = "1.6.0" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" 162 | 163 | [[package]] 164 | name = "cc" 165 | version = "1.0.95" 166 | source = "registry+https://github.com/rust-lang/crates.io-index" 167 | checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" 168 | 169 | [[package]] 170 | name = "cexpr" 171 | version = "0.6.0" 172 | source = "registry+https://github.com/rust-lang/crates.io-index" 173 | checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" 174 | dependencies = [ 175 | "nom", 176 | ] 177 | 178 | [[package]] 179 | name = "cfg-if" 180 | version = "1.0.0" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 183 | 184 | [[package]] 185 | name = "clang-sys" 186 | version = "1.8.1" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" 189 | dependencies = [ 190 | "glob", 191 | "libc", 192 | "libloading", 193 | ] 194 | 195 | [[package]] 196 | name = "colorchoice" 197 | version = "1.0.2" 198 | source = "registry+https://github.com/rust-lang/crates.io-index" 199 | checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" 200 | 201 | [[package]] 202 | name = "concurrent-queue" 203 | version = "2.5.0" 204 | source = "registry+https://github.com/rust-lang/crates.io-index" 205 | checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" 206 | dependencies = [ 207 | "crossbeam-utils", 208 | ] 209 | 210 | [[package]] 211 | name = "convert_case" 212 | version = "0.6.0" 213 | source = "registry+https://github.com/rust-lang/crates.io-index" 214 | checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" 215 | dependencies = [ 216 | "unicode-segmentation", 217 | ] 218 | 219 | [[package]] 220 | name = "core-foundation" 221 | version = "0.9.4" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" 224 | dependencies = [ 225 | "core-foundation-sys", 226 | "libc", 227 | ] 228 | 229 | [[package]] 230 | name = "core-foundation-sys" 231 | version = "0.8.6" 232 | source = "registry+https://github.com/rust-lang/crates.io-index" 233 | checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" 234 | 235 | [[package]] 236 | name = "crossbeam-queue" 237 | version = "0.3.11" 238 | source = "registry+https://github.com/rust-lang/crates.io-index" 239 | checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" 240 | dependencies = [ 241 | "crossbeam-utils", 242 | ] 243 | 244 | [[package]] 245 | name = "crossbeam-utils" 246 | version = "0.8.19" 247 | source = "registry+https://github.com/rust-lang/crates.io-index" 248 | checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" 249 | 250 | [[package]] 251 | name = "either" 252 | version = "1.13.0" 253 | source = "registry+https://github.com/rust-lang/crates.io-index" 254 | checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" 255 | 256 | [[package]] 257 | name = "encoding_rs" 258 | version = "0.8.34" 259 | source = "registry+https://github.com/rust-lang/crates.io-index" 260 | checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" 261 | dependencies = [ 262 | "cfg-if", 263 | ] 264 | 265 | [[package]] 266 | name = "env_filter" 267 | version = "0.1.2" 268 | source = "registry+https://github.com/rust-lang/crates.io-index" 269 | checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" 270 | dependencies = [ 271 | "log", 272 | "regex", 273 | ] 274 | 275 | [[package]] 276 | name = "env_logger" 277 | version = "0.11.5" 278 | source = "registry+https://github.com/rust-lang/crates.io-index" 279 | checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" 280 | dependencies = [ 281 | "anstream", 282 | "anstyle", 283 | "env_filter", 284 | "humantime", 285 | "log", 286 | ] 287 | 288 | [[package]] 289 | name = "equivalent" 290 | version = "1.0.1" 291 | source = "registry+https://github.com/rust-lang/crates.io-index" 292 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 293 | 294 | [[package]] 295 | name = "errno" 296 | version = "0.3.8" 297 | source = "registry+https://github.com/rust-lang/crates.io-index" 298 | checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" 299 | dependencies = [ 300 | "libc", 301 | "windows-sys 0.52.0", 302 | ] 303 | 304 | [[package]] 305 | name = "event-listener" 306 | version = "5.4.0" 307 | source = "registry+https://github.com/rust-lang/crates.io-index" 308 | checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" 309 | dependencies = [ 310 | "concurrent-queue", 311 | "parking", 312 | "pin-project-lite", 313 | ] 314 | 315 | [[package]] 316 | name = "event-listener-strategy" 317 | version = "0.5.3" 318 | source = "registry+https://github.com/rust-lang/crates.io-index" 319 | checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" 320 | dependencies = [ 321 | "event-listener", 322 | "pin-project-lite", 323 | ] 324 | 325 | [[package]] 326 | name = "fastrand" 327 | version = "2.1.0" 328 | source = "registry+https://github.com/rust-lang/crates.io-index" 329 | checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" 330 | 331 | [[package]] 332 | name = "fnv" 333 | version = "1.0.7" 334 | source = "registry+https://github.com/rust-lang/crates.io-index" 335 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 336 | 337 | [[package]] 338 | name = "foreign-types" 339 | version = "0.3.2" 340 | source = "registry+https://github.com/rust-lang/crates.io-index" 341 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 342 | dependencies = [ 343 | "foreign-types-shared", 344 | ] 345 | 346 | [[package]] 347 | name = "foreign-types-shared" 348 | version = "0.1.1" 349 | source = "registry+https://github.com/rust-lang/crates.io-index" 350 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 351 | 352 | [[package]] 353 | name = "form_urlencoded" 354 | version = "1.2.1" 355 | source = "registry+https://github.com/rust-lang/crates.io-index" 356 | checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" 357 | dependencies = [ 358 | "percent-encoding", 359 | ] 360 | 361 | [[package]] 362 | name = "futures" 363 | version = "0.3.30" 364 | source = "registry+https://github.com/rust-lang/crates.io-index" 365 | checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" 366 | dependencies = [ 367 | "futures-channel", 368 | "futures-core", 369 | "futures-executor", 370 | "futures-io", 371 | "futures-sink", 372 | "futures-task", 373 | "futures-util", 374 | ] 375 | 376 | [[package]] 377 | name = "futures-channel" 378 | version = "0.3.30" 379 | source = "registry+https://github.com/rust-lang/crates.io-index" 380 | checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" 381 | dependencies = [ 382 | "futures-core", 383 | "futures-sink", 384 | ] 385 | 386 | [[package]] 387 | name = "futures-core" 388 | version = "0.3.30" 389 | source = "registry+https://github.com/rust-lang/crates.io-index" 390 | checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" 391 | 392 | [[package]] 393 | name = "futures-executor" 394 | version = "0.3.30" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" 397 | dependencies = [ 398 | "futures-core", 399 | "futures-task", 400 | "futures-util", 401 | ] 402 | 403 | [[package]] 404 | name = "futures-io" 405 | version = "0.3.30" 406 | source = "registry+https://github.com/rust-lang/crates.io-index" 407 | checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" 408 | 409 | [[package]] 410 | name = "futures-macro" 411 | version = "0.3.30" 412 | source = "registry+https://github.com/rust-lang/crates.io-index" 413 | checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" 414 | dependencies = [ 415 | "proc-macro2", 416 | "quote", 417 | "syn 2.0.60", 418 | ] 419 | 420 | [[package]] 421 | name = "futures-sink" 422 | version = "0.3.30" 423 | source = "registry+https://github.com/rust-lang/crates.io-index" 424 | checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" 425 | 426 | [[package]] 427 | name = "futures-task" 428 | version = "0.3.30" 429 | source = "registry+https://github.com/rust-lang/crates.io-index" 430 | checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" 431 | 432 | [[package]] 433 | name = "futures-util" 434 | version = "0.3.30" 435 | source = "registry+https://github.com/rust-lang/crates.io-index" 436 | checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" 437 | dependencies = [ 438 | "futures-channel", 439 | "futures-core", 440 | "futures-io", 441 | "futures-macro", 442 | "futures-sink", 443 | "futures-task", 444 | "memchr", 445 | "pin-project-lite", 446 | "pin-utils", 447 | "slab", 448 | ] 449 | 450 | [[package]] 451 | name = "gimli" 452 | version = "0.28.1" 453 | source = "registry+https://github.com/rust-lang/crates.io-index" 454 | checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" 455 | 456 | [[package]] 457 | name = "glob" 458 | version = "0.3.2" 459 | source = "registry+https://github.com/rust-lang/crates.io-index" 460 | checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" 461 | 462 | [[package]] 463 | name = "h2" 464 | version = "0.4.4" 465 | source = "registry+https://github.com/rust-lang/crates.io-index" 466 | checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" 467 | dependencies = [ 468 | "bytes", 469 | "fnv", 470 | "futures-core", 471 | "futures-sink", 472 | "futures-util", 473 | "http", 474 | "indexmap", 475 | "slab", 476 | "tokio", 477 | "tokio-util", 478 | "tracing", 479 | ] 480 | 481 | [[package]] 482 | name = "hashbrown" 483 | version = "0.14.3" 484 | source = "registry+https://github.com/rust-lang/crates.io-index" 485 | checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" 486 | 487 | [[package]] 488 | name = "hermit-abi" 489 | version = "0.3.9" 490 | source = "registry+https://github.com/rust-lang/crates.io-index" 491 | checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" 492 | 493 | [[package]] 494 | name = "home" 495 | version = "0.5.11" 496 | source = "registry+https://github.com/rust-lang/crates.io-index" 497 | checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" 498 | dependencies = [ 499 | "windows-sys 0.59.0", 500 | ] 501 | 502 | [[package]] 503 | name = "http" 504 | version = "1.1.0" 505 | source = "registry+https://github.com/rust-lang/crates.io-index" 506 | checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" 507 | dependencies = [ 508 | "bytes", 509 | "fnv", 510 | "itoa", 511 | ] 512 | 513 | [[package]] 514 | name = "http-body" 515 | version = "1.0.0" 516 | source = "registry+https://github.com/rust-lang/crates.io-index" 517 | checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" 518 | dependencies = [ 519 | "bytes", 520 | "http", 521 | ] 522 | 523 | [[package]] 524 | name = "http-body-util" 525 | version = "0.1.1" 526 | source = "registry+https://github.com/rust-lang/crates.io-index" 527 | checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" 528 | dependencies = [ 529 | "bytes", 530 | "futures-core", 531 | "http", 532 | "http-body", 533 | "pin-project-lite", 534 | ] 535 | 536 | [[package]] 537 | name = "httparse" 538 | version = "1.8.0" 539 | source = "registry+https://github.com/rust-lang/crates.io-index" 540 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" 541 | 542 | [[package]] 543 | name = "humantime" 544 | version = "2.1.0" 545 | source = "registry+https://github.com/rust-lang/crates.io-index" 546 | checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" 547 | 548 | [[package]] 549 | name = "hyper" 550 | version = "1.3.1" 551 | source = "registry+https://github.com/rust-lang/crates.io-index" 552 | checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" 553 | dependencies = [ 554 | "bytes", 555 | "futures-channel", 556 | "futures-util", 557 | "h2", 558 | "http", 559 | "http-body", 560 | "httparse", 561 | "itoa", 562 | "pin-project-lite", 563 | "smallvec", 564 | "tokio", 565 | "want", 566 | ] 567 | 568 | [[package]] 569 | name = "hyper-tls" 570 | version = "0.6.0" 571 | source = "registry+https://github.com/rust-lang/crates.io-index" 572 | checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" 573 | dependencies = [ 574 | "bytes", 575 | "http-body-util", 576 | "hyper", 577 | "hyper-util", 578 | "native-tls", 579 | "tokio", 580 | "tokio-native-tls", 581 | "tower-service", 582 | ] 583 | 584 | [[package]] 585 | name = "hyper-util" 586 | version = "0.1.3" 587 | source = "registry+https://github.com/rust-lang/crates.io-index" 588 | checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" 589 | dependencies = [ 590 | "bytes", 591 | "futures-channel", 592 | "futures-util", 593 | "http", 594 | "http-body", 595 | "hyper", 596 | "pin-project-lite", 597 | "socket2", 598 | "tokio", 599 | "tower", 600 | "tower-service", 601 | "tracing", 602 | ] 603 | 604 | [[package]] 605 | name = "ident_case" 606 | version = "1.0.1" 607 | source = "registry+https://github.com/rust-lang/crates.io-index" 608 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 609 | 610 | [[package]] 611 | name = "idna" 612 | version = "0.5.0" 613 | source = "registry+https://github.com/rust-lang/crates.io-index" 614 | checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" 615 | dependencies = [ 616 | "unicode-bidi", 617 | "unicode-normalization", 618 | ] 619 | 620 | [[package]] 621 | name = "indexmap" 622 | version = "2.2.6" 623 | source = "registry+https://github.com/rust-lang/crates.io-index" 624 | checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" 625 | dependencies = [ 626 | "equivalent", 627 | "hashbrown", 628 | ] 629 | 630 | [[package]] 631 | name = "inv_sig_helper_rust" 632 | version = "0.1.0" 633 | dependencies = [ 634 | "env_logger", 635 | "futures", 636 | "lazy-regex", 637 | "log", 638 | "regex", 639 | "reqwest", 640 | "rquickjs", 641 | "tokio", 642 | "tokio-util", 643 | "tub", 644 | ] 645 | 646 | [[package]] 647 | name = "ipnet" 648 | version = "2.9.0" 649 | source = "registry+https://github.com/rust-lang/crates.io-index" 650 | checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" 651 | 652 | [[package]] 653 | name = "is_terminal_polyfill" 654 | version = "1.70.1" 655 | source = "registry+https://github.com/rust-lang/crates.io-index" 656 | checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" 657 | 658 | [[package]] 659 | name = "itertools" 660 | version = "0.12.1" 661 | source = "registry+https://github.com/rust-lang/crates.io-index" 662 | checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" 663 | dependencies = [ 664 | "either", 665 | ] 666 | 667 | [[package]] 668 | name = "itoa" 669 | version = "1.0.11" 670 | source = "registry+https://github.com/rust-lang/crates.io-index" 671 | checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" 672 | 673 | [[package]] 674 | name = "js-sys" 675 | version = "0.3.69" 676 | source = "registry+https://github.com/rust-lang/crates.io-index" 677 | checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" 678 | dependencies = [ 679 | "wasm-bindgen", 680 | ] 681 | 682 | [[package]] 683 | name = "lazy-regex" 684 | version = "3.1.0" 685 | source = "registry+https://github.com/rust-lang/crates.io-index" 686 | checksum = "5d12be4595afdf58bd19e4a9f4e24187da2a66700786ff660a418e9059937a4c" 687 | dependencies = [ 688 | "lazy-regex-proc_macros", 689 | "once_cell", 690 | "regex", 691 | ] 692 | 693 | [[package]] 694 | name = "lazy-regex-proc_macros" 695 | version = "3.1.0" 696 | source = "registry+https://github.com/rust-lang/crates.io-index" 697 | checksum = "44bcd58e6c97a7fcbaffcdc95728b393b8d98933bfadad49ed4097845b57ef0b" 698 | dependencies = [ 699 | "proc-macro2", 700 | "quote", 701 | "regex", 702 | "syn 2.0.60", 703 | ] 704 | 705 | [[package]] 706 | name = "lazy_static" 707 | version = "1.4.0" 708 | source = "registry+https://github.com/rust-lang/crates.io-index" 709 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 710 | 711 | [[package]] 712 | name = "lazycell" 713 | version = "1.3.0" 714 | source = "registry+https://github.com/rust-lang/crates.io-index" 715 | checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" 716 | 717 | [[package]] 718 | name = "libc" 719 | version = "0.2.153" 720 | source = "registry+https://github.com/rust-lang/crates.io-index" 721 | checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" 722 | 723 | [[package]] 724 | name = "libloading" 725 | version = "0.8.6" 726 | source = "registry+https://github.com/rust-lang/crates.io-index" 727 | checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" 728 | dependencies = [ 729 | "cfg-if", 730 | "windows-targets 0.48.5", 731 | ] 732 | 733 | [[package]] 734 | name = "linux-raw-sys" 735 | version = "0.4.13" 736 | source = "registry+https://github.com/rust-lang/crates.io-index" 737 | checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" 738 | 739 | [[package]] 740 | name = "lock_api" 741 | version = "0.4.12" 742 | source = "registry+https://github.com/rust-lang/crates.io-index" 743 | checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" 744 | dependencies = [ 745 | "autocfg", 746 | "scopeguard", 747 | ] 748 | 749 | [[package]] 750 | name = "log" 751 | version = "0.4.22" 752 | source = "registry+https://github.com/rust-lang/crates.io-index" 753 | checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" 754 | 755 | [[package]] 756 | name = "memchr" 757 | version = "2.7.2" 758 | source = "registry+https://github.com/rust-lang/crates.io-index" 759 | checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" 760 | 761 | [[package]] 762 | name = "mime" 763 | version = "0.3.17" 764 | source = "registry+https://github.com/rust-lang/crates.io-index" 765 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 766 | 767 | [[package]] 768 | name = "minimal-lexical" 769 | version = "0.2.1" 770 | source = "registry+https://github.com/rust-lang/crates.io-index" 771 | checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" 772 | 773 | [[package]] 774 | name = "miniz_oxide" 775 | version = "0.7.2" 776 | source = "registry+https://github.com/rust-lang/crates.io-index" 777 | checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" 778 | dependencies = [ 779 | "adler", 780 | ] 781 | 782 | [[package]] 783 | name = "mio" 784 | version = "0.8.11" 785 | source = "registry+https://github.com/rust-lang/crates.io-index" 786 | checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" 787 | dependencies = [ 788 | "libc", 789 | "wasi", 790 | "windows-sys 0.48.0", 791 | ] 792 | 793 | [[package]] 794 | name = "native-tls" 795 | version = "0.2.11" 796 | source = "registry+https://github.com/rust-lang/crates.io-index" 797 | checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" 798 | dependencies = [ 799 | "lazy_static", 800 | "libc", 801 | "log", 802 | "openssl", 803 | "openssl-probe", 804 | "openssl-sys", 805 | "schannel", 806 | "security-framework", 807 | "security-framework-sys", 808 | "tempfile", 809 | ] 810 | 811 | [[package]] 812 | name = "nom" 813 | version = "7.1.3" 814 | source = "registry+https://github.com/rust-lang/crates.io-index" 815 | checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" 816 | dependencies = [ 817 | "memchr", 818 | "minimal-lexical", 819 | ] 820 | 821 | [[package]] 822 | name = "num_cpus" 823 | version = "1.16.0" 824 | source = "registry+https://github.com/rust-lang/crates.io-index" 825 | checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" 826 | dependencies = [ 827 | "hermit-abi", 828 | "libc", 829 | ] 830 | 831 | [[package]] 832 | name = "object" 833 | version = "0.32.2" 834 | source = "registry+https://github.com/rust-lang/crates.io-index" 835 | checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" 836 | dependencies = [ 837 | "memchr", 838 | ] 839 | 840 | [[package]] 841 | name = "once_cell" 842 | version = "1.19.0" 843 | source = "registry+https://github.com/rust-lang/crates.io-index" 844 | checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" 845 | 846 | [[package]] 847 | name = "openssl" 848 | version = "0.10.66" 849 | source = "registry+https://github.com/rust-lang/crates.io-index" 850 | checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" 851 | dependencies = [ 852 | "bitflags 2.5.0", 853 | "cfg-if", 854 | "foreign-types", 855 | "libc", 856 | "once_cell", 857 | "openssl-macros", 858 | "openssl-sys", 859 | ] 860 | 861 | [[package]] 862 | name = "openssl-macros" 863 | version = "0.1.1" 864 | source = "registry+https://github.com/rust-lang/crates.io-index" 865 | checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" 866 | dependencies = [ 867 | "proc-macro2", 868 | "quote", 869 | "syn 2.0.60", 870 | ] 871 | 872 | [[package]] 873 | name = "openssl-probe" 874 | version = "0.1.5" 875 | source = "registry+https://github.com/rust-lang/crates.io-index" 876 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 877 | 878 | [[package]] 879 | name = "openssl-sys" 880 | version = "0.9.103" 881 | source = "registry+https://github.com/rust-lang/crates.io-index" 882 | checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" 883 | dependencies = [ 884 | "cc", 885 | "libc", 886 | "pkg-config", 887 | "vcpkg", 888 | ] 889 | 890 | [[package]] 891 | name = "parking" 892 | version = "2.2.1" 893 | source = "registry+https://github.com/rust-lang/crates.io-index" 894 | checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" 895 | 896 | [[package]] 897 | name = "parking_lot" 898 | version = "0.12.2" 899 | source = "registry+https://github.com/rust-lang/crates.io-index" 900 | checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" 901 | dependencies = [ 902 | "lock_api", 903 | "parking_lot_core", 904 | ] 905 | 906 | [[package]] 907 | name = "parking_lot_core" 908 | version = "0.9.10" 909 | source = "registry+https://github.com/rust-lang/crates.io-index" 910 | checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" 911 | dependencies = [ 912 | "cfg-if", 913 | "libc", 914 | "redox_syscall", 915 | "smallvec", 916 | "windows-targets 0.52.6", 917 | ] 918 | 919 | [[package]] 920 | name = "percent-encoding" 921 | version = "2.3.1" 922 | source = "registry+https://github.com/rust-lang/crates.io-index" 923 | checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" 924 | 925 | [[package]] 926 | name = "pin-project" 927 | version = "1.1.5" 928 | source = "registry+https://github.com/rust-lang/crates.io-index" 929 | checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" 930 | dependencies = [ 931 | "pin-project-internal", 932 | ] 933 | 934 | [[package]] 935 | name = "pin-project-internal" 936 | version = "1.1.5" 937 | source = "registry+https://github.com/rust-lang/crates.io-index" 938 | checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" 939 | dependencies = [ 940 | "proc-macro2", 941 | "quote", 942 | "syn 2.0.60", 943 | ] 944 | 945 | [[package]] 946 | name = "pin-project-lite" 947 | version = "0.2.14" 948 | source = "registry+https://github.com/rust-lang/crates.io-index" 949 | checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" 950 | 951 | [[package]] 952 | name = "pin-utils" 953 | version = "0.1.0" 954 | source = "registry+https://github.com/rust-lang/crates.io-index" 955 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 956 | 957 | [[package]] 958 | name = "pkg-config" 959 | version = "0.3.30" 960 | source = "registry+https://github.com/rust-lang/crates.io-index" 961 | checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" 962 | 963 | [[package]] 964 | name = "prettyplease" 965 | version = "0.2.20" 966 | source = "registry+https://github.com/rust-lang/crates.io-index" 967 | checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" 968 | dependencies = [ 969 | "proc-macro2", 970 | "syn 2.0.60", 971 | ] 972 | 973 | [[package]] 974 | name = "proc-macro-crate" 975 | version = "1.3.1" 976 | source = "registry+https://github.com/rust-lang/crates.io-index" 977 | checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" 978 | dependencies = [ 979 | "once_cell", 980 | "toml_edit", 981 | ] 982 | 983 | [[package]] 984 | name = "proc-macro-error" 985 | version = "1.0.4" 986 | source = "registry+https://github.com/rust-lang/crates.io-index" 987 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 988 | dependencies = [ 989 | "proc-macro-error-attr", 990 | "proc-macro2", 991 | "quote", 992 | "syn 1.0.109", 993 | "version_check", 994 | ] 995 | 996 | [[package]] 997 | name = "proc-macro-error-attr" 998 | version = "1.0.4" 999 | source = "registry+https://github.com/rust-lang/crates.io-index" 1000 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 1001 | dependencies = [ 1002 | "proc-macro2", 1003 | "quote", 1004 | "version_check", 1005 | ] 1006 | 1007 | [[package]] 1008 | name = "proc-macro2" 1009 | version = "1.0.81" 1010 | source = "registry+https://github.com/rust-lang/crates.io-index" 1011 | checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" 1012 | dependencies = [ 1013 | "unicode-ident", 1014 | ] 1015 | 1016 | [[package]] 1017 | name = "quote" 1018 | version = "1.0.36" 1019 | source = "registry+https://github.com/rust-lang/crates.io-index" 1020 | checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" 1021 | dependencies = [ 1022 | "proc-macro2", 1023 | ] 1024 | 1025 | [[package]] 1026 | name = "redox_syscall" 1027 | version = "0.5.1" 1028 | source = "registry+https://github.com/rust-lang/crates.io-index" 1029 | checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" 1030 | dependencies = [ 1031 | "bitflags 2.5.0", 1032 | ] 1033 | 1034 | [[package]] 1035 | name = "regex" 1036 | version = "1.10.4" 1037 | source = "registry+https://github.com/rust-lang/crates.io-index" 1038 | checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" 1039 | dependencies = [ 1040 | "aho-corasick", 1041 | "memchr", 1042 | "regex-automata", 1043 | "regex-syntax", 1044 | ] 1045 | 1046 | [[package]] 1047 | name = "regex-automata" 1048 | version = "0.4.6" 1049 | source = "registry+https://github.com/rust-lang/crates.io-index" 1050 | checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" 1051 | dependencies = [ 1052 | "aho-corasick", 1053 | "memchr", 1054 | "regex-syntax", 1055 | ] 1056 | 1057 | [[package]] 1058 | name = "regex-syntax" 1059 | version = "0.8.3" 1060 | source = "registry+https://github.com/rust-lang/crates.io-index" 1061 | checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" 1062 | 1063 | [[package]] 1064 | name = "relative-path" 1065 | version = "1.9.3" 1066 | source = "registry+https://github.com/rust-lang/crates.io-index" 1067 | checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" 1068 | 1069 | [[package]] 1070 | name = "reqwest" 1071 | version = "0.12.4" 1072 | source = "registry+https://github.com/rust-lang/crates.io-index" 1073 | checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" 1074 | dependencies = [ 1075 | "base64", 1076 | "bytes", 1077 | "encoding_rs", 1078 | "futures-core", 1079 | "futures-util", 1080 | "h2", 1081 | "http", 1082 | "http-body", 1083 | "http-body-util", 1084 | "hyper", 1085 | "hyper-tls", 1086 | "hyper-util", 1087 | "ipnet", 1088 | "js-sys", 1089 | "log", 1090 | "mime", 1091 | "native-tls", 1092 | "once_cell", 1093 | "percent-encoding", 1094 | "pin-project-lite", 1095 | "rustls-pemfile", 1096 | "serde", 1097 | "serde_json", 1098 | "serde_urlencoded", 1099 | "sync_wrapper", 1100 | "system-configuration", 1101 | "tokio", 1102 | "tokio-native-tls", 1103 | "tower-service", 1104 | "url", 1105 | "wasm-bindgen", 1106 | "wasm-bindgen-futures", 1107 | "web-sys", 1108 | "winreg", 1109 | ] 1110 | 1111 | [[package]] 1112 | name = "rquickjs" 1113 | version = "0.6.2" 1114 | source = "registry+https://github.com/rust-lang/crates.io-index" 1115 | checksum = "9cbd33e0b668aea0ab238b9164523aca929096f9f40834700d71d91dd4888882" 1116 | dependencies = [ 1117 | "rquickjs-core", 1118 | "rquickjs-macro", 1119 | ] 1120 | 1121 | [[package]] 1122 | name = "rquickjs-core" 1123 | version = "0.6.2" 1124 | source = "registry+https://github.com/rust-lang/crates.io-index" 1125 | checksum = "2e9129d69b7b8f7ee8ad1da5b12c7f4a8a8acd45f2e6dd9cb2ee1bc5a1f2fa3d" 1126 | dependencies = [ 1127 | "async-lock", 1128 | "relative-path", 1129 | "rquickjs-sys", 1130 | ] 1131 | 1132 | [[package]] 1133 | name = "rquickjs-macro" 1134 | version = "0.6.2" 1135 | source = "registry+https://github.com/rust-lang/crates.io-index" 1136 | checksum = "c7d2ecaf7c9eda262e02a91e9541989a9dd18984d17d0d97f99f33b464318057" 1137 | dependencies = [ 1138 | "convert_case", 1139 | "fnv", 1140 | "ident_case", 1141 | "indexmap", 1142 | "proc-macro-crate", 1143 | "proc-macro-error", 1144 | "proc-macro2", 1145 | "quote", 1146 | "rquickjs-core", 1147 | "syn 2.0.60", 1148 | ] 1149 | 1150 | [[package]] 1151 | name = "rquickjs-sys" 1152 | version = "0.6.2" 1153 | source = "registry+https://github.com/rust-lang/crates.io-index" 1154 | checksum = "bf6f2288d8e7fbb5130f62cf720451641e99d55f6fde9db86aa2914ecb553fd2" 1155 | dependencies = [ 1156 | "bindgen", 1157 | "cc", 1158 | ] 1159 | 1160 | [[package]] 1161 | name = "rustc-demangle" 1162 | version = "0.1.23" 1163 | source = "registry+https://github.com/rust-lang/crates.io-index" 1164 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" 1165 | 1166 | [[package]] 1167 | name = "rustc-hash" 1168 | version = "1.1.0" 1169 | source = "registry+https://github.com/rust-lang/crates.io-index" 1170 | checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" 1171 | 1172 | [[package]] 1173 | name = "rustix" 1174 | version = "0.38.34" 1175 | source = "registry+https://github.com/rust-lang/crates.io-index" 1176 | checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" 1177 | dependencies = [ 1178 | "bitflags 2.5.0", 1179 | "errno", 1180 | "libc", 1181 | "linux-raw-sys", 1182 | "windows-sys 0.52.0", 1183 | ] 1184 | 1185 | [[package]] 1186 | name = "rustls-pemfile" 1187 | version = "2.1.2" 1188 | source = "registry+https://github.com/rust-lang/crates.io-index" 1189 | checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" 1190 | dependencies = [ 1191 | "base64", 1192 | "rustls-pki-types", 1193 | ] 1194 | 1195 | [[package]] 1196 | name = "rustls-pki-types" 1197 | version = "1.5.0" 1198 | source = "registry+https://github.com/rust-lang/crates.io-index" 1199 | checksum = "beb461507cee2c2ff151784c52762cf4d9ff6a61f3e80968600ed24fa837fa54" 1200 | 1201 | [[package]] 1202 | name = "ryu" 1203 | version = "1.0.17" 1204 | source = "registry+https://github.com/rust-lang/crates.io-index" 1205 | checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" 1206 | 1207 | [[package]] 1208 | name = "schannel" 1209 | version = "0.1.23" 1210 | source = "registry+https://github.com/rust-lang/crates.io-index" 1211 | checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" 1212 | dependencies = [ 1213 | "windows-sys 0.52.0", 1214 | ] 1215 | 1216 | [[package]] 1217 | name = "scopeguard" 1218 | version = "1.2.0" 1219 | source = "registry+https://github.com/rust-lang/crates.io-index" 1220 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 1221 | 1222 | [[package]] 1223 | name = "security-framework" 1224 | version = "2.10.0" 1225 | source = "registry+https://github.com/rust-lang/crates.io-index" 1226 | checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" 1227 | dependencies = [ 1228 | "bitflags 1.3.2", 1229 | "core-foundation", 1230 | "core-foundation-sys", 1231 | "libc", 1232 | "security-framework-sys", 1233 | ] 1234 | 1235 | [[package]] 1236 | name = "security-framework-sys" 1237 | version = "2.10.0" 1238 | source = "registry+https://github.com/rust-lang/crates.io-index" 1239 | checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" 1240 | dependencies = [ 1241 | "core-foundation-sys", 1242 | "libc", 1243 | ] 1244 | 1245 | [[package]] 1246 | name = "serde" 1247 | version = "1.0.199" 1248 | source = "registry+https://github.com/rust-lang/crates.io-index" 1249 | checksum = "0c9f6e76df036c77cd94996771fb40db98187f096dd0b9af39c6c6e452ba966a" 1250 | dependencies = [ 1251 | "serde_derive", 1252 | ] 1253 | 1254 | [[package]] 1255 | name = "serde_derive" 1256 | version = "1.0.199" 1257 | source = "registry+https://github.com/rust-lang/crates.io-index" 1258 | checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc" 1259 | dependencies = [ 1260 | "proc-macro2", 1261 | "quote", 1262 | "syn 2.0.60", 1263 | ] 1264 | 1265 | [[package]] 1266 | name = "serde_json" 1267 | version = "1.0.116" 1268 | source = "registry+https://github.com/rust-lang/crates.io-index" 1269 | checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" 1270 | dependencies = [ 1271 | "itoa", 1272 | "ryu", 1273 | "serde", 1274 | ] 1275 | 1276 | [[package]] 1277 | name = "serde_urlencoded" 1278 | version = "0.7.1" 1279 | source = "registry+https://github.com/rust-lang/crates.io-index" 1280 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 1281 | dependencies = [ 1282 | "form_urlencoded", 1283 | "itoa", 1284 | "ryu", 1285 | "serde", 1286 | ] 1287 | 1288 | [[package]] 1289 | name = "shlex" 1290 | version = "1.3.0" 1291 | source = "registry+https://github.com/rust-lang/crates.io-index" 1292 | checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" 1293 | 1294 | [[package]] 1295 | name = "signal-hook-registry" 1296 | version = "1.4.2" 1297 | source = "registry+https://github.com/rust-lang/crates.io-index" 1298 | checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" 1299 | dependencies = [ 1300 | "libc", 1301 | ] 1302 | 1303 | [[package]] 1304 | name = "slab" 1305 | version = "0.4.9" 1306 | source = "registry+https://github.com/rust-lang/crates.io-index" 1307 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 1308 | dependencies = [ 1309 | "autocfg", 1310 | ] 1311 | 1312 | [[package]] 1313 | name = "smallvec" 1314 | version = "1.13.2" 1315 | source = "registry+https://github.com/rust-lang/crates.io-index" 1316 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" 1317 | 1318 | [[package]] 1319 | name = "socket2" 1320 | version = "0.5.6" 1321 | source = "registry+https://github.com/rust-lang/crates.io-index" 1322 | checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" 1323 | dependencies = [ 1324 | "libc", 1325 | "windows-sys 0.52.0", 1326 | ] 1327 | 1328 | [[package]] 1329 | name = "syn" 1330 | version = "1.0.109" 1331 | source = "registry+https://github.com/rust-lang/crates.io-index" 1332 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 1333 | dependencies = [ 1334 | "proc-macro2", 1335 | "unicode-ident", 1336 | ] 1337 | 1338 | [[package]] 1339 | name = "syn" 1340 | version = "2.0.60" 1341 | source = "registry+https://github.com/rust-lang/crates.io-index" 1342 | checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" 1343 | dependencies = [ 1344 | "proc-macro2", 1345 | "quote", 1346 | "unicode-ident", 1347 | ] 1348 | 1349 | [[package]] 1350 | name = "sync_wrapper" 1351 | version = "0.1.2" 1352 | source = "registry+https://github.com/rust-lang/crates.io-index" 1353 | checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" 1354 | 1355 | [[package]] 1356 | name = "system-configuration" 1357 | version = "0.5.1" 1358 | source = "registry+https://github.com/rust-lang/crates.io-index" 1359 | checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" 1360 | dependencies = [ 1361 | "bitflags 1.3.2", 1362 | "core-foundation", 1363 | "system-configuration-sys", 1364 | ] 1365 | 1366 | [[package]] 1367 | name = "system-configuration-sys" 1368 | version = "0.5.0" 1369 | source = "registry+https://github.com/rust-lang/crates.io-index" 1370 | checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" 1371 | dependencies = [ 1372 | "core-foundation-sys", 1373 | "libc", 1374 | ] 1375 | 1376 | [[package]] 1377 | name = "tempfile" 1378 | version = "3.10.1" 1379 | source = "registry+https://github.com/rust-lang/crates.io-index" 1380 | checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" 1381 | dependencies = [ 1382 | "cfg-if", 1383 | "fastrand", 1384 | "rustix", 1385 | "windows-sys 0.52.0", 1386 | ] 1387 | 1388 | [[package]] 1389 | name = "tinyvec" 1390 | version = "1.6.0" 1391 | source = "registry+https://github.com/rust-lang/crates.io-index" 1392 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 1393 | dependencies = [ 1394 | "tinyvec_macros", 1395 | ] 1396 | 1397 | [[package]] 1398 | name = "tinyvec_macros" 1399 | version = "0.1.1" 1400 | source = "registry+https://github.com/rust-lang/crates.io-index" 1401 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 1402 | 1403 | [[package]] 1404 | name = "tokio" 1405 | version = "1.37.0" 1406 | source = "registry+https://github.com/rust-lang/crates.io-index" 1407 | checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" 1408 | dependencies = [ 1409 | "backtrace", 1410 | "bytes", 1411 | "libc", 1412 | "mio", 1413 | "num_cpus", 1414 | "parking_lot", 1415 | "pin-project-lite", 1416 | "signal-hook-registry", 1417 | "socket2", 1418 | "tokio-macros", 1419 | "windows-sys 0.48.0", 1420 | ] 1421 | 1422 | [[package]] 1423 | name = "tokio-macros" 1424 | version = "2.2.0" 1425 | source = "registry+https://github.com/rust-lang/crates.io-index" 1426 | checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" 1427 | dependencies = [ 1428 | "proc-macro2", 1429 | "quote", 1430 | "syn 2.0.60", 1431 | ] 1432 | 1433 | [[package]] 1434 | name = "tokio-native-tls" 1435 | version = "0.3.1" 1436 | source = "registry+https://github.com/rust-lang/crates.io-index" 1437 | checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" 1438 | dependencies = [ 1439 | "native-tls", 1440 | "tokio", 1441 | ] 1442 | 1443 | [[package]] 1444 | name = "tokio-util" 1445 | version = "0.7.10" 1446 | source = "registry+https://github.com/rust-lang/crates.io-index" 1447 | checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" 1448 | dependencies = [ 1449 | "bytes", 1450 | "futures-core", 1451 | "futures-io", 1452 | "futures-sink", 1453 | "futures-util", 1454 | "pin-project-lite", 1455 | "tokio", 1456 | "tracing", 1457 | ] 1458 | 1459 | [[package]] 1460 | name = "toml_datetime" 1461 | version = "0.6.8" 1462 | source = "registry+https://github.com/rust-lang/crates.io-index" 1463 | checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" 1464 | 1465 | [[package]] 1466 | name = "toml_edit" 1467 | version = "0.19.15" 1468 | source = "registry+https://github.com/rust-lang/crates.io-index" 1469 | checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" 1470 | dependencies = [ 1471 | "indexmap", 1472 | "toml_datetime", 1473 | "winnow", 1474 | ] 1475 | 1476 | [[package]] 1477 | name = "tower" 1478 | version = "0.4.13" 1479 | source = "registry+https://github.com/rust-lang/crates.io-index" 1480 | checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" 1481 | dependencies = [ 1482 | "futures-core", 1483 | "futures-util", 1484 | "pin-project", 1485 | "pin-project-lite", 1486 | "tokio", 1487 | "tower-layer", 1488 | "tower-service", 1489 | "tracing", 1490 | ] 1491 | 1492 | [[package]] 1493 | name = "tower-layer" 1494 | version = "0.3.2" 1495 | source = "registry+https://github.com/rust-lang/crates.io-index" 1496 | checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" 1497 | 1498 | [[package]] 1499 | name = "tower-service" 1500 | version = "0.3.2" 1501 | source = "registry+https://github.com/rust-lang/crates.io-index" 1502 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" 1503 | 1504 | [[package]] 1505 | name = "tracing" 1506 | version = "0.1.40" 1507 | source = "registry+https://github.com/rust-lang/crates.io-index" 1508 | checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" 1509 | dependencies = [ 1510 | "log", 1511 | "pin-project-lite", 1512 | "tracing-core", 1513 | ] 1514 | 1515 | [[package]] 1516 | name = "tracing-core" 1517 | version = "0.1.32" 1518 | source = "registry+https://github.com/rust-lang/crates.io-index" 1519 | checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" 1520 | dependencies = [ 1521 | "once_cell", 1522 | ] 1523 | 1524 | [[package]] 1525 | name = "try-lock" 1526 | version = "0.2.5" 1527 | source = "registry+https://github.com/rust-lang/crates.io-index" 1528 | checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" 1529 | 1530 | [[package]] 1531 | name = "tub" 1532 | version = "0.3.7" 1533 | source = "registry+https://github.com/rust-lang/crates.io-index" 1534 | checksum = "6bca43faba247bc76eb1d6c1b8b561e4a1c5bdd427cc3d7a007faabea75c683a" 1535 | dependencies = [ 1536 | "crossbeam-queue", 1537 | "tokio", 1538 | ] 1539 | 1540 | [[package]] 1541 | name = "unicode-bidi" 1542 | version = "0.3.15" 1543 | source = "registry+https://github.com/rust-lang/crates.io-index" 1544 | checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" 1545 | 1546 | [[package]] 1547 | name = "unicode-ident" 1548 | version = "1.0.12" 1549 | source = "registry+https://github.com/rust-lang/crates.io-index" 1550 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 1551 | 1552 | [[package]] 1553 | name = "unicode-normalization" 1554 | version = "0.1.23" 1555 | source = "registry+https://github.com/rust-lang/crates.io-index" 1556 | checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" 1557 | dependencies = [ 1558 | "tinyvec", 1559 | ] 1560 | 1561 | [[package]] 1562 | name = "unicode-segmentation" 1563 | version = "1.12.0" 1564 | source = "registry+https://github.com/rust-lang/crates.io-index" 1565 | checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" 1566 | 1567 | [[package]] 1568 | name = "url" 1569 | version = "2.5.0" 1570 | source = "registry+https://github.com/rust-lang/crates.io-index" 1571 | checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" 1572 | dependencies = [ 1573 | "form_urlencoded", 1574 | "idna", 1575 | "percent-encoding", 1576 | ] 1577 | 1578 | [[package]] 1579 | name = "utf8parse" 1580 | version = "0.2.2" 1581 | source = "registry+https://github.com/rust-lang/crates.io-index" 1582 | checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" 1583 | 1584 | [[package]] 1585 | name = "vcpkg" 1586 | version = "0.2.15" 1587 | source = "registry+https://github.com/rust-lang/crates.io-index" 1588 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 1589 | 1590 | [[package]] 1591 | name = "version_check" 1592 | version = "0.9.5" 1593 | source = "registry+https://github.com/rust-lang/crates.io-index" 1594 | checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" 1595 | 1596 | [[package]] 1597 | name = "want" 1598 | version = "0.3.1" 1599 | source = "registry+https://github.com/rust-lang/crates.io-index" 1600 | checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" 1601 | dependencies = [ 1602 | "try-lock", 1603 | ] 1604 | 1605 | [[package]] 1606 | name = "wasi" 1607 | version = "0.11.0+wasi-snapshot-preview1" 1608 | source = "registry+https://github.com/rust-lang/crates.io-index" 1609 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1610 | 1611 | [[package]] 1612 | name = "wasm-bindgen" 1613 | version = "0.2.92" 1614 | source = "registry+https://github.com/rust-lang/crates.io-index" 1615 | checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" 1616 | dependencies = [ 1617 | "cfg-if", 1618 | "wasm-bindgen-macro", 1619 | ] 1620 | 1621 | [[package]] 1622 | name = "wasm-bindgen-backend" 1623 | version = "0.2.92" 1624 | source = "registry+https://github.com/rust-lang/crates.io-index" 1625 | checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" 1626 | dependencies = [ 1627 | "bumpalo", 1628 | "log", 1629 | "once_cell", 1630 | "proc-macro2", 1631 | "quote", 1632 | "syn 2.0.60", 1633 | "wasm-bindgen-shared", 1634 | ] 1635 | 1636 | [[package]] 1637 | name = "wasm-bindgen-futures" 1638 | version = "0.4.42" 1639 | source = "registry+https://github.com/rust-lang/crates.io-index" 1640 | checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" 1641 | dependencies = [ 1642 | "cfg-if", 1643 | "js-sys", 1644 | "wasm-bindgen", 1645 | "web-sys", 1646 | ] 1647 | 1648 | [[package]] 1649 | name = "wasm-bindgen-macro" 1650 | version = "0.2.92" 1651 | source = "registry+https://github.com/rust-lang/crates.io-index" 1652 | checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" 1653 | dependencies = [ 1654 | "quote", 1655 | "wasm-bindgen-macro-support", 1656 | ] 1657 | 1658 | [[package]] 1659 | name = "wasm-bindgen-macro-support" 1660 | version = "0.2.92" 1661 | source = "registry+https://github.com/rust-lang/crates.io-index" 1662 | checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" 1663 | dependencies = [ 1664 | "proc-macro2", 1665 | "quote", 1666 | "syn 2.0.60", 1667 | "wasm-bindgen-backend", 1668 | "wasm-bindgen-shared", 1669 | ] 1670 | 1671 | [[package]] 1672 | name = "wasm-bindgen-shared" 1673 | version = "0.2.92" 1674 | source = "registry+https://github.com/rust-lang/crates.io-index" 1675 | checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" 1676 | 1677 | [[package]] 1678 | name = "web-sys" 1679 | version = "0.3.69" 1680 | source = "registry+https://github.com/rust-lang/crates.io-index" 1681 | checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" 1682 | dependencies = [ 1683 | "js-sys", 1684 | "wasm-bindgen", 1685 | ] 1686 | 1687 | [[package]] 1688 | name = "which" 1689 | version = "4.4.2" 1690 | source = "registry+https://github.com/rust-lang/crates.io-index" 1691 | checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" 1692 | dependencies = [ 1693 | "either", 1694 | "home", 1695 | "once_cell", 1696 | "rustix", 1697 | ] 1698 | 1699 | [[package]] 1700 | name = "windows-sys" 1701 | version = "0.48.0" 1702 | source = "registry+https://github.com/rust-lang/crates.io-index" 1703 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1704 | dependencies = [ 1705 | "windows-targets 0.48.5", 1706 | ] 1707 | 1708 | [[package]] 1709 | name = "windows-sys" 1710 | version = "0.52.0" 1711 | source = "registry+https://github.com/rust-lang/crates.io-index" 1712 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 1713 | dependencies = [ 1714 | "windows-targets 0.52.6", 1715 | ] 1716 | 1717 | [[package]] 1718 | name = "windows-sys" 1719 | version = "0.59.0" 1720 | source = "registry+https://github.com/rust-lang/crates.io-index" 1721 | checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 1722 | dependencies = [ 1723 | "windows-targets 0.52.6", 1724 | ] 1725 | 1726 | [[package]] 1727 | name = "windows-targets" 1728 | version = "0.48.5" 1729 | source = "registry+https://github.com/rust-lang/crates.io-index" 1730 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 1731 | dependencies = [ 1732 | "windows_aarch64_gnullvm 0.48.5", 1733 | "windows_aarch64_msvc 0.48.5", 1734 | "windows_i686_gnu 0.48.5", 1735 | "windows_i686_msvc 0.48.5", 1736 | "windows_x86_64_gnu 0.48.5", 1737 | "windows_x86_64_gnullvm 0.48.5", 1738 | "windows_x86_64_msvc 0.48.5", 1739 | ] 1740 | 1741 | [[package]] 1742 | name = "windows-targets" 1743 | version = "0.52.6" 1744 | source = "registry+https://github.com/rust-lang/crates.io-index" 1745 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 1746 | dependencies = [ 1747 | "windows_aarch64_gnullvm 0.52.6", 1748 | "windows_aarch64_msvc 0.52.6", 1749 | "windows_i686_gnu 0.52.6", 1750 | "windows_i686_gnullvm", 1751 | "windows_i686_msvc 0.52.6", 1752 | "windows_x86_64_gnu 0.52.6", 1753 | "windows_x86_64_gnullvm 0.52.6", 1754 | "windows_x86_64_msvc 0.52.6", 1755 | ] 1756 | 1757 | [[package]] 1758 | name = "windows_aarch64_gnullvm" 1759 | version = "0.48.5" 1760 | source = "registry+https://github.com/rust-lang/crates.io-index" 1761 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 1762 | 1763 | [[package]] 1764 | name = "windows_aarch64_gnullvm" 1765 | version = "0.52.6" 1766 | source = "registry+https://github.com/rust-lang/crates.io-index" 1767 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 1768 | 1769 | [[package]] 1770 | name = "windows_aarch64_msvc" 1771 | version = "0.48.5" 1772 | source = "registry+https://github.com/rust-lang/crates.io-index" 1773 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 1774 | 1775 | [[package]] 1776 | name = "windows_aarch64_msvc" 1777 | version = "0.52.6" 1778 | source = "registry+https://github.com/rust-lang/crates.io-index" 1779 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 1780 | 1781 | [[package]] 1782 | name = "windows_i686_gnu" 1783 | version = "0.48.5" 1784 | source = "registry+https://github.com/rust-lang/crates.io-index" 1785 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 1786 | 1787 | [[package]] 1788 | name = "windows_i686_gnu" 1789 | version = "0.52.6" 1790 | source = "registry+https://github.com/rust-lang/crates.io-index" 1791 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 1792 | 1793 | [[package]] 1794 | name = "windows_i686_gnullvm" 1795 | version = "0.52.6" 1796 | source = "registry+https://github.com/rust-lang/crates.io-index" 1797 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 1798 | 1799 | [[package]] 1800 | name = "windows_i686_msvc" 1801 | version = "0.48.5" 1802 | source = "registry+https://github.com/rust-lang/crates.io-index" 1803 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 1804 | 1805 | [[package]] 1806 | name = "windows_i686_msvc" 1807 | version = "0.52.6" 1808 | source = "registry+https://github.com/rust-lang/crates.io-index" 1809 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 1810 | 1811 | [[package]] 1812 | name = "windows_x86_64_gnu" 1813 | version = "0.48.5" 1814 | source = "registry+https://github.com/rust-lang/crates.io-index" 1815 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 1816 | 1817 | [[package]] 1818 | name = "windows_x86_64_gnu" 1819 | version = "0.52.6" 1820 | source = "registry+https://github.com/rust-lang/crates.io-index" 1821 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 1822 | 1823 | [[package]] 1824 | name = "windows_x86_64_gnullvm" 1825 | version = "0.48.5" 1826 | source = "registry+https://github.com/rust-lang/crates.io-index" 1827 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 1828 | 1829 | [[package]] 1830 | name = "windows_x86_64_gnullvm" 1831 | version = "0.52.6" 1832 | source = "registry+https://github.com/rust-lang/crates.io-index" 1833 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 1834 | 1835 | [[package]] 1836 | name = "windows_x86_64_msvc" 1837 | version = "0.48.5" 1838 | source = "registry+https://github.com/rust-lang/crates.io-index" 1839 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 1840 | 1841 | [[package]] 1842 | name = "windows_x86_64_msvc" 1843 | version = "0.52.6" 1844 | source = "registry+https://github.com/rust-lang/crates.io-index" 1845 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 1846 | 1847 | [[package]] 1848 | name = "winnow" 1849 | version = "0.5.40" 1850 | source = "registry+https://github.com/rust-lang/crates.io-index" 1851 | checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" 1852 | dependencies = [ 1853 | "memchr", 1854 | ] 1855 | 1856 | [[package]] 1857 | name = "winreg" 1858 | version = "0.52.0" 1859 | source = "registry+https://github.com/rust-lang/crates.io-index" 1860 | checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" 1861 | dependencies = [ 1862 | "cfg-if", 1863 | "windows-sys 0.48.0", 1864 | ] 1865 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "inv_sig_helper_rust" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | regex = "1.10.4" 10 | tokio = { version = "1.37.0", features = ["full", "net", "macros", "rt-multi-thread", "io-std", "io-util", "mio"] } 11 | reqwest = "0.12.4" 12 | lazy-regex = "3.1.0" 13 | tub = "0.3.7" 14 | tokio-util = { version = "0.7.10", features=["futures-io", "futures-util", "codec"]} 15 | futures = "0.3.30" 16 | log = "0.4.22" 17 | env_logger = "0.11.5" 18 | 19 | [target.'cfg(not(target_os = "freebsd"))'.dependencies] 20 | rquickjs = {version = "0.6.0", features=["futures", "parallel"]} 21 | 22 | [target.'cfg(target_os = "freebsd")'.dependencies] 23 | rquickjs = {version = "0.6.2", features=["futures", "parallel", "bindgen"]} 24 | 25 | 26 | # Compilation optimizations for release builds 27 | # Increases compile time but typically produces a faster and smaller binary. Suitable for final releases but not for debug builds. 28 | [profile.release] 29 | lto = true 30 | opt-level = 3 31 | codegen-units = 1 32 | panic = 'abort' 33 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Use the official Alpine-based Rust image as a parent image 2 | FROM rust:1.80-alpine AS builder 3 | 4 | # Set the working directory in the container 5 | WORKDIR /usr/src/app 6 | 7 | # Install build dependencies 8 | RUN apk add --no-cache \ 9 | musl-dev \ 10 | openssl-dev \ 11 | openssl-libs-static \ 12 | pkgconfig \ 13 | patch 14 | 15 | # Set environment variables for static linking 16 | ENV OPENSSL_STATIC=yes 17 | ENV OPENSSL_DIR=/usr 18 | 19 | # Copy the current directory contents into the container 20 | COPY . . 21 | 22 | # Determine the target architecture and build the application 23 | RUN RUST_TARGET=$(rustc -vV | sed -n 's/host: //p') && \ 24 | rustup target add $RUST_TARGET && \ 25 | RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target $RUST_TARGET 26 | 27 | # Stage for creating the non-privileged user 28 | FROM alpine:3.20 AS user-stage 29 | 30 | RUN adduser -u 10001 -S appuser 31 | 32 | # Stage for a smaller final image 33 | FROM scratch 34 | 35 | # Copy necessary files from the builder stage, using the correct architecture path 36 | COPY --from=builder /usr/src/app/target/*/release/inv_sig_helper_rust /app/inv_sig_helper_rust 37 | COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ 38 | 39 | # Copy passwd file for the non-privileged user from the user-stage 40 | COPY --from=user-stage /etc/passwd /etc/passwd 41 | 42 | # Set the working directory 43 | WORKDIR /app 44 | 45 | # Expose port 12999 46 | EXPOSE 12999 47 | 48 | # Switch to non-privileged user 49 | USER appuser 50 | 51 | # Set the entrypoint to the binary name 52 | ENTRYPOINT ["/app/inv_sig_helper_rust"] 53 | 54 | # Set default arguments in CMD 55 | CMD ["--tcp", "127.0.0.1:12999"] 56 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # inv_sig_helper 2 | 3 | `inv_sig_helper` is a Rust service that decrypts YouTube signatures and manages player information. It offers a TCP/Unix socket interface for signature decryption and related operations. 4 | 5 | ## Features 6 | 7 | - Decrypt YouTube `n` and `s` signatures 8 | - Fetch and update YouTube player data 9 | - Provide signature timestamps and player status 10 | - Efficient signature decryption with multi-threaded JavaScript execution 11 | 12 | ## Run with Docker (recommended method) 13 | 14 | A Dockerfile is included for containerized deployment. 15 | 16 | And an official Docker image is available at `quay.io/invidious/inv-sig-helper`: https://quay.io/repository/invidious/inv-sig-helper 17 | 18 | ### Production 19 | 20 | Follow the official installation guide: https://github.com/iv-org/documentation/blob/master/docs/installation.md. 21 | 22 | ### Development 23 | 24 | Run the project using docker compose: 25 | 26 | ``` 27 | docker compose up -d 28 | ``` 29 | 30 | Or you can run it manually but not recommended since you won't lock down the container from potential code execution from Google: 31 | 32 | 1. Build the image: 33 | 34 | ``` 35 | docker build -t inv_sig_helper . 36 | ``` 37 | 38 | 2. Run the container: 39 | 40 | ``` 41 | docker run -p 127.0.0.1:12999:12999 inv_sig_helper 42 | ``` 43 | 44 | ## Building and Running without Docker 45 | 46 | ### Prerequisites 47 | 48 | - Rust 1.77 or later 49 | - Cargo 50 | - Patch 51 | - openssl-devel 52 | 53 | ### Building 54 | 55 | 1. Clone the repository and navigate to the project directory: 56 | 57 | ``` 58 | git clone https://github.com/iv-org/inv_sig_helper.git 59 | cd inv_sig_helper 60 | ``` 61 | 62 | 2. Build the project: 63 | 64 | ``` 65 | cargo build --release 66 | ``` 67 | 68 | ### Running 69 | 70 | #### Warning 71 | 72 | This service runs untrusted code directly from Google. 73 | 74 | We recommend running sig_helper inside a locked down environment like an LXC container or a systemd service where only the strict necessary is allowed. An examplary systemd service file is provided in `inv_sig_helper.service` which creates a socket in `/home/invidious/tmp/inv_sig_helper.sock`. 75 | 76 | #### Instructions 77 | 78 | The service can run in Unix socket mode (default) or TCP mode: 79 | 80 | 1. Unix socket mode: 81 | 82 | ``` 83 | ./target/release/inv_sig_helper_rust 84 | ``` 85 | 86 | This creates a Unix socket at `/tmp/inv_sig_helper.sock`. 87 | 88 | 2. TCP mode: 89 | 90 | ``` 91 | ./target/release/inv_sig_helper_rust --tcp [IP:PORT] 92 | ``` 93 | 94 | If no IP:PORT is given, it defaults to `127.0.0.1:12999`. 95 | 96 | #### Troubleshooting 97 | 98 | The log level can be configured using the `RUST_LOG` environment variable. Valid values are: 99 | 100 | - error 101 | - warn 102 | - info 103 | - debug 104 | - trace 105 | 106 | The `info` log level is the default setting. Changing this to `debug` will provide detailed logs on each request for additional troubleshooting. 107 | 108 | 109 | ## Protocol Format 110 | 111 | All data-types bigger than 1 byte are stored in network endian (big-endian) unless stated otherwise. 112 | 113 | ### Request Base 114 | | Name | Size (bytes) | Description | 115 | |-----------|--------------|--------------------------------------| 116 | |opcode | 1 | The operation code to perform, A list of operations currently supported (and their data) can be found in the **Operations** chapter | 117 | |request_id | 4 | The ID for the current request, Used to distinguish responses in the current connection | 118 | 119 | The data afterwards depends on the supplied opcode, Please consult the **Operations** chapter for more information. 120 | 121 | ### Response Base 122 | | Name | Size (bytes) | Description | 123 | |------------|--------------|---------------------------------------| 124 | |request_id | 4 | The ID for the request that this response is meant for | 125 | |size | 4 | Size of the response (excluding size of request id)| 126 | 127 | The data afterwards depends on the supplied opcode, Please consult the **Operations** chapter for more information. 128 | 129 | ### Operations 130 | #### `FORCE_UPDATE` (0x00) 131 | Forces the server to re-fetch the YouTube player, and extract the necessary components from it (`nsig` function code, `sig` function code, signature timestamp). 132 | 133 | ##### Request 134 | *No additional data required* 135 | 136 | ##### Response 137 | | Name | Size (bytes) | Description | 138 | |------|--------------|-------------| 139 | |status| 2 | The status code of the request: `0xF44F` if successful, `0xFFFF` if no updating is required (YouTube's player ID is equal to the server's current player ID), `0x0000` if an error occurred | 140 | 141 | #### `DECRYPT_N_SIGNATURE` (0x01) 142 | Decrypt a provided `n` signature using the server's current `nsig` function code, and return the result (or an error). 143 | 144 | ##### Request 145 | | Name | Size (bytes) | Description | 146 | |------|--------------|-------------------------------------| 147 | |size | 2 | The size of the encrypted signature | 148 | |string| *`size`* | The encrypted signature | 149 | 150 | ##### Response 151 | | Name | Size (bytes) | Description | 152 | |------|--------------|------------------------------------------------------------------| 153 | |size | 2 | The size of the decrypted signature, `0x0000` if an error occurred | 154 | |string| *`size`* | The decrypted signature | 155 | 156 | #### `DECRYPT_SIGNATURE` (0x02) 157 | Decrypt a provided `s` signature using the server's current `sig` function code, and return the result (or an error). 158 | 159 | ##### Request 160 | | Name | Size (bytes) | Description | 161 | |------|--------------|-------------------------------------| 162 | |size | 2 | The size of the encrypted signature | 163 | |string| *`size`* | The encrypted signature | 164 | 165 | ##### Response 166 | | Name | Size (bytes) | Description | 167 | |------|--------------|------------------------------------------------------------------| 168 | |size | 2 | The size of the decrypted signature, `0x0000` if an error occurred | 169 | |string| *`size`* | The decrypted signature | 170 | 171 | #### `GET_SIGNATURE_TIMESTAMP` (0x03) 172 | Get the signature timestamp from the server's current player, and return it in the form of a 64-bit integer. If there's no player, it will return 0 in the `timestamp` (Please check with `PLAYER_STATUS` if the server has a player) 173 | 174 | ##### Request 175 | No additional data required 176 | 177 | ##### Response 178 | | Name | Size (bytes) | Description | 179 | |---------|--------------|----------------------------------------------------------| 180 | |timestamp| 8 | The signature timestamp from the server's current player | 181 | 182 | #### `PLAYER_STATUS` (0x04) 183 | Get the server's information about the current player. 184 | 185 | ##### Request 186 | No additional data required 187 | 188 | ##### Response 189 | 190 | | Name | Size (bytes) | Description | 191 | |----------|--------------|-------------| 192 | |has_player| 1 | If the server has a player, this variable will be `0xFF`. or else, it will be `0x00`| 193 | |player_id | 4 | The server's current player ID. If the server has no player, this will always be `0x00000000`| 194 | 195 | #### `PLAYER_UPDATE_TIMESTAMP` (0x05) 196 | Get the time of the last player update, The time is represented as seconds since the last update 197 | 198 | ##### Request 199 | No additional data required 200 | 201 | ##### Response 202 | 203 | | Name | Size (bytes) | Description | 204 | |----------|--------------|-------------| 205 | |timestamp | 8 | Seconds since the last player update | 206 | 207 | ## License 208 | 209 | This project is open source under the AGPL-3.0 license. 210 | -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | inv_sig_helper: 4 | build: 5 | context: . 6 | dockerfile: Dockerfile 7 | # image: quay.io/invidious/inv-sig-helper:latest 8 | init: true 9 | command: ["--tcp", "127.0.0.1:12999"] 10 | ports: 11 | - 127.0.0.1:12999:12999 12 | environment: 13 | - RUST_LOG=info 14 | restart: unless-stopped 15 | cap_drop: 16 | - ALL 17 | read_only: true 18 | user: 10001:10001 19 | security_opt: 20 | - no-new-privileges:true 21 | -------------------------------------------------------------------------------- /inv_sig_helper.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=inv_sig_helper (decrypt YouTube signatures and manage player information) 3 | After=syslog.target 4 | After=network.target 5 | 6 | [Service] 7 | RestartSec=2s 8 | Type=simple 9 | 10 | User=invidious 11 | Group=invidious 12 | 13 | # allow only the strict necessary since this service runs untrusted code directly from Google 14 | CapabilityBoundingSet=~CAP_SETUID CAP_SETGID CAP_SETPCAP 15 | CapabilityBoundingSet=~CAP_SYS_ADMIN 16 | CapabilityBoundingSet=~CAP_SYS_PTRACE 17 | CapabilityBoundingSet=~CAP_CHOWN CAP_FSETID CAP_SETFCAP 18 | CapabilityBoundingSet=~CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH CAP_FOWNER CAP_IPC_OWNER 19 | CapabilityBoundingSet=~CAP_NET_ADMIN 20 | CapabilityBoundingSet=~CAP_SYS_MODULE 21 | CapabilityBoundingSet=~CAP_SYS_RAWIO 22 | CapabilityBoundingSet=~CAP_SYS_TIME 23 | CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE 24 | CapabilityBoundingSet=~CAP_KILL 25 | CapabilityBoundingSet=~CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW 26 | CapabilityBoundingSet=~CAP_SYSLOG 27 | CapabilityBoundingSet=~CAP_SYS_NICE CAP_SYS_RESOURCE 28 | CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE 29 | CapabilityBoundingSet=~CAP_SYS_BOOT 30 | CapabilityBoundingSet=~CAP_LINUX_IMMUTABLE 31 | CapabilityBoundingSet=~CAP_IPC_LOCK 32 | CapabilityBoundingSet=~CAP_SYS_CHROOT 33 | CapabilityBoundingSet=~CAP_BLOCK_SUSPEND 34 | CapabilityBoundingSet=~CAP_LEASE 35 | CapabilityBoundingSet=~CAP_SYS_PACCT 36 | CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG 37 | CapabilityBoundingSet=~CAP_WAKE_ALARM 38 | LockPersonality=true 39 | MemoryDenyWriteExecute=true 40 | NoNewPrivileges=true 41 | PrivateDevices=true 42 | PrivateTmp=true 43 | PrivateUsers=true 44 | ProcSubset=pid 45 | ProtectControlGroups=true 46 | ProtectHome=tmpfs 47 | ProtectHostname=true 48 | ProtectKernelLogs=true 49 | ProtectKernelModules=true 50 | ProtectKernelTunables=true 51 | ProtectProc=invisible 52 | ProtectSystem=strict 53 | RemoveIPC=true 54 | RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX 55 | RestrictNamespaces=true 56 | RestrictSUIDSGID=true 57 | RestrictRealtime=true 58 | SystemCallArchitectures=native 59 | SystemCallFilter=~@clock 60 | SystemCallFilter=~@debug 61 | SystemCallFilter=~@module 62 | SystemCallFilter=~@mount 63 | SystemCallFilter=~@raw-io 64 | SystemCallFilter=~@reboot 65 | SystemCallFilter=~@swap 66 | SystemCallFilter=~@privileged 67 | SystemCallFilter=~@resources 68 | SystemCallFilter=~@cpu-emulation 69 | SystemCallFilter=~@obsolete 70 | 71 | BindReadOnlyPaths=/home/invidious/inv_sig_helper 72 | BindPaths=/home/invidious/tmp 73 | 74 | WorkingDirectory=/home/invidious/inv_sig_helper 75 | ExecStart=/home/invidious/inv_sig_helper/target/release/inv_sig_helper_rust /home/invidious/tmp/inv_sig_helper.sock 76 | 77 | Restart=always 78 | 79 | [Install] 80 | WantedBy=multi-user.target 81 | -------------------------------------------------------------------------------- /src/consts.rs: -------------------------------------------------------------------------------- 1 | use lazy_regex::{regex, Lazy}; 2 | use regex::Regex; 3 | 4 | pub static DEFAULT_SOCK_PATH: &str = "/tmp/inv_sig_helper.sock"; 5 | pub static DEFAULT_SOCK_PERMS: u32 = 0o755; 6 | pub static DEFAULT_TCP_URL: &str = "127.0.0.1:12999"; 7 | 8 | pub static TEST_YOUTUBE_VIDEO: &str = "https://www.youtube.com/watch?v=jNQXAC9IVRw"; 9 | 10 | pub static REGEX_PLAYER_ID: &Lazy = regex!("\\/s\\/player\\/([0-9a-f]{8})"); 11 | pub static NSIG_FUNCTION_ARRAYS: &[&str] = &[ 12 | r#"null\)&&\([a-zA-Z]=(?P[_a-zA-Z0-9$]+)\[(?P\d+)\]\([a-zA-Z0-9]\)"#, 13 | r#"(?x)&&\(b="n+"\[[a-zA-Z0-9.+$]+\],c=a\.get\(b\)\)&&\(c=(?P[a-zA-Z0-9$]+)(?:\[(?P\d+)\])?\([a-zA-Z0-9]\)"#, 14 | ]; 15 | 16 | pub static NSIG_FUNCTION_ENDINGS: &[&str] = &[ 17 | r#"=\s*function([\S\s]*?\}\s*return [A-Za-z0-9$]+\[[A-Za-z0-9$]+\[\d+\]\]\([A-Za-z0-9$]+\[\d+\]\)\s*\};)"#, 18 | r#"=\s*function(\(\w\)\s*\{[\S\s]*\{return.[a-zA-Z0-9_-]+_w8_.+?\}\s*return\s*\w+.join\(""\)\};)"#, 19 | r#"=\s*function([\S\s]*?\}\s*return \w+?\.join\([^)]+\)\s*\};)"#, 20 | r#"=\s*function([\S\s]*?\}\s*return [\W\w$]+?\.call\([\w$]+?,\"\"\)\s*\};)"#, 21 | ]; 22 | 23 | pub static REGEX_SIGNATURE_TIMESTAMP: &Lazy = regex!("signatureTimestamp[=:](\\d+)"); 24 | 25 | pub static REGEX_SIGNATURE_FUNCTION_PATTERNS: &[&str] = &[ 26 | r#"\s*?([a-zA-Z0-9_\$]{1,})=function\([a-zA-Z]{1}\)\{(.{1}=.{1}\.split\([a-zA-Z0-9\-_\$\[\]"]+\)[^\}{]+)return .{1}\.join\([a-zA-Z0-9\-_\$\[\]"]+\)\}"#, // old regex 27 | r#"([a-zA-Z0-9_$]{1,})=function\(([a-zA-Z0-9_$]{1})\)\{[^}]*GLOBAL_VAR_NAME\[[^\]]+\][^}]*return [^}]*GLOBAL_VAR_NAME\[[^\]]+\][^}]*\}"#, // new regex 28 | r#"([a-zA-Z0-9_$]{1,})=function\(([a-zA-Z0-9_$]{1})\)\{[^}]*return [^}]*GLOBAL_VAR_NAME\[[^\]]+\][^}]*\}"#, // more general regex 29 | ]; 30 | 31 | // pub static REGEX_SIGNATURE_FUNCTION: &Lazy = regex!(r#"\s*?([a-zA-Z0-9_\$]{1,})=function\([a-zA-Z]{1}\)\{(.{1}=.{1}\.split\([a-zA-Z0-9\-_\$\[\]"]+\)[^\}{]+)return .{1}\.join\([a-zA-Z0-9\-_\$\[\]"]+\)\}"#); 32 | pub static REGEX_HELPER_OBJ_NAME: &Lazy = regex!(";([A-Za-z0-9_\\$]{2,})(?:\\.|\\[)"); 33 | 34 | pub static NSIG_FUNCTION_NAME: &str = "decrypt_nsig"; 35 | pub static SIG_FUNCTION_NAME: &str = "decrypt_sig"; 36 | -------------------------------------------------------------------------------- /src/jobs.rs: -------------------------------------------------------------------------------- 1 | use futures::SinkExt; 2 | use rquickjs::{async_with, AsyncContext, AsyncRuntime}; 3 | use std::{num::NonZeroUsize, sync::Arc, thread::available_parallelism, time::SystemTime}; 4 | use log::{debug, error}; 5 | use tokio::{runtime::Handle, sync::Mutex, task::block_in_place}; 6 | use tub::Pool; 7 | 8 | use crate::{consts::NSIG_FUNCTION_NAME, opcode::OpcodeResponse, player::fetch_update}; 9 | 10 | pub enum JobOpcode { 11 | ForceUpdate, 12 | DecryptNSignature, 13 | DecryptSignature, 14 | GetSignatureTimestamp, 15 | PlayerStatus, 16 | PlayerUpdateTimestamp, 17 | UnknownOpcode, 18 | } 19 | 20 | impl std::fmt::Display for JobOpcode { 21 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 22 | match self { 23 | Self::ForceUpdate => write!(f, "ForceUpdate"), 24 | Self::DecryptNSignature => write!(f, "DecryptNSignature"), 25 | Self::DecryptSignature => write!(f, "DecryptSignature"), 26 | Self::GetSignatureTimestamp => write!(f, "GetSignatureTimestamp"), 27 | Self::PlayerStatus => write!(f, "PlayerStatus"), 28 | Self::PlayerUpdateTimestamp => write!(f, "PlayerUpdateTimestamp"), 29 | Self::UnknownOpcode => write!(f, "UnknownOpcode"), 30 | } 31 | } 32 | } 33 | impl From for JobOpcode { 34 | fn from(value: u8) -> Self { 35 | match value { 36 | 0x00 => Self::ForceUpdate, 37 | 0x01 => Self::DecryptNSignature, 38 | 0x02 => Self::DecryptSignature, 39 | 0x03 => Self::GetSignatureTimestamp, 40 | 0x04 => Self::PlayerStatus, 41 | 0x05 => Self::PlayerUpdateTimestamp, 42 | _ => Self::UnknownOpcode, 43 | } 44 | } 45 | } 46 | 47 | pub struct PlayerInfo { 48 | pub nsig_function_code: String, 49 | pub sig_function_code: String, 50 | pub sig_function_name: String, 51 | pub signature_timestamp: u64, 52 | pub player_id: u32, 53 | pub has_player: u8, 54 | pub last_update: SystemTime, 55 | } 56 | 57 | pub struct JavascriptInterpreter { 58 | js_runtime: AsyncRuntime, 59 | sig_context: AsyncContext, 60 | nsig_context: AsyncContext, 61 | sig_player_id: Mutex, 62 | nsig_player_id: Mutex, 63 | } 64 | 65 | impl JavascriptInterpreter { 66 | pub fn new() -> JavascriptInterpreter { 67 | let js_runtime = AsyncRuntime::new().unwrap(); 68 | // not ideal, but this is only done at startup 69 | let nsig_context = block_in_place(|| { 70 | Handle::current() 71 | .block_on(AsyncContext::full(&js_runtime)) 72 | .unwrap() 73 | }); 74 | let sig_context = block_in_place(|| { 75 | Handle::current() 76 | .block_on(AsyncContext::full(&js_runtime)) 77 | .unwrap() 78 | }); 79 | JavascriptInterpreter { 80 | js_runtime, 81 | sig_context, 82 | nsig_context, 83 | sig_player_id: Mutex::new(0), 84 | nsig_player_id: Mutex::new(0), 85 | } 86 | } 87 | } 88 | 89 | pub struct GlobalState { 90 | pub player_info: Mutex, 91 | js_runtime_pool: Pool>, 92 | } 93 | 94 | impl GlobalState { 95 | pub fn new() -> GlobalState { 96 | let number_of_runtimes = available_parallelism() 97 | .unwrap_or(NonZeroUsize::new(1).unwrap()) 98 | .get(); 99 | let mut runtime_vector: Vec> = 100 | Vec::with_capacity(number_of_runtimes); 101 | for _n in 0..number_of_runtimes { 102 | runtime_vector.push(Arc::new(JavascriptInterpreter::new())); 103 | } 104 | 105 | let runtime_pool: Pool> = Pool::from_vec(runtime_vector); 106 | GlobalState { 107 | player_info: Mutex::new(PlayerInfo { 108 | nsig_function_code: Default::default(), 109 | sig_function_code: Default::default(), 110 | sig_function_name: Default::default(), 111 | player_id: Default::default(), 112 | signature_timestamp: Default::default(), 113 | has_player: 0x00, 114 | last_update: SystemTime::now(), 115 | }), 116 | js_runtime_pool: runtime_pool, 117 | } 118 | } 119 | } 120 | 121 | pub async fn process_fetch_update( 122 | state: Arc, 123 | stream: Arc>, 124 | request_id: u32, 125 | ) where 126 | W: SinkExt + Unpin + Send, 127 | { 128 | let cloned_writer = stream.clone(); 129 | let global_state = state.clone(); 130 | let status = fetch_update(global_state).await; 131 | 132 | let mut writer = cloned_writer.lock().await; 133 | let _ = writer 134 | .send(OpcodeResponse { 135 | opcode: JobOpcode::ForceUpdate, 136 | request_id, 137 | update_status: status, 138 | ..Default::default() 139 | }) 140 | .await; 141 | } 142 | 143 | pub async fn process_decrypt_n_signature( 144 | state: Arc, 145 | sig: String, 146 | stream: Arc>, 147 | request_id: u32, 148 | ) where 149 | W: SinkExt + Unpin + Send, 150 | { 151 | let cloned_writer = stream.clone(); 152 | let global_state = state.clone(); 153 | 154 | //println!("Signature to be decrypted: {}", sig); 155 | let interp = global_state.js_runtime_pool.acquire().await; 156 | 157 | let cloned_interp = interp.clone(); 158 | async_with!(cloned_interp.nsig_context => |ctx|{ 159 | let mut writer; 160 | let mut current_player_id = interp.nsig_player_id.lock().await; 161 | let player_info = global_state.player_info.lock().await; 162 | 163 | if player_info.player_id != *current_player_id { 164 | match ctx.eval::<(),String>(player_info.nsig_function_code.clone()) { 165 | Ok(x) => x, 166 | Err(n) => { 167 | if n.is_exception() { 168 | error!("JavaScript interpreter error (nsig code): {:?}", ctx.catch().as_exception()); 169 | } else { 170 | error!("JavaScript interpreter error (nsig code): {}", n); 171 | } 172 | debug!("Code: {}", player_info.nsig_function_code.clone()); 173 | writer = cloned_writer.lock().await; 174 | let _ = writer.send(OpcodeResponse { 175 | opcode: JobOpcode::DecryptNSignature, 176 | request_id, 177 | ..Default::default() 178 | }).await; 179 | return; 180 | } 181 | } 182 | *current_player_id = player_info.player_id; 183 | } 184 | drop(player_info); 185 | 186 | let mut call_string: String = String::new(); 187 | call_string += NSIG_FUNCTION_NAME; 188 | call_string += "(\""; 189 | call_string += &sig.replace("\"", "\\\""); 190 | call_string += "\")"; 191 | 192 | let decrypted_string = match ctx.eval::(call_string.clone()) { 193 | Ok(x) => x, 194 | Err(n) => { 195 | if n.is_exception() { 196 | error!("JavaScript interpreter error (nsig code): {:?}", ctx.catch().as_exception()); 197 | } else { 198 | error!("JavaScript interpreter error (nsig code): {}", n); 199 | } 200 | debug!("Code: {}", call_string.clone()); 201 | writer = cloned_writer.lock().await; 202 | let _ = writer.send(OpcodeResponse { 203 | opcode: JobOpcode::DecryptNSignature, 204 | request_id, 205 | ..Default::default() 206 | }).await; 207 | return; 208 | } 209 | }; 210 | 211 | writer = cloned_writer.lock().await; 212 | 213 | let _ = writer.send(OpcodeResponse { 214 | opcode: JobOpcode::DecryptNSignature, 215 | request_id, 216 | signature: decrypted_string, 217 | ..Default::default() 218 | }).await; 219 | }) 220 | .await; 221 | } 222 | 223 | pub async fn process_decrypt_signature( 224 | state: Arc, 225 | sig: String, 226 | stream: Arc>, 227 | request_id: u32, 228 | ) where 229 | W: SinkExt + Unpin + Send, 230 | { 231 | let cloned_writer = stream.clone(); 232 | let global_state = state.clone(); 233 | 234 | let interp = global_state.js_runtime_pool.acquire().await; 235 | let cloned_interp = interp.clone(); 236 | 237 | async_with!(cloned_interp.sig_context => |ctx|{ 238 | let mut writer; 239 | let mut current_player_id = interp.sig_player_id.lock().await; 240 | let player_info = global_state.player_info.lock().await; 241 | 242 | if player_info.player_id != *current_player_id { 243 | match ctx.eval::<(),String>(player_info.sig_function_code.clone()) { 244 | Ok(x) => x, 245 | Err(n) => { 246 | if n.is_exception() { 247 | error!("JavaScript interpreter error (sig code): {:?}", ctx.catch().as_exception()); 248 | } else { 249 | error!("JavaScript interpreter error (sig code): {}", n); 250 | } 251 | debug!("Code: {}", player_info.sig_function_code.clone()); 252 | writer = cloned_writer.lock().await; 253 | let _ = writer.send(OpcodeResponse { 254 | opcode: JobOpcode::DecryptSignature, 255 | request_id, 256 | ..Default::default() 257 | }).await; 258 | return; 259 | } 260 | } 261 | *current_player_id = player_info.player_id; 262 | } 263 | 264 | let sig_function_name = &player_info.sig_function_name; 265 | 266 | let mut call_string: String = String::new(); 267 | call_string += sig_function_name; 268 | call_string += "(\""; 269 | call_string += &sig.replace("\"", "\\\""); 270 | call_string += "\")"; 271 | 272 | drop(player_info); 273 | 274 | let decrypted_string = match ctx.eval::(call_string.clone()) { 275 | Ok(x) => x, 276 | Err(n) => { 277 | if n.is_exception() { 278 | error!("JavaScript interpreter error (sig code): {:?}", ctx.catch().as_exception()); 279 | } else { 280 | error!("JavaScript interpreter error (sig code): {}", n); 281 | } 282 | debug!("Code: {}", call_string.clone()); 283 | writer = cloned_writer.lock().await; 284 | let _ = writer.send(OpcodeResponse { 285 | opcode: JobOpcode::DecryptSignature, 286 | request_id, 287 | ..Default::default() 288 | }).await; 289 | return; 290 | } 291 | }; 292 | 293 | writer = cloned_writer.lock().await; 294 | 295 | let _ = writer.send(OpcodeResponse { 296 | opcode: JobOpcode::DecryptSignature, 297 | request_id, 298 | signature: decrypted_string, 299 | ..Default::default() 300 | }).await; 301 | }) 302 | .await; 303 | } 304 | 305 | pub async fn process_get_signature_timestamp( 306 | state: Arc, 307 | stream: Arc>, 308 | request_id: u32, 309 | ) where 310 | W: SinkExt + Unpin + Send, 311 | { 312 | let cloned_writer = stream.clone(); 313 | let global_state = state.clone(); 314 | 315 | let player_info = global_state.player_info.lock().await; 316 | let timestamp = player_info.signature_timestamp; 317 | 318 | let mut writer = cloned_writer.lock().await; 319 | let _ = writer 320 | .send(OpcodeResponse { 321 | opcode: JobOpcode::GetSignatureTimestamp, 322 | request_id, 323 | signature_timestamp: timestamp, 324 | ..Default::default() 325 | }) 326 | .await; 327 | } 328 | 329 | pub async fn process_player_status( 330 | state: Arc, 331 | stream: Arc>, 332 | request_id: u32, 333 | ) where 334 | W: SinkExt + Unpin + Send, 335 | { 336 | let cloned_writer = stream.clone(); 337 | let global_state = state.clone(); 338 | 339 | let player_info = global_state.player_info.lock().await; 340 | let has_player = player_info.has_player; 341 | let player_id = player_info.player_id; 342 | 343 | let mut writer = cloned_writer.lock().await; 344 | 345 | let _ = writer 346 | .send(OpcodeResponse { 347 | opcode: JobOpcode::PlayerStatus, 348 | request_id, 349 | has_player, 350 | player_id, 351 | ..Default::default() 352 | }) 353 | .await; 354 | } 355 | 356 | pub async fn process_player_update_timestamp( 357 | state: Arc, 358 | stream: Arc>, 359 | request_id: u32, 360 | ) where 361 | W: SinkExt + Unpin + Send, 362 | { 363 | let cloned_writer = stream.clone(); 364 | let global_state = state.clone(); 365 | 366 | let player_info = global_state.player_info.lock().await; 367 | let last_update = player_info.last_update; 368 | 369 | let mut writer = cloned_writer.lock().await; 370 | 371 | let _ = writer 372 | .send(OpcodeResponse { 373 | opcode: JobOpcode::PlayerUpdateTimestamp, 374 | request_id, 375 | last_player_update: SystemTime::now() 376 | .duration_since(last_update) 377 | .unwrap() 378 | .as_secs(), 379 | 380 | ..Default::default() 381 | }) 382 | .await; 383 | } 384 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | mod consts; 2 | mod jobs; 3 | mod opcode; 4 | mod player; 5 | 6 | use ::futures::StreamExt; 7 | use consts::{DEFAULT_SOCK_PATH, DEFAULT_SOCK_PERMS, DEFAULT_TCP_URL}; 8 | use jobs::{process_decrypt_n_signature, process_fetch_update, GlobalState, JobOpcode}; 9 | use opcode::OpcodeDecoder; 10 | use player::fetch_update; 11 | use std::{env::args, sync::Arc, fs::set_permissions, fs::Permissions, os::unix::fs::PermissionsExt}; 12 | use env_logger::Env; 13 | use tokio::{ 14 | fs::remove_file, 15 | io::{AsyncReadExt, AsyncWrite}, 16 | net::{TcpListener, UnixListener}, 17 | sync::Mutex, 18 | }; 19 | use tokio_util::codec::Framed; 20 | use log::{info, error, debug}; 21 | 22 | use crate::jobs::{ 23 | process_decrypt_signature, process_get_signature_timestamp, process_player_status, 24 | process_player_update_timestamp, 25 | }; 26 | 27 | macro_rules! loop_main { 28 | ($i:ident, $s:ident) => { 29 | info!("Fetching player"); 30 | match fetch_update($s.clone()).await { 31 | Ok(()) => info!("Successfully fetched player"), 32 | Err(x) => { 33 | error!("Error occured while trying to fetch the player: {:?}", x); 34 | } 35 | } 36 | loop { 37 | let (socket, _addr) = $i.accept().await.unwrap(); 38 | 39 | let cloned_state = $s.clone(); 40 | tokio::spawn(async move { 41 | process_socket(cloned_state, socket).await; 42 | }); 43 | } 44 | }; 45 | } 46 | #[tokio::main] 47 | async fn main() { 48 | env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); 49 | 50 | let args: Vec = args().collect(); 51 | let socket_url: &str = match args.get(1) { 52 | Some(stringref) => stringref, 53 | None => DEFAULT_SOCK_PATH, 54 | }; 55 | 56 | // have to please rust 57 | let state: Arc = Arc::new(GlobalState::new()); 58 | 59 | if socket_url == "--tcp" { 60 | let socket_tcp_url: &str = match args.get(2) { 61 | Some(stringref) => stringref, 62 | None => DEFAULT_TCP_URL, 63 | }; 64 | let tcp_socket = match TcpListener::bind(socket_tcp_url).await { 65 | Ok(x) => x, 66 | Err(x) => { 67 | error!("Error occurred while trying to bind: {}", x); 68 | return; 69 | } 70 | }; 71 | loop_main!(tcp_socket, state); 72 | } else if socket_url == "--test" { 73 | // TODO: test the API aswell, this only tests the player script extractor 74 | info!("Fetching player"); 75 | match fetch_update(state.clone()).await { 76 | Ok(()) => std::process::exit(0), 77 | Err(_x) => std::process::exit(-1), 78 | } 79 | } else { 80 | let unix_socket = match UnixListener::bind(socket_url) { 81 | Ok(x) => x, 82 | Err(x) => { 83 | if x.kind() == std::io::ErrorKind::AddrInUse { 84 | remove_file(socket_url).await; 85 | UnixListener::bind(socket_url).unwrap() 86 | } else { 87 | error!("Error occurred while trying to bind: {}", x); 88 | return; 89 | } 90 | } 91 | }; 92 | let socket_perms: u32 = match args.get(2) { 93 | Some(stringref) => u32::from_str_radix(stringref, 8).expect( 94 | "Socket permissions must be an octal from 0 to 777!"), 95 | None => DEFAULT_SOCK_PERMS, 96 | }; 97 | let perms = Permissions::from_mode(socket_perms); 98 | let _ = set_permissions(socket_url, perms); 99 | loop_main!(unix_socket, state); 100 | } 101 | } 102 | 103 | async fn process_socket(state: Arc, socket: W) 104 | where 105 | W: AsyncReadExt + Send + AsyncWrite + 'static, 106 | { 107 | let decoder = OpcodeDecoder {}; 108 | let str = Framed::new(socket, decoder); 109 | 110 | let (sink, mut stream) = str.split(); 111 | 112 | let arc_sink = Arc::new(Mutex::new(sink)); 113 | while let Some(opcode_res) = stream.next().await { 114 | match opcode_res { 115 | Ok(opcode) => { 116 | debug!("Received job: {}", opcode.opcode); 117 | 118 | match opcode.opcode { 119 | JobOpcode::ForceUpdate => { 120 | let cloned_state = state.clone(); 121 | let cloned_sink = arc_sink.clone(); 122 | tokio::spawn(async move { 123 | process_fetch_update(cloned_state, cloned_sink, opcode.request_id) 124 | .await; 125 | }); 126 | } 127 | JobOpcode::DecryptNSignature => { 128 | let cloned_state = state.clone(); 129 | let cloned_sink = arc_sink.clone(); 130 | tokio::spawn(async move { 131 | process_decrypt_n_signature( 132 | cloned_state, 133 | opcode.signature, 134 | cloned_sink, 135 | opcode.request_id, 136 | ) 137 | .await; 138 | }); 139 | } 140 | JobOpcode::DecryptSignature => { 141 | let cloned_state = state.clone(); 142 | let cloned_sink = arc_sink.clone(); 143 | tokio::spawn(async move { 144 | process_decrypt_signature( 145 | cloned_state, 146 | opcode.signature, 147 | cloned_sink, 148 | opcode.request_id, 149 | ) 150 | .await; 151 | }); 152 | } 153 | JobOpcode::GetSignatureTimestamp => { 154 | let cloned_state = state.clone(); 155 | let cloned_sink = arc_sink.clone(); 156 | tokio::spawn(async move { 157 | process_get_signature_timestamp( 158 | cloned_state, 159 | cloned_sink, 160 | opcode.request_id, 161 | ) 162 | .await; 163 | }); 164 | } 165 | JobOpcode::PlayerStatus => { 166 | let cloned_state = state.clone(); 167 | let cloned_sink = arc_sink.clone(); 168 | tokio::spawn(async move { 169 | process_player_status(cloned_state, cloned_sink, opcode.request_id) 170 | .await; 171 | }); 172 | } 173 | JobOpcode::PlayerUpdateTimestamp => { 174 | let cloned_state = state.clone(); 175 | let cloned_sink = arc_sink.clone(); 176 | tokio::spawn(async move { 177 | process_player_update_timestamp( 178 | cloned_state, 179 | cloned_sink, 180 | opcode.request_id, 181 | ) 182 | .await; 183 | }); 184 | } 185 | _ => { 186 | continue; 187 | } 188 | } 189 | } 190 | Err(x) => { 191 | error!("I/O error: {:?}", x); 192 | break; 193 | } 194 | } 195 | } 196 | } 197 | -------------------------------------------------------------------------------- /src/opcode.rs: -------------------------------------------------------------------------------- 1 | use std::io::ErrorKind; 2 | use log::debug; 3 | use tokio_util::{ 4 | bytes::{Buf, BufMut}, 5 | codec::{Decoder, Encoder}, 6 | }; 7 | 8 | use crate::{jobs::JobOpcode, player::FetchUpdateStatus}; 9 | 10 | #[derive(Copy, Clone)] 11 | pub struct OpcodeDecoder {} 12 | 13 | pub struct Opcode { 14 | pub opcode: JobOpcode, 15 | pub request_id: u32, 16 | 17 | pub signature: String, 18 | } 19 | 20 | pub struct OpcodeResponse { 21 | pub opcode: JobOpcode, 22 | pub request_id: u32, 23 | 24 | pub update_status: Result<(), FetchUpdateStatus>, 25 | pub signature: String, 26 | pub signature_timestamp: u64, 27 | 28 | pub has_player: u8, 29 | pub player_id: u32, 30 | pub last_player_update: u64, 31 | } 32 | 33 | impl Default for OpcodeResponse { 34 | fn default() -> Self { 35 | OpcodeResponse { 36 | opcode: JobOpcode::ForceUpdate, 37 | request_id: 0, 38 | update_status: Ok(()), 39 | signature: String::new(), 40 | signature_timestamp: 0, 41 | has_player: 0, 42 | player_id: 0, 43 | last_player_update: 0, 44 | } 45 | } 46 | } 47 | impl Decoder for OpcodeDecoder { 48 | type Item = Opcode; 49 | type Error = std::io::Error; 50 | 51 | fn decode( 52 | &mut self, 53 | src: &mut tokio_util::bytes::BytesMut, 54 | ) -> Result, Self::Error> { 55 | debug!("Decoder length: {}", src.len()); 56 | if 5 > src.len() { 57 | return Ok(None); 58 | } 59 | 60 | let opcode_byte: u8 = src[0]; 61 | let opcode: JobOpcode = opcode_byte.into(); 62 | let request_id: u32 = u32::from_be_bytes(src[1..5].try_into().unwrap()); 63 | 64 | match opcode { 65 | JobOpcode::ForceUpdate 66 | | JobOpcode::GetSignatureTimestamp 67 | | JobOpcode::PlayerStatus 68 | | JobOpcode::PlayerUpdateTimestamp => { 69 | src.advance(5); 70 | Ok(Some(Opcode { 71 | opcode, 72 | request_id, 73 | signature: Default::default(), 74 | })) 75 | } 76 | JobOpcode::DecryptSignature | JobOpcode::DecryptNSignature => { 77 | if 7 > src.len() { 78 | return Ok(None); 79 | } 80 | 81 | let sig_size: u16 = ((src[5] as u16) << 8) | src[6] as u16; 82 | 83 | if (usize::from(sig_size) + 7) > src.len() { 84 | return Ok(None); 85 | } 86 | 87 | let sig: String = 88 | match String::from_utf8(src[7..(usize::from(sig_size) + 7)].to_vec()) { 89 | Ok(x) => x, 90 | Err(x) => { 91 | return Err(std::io::Error::new( 92 | ErrorKind::InvalidData, 93 | x.utf8_error(), 94 | )); 95 | } 96 | }; 97 | 98 | src.advance(7 + sig.len()); 99 | 100 | Ok(Some(Opcode { 101 | opcode, 102 | request_id, 103 | signature: sig, 104 | })) 105 | } 106 | _ => Err(std::io::Error::new(ErrorKind::InvalidInput, "")), 107 | } 108 | } 109 | } 110 | 111 | impl Encoder for OpcodeDecoder { 112 | type Error = std::io::Error; 113 | fn encode( 114 | &mut self, 115 | item: OpcodeResponse, 116 | dst: &mut tokio_util::bytes::BytesMut, 117 | ) -> Result<(), Self::Error> { 118 | dst.put_u32(item.request_id); 119 | match item.opcode { 120 | JobOpcode::ForceUpdate => { 121 | dst.put_u32(2); 122 | match item.update_status { 123 | Ok(_x) => dst.put_u16(0xF44F), 124 | Err(FetchUpdateStatus::PlayerAlreadyUpdated) => dst.put_u16(0xFFFF), 125 | Err(_x) => dst.put_u16(0x0000), 126 | } 127 | } 128 | JobOpcode::DecryptSignature | JobOpcode::DecryptNSignature => { 129 | dst.put_u32(2 + u32::try_from(item.signature.len()).unwrap()); 130 | dst.put_u16(u16::try_from(item.signature.len()).unwrap()); 131 | if !item.signature.is_empty() { 132 | dst.put_slice(item.signature.as_bytes()); 133 | } 134 | } 135 | JobOpcode::GetSignatureTimestamp => { 136 | dst.put_u32(8); 137 | dst.put_u64(item.signature_timestamp); 138 | } 139 | JobOpcode::PlayerStatus => { 140 | dst.put_u32(5); 141 | dst.put_u8(item.has_player); 142 | dst.put_u32(item.player_id); 143 | } 144 | JobOpcode::PlayerUpdateTimestamp => { 145 | dst.put_u32(8); 146 | dst.put_u64(item.last_player_update); 147 | } 148 | _ => {} 149 | } 150 | Ok(()) 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /src/player.rs: -------------------------------------------------------------------------------- 1 | use std::{sync::Arc, time::SystemTime}; 2 | use log::{debug, error, info, warn}; 3 | use regex::Regex; 4 | 5 | use crate::{ 6 | consts::{ 7 | NSIG_FUNCTION_ARRAYS, NSIG_FUNCTION_ENDINGS, NSIG_FUNCTION_NAME, REGEX_HELPER_OBJ_NAME, 8 | REGEX_PLAYER_ID, REGEX_SIGNATURE_FUNCTION_PATTERNS, REGEX_SIGNATURE_TIMESTAMP, TEST_YOUTUBE_VIDEO, 9 | }, 10 | jobs::GlobalState, 11 | }; 12 | 13 | // TODO: too lazy to make proper debugging print 14 | #[derive(Debug)] 15 | pub enum FetchUpdateStatus { 16 | CannotFetchTestVideo, 17 | CannotMatchPlayerID, 18 | CannotFetchPlayerJS, 19 | NsigRegexCompileFailed, 20 | PlayerAlreadyUpdated, 21 | } 22 | 23 | fn extract_player_js_global_var(jscode: &str) -> Option<(String, String, String)> { 24 | let re = Regex::new(r#"(?x) 25 | 'use\s+strict';\s* 26 | (?P 27 | var\s+(?P[a-zA-Z0-9_$]+)\s*=\s* 28 | (?P 29 | (?:"[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*') 30 | \.split\((?:"[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')\) 31 | |\[(?:(?:"[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')\s*,?\s*)*\] 32 | |"[^"]*"\.split\("[^"]*"\) 33 | ) 34 | )[;,]"#).ok()?; 35 | 36 | if let Some(caps) = re.captures(jscode) { 37 | Some(( 38 | caps.name("code")?.as_str().to_string(), 39 | caps.name("name")?.as_str().to_string(), 40 | caps.name("value")?.as_str().to_string() 41 | )) 42 | } else { 43 | None 44 | } 45 | } 46 | 47 | fn fixup_nsig_jscode(jscode: &str, player_javascript: &str) -> String { 48 | // First try to extract any global variable 49 | let mut result = jscode.to_string(); 50 | 51 | // Extract the original parameter name from the input JavaScript code 52 | let param_regex = Regex::new(r"function\s+[a-zA-Z0-9_$]+\s*\(([a-zA-Z0-9_$]+)\)").unwrap(); 53 | let param_name = param_regex.captures(jscode) 54 | .and_then(|caps| caps.get(1)) 55 | .map(|m| m.as_str()) 56 | .unwrap_or("a"); // fallback to 'a' if we can't find the original parameter 57 | 58 | let fixup_re = if let Some((global_var, varname, _)) = extract_player_js_global_var(player_javascript) { 59 | debug!("global_var: {}", global_var); 60 | debug!("varname: {}", varname); 61 | debug!("jscode: {}", jscode); 62 | 63 | info!("Prepending n function code with global array variable '{}'", varname); 64 | result = format!("function decrypt_nsig({}){{{}; {}", param_name, global_var, jscode.replace(&format!("function decrypt_nsig({}){{", param_name), "")); 65 | 66 | // Escape special regex characters in the variable name 67 | let escaped_varname = varname.replace("$", "\\$"); 68 | Regex::new(&format!(r#";\s*if\s*\(\s*typeof\s+[a-zA-Z0-9_$]+\s*===?\s*(?:"undefined"|'undefined'|{}\[\d+\])\s*\)\s*return\s+\w+;"#, escaped_varname)).unwrap() 69 | } else { 70 | info!("No global array variable found in player JS"); 71 | Regex::new(r#";\s*if\s*\(\s*typeof\s+[a-zA-Z0-9_$]+\s*===?\s*"undefined"\s*\)\s*return\s+\w+;"#).unwrap() 72 | }; 73 | 74 | // Now handle the conditional return statement cleanup 75 | // info!("jscode: {}", result); 76 | 77 | // Replace the matched pattern with just ";" 78 | if fixup_re.is_match(&result) { 79 | info!("Fixing up nsig_func_body"); 80 | result = fixup_re.replace_all(&result, ";").to_string(); 81 | // info!("result: {}", result); 82 | } else { 83 | info!("nsig_func returned with no fixup"); 84 | } 85 | result 86 | } 87 | 88 | pub async fn fetch_update(state: Arc) -> Result<(), FetchUpdateStatus> { 89 | let global_state = state.clone(); 90 | let response = match reqwest::get(TEST_YOUTUBE_VIDEO).await { 91 | Ok(req) => req.text().await.unwrap(), 92 | Err(x) => { 93 | error!("Could not fetch the test video: {}", x); 94 | return Err(FetchUpdateStatus::CannotFetchTestVideo); 95 | } 96 | }; 97 | 98 | let player_id_str = match REGEX_PLAYER_ID.captures(&response).unwrap().get(1) { 99 | Some(result) => result.as_str(), 100 | None => return Err(FetchUpdateStatus::CannotMatchPlayerID), 101 | }; 102 | 103 | let player_id: u32 = u32::from_str_radix(player_id_str, 16).unwrap(); 104 | 105 | let mut current_player_info = global_state.player_info.lock().await; 106 | let current_player_id = current_player_info.player_id; 107 | 108 | if player_id == current_player_id { 109 | current_player_info.last_update = SystemTime::now(); 110 | return Err(FetchUpdateStatus::PlayerAlreadyUpdated); 111 | } 112 | // release the mutex for other tasks 113 | drop(current_player_info); 114 | 115 | // Download the player script 116 | let player_js_url: String = format!( 117 | "https://www.youtube.com/s/player/{:08x}/player_ias.vflset/en_US/base.js", 118 | player_id 119 | ); 120 | info!("Fetching player JS URL: {}", player_js_url); 121 | let player_javascript = match reqwest::get(player_js_url).await { 122 | Ok(req) => req.text().await.unwrap(), 123 | Err(x) => { 124 | error!("Could not fetch the player JS: {}", x); 125 | return Err(FetchUpdateStatus::CannotFetchPlayerJS); 126 | } 127 | }; 128 | 129 | let mut nsig_function_array_opt = None; 130 | // Extract nsig function array code 131 | for (index, nsig_function_array_str) in NSIG_FUNCTION_ARRAYS.iter().enumerate() { 132 | let nsig_function_array_regex = Regex::new(&nsig_function_array_str).unwrap(); 133 | nsig_function_array_opt = match nsig_function_array_regex.captures(&player_javascript) { 134 | None => { 135 | warn!("nsig function array did not work: {}", nsig_function_array_str); 136 | if index == NSIG_FUNCTION_ARRAYS.len() { 137 | error!("!!ERROR!! nsig function array unable to be extracted"); 138 | return Err(FetchUpdateStatus::NsigRegexCompileFailed); 139 | } 140 | continue; 141 | } 142 | Some(i) => { 143 | Some(i) 144 | } 145 | }; 146 | break; 147 | } 148 | 149 | let nsig_function_array = nsig_function_array_opt.unwrap(); 150 | let nsig_array_name = nsig_function_array.name("nfunc").unwrap().as_str(); 151 | let nsig_array_value = nsig_function_array 152 | .name("idx") 153 | .unwrap() 154 | .as_str() 155 | .parse::() 156 | .unwrap(); 157 | 158 | let mut nsig_array_context_regex: String = String::new(); 159 | nsig_array_context_regex += "var "; 160 | nsig_array_context_regex += &nsig_array_name.replace("$", "\\$"); 161 | nsig_array_context_regex += "\\s*=\\s*\\[(.+?)][;,]"; 162 | 163 | let nsig_array_context = match Regex::new(&nsig_array_context_regex) { 164 | Ok(x) => x, 165 | Err(x) => { 166 | error!("Error: nsig regex compilation failed: {}", x); 167 | return Err(FetchUpdateStatus::NsigRegexCompileFailed); 168 | } 169 | }; 170 | 171 | let array_content = nsig_array_context 172 | .captures(&player_javascript) 173 | .unwrap() 174 | .get(1) 175 | .unwrap() 176 | .as_str() 177 | .split(','); 178 | 179 | let array_values: Vec<&str> = array_content.collect(); 180 | 181 | let nsig_function_name = array_values.get(nsig_array_value).unwrap(); 182 | 183 | let mut nsig_function_code = String::new(); 184 | nsig_function_code += "function "; 185 | nsig_function_code += NSIG_FUNCTION_NAME; 186 | 187 | debug!("nsig function name: {}", nsig_function_name); 188 | 189 | // Extract nsig function code 190 | for (index, ending) in NSIG_FUNCTION_ENDINGS.iter().enumerate() { 191 | let mut nsig_function_code_regex_str: String = String::new(); 192 | nsig_function_code_regex_str += "(?ms)"; 193 | nsig_function_code_regex_str += &nsig_function_name.replace("$", "\\$"); 194 | nsig_function_code_regex_str += ending; 195 | 196 | let nsig_function_code_regex = Regex::new(&nsig_function_code_regex_str).unwrap(); 197 | nsig_function_code += match nsig_function_code_regex.captures(&player_javascript) { 198 | None => { 199 | warn!("nsig function ending did not work: {}", ending); 200 | if index == NSIG_FUNCTION_ENDINGS.len() { 201 | error!("!!ERROR!! nsig function unable to be extracted"); 202 | return Err(FetchUpdateStatus::NsigRegexCompileFailed); 203 | } 204 | 205 | continue; 206 | } 207 | Some(i) => { 208 | debug!("nsig function ending worked: {}", ending); 209 | i.get(1).unwrap().as_str() 210 | } 211 | }; 212 | nsig_function_code = fixup_nsig_jscode(&nsig_function_code, &player_javascript); 213 | debug!("got nsig fn code: {}", nsig_function_code); 214 | break; 215 | } 216 | 217 | let (global_var, varname, _) = extract_player_js_global_var(&player_javascript).unwrap(); 218 | if !global_var.is_empty() { 219 | debug!("Found global var for sig: {}", global_var); 220 | debug!("Found varname for sig: {}", varname); 221 | } else { 222 | debug!("No global var found for sig"); 223 | } 224 | 225 | // Extract signature function name 226 | let mut sig_function_name = String::new(); 227 | let mut found_sig_function = false; 228 | 229 | for sig_pattern in REGEX_SIGNATURE_FUNCTION_PATTERNS.iter() { 230 | let _sig_pattern = sig_pattern.replace("GLOBAL_VAR_NAME", ®ex::escape(&varname)); 231 | 232 | debug!("sig pattern: {}", _sig_pattern); 233 | 234 | let sig_regex = match Regex::new(&_sig_pattern) { 235 | Ok(r) => r, 236 | Err(e) => { 237 | warn!("Failed to compile signature regex pattern: {}", e); 238 | continue; 239 | } 240 | }; 241 | 242 | if let Some(cap) = sig_regex.captures(&player_javascript) { 243 | if let Some(m) = cap.get(1) { 244 | sig_function_name = m.as_str().to_string(); 245 | found_sig_function = true; 246 | break; 247 | } 248 | } 249 | } 250 | 251 | if !found_sig_function { 252 | sig_function_name = format!("sig_function_{}", SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis()); 253 | info!("No signature function found in player JS, using random name: {}", sig_function_name); 254 | } 255 | 256 | let mut sig_code = String::new(); 257 | 258 | // if sig_function_name is not empty, then we need to extract the function body 259 | if found_sig_function { 260 | debug!("found sig function: {}", sig_function_name); 261 | 262 | let mut sig_function_body_regex_str: String = String::new(); 263 | sig_function_body_regex_str += &sig_function_name.replace("$", "\\$"); 264 | sig_function_body_regex_str += "=function\\([a-zA-Z0-9_]+\\)\\{.+?\\}"; 265 | 266 | let sig_function_body_regex = Regex::new(&sig_function_body_regex_str).unwrap(); 267 | 268 | let sig_function_body = sig_function_body_regex 269 | .captures(&player_javascript) 270 | .unwrap() 271 | .get(0) 272 | .unwrap() 273 | .as_str(); 274 | 275 | // Get the helper object 276 | let helper_object_name = REGEX_HELPER_OBJ_NAME 277 | .captures(sig_function_body) 278 | .unwrap() 279 | .get(1) 280 | .unwrap() 281 | .as_str(); 282 | 283 | let mut helper_object_body_regex_str = String::new(); 284 | helper_object_body_regex_str += "(var "; 285 | helper_object_body_regex_str += &helper_object_name.replace("$", "\\$"); 286 | helper_object_body_regex_str += "=\\{(?:.|\\n)+?\\}\\};)"; 287 | 288 | let helper_object_body_regex = Regex::new(&helper_object_body_regex_str).unwrap(); 289 | let helper_object_body = helper_object_body_regex 290 | .captures(&player_javascript) 291 | .unwrap() 292 | .get(0) 293 | .unwrap() 294 | .as_str(); 295 | 296 | sig_code += "var "; 297 | sig_code += &sig_function_name; 298 | sig_code += ";"; 299 | 300 | if !global_var.is_empty() { 301 | sig_code += &global_var; 302 | sig_code += ";"; 303 | } 304 | 305 | sig_code += helper_object_body; 306 | sig_code += sig_function_body; 307 | } else { 308 | // just return empty sig function code with random name 309 | sig_code += "var "; 310 | sig_code += &sig_function_name; 311 | sig_code += ";"; 312 | info!("No signature function found in player JS, just returning empty sig function code with random name: {}", sig_function_name); 313 | } 314 | 315 | debug!("sig code: {}", sig_code); 316 | 317 | // Get signature timestamp 318 | let signature_timestamp: u64 = REGEX_SIGNATURE_TIMESTAMP 319 | .captures(&player_javascript) 320 | .unwrap() 321 | .get(1) 322 | .unwrap() 323 | .as_str() 324 | .parse() 325 | .unwrap(); 326 | 327 | current_player_info = global_state.player_info.lock().await; 328 | current_player_info.player_id = player_id; 329 | current_player_info.nsig_function_code = nsig_function_code; 330 | current_player_info.sig_function_code = sig_code; 331 | current_player_info.sig_function_name = sig_function_name.to_string(); 332 | current_player_info.signature_timestamp = signature_timestamp; 333 | current_player_info.has_player = 0xFF; 334 | current_player_info.last_update = SystemTime::now(); 335 | 336 | Ok(()) 337 | } 338 | --------------------------------------------------------------------------------