Templates and TLS requests
Refactored HTML templates and added TLS back to issue HTTP requests
This commit is contained in:
@@ -21,23 +21,33 @@ where
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
pub enum MessageTemplate {
|
||||
#[template(path = "../templates/success.html")]
|
||||
Success { message: String },
|
||||
#[template(path = "../templates/error.html")]
|
||||
Error { message: String },
|
||||
#[template(path = "message.html")]
|
||||
pub struct MessageTemplate {
|
||||
pub message: String,
|
||||
pub error: bool,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "../templates/500.html")]
|
||||
pub struct InternalErrorTemplate;
|
||||
impl MessageTemplate {
|
||||
pub fn success(message: String) -> Self {
|
||||
Self {
|
||||
message,
|
||||
error: false,
|
||||
}
|
||||
}
|
||||
pub fn error(message: String) -> Self {
|
||||
Self {
|
||||
message,
|
||||
error: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "../templates/login.html")]
|
||||
pub struct LoginTemplate;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "../templates/dashboard.html")]
|
||||
#[template(path = "dashboard/dashboard.html")]
|
||||
pub struct DashboardTemplate {
|
||||
pub username: String,
|
||||
pub idempotency_key_1: String,
|
||||
@@ -53,27 +63,27 @@ pub struct DashboardTemplate {
|
||||
pub struct HomeTemplate;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "posts.html")]
|
||||
#[template(path = "posts/list.html")]
|
||||
pub struct PostsTemplate {
|
||||
pub posts: Vec<PostEntry>,
|
||||
pub next_page: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "posts.html", block = "posts")]
|
||||
#[template(path = "posts/list.html", block = "posts")]
|
||||
pub struct PostListTemplate {
|
||||
pub posts: Vec<PostEntry>,
|
||||
pub next_page: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "post.html")]
|
||||
#[template(path = "posts/page.html")]
|
||||
pub struct PostTemplate {
|
||||
pub post: PostEntry,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "dashboard.html", block = "subs")]
|
||||
#[template(path = "dashboard/subscribers/list.html", block = "subs")]
|
||||
pub struct SubListTemplate {
|
||||
pub subscribers: Vec<SubscriberEntry>,
|
||||
pub current_page: i64,
|
||||
@@ -81,19 +91,23 @@ pub struct SubListTemplate {
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "confirm.html")]
|
||||
#[template(path = "subscribe/confirm.html")]
|
||||
pub struct ConfirmTemplate;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "404.html")]
|
||||
pub struct NotFoundTemplate;
|
||||
pub enum ErrorTemplate {
|
||||
#[template(path = "error/404.html")]
|
||||
NotFound,
|
||||
#[template(path = "error/500.html")]
|
||||
InternalServer,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "unsubscribe_confirm.html")]
|
||||
#[template(path = "unsubscribe/confirm.html")]
|
||||
pub struct UnsubscribeConfirmTemplate;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "unsubscribe.html")]
|
||||
#[template(path = "unsubscribe/form.html")]
|
||||
pub struct UnsubscribeTemplate;
|
||||
|
||||
#[derive(Template)]
|
||||
|
||||
Reference in New Issue
Block a user