Merge branch 'crunchy-labs:master' into master

This commit is contained in:
DanGLES3 2022-11-30 20:57:28 -03:00 committed by GitHub
commit 299dc4e8d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 483 additions and 184 deletions

View file

@ -8,15 +8,13 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
test: test-nix:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
toolchain: x86_64-unknown-linux-musl toolchain: x86_64-unknown-linux-musl
- os: windows-latest
toolchain: x86_64-pc-windows-gnu
- os: macos-latest - os: macos-latest
toolchain: x86_64-apple-darwin toolchain: x86_64-apple-darwin
steps: steps:
@ -48,10 +46,50 @@ jobs:
command: test command: test
args: --all-features args: --all-features
build: test-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- run: vcpkg integrate install
- name: Install OpenSSL
run: vcpkg install openssl:x64-windows-static-md
- name: Set env variables
shell: bash
run: echo "CFLAGS=-I$(echo $VCPKG_INSTALLATION_ROOT)\packages\openssl_x64-windows-static-md\include" >> $GITHUB_ENV
- name: Cargo cache # https://github.com/actions/cache/blob/main/examples.md#rust---cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: x86_64-pc-windows-msvc
default: true
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args:
build-nix:
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
needs: needs:
- test - test-nix
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
@ -59,15 +97,9 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
toolchain: x86_64-unknown-linux-musl toolchain: x86_64-unknown-linux-musl
platform: linux platform: linux
ext:
- os: windows-latest
toolchain: x86_64-pc-windows-gnu
platform: windows
ext: .exe
- os: macos-latest - os: macos-latest
toolchain: x86_64-apple-darwin toolchain: x86_64-apple-darwin
platform: darwin platform: darwin
ext:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -101,7 +133,71 @@ jobs:
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: crunchy-cli_${{ matrix.platform }} name: crunchy-cli_${{ matrix.platform }}
path: ./target/release/crunchy-cli${{ matrix.ext }} path: ./target/release/crunchy-cli
if-no-files-found: error
- name: Upload manpages artifact
uses: actions/upload-artifact@v3
with:
name: manpages
path: ./target/release/manpages
if-no-files-found: error
- name: Upload completions artifact
uses: actions/upload-artifact@v3
with:
name: completions
path: ./target/release/completions
if-no-files-found: error
build-windows:
if: github.ref == 'refs/heads/master'
needs:
- test-windows
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- run: vcpkg integrate install
- name: Install OpenSSL
run: vcpkg install openssl:x64-windows-static-md
- name: Set env variables
shell: bash
run: echo "CFLAGS=-I$(echo $VCPKG_INSTALLATION_ROOT)\packages\openssl_x64-windows-static-md\include" >> $GITHUB_ENV
- name: Cargo cache # https://github.com/actions/cache/blob/main/examples.md#rust---cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: x86_64-pc-windows-msvc
default: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: crunchy-cli_windows.exe
path: ./target/release/crunchy-cli.exe
if-no-files-found: error if-no-files-found: error
- name: Upload manpages artifact - name: Upload manpages artifact

255
Cargo.lock generated
View file

@ -39,9 +39,9 @@ checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6"
[[package]] [[package]]
name = "async-channel" name = "async-channel"
version = "1.7.1" version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833"
dependencies = [ dependencies = [
"concurrent-queue", "concurrent-queue",
"event-listener", "event-listener",
@ -50,32 +50,27 @@ dependencies = [
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.58" version = "0.1.59"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
] ]
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "base64"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.3.2" version = "1.3.2"
@ -103,18 +98,21 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c"
[[package]]
name = "cache-padded"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
[[package]] [[package]]
name = "castaway" name = "castaway"
version = "0.1.2" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2698f953def977c68f935bb0dfa959375ad4638570e969e2f1e9f433cbf1af6" checksum = "a2698f953def977c68f935bb0dfa959375ad4638570e969e2f1e9f433cbf1af6"
[[package]]
name = "castaway"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc"
dependencies = [
"rustversion",
]
[[package]] [[package]]
name = "cbc" name = "cbc"
version = "0.1.2" version = "0.1.2"
@ -164,14 +162,14 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.0.26" version = "4.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2148adefda54e14492fb9bddcc600b4344c5d1a3123bd666dcb939c6f0e0e57e" checksum = "4d63b9e9c07271b9957ad22c173bae2a4d9a81127680962039296abcd2f8251d"
dependencies = [ dependencies = [
"atty",
"bitflags", "bitflags",
"clap_derive", "clap_derive",
"clap_lex", "clap_lex",
"is-terminal",
"once_cell", "once_cell",
"strsim", "strsim",
"termcolor", "termcolor",
@ -179,9 +177,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_complete" name = "clap_complete"
version = "4.0.5" version = "4.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96b0fba905b035a30d25c1b585bf1171690712fbb0ad3ac47214963aa4acc36c" checksum = "b7b3c9eae0de7bf8e3f904a5e40612b21fb2e2e566456d177809a48b892d24da"
dependencies = [ dependencies = [
"clap", "clap",
] ]
@ -210,9 +208,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_mangen" name = "clap_mangen"
version = "0.2.4" version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa149477df7854a1497db0def32b8a65bf98f72a14d04ac75b01938285d83420" checksum = "e503c3058af0a0854668ea01db55c622482a080092fede9dd2e00a00a9436504"
dependencies = [ dependencies = [
"clap", "clap",
"roff", "roff",
@ -230,11 +228,21 @@ dependencies = [
[[package]] [[package]]
name = "concurrent-queue" name = "concurrent-queue"
version = "1.2.4" version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b"
dependencies = [ dependencies = [
"cache-padded", "crossbeam-utils",
]
[[package]]
name = "core-foundation"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
dependencies = [
"core-foundation-sys",
"libc",
] ]
[[package]] [[package]]
@ -270,6 +278,7 @@ dependencies = [
"clap_complete", "clap_complete",
"clap_mangen", "clap_mangen",
"crunchy-cli-core", "crunchy-cli-core",
"static_vcruntime",
"tokio", "tokio",
] ]
@ -284,10 +293,11 @@ dependencies = [
"crunchyroll-rs", "crunchyroll-rs",
"ctrlc", "ctrlc",
"dirs", "dirs",
"isahc", "isahc 1.7.0 (git+https://github.com/sagebind/isahc?rev=c39f6f8)",
"log", "log",
"num_cpus", "num_cpus",
"regex", "regex",
"rustls-native-certs",
"signal-hook", "signal-hook",
"sys-locale", "sys-locale",
"tempfile", "tempfile",
@ -298,16 +308,18 @@ dependencies = [
[[package]] [[package]]
name = "crunchyroll-rs" name = "crunchyroll-rs"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/crunchy-labs/crunchyroll-rs#7aedfc6c9a91a42ef46639ba9e99adba63cd0dda" source = "git+https://github.com/crunchy-labs/crunchyroll-rs#3d455ebca34cfa83df39777f3e1414cee4f84002"
dependencies = [ dependencies = [
"aes", "aes",
"cbc", "cbc",
"chrono", "chrono",
"crunchyroll-rs-internal", "crunchyroll-rs-internal",
"curl-sys",
"http", "http",
"isahc", "isahc 1.7.0 (git+https://github.com/sagebind/isahc?rev=34f158ef)",
"m3u8-rs", "m3u8-rs",
"regex", "regex",
"rustls-native-certs",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
@ -318,7 +330,7 @@ dependencies = [
[[package]] [[package]]
name = "crunchyroll-rs-internal" name = "crunchyroll-rs-internal"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/crunchy-labs/crunchyroll-rs#7aedfc6c9a91a42ef46639ba9e99adba63cd0dda" source = "git+https://github.com/crunchy-labs/crunchyroll-rs#3d455ebca34cfa83df39777f3e1414cee4f84002"
dependencies = [ dependencies = [
"darling", "darling",
"quote", "quote",
@ -455,6 +467,12 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "data-encoding"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57"
[[package]] [[package]]
name = "dirs" name = "dirs"
version = "4.0.0" version = "4.0.0"
@ -598,6 +616,15 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "hermit-abi"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "http" name = "http"
version = "0.2.8" version = "0.2.8"
@ -676,9 +703,25 @@ dependencies = [
[[package]] [[package]]
name = "io-lifetimes" name = "io-lifetimes"
version = "0.7.5" version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
dependencies = [
"libc",
"windows-sys 0.42.0",
]
[[package]]
name = "is-terminal"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330"
dependencies = [
"hermit-abi 0.2.6",
"io-lifetimes",
"rustix",
"windows-sys 0.42.0",
]
[[package]] [[package]]
name = "isahc" name = "isahc"
@ -686,10 +729,11 @@ version = "1.7.0"
source = "git+https://github.com/sagebind/isahc?rev=34f158ef#34f158ef9f87b2387bed2c81936916a29c1eaad1" source = "git+https://github.com/sagebind/isahc?rev=34f158ef#34f158ef9f87b2387bed2c81936916a29c1eaad1"
dependencies = [ dependencies = [
"async-channel", "async-channel",
"castaway", "castaway 0.1.2",
"crossbeam-utils", "crossbeam-utils",
"curl", "curl",
"curl-sys", "curl-sys",
"data-encoding",
"encoding_rs", "encoding_rs",
"event-listener", "event-listener",
"futures-lite", "futures-lite",
@ -707,6 +751,33 @@ dependencies = [
"waker-fn", "waker-fn",
] ]
[[package]]
name = "isahc"
version = "1.7.0"
source = "git+https://github.com/sagebind/isahc?rev=c39f6f8#c39f6f85aaa1f36c5857064c6c3c80f4d307d863"
dependencies = [
"async-channel",
"castaway 0.2.2",
"crossbeam-utils",
"curl",
"curl-sys",
"data-encoding",
"encoding_rs",
"event-listener",
"futures-io",
"futures-lite",
"http",
"log",
"mime",
"once_cell",
"polling",
"sluice",
"tracing",
"tracing-futures",
"url",
"waker-fn",
]
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.4" version = "1.0.4"
@ -767,9 +838,9 @@ dependencies = [
[[package]] [[package]]
name = "linux-raw-sys" name = "linux-raw-sys"
version = "0.0.46" version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
[[package]] [[package]]
name = "log" name = "log"
@ -855,7 +926,7 @@ version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5"
dependencies = [ dependencies = [
"hermit-abi", "hermit-abi 0.1.19",
"libc", "libc",
] ]
@ -871,15 +942,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-src"
version = "111.24.0+1.1.1s"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3498f259dab01178c6228c6b00dcef0ed2a2d5e20d648c017861227773ea4abd"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "openssl-sys" name = "openssl-sys"
version = "0.9.78" version = "0.9.78"
@ -889,7 +951,6 @@ dependencies = [
"autocfg", "autocfg",
"cc", "cc",
"libc", "libc",
"openssl-src",
"pkg-config", "pkg-config",
"vcpkg", "vcpkg",
] ]
@ -946,16 +1007,16 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
[[package]] [[package]]
name = "polling" name = "polling"
version = "2.4.0" version = "2.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2" checksum = "166ca89eb77fd403230b9c156612965a81e094ec6ec3aa13663d4c8b113fa748"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cfg-if", "cfg-if",
"libc", "libc",
"log", "log",
"wepoll-ffi", "wepoll-ffi",
"winapi", "windows-sys 0.42.0",
] ]
[[package]] [[package]]
@ -1054,9 +1115,9 @@ checksum = "b833d8d034ea094b1ea68aa6d5c740e0d04bad9d16568d08ba6f76823a114316"
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.35.13" version = "0.36.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" checksum = "cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"errno", "errno",
@ -1066,6 +1127,33 @@ dependencies = [
"windows-sys 0.42.0", "windows-sys 0.42.0",
] ]
[[package]]
name = "rustls-native-certs"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50"
dependencies = [
"openssl-probe",
"rustls-pemfile",
"schannel",
"security-framework",
]
[[package]]
name = "rustls-pemfile"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55"
dependencies = [
"base64",
]
[[package]]
name = "rustversion"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8"
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.11" version = "1.0.11"
@ -1089,19 +1177,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898"
[[package]] [[package]]
name = "serde" name = "security-framework"
version = "1.0.147" version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c"
dependencies = [
"bitflags",
"core-foundation",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "serde"
version = "1.0.148"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.147" version = "1.0.148"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1191,6 +1302,12 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "static_vcruntime"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "954e3e877803def9dc46075bf4060147c55cd70db97873077232eae0269dc89b"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.10.0" version = "0.10.0"
@ -1199,9 +1316,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.103" version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" checksum = "4ae548ec36cf198c0ef7710d3c230987c2d6d7bd98ad6edc0274462724c585ce"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1246,9 +1363,9 @@ dependencies = [
[[package]] [[package]]
name = "terminal_size" name = "terminal_size"
version = "0.2.2" version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40ca90c434fd12083d1a6bdcbe9f92a14f96c8a1ba600ba451734ac334521f7a" checksum = "cb20089a8ba2b69debd491f8d2d023761cbf196e999218c591fa1e7e15a21907"
dependencies = [ dependencies = [
"rustix", "rustix",
"windows-sys 0.42.0", "windows-sys 0.42.0",
@ -1276,9 +1393,9 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.1.44" version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [ dependencies = [
"libc", "libc",
"wasi 0.10.0+wasi-snapshot-preview1", "wasi 0.10.0+wasi-snapshot-preview1",
@ -1314,9 +1431,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio-macros" name = "tokio-macros"
version = "1.8.0" version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View file

@ -9,9 +9,6 @@ default = ["static-curl"]
# Embed a static curl library into the binary instead of just linking it. # Embed a static curl library into the binary instead of just linking it.
static-curl = ["crunchy-cli-core/static-curl"] static-curl = ["crunchy-cli-core/static-curl"]
# Embed a static openssl library into the binary instead of just linking it. If you want to compile this project against
# musl and have openssl issues, this might solve these issues.
static-ssl = ["crunchy-cli-core/static-ssl"]
[dependencies] [dependencies]
tokio = { version = "1.22", features = ["macros", "rt-multi-thread", "time"], default-features = false } tokio = { version = "1.22", features = ["macros", "rt-multi-thread", "time"], default-features = false }
@ -26,7 +23,10 @@ clap_mangen = "0.2"
# The static-* features must be used here since build dependency features cannot be manipulated from the features # The static-* features must be used here since build dependency features cannot be manipulated from the features
# specified in this Cargo.toml [features]. # specified in this Cargo.toml [features].
crunchy-cli-core = { path = "./crunchy-cli-core", features = ["static-curl", "static-ssl"] } crunchy-cli-core = { path = "./crunchy-cli-core", features = ["static-curl"] }
[target.'cfg(all(windows, target_env = "msvc"))'.build-dependencies]
static_vcruntime = "2.0"
[profile.release] [profile.release]
strip = true strip = true

View file

@ -3,6 +3,9 @@ use clap_complete::shells;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
fn main() -> std::io::Result<()> { fn main() -> std::io::Result<()> {
#[cfg(all(windows, target_env = "msvc"))]
static_vcruntime::metabuild();
// note that we're using an anti-pattern here / violate the rust conventions. build script are // note that we're using an anti-pattern here / violate the rust conventions. build script are
// not supposed to write outside of 'OUT_DIR'. to have the generated files in the build "root" // not supposed to write outside of 'OUT_DIR'. to have the generated files in the build "root"
// (the same directory where the output binary lives) is much simpler than in 'OUT_DIR' since // (the same directory where the output binary lives) is much simpler than in 'OUT_DIR' since

View file

@ -39,9 +39,9 @@ checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6"
[[package]] [[package]]
name = "async-channel" name = "async-channel"
version = "1.7.1" version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833"
dependencies = [ dependencies = [
"concurrent-queue", "concurrent-queue",
"event-listener", "event-listener",
@ -50,32 +50,27 @@ dependencies = [
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.58" version = "0.1.59"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
] ]
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "base64"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.3.2" version = "1.3.2"
@ -103,17 +98,14 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c"
[[package]]
name = "cache-padded"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
[[package]] [[package]]
name = "castaway" name = "castaway"
version = "0.1.2" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2698f953def977c68f935bb0dfa959375ad4638570e969e2f1e9f433cbf1af6" checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc"
dependencies = [
"rustversion",
]
[[package]] [[package]]
name = "cbc" name = "cbc"
@ -164,14 +156,14 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.0.26" version = "4.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2148adefda54e14492fb9bddcc600b4344c5d1a3123bd666dcb939c6f0e0e57e" checksum = "4d63b9e9c07271b9957ad22c173bae2a4d9a81127680962039296abcd2f8251d"
dependencies = [ dependencies = [
"atty",
"bitflags", "bitflags",
"clap_derive", "clap_derive",
"clap_lex", "clap_lex",
"is-terminal",
"once_cell", "once_cell",
"strsim", "strsim",
"termcolor", "termcolor",
@ -211,11 +203,21 @@ dependencies = [
[[package]] [[package]]
name = "concurrent-queue" name = "concurrent-queue"
version = "1.2.4" version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b"
dependencies = [ dependencies = [
"cache-padded", "crossbeam-utils",
]
[[package]]
name = "core-foundation"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
dependencies = [
"core-foundation-sys",
"libc",
] ]
[[package]] [[package]]
@ -257,6 +259,7 @@ dependencies = [
"log", "log",
"num_cpus", "num_cpus",
"regex", "regex",
"rustls-native-certs",
"signal-hook", "signal-hook",
"sys-locale", "sys-locale",
"tempfile", "tempfile",
@ -267,16 +270,18 @@ dependencies = [
[[package]] [[package]]
name = "crunchyroll-rs" name = "crunchyroll-rs"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/crunchy-labs/crunchyroll-rs#7aedfc6c9a91a42ef46639ba9e99adba63cd0dda" source = "git+https://github.com/crunchy-labs/crunchyroll-rs#ffb054cbae4079bf2357a23e90a353ce875978af"
dependencies = [ dependencies = [
"aes", "aes",
"cbc", "cbc",
"chrono", "chrono",
"crunchyroll-rs-internal", "crunchyroll-rs-internal",
"curl-sys",
"http", "http",
"isahc", "isahc",
"m3u8-rs", "m3u8-rs",
"regex", "regex",
"rustls-native-certs",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
@ -287,7 +292,7 @@ dependencies = [
[[package]] [[package]]
name = "crunchyroll-rs-internal" name = "crunchyroll-rs-internal"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/crunchy-labs/crunchyroll-rs#7aedfc6c9a91a42ef46639ba9e99adba63cd0dda" source = "git+https://github.com/crunchy-labs/crunchyroll-rs#ffb054cbae4079bf2357a23e90a353ce875978af"
dependencies = [ dependencies = [
"darling", "darling",
"quote", "quote",
@ -424,6 +429,12 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "data-encoding"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57"
[[package]] [[package]]
name = "dirs" name = "dirs"
version = "4.0.0" version = "4.0.0"
@ -522,13 +533,8 @@ version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48"
dependencies = [ dependencies = [
"fastrand",
"futures-core", "futures-core",
"futures-io",
"memchr",
"parking",
"pin-project-lite", "pin-project-lite",
"waker-fn",
] ]
[[package]] [[package]]
@ -567,6 +573,15 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "hermit-abi"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "http" name = "http"
version = "0.2.8" version = "0.2.8"
@ -645,22 +660,40 @@ dependencies = [
[[package]] [[package]]
name = "io-lifetimes" name = "io-lifetimes"
version = "0.7.5" version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
dependencies = [
"libc",
"windows-sys 0.42.0",
]
[[package]]
name = "is-terminal"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330"
dependencies = [
"hermit-abi 0.2.6",
"io-lifetimes",
"rustix",
"windows-sys 0.42.0",
]
[[package]] [[package]]
name = "isahc" name = "isahc"
version = "1.7.0" version = "1.7.0"
source = "git+https://github.com/sagebind/isahc?rev=34f158ef#34f158ef9f87b2387bed2c81936916a29c1eaad1" source = "git+https://github.com/sagebind/isahc?rev=c39f6f8#c39f6f85aaa1f36c5857064c6c3c80f4d307d863"
dependencies = [ dependencies = [
"async-channel", "async-channel",
"castaway", "castaway",
"crossbeam-utils", "crossbeam-utils",
"curl", "curl",
"curl-sys", "curl-sys",
"data-encoding",
"encoding_rs", "encoding_rs",
"event-listener", "event-listener",
"futures-io",
"futures-lite", "futures-lite",
"http", "http",
"httpdate", "httpdate",
@ -668,7 +701,6 @@ dependencies = [
"mime", "mime",
"once_cell", "once_cell",
"polling", "polling",
"slab",
"sluice", "sluice",
"tracing", "tracing",
"tracing-futures", "tracing-futures",
@ -736,9 +768,9 @@ dependencies = [
[[package]] [[package]]
name = "linux-raw-sys" name = "linux-raw-sys"
version = "0.0.46" version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
[[package]] [[package]]
name = "log" name = "log"
@ -824,7 +856,7 @@ version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5"
dependencies = [ dependencies = [
"hermit-abi", "hermit-abi 0.1.19",
"libc", "libc",
] ]
@ -840,15 +872,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-src"
version = "111.24.0+1.1.1s"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3498f259dab01178c6228c6b00dcef0ed2a2d5e20d648c017861227773ea4abd"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "openssl-sys" name = "openssl-sys"
version = "0.9.78" version = "0.9.78"
@ -858,7 +881,6 @@ dependencies = [
"autocfg", "autocfg",
"cc", "cc",
"libc", "libc",
"openssl-src",
"pkg-config", "pkg-config",
"vcpkg", "vcpkg",
] ]
@ -869,12 +891,6 @@ version = "6.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
[[package]]
name = "parking"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
version = "2.2.0" version = "2.2.0"
@ -915,16 +931,16 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
[[package]] [[package]]
name = "polling" name = "polling"
version = "2.4.0" version = "2.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2" checksum = "166ca89eb77fd403230b9c156612965a81e094ec6ec3aa13663d4c8b113fa748"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cfg-if", "cfg-if",
"libc", "libc",
"log", "log",
"wepoll-ffi", "wepoll-ffi",
"winapi", "windows-sys 0.42.0",
] ]
[[package]] [[package]]
@ -1017,9 +1033,9 @@ dependencies = [
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.35.13" version = "0.36.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" checksum = "cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"errno", "errno",
@ -1029,6 +1045,33 @@ dependencies = [
"windows-sys 0.42.0", "windows-sys 0.42.0",
] ]
[[package]]
name = "rustls-native-certs"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50"
dependencies = [
"openssl-probe",
"rustls-pemfile",
"schannel",
"security-framework",
]
[[package]]
name = "rustls-pemfile"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55"
dependencies = [
"base64",
]
[[package]]
name = "rustversion"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8"
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.11" version = "1.0.11"
@ -1052,19 +1095,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898"
[[package]] [[package]]
name = "serde" name = "security-framework"
version = "1.0.147" version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c"
dependencies = [
"bitflags",
"core-foundation",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "serde"
version = "1.0.148"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.147" version = "1.0.148"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1113,15 +1179,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "slab"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
dependencies = [
"autocfg",
]
[[package]] [[package]]
name = "sluice" name = "sluice"
version = "0.5.5" version = "0.5.5"
@ -1162,9 +1219,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.103" version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" checksum = "4ae548ec36cf198c0ef7710d3c230987c2d6d7bd98ad6edc0274462724c585ce"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1209,9 +1266,9 @@ dependencies = [
[[package]] [[package]]
name = "terminal_size" name = "terminal_size"
version = "0.2.2" version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40ca90c434fd12083d1a6bdcbe9f92a14f96c8a1ba600ba451734ac334521f7a" checksum = "cb20089a8ba2b69debd491f8d2d023761cbf196e999218c591fa1e7e15a21907"
dependencies = [ dependencies = [
"rustix", "rustix",
"windows-sys 0.42.0", "windows-sys 0.42.0",
@ -1239,9 +1296,9 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.1.44" version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [ dependencies = [
"libc", "libc",
"wasi 0.10.0+wasi-snapshot-preview1", "wasi 0.10.0+wasi-snapshot-preview1",
@ -1277,9 +1334,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio-macros" name = "tokio-macros"
version = "1.8.0" version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View file

@ -7,9 +7,6 @@ edition = "2021"
[features] [features]
# Embed a static curl library into the binary instead of just linking it. # Embed a static curl library into the binary instead of just linking it.
static-curl = ["crunchyroll-rs/static-curl"] static-curl = ["crunchyroll-rs/static-curl"]
# Embed a static openssl library into the binary instead of just linking it. If you want to compile this project against
# musl and have openssl issues, this might solve these issues.
static-ssl = ["crunchyroll-rs/static-ssl"]
[dependencies] [dependencies]
anyhow = "1.0" anyhow = "1.0"
@ -19,7 +16,7 @@ chrono = "0.4"
crunchyroll-rs = { git = "https://github.com/crunchy-labs/crunchyroll-rs", default-features = false, features = ["stream", "parse"] } crunchyroll-rs = { git = "https://github.com/crunchy-labs/crunchyroll-rs", default-features = false, features = ["stream", "parse"] }
ctrlc = "3.2" ctrlc = "3.2"
dirs = "4.0" dirs = "4.0"
isahc = { git = "https://github.com/sagebind/isahc", rev = "34f158ef" } isahc = { git = "https://github.com/sagebind/isahc", rev = "c39f6f8" }
log = { version = "0.4", features = ["std"] } log = { version = "0.4", features = ["std"] }
num_cpus = "1.13" num_cpus = "1.13"
regex = "1.6" regex = "1.6"
@ -29,5 +26,9 @@ terminal_size = "0.2"
tokio = { version = "1.21", features = ["macros", "rt-multi-thread", "time"] } tokio = { version = "1.21", features = ["macros", "rt-multi-thread", "time"] }
sys-locale = "0.2" sys-locale = "0.2"
[target.'cfg(all(windows, target_env = "msvc"))'.dependencies]
isahc = { git = "https://github.com/sagebind/isahc", rev = "c39f6f8", features = ["data-encoding"] }
rustls-native-certs = "0.6"
[build-dependencies] [build-dependencies]
chrono = "0.4" chrono = "0.4"

View file

@ -92,6 +92,7 @@ impl CliProgress {
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
pub struct CliLogger { pub struct CliLogger {
all: bool,
level: LevelFilter, level: LevelFilter,
progress: Mutex<Option<CliProgress>>, progress: Mutex<Option<CliProgress>>,
} }
@ -105,7 +106,7 @@ impl Log for CliLogger {
if !self.enabled(record.metadata()) if !self.enabled(record.metadata())
|| (record.target() != "progress" || (record.target() != "progress"
&& record.target() != "progress_end" && record.target() != "progress_end"
&& !record.target().starts_with("crunchy_cli")) && (!self.all && !record.target().starts_with("crunchy_cli")))
{ {
return; return;
} }
@ -136,16 +137,17 @@ impl Log for CliLogger {
} }
impl CliLogger { impl CliLogger {
pub fn new(level: LevelFilter) -> Self { pub fn new(all: bool, level: LevelFilter) -> Self {
Self { Self {
all,
level, level,
progress: Mutex::new(None), progress: Mutex::new(None),
} }
} }
pub fn init(level: LevelFilter) -> Result<(), SetLoggerError> { pub fn init(all: bool, level: LevelFilter) -> Result<(), SetLoggerError> {
set_max_level(level); set_max_level(level);
set_boxed_logger(Box::new(CliLogger::new(level))) set_boxed_logger(Box::new(CliLogger::new(all, level)))
} }
fn extended(&self, record: &Record) { fn extended(&self, record: &Record) {

View file

@ -64,6 +64,10 @@ struct Verbosity {
#[arg(short)] #[arg(short)]
v: bool, v: bool,
#[arg(help = "Very verbose output. Generally not recommended, use '-v' instead")]
#[arg(long)]
vv: bool,
#[arg(help = "Quiet output. Does not print anything unless it's a error")] #[arg(help = "Quiet output. Does not print anything unless it's a error")]
#[arg( #[arg(
long_help = "Quiet output. Does not print anything unless it's a error. Can be helpful if you pipe the output to stdout" long_help = "Quiet output. Does not print anything unless it's a error. Can be helpful if you pipe the output to stdout"
@ -92,16 +96,18 @@ pub async fn cli_entrypoint() {
let cli: Cli = Cli::parse(); let cli: Cli = Cli::parse();
if let Some(verbosity) = &cli.verbosity { if let Some(verbosity) = &cli.verbosity {
if verbosity.v && verbosity.q { if verbosity.v as u8 + verbosity.q as u8 + verbosity.vv as u8 > 1 {
eprintln!("Output cannot be verbose ('-v') and quiet ('-q') at the same time"); eprintln!("Output cannot be verbose ('-v') and quiet ('-q') at the same time");
std::process::exit(1) std::process::exit(1)
} else if verbosity.v { } else if verbosity.v {
CliLogger::init(LevelFilter::Debug).unwrap() CliLogger::init(false, LevelFilter::Debug).unwrap()
} else if verbosity.q { } else if verbosity.q {
CliLogger::init(LevelFilter::Error).unwrap() CliLogger::init(false, LevelFilter::Error).unwrap()
} else if verbosity.vv {
CliLogger::init(true, LevelFilter::Debug).unwrap()
} }
} else { } else {
CliLogger::init(LevelFilter::Info).unwrap() CliLogger::init(false, LevelFilter::Info).unwrap()
} }
debug!("cli input: {:?}", cli); debug!("cli input: {:?}", cli);
@ -164,10 +170,27 @@ pub async fn cli_entrypoint() {
async fn create_ctx(cli: &Cli) -> Result<Context> { async fn create_ctx(cli: &Cli) -> Result<Context> {
let crunchy = crunchyroll_session(cli).await?; let crunchy = crunchyroll_session(cli).await?;
// TODO: Use crunchy.client() when it's possible // use crunchy.client() when it's possible
// currently crunchy.client() has a cloudflare bypass built-in to access crunchyroll. the servers // currently crunchy.client() has a cloudflare bypass built-in to access crunchyroll. the servers
// where crunchy stores their videos can't handle this bypass and simply refuses to connect // where crunchy stores their videos can't handle this bypass and simply refuses to connect
#[cfg(not(all(windows, target_env = "msvc")))]
let client = isahc::HttpClient::new().unwrap(); let client = isahc::HttpClient::new().unwrap();
#[cfg(all(windows, target_env = "msvc"))]
use isahc::config::Configurable;
#[cfg(all(windows, target_env = "msvc"))]
let client = isahc::HttpClientBuilder::default()
.tls_config(
isahc::tls::TlsConfigBuilder::default()
.root_cert_store(isahc::tls::RootCertStore::custom(
rustls_native_certs::load_native_certs()
.unwrap()
.into_iter()
.map(|l| isahc::tls::Certificate::from_der(l.0)),
))
.build(),
)
.build()
.unwrap();
Ok(Context { crunchy, client }) Ok(Context { crunchy, client })
} }