├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md └── src └── main.rs /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "adler" 7 | version = "1.0.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 10 | 11 | [[package]] 12 | name = "alloc-no-stdlib" 13 | version = "2.0.4" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" 16 | 17 | [[package]] 18 | name = "alloc-stdlib" 19 | version = "0.2.2" 20 | source = "registry+https://github.com/rust-lang/crates.io-index" 21 | checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" 22 | dependencies = [ 23 | "alloc-no-stdlib", 24 | ] 25 | 26 | [[package]] 27 | name = "async-compression" 28 | version = "0.3.15" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "942c7cd7ae39e91bde4820d74132e9862e62c2f386c3aa90ccf55949f5bad63a" 31 | dependencies = [ 32 | "brotli", 33 | "flate2", 34 | "futures-core", 35 | "memchr", 36 | "pin-project-lite", 37 | "tokio", 38 | ] 39 | 40 | [[package]] 41 | name = "async-trait" 42 | version = "0.1.68" 43 | source = "registry+https://github.com/rust-lang/crates.io-index" 44 | checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" 45 | dependencies = [ 46 | "proc-macro2", 47 | "quote", 48 | "syn", 49 | ] 50 | 51 | [[package]] 52 | name = "autocfg" 53 | version = "1.1.0" 54 | source = "registry+https://github.com/rust-lang/crates.io-index" 55 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 56 | 57 | [[package]] 58 | name = "base64" 59 | version = "0.21.0" 60 | source = "registry+https://github.com/rust-lang/crates.io-index" 61 | checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" 62 | 63 | [[package]] 64 | name = "bitflags" 65 | version = "1.3.2" 66 | source = "registry+https://github.com/rust-lang/crates.io-index" 67 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 68 | 69 | [[package]] 70 | name = "brotli" 71 | version = "3.3.4" 72 | source = "registry+https://github.com/rust-lang/crates.io-index" 73 | checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" 74 | dependencies = [ 75 | "alloc-no-stdlib", 76 | "alloc-stdlib", 77 | "brotli-decompressor", 78 | ] 79 | 80 | [[package]] 81 | name = "brotli-decompressor" 82 | version = "2.3.4" 83 | source = "registry+https://github.com/rust-lang/crates.io-index" 84 | checksum = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744" 85 | dependencies = [ 86 | "alloc-no-stdlib", 87 | "alloc-stdlib", 88 | ] 89 | 90 | [[package]] 91 | name = "bumpalo" 92 | version = "3.12.2" 93 | source = "registry+https://github.com/rust-lang/crates.io-index" 94 | checksum = "3c6ed94e98ecff0c12dd1b04c15ec0d7d9458ca8fe806cea6f12954efe74c63b" 95 | 96 | [[package]] 97 | name = "bytes" 98 | version = "1.4.0" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" 101 | 102 | [[package]] 103 | name = "cc" 104 | version = "1.0.79" 105 | source = "registry+https://github.com/rust-lang/crates.io-index" 106 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 107 | 108 | [[package]] 109 | name = "cfg-if" 110 | version = "1.0.0" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 113 | 114 | [[package]] 115 | name = "config" 116 | version = "0.13.3" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "d379af7f68bfc21714c6c7dea883544201741d2ce8274bb12fa54f89507f52a7" 119 | dependencies = [ 120 | "async-trait", 121 | "lazy_static", 122 | "nom", 123 | "pathdiff", 124 | "serde", 125 | "toml", 126 | ] 127 | 128 | [[package]] 129 | name = "core-foundation" 130 | version = "0.9.3" 131 | source = "registry+https://github.com/rust-lang/crates.io-index" 132 | checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" 133 | dependencies = [ 134 | "core-foundation-sys", 135 | "libc", 136 | ] 137 | 138 | [[package]] 139 | name = "core-foundation-sys" 140 | version = "0.8.4" 141 | source = "registry+https://github.com/rust-lang/crates.io-index" 142 | checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" 143 | 144 | [[package]] 145 | name = "crc32fast" 146 | version = "1.3.2" 147 | source = "registry+https://github.com/rust-lang/crates.io-index" 148 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 149 | dependencies = [ 150 | "cfg-if", 151 | ] 152 | 153 | [[package]] 154 | name = "dirs" 155 | version = "5.0.1" 156 | source = "registry+https://github.com/rust-lang/crates.io-index" 157 | checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" 158 | dependencies = [ 159 | "dirs-sys", 160 | ] 161 | 162 | [[package]] 163 | name = "dirs-sys" 164 | version = "0.4.1" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" 167 | dependencies = [ 168 | "libc", 169 | "option-ext", 170 | "redox_users", 171 | "windows-sys 0.48.0", 172 | ] 173 | 174 | [[package]] 175 | name = "either" 176 | version = "1.8.1" 177 | source = "registry+https://github.com/rust-lang/crates.io-index" 178 | checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" 179 | 180 | [[package]] 181 | name = "encoding_rs" 182 | version = "0.8.32" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" 185 | dependencies = [ 186 | "cfg-if", 187 | ] 188 | 189 | [[package]] 190 | name = "errno" 191 | version = "0.3.1" 192 | source = "registry+https://github.com/rust-lang/crates.io-index" 193 | checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" 194 | dependencies = [ 195 | "errno-dragonfly", 196 | "libc", 197 | "windows-sys 0.48.0", 198 | ] 199 | 200 | [[package]] 201 | name = "errno-dragonfly" 202 | version = "0.1.2" 203 | source = "registry+https://github.com/rust-lang/crates.io-index" 204 | checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" 205 | dependencies = [ 206 | "cc", 207 | "libc", 208 | ] 209 | 210 | [[package]] 211 | name = "fastrand" 212 | version = "1.9.0" 213 | source = "registry+https://github.com/rust-lang/crates.io-index" 214 | checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" 215 | dependencies = [ 216 | "instant", 217 | ] 218 | 219 | [[package]] 220 | name = "flate2" 221 | version = "1.0.26" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" 224 | dependencies = [ 225 | "crc32fast", 226 | "miniz_oxide", 227 | ] 228 | 229 | [[package]] 230 | name = "fnv" 231 | version = "1.0.7" 232 | source = "registry+https://github.com/rust-lang/crates.io-index" 233 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 234 | 235 | [[package]] 236 | name = "foreign-types" 237 | version = "0.3.2" 238 | source = "registry+https://github.com/rust-lang/crates.io-index" 239 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 240 | dependencies = [ 241 | "foreign-types-shared", 242 | ] 243 | 244 | [[package]] 245 | name = "foreign-types-shared" 246 | version = "0.1.1" 247 | source = "registry+https://github.com/rust-lang/crates.io-index" 248 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 249 | 250 | [[package]] 251 | name = "form_urlencoded" 252 | version = "1.1.0" 253 | source = "registry+https://github.com/rust-lang/crates.io-index" 254 | checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" 255 | dependencies = [ 256 | "percent-encoding", 257 | ] 258 | 259 | [[package]] 260 | name = "futures-channel" 261 | version = "0.3.28" 262 | source = "registry+https://github.com/rust-lang/crates.io-index" 263 | checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" 264 | dependencies = [ 265 | "futures-core", 266 | ] 267 | 268 | [[package]] 269 | name = "futures-core" 270 | version = "0.3.28" 271 | source = "registry+https://github.com/rust-lang/crates.io-index" 272 | checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" 273 | 274 | [[package]] 275 | name = "futures-sink" 276 | version = "0.3.28" 277 | source = "registry+https://github.com/rust-lang/crates.io-index" 278 | checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" 279 | 280 | [[package]] 281 | name = "futures-task" 282 | version = "0.3.28" 283 | source = "registry+https://github.com/rust-lang/crates.io-index" 284 | checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" 285 | 286 | [[package]] 287 | name = "futures-util" 288 | version = "0.3.28" 289 | source = "registry+https://github.com/rust-lang/crates.io-index" 290 | checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" 291 | dependencies = [ 292 | "futures-core", 293 | "futures-task", 294 | "pin-project-lite", 295 | "pin-utils", 296 | ] 297 | 298 | [[package]] 299 | name = "getrandom" 300 | version = "0.2.10" 301 | source = "registry+https://github.com/rust-lang/crates.io-index" 302 | checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" 303 | dependencies = [ 304 | "cfg-if", 305 | "libc", 306 | "wasi", 307 | ] 308 | 309 | [[package]] 310 | name = "h2" 311 | version = "0.3.18" 312 | source = "registry+https://github.com/rust-lang/crates.io-index" 313 | checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" 314 | dependencies = [ 315 | "bytes", 316 | "fnv", 317 | "futures-core", 318 | "futures-sink", 319 | "futures-util", 320 | "http", 321 | "indexmap", 322 | "slab", 323 | "tokio", 324 | "tokio-util", 325 | "tracing", 326 | ] 327 | 328 | [[package]] 329 | name = "hashbrown" 330 | version = "0.12.3" 331 | source = "registry+https://github.com/rust-lang/crates.io-index" 332 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 333 | 334 | [[package]] 335 | name = "hermit-abi" 336 | version = "0.2.6" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" 339 | dependencies = [ 340 | "libc", 341 | ] 342 | 343 | [[package]] 344 | name = "hermit-abi" 345 | version = "0.3.1" 346 | source = "registry+https://github.com/rust-lang/crates.io-index" 347 | checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" 348 | 349 | [[package]] 350 | name = "http" 351 | version = "0.2.9" 352 | source = "registry+https://github.com/rust-lang/crates.io-index" 353 | checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" 354 | dependencies = [ 355 | "bytes", 356 | "fnv", 357 | "itoa", 358 | ] 359 | 360 | [[package]] 361 | name = "http-body" 362 | version = "0.4.5" 363 | source = "registry+https://github.com/rust-lang/crates.io-index" 364 | checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" 365 | dependencies = [ 366 | "bytes", 367 | "http", 368 | "pin-project-lite", 369 | ] 370 | 371 | [[package]] 372 | name = "httparse" 373 | version = "1.8.0" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" 376 | 377 | [[package]] 378 | name = "httpdate" 379 | version = "1.0.2" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" 382 | 383 | [[package]] 384 | name = "hyper" 385 | version = "0.14.26" 386 | source = "registry+https://github.com/rust-lang/crates.io-index" 387 | checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" 388 | dependencies = [ 389 | "bytes", 390 | "futures-channel", 391 | "futures-core", 392 | "futures-util", 393 | "h2", 394 | "http", 395 | "http-body", 396 | "httparse", 397 | "httpdate", 398 | "itoa", 399 | "pin-project-lite", 400 | "socket2", 401 | "tokio", 402 | "tower-service", 403 | "tracing", 404 | "want", 405 | ] 406 | 407 | [[package]] 408 | name = "hyper-tls" 409 | version = "0.5.0" 410 | source = "registry+https://github.com/rust-lang/crates.io-index" 411 | checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" 412 | dependencies = [ 413 | "bytes", 414 | "hyper", 415 | "native-tls", 416 | "tokio", 417 | "tokio-native-tls", 418 | ] 419 | 420 | [[package]] 421 | name = "idna" 422 | version = "0.3.0" 423 | source = "registry+https://github.com/rust-lang/crates.io-index" 424 | checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" 425 | dependencies = [ 426 | "unicode-bidi", 427 | "unicode-normalization", 428 | ] 429 | 430 | [[package]] 431 | name = "indexmap" 432 | version = "1.9.3" 433 | source = "registry+https://github.com/rust-lang/crates.io-index" 434 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 435 | dependencies = [ 436 | "autocfg", 437 | "hashbrown", 438 | ] 439 | 440 | [[package]] 441 | name = "instant" 442 | version = "0.1.12" 443 | source = "registry+https://github.com/rust-lang/crates.io-index" 444 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 445 | dependencies = [ 446 | "cfg-if", 447 | ] 448 | 449 | [[package]] 450 | name = "io-lifetimes" 451 | version = "1.0.10" 452 | source = "registry+https://github.com/rust-lang/crates.io-index" 453 | checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" 454 | dependencies = [ 455 | "hermit-abi 0.3.1", 456 | "libc", 457 | "windows-sys 0.48.0", 458 | ] 459 | 460 | [[package]] 461 | name = "ipnet" 462 | version = "2.7.2" 463 | source = "registry+https://github.com/rust-lang/crates.io-index" 464 | checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" 465 | 466 | [[package]] 467 | name = "itertools" 468 | version = "0.10.5" 469 | source = "registry+https://github.com/rust-lang/crates.io-index" 470 | checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" 471 | dependencies = [ 472 | "either", 473 | ] 474 | 475 | [[package]] 476 | name = "itoa" 477 | version = "1.0.6" 478 | source = "registry+https://github.com/rust-lang/crates.io-index" 479 | checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" 480 | 481 | [[package]] 482 | name = "js-sys" 483 | version = "0.3.62" 484 | source = "registry+https://github.com/rust-lang/crates.io-index" 485 | checksum = "68c16e1bfd491478ab155fd8b4896b86f9ede344949b641e61501e07c2b8b4d5" 486 | dependencies = [ 487 | "wasm-bindgen", 488 | ] 489 | 490 | [[package]] 491 | name = "lazy_static" 492 | version = "1.4.0" 493 | source = "registry+https://github.com/rust-lang/crates.io-index" 494 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 495 | 496 | [[package]] 497 | name = "libc" 498 | version = "0.2.144" 499 | source = "registry+https://github.com/rust-lang/crates.io-index" 500 | checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" 501 | 502 | [[package]] 503 | name = "linux-raw-sys" 504 | version = "0.3.7" 505 | source = "registry+https://github.com/rust-lang/crates.io-index" 506 | checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f" 507 | 508 | [[package]] 509 | name = "lock_api" 510 | version = "0.4.9" 511 | source = "registry+https://github.com/rust-lang/crates.io-index" 512 | checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" 513 | dependencies = [ 514 | "autocfg", 515 | "scopeguard", 516 | ] 517 | 518 | [[package]] 519 | name = "log" 520 | version = "0.4.17" 521 | source = "registry+https://github.com/rust-lang/crates.io-index" 522 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 523 | dependencies = [ 524 | "cfg-if", 525 | ] 526 | 527 | [[package]] 528 | name = "memchr" 529 | version = "2.5.0" 530 | source = "registry+https://github.com/rust-lang/crates.io-index" 531 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 532 | 533 | [[package]] 534 | name = "mime" 535 | version = "0.3.17" 536 | source = "registry+https://github.com/rust-lang/crates.io-index" 537 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 538 | 539 | [[package]] 540 | name = "minimal-lexical" 541 | version = "0.2.1" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" 544 | 545 | [[package]] 546 | name = "miniz_oxide" 547 | version = "0.7.1" 548 | source = "registry+https://github.com/rust-lang/crates.io-index" 549 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" 550 | dependencies = [ 551 | "adler", 552 | ] 553 | 554 | [[package]] 555 | name = "mio" 556 | version = "0.8.6" 557 | source = "registry+https://github.com/rust-lang/crates.io-index" 558 | checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" 559 | dependencies = [ 560 | "libc", 561 | "log", 562 | "wasi", 563 | "windows-sys 0.45.0", 564 | ] 565 | 566 | [[package]] 567 | name = "native-tls" 568 | version = "0.2.11" 569 | source = "registry+https://github.com/rust-lang/crates.io-index" 570 | checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" 571 | dependencies = [ 572 | "lazy_static", 573 | "libc", 574 | "log", 575 | "openssl", 576 | "openssl-probe", 577 | "openssl-sys", 578 | "schannel", 579 | "security-framework", 580 | "security-framework-sys", 581 | "tempfile", 582 | ] 583 | 584 | [[package]] 585 | name = "nom" 586 | version = "7.1.3" 587 | source = "registry+https://github.com/rust-lang/crates.io-index" 588 | checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" 589 | dependencies = [ 590 | "memchr", 591 | "minimal-lexical", 592 | ] 593 | 594 | [[package]] 595 | name = "num_cpus" 596 | version = "1.15.0" 597 | source = "registry+https://github.com/rust-lang/crates.io-index" 598 | checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" 599 | dependencies = [ 600 | "hermit-abi 0.2.6", 601 | "libc", 602 | ] 603 | 604 | [[package]] 605 | name = "once_cell" 606 | version = "1.17.1" 607 | source = "registry+https://github.com/rust-lang/crates.io-index" 608 | checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" 609 | 610 | [[package]] 611 | name = "openssl" 612 | version = "0.10.52" 613 | source = "registry+https://github.com/rust-lang/crates.io-index" 614 | checksum = "01b8574602df80f7b85fdfc5392fa884a4e3b3f4f35402c070ab34c3d3f78d56" 615 | dependencies = [ 616 | "bitflags", 617 | "cfg-if", 618 | "foreign-types", 619 | "libc", 620 | "once_cell", 621 | "openssl-macros", 622 | "openssl-sys", 623 | ] 624 | 625 | [[package]] 626 | name = "openssl-macros" 627 | version = "0.1.1" 628 | source = "registry+https://github.com/rust-lang/crates.io-index" 629 | checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" 630 | dependencies = [ 631 | "proc-macro2", 632 | "quote", 633 | "syn", 634 | ] 635 | 636 | [[package]] 637 | name = "openssl-probe" 638 | version = "0.1.5" 639 | source = "registry+https://github.com/rust-lang/crates.io-index" 640 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 641 | 642 | [[package]] 643 | name = "openssl-sys" 644 | version = "0.9.87" 645 | source = "registry+https://github.com/rust-lang/crates.io-index" 646 | checksum = "8e17f59264b2809d77ae94f0e1ebabc434773f370d6ca667bd223ea10e06cc7e" 647 | dependencies = [ 648 | "cc", 649 | "libc", 650 | "pkg-config", 651 | "vcpkg", 652 | ] 653 | 654 | [[package]] 655 | name = "option-ext" 656 | version = "0.2.0" 657 | source = "registry+https://github.com/rust-lang/crates.io-index" 658 | checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" 659 | 660 | [[package]] 661 | name = "parking_lot" 662 | version = "0.12.1" 663 | source = "registry+https://github.com/rust-lang/crates.io-index" 664 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" 665 | dependencies = [ 666 | "lock_api", 667 | "parking_lot_core", 668 | ] 669 | 670 | [[package]] 671 | name = "parking_lot_core" 672 | version = "0.9.7" 673 | source = "registry+https://github.com/rust-lang/crates.io-index" 674 | checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" 675 | dependencies = [ 676 | "cfg-if", 677 | "libc", 678 | "redox_syscall 0.2.16", 679 | "smallvec", 680 | "windows-sys 0.45.0", 681 | ] 682 | 683 | [[package]] 684 | name = "pathdiff" 685 | version = "0.2.1" 686 | source = "registry+https://github.com/rust-lang/crates.io-index" 687 | checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" 688 | 689 | [[package]] 690 | name = "percent-encoding" 691 | version = "2.2.0" 692 | source = "registry+https://github.com/rust-lang/crates.io-index" 693 | checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" 694 | 695 | [[package]] 696 | name = "pin-project-lite" 697 | version = "0.2.9" 698 | source = "registry+https://github.com/rust-lang/crates.io-index" 699 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" 700 | 701 | [[package]] 702 | name = "pin-utils" 703 | version = "0.1.0" 704 | source = "registry+https://github.com/rust-lang/crates.io-index" 705 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 706 | 707 | [[package]] 708 | name = "pkg-config" 709 | version = "0.3.27" 710 | source = "registry+https://github.com/rust-lang/crates.io-index" 711 | checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" 712 | 713 | [[package]] 714 | name = "proc-macro2" 715 | version = "1.0.56" 716 | source = "registry+https://github.com/rust-lang/crates.io-index" 717 | checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" 718 | dependencies = [ 719 | "unicode-ident", 720 | ] 721 | 722 | [[package]] 723 | name = "quote" 724 | version = "1.0.27" 725 | source = "registry+https://github.com/rust-lang/crates.io-index" 726 | checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" 727 | dependencies = [ 728 | "proc-macro2", 729 | ] 730 | 731 | [[package]] 732 | name = "readwise-epub" 733 | version = "0.1.0" 734 | dependencies = [ 735 | "config", 736 | "dirs", 737 | "itertools", 738 | "reqwest", 739 | "serde", 740 | "serde_json", 741 | "time", 742 | "tokio", 743 | ] 744 | 745 | [[package]] 746 | name = "redox_syscall" 747 | version = "0.2.16" 748 | source = "registry+https://github.com/rust-lang/crates.io-index" 749 | checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" 750 | dependencies = [ 751 | "bitflags", 752 | ] 753 | 754 | [[package]] 755 | name = "redox_syscall" 756 | version = "0.3.5" 757 | source = "registry+https://github.com/rust-lang/crates.io-index" 758 | checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" 759 | dependencies = [ 760 | "bitflags", 761 | ] 762 | 763 | [[package]] 764 | name = "redox_users" 765 | version = "0.4.3" 766 | source = "registry+https://github.com/rust-lang/crates.io-index" 767 | checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" 768 | dependencies = [ 769 | "getrandom", 770 | "redox_syscall 0.2.16", 771 | "thiserror", 772 | ] 773 | 774 | [[package]] 775 | name = "reqwest" 776 | version = "0.11.17" 777 | source = "registry+https://github.com/rust-lang/crates.io-index" 778 | checksum = "13293b639a097af28fc8a90f22add145a9c954e49d77da06263d58cf44d5fb91" 779 | dependencies = [ 780 | "async-compression", 781 | "base64", 782 | "bytes", 783 | "encoding_rs", 784 | "futures-core", 785 | "futures-util", 786 | "h2", 787 | "http", 788 | "http-body", 789 | "hyper", 790 | "hyper-tls", 791 | "ipnet", 792 | "js-sys", 793 | "log", 794 | "mime", 795 | "native-tls", 796 | "once_cell", 797 | "percent-encoding", 798 | "pin-project-lite", 799 | "serde", 800 | "serde_json", 801 | "serde_urlencoded", 802 | "tokio", 803 | "tokio-native-tls", 804 | "tokio-util", 805 | "tower-service", 806 | "url", 807 | "wasm-bindgen", 808 | "wasm-bindgen-futures", 809 | "web-sys", 810 | "winreg", 811 | ] 812 | 813 | [[package]] 814 | name = "rustix" 815 | version = "0.37.19" 816 | source = "registry+https://github.com/rust-lang/crates.io-index" 817 | checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" 818 | dependencies = [ 819 | "bitflags", 820 | "errno", 821 | "io-lifetimes", 822 | "libc", 823 | "linux-raw-sys", 824 | "windows-sys 0.48.0", 825 | ] 826 | 827 | [[package]] 828 | name = "ryu" 829 | version = "1.0.13" 830 | source = "registry+https://github.com/rust-lang/crates.io-index" 831 | checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" 832 | 833 | [[package]] 834 | name = "schannel" 835 | version = "0.1.21" 836 | source = "registry+https://github.com/rust-lang/crates.io-index" 837 | checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" 838 | dependencies = [ 839 | "windows-sys 0.42.0", 840 | ] 841 | 842 | [[package]] 843 | name = "scopeguard" 844 | version = "1.1.0" 845 | source = "registry+https://github.com/rust-lang/crates.io-index" 846 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 847 | 848 | [[package]] 849 | name = "security-framework" 850 | version = "2.8.2" 851 | source = "registry+https://github.com/rust-lang/crates.io-index" 852 | checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" 853 | dependencies = [ 854 | "bitflags", 855 | "core-foundation", 856 | "core-foundation-sys", 857 | "libc", 858 | "security-framework-sys", 859 | ] 860 | 861 | [[package]] 862 | name = "security-framework-sys" 863 | version = "2.8.0" 864 | source = "registry+https://github.com/rust-lang/crates.io-index" 865 | checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" 866 | dependencies = [ 867 | "core-foundation-sys", 868 | "libc", 869 | ] 870 | 871 | [[package]] 872 | name = "serde" 873 | version = "1.0.163" 874 | source = "registry+https://github.com/rust-lang/crates.io-index" 875 | checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" 876 | dependencies = [ 877 | "serde_derive", 878 | ] 879 | 880 | [[package]] 881 | name = "serde_derive" 882 | version = "1.0.163" 883 | source = "registry+https://github.com/rust-lang/crates.io-index" 884 | checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" 885 | dependencies = [ 886 | "proc-macro2", 887 | "quote", 888 | "syn", 889 | ] 890 | 891 | [[package]] 892 | name = "serde_json" 893 | version = "1.0.96" 894 | source = "registry+https://github.com/rust-lang/crates.io-index" 895 | checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" 896 | dependencies = [ 897 | "itoa", 898 | "ryu", 899 | "serde", 900 | ] 901 | 902 | [[package]] 903 | name = "serde_urlencoded" 904 | version = "0.7.1" 905 | source = "registry+https://github.com/rust-lang/crates.io-index" 906 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 907 | dependencies = [ 908 | "form_urlencoded", 909 | "itoa", 910 | "ryu", 911 | "serde", 912 | ] 913 | 914 | [[package]] 915 | name = "signal-hook-registry" 916 | version = "1.4.1" 917 | source = "registry+https://github.com/rust-lang/crates.io-index" 918 | checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" 919 | dependencies = [ 920 | "libc", 921 | ] 922 | 923 | [[package]] 924 | name = "slab" 925 | version = "0.4.8" 926 | source = "registry+https://github.com/rust-lang/crates.io-index" 927 | checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" 928 | dependencies = [ 929 | "autocfg", 930 | ] 931 | 932 | [[package]] 933 | name = "smallvec" 934 | version = "1.10.0" 935 | source = "registry+https://github.com/rust-lang/crates.io-index" 936 | checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" 937 | 938 | [[package]] 939 | name = "socket2" 940 | version = "0.4.9" 941 | source = "registry+https://github.com/rust-lang/crates.io-index" 942 | checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" 943 | dependencies = [ 944 | "libc", 945 | "winapi", 946 | ] 947 | 948 | [[package]] 949 | name = "syn" 950 | version = "2.0.15" 951 | source = "registry+https://github.com/rust-lang/crates.io-index" 952 | checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" 953 | dependencies = [ 954 | "proc-macro2", 955 | "quote", 956 | "unicode-ident", 957 | ] 958 | 959 | [[package]] 960 | name = "tempfile" 961 | version = "3.5.0" 962 | source = "registry+https://github.com/rust-lang/crates.io-index" 963 | checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" 964 | dependencies = [ 965 | "cfg-if", 966 | "fastrand", 967 | "redox_syscall 0.3.5", 968 | "rustix", 969 | "windows-sys 0.45.0", 970 | ] 971 | 972 | [[package]] 973 | name = "thiserror" 974 | version = "1.0.40" 975 | source = "registry+https://github.com/rust-lang/crates.io-index" 976 | checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" 977 | dependencies = [ 978 | "thiserror-impl", 979 | ] 980 | 981 | [[package]] 982 | name = "thiserror-impl" 983 | version = "1.0.40" 984 | source = "registry+https://github.com/rust-lang/crates.io-index" 985 | checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" 986 | dependencies = [ 987 | "proc-macro2", 988 | "quote", 989 | "syn", 990 | ] 991 | 992 | [[package]] 993 | name = "time" 994 | version = "0.3.21" 995 | source = "registry+https://github.com/rust-lang/crates.io-index" 996 | checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" 997 | dependencies = [ 998 | "itoa", 999 | "serde", 1000 | "time-core", 1001 | "time-macros", 1002 | ] 1003 | 1004 | [[package]] 1005 | name = "time-core" 1006 | version = "0.1.1" 1007 | source = "registry+https://github.com/rust-lang/crates.io-index" 1008 | checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" 1009 | 1010 | [[package]] 1011 | name = "time-macros" 1012 | version = "0.2.9" 1013 | source = "registry+https://github.com/rust-lang/crates.io-index" 1014 | checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" 1015 | dependencies = [ 1016 | "time-core", 1017 | ] 1018 | 1019 | [[package]] 1020 | name = "tinyvec" 1021 | version = "1.6.0" 1022 | source = "registry+https://github.com/rust-lang/crates.io-index" 1023 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 1024 | dependencies = [ 1025 | "tinyvec_macros", 1026 | ] 1027 | 1028 | [[package]] 1029 | name = "tinyvec_macros" 1030 | version = "0.1.1" 1031 | source = "registry+https://github.com/rust-lang/crates.io-index" 1032 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 1033 | 1034 | [[package]] 1035 | name = "tokio" 1036 | version = "1.28.1" 1037 | source = "registry+https://github.com/rust-lang/crates.io-index" 1038 | checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105" 1039 | dependencies = [ 1040 | "autocfg", 1041 | "bytes", 1042 | "libc", 1043 | "mio", 1044 | "num_cpus", 1045 | "parking_lot", 1046 | "pin-project-lite", 1047 | "signal-hook-registry", 1048 | "socket2", 1049 | "tokio-macros", 1050 | "windows-sys 0.48.0", 1051 | ] 1052 | 1053 | [[package]] 1054 | name = "tokio-macros" 1055 | version = "2.1.0" 1056 | source = "registry+https://github.com/rust-lang/crates.io-index" 1057 | checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" 1058 | dependencies = [ 1059 | "proc-macro2", 1060 | "quote", 1061 | "syn", 1062 | ] 1063 | 1064 | [[package]] 1065 | name = "tokio-native-tls" 1066 | version = "0.3.1" 1067 | source = "registry+https://github.com/rust-lang/crates.io-index" 1068 | checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" 1069 | dependencies = [ 1070 | "native-tls", 1071 | "tokio", 1072 | ] 1073 | 1074 | [[package]] 1075 | name = "tokio-util" 1076 | version = "0.7.8" 1077 | source = "registry+https://github.com/rust-lang/crates.io-index" 1078 | checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" 1079 | dependencies = [ 1080 | "bytes", 1081 | "futures-core", 1082 | "futures-sink", 1083 | "pin-project-lite", 1084 | "tokio", 1085 | "tracing", 1086 | ] 1087 | 1088 | [[package]] 1089 | name = "toml" 1090 | version = "0.5.11" 1091 | source = "registry+https://github.com/rust-lang/crates.io-index" 1092 | checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" 1093 | dependencies = [ 1094 | "serde", 1095 | ] 1096 | 1097 | [[package]] 1098 | name = "tower-service" 1099 | version = "0.3.2" 1100 | source = "registry+https://github.com/rust-lang/crates.io-index" 1101 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" 1102 | 1103 | [[package]] 1104 | name = "tracing" 1105 | version = "0.1.37" 1106 | source = "registry+https://github.com/rust-lang/crates.io-index" 1107 | checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" 1108 | dependencies = [ 1109 | "cfg-if", 1110 | "pin-project-lite", 1111 | "tracing-core", 1112 | ] 1113 | 1114 | [[package]] 1115 | name = "tracing-core" 1116 | version = "0.1.30" 1117 | source = "registry+https://github.com/rust-lang/crates.io-index" 1118 | checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" 1119 | dependencies = [ 1120 | "once_cell", 1121 | ] 1122 | 1123 | [[package]] 1124 | name = "try-lock" 1125 | version = "0.2.4" 1126 | source = "registry+https://github.com/rust-lang/crates.io-index" 1127 | checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" 1128 | 1129 | [[package]] 1130 | name = "unicode-bidi" 1131 | version = "0.3.13" 1132 | source = "registry+https://github.com/rust-lang/crates.io-index" 1133 | checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" 1134 | 1135 | [[package]] 1136 | name = "unicode-ident" 1137 | version = "1.0.8" 1138 | source = "registry+https://github.com/rust-lang/crates.io-index" 1139 | checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" 1140 | 1141 | [[package]] 1142 | name = "unicode-normalization" 1143 | version = "0.1.22" 1144 | source = "registry+https://github.com/rust-lang/crates.io-index" 1145 | checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" 1146 | dependencies = [ 1147 | "tinyvec", 1148 | ] 1149 | 1150 | [[package]] 1151 | name = "url" 1152 | version = "2.3.1" 1153 | source = "registry+https://github.com/rust-lang/crates.io-index" 1154 | checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" 1155 | dependencies = [ 1156 | "form_urlencoded", 1157 | "idna", 1158 | "percent-encoding", 1159 | ] 1160 | 1161 | [[package]] 1162 | name = "vcpkg" 1163 | version = "0.2.15" 1164 | source = "registry+https://github.com/rust-lang/crates.io-index" 1165 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 1166 | 1167 | [[package]] 1168 | name = "want" 1169 | version = "0.3.0" 1170 | source = "registry+https://github.com/rust-lang/crates.io-index" 1171 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 1172 | dependencies = [ 1173 | "log", 1174 | "try-lock", 1175 | ] 1176 | 1177 | [[package]] 1178 | name = "wasi" 1179 | version = "0.11.0+wasi-snapshot-preview1" 1180 | source = "registry+https://github.com/rust-lang/crates.io-index" 1181 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1182 | 1183 | [[package]] 1184 | name = "wasm-bindgen" 1185 | version = "0.2.85" 1186 | source = "registry+https://github.com/rust-lang/crates.io-index" 1187 | checksum = "5b6cb788c4e39112fbe1822277ef6fb3c55cd86b95cb3d3c4c1c9597e4ac74b4" 1188 | dependencies = [ 1189 | "cfg-if", 1190 | "wasm-bindgen-macro", 1191 | ] 1192 | 1193 | [[package]] 1194 | name = "wasm-bindgen-backend" 1195 | version = "0.2.85" 1196 | source = "registry+https://github.com/rust-lang/crates.io-index" 1197 | checksum = "35e522ed4105a9d626d885b35d62501b30d9666283a5c8be12c14a8bdafe7822" 1198 | dependencies = [ 1199 | "bumpalo", 1200 | "log", 1201 | "once_cell", 1202 | "proc-macro2", 1203 | "quote", 1204 | "syn", 1205 | "wasm-bindgen-shared", 1206 | ] 1207 | 1208 | [[package]] 1209 | name = "wasm-bindgen-futures" 1210 | version = "0.4.35" 1211 | source = "registry+https://github.com/rust-lang/crates.io-index" 1212 | checksum = "083abe15c5d88556b77bdf7aef403625be9e327ad37c62c4e4129af740168163" 1213 | dependencies = [ 1214 | "cfg-if", 1215 | "js-sys", 1216 | "wasm-bindgen", 1217 | "web-sys", 1218 | ] 1219 | 1220 | [[package]] 1221 | name = "wasm-bindgen-macro" 1222 | version = "0.2.85" 1223 | source = "registry+https://github.com/rust-lang/crates.io-index" 1224 | checksum = "358a79a0cb89d21db8120cbfb91392335913e4890665b1a7981d9e956903b434" 1225 | dependencies = [ 1226 | "quote", 1227 | "wasm-bindgen-macro-support", 1228 | ] 1229 | 1230 | [[package]] 1231 | name = "wasm-bindgen-macro-support" 1232 | version = "0.2.85" 1233 | source = "registry+https://github.com/rust-lang/crates.io-index" 1234 | checksum = "4783ce29f09b9d93134d41297aded3a712b7b979e9c6f28c32cb88c973a94869" 1235 | dependencies = [ 1236 | "proc-macro2", 1237 | "quote", 1238 | "syn", 1239 | "wasm-bindgen-backend", 1240 | "wasm-bindgen-shared", 1241 | ] 1242 | 1243 | [[package]] 1244 | name = "wasm-bindgen-shared" 1245 | version = "0.2.85" 1246 | source = "registry+https://github.com/rust-lang/crates.io-index" 1247 | checksum = "a901d592cafaa4d711bc324edfaff879ac700b19c3dfd60058d2b445be2691eb" 1248 | 1249 | [[package]] 1250 | name = "web-sys" 1251 | version = "0.3.62" 1252 | source = "registry+https://github.com/rust-lang/crates.io-index" 1253 | checksum = "16b5f940c7edfdc6d12126d98c9ef4d1b3d470011c47c76a6581df47ad9ba721" 1254 | dependencies = [ 1255 | "js-sys", 1256 | "wasm-bindgen", 1257 | ] 1258 | 1259 | [[package]] 1260 | name = "winapi" 1261 | version = "0.3.9" 1262 | source = "registry+https://github.com/rust-lang/crates.io-index" 1263 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1264 | dependencies = [ 1265 | "winapi-i686-pc-windows-gnu", 1266 | "winapi-x86_64-pc-windows-gnu", 1267 | ] 1268 | 1269 | [[package]] 1270 | name = "winapi-i686-pc-windows-gnu" 1271 | version = "0.4.0" 1272 | source = "registry+https://github.com/rust-lang/crates.io-index" 1273 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1274 | 1275 | [[package]] 1276 | name = "winapi-x86_64-pc-windows-gnu" 1277 | version = "0.4.0" 1278 | source = "registry+https://github.com/rust-lang/crates.io-index" 1279 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1280 | 1281 | [[package]] 1282 | name = "windows-sys" 1283 | version = "0.42.0" 1284 | source = "registry+https://github.com/rust-lang/crates.io-index" 1285 | checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" 1286 | dependencies = [ 1287 | "windows_aarch64_gnullvm 0.42.2", 1288 | "windows_aarch64_msvc 0.42.2", 1289 | "windows_i686_gnu 0.42.2", 1290 | "windows_i686_msvc 0.42.2", 1291 | "windows_x86_64_gnu 0.42.2", 1292 | "windows_x86_64_gnullvm 0.42.2", 1293 | "windows_x86_64_msvc 0.42.2", 1294 | ] 1295 | 1296 | [[package]] 1297 | name = "windows-sys" 1298 | version = "0.45.0" 1299 | source = "registry+https://github.com/rust-lang/crates.io-index" 1300 | checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" 1301 | dependencies = [ 1302 | "windows-targets 0.42.2", 1303 | ] 1304 | 1305 | [[package]] 1306 | name = "windows-sys" 1307 | version = "0.48.0" 1308 | source = "registry+https://github.com/rust-lang/crates.io-index" 1309 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1310 | dependencies = [ 1311 | "windows-targets 0.48.0", 1312 | ] 1313 | 1314 | [[package]] 1315 | name = "windows-targets" 1316 | version = "0.42.2" 1317 | source = "registry+https://github.com/rust-lang/crates.io-index" 1318 | checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" 1319 | dependencies = [ 1320 | "windows_aarch64_gnullvm 0.42.2", 1321 | "windows_aarch64_msvc 0.42.2", 1322 | "windows_i686_gnu 0.42.2", 1323 | "windows_i686_msvc 0.42.2", 1324 | "windows_x86_64_gnu 0.42.2", 1325 | "windows_x86_64_gnullvm 0.42.2", 1326 | "windows_x86_64_msvc 0.42.2", 1327 | ] 1328 | 1329 | [[package]] 1330 | name = "windows-targets" 1331 | version = "0.48.0" 1332 | source = "registry+https://github.com/rust-lang/crates.io-index" 1333 | checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" 1334 | dependencies = [ 1335 | "windows_aarch64_gnullvm 0.48.0", 1336 | "windows_aarch64_msvc 0.48.0", 1337 | "windows_i686_gnu 0.48.0", 1338 | "windows_i686_msvc 0.48.0", 1339 | "windows_x86_64_gnu 0.48.0", 1340 | "windows_x86_64_gnullvm 0.48.0", 1341 | "windows_x86_64_msvc 0.48.0", 1342 | ] 1343 | 1344 | [[package]] 1345 | name = "windows_aarch64_gnullvm" 1346 | version = "0.42.2" 1347 | source = "registry+https://github.com/rust-lang/crates.io-index" 1348 | checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" 1349 | 1350 | [[package]] 1351 | name = "windows_aarch64_gnullvm" 1352 | version = "0.48.0" 1353 | source = "registry+https://github.com/rust-lang/crates.io-index" 1354 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" 1355 | 1356 | [[package]] 1357 | name = "windows_aarch64_msvc" 1358 | version = "0.42.2" 1359 | source = "registry+https://github.com/rust-lang/crates.io-index" 1360 | checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" 1361 | 1362 | [[package]] 1363 | name = "windows_aarch64_msvc" 1364 | version = "0.48.0" 1365 | source = "registry+https://github.com/rust-lang/crates.io-index" 1366 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" 1367 | 1368 | [[package]] 1369 | name = "windows_i686_gnu" 1370 | version = "0.42.2" 1371 | source = "registry+https://github.com/rust-lang/crates.io-index" 1372 | checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" 1373 | 1374 | [[package]] 1375 | name = "windows_i686_gnu" 1376 | version = "0.48.0" 1377 | source = "registry+https://github.com/rust-lang/crates.io-index" 1378 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" 1379 | 1380 | [[package]] 1381 | name = "windows_i686_msvc" 1382 | version = "0.42.2" 1383 | source = "registry+https://github.com/rust-lang/crates.io-index" 1384 | checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" 1385 | 1386 | [[package]] 1387 | name = "windows_i686_msvc" 1388 | version = "0.48.0" 1389 | source = "registry+https://github.com/rust-lang/crates.io-index" 1390 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" 1391 | 1392 | [[package]] 1393 | name = "windows_x86_64_gnu" 1394 | version = "0.42.2" 1395 | source = "registry+https://github.com/rust-lang/crates.io-index" 1396 | checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" 1397 | 1398 | [[package]] 1399 | name = "windows_x86_64_gnu" 1400 | version = "0.48.0" 1401 | source = "registry+https://github.com/rust-lang/crates.io-index" 1402 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" 1403 | 1404 | [[package]] 1405 | name = "windows_x86_64_gnullvm" 1406 | version = "0.42.2" 1407 | source = "registry+https://github.com/rust-lang/crates.io-index" 1408 | checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" 1409 | 1410 | [[package]] 1411 | name = "windows_x86_64_gnullvm" 1412 | version = "0.48.0" 1413 | source = "registry+https://github.com/rust-lang/crates.io-index" 1414 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" 1415 | 1416 | [[package]] 1417 | name = "windows_x86_64_msvc" 1418 | version = "0.42.2" 1419 | source = "registry+https://github.com/rust-lang/crates.io-index" 1420 | checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" 1421 | 1422 | [[package]] 1423 | name = "windows_x86_64_msvc" 1424 | version = "0.48.0" 1425 | source = "registry+https://github.com/rust-lang/crates.io-index" 1426 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" 1427 | 1428 | [[package]] 1429 | name = "winreg" 1430 | version = "0.10.1" 1431 | source = "registry+https://github.com/rust-lang/crates.io-index" 1432 | checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" 1433 | dependencies = [ 1434 | "winapi", 1435 | ] 1436 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "readwise-epub" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | config = { version = "0.13.3", default-features = false, features = ["toml"] } 8 | dirs = "5.0.1" 9 | itertools = "0.10.5" 10 | reqwest = { version = "0.11.17", features = ["gzip", "brotli", "deflate"] } 11 | serde = { version = "1.0.163", features = ["derive"] } 12 | serde_json = "1.0.96" 13 | time = { version = "0.3.21", features = ["serde", "parsing", "formatting"] } 14 | tokio = { version = "1.28.1", features = ["full"] } 15 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any 2 | person obtaining a copy of this software and associated 3 | documentation files (the "Software"), to deal in the 4 | Software without restriction, including without 5 | limitation the rights to use, copy, modify, merge, 6 | publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software 8 | is furnished to do so, subject to the following 9 | conditions: 10 | 11 | The above copyright notice and this permission notice 12 | shall be included in all copies or substantial portions 13 | of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 16 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 17 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 18 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 19 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 22 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Readwise-Epub 2 | 3 | This project packages up your Readwise Reader inbox into nicely grouped epubs. I 4 | use it with a Kobo reader, but you should be able to use any device that can 5 | open epub files. 6 | 7 | ## Installing / Prerequisites 8 | 9 | Install [Rust](https://rustup.rs/) and 10 | [Percollate](https://github.com/danburzo/percollate). These are both left as an 11 | exercise to the reader. 12 | 13 | Install this project by running `cargo install --path .` in the root directory. 14 | 15 | Set your Readwise auth token by setting the environment variable 16 | `READWISE_EPUB_READER_TOKEN` or writing it to a file in your [config 17 | dir](https://docs.rs/dirs/latest/dirs/fn.config_dir.html) 18 | `/readwise-epub/config.toml` under the key `reader_token`. 19 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | //! # Notes 2 | //! 3 | //! This could potentially be a very simple html-to-epub tool instead of using 4 | //! `percollate` if Readwise added an API to fetch their cleaned html. (Todo: 5 | //! request that.) 6 | //! 7 | //! I tried directly integrating https://github.com/hipstermojo/paperoni (built 8 | //! on https://github.com/lise-henry/epub-builder), but it emitted epub files 9 | //! that were fairly spec-noncompliant. Code review did not give me much 10 | //! confidence that it could be brought up to spec without a significant amount 11 | //! of work. 12 | //! 13 | //! See the official EPUBCheck tool: https://www.w3.org/publishing/epubcheck/ 14 | //! 15 | //! # Todo 16 | //! 17 | //! - Cache redirects 18 | //! - Download articles as individual epubs (cache them) and then merge 19 | //! - Make this reasonable to run nightly 20 | //! - Attach this to something like [Koblime](https://kobli.me/) to sync each 21 | //! day's new articles directly to device. 22 | //! - Group short reads together, separate long reads to individual epubs 23 | //! - Create/update readwise tags for grouped articles ('epub-yyyy-mm-dd') 24 | //! - Create title pages using local templates 25 | //! 26 | 27 | use itertools::Itertools; 28 | use reqwest::{header, Method}; 29 | use serde::{Deserialize, Serialize}; 30 | use std::{path::PathBuf, process::Stdio, time::Duration}; 31 | use time::OffsetDateTime; 32 | use tokio::{fs::File, io::AsyncWriteExt}; 33 | 34 | #[derive(Debug, Deserialize, Serialize)] 35 | struct ListResults { 36 | count: u64, 37 | #[serde(rename = "nextPageCursor")] 38 | next_page_cursor: Option, 39 | results: Vec, 40 | } 41 | 42 | #[derive(Debug, Deserialize, Serialize)] 43 | struct Item { 44 | title: Option, 45 | author: Option, 46 | site_name: Option, 47 | source_url: String, 48 | image_url: Option, 49 | summary: Option, 50 | content: Option, 51 | #[serde(deserialize_with = "null_to_default")] 52 | word_count: u32, 53 | #[serde(with = "time::serde::rfc3339")] 54 | created_at: OffsetDateTime, 55 | #[serde(with = "time::serde::rfc3339")] 56 | updated_at: OffsetDateTime, 57 | // these always seem to be null 58 | // #[serde(deserialize_with = "null_to_default_time")] 59 | // published_date: Option, 60 | // #[serde(default)] 61 | // tags: Option>, 62 | } 63 | 64 | fn null_to_default<'de, D, T>(deserializer: D) -> Result 65 | where 66 | T: Default + Deserialize<'de>, 67 | D: serde::Deserializer<'de>, 68 | { 69 | let opt = Option::deserialize(deserializer)?; 70 | Ok(opt.unwrap_or_default()) 71 | } 72 | 73 | #[derive(Debug, Deserialize)] 74 | struct Config { 75 | reader_token: String, 76 | } 77 | 78 | #[tokio::main] 79 | async fn main() { 80 | let config_file = dirs::config_dir() 81 | .unwrap() 82 | .join("readwise-epub/config.toml"); 83 | let config = config::Config::builder() 84 | .add_source(config::Environment::with_prefix("READWISE_EPUB").separator("_")) 85 | .add_source(config::File::from(config_file.as_ref()).required(false)) 86 | .build() 87 | .unwrap() 88 | .try_deserialize::() 89 | .unwrap(); 90 | 91 | let client = reqwest::Client::new(); 92 | let mut cursor = None; 93 | let mut acc = vec![]; 94 | 95 | // fetch all articles in readwise inbox 96 | loop { 97 | let uri = if let Some(cursor) = cursor { 98 | format!("https://readwise.io/api/v3/list/?location=new&pageCursor={cursor}") 99 | } else { 100 | String::from("https://readwise.io/api/v3/list/?location=new") 101 | }; 102 | 103 | let res = client 104 | .request(Method::GET, uri) 105 | .header( 106 | header::AUTHORIZATION, 107 | format!("Token {}", config.reader_token), 108 | ) 109 | .header(header::CONTENT_TYPE, "application/json") 110 | .send() 111 | .await 112 | .unwrap(); 113 | 114 | let mut res: ListResults = serde_json::from_slice(&res.bytes().await.unwrap()).unwrap(); 115 | 116 | cursor = res.next_page_cursor; 117 | acc.append(&mut res.results); 118 | 119 | if cursor.is_none() { 120 | break; 121 | } 122 | 123 | // don't exceed API rate limit 124 | tokio::time::sleep(Duration::from_millis(60000 / 20)).await; 125 | } 126 | 127 | let output = serde_json::to_string_pretty(&acc).unwrap(); 128 | let mut file = File::create("all_uris.json").await.unwrap(); 129 | file.write_all(output.as_bytes()).await.unwrap(); 130 | 131 | // todo: download PDFs separately 132 | 133 | acc.sort_by_key(|i| i.updated_at); 134 | 135 | // filter out emails 136 | // todo: request a way to get this content from readwise / fetch from private APIs 137 | let mut filtered = acc 138 | .into_iter() 139 | .filter(|val| !val.source_url.starts_with("mailto:")) 140 | .collect::>(); 141 | 142 | // follow redirects 143 | let client = reqwest::Client::new(); 144 | for mut val in &mut filtered { 145 | let Ok(resp) = client.head(&val.source_url).send().await else { 146 | println!("Failed to HEAD {}", val.source_url); 147 | continue; 148 | }; 149 | let resp_url = resp.url().to_string(); 150 | if val.source_url != resp_url { 151 | println!("Redirected from {} to {}", val.source_url, resp_url); 152 | val.source_url = resp.url().to_string(); 153 | } 154 | } 155 | 156 | // group articles by author and site 157 | let author_and_site = filtered 158 | .into_iter() 159 | .group_by(|i| (i.author.clone(), i.site_name.clone())); 160 | 161 | // retain groups of more than one article for the same author and site 162 | let mut groups = vec![]; 163 | let mut remainder = vec![]; 164 | for ((author, site), group) in &author_and_site { 165 | let mut group = group.collect::>(); 166 | if (author.is_some() || site.is_some()) && group.len() > 1 { 167 | let name = match (author, site) { 168 | (Some(author), Some(site)) => format!("{author} - {site}"), 169 | (Some(author), None) => author.clone(), 170 | (None, Some(site)) => site.clone(), 171 | (None, None) => unreachable!(), 172 | }; 173 | 174 | groups.push((name, group)); 175 | } else { 176 | remainder.append(&mut group); 177 | } 178 | } 179 | 180 | // group remaining articles into approx 1 hour chunks of reading 181 | let mut remainder = remainder 182 | .into_iter() 183 | .fold((0, vec![vec![]]), |(word_count, mut groups), item| { 184 | // todo: request reading time from Readwise in the API 185 | let wc = item.word_count; 186 | 187 | // group into approx. 1 hour chunks 188 | if word_count < 8000 { 189 | groups.last_mut().unwrap().push(item); 190 | (word_count + wc, groups) 191 | } else { 192 | groups.push(vec![item]); 193 | (wc, groups) 194 | } 195 | }) 196 | .1 197 | .into_iter() 198 | .map(|group| (group.first().unwrap().updated_at.date().to_string(), group)) 199 | .collect(); 200 | 201 | groups.append(&mut remainder); 202 | 203 | let _ = tokio::fs::create_dir_all("epubs").await; 204 | let basepath = PathBuf::from("epubs"); 205 | 206 | println!("Creating {} groups of articles", groups.len()); 207 | for (name, group) in groups { 208 | let mut num = 1; 209 | let mut filename = format!("readwise-{}.epub", name); 210 | let mut title = name.to_string(); 211 | while let Ok(true) = tokio::fs::try_exists(&basepath.join(&filename)).await { 212 | num += 1; 213 | filename = format!("readwise-{name}-{num}.epub",); 214 | title = format!("{name} Pt. {}", num); 215 | } 216 | println!("Creating {} from {} articles", filename, group.len()); 217 | tokio::process::Command::new("percollate.cmd") 218 | .arg("epub") 219 | .arg("--output") 220 | .arg(filename) 221 | .arg("--title") 222 | .arg(title) 223 | .arg("--author") 224 | .arg("readwise") 225 | .args(group.into_iter().map(|i| i.source_url).collect::>()) 226 | .current_dir("epubs") 227 | .stdout(Stdio::inherit()) 228 | .stderr(Stdio::inherit()) 229 | .stdin(Stdio::null()) 230 | .output() 231 | .await 232 | .unwrap(); 233 | } 234 | } 235 | --------------------------------------------------------------------------------