Compare commits
2 commits
58cfce0eb6
...
01e9d4818b
Author | SHA1 | Date | |
---|---|---|---|
Gabriel Simmer | 01e9d4818b | ||
Gabriel Simmer | 86bf19f068 |
|
@ -5,7 +5,27 @@ on:
|
|||
- trunk
|
||||
|
||||
jobs:
|
||||
nix-flake-check:
|
||||
runs-on: debian-latest
|
||||
steps:
|
||||
- name: Install prerequisites
|
||||
run: apt update && apt install -y sudo
|
||||
- name: Install Nix
|
||||
uses: https://github.com/cachix/install-nix-action@v22
|
||||
with:
|
||||
extra_nix_config: "experimental-features = nix-command flakes"
|
||||
nix_path: nixpkgs=channel:nixos-23.05
|
||||
- name: Remove access_tokens
|
||||
run: sed -i '/^access-tokens/d' /etc/nix/nix.conf
|
||||
- name: Check out repository
|
||||
uses: https://github.com/RouxAntoine/checkout@v3.5.4
|
||||
with:
|
||||
ref: trunk
|
||||
- name: Check codebase
|
||||
run: nix flake check -L
|
||||
|
||||
arm-docker-build:
|
||||
needs: nix-flake-check
|
||||
runs-on: debian-latest-arm
|
||||
steps:
|
||||
- name: Install prerequisites
|
185
Cargo.lock
generated
185
Cargo.lock
generated
|
@ -17,6 +17,25 @@ version = "1.0.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "assert-json-diff"
|
||||
version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47e4f2b81832e72834d7518d8487a0396a28cc408186a2e8854c0f98011faf12"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.71"
|
||||
|
@ -42,7 +61,7 @@ checksum = "f8175979259124331c1d7bf6586ee7e0da434155e4b2d48ec2c8386281d8df39"
|
|||
dependencies = [
|
||||
"async-trait",
|
||||
"axum-core",
|
||||
"bitflags",
|
||||
"bitflags 1.3.2",
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http",
|
||||
|
@ -129,6 +148,12 @@ version = "1.3.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.13.0"
|
||||
|
@ -153,6 +178,17 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "colored"
|
||||
version = "2.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6"
|
||||
dependencies = [
|
||||
"is-terminal",
|
||||
"lazy_static",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.3"
|
||||
|
@ -177,6 +213,7 @@ dependencies = [
|
|||
"axum-extra",
|
||||
"futures",
|
||||
"maud",
|
||||
"mockito",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
@ -341,6 +378,17 @@ dependencies = [
|
|||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.27.3"
|
||||
|
@ -501,6 +549,17 @@ version = "2.8.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6"
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"rustix 0.38.4",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.9"
|
||||
|
@ -534,6 +593,12 @@ version = "0.3.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.10"
|
||||
|
@ -620,6 +685,26 @@ dependencies = [
|
|||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mockito"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09c762b6267c4593555bb38f1df19e9318985bc4de60b5e8462890856a9a5b4c"
|
||||
dependencies = [
|
||||
"assert-json-diff",
|
||||
"colored",
|
||||
"futures",
|
||||
"hyper",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"rand",
|
||||
"regex",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"similar",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "native-tls"
|
||||
version = "0.2.11"
|
||||
|
@ -669,7 +754,7 @@ version = "0.10.55"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 1.3.2",
|
||||
"cfg-if",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
|
@ -774,6 +859,12 @@ version = "0.3.27"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "1.0.4"
|
||||
|
@ -816,15 +907,74 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2"
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.11.18"
|
||||
|
@ -874,11 +1024,24 @@ version = "0.37.23"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 1.3.2",
|
||||
"errno",
|
||||
"io-lifetimes",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"linux-raw-sys 0.3.8",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5"
|
||||
dependencies = [
|
||||
"bitflags 2.3.3",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys 0.4.3",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
|
@ -915,7 +1078,7 @@ version = "2.9.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
|
@ -994,6 +1157,12 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "similar"
|
||||
version = "2.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf"
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.8"
|
||||
|
@ -1057,7 +1226,7 @@ dependencies = [
|
|||
"cfg-if",
|
||||
"fastrand",
|
||||
"redox_syscall",
|
||||
"rustix",
|
||||
"rustix 0.37.23",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
|
@ -1153,7 +1322,7 @@ version = "0.3.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 1.3.2",
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
|
|
|
@ -12,3 +12,4 @@ axum-extra = { version = "0.4.2", features = ["spa"] }
|
|||
reqwest = { version = "0.11", features = ["json"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
mockito = "1.1.0"
|
107
flake.lock
107
flake.lock
|
@ -6,11 +6,11 @@
|
|||
"utils": "utils"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1667763126,
|
||||
"narHash": "sha256-wKn3q3hICvEfs0m3CaeJmLCSyWVuVw/5LgDdh3QSXkU=",
|
||||
"lastModified": 1682266158,
|
||||
"narHash": "sha256-VK66KyF1doJ24yktb9rp7Yv7auS6i0P8EnJLhFOz+jY=",
|
||||
"owner": "Xe",
|
||||
"repo": "Xess",
|
||||
"rev": "882799a25ce4fa4df014ad701aaa5a9b23ff9e85",
|
||||
"rev": "3a85d1de06cd3420b4d56a8edd72cd57e6f0806e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -19,6 +19,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"advisory-db": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1689698236,
|
||||
"narHash": "sha256-Qz9JxGKeA3jwuj1CdK9ejMJ7VsJRdiZniF8lx4mft9s=",
|
||||
"owner": "rustsec",
|
||||
"repo": "advisory-db",
|
||||
"rev": "4aa517564d1d06f0e79784c8ad973a59d68aa9c8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rustsec",
|
||||
"repo": "advisory-db",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"crane": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
|
@ -29,11 +45,11 @@
|
|||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1668993159,
|
||||
"narHash": "sha256-9BVTtPFrHRh0HbeEm2bmXsoIWRj1tKM6Nvfl7VMK/X8=",
|
||||
"lastModified": 1688772518,
|
||||
"narHash": "sha256-ol7gZxwvgLnxNSZwFTDJJ49xVY5teaSvF7lzlo3YQfM=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "c61d98aaea5667607a36bafe5a6fa87fe5bb2c7e",
|
||||
"rev": "8b08e96c9af8c6e3a2b69af5a7fa168750fcf88e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -45,11 +61,11 @@
|
|||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1650374568,
|
||||
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -59,12 +75,15 @@
|
|||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"lastModified": 1687709756,
|
||||
"narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -74,12 +93,15 @@
|
|||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"lastModified": 1689068808,
|
||||
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -90,11 +112,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1640319671,
|
||||
"narHash": "sha256-ZkKmakwaOaLiZOpIZWbeJZwap5CzJ30s4UJTfydYIYc=",
|
||||
"lastModified": 1678898370,
|
||||
"narHash": "sha256-xTICr1j+uat5hk9FyuPOFGxpWHdJRibwZC+ATi0RbtE=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "eac07edbd20ed4908b98790ba299250b5527ecdf",
|
||||
"rev": "ac718d02867a84b42522a0ece52d841188208f2c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -106,11 +128,11 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1669507072,
|
||||
"narHash": "sha256-RQAHgHM7wfgUTWbEjb8Ki43tQUUcwIg1Ra+PNustAVI=",
|
||||
"lastModified": 1689631193,
|
||||
"narHash": "sha256-AGSkBZaiTODQc8eT1rZDrQIjtb8JtFwJ0wVPzArlrnM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9e6b054555c9b10310543cd213ce7c70bb0cbc5f",
|
||||
"rev": "57695599bdc4f7bfe5d28cfa23f14b3d8bdf8a5f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -123,6 +145,7 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"Xess": "Xess",
|
||||
"advisory-db": "advisory-db",
|
||||
"crane": "crane",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
|
@ -140,11 +163,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1667487142,
|
||||
"narHash": "sha256-bVuzLs1ZVggJAbJmEDVO9G6p8BH3HRaolK70KXvnWnU=",
|
||||
"lastModified": 1688351637,
|
||||
"narHash": "sha256-CLTufJ29VxNOIZ8UTg0lepsn3X03AmopmaLTTeHDCL4=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "cf668f737ac986c0a89e83b6b2e3c5ddbd8cf33b",
|
||||
"rev": "f9b92316727af9e6c7fee4a761242f7f46880329",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -153,13 +176,43 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"locked": {
|
||||
"lastModified": 1638122382,
|
||||
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
|
||||
"lastModified": 1678901627,
|
||||
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
|
||||
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
51
flake.nix
51
flake.nix
|
@ -12,29 +12,41 @@
|
|||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
Xess.url = "github:Xe/Xess";
|
||||
|
||||
advisory-db = {
|
||||
url = "github:rustsec/advisory-db";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, crane, flake-utils, Xess, ... }:
|
||||
outputs = { self, nixpkgs, crane, flake-utils, Xess, advisory-db, ... }:
|
||||
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
|
||||
inherit (pkgs) lib;
|
||||
|
||||
craneLib = crane.lib.${system};
|
||||
dref = craneLib.buildPackage {
|
||||
src = craneLib.cleanCargoSource ./.;
|
||||
src = craneLib.cleanCargoSource (craneLib.path ./.);
|
||||
commonArgs = {
|
||||
inherit src;
|
||||
|
||||
buildInputs = [
|
||||
# Add additional build inputs here
|
||||
pkgs.openssl
|
||||
pkgs.pkg-config
|
||||
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
|
||||
# Additional darwin specific inputs can be set here
|
||||
pkgs.libiconv
|
||||
];
|
||||
};
|
||||
|
||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||
|
||||
dref = craneLib.buildPackage (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
});
|
||||
|
||||
dockerImage = pkgs.dockerTools.buildImage {
|
||||
name = "dref";
|
||||
config = {
|
||||
|
@ -48,6 +60,35 @@
|
|||
{
|
||||
checks = {
|
||||
inherit dref;
|
||||
dref-clippy = craneLib.cargoClippy (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
||||
});
|
||||
|
||||
dref-doc = craneLib.cargoDoc (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
});
|
||||
|
||||
dref-fmt = craneLib.cargoFmt {
|
||||
inherit src;
|
||||
};
|
||||
|
||||
dref-audit = craneLib.cargoAudit {
|
||||
inherit src advisory-db;
|
||||
};
|
||||
|
||||
# Run tests with cargo-nextest
|
||||
# Consider setting `doCheck = false` on `dref` if you do not want
|
||||
# the tests to run twice
|
||||
dref-nextest = craneLib.cargoNextest (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
partitions = 1;
|
||||
partitionType = "count";
|
||||
});
|
||||
} // lib.optionalAttrs (system == "x86_64-linux") {
|
||||
dref-coverage = craneLib.cargoTarpaulin (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
});
|
||||
};
|
||||
|
||||
apps.default = flake-utils.lib.mkApp {
|
||||
|
|
12
src/css.rs
12
src/css.rs
|
@ -1,4 +1,4 @@
|
|||
use std::{error::Error, path::Path, fs};
|
||||
use std::{error::Error, fs, path::Path};
|
||||
|
||||
const XESS: &str = r#"
|
||||
/* XESS by Xe https://github.com/Xe/Xess/blob/master/LICENSE */
|
||||
|
@ -138,9 +138,9 @@ hr {
|
|||
/// Returns either the plain XESS template with aoi theme or
|
||||
/// concats it with the contents of the theme.css file.
|
||||
pub fn render_css() -> Result<String, Box<dyn Error>> {
|
||||
if Path::new("theme.css").exists() {
|
||||
let theme: String = fs::read_to_string("theme.css")?.parse()?;
|
||||
return Ok(format!("{}{}", XESS, theme).replace("\n", ""))
|
||||
}
|
||||
Ok(XESS.to_string().replace("\n", ""))
|
||||
if Path::new("theme.css").exists() {
|
||||
let theme: String = fs::read_to_string("theme.css")?.parse()?;
|
||||
return Ok(format!("{}{}", XESS, theme).replace('\n', ""));
|
||||
}
|
||||
Ok(XESS.to_string().replace('\n', ""))
|
||||
}
|
||||
|
|
99
src/lib.rs
99
src/lib.rs
|
@ -1,58 +1,85 @@
|
|||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
use std::{boxed, error};
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Registry {
|
||||
pub url: String,
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Image {
|
||||
pub name: String,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RichTag {
|
||||
pub name: String,
|
||||
architectures: Vec<String>
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Tags {
|
||||
name: String,
|
||||
tags: Vec<String>
|
||||
tags: Vec<String>,
|
||||
}
|
||||
|
||||
impl Registry {
|
||||
pub async fn images(&self) -> Result<Vec<Image>, boxed::Box<dyn error::Error>> {
|
||||
let resq_url = format!("{}/v2/_catalog", self.url);
|
||||
let resp = reqwest::get(resq_url)
|
||||
.await?
|
||||
.json::<HashMap<String, Vec<String>>>()
|
||||
.await?;
|
||||
let i = resp.get("repositories").unwrap().into_iter().map(|i| async {
|
||||
Image{
|
||||
name: i.to_string(),
|
||||
}
|
||||
});
|
||||
let images: Vec<Image> = futures::future::join_all(i).await;
|
||||
Ok(images)
|
||||
}
|
||||
pub async fn image_tags(&self, image: String) -> Result<Vec<RichTag>, boxed::Box<dyn error::Error>> {
|
||||
let resq_url = format!("{}/v2/{}/tags/list", self.url, image);
|
||||
let resp: Tags = reqwest::get(resq_url)
|
||||
.await?
|
||||
.json::<Tags>()
|
||||
.await?;
|
||||
let i = resp.tags.into_iter().map(|i| async move {
|
||||
RichTag{
|
||||
name: i.to_string(),
|
||||
architectures: Vec::new(),
|
||||
}
|
||||
});
|
||||
let tags: Vec<RichTag> = futures::future::join_all(i).await;
|
||||
Ok(tags)
|
||||
}
|
||||
pub async fn images(&self) -> Result<Vec<Image>, boxed::Box<dyn error::Error>> {
|
||||
let resq_url = format!("{}/v2/_catalog", self.url);
|
||||
let resp = reqwest::get(resq_url)
|
||||
.await?
|
||||
.json::<HashMap<String, Vec<String>>>()
|
||||
.await?;
|
||||
let i = resp.get("repositories").unwrap().iter().map(|i| async {
|
||||
Image {
|
||||
name: i.to_string(),
|
||||
}
|
||||
});
|
||||
let images: Vec<Image> = futures::future::join_all(i).await;
|
||||
Ok(images)
|
||||
}
|
||||
pub async fn image_tags(
|
||||
&self,
|
||||
image: String,
|
||||
) -> Result<Vec<RichTag>, boxed::Box<dyn error::Error>> {
|
||||
let resq_url = format!("{}/v2/{}/tags/list", self.url, image);
|
||||
let resp: Tags = reqwest::get(resq_url).await?.json::<Tags>().await?;
|
||||
let i = resp.tags.iter().map(|i| async move {
|
||||
RichTag {
|
||||
name: i.to_string(),
|
||||
}
|
||||
});
|
||||
let tags: Vec<RichTag> = futures::future::join_all(i).await;
|
||||
Ok(tags)
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_registry() {
|
||||
// Request a new server from the pool
|
||||
let mut server = mockito::Server::new_async().await;
|
||||
|
||||
// Use one of these addresses to configure your client
|
||||
let _host = server.host_with_port();
|
||||
let url = server.url();
|
||||
|
||||
// Create a mock
|
||||
let mock = server
|
||||
.mock("GET", "/v2/_catalog")
|
||||
.with_status(201)
|
||||
.with_header("content-type", "application/json")
|
||||
.with_body(r#"{"repositories": ["dref"]}"#)
|
||||
.create_async()
|
||||
.await;
|
||||
|
||||
let registry = Registry { url };
|
||||
|
||||
let response = registry.images().await;
|
||||
let images = match response {
|
||||
Ok(i) => i,
|
||||
Err(_) => Vec::new(),
|
||||
};
|
||||
|
||||
assert_eq!(images.first().unwrap().name, "dref");
|
||||
|
||||
mock.assert();
|
||||
}
|
||||
|
|
87
src/main.rs
87
src/main.rs
|
@ -1,28 +1,28 @@
|
|||
mod css;
|
||||
|
||||
use std::{boxed, error, env, collections::{HashMap, self}};
|
||||
use axum::{extract::State, response::IntoResponse, routing::get, Router};
|
||||
use maud::{html, Markup, DOCTYPE};
|
||||
use axum::{Router, routing::get, response::IntoResponse, extract::State};
|
||||
use dref;
|
||||
use std::env;
|
||||
|
||||
#[derive(Clone)]
|
||||
struct AppState {
|
||||
registry: dref::Registry
|
||||
registry: dref::Registry,
|
||||
}
|
||||
|
||||
#[tokio::main(flavor = "multi_thread", worker_threads = 10)]
|
||||
async fn main() {
|
||||
let registry = dref::Registry{
|
||||
url: env::var("DREF_REGISTRY").unwrap(),
|
||||
};
|
||||
let state = AppState {registry};
|
||||
let registry = dref::Registry {
|
||||
url: env::var("DREF_REGISTRY").unwrap(),
|
||||
};
|
||||
let state = AppState { registry };
|
||||
// build our application with a single route
|
||||
let app = Router::new()
|
||||
.route("/", get(root)).route("/styles.css", get(css))
|
||||
.with_state(state);
|
||||
.route("/", get(root))
|
||||
.route("/styles.css", get(css))
|
||||
.with_state(state);
|
||||
|
||||
// run it with hyper on localhost:3000
|
||||
println!("Running webserver on port :3000");
|
||||
println!("Running webserver on port :3000");
|
||||
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
|
||||
.serve(app.into_make_service())
|
||||
.await
|
||||
|
@ -30,19 +30,22 @@ async fn main() {
|
|||
}
|
||||
|
||||
async fn css() -> impl IntoResponse {
|
||||
([("Content-Type", "text/css")], match css::render_css() {
|
||||
Ok(css) => css,
|
||||
Err(_) => "".to_owned(),
|
||||
})
|
||||
(
|
||||
[("Content-Type", "text/css")],
|
||||
match css::render_css() {
|
||||
Ok(css) => css,
|
||||
Err(_) => "".to_owned(),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
fn header(page_title: &str) -> Markup {
|
||||
html! {
|
||||
(DOCTYPE)
|
||||
meta charset="utf-8";
|
||||
html! {
|
||||
(DOCTYPE)
|
||||
meta charset="utf-8";
|
||||
title { (page_title) }
|
||||
link rel="stylesheet" href="/styles.css";
|
||||
}
|
||||
link rel="stylesheet" href="/styles.css";
|
||||
}
|
||||
}
|
||||
|
||||
/// A static footer.
|
||||
|
@ -53,27 +56,27 @@ fn footer() -> Markup {
|
|||
}
|
||||
|
||||
async fn root(State(state): State<AppState>) -> Markup {
|
||||
let c = state.registry.images().await.unwrap();
|
||||
let c = state.registry.images().await.unwrap();
|
||||
html! {
|
||||
(header("/DREF"))
|
||||
body {
|
||||
main {
|
||||
h1 { "/DREF" }
|
||||
hr;
|
||||
@for image in c {
|
||||
div {
|
||||
details {
|
||||
summary { (image.name) }
|
||||
ul {
|
||||
@for tag in state.registry.image_tags(image.name).await.unwrap() {
|
||||
li { (tag.name) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(footer())
|
||||
}
|
||||
(header("/DREF"))
|
||||
body {
|
||||
main {
|
||||
h1 { "/DREF" }
|
||||
hr;
|
||||
@for image in c {
|
||||
div {
|
||||
details {
|
||||
summary { (image.name) }
|
||||
ul {
|
||||
@for tag in state.registry.image_tags(image.name).await.unwrap() {
|
||||
li { (tag.name) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(footer())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue