Working on session
This commit is contained in:
parent
dcb2276ed3
commit
4d0e589a44
@ -767,6 +767,10 @@ select {
|
|||||||
left: 0px;
|
left: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.top-0 {
|
||||||
|
top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.z-50 {
|
.z-50 {
|
||||||
z-index: 50;
|
z-index: 50;
|
||||||
}
|
}
|
||||||
@ -849,6 +853,10 @@ select {
|
|||||||
height: 2rem;
|
height: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.h-full {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.min-h-screen {
|
.min-h-screen {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
@ -901,6 +909,10 @@ select {
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content-center {
|
||||||
|
align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
.items-center {
|
.items-center {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
@ -979,6 +991,11 @@ select {
|
|||||||
border-color: rgb(209 213 219 / var(--tw-border-opacity));
|
border-color: rgb(209 213 219 / var(--tw-border-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg-black {
|
||||||
|
--tw-bg-opacity: 1;
|
||||||
|
background-color: rgb(0 0 0 / var(--tw-bg-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
.bg-blue-700 {
|
.bg-blue-700 {
|
||||||
--tw-bg-opacity: 1;
|
--tw-bg-opacity: 1;
|
||||||
background-color: rgb(29 78 216 / var(--tw-bg-opacity));
|
background-color: rgb(29 78 216 / var(--tw-bg-opacity));
|
||||||
@ -1009,6 +1026,14 @@ select {
|
|||||||
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg-cover {
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-center {
|
||||||
|
background-position: center;
|
||||||
|
}
|
||||||
|
|
||||||
.p-2 {
|
.p-2 {
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
}
|
}
|
||||||
@ -1046,6 +1071,10 @@ select {
|
|||||||
padding-bottom: 0.75rem;
|
padding-bottom: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pb-32 {
|
||||||
|
padding-bottom: 8rem;
|
||||||
|
}
|
||||||
|
|
||||||
.pl-10 {
|
.pl-10 {
|
||||||
padding-left: 2.5rem;
|
padding-left: 2.5rem;
|
||||||
}
|
}
|
||||||
@ -1058,6 +1087,10 @@ select {
|
|||||||
padding-right: 1rem;
|
padding-right: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pt-16 {
|
||||||
|
padding-top: 4rem;
|
||||||
|
}
|
||||||
|
|
||||||
.text-2xl {
|
.text-2xl {
|
||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
line-height: 2rem;
|
line-height: 2rem;
|
||||||
@ -1134,6 +1167,10 @@ select {
|
|||||||
color: rgb(255 255 255 / var(--tw-text-opacity));
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.opacity-75 {
|
||||||
|
opacity: 0.75;
|
||||||
|
}
|
||||||
|
|
||||||
.shadow {
|
.shadow {
|
||||||
--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
||||||
--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
|
--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
|
||||||
|
@ -6,7 +6,7 @@ use oswilno_contract::accounts;
|
|||||||
use oswilno_contract::parking_space_rents;
|
use oswilno_contract::parking_space_rents;
|
||||||
use oswilno_contract::parking_spaces;
|
use oswilno_contract::parking_spaces;
|
||||||
use oswilno_session::{Authenticated, MaybeAuthenticated};
|
use oswilno_session::{Authenticated, MaybeAuthenticated};
|
||||||
use oswilno_view::{is_partial, Layout, Main, MainOpts, SessionOpts, SearchOpts};
|
use oswilno_view::{is_partial, Layout, Main, MainOpts, SearchOpts, SessionOpts, Blank};
|
||||||
use sea_orm::prelude::*;
|
use sea_orm::prelude::*;
|
||||||
use sea_orm::ActiveValue::{NotSet, Set};
|
use sea_orm::ActiveValue::{NotSet, Set};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
@ -48,6 +48,7 @@ async fn all_parking_spaces(
|
|||||||
let parking_spaces = load_parking_spaces(db).await;
|
let parking_spaces = load_parking_spaces(db).await;
|
||||||
let main = Main {
|
let main = Main {
|
||||||
body: parking_spaces,
|
body: parking_spaces,
|
||||||
|
title: Blank,
|
||||||
opts: MainOpts {
|
opts: MainOpts {
|
||||||
session: session.into_option().map(|s| SessionOpts {
|
session: session.into_option().map(|s| SessionOpts {
|
||||||
login: s.subject.to_owned(),
|
login: s.subject.to_owned(),
|
||||||
|
@ -60,7 +60,8 @@ async fn main() -> std::io::Result<()> {
|
|||||||
.app_data(Data::new(l10n.clone()))
|
.app_data(Data::new(l10n.clone()))
|
||||||
.configure(oswilno_parking_space::mount)
|
.configure(oswilno_parking_space::mount)
|
||||||
.configure(oswilno_admin::mount)
|
.configure(oswilno_admin::mount)
|
||||||
.configure(web_assets::configure)
|
.configure(web_assets::mount)
|
||||||
|
.configure(oswilno_view::mount)
|
||||||
.configure(|c| session_config.app_data(c))
|
.configure(|c| session_config.app_data(c))
|
||||||
})
|
})
|
||||||
.bind(("0.0.0.0", 8080))?
|
.bind(("0.0.0.0", 8080))?
|
||||||
|
@ -9,7 +9,7 @@ use askama_actix::Template;
|
|||||||
use autometrics::autometrics;
|
use autometrics::autometrics;
|
||||||
use garde::Validate;
|
use garde::Validate;
|
||||||
use jsonwebtoken::*;
|
use jsonwebtoken::*;
|
||||||
use oswilno_view::{Errors, Lang, Layout, Main, MainOpts, TranslationStorage};
|
use oswilno_view::{Errors, Lang, Layout, Main, MainOpts, TranslationStorage, Blank};
|
||||||
use ring::rand::SystemRandom;
|
use ring::rand::SystemRandom;
|
||||||
use ring::signature::{Ed25519KeyPair, KeyPair};
|
use ring::signature::{Ed25519KeyPair, KeyPair};
|
||||||
use sea_orm::DatabaseConnection;
|
use sea_orm::DatabaseConnection;
|
||||||
@ -169,6 +169,7 @@ async fn login_view(req: HttpRequest, t: Data<TranslationStorage>) -> HttpRespon
|
|||||||
search: None,
|
search: None,
|
||||||
session: None,
|
session: None,
|
||||||
},
|
},
|
||||||
|
title: Blank,
|
||||||
}
|
}
|
||||||
.render()
|
.render()
|
||||||
} else {
|
} else {
|
||||||
@ -184,6 +185,7 @@ async fn login_view(req: HttpRequest, t: Data<TranslationStorage>) -> HttpRespon
|
|||||||
show: true,
|
show: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
|
title: Blank,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
.render()
|
.render()
|
||||||
@ -344,6 +346,7 @@ async fn register_view(req: HttpRequest, t: Data<TranslationStorage>) -> HttpRes
|
|||||||
lang: Lang::Pl,
|
lang: Lang::Pl,
|
||||||
errors: oswilno_view::Errors::default(),
|
errors: oswilno_view::Errors::default(),
|
||||||
},
|
},
|
||||||
|
title: Blank,
|
||||||
opts: MainOpts {
|
opts: MainOpts {
|
||||||
show: true,
|
show: true,
|
||||||
search: None,
|
search: None,
|
||||||
@ -360,6 +363,7 @@ async fn register_view(req: HttpRequest, t: Data<TranslationStorage>) -> HttpRes
|
|||||||
lang: Lang::Pl,
|
lang: Lang::Pl,
|
||||||
errors: oswilno_view::Errors::default(),
|
errors: oswilno_view::Errors::default(),
|
||||||
},
|
},
|
||||||
|
title: Blank,
|
||||||
opts: MainOpts::default(),
|
opts: MainOpts::default(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,26 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
|
|
||||||
use actix_web::HttpRequest;
|
use actix_web::http::header::ContentType;
|
||||||
|
use actix_web::web::ServiceConfig;
|
||||||
|
use actix_web::{get, HttpRequest, HttpResponse};
|
||||||
pub use lang::*;
|
pub use lang::*;
|
||||||
|
|
||||||
pub mod filters;
|
pub mod filters;
|
||||||
pub mod lang;
|
pub mod lang;
|
||||||
|
|
||||||
|
pub fn mount(config: &mut ServiceConfig) {
|
||||||
|
config.service(banner);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[get("/banner.jpg")]
|
||||||
|
async fn banner() -> HttpResponse {
|
||||||
|
const BANNER_BLOB: &[u8; 314124] = include_bytes!("../assets/banner.jpg");
|
||||||
|
HttpResponse::Ok()
|
||||||
|
.append_header(ContentType::jpeg())
|
||||||
|
.body(BANNER_BLOB.as_slice())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_partial(req: &HttpRequest) -> bool {
|
pub fn is_partial(req: &HttpRequest) -> bool {
|
||||||
req.headers()
|
req.headers()
|
||||||
.get("Accept")
|
.get("Accept")
|
||||||
@ -43,14 +57,19 @@ impl Default for MainOpts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, askama_actix::Template)]
|
#[derive(Debug, Default, askama_actix::Template)]
|
||||||
|
#[template(source = "", ext = "txt")]
|
||||||
|
pub struct Blank;
|
||||||
|
|
||||||
|
#[derive(Debug, Default, askama_actix::Template)]
|
||||||
#[template(path = "../templates/main.html")]
|
#[template(path = "../templates/main.html")]
|
||||||
pub struct Main<BodyTemplate: askama::Template> {
|
pub struct Main<BodyTemplate: askama::Template, TitleTemplate: askama::Template = Blank> {
|
||||||
|
pub title: TitleTemplate,
|
||||||
pub body: BodyTemplate,
|
pub body: BodyTemplate,
|
||||||
pub opts: MainOpts,
|
pub opts: MainOpts,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, askama_actix::Template)]
|
#[derive(Debug, Default, askama_actix::Template)]
|
||||||
#[template(path = "../templates/base.html")]
|
#[template(path = "../templates/base.html")]
|
||||||
pub struct Layout<BodyTemplate: askama::Template> {
|
pub struct Layout<BodyTemplate: askama::Template> {
|
||||||
pub main: Main<BodyTemplate>,
|
pub main: Main<BodyTemplate>,
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<main class="relative">
|
<main>
|
||||||
<div class="absolute top-0 w-full h-full bg-center bg-cover" style="background-image:url('/banner.jpg')">
|
|
||||||
</div>
|
|
||||||
{% include "navbar.html" %}
|
{% include "navbar.html" %}
|
||||||
|
<section id="main-header" class="relative pt-16 pb-32 flex content-center items-center justify-center" style="min-height:75vh">
|
||||||
|
<div class="absolute top-0 w-full h-full bg-center bg-cover" style="background-image:url('/banner.jpg')">
|
||||||
|
<span id="blackOverlay" class="w-full h-full absolute opacity-75 bg-black"></span>
|
||||||
|
</div>
|
||||||
|
{{ title|safe }}
|
||||||
|
</section>
|
||||||
{{ body|safe }}
|
{{ body|safe }}
|
||||||
</main>
|
</main>
|
||||||
|
@ -2,7 +2,7 @@ use std::{borrow::Cow, sync::Once};
|
|||||||
|
|
||||||
use actix_web::{get, web::ServiceConfig, HttpResponse};
|
use actix_web::{get, web::ServiceConfig, HttpResponse};
|
||||||
|
|
||||||
pub fn configure(config: &mut ServiceConfig) {
|
pub fn mount(config: &mut ServiceConfig) {
|
||||||
config
|
config
|
||||||
.service(serve_build_js)
|
.service(serve_build_js)
|
||||||
.service(serve_build_js_map)
|
.service(serve_build_js_map)
|
||||||
|
Loading…
Reference in New Issue
Block a user