add: apps api
This commit is contained in:
parent
2a99d49c8a
commit
ebded00fd3
33 changed files with 698 additions and 31 deletions
|
@ -121,6 +121,8 @@ pub const FORGE_BASE: &str = include_str!("./public/html/forge/base.lisp");
|
|||
pub const FORGE_INFO: &str = include_str!("./public/html/forge/info.lisp");
|
||||
pub const FORGE_TICKETS: &str = include_str!("./public/html/forge/tickets.lisp");
|
||||
|
||||
pub const DEVELOPER_HOME: &str = include_str!("./public/html/developer/home.lisp");
|
||||
|
||||
// langs
|
||||
pub const LANG_EN_US: &str = include_str!("./langs/en-US.toml");
|
||||
|
||||
|
@ -129,6 +131,8 @@ pub const LANG_EN_US: &str = include_str!("./langs/en-US.toml");
|
|||
pub const VENDOR_SPOTIFY_ICON: &str = include_str!("./public/images/vendor/spotify.svg");
|
||||
pub const VENDOR_LAST_FM_ICON: &str = include_str!("./public/images/vendor/last-fm.svg");
|
||||
|
||||
pub const TETRATTO_BUNNY: &[u8] = include_bytes!("./public/images/tetratto_bunny.webp");
|
||||
|
||||
pub(crate) static HTML_FOOTER: LazyLock<RwLock<String>> =
|
||||
LazyLock::new(|| RwLock::new(String::new()));
|
||||
|
||||
|
@ -174,6 +178,13 @@ macro_rules! vendor_icon {
|
|||
}};
|
||||
}
|
||||
|
||||
macro_rules! bin_icon {
|
||||
($name:literal, $icon:ident, $icons_dir:expr) => {{
|
||||
let file_path = PathBufD::current().extend(&[$icons_dir.clone(), $name.to_string()]);
|
||||
std::fs::write(file_path, $icon).unwrap();
|
||||
}};
|
||||
}
|
||||
|
||||
/// Read a string and replace all custom blocks with the corresponding correct HTML.
|
||||
///
|
||||
/// # Replaces
|
||||
|
@ -315,6 +326,7 @@ pub(crate) fn lisp_plugins() -> HashMap<String, Box<dyn FnMut(Element) -> Elemen
|
|||
pub(crate) async fn write_assets(config: &Config) -> PathBufD {
|
||||
vendor_icon!("spotify", VENDOR_SPOTIFY_ICON, config.dirs.icons);
|
||||
vendor_icon!("last_fm", VENDOR_LAST_FM_ICON, config.dirs.icons);
|
||||
bin_icon!("tetratto_bunny.webp", TETRATTO_BUNNY, config.dirs.assets);
|
||||
|
||||
// ...
|
||||
let mut plugins = lisp_plugins();
|
||||
|
@ -395,6 +407,8 @@ pub(crate) async fn write_assets(config: &Config) -> PathBufD {
|
|||
write_template!(html_path->"forge/info.html"(crate::assets::FORGE_INFO) --config=config --lisp plugins);
|
||||
write_template!(html_path->"forge/tickets.html"(crate::assets::FORGE_TICKETS) --config=config --lisp plugins);
|
||||
|
||||
write_template!(html_path->"developer/home.html"(crate::assets::DEVELOPER_HOME) -d "developer" --config=config --lisp plugins);
|
||||
|
||||
html_path
|
||||
}
|
||||
|
||||
|
@ -402,6 +416,8 @@ pub(crate) async fn write_assets(config: &Config) -> PathBufD {
|
|||
pub(crate) async fn init_dirs(config: &Config) {
|
||||
create_dir_if_not_exists!(&config.dirs.templates);
|
||||
create_dir_if_not_exists!(&config.dirs.docs);
|
||||
create_dir_if_not_exists!(&config.dirs.rustdoc);
|
||||
create_dir_if_not_exists!(&config.dirs.assets);
|
||||
|
||||
// images
|
||||
create_dir_if_not_exists!(&config.dirs.media);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue