109 lines
4.2 KiB
Rust
109 lines
4.2 KiB
Rust
use anyhow::*;
|
|
use log::LevelFilter;
|
|
use kochab::{Server, Response, Gemtext};
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<()> {
|
|
env_logger::builder()
|
|
.filter_module("kochab", LevelFilter::Debug)
|
|
.init();
|
|
|
|
let response: Response = Document::new()
|
|
.add_preformatted_with_alt("kochab", include_str!("kochab_logo.txt"))
|
|
.add_blank_line()
|
|
.add_text(
|
|
concat!(
|
|
"Kochab is an extension & a fork of the Gemini SDK [northstar]. Where",
|
|
" northstar creates an efficient and flexible foundation for Gemini projects,",
|
|
" kochab seeks to be as ergonomic and intuitive as possible, making it",
|
|
" possible to get straight into getting your ideas into geminispace, with no",
|
|
" worrying about needing to build the tools to get there."
|
|
)
|
|
)
|
|
.add_blank_line()
|
|
.add_link("https://github.com/Alch-Emi/kochab", "GitHub")
|
|
.add_blank_line()
|
|
.add_heading(H2, "Usage")
|
|
.add_blank_line()
|
|
.add_text("Add the latest version of kochab to your `Cargo.toml`.")
|
|
.add_blank_line()
|
|
.add_preformatted_with_alt("toml", r#"kochab = { git = "https://github.com/Alch-Emi/kochab.git" }"#)
|
|
.add_blank_line()
|
|
.add_heading(H2, "Generating a key & certificate")
|
|
.add_blank_line()
|
|
.add_preformatted_with_alt("sh", concat!(
|
|
"mkdir cert && cd cert\n",
|
|
"openssl req -x509 -nodes -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365",
|
|
))
|
|
.into();
|
|
|
|
<<<<<<< HEAD
|
|
fn handle_request(_request: Request) -> BoxFuture<'static, Result<Response>> {
|
|
async move {
|
|
let response = Gemtext::new()
|
|
.preformatted("Northstar", include_str!("northstar_logo.txt"))
|
|
.blank_line()
|
|
.link("https://docs.rs/northstar", Some("Documentation"))
|
|
.link("https://github.com/panicbit/northstar", Some("GitHub"))
|
|
.blank_line()
|
|
.heading(1, "Usage")
|
|
.blank_line()
|
|
.text("Add the latest version of northstar to your `Cargo.toml`.")
|
|
.blank_line()
|
|
.heading(2, "Manually")
|
|
.blank_line()
|
|
.preformatted("toml", r#"northstar = "0.3.0" # check crates.io for the latest version"#)
|
|
.blank_line()
|
|
.heading(2, "Automatically")
|
|
.blank_line()
|
|
.preformatted("sh", "cargo add northstar")
|
|
.blank_line()
|
|
.heading(1, "Generating a key & certificate")
|
|
.blank_line()
|
|
.preformatted("sh", concat!(
|
|
"mkdir cert && cd cert\n",
|
|
"openssl req -x509 -nodes -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365",
|
|
))
|
|
.into();
|
|
Ok(response)
|
|
}
|
|
.boxed()
|
|
||||||| merged common ancestors
|
|
fn handle_request(_request: Request) -> BoxFuture<'static, Result<Response>> {
|
|
async move {
|
|
let response = Document::new()
|
|
.add_preformatted(include_str!("northstar_logo.txt"))
|
|
.add_blank_line()
|
|
.add_link("https://docs.rs/northstar", "Documentation")
|
|
.add_link("https://github.com/panicbit/northstar", "GitHub")
|
|
.add_blank_line()
|
|
.add_heading(H1, "Usage")
|
|
.add_blank_line()
|
|
.add_text("Add the latest version of northstar to your `Cargo.toml`.")
|
|
.add_blank_line()
|
|
.add_heading(H2, "Manually")
|
|
.add_blank_line()
|
|
.add_preformatted_with_alt("toml", r#"northstar = "0.3.0" # check crates.io for the latest version"#)
|
|
.add_blank_line()
|
|
.add_heading(H2, "Automatically")
|
|
.add_blank_line()
|
|
.add_preformatted_with_alt("sh", "cargo add northstar")
|
|
.add_blank_line()
|
|
.add_heading(H1, "Generating a key & certificate")
|
|
.add_blank_line()
|
|
.add_preformatted_with_alt("sh", concat!(
|
|
"mkdir cert && cd cert\n",
|
|
"openssl req -x509 -nodes -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365",
|
|
))
|
|
.into();
|
|
Ok(response)
|
|
}
|
|
.boxed()
|
|
=======
|
|
Server::new()
|
|
.add_route("/", response)
|
|
.serve_unix("kochab.sock")
|
|
.await
|
|
>>>>>>> devel
|
|
}
|