diff --git a/.gitignore b/.gitignore index ea8c4bf..098c2c6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +gosub_cookies.db diff --git a/Cargo.lock b/Cargo.lock index ea63d90..5ec214a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,17 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -26,12 +37,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "aligned-vec" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1" - [[package]] name = "alloc-no-stdlib" version = "2.0.4" @@ -111,35 +116,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "anyhow" -version = "1.0.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" - -[[package]] -name = "arbitrary" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" - -[[package]] -name = "arg_enum_proc_macro" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "arrayvec" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" - [[package]] name = "async-channel" version = "2.3.1" @@ -178,29 +154,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[package]] -name = "av1-grain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6678909d8c5d46a42abcf571271e15fdbc0a225e3646cf23762cd415046c78bf" -dependencies = [ - "anyhow", - "arrayvec", - "log", - "nom", - "num-rational", - "v_frame", -] - -[[package]] -name = "avif-serialize" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e335041290c43101ca215eed6f43ec437eb5a42125573f600fc3fa42b9bddd62" -dependencies = [ - "arrayvec", -] - [[package]] name = "backtrace" version = "0.3.74" @@ -222,12 +175,6 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "bit_field" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" - [[package]] name = "bitflags" version = "1.3.2" @@ -240,12 +187,6 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" -[[package]] -name = "bitstream-io" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6099cdc01846bc367c4e7dd630dc5966dccf36b652fae7a74e17b640411a91b2" - [[package]] name = "brotli" version = "7.0.0" @@ -267,36 +208,18 @@ dependencies = [ "alloc-stdlib", ] -[[package]] -name = "built" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c360505aed52b7ec96a3636c3f039d99103c37d1d9b4f7a8c743d3ea9ffcd03b" - [[package]] name = "bumpalo" version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" -[[package]] -name = "bytemuck" -version = "1.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" - [[package]] name = "byteorder" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "byteorder-lite" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" - [[package]] name = "bytes" version = "1.9.0" @@ -323,7 +246,7 @@ checksum = "428290f914b9b86089f60f5d8a9f6e440508e1bcff23b25afd51502b0a2da88f" dependencies = [ "glib-sys", "libc", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -332,21 +255,9 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" dependencies = [ - "jobserver", - "libc", "shlex", ] -[[package]] -name = "cfg-expr" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" -dependencies = [ - "smallvec", - "target-lexicon", -] - [[package]] name = "cfg-expr" version = "0.17.2" @@ -394,12 +305,6 @@ dependencies = [ "log", ] -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - [[package]] name = "colorchoice" version = "1.0.3" @@ -479,37 +384,12 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - [[package]] name = "deranged" version = "0.3.11" @@ -539,12 +419,6 @@ dependencies = [ "litrs", ] -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - [[package]] name = "encoding_rs" version = "0.8.35" @@ -615,34 +489,22 @@ dependencies = [ ] [[package]] -name = "exr" -version = "1.73.0" +name = "fallible-iterator" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83197f59927b46c04a183a619b7c29df34e63e63c7869320862268c0ef687e0" -dependencies = [ - "bit_field", - "half", - "lebe", - "miniz_oxide", - "rayon-core", - "smallvec", - "zune-inflate", -] +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] -name = "fastrand" -version = "2.2.0" +name = "fallible-streaming-iterator" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] -name = "fdeflate" -version = "0.3.6" +name = "fastrand" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07c6f4c64c1d33a3111c4466f7365ebdcc37c5bd1ea0d62aae2e3d722aacbedb" -dependencies = [ - "simd-adler32", -] +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "field-offset" @@ -789,7 +651,7 @@ dependencies = [ "glib-sys", "gobject-sys", "libc", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -821,7 +683,7 @@ dependencies = [ "libc", "pango-sys", "pkg-config", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -837,16 +699,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "gif" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2" -dependencies = [ - "color_quant", - "weezl", -] - [[package]] name = "gimli" version = "0.31.1" @@ -879,7 +731,7 @@ dependencies = [ "glib-sys", "gobject-sys", "libc", - "system-deps 7.0.3", + "system-deps", "windows-sys 0.52.0", ] @@ -933,7 +785,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d0b1827e8621fc42c0dfb228e5d57ff6a71f9699e666ece8113f979ad87c2de" dependencies = [ "libc", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -944,28 +796,26 @@ checksum = "a4c674d2ff8478cf0ec29d2be730ed779fef54415a2fb4b565c52def62696462" dependencies = [ "glib-sys", "libc", - "system-deps 7.0.3", + "system-deps", ] [[package]] name = "gosub-gtk" version = "0.1.0" dependencies = [ - "anyhow", "async-channel", - "bytes", "chrono", "colog", + "cookie", "glib-build-tools", "gtk-macros", "gtk4", - "image", "log", "once_cell", "reqwest", - "thiserror 2.0.3", - "time", + "rusqlite", "tokio", + "url", "uuid", ] @@ -989,7 +839,7 @@ dependencies = [ "glib-sys", "libc", "pkg-config", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -1020,7 +870,7 @@ dependencies = [ "graphene-sys", "libc", "pango-sys", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -1078,7 +928,7 @@ dependencies = [ "gsk4-sys", "libc", "pango-sys", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -1101,13 +951,12 @@ dependencies = [ ] [[package]] -name = "half" -version = "2.4.1" +name = "hashbrown" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "cfg-if", - "crunchy", + "ahash", ] [[package]] @@ -1116,6 +965,15 @@ version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +[[package]] +name = "hashlink" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf" +dependencies = [ + "hashbrown 0.11.2", +] + [[package]] name = "heck" version = "0.5.0" @@ -1403,45 +1261,6 @@ dependencies = [ "icu_properties", ] -[[package]] -name = "image" -version = "0.25.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd6f44aed642f18953a158afeb30206f4d50da59fbc66ecb53c66488de73563b" -dependencies = [ - "bytemuck", - "byteorder-lite", - "color_quant", - "exr", - "gif", - "image-webp", - "num-traits", - "png", - "qoi", - "ravif", - "rayon", - "rgb", - "tiff", - "zune-core", - "zune-jpeg", -] - -[[package]] -name = "image-webp" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e031e8e3d94711a9ccb5d6ea357439ef3dcbed361798bd4071dc4d9793fbe22f" -dependencies = [ - "byteorder-lite", - "quick-error", -] - -[[package]] -name = "imgref" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408" - [[package]] name = "indexmap" version = "2.6.0" @@ -1449,18 +1268,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown", -] - -[[package]] -name = "interpolate_name" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "hashbrown 0.15.2", ] [[package]] @@ -1475,36 +1283,12 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" -[[package]] -name = "jobserver" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" -dependencies = [ - "libc", -] - -[[package]] -name = "jpeg-decoder" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" - [[package]] name = "js-sys" version = "0.3.74" @@ -1521,12 +1305,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -[[package]] -name = "lebe" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" - [[package]] name = "libc" version = "0.2.167" @@ -1534,13 +1312,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] -name = "libfuzzer-sys" -version = "0.4.8" +name = "libsqlite3-sys" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b9569d2f74e257076d8c6bfa73fb505b46b851e51ddaecc825944aa3bed17fa" +checksum = "290b64917f8b0cb885d9de0f9959fe1f775d7fa12f1da2db9001c1c8ab60f89d" dependencies = [ - "arbitrary", - "cc", + "pkg-config", + "vcpkg", ] [[package]] @@ -1567,25 +1345,6 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" -[[package]] -name = "loop9" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" -dependencies = [ - "imgref", -] - -[[package]] -name = "maybe-rayon" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" -dependencies = [ - "cfg-if", - "rayon", -] - [[package]] name = "memchr" version = "2.7.4" @@ -1607,12 +1366,6 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.8.0" @@ -1620,7 +1373,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ "adler2", - "simd-adler32", ] [[package]] @@ -1651,75 +1403,12 @@ dependencies = [ "tempfile", ] -[[package]] -name = "new_debug_unreachable" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "noop_proc_macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - [[package]] name = "num-conv" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" -[[package]] -name = "num-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1809,7 +1498,7 @@ dependencies = [ "glib-sys", "gobject-sys", "libc", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -1818,12 +1507,6 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - [[package]] name = "percent-encoding" version = "2.3.1" @@ -1848,19 +1531,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" -[[package]] -name = "png" -version = "0.17.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f9d46a34a05a6a57566bc2bfae066ef07585a6e3fa30fbbdff5936380623f0" -dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide", -] - [[package]] name = "powerfmt" version = "0.2.0" @@ -1894,25 +1564,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "profiling" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" -dependencies = [ - "profiling-procmacros", -] - -[[package]] -name = "profiling-procmacros" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30" -dependencies = [ - "quote", - "syn", -] - [[package]] name = "psl-types" version = "2.0.11" @@ -1929,21 +1580,6 @@ dependencies = [ "psl-types", ] -[[package]] -name = "qoi" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - [[package]] name = "quinn" version = "0.11.6" @@ -1957,7 +1593,7 @@ dependencies = [ "rustc-hash", "rustls", "socket2", - "thiserror 2.0.3", + "thiserror", "tokio", "tracing", ] @@ -1976,7 +1612,7 @@ dependencies = [ "rustls", "rustls-pki-types", "slab", - "thiserror 2.0.3", + "thiserror", "tinyvec", "tracing", "web-time", @@ -2035,76 +1671,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rav1e" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd87ce80a7665b1cce111f8a16c1f3929f6547ce91ade6addf4ec86a8dda5ce9" -dependencies = [ - "arbitrary", - "arg_enum_proc_macro", - "arrayvec", - "av1-grain", - "bitstream-io", - "built", - "cfg-if", - "interpolate_name", - "itertools", - "libc", - "libfuzzer-sys", - "log", - "maybe-rayon", - "new_debug_unreachable", - "noop_proc_macro", - "num-derive", - "num-traits", - "once_cell", - "paste", - "profiling", - "rand", - "rand_chacha", - "simd_helpers", - "system-deps 6.2.2", - "thiserror 1.0.69", - "v_frame", - "wasm-bindgen", -] - -[[package]] -name = "ravif" -version = "0.11.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2413fd96bd0ea5cdeeb37eaf446a22e6ed7b981d792828721e74ded1980a45c6" -dependencies = [ - "avif-serialize", - "imgref", - "loop9", - "quick-error", - "rav1e", - "rayon", - "rgb", -] - -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - [[package]] name = "regex" version = "1.11.1" @@ -2187,12 +1753,6 @@ dependencies = [ "windows-registry", ] -[[package]] -name = "rgb" -version = "0.8.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a" - [[package]] name = "ring" version = "0.17.8" @@ -2208,6 +1768,21 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rusqlite" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c4b1eaf239b47034fb450ee9cdedd7d0226571689d8823030c4b6c2cb407152" +dependencies = [ + "bitflags 1.3.2", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "memchr", + "smallvec", +] + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -2388,21 +1963,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "simd-adler32" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" - -[[package]] -name = "simd_helpers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" -dependencies = [ - "quote", -] - [[package]] name = "slab" version = "0.4.9" @@ -2498,26 +2058,13 @@ dependencies = [ "libc", ] -[[package]] -name = "system-deps" -version = "6.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" -dependencies = [ - "cfg-expr 0.15.8", - "heck", - "pkg-config", - "toml", - "version-compare", -] - [[package]] name = "system-deps" version = "7.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66d23aaf9f331227789a99e8de4c91bf46703add012bdfd45fdecdfb2975a005" dependencies = [ - "cfg-expr 0.17.2", + "cfg-expr", "heck", "pkg-config", "toml", @@ -2543,33 +2090,13 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - [[package]] name = "thiserror" version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" dependencies = [ - "thiserror-impl 2.0.3", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "thiserror-impl", ] [[package]] @@ -2583,17 +2110,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tiff" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" -dependencies = [ - "flate2", - "jpeg-decoder", - "weezl", -] - [[package]] name = "time" version = "0.3.36" @@ -2814,17 +2330,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "v_frame" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f32aaa24bacd11e488aa9ba66369c7cd514885742c9fe08cfe85884db3e92b" -dependencies = [ - "aligned-vec", - "num-traits", - "wasm-bindgen", -] - [[package]] name = "vcpkg" version = "0.2.15" @@ -2955,12 +2460,6 @@ dependencies = [ "rustls-pki-types", ] -[[package]] -name = "weezl" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" - [[package]] name = "windows-core" version = "0.52.0" @@ -3262,27 +2761,3 @@ dependencies = [ "quote", "syn", ] - -[[package]] -name = "zune-core" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" - -[[package]] -name = "zune-inflate" -version = "0.2.54" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "zune-jpeg" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16099418600b4d8f028622f73ff6e3deaabdff330fb9a2a131dea781ee8b0768" -dependencies = [ - "zune-core", -] diff --git a/Cargo.toml b/Cargo.toml index e7419c0..64871cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,17 +8,15 @@ gtk-macros = "0.3" gtk4 = { version = "0.9.4", features = ["v4_6", "v4_14"] } chrono = { version = "0.4.31", features = [] } reqwest = { version = "0.12.9", features = ["blocking", "gzip", "brotli", "cookies", "deflate", "http2", "rustls-tls"] } -image = "0.25.5" -uuid = { version = "1.11.0", features = ["v4"] } +uuid = { version = "1.11.0", features = ["v4", "v7"] } log = "0.4.22" once_cell = "1.5" -thiserror = "2.0.3" colog = "1.3.0" tokio = { version = "1.41.0", features = ["rt-multi-thread"] } -bytes = "1.8.0" -time = "0.3.36" -anyhow = "1.0.93" async-channel = "2.3.1" +url = "2.5.2" +rusqlite = "0.25.0" +cookie = "0.18.1" [build-dependencies] glib-build-tools = "0.20.0" diff --git a/src/cookies.rs b/src/cookies.rs new file mode 100644 index 0000000..2e531e8 --- /dev/null +++ b/src/cookies.rs @@ -0,0 +1,2 @@ +pub mod jar; +pub mod sqlite_store; diff --git a/src/cookies/jar.rs b/src/cookies/jar.rs new file mode 100644 index 0000000..b23c0f2 --- /dev/null +++ b/src/cookies/jar.rs @@ -0,0 +1,42 @@ +use cookie::Cookie; +use reqwest::cookie::CookieStore; +use reqwest::header::HeaderValue; +use std::sync::{Arc, Mutex}; +use url::Url; + +pub trait StorageBackend: Send + Sync { + fn store(&self, url: &Url, value: &Cookie); + fn get(&self, url: &Url) -> Option>; +} + +pub struct CookieJar { + store: Arc>, +} + +impl CookieJar { + pub fn new(store: Arc>) -> Self { + Self { store } + } +} + +impl CookieStore for CookieJar { + fn set_cookies(&self, cookie_headers: &mut dyn Iterator, url: &url::Url) { + println!("set_cookies for {:?}", url); + for header_value in cookie_headers { + println!("cookie: {:?}", header_value); + match Cookie::parse(header_value.to_str().unwrap()) { + Ok(c) => { + self.store.lock().unwrap().store(url, &c); + } + Err(e) => { + println!("failed to parse cookie: {:?}", e); + } + } + } + } + + fn cookies(&self, url: &url::Url) -> Option { + println!("getting cookies for {:?}", url); + None + } +} diff --git a/src/cookies/sqlite_store.rs b/src/cookies/sqlite_store.rs new file mode 100644 index 0000000..facb977 --- /dev/null +++ b/src/cookies/sqlite_store.rs @@ -0,0 +1,100 @@ +use crate::cookies::jar::StorageBackend; +use cookie::Cookie; +use log::warn; +use rusqlite::{params, Connection}; +use std::sync::Mutex; +use url::Url; +use uuid::Uuid; + +pub struct SqliteStorage { + /// Connection. Should be guarded through a mutex, as it can be used multi-threaded + conn: Mutex, +} + +impl SqliteStorage { + pub fn new(database_path: &str) -> Result { + let conn = Connection::open(database_path)?; + conn.execute( + "CREATE TABLE IF NOT EXISTS cookies ( + id UUID PRIMARY KEY, + domain TEXT NOT NULL, + path TEXT NOT NULL, + name TEXT NOT NULL, + cookie TEXT NOT NULL, + expires_at INTEGER NOT NULL + )", + [], + )?; + + conn.execute("CREATE UNIQUE INDEX IF NOT EXISTS idx_dpn ON cookies (domain, path, name)", [])?; + + Ok(Self { conn: Mutex::new(conn) }) + } +} + +impl StorageBackend for SqliteStorage { + fn store(&self, url: &Url, cookie: &Cookie) { + if cookie.expires().is_none() { + // No expires found + return; + } + + let expires = cookie.expires().unwrap(); + if expires.is_session() { + // Session cookie, do not store + return; + } + + let expires_at = expires.datetime().unwrap().unix_timestamp(); + + let domain = match cookie.domain() { + Some(d) => d.to_string(), + None => url.domain().unwrap().to_string(), + }; + + let e = self.conn.lock().unwrap().execute( + "INSERT INTO cookies (id, domain, path, name, cookie, expires_at) VALUES (?1, ?2, ?3, ?4, ?5, ?6) + ON CONFLICT(domain, path, name) DO UPDATE SET cookie = excluded.cookie, expires_at = excluded.expires_at", + params![ + Uuid::now_v7().to_string(), + domain, + cookie.path(), + cookie.name(), + cookie.to_string(), + expires_at + ], + ); + if let Err(e) = e { + warn!("failed to store cookie: {:?}", e); + } + } + + fn get(&self, url: &Url) -> Option> { + println!("getting cookies for {:?}", url); + + let domain = url.domain().unwrap().to_string(); + let path = url.path().to_string(); + + let locked_conn = self.conn.lock().unwrap(); + + let stmt = locked_conn.prepare( + "SELECT cookie FROM cookies WHERE domain = ?1 AND path = ?2 AND expires_at > ?3", + ); + if let Err(e) = stmt { + warn!("failed to prepare statement: {:?}", e); + return None; + } + + let mut stmt = stmt.unwrap(); + let cookies = stmt + .query_map(params![domain, path, chrono::Utc::now().timestamp()], |row| { + let cookie_str: String = row.get(0)?; + Ok(Cookie::parse(cookie_str).unwrap()) + }) + .unwrap() + .map(|c| c.unwrap()) + .collect(); + + Some(cookies) + } +} diff --git a/src/fetcher.rs b/src/fetcher.rs index d74e09f..9d4182d 100644 --- a/src/fetcher.rs +++ b/src/fetcher.rs @@ -1,6 +1,9 @@ -use log::info; +use crate::cookies::jar::CookieJar; +use crate::cookies::sqlite_store::SqliteStorage; +use log::{info, warn}; use reqwest::header::HeaderMap; use reqwest::{Client, Error, Response}; +use std::sync::{Arc, Mutex}; use std::time::Duration; const GOSUB_USERAGENT_STRING: &str = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; Wayland; rv:133.0) Gecko/20100101 Gosub/0.1 Firefox/133.0"; @@ -32,8 +35,19 @@ pub async fn fetch_url(url: &str) -> Result { // headers.insert("Connection", "keep-alive".parse().unwrap()); headers.insert("DNT", "1".parse().unwrap()); + let jar = match SqliteStorage::new("./gosub_cookies.db") { + Ok(store) => { + info!("successfully created SqliteStorage"); + Some(CookieJar::new(Arc::new(Mutex::new(store)))) + } + Err(e) => { + info!("failed to create SqliteStorage: {:?}", e); + None + } + }; + info!("fetching url {}", url); - let client = Client::builder() + let mut builder = Client::builder() .user_agent(FIREFOX_USERAGENT_STRING) .timeout(Duration::from_secs(5)) .use_rustls_tls() // For HTTP2 @@ -42,20 +56,30 @@ pub async fn fetch_url(url: &str) -> Result { .read_timeout(Duration::from_secs(5)) .brotli(true) .gzip(true) - .deflate(true) - .build()?; + .deflate(true); + + match jar { + Some(jar) => { + builder = builder.cookie_provider(Arc::new(jar)); + } + None => { + info!("no cookie jar"); + } + } + + let client = builder.build()?; let request_builder = client.get(url).headers(headers); let request = request_builder.build()?; - println!("Request Method: {:?}", request.method()); - println!("Request URL: {:?}", request.url()); - println!("Request Headers: {:#?}", request.headers()); + // println!("Request Method: {:?}", request.method()); + // println!("Request URL: {:?}", request.url()); + // println!("Request Headers: {:#?}", request.headers()); let response = client.execute(request).await?; - println!("Response Status: {:?}", response.status()); - println!("Response Headers: {:#?}", response.headers()); + // println!("Response Status: {:?}", response.status()); + // println!("Response Headers: {:#?}", response.headers()); Ok(response) } @@ -68,7 +92,7 @@ pub async fn fetch_favicon(url: &str) -> Vec { info!("fetching favicon from {}", url); let url = format!("{}{}", url, "/favicon.ico"); let Ok(buf) = fetch_url_body(url.as_str()).await else { - info!("Failed to fetch favicon from URL"); + warn!("Failed to fetch favicon from URL"); return Vec::new(); }; diff --git a/src/main.rs b/src/main.rs index af0b6a9..cfa18b5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ mod application; +mod cookies; mod dialog; mod fetcher; mod tab;