Added assets

This commit is contained in:
2025-11-01 21:46:23 -07:00
parent e84e77dff9
commit ce830ae280
19 changed files with 162 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
[package]
name = "service-webpage"
version = { workspace = true }
rust-version = { workspace = true }
edition = { workspace = true }
[lints]
workspace = true
[dependencies]
libservice = { workspace = true }
macro-assets = { workspace = true }
macro-sass = { workspace = true }
assetserver = { workspace = true }
axum = { workspace = true }
tracing = { workspace = true }
utoipa = { workspace = true }
maud = { workspace = true }
markdown = { workspace = true }

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,31 @@
use axum::Router;
use libservice::ToService;
use utoipa::OpenApi;
mod routes;
pub struct WebpageService {}
impl WebpageService {
#[inline]
pub fn new() -> Self {
Self {}
}
}
impl ToService for WebpageService {
#[inline]
fn make_router(&self) -> Option<Router<()>> {
Some(routes::router())
}
#[inline]
fn make_openapi(&self) -> utoipa::openapi::OpenApi {
routes::Api::openapi()
}
#[inline]
fn service_name(&self) -> Option<String> {
Some("webpage".to_owned())
}
}

View File

@@ -0,0 +1,95 @@
use assetserver::Asset;
use macro_assets::assets;
// TODO: auto-generate from dir
assets! {
prefix: "/assets"
router: asset_router()
//
// MARK: images
//
Image_Cover {
source: "../../assets/images/cover-small.jpg",
target: "/img/face.jpg"
}
Image_Betalupi {
source: "../../assets/images/betalupi-map.png",
target: "/img/betalupi.png"
}
Image_Icon {
source: "../../assets/images/icon.png",
target: "/img/icon.png"
}
//
// MARK:fonts
//
FiraCode_Bold_woff2 {
source: "../../assets/fonts/fira/FiraCode-Bold.woff2",
target: "/fonts/FiraCode-Bold.woff2"
}
FiraCode_Light_woff2 {
source: "../../assets/fonts/fira/FiraCode-Light.woff2",
target: "/fonts/FiraCode-Light.woff2"
}
FiraCode_Medium_woff2 {
source: "../../assets/fonts/fira/FiraCode-Medium.woff2",
target: "/fonts/FiraCode-Medium.woff2"
}
FiraCode_Regular_woff2 {
source: "../../assets/fonts/fira/FiraCode-Regular.woff2",
target: "/fonts/FiraCode-Regular.woff2"
}
FiraCode_SemiBold_woff2 {
source: "../../assets/fonts/fira/FiraCode-SemiBold.woff2",
target: "/fonts/FiraCode-SemiBold.woff2"
}
FiraCode_VF_woff2 {
source: "../../assets/fonts/fira/FiraCode-VF.woff2",
target: "/fonts/FiraCode-VF.woff2"
}
//
// MARK: icons
//
Fa_Brands_woff2 {
source: "../../assets/fonts/fa/fa-brands-400.woff2",
target: "/fonts/fa/fa-brands-400.woff2"
}
Fa_Regular_woff2 {
source: "../../assets/fonts/fa/fa-regular-400.woff2",
target: "/fonts/fa/fa-regular-400.woff2"
}
Fa_Solid_woff2 {
source: "../../assets/fonts/fa/fa-solid-900.woff2",
target: "/fonts/fa/fa-solid-900.woff2"
}
Fa_Brands_ttf {
source: "../../assets/fonts/fa/fa-brands-400.ttf",
target: "/fonts/fa/fa-brands-400.ttf"
}
Fa_Regular_ttf {
source: "../../assets/fonts/fa/fa-regular-400.ttf",
target: "/fonts/fa/fa-regular-400.ttf"
}
Fa_Solid_ttf {
source: "../../assets/fonts/fa/fa-solid-900.ttf",
target: "/fonts/fa/fa-solid-900.ttf"
}
}

View File

@@ -0,0 +1,16 @@
use axum::Router;
use tracing::info;
use utoipa::OpenApi;
mod assets;
#[derive(OpenApi)]
#[openapi(tags(), paths(), components(schemas()))]
pub(super) struct Api;
pub(super) fn router() -> Router<()> {
let (asset_prefix, asset_router) = assets::asset_router();
info!("Serving assets at {asset_prefix}");
Router::new().nest(asset_prefix, asset_router)
}