+29 -17 +/-9 browse
1 | diff --git a/web/README.md b/web/README.md |
2 | index f5c1d07..5495c3d 100644 |
3 | --- a/web/README.md |
4 | +++ b/web/README.md |
5 | @@ -17,5 +17,6 @@ The following environment variables can be defined to configure various settings |
6 | - `PORT`, default `3000`. |
7 | - `PUBLIC_URL`, default `lists.mailpot.rs`. |
8 | - `SITE_TITLE`, default `mailing list archive`. |
9 | + - `SITE_SUBTITLE`, default empty. |
10 | - `ROOT_URL_PREFIX`, default empty. |
11 | - `SSH_NAMESPACE`, default `lists.mailpot.rs`. |
12 | diff --git a/web/src/auth.rs b/web/src/auth.rs |
13 | index fd00f30..aaefb0a 100644 |
14 | --- a/web/src/auth.rs |
15 | +++ b/web/src/auth.rs |
16 | @@ -142,9 +142,9 @@ pub async fn ssh_signin( |
17 | |
18 | let context = minijinja::context! { |
19 | namespace => &state.public_url, |
20 | - title => state.site_title.as_ref(), |
21 | + site_title => state.site_title.as_ref(), |
22 | + site_subtitle => state.site_subtitle.as_ref(), |
23 | page_title => "Log in", |
24 | - description => "", |
25 | root_url_prefix => &root_url_prefix, |
26 | ssh_challenge => token, |
27 | timeout_left => timeout_left, |
28 | diff --git a/web/src/help.rs b/web/src/help.rs |
29 | index f073207..924a785 100644 |
30 | --- a/web/src/help.rs |
31 | +++ b/web/src/help.rs |
32 | @@ -37,9 +37,9 @@ pub async fn help( |
33 | }, |
34 | ]; |
35 | let context = minijinja::context! { |
36 | - title => state.site_title.as_ref(), |
37 | + site_title => state.site_title.as_ref(), |
38 | + site_subtitle => state.site_subtitle.as_ref(), |
39 | page_title => "Help & Documentation", |
40 | - description => "", |
41 | root_url_prefix => &state.root_url_prefix, |
42 | current_user => auth.current_user, |
43 | messages => session.drain_messages(), |
44 | diff --git a/web/src/lib.rs b/web/src/lib.rs |
45 | index 6b17d81..e8d4c61 100644 |
46 | --- a/web/src/lib.rs |
47 | +++ b/web/src/lib.rs |
48 | @@ -168,6 +168,7 @@ pub struct AppState { |
49 | pub root_url_prefix: Value, |
50 | pub public_url: String, |
51 | pub site_title: Cow<'static, str>, |
52 | + pub site_subtitle: Option<Cow<'static, str>>, |
53 | pub user_store: Arc<RwLock<HashMap<i64, User>>>, |
54 | // ... |
55 | } |
56 | diff --git a/web/src/lists.rs b/web/src/lists.rs |
57 | index 3fe4b6a..9e38d16 100644 |
58 | --- a/web/src/lists.rs |
59 | +++ b/web/src/lists.rs |
60 | @@ -114,7 +114,8 @@ pub async fn list( |
61 | }, |
62 | ]; |
63 | let context = minijinja::context! { |
64 | - title => state.site_title.as_ref(), |
65 | + site_title => state.site_title.as_ref(), |
66 | + site_subtitle => state.site_subtitle.as_ref(), |
67 | page_title => &list.name, |
68 | description => &list.description, |
69 | post_policy => &post_policy, |
70 | @@ -123,7 +124,6 @@ pub async fn list( |
71 | months => &months, |
72 | hists => &hist, |
73 | posts => posts_ctx, |
74 | - body => &list.description.clone().unwrap_or_default(), |
75 | root_url_prefix => &state.root_url_prefix, |
76 | list => Value::from_object(MailingList::from(list)), |
77 | current_user => auth.current_user, |
78 | @@ -194,7 +194,8 @@ pub async fn list_post( |
79 | }, |
80 | ]; |
81 | let context = minijinja::context! { |
82 | - title => state.site_title.as_ref(), |
83 | + site_title => state.site_title.as_ref(), |
84 | + site_subtitle => state.site_subtitle.as_ref(), |
85 | page_title => subject_ref, |
86 | description => &list.description, |
87 | list => Value::from_object(MailingList::from(list)), |
88 | @@ -295,7 +296,8 @@ pub async fn list_edit( |
89 | }, |
90 | ]; |
91 | let context = minijinja::context! { |
92 | - title => state.site_title.as_ref(), |
93 | + site_title => state.site_title.as_ref(), |
94 | + site_subtitle => state.site_subtitle.as_ref(), |
95 | page_title => format!("Edit {} settings", list.name), |
96 | description => &list.description, |
97 | post_policy => &post_policy, |
98 | diff --git a/web/src/main.rs b/web/src/main.rs |
99 | index 1fabdcc..8f74299 100644 |
100 | --- a/web/src/main.rs |
101 | +++ b/web/src/main.rs |
102 | @@ -51,6 +51,7 @@ async fn main() { |
103 | site_title: std::env::var("SITE_TITLE") |
104 | .unwrap_or_else(|_| "mailing list archive".to_string()) |
105 | .into(), |
106 | + site_subtitle: std::env::var("SITE_SUBTITLE").ok().map(Into::into), |
107 | user_store: Arc::new(RwLock::new(HashMap::default())), |
108 | }); |
109 | |
110 | @@ -176,9 +177,9 @@ async fn root( |
111 | }]; |
112 | |
113 | let context = minijinja::context! { |
114 | - title => state.site_title.as_ref(), |
115 | + site_title => state.site_title.as_ref(), |
116 | + site_subtitle => state.site_subtitle.as_ref(), |
117 | page_title => Option::<&'static str>::None, |
118 | - description => "", |
119 | lists => &lists, |
120 | root_url_prefix => &state.root_url_prefix, |
121 | current_user => auth.current_user, |
122 | diff --git a/web/src/settings.rs b/web/src/settings.rs |
123 | index 3089654..5dff893 100644 |
124 | --- a/web/src/settings.rs |
125 | +++ b/web/src/settings.rs |
126 | @@ -66,9 +66,9 @@ pub async fn settings( |
127 | >>()?; |
128 | |
129 | let context = minijinja::context! { |
130 | - title => state.site_title.as_ref(), |
131 | + site_title => state.site_title.as_ref(), |
132 | + site_subtitle => state.site_subtitle.as_ref(), |
133 | page_title => "Account settings", |
134 | - description => "", |
135 | root_url_prefix => &root_url_prefix, |
136 | user => user, |
137 | subscriptions => subscriptions, |
138 | @@ -307,9 +307,9 @@ pub async fn user_list_subscription( |
139 | ]; |
140 | |
141 | let context = minijinja::context! { |
142 | - title => state.site_title.as_ref(), |
143 | + site_title => state.site_title.as_ref(), |
144 | + site_subtitle => state.site_subtitle.as_ref(), |
145 | page_title => "Subscription settings", |
146 | - description => "", |
147 | root_url_prefix => &root_url_prefix, |
148 | user => user, |
149 | list => list, |
150 | diff --git a/web/src/templates/css.html b/web/src/templates/css.html |
151 | index 06560d8..f563623 100644 |
152 | --- a/web/src/templates/css.html |
153 | +++ b/web/src/templates/css.html |
154 | @@ -378,6 +378,13 @@ |
155 | font-size: xx-large; |
156 | } |
157 | |
158 | + main.layout>div.header>p.site-subtitle { |
159 | + margin: 1rem; |
160 | + margin-top: 0px; |
161 | + font-family: var(--grotesque-system-stack); |
162 | + font-size: large; |
163 | + } |
164 | + |
165 | main.layout>div.header>div.page-header { |
166 | width: 90vw; |
167 | margin: 0px auto; |
168 | diff --git a/web/src/templates/header.html b/web/src/templates/header.html |
169 | index d86dcf3..9cbafa0 100644 |
170 | --- a/web/src/templates/header.html |
171 | +++ b/web/src/templates/header.html |
172 | @@ -9,9 +9,9 @@ |
173 | <body> |
174 | <main class="layout"> |
175 | <div class="header"> |
176 | - <h1>{{ title }}</h1> |
177 | - {% if description %} |
178 | - <p class="description">{{ description }}</p> |
179 | + <h1>{{ site_title }}</h1> |
180 | + {% if site_subtitle %} |
181 | + <p class="site-subtitle">{{ site_subtitle|safe }}</p> |
182 | {% endif %} |
183 | {% include "menu.html" %} |
184 | <div class="page-header"> |