Compare commits

..

41 Commits

Author SHA1 Message Date
Savanni D'Gerinel 6fb872569d Remove the Iron middleware files 2023-10-03 19:40:57 -04:00
Savanni D'Gerinel a187582f16 Remove dead comments 2023-10-03 19:40:57 -04:00
Savanni D'Gerinel 5491521f95 Remove a legacy file 2023-10-03 19:40:57 -04:00
Savanni D'Gerinel fee2fe607d Remove an excess comment 2023-10-03 19:40:57 -04:00
Savanni D'Gerinel 9bc785722b Remove old placeholder directories 2023-10-03 19:40:57 -04:00
Savanni D'Gerinel b044dbaed8 Handle file uploads with a validated session 2023-10-03 19:40:57 -04:00
Savanni D'Gerinel 48f8c4aaf5 Validate the session token with file uploads
File uploads now check the session token before continuing.

Resolves: https://www.pivotaltracker.com/story/show/186174680
2023-10-03 19:40:57 -04:00
Savanni D'Gerinel 17ad927187 Validate the session token
A previous commit added authentication token checks. Auth tokens are replaced with session tokens, which can (and should) expire. This commit validates sessions, which now allows access to gated operations.
2023-10-03 19:40:55 -04:00
Savanni D'Gerinel 73293fd932 Add a CLI application for user management 2023-10-03 19:37:53 -04:00
Savanni D'Gerinel 2ae0d9cfe8 Split out a support library 2023-10-03 19:37:53 -04:00
Savanni D'Gerinel 2ad3874724 Add session checks 2023-10-03 19:37:53 -04:00
Savanni D'Gerinel 5c80fb3591 Add the ability to create and list users 2023-10-03 19:37:53 -04:00
Savanni D'Gerinel 5417eecdad Create the initial database migration 2023-10-03 19:37:53 -04:00
Savanni D'Gerinel 5cc7c3ac5e Finish the auth handler and create app auth stubs 2023-10-03 19:37:53 -04:00
Savanni D'Gerinel 40b9c41ed1 Set up authentication routes 2023-10-03 19:37:51 -04:00
Savanni D'Gerinel d4fb5601c0 Complete upload 2023-10-03 19:34:04 -04:00
Savanni D'Gerinel 5479c136fd Set up temperory working directories 2023-10-03 19:34:04 -04:00
Savanni D'Gerinel f204920216 Correctly set up file ids from list_files 2023-10-03 19:34:03 -04:00
Savanni D'Gerinel 5c23427fdb Refactor PathResolver so it cannot fail 2023-10-03 19:34:03 -04:00
Savanni D'Gerinel a3add82294 Remove old test files 2023-10-03 19:34:03 -04:00
Savanni D'Gerinel 3b05e31374 Lots more refactoring :( 2023-10-03 19:34:03 -04:00
Savanni D'Gerinel 756120c9e6 Clean up the filehandle logic 2023-10-03 19:34:03 -04:00
Savanni D'Gerinel b7ffdfac61 Add cool_asserts 2023-10-03 19:34:03 -04:00
Savanni D'Gerinel 8afbe1ddc1 Provide a unified interface for the File and Thumbnail 2023-10-03 19:34:03 -04:00
Savanni D'Gerinel 89594d3169 Load file by ID 2023-10-03 19:34:03 -04:00
Savanni D'Gerinel e957865d2a Get thumbnail creation working again 2023-10-03 19:34:03 -04:00
Savanni D'Gerinel 334cd42e10 Add some tests to verify that a file can be added to the system
Still gutting a lot of the old code, but this MR focuses more on ensuring that a file can be added and that the metadata gets saved.
2023-10-03 19:34:03 -04:00
Savanni D'Gerinel 5ef0260ce2 Add some testing for the PathResolver 2023-10-03 19:34:03 -04:00
Savanni D'Gerinel 10a0c483a1 Start ripping out lots of infrastructure
Much of the infrastructure is old and seems to be based on some assumptions about how Iron handled multipart posts. I don't understand how much of this works, so I'm slowly ripping parts out and rebuilding how the separation of concerns works.
2023-10-03 19:34:03 -04:00
Savanni D'Gerinel 0d0cc8c495 Set up the delete route
Sets up the delete route, including post-delete redirect back to the root.
Also adds logging.

Delete does not actually delete things yet.
2023-10-03 19:34:03 -04:00
Savanni D'Gerinel f451df3a79 Refactor file and thumbnail serving to common code 2023-10-03 19:34:03 -04:00
Savanni D'Gerinel d0c5e0a59f Attempt to add etag caching 2023-10-03 19:34:03 -04:00
Savanni D'Gerinel de034d53c1 Render thumbnails 2023-10-03 19:34:03 -04:00
Savanni D'Gerinel 343e8e8817 Update cargo.lock 2023-10-03 19:34:02 -04:00
Savanni D'Gerinel 404ccd1854 Swap from iron to warp and start rebuilding the app 2023-10-03 19:33:00 -04:00
Savanni D'Gerinel e36657591b Add orizentic and file-service to the build 2023-10-03 19:32:57 -04:00
Savanni D'Gerinel 7077724e15 Import a questionably refactored version of file-service 2023-10-03 17:59:55 -04:00
Savanni D'Gerinel 4816c9f4cf Import orizentic 2023-10-03 17:59:55 -04:00
Savanni D'Gerinel 207d099607 nom parsing practice 2023-09-25 22:54:54 +00:00
Savanni D'Gerinel 59061c02ce dashboard: 0.1.0 --> 0.1.1 2023-09-21 09:44:22 -04:00
Savanni D'Gerinel 3d460e5840 Sleep for only one second if the gtk sender can't be found
This probably means that the main app hasn't started yet. Just sleep for one second before retrying.
2023-09-21 09:37:56 -04:00
7 changed files with 324 additions and 193 deletions

368
Cargo.lock generated
View File

@ -37,9 +37,9 @@ dependencies = [
[[package]]
name = "aho-corasick"
version = "1.0.5"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783"
checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab"
dependencies = [
"memchr",
]
@ -190,15 +190,9 @@ dependencies = [
[[package]]
name = "base64"
version = "0.13.1"
version = "0.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "base64"
version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53"
checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2"
[[package]]
name = "base64ct"
@ -259,15 +253,15 @@ checksum = "3108fe6fe7ac796fb7625bdde8fa2b67b5a7731496251ca57c7b8cadd78a16a1"
[[package]]
name = "bumpalo"
version = "3.13.0"
version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
[[package]]
name = "bytemuck"
version = "1.13.1"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea"
checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6"
[[package]]
name = "byteorder"
@ -277,9 +271,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
version = "1.4.0"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
[[package]]
name = "cairo-rs"
@ -317,9 +311,9 @@ dependencies = [
[[package]]
name = "cfg-expr"
version = "0.15.4"
version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b40ccee03b5175c18cde8f37e7d2a33bcef6f8ec8f7cc0d81090d1bb380949c9"
checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3"
dependencies = [
"smallvec",
"target-lexicon",
@ -340,16 +334,15 @@ dependencies = [
[[package]]
name = "chrono"
version = "0.4.27"
version = "0.4.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f56b4c72906975ca04becb8a30e102dfecddd0c06181e3e95ddc444be28881f8"
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
dependencies = [
"android-tzdata",
"iana-time-zone",
"js-sys",
"num-traits",
"serde 1.0.188",
"time 0.1.45",
"wasm-bindgen",
"windows-targets",
]
@ -423,7 +416,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.37",
]
[[package]]
@ -555,16 +548,6 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
dependencies = [
"cfg-if",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.3"
@ -636,7 +619,7 @@ dependencies = [
[[package]]
name = "dashboard"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"cairo-rs",
"chrono",
@ -661,6 +644,12 @@ dependencies = [
"unic-langid",
]
[[package]]
name = "data-encoding"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "deflate"
version = "0.8.6"
@ -720,7 +709,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.37",
]
[[package]]
@ -783,9 +772,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.3"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd"
checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480"
dependencies = [
"errno-dragonfly",
"libc",
@ -821,12 +810,12 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]]
name = "exr"
version = "1.7.0"
version = "1.71.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1e481eb11a482815d3e9d618db8c42a93207134662873809335a92327440c18"
checksum = "832a761f35ab3e6664babfbdc6cef35a4860e816ec3916dcfd0882954e98a8a8"
dependencies = [
"bit_field",
"flume 0.10.14",
"flume",
"half",
"lebe",
"miniz_oxide 0.7.1",
@ -837,9 +826,9 @@ dependencies = [
[[package]]
name = "fastrand"
version = "2.0.0"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764"
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]]
name = "fdeflate"
@ -968,19 +957,6 @@ dependencies = [
"thiserror",
]
[[package]]
name = "flume"
version = "0.10.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577"
dependencies = [
"futures-core",
"futures-sink",
"nanorand",
"pin-project",
"spin 0.9.8",
]
[[package]]
name = "flume"
version = "0.11.0"
@ -1095,7 +1071,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.37",
]
[[package]]
@ -1218,10 +1194,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi 0.11.0+wasi-snapshot-preview1",
"wasm-bindgen",
]
[[package]]
@ -1272,16 +1246,16 @@ dependencies = [
[[package]]
name = "gio"
version = "0.18.1"
version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7884cba6b1c5db1607d970cadf44b14a43913d42bc68766eea6a5e2fe0891524"
checksum = "57052f84e8e5999b258e8adf8f5f2af0ac69033864936b8b6838321db2f759b1"
dependencies = [
"futures-channel",
"futures-core",
"futures-io",
"futures-util",
"gio-sys 0.18.1",
"glib 0.18.1",
"glib 0.18.2",
"libc",
"once_cell",
"pin-project-lite",
@ -1340,9 +1314,9 @@ dependencies = [
[[package]]
name = "glib"
version = "0.18.1"
version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "331156127e8166dd815cf8d2db3a5beb492610c716c03ee6db4f2d07092af0a7"
checksum = "1c316afb01ce8067c5eaab1fc4f2cd47dc21ce7b6296358605e2ffab23ccbd19"
dependencies = [
"bitflags 2.4.0",
"futures-channel",
@ -1351,7 +1325,7 @@ dependencies = [
"futures-task",
"futures-util",
"gio-sys 0.18.1",
"glib-macros 0.18.0",
"glib-macros 0.18.2",
"glib-sys 0.18.1",
"gobject-sys 0.18.0",
"libc",
@ -1390,16 +1364,16 @@ dependencies = [
[[package]]
name = "glib-macros"
version = "0.18.0"
version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "179643c50bf28d20d2f6eacd2531a88f2f5d9747dd0b86b8af1e8bb5dd0de3c0"
checksum = "f8da903822b136d42360518653fcf154455defc437d3e7a81475bf9a95ff1e47"
dependencies = [
"heck",
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.37",
]
[[package]]
@ -1618,9 +1592,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hashbrown"
version = "0.14.0"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12"
dependencies = [
"ahash",
"allocator-api2",
@ -1632,7 +1606,7 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
dependencies = [
"hashbrown 0.14.0",
"hashbrown 0.14.1",
]
[[package]]
@ -1641,7 +1615,7 @@ version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270"
dependencies = [
"base64 0.21.3",
"base64 0.21.4",
"bytes",
"headers-core",
"http",
@ -1679,9 +1653,9 @@ dependencies = [
[[package]]
name = "hermit-abi"
version = "0.3.2"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
[[package]]
name = "hex"
@ -1940,12 +1914,12 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.0.0"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897"
dependencies = [
"equivalent",
"hashbrown 0.14.0",
"hashbrown 0.14.1",
]
[[package]]
@ -1995,7 +1969,7 @@ version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
dependencies = [
"hermit-abi 0.3.2",
"hermit-abi 0.3.3",
"rustix",
"windows-sys",
]
@ -2155,9 +2129,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.147"
version = "0.2.148"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b"
[[package]]
name = "libm"
@ -2184,9 +2158,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "linux-raw-sys"
version = "0.4.5"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503"
checksum = "3852614a3bd9ca9804678ba6be5e3b8ce76dfc902cae004e3e0c44051b6e88db"
[[package]]
name = "lock_api"
@ -2242,9 +2216,9 @@ dependencies = [
[[package]]
name = "memchr"
version = "2.6.1"
version = "2.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f478948fd84d9f8e86967bf432640e46adfb5a4bd4f14ef7e864ab38220534ae"
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
[[package]]
name = "memoffset"
@ -2373,15 +2347,6 @@ dependencies = [
"version_check 0.9.4",
]
[[package]]
name = "nanorand"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3"
dependencies = [
"getrandom",
]
[[package]]
name = "native-tls"
version = "0.2.11"
@ -2416,6 +2381,14 @@ dependencies = [
"minimal-lexical",
]
[[package]]
name = "nom-training"
version = "0.1.0"
dependencies = [
"cool_asserts",
"nom",
]
[[package]]
name = "num-bigint-dig"
version = "0.8.4"
@ -2492,15 +2465,15 @@ version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
"hermit-abi 0.3.2",
"hermit-abi 0.3.3",
"libc",
]
[[package]]
name = "object"
version = "0.32.0"
version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe"
checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0"
dependencies = [
"memchr",
]
@ -2534,7 +2507,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.37",
]
[[package]]
@ -2545,9 +2518,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-sys"
version = "0.9.92"
version = "0.9.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db7e971c2c2bba161b2d2fdf37080177eff520b3bc044787c7f1f5f9e78d869b"
checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d"
dependencies = [
"cc",
"libc",
@ -2592,8 +2565,8 @@ version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06a9e54b831d033206160096b825f2070cf5fda7e35167b1c01e9e774f9202d1"
dependencies = [
"gio 0.18.1",
"glib 0.18.1",
"gio 0.18.2",
"glib 0.18.2",
"libc",
"once_cell",
"pango-sys 0.18.0",
@ -2776,7 +2749,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.37",
]
[[package]]
@ -2875,7 +2848,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
dependencies = [
"once_cell",
"toml_edit",
"toml_edit 0.19.15",
]
[[package]]
@ -2904,28 +2877,28 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.66"
version = "1.0.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328"
dependencies = [
"unicode-ident",
]
[[package]]
name = "proptest"
version = "1.2.0"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65"
checksum = "7c003ac8c77cb07bb74f5f198bce836a689bcd5a42574612bf14d17bfd08c20e"
dependencies = [
"bit-set",
"bitflags 1.3.2",
"byteorder",
"bit-vec",
"bitflags 2.4.0",
"lazy_static",
"num-traits",
"rand 0.8.5",
"rand_chacha 0.3.1",
"rand_xorshift 0.3.0",
"regex-syntax 0.6.29",
"regex-syntax",
"rusty-fork",
"tempfile",
"unarray",
@ -3125,9 +3098,9 @@ dependencies = [
[[package]]
name = "rayon"
version = "1.7.0"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1"
dependencies = [
"either",
"rayon-core",
@ -3135,14 +3108,12 @@ dependencies = [
[[package]]
name = "rayon-core"
version = "1.11.0"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
"num_cpus",
]
[[package]]
@ -3165,33 +3136,27 @@ dependencies = [
[[package]]
name = "regex"
version = "1.9.4"
version = "1.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29"
checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax 0.7.5",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.3.7"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629"
checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax 0.7.5",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
[[package]]
name = "regex-syntax"
version = "0.7.5"
@ -3209,11 +3174,11 @@ dependencies = [
[[package]]
name = "reqwest"
version = "0.11.20"
version = "0.11.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1"
checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b"
dependencies = [
"base64 0.21.3",
"base64 0.21.4",
"bytes",
"encoding_rs",
"futures-core",
@ -3234,6 +3199,7 @@ dependencies = [
"serde 1.0.188",
"serde_json",
"serde_urlencoded",
"system-configuration",
"tokio",
"tokio-native-tls",
"tower-service",
@ -3301,9 +3267,9 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.10"
version = "0.38.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed6248e1caa625eb708e266e06159f135e8c26f2bb7ceb72dc4b2766d0340964"
checksum = "d2f9da0cbd88f9f09e7814e388301c8414c51c62aa6ce1e4b5c551d49d96e531"
dependencies = [
"bitflags 2.4.0",
"errno",
@ -3318,7 +3284,7 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2"
dependencies = [
"base64 0.21.3",
"base64 0.21.4",
]
[[package]]
@ -3410,9 +3376,9 @@ checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af"
[[package]]
name = "semver"
version = "1.0.18"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"
checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0"
[[package]]
name = "serde"
@ -3437,14 +3403,14 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.37",
]
[[package]]
name = "serde_json"
version = "1.0.105"
version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360"
checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65"
dependencies = [
"itoa",
"ryu",
@ -3486,9 +3452,9 @@ dependencies = [
[[package]]
name = "sha1"
version = "0.10.5"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"
checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
dependencies = [
"cfg-if",
"cpufeatures",
@ -3497,9 +3463,9 @@ dependencies = [
[[package]]
name = "sha2"
version = "0.10.7"
version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8"
checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
dependencies = [
"cfg-if",
"cpufeatures",
@ -3554,9 +3520,9 @@ dependencies = [
[[package]]
name = "smallvec"
version = "1.11.0"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
[[package]]
name = "socket2"
@ -3570,9 +3536,9 @@ dependencies = [
[[package]]
name = "socket2"
version = "0.5.3"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877"
checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e"
dependencies = [
"libc",
"windows-sys",
@ -3649,7 +3615,7 @@ dependencies = [
"futures-util",
"hashlink",
"hex",
"indexmap 2.0.0",
"indexmap 2.0.2",
"log 0.4.20",
"memchr",
"once_cell",
@ -3712,7 +3678,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "864b869fdf56263f4c95c45483191ea0af340f9f3e3e7b4d57a61c7c87a970db"
dependencies = [
"atoi",
"base64 0.21.3",
"base64 0.21.4",
"bitflags 2.4.0",
"byteorder",
"bytes",
@ -3754,7 +3720,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb7ae0e6a97fb3ba33b23ac2671a5ce6e3cabe003f451abd5a56e7951d975624"
dependencies = [
"atoi",
"base64 0.21.3",
"base64 0.21.4",
"bitflags 2.4.0",
"byteorder",
"crc",
@ -3793,7 +3759,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d59dc83cf45d89c555a577694534fcd1b55c545a816c816ce51f20bbe56a4f3f"
dependencies = [
"atoi",
"flume 0.11.0",
"flume",
"futures-channel",
"futures-core",
"futures-executor",
@ -3850,9 +3816,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.29"
version = "2.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a"
checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8"
dependencies = [
"proc-macro2",
"quote",
@ -3860,10 +3826,31 @@ dependencies = [
]
[[package]]
name = "system-deps"
version = "6.1.1"
name = "system-configuration"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30c2de8a4d8f4b823d634affc9cd2a74ec98c53a756f317e529a48046cbf71f3"
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
dependencies = [
"bitflags 1.3.2",
"core-foundation",
"system-configuration-sys",
]
[[package]]
name = "system-configuration-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "system-deps"
version = "6.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94af52f9402f94aac4948a2518b43359be8d9ce6cd9efc1c4de3b2f7b7e897d6"
dependencies = [
"cfg-expr",
"heck",
@ -3921,22 +3908,22 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.47"
version = "1.0.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f"
checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.47"
version = "1.0.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b"
checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.37",
]
[[package]]
@ -4002,9 +3989,9 @@ dependencies = [
[[package]]
name = "tinystr"
version = "0.7.1"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ac3f5b6856e931e15e07b478e98c8045239829a65f9156d4fa7e7788197a5ef"
checksum = "d5d0e245e80bdc9b4e5356fc45a72184abbc3861992603f515270e9340f5a219"
dependencies = [
"displaydoc",
]
@ -4038,7 +4025,7 @@ dependencies = [
"parking_lot",
"pin-project-lite",
"signal-hook-registry",
"socket2 0.5.3",
"socket2 0.5.4",
"tokio-macros",
"windows-sys",
]
@ -4051,7 +4038,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.37",
]
[[package]]
@ -4077,9 +4064,9 @@ dependencies = [
[[package]]
name = "tokio-tungstenite"
version = "0.18.0"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54319c93411147bced34cb5609a80e0a8e44c5999c93903a81cd866630ec0bfd"
checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c"
dependencies = [
"futures-util",
"log 0.4.20",
@ -4089,9 +4076,9 @@ dependencies = [
[[package]]
name = "tokio-util"
version = "0.7.8"
version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d"
checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d"
dependencies = [
"bytes",
"futures-core",
@ -4103,14 +4090,14 @@ dependencies = [
[[package]]
name = "toml"
version = "0.7.6"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542"
checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d"
dependencies = [
"serde 1.0.188",
"serde_spanned",
"toml_datetime",
"toml_edit",
"toml_edit 0.20.2",
]
[[package]]
@ -4124,11 +4111,22 @@ dependencies = [
[[package]]
name = "toml_edit"
version = "0.19.14"
version = "0.19.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [
"indexmap 2.0.0",
"indexmap 2.0.2",
"toml_datetime",
"winnow",
]
[[package]]
name = "toml_edit"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
dependencies = [
"indexmap 2.0.2",
"serde 1.0.188",
"serde_spanned",
"toml_datetime",
@ -4162,7 +4160,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.37",
]
[[package]]
@ -4188,13 +4186,13 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
[[package]]
name = "tungstenite"
version = "0.18.0"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30ee6ab729cd4cf0fd55218530c4522ed30b7b6081752839b68fcec8d0960788"
checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9"
dependencies = [
"base64 0.13.1",
"byteorder",
"bytes",
"data-encoding",
"http",
"httparse",
"log 0.4.20",
@ -4231,9 +4229,9 @@ dependencies = [
[[package]]
name = "typenum"
version = "1.16.0"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "typeshare"
@ -4307,9 +4305,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
[[package]]
name = "unicode-ident"
version = "1.0.11"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-normalization"
@ -4466,9 +4464,9 @@ dependencies = [
[[package]]
name = "warp"
version = "0.3.5"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba431ef570df1287f7f8b07e376491ad54f84d26ac473489427231e1718e1f69"
checksum = "c1e92e22e03ff1230c03a1a8ee37d2f89cd489e2e541b7550d6afad96faed169"
dependencies = [
"bytes",
"futures-channel",
@ -4528,7 +4526,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.37",
"wasm-bindgen-shared",
]
@ -4562,7 +4560,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.37",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]

View File

@ -20,4 +20,5 @@ members = [
"orizentic",
"screenplay",
"sgf",
"nom-training",
]

View File

@ -1,6 +1,6 @@
[package]
name = "dashboard"
version = "0.1.0"
version = "0.1.1"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -110,8 +110,10 @@ pub fn main() {
if let Some(ref gtk_tx) = *core.tx.read().unwrap() {
let _ = gtk_tx.send(Message::Refresh(state.clone()));
}
std::thread::sleep(std::time::Duration::from_secs(60));
} else {
std::thread::sleep(std::time::Duration::from_secs(1));
}
}
}
});
@ -134,8 +136,6 @@ pub fn main() {
Continue(true)
}
});
std::thread::spawn(move || {});
});
let args: Vec<String> = env::args().collect();

View File

@ -501,7 +501,7 @@ mod authdb_test {
let token = AuthToken::from("0000000000");
assert_matches!(db.auth_token(token).await, Ok(None));
assert_matches!(db.authenticate(token).await, Ok(None));
}
#[tokio::test]
@ -514,7 +514,7 @@ mod authdb_test {
.await
.expect("user to be created");
assert_matches!(db.auth_token(token).await, Ok(_));
assert_matches!(db.authenticate(token).await, Ok(_));
}
#[tokio::test]
@ -527,13 +527,13 @@ mod authdb_test {
.await
.expect("user to be created");
let session = db
.auth_token(token)
.authenticate(token)
.await
.expect("token authentication should succeed")
.expect("session token should be found");
assert_matches!(
db.auth_session(session).await,
db.validate_session(session).await,
Ok(Some(username)) => {
assert_eq!(username, Username::from("savanni"));
});

10
nom-training/Cargo.toml Normal file
View File

@ -0,0 +1,10 @@
[package]
name = "nom-training"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
nom = { version = "7" }
cool_asserts = { version = "*" }

122
nom-training/src/lib.rs Normal file
View File

@ -0,0 +1,122 @@
// Write two separate parser functions
// One function returns `impl Parser<>`
// The other function returns `FnMut(I) -> IResult<I, ...`
// Test each with the `map` function and the `parse` function
use nom::{character::complete::digit1, error::ParseError, IResult, Parser};
#[derive(Clone, Copy, Debug, PartialEq)]
struct Container(i32);
#[allow(dead_code)]
fn parse_container_a<'a, E: ParseError<&'a str>>(
mut parser: impl Parser<&'a str, i32, E>,
) -> impl FnMut(&'a str) -> IResult<&'a str, Container, E> {
move |input| {
let (input, value) = parser.parse(input)?;
Ok((input, Container(value)))
}
}
/*
// This form doesn't work. It is not possible in this case to get the ownership
// declarations correct on parser. The reason I would want to do this is for more
// concise representation of parse_container_a. It probably fails because map consumes
// the parser.
fn parse_container_b<'a, E: ParseError<&'a str>, P>(
mut parser: P,
) -> impl Parser<&'a str, Container, E>
where
P: Parser<&'a str, i32, E>,
{
move |input| parser.map(|val| Container(val)).parse(input)
}
*/
#[allow(dead_code)]
fn parse_container_c<'a, E: ParseError<&'a str>>(
parser: impl Parser<&'a str, i32, E>,
) -> impl Parser<&'a str, Container, E> {
parser.map(|val| Container(val))
}
/*
// This form also doesn't work, for the same reason as parse_container_b doesn't work.
fn parse_container_d<'a, E: ParseError<&'a str>>(
parser: impl Parser<&'a str, i32, E>,
) -> impl FnMut(&'a str) -> IResult<&'a str, Container, E> {
|input| parser.map(|val| Container(val)).parse(input)
}
*/
// If I really want to do forms b and d, this works. I do the parser combination before
// creating the resulting function.
#[allow(dead_code)]
fn parse_container_e<'a, E: ParseError<&'a str>>(
parser: impl Parser<&'a str, i32, E>,
) -> impl Parser<&'a str, Container, E> {
let mut parser = parser.map(|val| Container(val));
move |input| parser.parse(input)
}
#[allow(dead_code)]
fn parse_number_a<'a, E: ParseError<&'a str>>() -> impl FnMut(&'a str) -> IResult<&'a str, i32, E> {
parse_number
}
#[allow(dead_code)]
fn parse_number_b<'a, E: ParseError<&'a str>>() -> impl Parser<&'a str, i32, E> {
parse_number
}
#[allow(dead_code)]
fn parse_number<'a, E: ParseError<&'a str>>(input: &'a str) -> IResult<&'a str, i32, E> {
let (input, val) = digit1(input)?;
Ok((input, val.parse::<i32>().unwrap()))
}
#[cfg(test)]
mod tests {
use super::*;
use cool_asserts::assert_matches;
const DATA: &'static str = "15";
#[test]
fn function() {
let resp = parse_number_a::<nom::error::VerboseError<&str>>()
.map(|val| Container(val))
.parse(DATA);
assert_matches!(resp, Ok((_, content)) =>
assert_eq!(content, Container(15))
);
}
#[test]
fn parser() {
let resp = parse_number_b::<nom::error::VerboseError<&str>>()
.map(|val| Container(val))
.parse(DATA);
assert_matches!(resp, Ok((_, content)) =>
assert_eq!(content, Container(15))
);
}
#[test]
fn parser_composition_a() {
let resp =
parse_container_a::<nom::error::VerboseError<&str>>(parse_number_a()).parse(DATA);
assert_matches!(resp, Ok((_, content)) =>
assert_eq!(content, Container(15))
);
}
#[test]
fn parser_composition_c() {
let resp =
parse_container_c::<nom::error::VerboseError<&str>>(parse_number_b()).parse(DATA);
assert_matches!(resp, Ok((_, content)) =>
assert_eq!(content, Container(15))
);
}
}