From 1ef3e9d99334f9a6837137287e5e1a19de2cde41 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Sun, 27 Apr 2025 13:08:50 +0300 Subject: [PATCH] feat: use cargo-about to generate a license page --- cargo-about/about.hbs | 70 + cargo-about/about.toml | 4 + justfile | 3 + src/main.rs | 8 +- static/license.html | 5901 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 5985 insertions(+), 1 deletion(-) create mode 100644 cargo-about/about.hbs create mode 100644 cargo-about/about.toml create mode 100644 static/license.html diff --git a/cargo-about/about.hbs b/cargo-about/about.hbs new file mode 100644 index 0000000..167f897 --- /dev/null +++ b/cargo-about/about.hbs @@ -0,0 +1,70 @@ + + + + + + + +
+
+

Third Party Licenses

+

This page lists the licenses of the projects used in canwa.

+
+ +

Overview of licenses:

+ + +

All license text:

+ +
+ + + diff --git a/cargo-about/about.toml b/cargo-about/about.toml new file mode 100644 index 0000000..0e67fb5 --- /dev/null +++ b/cargo-about/about.toml @@ -0,0 +1,4 @@ +accepted = ["Apache-2.0", "BSD-3-Clause", "MIT", "Unicode-3.0"] + +[canwa] +accepted = ["AGPL-3.0"] diff --git a/justfile b/justfile index 688133f..453a20b 100644 --- a/justfile +++ b/justfile @@ -6,3 +6,6 @@ run *ARGS: test *ARGS: cargo test {{ARGS}} + +gen-license-html: + ~/.cargo/bin/cargo-about generate --config cargo-about/about.toml cargo-about/about.hbs > static/license.html diff --git a/src/main.rs b/src/main.rs index 470b7e7..e999ff6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ use std::sync::Arc; use axum::{ Json, Router, - response::IntoResponse, + response::{Html, IntoResponse}, routing::{get, post}, }; use clap::Parser; @@ -27,6 +27,8 @@ use state::State; mod service; +const LICENSE_HTML: &str = include_str!("../static/license.html"); + #[derive(Parser)] #[command(version)] struct Args { @@ -56,6 +58,10 @@ async fn main() { let router = Router::new() .route("/", get(|| async { "canwa" })) + .route( + "/license", + get(|| async { (StatusCode::OK, Html::from(LICENSE_HTML)) }), + ) .route( "/message", post({ diff --git a/static/license.html b/static/license.html new file mode 100644 index 0000000..97d30cb --- /dev/null +++ b/static/license.html @@ -0,0 +1,5901 @@ + + + + + + + +
+
+

Third Party Licenses

+

This page lists the licenses of the projects used in canwa.

+
+ +

Overview of licenses:

+ + +

All license text:

+ +
+ + + + -- 2.44.1