aboutsummaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-01-22 21:23:19 +0100
committermetamuffin <metamuffin@disroot.org>2023-01-22 21:23:19 +0100
commitd0197c8698a94a19d790c0e859646c3c341031e0 (patch)
tree8077922864d3218045ecbeaecd7e652fe7547c25 /server/src
parent34cb7d576b1aec8b53cf1f6398480cf8d3fa24c7 (diff)
downloadjellything-d0197c8698a94a19d790c0e859646c3c341031e0.tar
jellything-d0197c8698a94a19d790c0e859646c3c341031e0.tar.bz2
jellything-d0197c8698a94a19d790c0e859646c3c341031e0.tar.zst
fancy login
Diffstat (limited to 'server/src')
-rw-r--r--server/src/config.rs4
-rw-r--r--server/src/routes/mod.rs11
-rw-r--r--server/src/routes/ui/account/mod.rs19
-rw-r--r--server/src/routes/ui/style/forms.css21
-rw-r--r--server/src/routes/ui/style/mod.rs4
5 files changed, 45 insertions, 14 deletions
diff --git a/server/src/config.rs b/server/src/config.rs
index 0534f22..cffdc2f 100644
--- a/server/src/config.rs
+++ b/server/src/config.rs
@@ -1,12 +1,10 @@
-use std::{fs::File, path::PathBuf};
-
use serde::{Deserialize, Serialize};
+use std::{fs::File, path::PathBuf};
#[derive(Debug, Deserialize, Serialize, Default)]
pub struct GlobalConfig {
pub brand: String,
pub slogan: String,
- pub icon: PathBuf,
pub asset_dir: PathBuf,
pub database_path: PathBuf,
diff --git a/server/src/routes/mod.rs b/server/src/routes/mod.rs
index e7db40f..e3a9382 100644
--- a/server/src/routes/mod.rs
+++ b/server/src/routes/mod.rs
@@ -1,6 +1,7 @@
-use crate::{database::Database, library::Library, CONF};
+use crate::{database::Database, library::Library, routes::ui::error::MyResult, CONF};
use jellyremuxer::RemuxerContext;
-use rocket::{catchers, config::SecretKey, fs::FileServer, routes, Build, Config, Rocket};
+use rocket::{catchers, config::SecretKey, fs::FileServer, get, routes, Build, Config, Rocket};
+use std::fs::File;
use stream::r_stream;
use ui::{
account::{
@@ -60,7 +61,13 @@ pub fn build_rocket(
r_account_admin_dashboard,
r_account_admin_invite,
r_account_admin_remove_user,
+ r_favicon,
r_item_assets,
],
)
}
+
+#[get("/favicon.ico")]
+fn r_favicon() -> MyResult<File> {
+ Ok(File::open(CONF.asset_dir.join("favicon.ico"))?)
+}
diff --git a/server/src/routes/ui/account/mod.rs b/server/src/routes/ui/account/mod.rs
index e39ef6c..c1561e3 100644
--- a/server/src/routes/ui/account/mod.rs
+++ b/server/src/routes/ui/account/mod.rs
@@ -32,8 +32,9 @@ pub async fn r_account_register() -> DynLayoutPage<'static> {
LayoutPage {
title: "Register".to_string(),
content: markup::new! {
- h1 { "Register for " @CONF.brand }
- form[method="POST", action=""] {
+ form.account[method="POST", action=""] {
+ h1 { "Register for " @CONF.brand }
+
label[for="inp-invitation"] { "Invite Code: " }
input[type="text", id="inp-invitation", name="invitation"]; br;
@@ -61,16 +62,18 @@ pub fn r_account_login() -> DynLayoutPage<'static> {
LayoutPage {
title: "Log in".to_string(),
content: markup::new! {
- h1 { "Log in to your Account" }
- form[method="POST", action=""] {
+ form.account[method="POST", action=""] {
+ h1 { "Log in to your Account" }
+
label[for="inp-username"] { "Username: " }
input[type="text", id="inp-username", name="username"]; br;
label[for="inp-password"] { "Password: " }
input[type="password", id="inp-password", name="password"]; br;
-
+
input[type="submit", value="Login"];
+
+ p { "While logged in, a cookie will be used to identify you." }
}
- p { "While logged in, a cookie will be used to identify you." }
},
}
}
@@ -80,8 +83,8 @@ pub fn r_account_logout() -> DynLayoutPage<'static> {
LayoutPage {
title: "Log out".to_string(),
content: markup::new! {
- h1 { "Log out" }
- form[method="POST", action=""] {
+ form.account[method="POST", action=""] {
+ h1 { "Log out" }
input[type="submit", value="Log out."];
}
},
diff --git a/server/src/routes/ui/style/forms.css b/server/src/routes/ui/style/forms.css
new file mode 100644
index 0000000..959a62e
--- /dev/null
+++ b/server/src/routes/ui/style/forms.css
@@ -0,0 +1,21 @@
+input[type="text"],
+input[type="password"] {
+ border-radius: 7px;
+ padding: 0.3em;
+ margin: 0.2em;
+ border: 2px solid var(--accent-light);
+}
+
+form.account {
+ padding: 3em;
+ border-radius: 1em;
+ background-color: var(--background-light);
+
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+}
+form.account h1 {
+ margin-top: 0px;
+}
diff --git a/server/src/routes/ui/style/mod.rs b/server/src/routes/ui/style/mod.rs
index 39e11af..0891d59 100644
--- a/server/src/routes/ui/style/mod.rs
+++ b/server/src/routes/ui/style/mod.rs
@@ -13,6 +13,7 @@ fn css_bundle() -> String {
"player.css",
"itempage.css",
"directorypage.css",
+ "forms.css",
]
.into_iter()
.map(|n| {
@@ -32,7 +33,8 @@ fn css_bundle() -> String {
include_str!("layout.css"),
include_str!("player.css"),
include_str!("itempage.css"),
- include_str!("directorypage.css")
+ include_str!("directorypage.css"),
+ include_str!("forms.css")
)
.to_string()
}