feat: scaffold web elements

This commit is contained in:
nullishamy 2025-04-29 22:45:12 +01:00
parent 77fba1a082
commit 4167a2f8bb
Signed by: amy
SSH key fingerprint: SHA256:WmV0uk6WgAQvDJlM8Ld4mFPHZo02CLXXP5VkwQ5xtyk
6 changed files with 103 additions and 2 deletions

View file

@ -0,0 +1,20 @@
use rocket::{get, post, response::content::RawHtml};
use askama::Template;
#[derive(Template)]
#[template(path = "index.html")]
struct IndexTemplate {
val: String
}
#[post("/clicked")]
pub async fn button_clicked() -> RawHtml<String> {
let tmpl = IndexTemplate { val: "clicked".to_string() };
RawHtml(tmpl.render().unwrap())
}
#[get("/")]
pub async fn index() -> RawHtml<String> {
let tmpl = IndexTemplate { val: "test".to_string() };
RawHtml(tmpl.render().unwrap())
}

View file

@ -4,6 +4,8 @@ pub mod oauth;
pub mod user;
pub mod api;
pub mod admin;
pub mod custom;
pub mod inbox;
pub mod well_known;

View file

@ -1,6 +1,6 @@
use endpoints::{
api::{self, timeline},
custom, inbox, oauth, user, well_known,
admin, custom, inbox, oauth, user, well_known,
};
use tracing_subscriber::fmt;
@ -122,6 +122,13 @@ pub fn launch(cfg: Config) -> Rocket<Build> {
.attach(Db::init())
.attach(cors::CORS)
.mount("/assets", rocket::fs::FileServer::from("./assets"))
.mount(
"/admin",
routes![
admin::index,
admin::button_clicked
]
)
.mount(
"/",
routes![