Basic frontend

I'm sorry for the big commit

- Added yarte templating engine
- Wrote frontend: all HTML except file input area, basic CSS (themes soon), JS.
No client-side encryption yet. And no working API.
- Simple but handy build system in Makefile
(requires pacman -S entr / apt install entr)
This commit is contained in:
DarkCat09 2024-03-09 16:17:18 +04:00
parent 4b6b3f7da4
commit 96376f2fba
Signed by: DarkCat09
GPG key ID: 0A26CD5B3345D6E3
12 changed files with 805 additions and 11 deletions

View file

@ -1,11 +1,16 @@
use ntex::web::{self, App};
use ntex_files;
mod pages;
#[ntex::main]
async fn main() -> std::io::Result<()> {
web::server(move || App::new().service(pages::index))
.bind("127.0.0.1:3002")?
.run()
.await
web::server(move || {
App::new()
.service(pages::index)
.service(ntex_files::Files::new("/static", "./static"))
})
.bind("127.0.0.1:3002")?
.run()
.await
}

View file

@ -1,8 +1,13 @@
use ntex::web::{self, HttpResponse};
use yarte::TemplateMin;
#[derive(TemplateMin)]
#[template(path = "index")]
struct MainPageTemplate;
#[web::get("/")]
pub async fn index() -> HttpResponse {
HttpResponse::Ok()
.content_type("text/html; charset=utf-8")
.body("<h1>dc09's bin</h1>")
.body(MainPageTemplate {}.to_string())
}