Compare commits
22 Commits
v0.5.1-dev
...
v0.6.0-60-
Author | SHA1 | Date | |
---|---|---|---|
d7c078d95a | |||
00cada74e2 | |||
9436c9033a
|
|||
85d8f839f1
|
|||
16f633d563
|
|||
0b53eb8208
|
|||
73c8fd2634
|
|||
fa8643e73a
|
|||
2d6b550ae6 | |||
f43bcaa314 | |||
a6ef7d8a62 | |||
bd793db08e | |||
1e95822b5a | |||
228ca67a16 | |||
d3251f935e | |||
569fb632e5 | |||
6aa4c3d741 | |||
97853a42c1 | |||
fdae8056b1 | |||
24aa60cb48 | |||
d8eadb8187 | |||
2b2e96c02d |
@@ -1,9 +1,9 @@
|
|||||||
name: Release Tagging
|
name: Release Tagging
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- devel
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
|
@@ -4,11 +4,9 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- devel
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- devel
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
|
253
Cargo.lock
generated
253
Cargo.lock
generated
@@ -2,6 +2,33 @@
|
|||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 4
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "adler2"
|
||||||
|
version = "2.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "aho-corasick"
|
||||||
|
version = "1.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anyhow"
|
||||||
|
version = "1.0.98"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base64"
|
||||||
|
version = "0.22.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "2.9.0"
|
version = "2.9.0"
|
||||||
@@ -14,12 +41,30 @@ version = "3.19.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
|
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.2.30"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7"
|
||||||
|
dependencies = [
|
||||||
|
"shlex",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crc32fast"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deranged"
|
name = "deranged"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
@@ -30,6 +75,12 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "equivalent"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "errno"
|
name = "errno"
|
||||||
version = "0.3.10"
|
version = "0.3.10"
|
||||||
@@ -46,6 +97,31 @@ version = "2.3.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "flate2"
|
||||||
|
version = "1.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
|
||||||
|
dependencies = [
|
||||||
|
"crc32fast",
|
||||||
|
"miniz_oxide",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "foreign-types"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
||||||
|
dependencies = [
|
||||||
|
"foreign-types-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "foreign-types-shared"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
@@ -58,24 +134,60 @@ dependencies = [
|
|||||||
"wasi",
|
"wasi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.15.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "icarus_models"
|
name = "icarus_models"
|
||||||
version = "0.5.1"
|
version = "0.6.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"josekit",
|
||||||
"rand",
|
"rand",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"time",
|
"time",
|
||||||
|
"utoipa",
|
||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indexmap"
|
||||||
|
version = "2.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"
|
||||||
|
dependencies = [
|
||||||
|
"equivalent",
|
||||||
|
"hashbrown",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.15"
|
version = "1.0.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "josekit"
|
||||||
|
version = "0.10.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a808e078330e6af222eb0044b71d4b1ff981bfef43e7bc8133a88234e0c86a0c"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"base64",
|
||||||
|
"flate2",
|
||||||
|
"openssl",
|
||||||
|
"regex",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"thiserror",
|
||||||
|
"time",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js-sys"
|
name = "js-sys"
|
||||||
version = "0.3.77"
|
version = "0.3.77"
|
||||||
@@ -110,6 +222,15 @@ version = "2.7.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "miniz_oxide"
|
||||||
|
version = "0.8.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
||||||
|
dependencies = [
|
||||||
|
"adler2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-conv"
|
name = "num-conv"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@@ -122,6 +243,50 @@ version = "1.21.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl"
|
||||||
|
version = "0.10.73"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"cfg-if",
|
||||||
|
"foreign-types",
|
||||||
|
"libc",
|
||||||
|
"once_cell",
|
||||||
|
"openssl-macros",
|
||||||
|
"openssl-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-macros"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-sys"
|
||||||
|
version = "0.9.109"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"libc",
|
||||||
|
"pkg-config",
|
||||||
|
"vcpkg",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pkg-config"
|
||||||
|
version = "0.3.32"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "powerfmt"
|
name = "powerfmt"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
@@ -190,6 +355,35 @@ dependencies = [
|
|||||||
"getrandom",
|
"getrandom",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex"
|
||||||
|
version = "1.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
||||||
|
dependencies = [
|
||||||
|
"aho-corasick",
|
||||||
|
"memchr",
|
||||||
|
"regex-automata",
|
||||||
|
"regex-syntax",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex-automata"
|
||||||
|
version = "0.4.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
||||||
|
dependencies = [
|
||||||
|
"aho-corasick",
|
||||||
|
"memchr",
|
||||||
|
"regex-syntax",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex-syntax"
|
||||||
|
version = "0.8.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "1.0.3"
|
version = "1.0.3"
|
||||||
@@ -241,12 +435,19 @@ version = "1.0.140"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
|
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"indexmap",
|
||||||
"itoa",
|
"itoa",
|
||||||
"memchr",
|
"memchr",
|
||||||
"ryu",
|
"ryu",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shlex"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.100"
|
version = "2.0.100"
|
||||||
@@ -271,6 +472,26 @@ dependencies = [
|
|||||||
"windows-sys",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror"
|
||||||
|
version = "2.0.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
|
||||||
|
dependencies = [
|
||||||
|
"thiserror-impl",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror-impl"
|
||||||
|
version = "2.0.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
version = "0.3.41"
|
version = "0.3.41"
|
||||||
@@ -308,6 +529,30 @@ version = "1.0.18"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "utoipa"
|
||||||
|
version = "5.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2fcc29c80c21c31608227e0912b2d7fddba57ad76b606890627ba8ee7964e993"
|
||||||
|
dependencies = [
|
||||||
|
"indexmap",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"utoipa-gen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "utoipa-gen"
|
||||||
|
version = "5.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6d79d08d92ab8af4c5e8a6da20c47ae3f61a0f1dabc1997cdf2d082b757ca08b"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"uuid",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uuid"
|
name = "uuid"
|
||||||
version = "1.17.0"
|
version = "1.17.0"
|
||||||
@@ -320,6 +565,12 @@ dependencies = [
|
|||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "vcpkg"
|
||||||
|
version = "0.2.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.14.2+wasi-0.2.4"
|
version = "0.14.2+wasi-0.2.4"
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "icarus_models"
|
name = "icarus_models"
|
||||||
version = "0.5.1"
|
version = "0.6.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.88"
|
rust-version = "1.88"
|
||||||
description = "models used for the icarus project"
|
description = "models used for the icarus project"
|
||||||
@@ -12,6 +12,8 @@ serde_json = { version = "1.0.140" }
|
|||||||
rand = { version = "0.9.1" }
|
rand = { version = "0.9.1" }
|
||||||
time = { version = "0.3.41", features = ["formatting", "macros", "parsing", "serde"] }
|
time = { version = "0.3.41", features = ["formatting", "macros", "parsing", "serde"] }
|
||||||
uuid = { version = "1.17.0", features = ["v4", "serde"] }
|
uuid = { version = "1.17.0", features = ["v4", "serde"] }
|
||||||
|
josekit = { version = "0.10.3" }
|
||||||
|
utoipa = { version = "5.4.0", features = ["uuid", "time"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = { version = "3.20.0" }
|
tempfile = { version = "3.20.0" }
|
||||||
|
@@ -2,7 +2,7 @@ use std::default::Default;
|
|||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize, utoipa::ToSchema)]
|
||||||
pub struct AccessLevel {
|
pub struct AccessLevel {
|
||||||
pub id: uuid::Uuid,
|
pub id: uuid::Uuid,
|
||||||
pub level: String,
|
pub level: String,
|
||||||
|
@@ -2,10 +2,11 @@ use std::io::Read;
|
|||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize, utoipa::ToSchema)]
|
||||||
pub struct CoverArt {
|
pub struct CoverArt {
|
||||||
pub id: uuid::Uuid,
|
pub id: uuid::Uuid,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
|
#[serde(skip)]
|
||||||
pub path: String,
|
pub path: String,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub data: Vec<u8>,
|
pub data: Vec<u8>,
|
||||||
@@ -36,6 +37,9 @@ impl CoverArt {
|
|||||||
Err(err) => Err(err),
|
Err(err) => Err(err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Add method to save to filesystem
|
||||||
|
// TODO: Add method to remove from filesystem
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@@ -2,7 +2,7 @@ use std::default::Default;
|
|||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize, utoipa::ToSchema)]
|
||||||
pub struct LoginResult {
|
pub struct LoginResult {
|
||||||
pub id: uuid::Uuid,
|
pub id: uuid::Uuid,
|
||||||
pub username: String,
|
pub username: String,
|
||||||
|
99
src/song.rs
99
src/song.rs
@@ -1,13 +1,13 @@
|
|||||||
use std::io::Read;
|
use std::io::Write;
|
||||||
|
|
||||||
|
use rand::Rng;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::constants;
|
use crate::constants;
|
||||||
use crate::init;
|
use crate::init;
|
||||||
use crate::types;
|
use crate::types;
|
||||||
|
|
||||||
use rand::Rng;
|
#[derive(Clone, Debug, Default, Deserialize, Serialize, utoipa::ToSchema)]
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
|
||||||
pub struct Song {
|
pub struct Song {
|
||||||
#[serde(skip_serializing_if = "init::is_uuid_nil")]
|
#[serde(skip_serializing_if = "init::is_uuid_nil")]
|
||||||
#[serde(alias = "id")]
|
#[serde(alias = "id")]
|
||||||
@@ -90,25 +90,7 @@ impl Song {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_data(&self) -> Result<Vec<u8>, std::io::Error> {
|
// TODO: Make this available as a function
|
||||||
let path_result = self.song_path();
|
|
||||||
|
|
||||||
match path_result {
|
|
||||||
Ok(path) => {
|
|
||||||
let mut file = std::fs::File::open(path)?;
|
|
||||||
let mut buffer: Vec<u8> = Vec::new();
|
|
||||||
file.read_to_end(&mut buffer)?;
|
|
||||||
|
|
||||||
if buffer.is_empty() {
|
|
||||||
Err(std::io::Error::other("File is empty"))
|
|
||||||
} else {
|
|
||||||
Ok(buffer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(er) => Err(er),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn generate_filename(&self, typ: types::MusicTypes, randomize: bool) -> String {
|
pub fn generate_filename(&self, typ: types::MusicTypes, randomize: bool) -> String {
|
||||||
let mut filename: String = String::new();
|
let mut filename: String = String::new();
|
||||||
let filename_len = 10;
|
let filename_len = 10;
|
||||||
@@ -150,4 +132,73 @@ impl Song {
|
|||||||
|
|
||||||
filename
|
filename
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Saves the song to the filesystem using the song's data
|
||||||
|
pub fn save_to_filesystem(&self) -> Result<(), std::io::Error> {
|
||||||
|
match self.song_path() {
|
||||||
|
Ok(song_path) => match std::fs::File::create(&song_path) {
|
||||||
|
Ok(mut file) => match file.write_all(&self.data) {
|
||||||
|
Ok(_res) => Ok(()),
|
||||||
|
Err(err) => Err(err),
|
||||||
|
},
|
||||||
|
Err(err) => Err(err),
|
||||||
|
},
|
||||||
|
Err(err) => Err(err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Add function to remove file from the filesystem
|
||||||
|
}
|
||||||
|
|
||||||
|
/// I/O operations for songs
|
||||||
|
pub mod io {
|
||||||
|
use std::io::Read;
|
||||||
|
|
||||||
|
/// Copies a song using the source song's data
|
||||||
|
pub fn copy_song(
|
||||||
|
song_source: &super::Song,
|
||||||
|
song_target: &mut super::Song,
|
||||||
|
) -> Result<(), std::io::Error> {
|
||||||
|
match song_target.song_path() {
|
||||||
|
Ok(songpath) => {
|
||||||
|
let p = std::path::Path::new(&songpath);
|
||||||
|
if p.exists() {
|
||||||
|
Err(std::io::Error::other(
|
||||||
|
"Cannot copy song over to one that already exists",
|
||||||
|
))
|
||||||
|
} else {
|
||||||
|
if song_target.data.is_empty() {
|
||||||
|
song_target.data = song_source.data.clone();
|
||||||
|
} else {
|
||||||
|
song_target.data.clear();
|
||||||
|
song_target.data = song_source.data.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
match song_target.save_to_filesystem() {
|
||||||
|
Ok(_) => Ok(()),
|
||||||
|
Err(err) => Err(err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => Err(err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets the raw file data of a song from the filesystem
|
||||||
|
pub fn to_data(song: &super::Song) -> Result<Vec<u8>, std::io::Error> {
|
||||||
|
match song.song_path() {
|
||||||
|
Ok(path) => {
|
||||||
|
let mut file = std::fs::File::open(path)?;
|
||||||
|
let mut buffer: Vec<u8> = Vec::new();
|
||||||
|
file.read_to_end(&mut buffer)?;
|
||||||
|
|
||||||
|
if buffer.is_empty() {
|
||||||
|
Err(std::io::Error::other("File is empty"))
|
||||||
|
} else {
|
||||||
|
Ok(buffer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(er) => Err(er),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
118
src/token.rs
118
src/token.rs
@@ -62,10 +62,87 @@ impl Token {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_issued() -> time::Result<time::OffsetDateTime> {
|
||||||
|
Ok(time::OffsetDateTime::now_utc())
|
||||||
|
}
|
||||||
|
|
||||||
|
mod util {
|
||||||
|
pub fn time_to_std_time(
|
||||||
|
provided_time: &time::OffsetDateTime,
|
||||||
|
) -> Result<std::time::SystemTime, std::time::SystemTimeError> {
|
||||||
|
let converted = std::time::SystemTime::from(*provided_time);
|
||||||
|
Ok(converted)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct TokenResource {
|
||||||
|
pub message: String,
|
||||||
|
pub issuer: String,
|
||||||
|
pub audiences: Vec<String>,
|
||||||
|
pub id: uuid::Uuid,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const TOKEN_TYPE: &str = "JWT";
|
||||||
|
|
||||||
|
pub fn create_token(
|
||||||
|
key: &String,
|
||||||
|
token_resource: &TokenResource,
|
||||||
|
duration: time::Duration,
|
||||||
|
) -> Result<(String, i64), josekit::JoseError> {
|
||||||
|
let mut header = josekit::jws::JwsHeader::new();
|
||||||
|
header.set_token_type(TOKEN_TYPE);
|
||||||
|
|
||||||
|
let mut payload = josekit::jwt::JwtPayload::new();
|
||||||
|
let message = &token_resource.message;
|
||||||
|
let issuer = &token_resource.issuer;
|
||||||
|
let audiences: &Vec<String> = &token_resource.audiences;
|
||||||
|
payload.set_subject(message);
|
||||||
|
payload.set_issuer(issuer);
|
||||||
|
payload.set_audience(audiences.clone());
|
||||||
|
if !token_resource.id.is_nil() {
|
||||||
|
match payload.set_claim("id", Some(serde_json::json!(token_resource.id))) {
|
||||||
|
Ok(_) => {}
|
||||||
|
Err(err) => {
|
||||||
|
return Err(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
match get_issued() {
|
||||||
|
Ok(issued) => {
|
||||||
|
let expire = issued + duration;
|
||||||
|
payload.set_issued_at(&util::time_to_std_time(&issued).unwrap());
|
||||||
|
payload.set_expires_at(&util::time_to_std_time(&expire).unwrap());
|
||||||
|
|
||||||
|
let signer = josekit::jws::alg::hmac::HmacJwsAlgorithm::Hs256
|
||||||
|
.signer_from_bytes(key.as_bytes())
|
||||||
|
.unwrap();
|
||||||
|
Ok((
|
||||||
|
josekit::jwt::encode_with_signer(&payload, &header, &signer).unwrap(),
|
||||||
|
(expire - time::OffsetDateTime::UNIX_EPOCH).whole_seconds(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
Err(e) => Err(josekit::JoseError::InvalidClaim(e.into())),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
fn test_key() -> String {
|
||||||
|
String::from("c3092urmc2219ix320i40m293ic29IM09IN0u879Y8B98YB8yb86TN7B55R4yv4RCVU6Bi8YO8U")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_resource() -> TokenResource {
|
||||||
|
TokenResource {
|
||||||
|
issuer: String::from("icarus_auth_test"),
|
||||||
|
message: String::from("Authorization"),
|
||||||
|
audiences: vec![String::from("icarus_test")],
|
||||||
|
id: uuid::Uuid::nil(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_token_scope_check() {
|
fn test_token_scope_check() {
|
||||||
let mut token = Token::default();
|
let mut token = Token::default();
|
||||||
@@ -80,4 +157,45 @@ mod tests {
|
|||||||
check_scope, token.scope
|
check_scope, token.scope
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_token_creation() {
|
||||||
|
let key = test_key();
|
||||||
|
let test_token_resource = test_resource();
|
||||||
|
let token_expiration_duration = time::Duration::hours(2);
|
||||||
|
|
||||||
|
match create_token(&key, &test_token_resource, token_expiration_duration) {
|
||||||
|
Ok((token, expire_duration)) => {
|
||||||
|
assert_eq!(false, token.is_empty(), "Error: Token is empty");
|
||||||
|
assert!(
|
||||||
|
expire_duration > 0,
|
||||||
|
"Token expire duration is invalid {expire_duration:?}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
assert!(false, "Error: {err:?}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_token_creation_with_id() {
|
||||||
|
let key = test_key();
|
||||||
|
let mut test_token_resource = test_resource();
|
||||||
|
test_token_resource.id = uuid::Uuid::new_v4();
|
||||||
|
let token_expiration_duration = time::Duration::hours(2);
|
||||||
|
|
||||||
|
match create_token(&key, &test_token_resource, token_expiration_duration) {
|
||||||
|
Ok((token, expire_duration)) => {
|
||||||
|
assert_eq!(false, token.is_empty(), "Error: Token is empty");
|
||||||
|
assert!(
|
||||||
|
expire_duration > 0,
|
||||||
|
"Token expire duration is invalid {expire_duration:?}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
assert!(false, "Error: {err:?}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@ use crate::init;
|
|||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize, utoipa::ToSchema)]
|
||||||
pub struct User {
|
pub struct User {
|
||||||
#[serde(skip_serializing_if = "init::is_uuid_nil")]
|
#[serde(skip_serializing_if = "init::is_uuid_nil")]
|
||||||
pub id: uuid::Uuid,
|
pub id: uuid::Uuid,
|
||||||
|
@@ -30,16 +30,12 @@ mod utils {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod song_tests {
|
mod song_tests {
|
||||||
use std::fs::File;
|
|
||||||
use std::io::Write;
|
|
||||||
|
|
||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
|
|
||||||
|
use crate::utils;
|
||||||
use icarus_models::song;
|
use icarus_models::song;
|
||||||
use icarus_models::types;
|
use icarus_models::types;
|
||||||
|
|
||||||
use crate::utils;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_song_to_data() {
|
fn test_song_to_data() {
|
||||||
println!("Test");
|
println!("Test");
|
||||||
@@ -65,7 +61,7 @@ mod song_tests {
|
|||||||
Ok(buffer) => {
|
Ok(buffer) => {
|
||||||
assert_eq!(buffer.is_empty(), false);
|
assert_eq!(buffer.is_empty(), false);
|
||||||
|
|
||||||
match song.to_data() {
|
match song::io::to_data(&song) {
|
||||||
Ok(song_data) => {
|
Ok(song_data) => {
|
||||||
println!("Both files match");
|
println!("Both files match");
|
||||||
assert_eq!(buffer, song_data);
|
assert_eq!(buffer, song_data);
|
||||||
@@ -103,50 +99,42 @@ mod song_tests {
|
|||||||
song.directory = utils::get_tests_directory();
|
song.directory = utils::get_tests_directory();
|
||||||
song.filename = String::from("track01.flac");
|
song.filename = String::from("track01.flac");
|
||||||
|
|
||||||
match song.song_path() {
|
let mut song_cpy = song.clone();
|
||||||
Ok(songpath) => match utils::extract_data_from_file(&songpath) {
|
let temp_dir = tempdir().expect("Failed to create temp dir");
|
||||||
Ok(buffer) => {
|
song_cpy.directory = match temp_dir.path().to_str() {
|
||||||
let mut song_cpy = song.clone();
|
Some(s) => String::from(s),
|
||||||
let temp_dir = tempdir().expect("Failed to create temp dir");
|
None => String::new(),
|
||||||
song_cpy.directory = match temp_dir.path().to_str() {
|
};
|
||||||
Some(s) => String::from(s),
|
|
||||||
None => String::new(),
|
|
||||||
};
|
|
||||||
|
|
||||||
assert_eq!(song.directory.is_empty(), false);
|
assert_eq!(song.directory.is_empty(), false);
|
||||||
song_cpy.filename =
|
song_cpy.filename = song.generate_filename(types::MusicTypes::FlacExtension, true);
|
||||||
song.generate_filename(types::MusicTypes::FlacExtension, true);
|
println!("Directory: {:?}", song_cpy.directory);
|
||||||
println!("Directory: {:?}", song_cpy.directory);
|
println!("File to be created: {:?}", song_cpy.filename);
|
||||||
println!("File to be created: {:?}", song_cpy.filename);
|
|
||||||
|
|
||||||
let path = match song_cpy.song_path() {
|
match song::io::copy_song(&song, &mut song_cpy) {
|
||||||
Ok(s_path) => s_path,
|
Ok(_) => {}
|
||||||
Err(err) => {
|
|
||||||
assert!(false, "Error: {:?}", err);
|
|
||||||
String::new()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
match File::create(path) {
|
|
||||||
Ok(mut file_cpy) => match file_cpy.write_all(&buffer) {
|
|
||||||
Ok(success) => {
|
|
||||||
println!("Success: {:?}", success);
|
|
||||||
}
|
|
||||||
Err(err) => {
|
|
||||||
assert!(false, "Error saving file: {:?}", err);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Err(err) => {
|
|
||||||
assert!(false, "Error: {:?}", err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Err(err) => {
|
|
||||||
assert!(false, "Error: {:?}", err);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
assert!(false, "Error extracting song data: {:?}", err);
|
assert!(false, "Error copying song: Error: {err:?}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_save_song_to_filesystem() {
|
||||||
|
let mut song = song::Song::default();
|
||||||
|
song.directory = utils::get_tests_directory();
|
||||||
|
song.filename = String::from("track02.flac");
|
||||||
|
|
||||||
|
let mut copied_song = song::Song {
|
||||||
|
directory: utils::get_tests_directory(),
|
||||||
|
filename: String::from("track02-coppied.flac"),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
match song::io::copy_song(&song, &mut copied_song) {
|
||||||
|
Ok(_) => {}
|
||||||
|
Err(err) => {
|
||||||
|
assert!(false, "Error: {err:?}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user