├── .gitignore ├── .gitlab-ci.yml ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── Rocket.toml ├── example └── bookmarks.example.toml └── src ├── books ├── config.rs ├── library.rs └── mod.rs ├── command.rs ├── encoder.rs └── main.rs /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/* 2 | /target 3 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | image: 'rust:latest' 2 | 3 | before_script: 4 | - rustup default nightly 5 | - rustc --version && cargo --version # Print version info for debugging 6 | - rustup component add clippy 7 | 8 | test: 9 | script: 10 | - cargo test --workspace --verbose 11 | 12 | lint: 13 | script: 14 | - cargo clippy -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | [[package]] 4 | name = "aead" 5 | version = "0.2.0" 6 | source = "registry+https://github.com/rust-lang/crates.io-index" 7 | checksum = "4cf01b9b56e767bb57b94ebf91a58b338002963785cdd7013e21c0d4679471e4" 8 | dependencies = [ 9 | "generic-array", 10 | ] 11 | 12 | [[package]] 13 | name = "aes" 14 | version = "0.3.2" 15 | source = "registry+https://github.com/rust-lang/crates.io-index" 16 | checksum = "54eb1d8fe354e5fc611daf4f2ea97dd45a765f4f1e4512306ec183ae2e8f20c9" 17 | dependencies = [ 18 | "aes-soft", 19 | "aesni", 20 | "block-cipher-trait", 21 | ] 22 | 23 | [[package]] 24 | name = "aes-gcm" 25 | version = "0.5.0" 26 | source = "registry+https://github.com/rust-lang/crates.io-index" 27 | checksum = "834a6bda386024dbb7c8fc51322856c10ffe69559f972261c868485f5759c638" 28 | dependencies = [ 29 | "aead", 30 | "aes", 31 | "block-cipher-trait", 32 | "ghash", 33 | "subtle 2.2.3", 34 | "zeroize", 35 | ] 36 | 37 | [[package]] 38 | name = "aes-soft" 39 | version = "0.3.3" 40 | source = "registry+https://github.com/rust-lang/crates.io-index" 41 | checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" 42 | dependencies = [ 43 | "block-cipher-trait", 44 | "byteorder", 45 | "opaque-debug", 46 | ] 47 | 48 | [[package]] 49 | name = "aesni" 50 | version = "0.6.0" 51 | source = "registry+https://github.com/rust-lang/crates.io-index" 52 | checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" 53 | dependencies = [ 54 | "block-cipher-trait", 55 | "opaque-debug", 56 | ] 57 | 58 | [[package]] 59 | name = "arrayref" 60 | version = "0.3.6" 61 | source = "registry+https://github.com/rust-lang/crates.io-index" 62 | checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" 63 | 64 | [[package]] 65 | name = "arrayvec" 66 | version = "0.5.1" 67 | source = "registry+https://github.com/rust-lang/crates.io-index" 68 | checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" 69 | 70 | [[package]] 71 | name = "atty" 72 | version = "0.2.14" 73 | source = "registry+https://github.com/rust-lang/crates.io-index" 74 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 75 | dependencies = [ 76 | "hermit-abi", 77 | "libc", 78 | "winapi", 79 | ] 80 | 81 | [[package]] 82 | name = "autocfg" 83 | version = "1.0.0" 84 | source = "registry+https://github.com/rust-lang/crates.io-index" 85 | checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" 86 | 87 | [[package]] 88 | name = "base64" 89 | version = "0.9.3" 90 | source = "registry+https://github.com/rust-lang/crates.io-index" 91 | checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" 92 | dependencies = [ 93 | "byteorder", 94 | "safemem", 95 | ] 96 | 97 | [[package]] 98 | name = "base64" 99 | version = "0.11.0" 100 | source = "registry+https://github.com/rust-lang/crates.io-index" 101 | checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" 102 | 103 | [[package]] 104 | name = "base64" 105 | version = "0.12.3" 106 | source = "registry+https://github.com/rust-lang/crates.io-index" 107 | checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" 108 | 109 | [[package]] 110 | name = "bitflags" 111 | version = "1.2.1" 112 | source = "registry+https://github.com/rust-lang/crates.io-index" 113 | checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" 114 | 115 | [[package]] 116 | name = "blake2b_simd" 117 | version = "0.5.10" 118 | source = "registry+https://github.com/rust-lang/crates.io-index" 119 | checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" 120 | dependencies = [ 121 | "arrayref", 122 | "arrayvec", 123 | "constant_time_eq", 124 | ] 125 | 126 | [[package]] 127 | name = "block-buffer" 128 | version = "0.7.3" 129 | source = "registry+https://github.com/rust-lang/crates.io-index" 130 | checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" 131 | dependencies = [ 132 | "block-padding", 133 | "byte-tools", 134 | "byteorder", 135 | "generic-array", 136 | ] 137 | 138 | [[package]] 139 | name = "block-cipher-trait" 140 | version = "0.6.2" 141 | source = "registry+https://github.com/rust-lang/crates.io-index" 142 | checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" 143 | dependencies = [ 144 | "generic-array", 145 | ] 146 | 147 | [[package]] 148 | name = "block-padding" 149 | version = "0.1.5" 150 | source = "registry+https://github.com/rust-lang/crates.io-index" 151 | checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" 152 | dependencies = [ 153 | "byte-tools", 154 | ] 155 | 156 | [[package]] 157 | name = "bun" 158 | version = "0.1.0" 159 | dependencies = [ 160 | "dirs", 161 | "key-list", 162 | "percent-encoding 2.1.0", 163 | "rocket", 164 | "serde", 165 | "toml 0.5.6", 166 | ] 167 | 168 | [[package]] 169 | name = "byte-tools" 170 | version = "0.3.1" 171 | source = "registry+https://github.com/rust-lang/crates.io-index" 172 | checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" 173 | 174 | [[package]] 175 | name = "byteorder" 176 | version = "1.3.4" 177 | source = "registry+https://github.com/rust-lang/crates.io-index" 178 | checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" 179 | 180 | [[package]] 181 | name = "cfg-if" 182 | version = "0.1.10" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 185 | 186 | [[package]] 187 | name = "constant_time_eq" 188 | version = "0.1.5" 189 | source = "registry+https://github.com/rust-lang/crates.io-index" 190 | checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" 191 | 192 | [[package]] 193 | name = "cookie" 194 | version = "0.11.3" 195 | source = "registry+https://github.com/rust-lang/crates.io-index" 196 | checksum = "5795cda0897252e34380a27baf884c53aa7ad9990329cdad96d4c5d027015d44" 197 | dependencies = [ 198 | "aes-gcm", 199 | "base64 0.12.3", 200 | "hkdf", 201 | "hmac", 202 | "percent-encoding 2.1.0", 203 | "rand", 204 | "sha2", 205 | "time", 206 | ] 207 | 208 | [[package]] 209 | name = "crossbeam-utils" 210 | version = "0.7.2" 211 | source = "registry+https://github.com/rust-lang/crates.io-index" 212 | checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" 213 | dependencies = [ 214 | "autocfg", 215 | "cfg-if", 216 | "lazy_static", 217 | ] 218 | 219 | [[package]] 220 | name = "crypto-mac" 221 | version = "0.7.0" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" 224 | dependencies = [ 225 | "generic-array", 226 | "subtle 1.0.0", 227 | ] 228 | 229 | [[package]] 230 | name = "devise" 231 | version = "0.2.0" 232 | source = "registry+https://github.com/rust-lang/crates.io-index" 233 | checksum = "74e04ba2d03c5fa0d954c061fc8c9c288badadffc272ebb87679a89846de3ed3" 234 | dependencies = [ 235 | "devise_codegen", 236 | "devise_core", 237 | ] 238 | 239 | [[package]] 240 | name = "devise_codegen" 241 | version = "0.2.0" 242 | source = "registry+https://github.com/rust-lang/crates.io-index" 243 | checksum = "066ceb7928ca93a9bedc6d0e612a8a0424048b0ab1f75971b203d01420c055d7" 244 | dependencies = [ 245 | "devise_core", 246 | "quote 0.6.13", 247 | ] 248 | 249 | [[package]] 250 | name = "devise_core" 251 | version = "0.2.0" 252 | source = "registry+https://github.com/rust-lang/crates.io-index" 253 | checksum = "cf41c59b22b5e3ec0ea55c7847e5f358d340f3a8d6d53a5cf4f1564967f96487" 254 | dependencies = [ 255 | "bitflags", 256 | "proc-macro2 0.4.30", 257 | "quote 0.6.13", 258 | "syn 0.15.44", 259 | ] 260 | 261 | [[package]] 262 | name = "digest" 263 | version = "0.8.1" 264 | source = "registry+https://github.com/rust-lang/crates.io-index" 265 | checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" 266 | dependencies = [ 267 | "generic-array", 268 | ] 269 | 270 | [[package]] 271 | name = "dirs" 272 | version = "3.0.1" 273 | source = "registry+https://github.com/rust-lang/crates.io-index" 274 | checksum = "142995ed02755914747cc6ca76fc7e4583cd18578746716d0508ea6ed558b9ff" 275 | dependencies = [ 276 | "dirs-sys", 277 | ] 278 | 279 | [[package]] 280 | name = "dirs-sys" 281 | version = "0.3.5" 282 | source = "registry+https://github.com/rust-lang/crates.io-index" 283 | checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" 284 | dependencies = [ 285 | "libc", 286 | "redox_users", 287 | "winapi", 288 | ] 289 | 290 | [[package]] 291 | name = "fake-simd" 292 | version = "0.1.2" 293 | source = "registry+https://github.com/rust-lang/crates.io-index" 294 | checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" 295 | 296 | [[package]] 297 | name = "generic-array" 298 | version = "0.12.3" 299 | source = "registry+https://github.com/rust-lang/crates.io-index" 300 | checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" 301 | dependencies = [ 302 | "typenum", 303 | ] 304 | 305 | [[package]] 306 | name = "getrandom" 307 | version = "0.1.14" 308 | source = "registry+https://github.com/rust-lang/crates.io-index" 309 | checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" 310 | dependencies = [ 311 | "cfg-if", 312 | "libc", 313 | "wasi", 314 | ] 315 | 316 | [[package]] 317 | name = "ghash" 318 | version = "0.2.3" 319 | source = "registry+https://github.com/rust-lang/crates.io-index" 320 | checksum = "9f0930ed19a7184089ea46d2fedead2f6dc2b674c5db4276b7da336c7cd83252" 321 | dependencies = [ 322 | "polyval", 323 | ] 324 | 325 | [[package]] 326 | name = "glob" 327 | version = "0.3.0" 328 | source = "registry+https://github.com/rust-lang/crates.io-index" 329 | checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" 330 | 331 | [[package]] 332 | name = "hermit-abi" 333 | version = "0.1.14" 334 | source = "registry+https://github.com/rust-lang/crates.io-index" 335 | checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" 336 | dependencies = [ 337 | "libc", 338 | ] 339 | 340 | [[package]] 341 | name = "hkdf" 342 | version = "0.8.0" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | checksum = "3fa08a006102488bd9cd5b8013aabe84955cf5ae22e304c2caf655b633aefae3" 345 | dependencies = [ 346 | "digest", 347 | "hmac", 348 | ] 349 | 350 | [[package]] 351 | name = "hmac" 352 | version = "0.7.1" 353 | source = "registry+https://github.com/rust-lang/crates.io-index" 354 | checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" 355 | dependencies = [ 356 | "crypto-mac", 357 | "digest", 358 | ] 359 | 360 | [[package]] 361 | name = "httparse" 362 | version = "1.3.4" 363 | source = "registry+https://github.com/rust-lang/crates.io-index" 364 | checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" 365 | 366 | [[package]] 367 | name = "hyper" 368 | version = "0.10.16" 369 | source = "registry+https://github.com/rust-lang/crates.io-index" 370 | checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" 371 | dependencies = [ 372 | "base64 0.9.3", 373 | "httparse", 374 | "language-tags", 375 | "log 0.3.9", 376 | "mime", 377 | "num_cpus", 378 | "time", 379 | "traitobject", 380 | "typeable", 381 | "unicase", 382 | "url", 383 | ] 384 | 385 | [[package]] 386 | name = "idna" 387 | version = "0.1.5" 388 | source = "registry+https://github.com/rust-lang/crates.io-index" 389 | checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" 390 | dependencies = [ 391 | "matches", 392 | "unicode-bidi", 393 | "unicode-normalization", 394 | ] 395 | 396 | [[package]] 397 | name = "indexmap" 398 | version = "1.4.0" 399 | source = "registry+https://github.com/rust-lang/crates.io-index" 400 | checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe" 401 | dependencies = [ 402 | "autocfg", 403 | ] 404 | 405 | [[package]] 406 | name = "key-list" 407 | version = "1.0.0" 408 | source = "registry+https://github.com/rust-lang/crates.io-index" 409 | checksum = "9c0e10f1d9e18d3803d500a2c74cf6297c40ee8bf8b3061206180a68972f68ab" 410 | 411 | [[package]] 412 | name = "language-tags" 413 | version = "0.2.2" 414 | source = "registry+https://github.com/rust-lang/crates.io-index" 415 | checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" 416 | 417 | [[package]] 418 | name = "lazy_static" 419 | version = "1.4.0" 420 | source = "registry+https://github.com/rust-lang/crates.io-index" 421 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 422 | 423 | [[package]] 424 | name = "libc" 425 | version = "0.2.71" 426 | source = "registry+https://github.com/rust-lang/crates.io-index" 427 | checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" 428 | 429 | [[package]] 430 | name = "log" 431 | version = "0.3.9" 432 | source = "registry+https://github.com/rust-lang/crates.io-index" 433 | checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" 434 | dependencies = [ 435 | "log 0.4.8", 436 | ] 437 | 438 | [[package]] 439 | name = "log" 440 | version = "0.4.8" 441 | source = "registry+https://github.com/rust-lang/crates.io-index" 442 | checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" 443 | dependencies = [ 444 | "cfg-if", 445 | ] 446 | 447 | [[package]] 448 | name = "matches" 449 | version = "0.1.8" 450 | source = "registry+https://github.com/rust-lang/crates.io-index" 451 | checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" 452 | 453 | [[package]] 454 | name = "memchr" 455 | version = "2.3.3" 456 | source = "registry+https://github.com/rust-lang/crates.io-index" 457 | checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" 458 | 459 | [[package]] 460 | name = "mime" 461 | version = "0.2.6" 462 | source = "registry+https://github.com/rust-lang/crates.io-index" 463 | checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" 464 | dependencies = [ 465 | "log 0.3.9", 466 | ] 467 | 468 | [[package]] 469 | name = "num_cpus" 470 | version = "1.13.0" 471 | source = "registry+https://github.com/rust-lang/crates.io-index" 472 | checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" 473 | dependencies = [ 474 | "hermit-abi", 475 | "libc", 476 | ] 477 | 478 | [[package]] 479 | name = "opaque-debug" 480 | version = "0.2.3" 481 | source = "registry+https://github.com/rust-lang/crates.io-index" 482 | checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" 483 | 484 | [[package]] 485 | name = "pear" 486 | version = "0.1.4" 487 | source = "registry+https://github.com/rust-lang/crates.io-index" 488 | checksum = "5320f212db967792b67cfe12bd469d08afd6318a249bd917d5c19bc92200ab8a" 489 | dependencies = [ 490 | "pear_codegen", 491 | ] 492 | 493 | [[package]] 494 | name = "pear_codegen" 495 | version = "0.1.4" 496 | source = "registry+https://github.com/rust-lang/crates.io-index" 497 | checksum = "bfc1c836fdc3d1ef87c348b237b5b5c4dff922156fb2d968f57734f9669768ca" 498 | dependencies = [ 499 | "proc-macro2 0.4.30", 500 | "quote 0.6.13", 501 | "syn 0.15.44", 502 | "version_check 0.9.2", 503 | "yansi", 504 | ] 505 | 506 | [[package]] 507 | name = "percent-encoding" 508 | version = "1.0.1" 509 | source = "registry+https://github.com/rust-lang/crates.io-index" 510 | checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" 511 | 512 | [[package]] 513 | name = "percent-encoding" 514 | version = "2.1.0" 515 | source = "registry+https://github.com/rust-lang/crates.io-index" 516 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 517 | 518 | [[package]] 519 | name = "polyval" 520 | version = "0.3.3" 521 | source = "registry+https://github.com/rust-lang/crates.io-index" 522 | checksum = "7ec3341498978de3bfd12d1b22f1af1de22818f5473a11e8a6ef997989e3a212" 523 | dependencies = [ 524 | "cfg-if", 525 | "universal-hash", 526 | ] 527 | 528 | [[package]] 529 | name = "ppv-lite86" 530 | version = "0.2.8" 531 | source = "registry+https://github.com/rust-lang/crates.io-index" 532 | checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" 533 | 534 | [[package]] 535 | name = "proc-macro2" 536 | version = "0.4.30" 537 | source = "registry+https://github.com/rust-lang/crates.io-index" 538 | checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" 539 | dependencies = [ 540 | "unicode-xid 0.1.0", 541 | ] 542 | 543 | [[package]] 544 | name = "proc-macro2" 545 | version = "1.0.18" 546 | source = "registry+https://github.com/rust-lang/crates.io-index" 547 | checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" 548 | dependencies = [ 549 | "unicode-xid 0.2.1", 550 | ] 551 | 552 | [[package]] 553 | name = "quote" 554 | version = "0.6.13" 555 | source = "registry+https://github.com/rust-lang/crates.io-index" 556 | checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" 557 | dependencies = [ 558 | "proc-macro2 0.4.30", 559 | ] 560 | 561 | [[package]] 562 | name = "quote" 563 | version = "1.0.7" 564 | source = "registry+https://github.com/rust-lang/crates.io-index" 565 | checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" 566 | dependencies = [ 567 | "proc-macro2 1.0.18", 568 | ] 569 | 570 | [[package]] 571 | name = "rand" 572 | version = "0.7.3" 573 | source = "registry+https://github.com/rust-lang/crates.io-index" 574 | checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" 575 | dependencies = [ 576 | "getrandom", 577 | "libc", 578 | "rand_chacha", 579 | "rand_core", 580 | "rand_hc", 581 | ] 582 | 583 | [[package]] 584 | name = "rand_chacha" 585 | version = "0.2.2" 586 | source = "registry+https://github.com/rust-lang/crates.io-index" 587 | checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" 588 | dependencies = [ 589 | "ppv-lite86", 590 | "rand_core", 591 | ] 592 | 593 | [[package]] 594 | name = "rand_core" 595 | version = "0.5.1" 596 | source = "registry+https://github.com/rust-lang/crates.io-index" 597 | checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" 598 | dependencies = [ 599 | "getrandom", 600 | ] 601 | 602 | [[package]] 603 | name = "rand_hc" 604 | version = "0.2.0" 605 | source = "registry+https://github.com/rust-lang/crates.io-index" 606 | checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" 607 | dependencies = [ 608 | "rand_core", 609 | ] 610 | 611 | [[package]] 612 | name = "redox_syscall" 613 | version = "0.1.56" 614 | source = "registry+https://github.com/rust-lang/crates.io-index" 615 | checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" 616 | 617 | [[package]] 618 | name = "redox_users" 619 | version = "0.3.4" 620 | source = "registry+https://github.com/rust-lang/crates.io-index" 621 | checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431" 622 | dependencies = [ 623 | "getrandom", 624 | "redox_syscall", 625 | "rust-argon2", 626 | ] 627 | 628 | [[package]] 629 | name = "rocket" 630 | version = "0.4.5" 631 | source = "registry+https://github.com/rust-lang/crates.io-index" 632 | checksum = "6130967b369cfb8411b0b73e96fcba1229c32a9cc6f295d144f879bfced13c6e" 633 | dependencies = [ 634 | "atty", 635 | "base64 0.12.3", 636 | "log 0.4.8", 637 | "memchr", 638 | "num_cpus", 639 | "pear", 640 | "rocket_codegen", 641 | "rocket_http", 642 | "state", 643 | "time", 644 | "toml 0.4.10", 645 | "version_check 0.9.2", 646 | "yansi", 647 | ] 648 | 649 | [[package]] 650 | name = "rocket_codegen" 651 | version = "0.4.5" 652 | source = "registry+https://github.com/rust-lang/crates.io-index" 653 | checksum = "cb852e6da168fb948a8f2b798ba2e2f0e4fc860eae0efa9cf2bf0f5466bb0425" 654 | dependencies = [ 655 | "devise", 656 | "glob", 657 | "indexmap", 658 | "quote 0.6.13", 659 | "rocket_http", 660 | "version_check 0.9.2", 661 | "yansi", 662 | ] 663 | 664 | [[package]] 665 | name = "rocket_http" 666 | version = "0.4.5" 667 | source = "registry+https://github.com/rust-lang/crates.io-index" 668 | checksum = "1aff5a5480175f2f553a876b251e9350c74196128806d176da3a51c82aab5428" 669 | dependencies = [ 670 | "cookie", 671 | "hyper", 672 | "indexmap", 673 | "pear", 674 | "percent-encoding 1.0.1", 675 | "smallvec", 676 | "state", 677 | "time", 678 | "unicode-xid 0.1.0", 679 | ] 680 | 681 | [[package]] 682 | name = "rust-argon2" 683 | version = "0.7.0" 684 | source = "registry+https://github.com/rust-lang/crates.io-index" 685 | checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017" 686 | dependencies = [ 687 | "base64 0.11.0", 688 | "blake2b_simd", 689 | "constant_time_eq", 690 | "crossbeam-utils", 691 | ] 692 | 693 | [[package]] 694 | name = "safemem" 695 | version = "0.3.3" 696 | source = "registry+https://github.com/rust-lang/crates.io-index" 697 | checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" 698 | 699 | [[package]] 700 | name = "serde" 701 | version = "1.0.114" 702 | source = "registry+https://github.com/rust-lang/crates.io-index" 703 | checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" 704 | dependencies = [ 705 | "serde_derive", 706 | ] 707 | 708 | [[package]] 709 | name = "serde_derive" 710 | version = "1.0.114" 711 | source = "registry+https://github.com/rust-lang/crates.io-index" 712 | checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" 713 | dependencies = [ 714 | "proc-macro2 1.0.18", 715 | "quote 1.0.7", 716 | "syn 1.0.33", 717 | ] 718 | 719 | [[package]] 720 | name = "sha2" 721 | version = "0.8.2" 722 | source = "registry+https://github.com/rust-lang/crates.io-index" 723 | checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" 724 | dependencies = [ 725 | "block-buffer", 726 | "digest", 727 | "fake-simd", 728 | "opaque-debug", 729 | ] 730 | 731 | [[package]] 732 | name = "smallvec" 733 | version = "1.4.0" 734 | source = "registry+https://github.com/rust-lang/crates.io-index" 735 | checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" 736 | 737 | [[package]] 738 | name = "state" 739 | version = "0.4.1" 740 | source = "registry+https://github.com/rust-lang/crates.io-index" 741 | checksum = "7345c971d1ef21ffdbd103a75990a15eb03604fc8b8852ca8cb418ee1a099028" 742 | 743 | [[package]] 744 | name = "subtle" 745 | version = "1.0.0" 746 | source = "registry+https://github.com/rust-lang/crates.io-index" 747 | checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" 748 | 749 | [[package]] 750 | name = "subtle" 751 | version = "2.2.3" 752 | source = "registry+https://github.com/rust-lang/crates.io-index" 753 | checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" 754 | 755 | [[package]] 756 | name = "syn" 757 | version = "0.15.44" 758 | source = "registry+https://github.com/rust-lang/crates.io-index" 759 | checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" 760 | dependencies = [ 761 | "proc-macro2 0.4.30", 762 | "quote 0.6.13", 763 | "unicode-xid 0.1.0", 764 | ] 765 | 766 | [[package]] 767 | name = "syn" 768 | version = "1.0.33" 769 | source = "registry+https://github.com/rust-lang/crates.io-index" 770 | checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd" 771 | dependencies = [ 772 | "proc-macro2 1.0.18", 773 | "quote 1.0.7", 774 | "unicode-xid 0.2.1", 775 | ] 776 | 777 | [[package]] 778 | name = "time" 779 | version = "0.1.43" 780 | source = "registry+https://github.com/rust-lang/crates.io-index" 781 | checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" 782 | dependencies = [ 783 | "libc", 784 | "winapi", 785 | ] 786 | 787 | [[package]] 788 | name = "tinyvec" 789 | version = "0.3.3" 790 | source = "registry+https://github.com/rust-lang/crates.io-index" 791 | checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" 792 | 793 | [[package]] 794 | name = "toml" 795 | version = "0.4.10" 796 | source = "registry+https://github.com/rust-lang/crates.io-index" 797 | checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" 798 | dependencies = [ 799 | "serde", 800 | ] 801 | 802 | [[package]] 803 | name = "toml" 804 | version = "0.5.6" 805 | source = "registry+https://github.com/rust-lang/crates.io-index" 806 | checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" 807 | dependencies = [ 808 | "serde", 809 | ] 810 | 811 | [[package]] 812 | name = "traitobject" 813 | version = "0.1.0" 814 | source = "registry+https://github.com/rust-lang/crates.io-index" 815 | checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" 816 | 817 | [[package]] 818 | name = "typeable" 819 | version = "0.1.2" 820 | source = "registry+https://github.com/rust-lang/crates.io-index" 821 | checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" 822 | 823 | [[package]] 824 | name = "typenum" 825 | version = "1.12.0" 826 | source = "registry+https://github.com/rust-lang/crates.io-index" 827 | checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" 828 | 829 | [[package]] 830 | name = "unicase" 831 | version = "1.4.2" 832 | source = "registry+https://github.com/rust-lang/crates.io-index" 833 | checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" 834 | dependencies = [ 835 | "version_check 0.1.5", 836 | ] 837 | 838 | [[package]] 839 | name = "unicode-bidi" 840 | version = "0.3.4" 841 | source = "registry+https://github.com/rust-lang/crates.io-index" 842 | checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" 843 | dependencies = [ 844 | "matches", 845 | ] 846 | 847 | [[package]] 848 | name = "unicode-normalization" 849 | version = "0.1.13" 850 | source = "registry+https://github.com/rust-lang/crates.io-index" 851 | checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" 852 | dependencies = [ 853 | "tinyvec", 854 | ] 855 | 856 | [[package]] 857 | name = "unicode-xid" 858 | version = "0.1.0" 859 | source = "registry+https://github.com/rust-lang/crates.io-index" 860 | checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 861 | 862 | [[package]] 863 | name = "unicode-xid" 864 | version = "0.2.1" 865 | source = "registry+https://github.com/rust-lang/crates.io-index" 866 | checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" 867 | 868 | [[package]] 869 | name = "universal-hash" 870 | version = "0.3.0" 871 | source = "registry+https://github.com/rust-lang/crates.io-index" 872 | checksum = "df0c900f2f9b4116803415878ff48b63da9edb268668e08cf9292d7503114a01" 873 | dependencies = [ 874 | "generic-array", 875 | "subtle 2.2.3", 876 | ] 877 | 878 | [[package]] 879 | name = "url" 880 | version = "1.7.2" 881 | source = "registry+https://github.com/rust-lang/crates.io-index" 882 | checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" 883 | dependencies = [ 884 | "idna", 885 | "matches", 886 | "percent-encoding 1.0.1", 887 | ] 888 | 889 | [[package]] 890 | name = "version_check" 891 | version = "0.1.5" 892 | source = "registry+https://github.com/rust-lang/crates.io-index" 893 | checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" 894 | 895 | [[package]] 896 | name = "version_check" 897 | version = "0.9.2" 898 | source = "registry+https://github.com/rust-lang/crates.io-index" 899 | checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" 900 | 901 | [[package]] 902 | name = "wasi" 903 | version = "0.9.0+wasi-snapshot-preview1" 904 | source = "registry+https://github.com/rust-lang/crates.io-index" 905 | checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 906 | 907 | [[package]] 908 | name = "winapi" 909 | version = "0.3.9" 910 | source = "registry+https://github.com/rust-lang/crates.io-index" 911 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 912 | dependencies = [ 913 | "winapi-i686-pc-windows-gnu", 914 | "winapi-x86_64-pc-windows-gnu", 915 | ] 916 | 917 | [[package]] 918 | name = "winapi-i686-pc-windows-gnu" 919 | version = "0.4.0" 920 | source = "registry+https://github.com/rust-lang/crates.io-index" 921 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 922 | 923 | [[package]] 924 | name = "winapi-x86_64-pc-windows-gnu" 925 | version = "0.4.0" 926 | source = "registry+https://github.com/rust-lang/crates.io-index" 927 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 928 | 929 | [[package]] 930 | name = "yansi" 931 | version = "0.5.0" 932 | source = "registry+https://github.com/rust-lang/crates.io-index" 933 | checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" 934 | 935 | [[package]] 936 | name = "zeroize" 937 | version = "1.1.0" 938 | source = "registry+https://github.com/rust-lang/crates.io-index" 939 | checksum = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" 940 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bun" 3 | version = "0.1.0" 4 | authors = ["0x20F <0x20fa@gmail.com>"] 5 | edition = "2018" 6 | 7 | 8 | homepage = "https://github.com/0x20F/bunny" 9 | repository = "https://github.com/0x20F/bunny" 10 | readme = "README.md" 11 | 12 | keywords = ["bookmarks", "tool", "toml", "rocket"] 13 | description = "Smart bookmarking tool, running custom commands to open urls from a browser url bar" 14 | license = "GPL-3.0-or-later" 15 | 16 | exclude = [ 17 | "example/*" 18 | ] 19 | 20 | 21 | 22 | [dependencies] 23 | dirs = "3" 24 | toml = "0.5" 25 | key-list = "1" 26 | rocket = "0.4" 27 | percent-encoding = "2" 28 | serde = { version = "1.0", features = [ "derive" ] } 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Poly 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
Smart bookmarking tool, running custom commands to open urls from a browser url bar
4 | 5 | 6 | ## What? 7 | "Smart bookmarking"? What? I had the same reaction. Imagine it as a very fast, and elegant (if you so wish) way of entering urls into your browser. Instead of writing `reddit.com/r/programmerhumor`, you could be writing `rd r programmerhumor` and be redirected to your entertainment of choice a lot easier. 8 | 9 | This was inspired by the following [article by facebook](https://developers.facebook.com/blog/post/2020/06/03/build-smart-bookmarking-tool-rust-rocket/) 10 | 11 | 12 | ## How to use 13 | * `cargo install bun` (this does require rust nightly for now) 14 | * Run the installed program `bun` 15 | * Create a custom search engine for your browser and point it towards the address the server is running on 16 | 17 | The server looks for a file that contains all the bookmarks inside the home directory (`~/bookmarks.toml`) 18 | 19 | 20 | ### Writing bookmarks (`bookmarks.toml`) 21 | The engine is simple, it's all written in a `toml` format for readability 22 | 23 | * The bookmarks file is made of `books`, they can have any *name* you choose, an *alias*, and a *default* url: 24 | ```rust 25 | [twitter] 26 | alias = "tw" 27 | default = "https://twitter.com" 28 | ``` 29 | 30 | * Each `book` in the file has `pages`. Each page has a *name*, a *prefix*, and a *url*: 31 | ```rust 32 | [twitter] 33 | alias = "tw" 34 | default = "https://twitter.com" 35 | 36 | [twitter.pages] 37 | search = { prefix = "NONE", url = "https://twitter.com/search?q={encoded}" } 38 | profile = { prefix = "@", url = "https://twitter.com/{raw}" } 39 | ``` 40 | 41 | * Each `url` can contain special keys that handle the data you pass to the command. 42 | 43 | ### Keys 44 | 45 | Consider the following command: `tw rust lang`. Here are the keys and what they do with the given data. The `prefix` gets stripped away and we are left to handle `rust lang` 46 | - `{default}` - will be replaced with the default url of the `book` => `https://twitter.com` 47 | - `{encoded}` - will url encode the data => `rust%20lang` 48 | - `{raw}` - will pass in the raw data without encoding it => `rust lang` 49 | - `{0}` - will pass in the first *segment* of the data => `rust` 50 | - `{1}` - will pass in the second *segment* of the data => `lang` 51 | * There are up to `4` total segments at the moment, because it felt like more were just too many. These can be used to create more customised commands, such as, a reddit command: 52 | ```rust 53 | [reddit] 54 | alias = "rd" 55 | default = "https://reddit.com" 56 | 57 | [reddit.pages] 58 | whatever = { prefix = "NONE", url = "https://reddit.com/{0}/{1} } 59 | ``` 60 | * The above can be used as `rd r programmerhumor` to go to a subreddit or as `rd u programmerhumor` to go to a user 61 | 62 | ### Prefixes 63 | 64 | The url prefix can be whatever you want it to be, it is used to differentiate between each command. You could have `-s` when searching for something, or full on `search` if shortcuts aren't your thing. 65 | 66 | **You dont even need spaces between the prefix and command**. 67 | 68 | `-sheyooo` will be split into `-s heyooo` if the prefix is defined as `-s`. 69 | 70 | There's also one special prefix, `NONE`, which means the command will not expect a prefix, and encode the url with all the given data. 71 | 72 | 73 | 74 | ### Full examples can be seen in the [example file](./example/bookmarks.example.toml) 75 | -------------------------------------------------------------------------------- /Rocket.toml: -------------------------------------------------------------------------------- 1 | [development] 2 | address = "localhost" 3 | port = 8888 4 | log = "normal" 5 | 6 | [staging] 7 | address = "0.0.0.0" 8 | port = 9999 9 | log = "normal" 10 | 11 | [production] 12 | address = "0.0.0.0" 13 | port = 8888 14 | log = "critical" 15 | 16 | -------------------------------------------------------------------------------- /example/bookmarks.example.toml: -------------------------------------------------------------------------------- 1 | [twitter] 2 | alias = "tw" 3 | default = "https://twitter.com" 4 | 5 | [twitter.pages] 6 | search = { prefix = "NONE", url = "https://twitter.com/search?q={encoded}" } 7 | user = { prefix = "@", url = "https://twitter.com/{raw}" } 8 | 9 | 10 | 11 | 12 | [github] 13 | alias = "gh" 14 | default = "https://github.com" 15 | 16 | [github.pages] 17 | search = { prefix = "-s", url = "{default}/search?q={encoded}"} 18 | repo = { prefix = "NONE", url = "{default}/{raw}" } 19 | 20 | 21 | 22 | 23 | [reddit] 24 | alias = "rd" 25 | default = "https://reddit.com" 26 | 27 | [reddit.pages] 28 | whatever = { prefix = "NONE", url = "{default}/{0}/{1}" } 29 | search = { prefix = "-s", url = "https://reddit.com/search?q={encoded}" } 30 | -------------------------------------------------------------------------------- /src/books/config.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | 3 | 4 | #[derive(Deserialize, Debug, Default)] 5 | pub struct Book { 6 | pub alias: String, 7 | pub pages: HashMap