diff --git a/src/filters.rs b/src/filters.rs index e56bb2d..466d3a0 100644 --- a/src/filters.rs +++ b/src/filters.rs @@ -1,6 +1,6 @@ use chrono::{DateTime, Locale, Utc}; -use regex::{Captures, Regex}; use lazy_static::lazy_static; +use regex::{Captures, Regex}; use std::{collections::HashSet, fmt::Display}; use crate::markup::SPOILER_REGEX; diff --git a/src/web/index.rs b/src/web/index.rs index d93cfc2..12b81b1 100755 --- a/src/web/index.rs +++ b/src/web/index.rs @@ -2,38 +2,21 @@ use actix_web::{get, web::Data, HttpRequest, HttpResponse}; use askama::Template; use super::tcx::TemplateCtx; -use crate::{ - ctx::Ctx, - db::models::{Board, Post}, - error::NekrochanError, - filters, - web::template_response, -}; +use crate::{ctx::Ctx, db::models::NewsPost, error::NekrochanError, web::template_response}; #[derive(Template)] #[template(path = "index.html")] struct IndexTemplate { tcx: TemplateCtx, - boards: Vec, - posts: Vec, - files: Vec, + _news: Vec, } #[get("/")] pub async fn index(ctx: Data, req: HttpRequest) -> Result { let tcx = TemplateCtx::new(&ctx, &req).await?; - - let boards = Board::read_all(&ctx).await?; - let posts = Post::read_latest(&ctx).await.unwrap_or_else(|_| Vec::new()); - let files = Post::read_files(&ctx).await.unwrap_or_else(|_| Vec::new()); - - let template = IndexTemplate { - tcx, - boards, - posts, - files, - }; + let _news = NewsPost::read_all(&ctx).await?; + let template = IndexTemplate { tcx, _news }; template_response(&template) } diff --git a/static/favicon.ico b/static/favicon.ico old mode 100755 new mode 100644 index 6c1d133..d00eef9 Binary files a/static/favicon.ico and b/static/favicon.ico differ diff --git a/static/icons/download.png b/static/icons/download.png deleted file mode 100755 index ee2c90f..0000000 Binary files a/static/icons/download.png and /dev/null differ diff --git a/static/style.css b/static/style.css index d451d26..8101685 100755 --- a/static/style.css +++ b/static/style.css @@ -207,10 +207,14 @@ summary { } .small { - font-size: 8pt; + font-size: 0.8rem; font-weight: normal; } +.big { + font-size: 1.2rem; +} + .center { text-align: center; } @@ -228,6 +232,7 @@ summary { } .board-links { + color: var(--board-links-color); padding: 2px; } @@ -412,8 +417,7 @@ summary { .icon { height: 1em; - vertical-align: middle; - image-rendering: pixelated; + vertical-align: text-top; } .posts-omitted { diff --git a/static/themes/yotsuba-b.css b/static/themes/yotsuba-b.css index 976f686..ee871a5 100644 --- a/static/themes/yotsuba-b.css +++ b/static/themes/yotsuba-b.css @@ -1,6 +1,6 @@ :root { /* General */ - --bg: linear-gradient(#d6daf0 3rem, #eef2ff 230px); + --bg: linear-gradient(#d1d5ee 3rem, #eef2ff 230px); --text: #000000; --font: Arial, Helvetica, sans-serif; /* Text */ @@ -8,6 +8,7 @@ --link-hover: #dd0000; --post-link-color: #34345c; --post-link-hover: #dd0000; + --board-links-color: #8899aa; --title-color: #af0a0f; --title-font: tahoma; --hr-color: #d3d3d3; diff --git a/static/themes/yotsuba.css b/static/themes/yotsuba.css index b49dfea..227d558 100644 --- a/static/themes/yotsuba.css +++ b/static/themes/yotsuba.css @@ -1,6 +1,6 @@ :root { /* General */ - --bg: linear-gradient(#fed6af90 3rem, #ffe 230px); + --bg: linear-gradient(#fed6af 3rem, #ffffee 230px); --text: #800000; --font: Arial, Helvetica, sans-serif; /* Text */ @@ -8,6 +8,7 @@ --link-hover: #dd0000; --post-link-color: #000080; --post-link-hover: #dd0000; + --board-links-color: #bb8866; --title-color: #af0a0f; --title-font: tahoma; --hr-color: #d9bfb7; diff --git a/templates/base.html b/templates/base.html index 900ee83..e9337e7 100755 --- a/templates/base.html +++ b/templates/base.html @@ -1,3 +1,5 @@ +{% import "./macros/board-links.html" as board_links %} + @@ -13,12 +15,7 @@
- {% call post_actions::post_actions(tcx.perms) %} + {% call post_actions::post_actions() %} {% endblock %} diff --git a/templates/board.html b/templates/board.html index 2267acd..3093752 100755 --- a/templates/board.html +++ b/templates/board.html @@ -15,7 +15,7 @@

{{ board.description }}

Katalog - {% call post_form::post_form(board, tcx.perms, false, 0) %} + {% call post_form::post_form(board, false, 0) %}
diff --git a/templates/index.html b/templates/index.html index d04bb2d..04dfcda 100755 --- a/templates/index.html +++ b/templates/index.html @@ -1,52 +1,12 @@ +{% import "./macros/board-links.html" as board_links %} + {% extends "base.html" %} {% block title %}{{ tcx.cfg.site.name }}{% endblock %} {% block content %} -
-
-

{{ tcx.cfg.site.name }}

-

{{ tcx.cfg.site.description }}

-
- {% if !boards.is_empty() %} -
-
Nástěnky
-
- -
-
- {% endif %} - {% if !posts.is_empty() %} -
-
Nejnovější příspěvky
-
- -
-
- {% endif %} - {% if !files.is_empty() %} -
-
Nejnovější soubory
-
-
- {% for post in files %} -
- - - -
- {% endfor %} -
-
-
- {% endif %} +
+

{{ tcx.cfg.site.name }}

+

{{ tcx.cfg.site.description }}

{% endblock %} diff --git a/templates/macros/board-links.html b/templates/macros/board-links.html new file mode 100644 index 0000000..1899c21 --- /dev/null +++ b/templates/macros/board-links.html @@ -0,0 +1,8 @@ +{% macro board_links() %} + + {% for board_link in tcx.boards %} + {{ board_link }} + {% if !loop.last %}{% endif %} + {% endfor %} + +{% endmacro %} diff --git a/templates/macros/post-actions.html b/templates/macros/post-actions.html index d21a8d4..ebdebe6 100644 --- a/templates/macros/post-actions.html +++ b/templates/macros/post-actions.html @@ -1,4 +1,4 @@ -{% macro post_actions(perms) %} +{% macro post_actions() %}
Uživatelské akce @@ -68,11 +68,11 @@

-{% if perms.owner() || perms.manage_posts() || perms.bans() || perms.edit_posts() %} +{% if tcx.perms.owner() || tcx.perms.manage_posts() || tcx.perms.bans() || tcx.perms.edit_posts() %}
Uklízečské akce - {% if perms.owner() || perms.manage_posts() %} + {% if tcx.perms.owner() || tcx.perms.manage_posts() %} {% endif %} - {% if perms.owner() || perms.bans() %} + {% if tcx.perms.owner() || tcx.perms.bans() %}
Odstranit příspěvky @@ -114,7 +114,7 @@
Zabanovat uživatele @@ -169,7 +169,7 @@
- {% if perms.owner() || perms.edit_posts() %} + {% if tcx.perms.owner() || tcx.perms.edit_posts() %}
diff --git a/templates/macros/post-form.html b/templates/macros/post-form.html index 6afbf02..c9f83de 100644 --- a/templates/macros/post-form.html +++ b/templates/macros/post-form.html @@ -1,11 +1,11 @@ -{% macro post_form(board, perms, reply, reply_to) %} +{% macro post_form(board, reply, reply_to) %} {% if reply %} {% endif %} - {% if reply %} + {% if reply %} @@ -50,7 +50,7 @@ - {% if !(perms.bypass_captcha() || perms.owner()) %} + {% if !(tcx.perms.bypass_captcha() || tcx.perms.owner()) %} {% if reply %} {% if let Some((id, base64)) = board.reply_captcha() %} diff --git a/templates/macros/post.html b/templates/macros/post.html index d4720a8..015f904 100644 --- a/templates/macros/post.html +++ b/templates/macros/post.html @@ -11,7 +11,7 @@ {{ tripcode }} {% endif %} {% if let Some(capcode) = post.capcode %} - ## {{ capcode }} + ## {{ capcode }} {% endif %} {% if tcx.ip == post.ip %} {# Technically not a tripcode or something but same styling #} @@ -41,8 +41,11 @@ {% for file in post.files.0 %}
- {% if file.spoiler %}[Spoiler]{% else %}{{ file.original_name }}{% endif %} - + {% if file.spoiler %} + [Spoiler] + {% else %} + {{ file.original_name }} + {% endif %}
({{ file.size|filesizeformat }}, {{ file.width }}x{{ file.height }}) diff --git a/templates/macros/staff-nav.html b/templates/macros/staff-nav.html index f2503df..7da8429 100644 --- a/templates/macros/staff-nav.html +++ b/templates/macros/staff-nav.html @@ -1,21 +1,21 @@ -{% macro staff_nav(perms) %} +{% macro staff_nav() %} diff --git a/templates/overboard-catalog.html b/templates/overboard-catalog.html index 1cd866b..0dc8a36 100755 --- a/templates/overboard-catalog.html +++ b/templates/overboard-catalog.html @@ -22,6 +22,6 @@ {% endfor %}

- {% call post_actions::post_actions(tcx.perms) %} + {% call post_actions::post_actions() %} {% endblock %} diff --git a/templates/overboard.html b/templates/overboard.html index 2e90cbd..d31a652 100644 --- a/templates/overboard.html +++ b/templates/overboard.html @@ -42,6 +42,6 @@ {% endfor %} {% call pagination::pagination("/overboard", pages, page) %}
- {% call post_actions::post_actions(tcx.perms) %} + {% call post_actions::post_actions() %} {% endblock %} diff --git a/templates/staff/account.html b/templates/staff/account.html index 2f91988..790d433 100755 --- a/templates/staff/account.html +++ b/templates/staff/account.html @@ -6,7 +6,7 @@ {% block content %}

Účet ({{ account.username }})

-{% call staff_nav::staff_nav(tcx.perms) %} +{% call staff_nav::staff_nav() %}

Změnit heslo

diff --git a/templates/staff/accounts.html b/templates/staff/accounts.html index 074dcc7..768499e 100755 --- a/templates/staff/accounts.html +++ b/templates/staff/accounts.html @@ -6,7 +6,7 @@ {% block content %}

Účty

-{% call staff_nav::staff_nav(tcx.perms) %} +{% call staff_nav::staff_nav() %}

Účty

diff --git a/templates/staff/banners.html b/templates/staff/banners.html index 2c2a92d..46e1136 100755 --- a/templates/staff/banners.html +++ b/templates/staff/banners.html @@ -6,7 +6,7 @@ {% block content %}

Bannery

-{% call staff_nav::staff_nav(tcx.perms) %} +{% call staff_nav::staff_nav() %}

Bannery

diff --git a/templates/staff/bans.html b/templates/staff/bans.html index 1daa012..3432da8 100755 --- a/templates/staff/bans.html +++ b/templates/staff/bans.html @@ -6,7 +6,7 @@ {% block content %}

Bany

-{% call staff_nav::staff_nav(tcx.perms) %} +{% call staff_nav::staff_nav() %}

Bany

diff --git a/templates/staff/board-config.html b/templates/staff/board-config.html index 22b0e20..c44ea67 100755 --- a/templates/staff/board-config.html +++ b/templates/staff/board-config.html @@ -6,7 +6,7 @@ {% block content %}

Nastavení (/{{ board.id }}/)

-{% call staff_nav::staff_nav(tcx.perms) %} +{% call staff_nav::staff_nav() %}
diff --git a/templates/staff/boards.html b/templates/staff/boards.html index d6c355d..383da74 100755 --- a/templates/staff/boards.html +++ b/templates/staff/boards.html @@ -6,7 +6,7 @@ {% block content %}

Nástěnky

-{% call staff_nav::staff_nav(tcx.perms) %} +{% call staff_nav::staff_nav() %}

Nástěnky

diff --git a/templates/staff/logs.html b/templates/staff/logs.html index 7d32781..cd3eb36 100755 --- a/templates/staff/logs.html +++ b/templates/staff/logs.html @@ -7,7 +7,7 @@ {% block content %}

Záznamy

-{% call staff_nav::staff_nav(tcx.perms) %} +{% call staff_nav::staff_nav() %}

Záznamy

diff --git a/templates/staff/permissions.html b/templates/staff/permissions.html index e8937a6..cf6ddfa 100755 --- a/templates/staff/permissions.html +++ b/templates/staff/permissions.html @@ -6,7 +6,7 @@ {% block content %}

Oprávnění ({{ account.username }})

-{% call staff_nav::staff_nav(tcx.perms) %} +{% call staff_nav::staff_nav() %}
{% if account.perms().owner() %}

Tento uživatel je vlastník, změny nebudou mít žádný vliv.

diff --git a/templates/staff/reports.html b/templates/staff/reports.html index fb4cab5..5f263c3 100755 --- a/templates/staff/reports.html +++ b/templates/staff/reports.html @@ -7,7 +7,7 @@ {% block content %}

Hlášení

-{% call staff_nav::staff_nav(tcx.perms) %} +{% call staff_nav::staff_nav() %}

Dočasně nedostupné

{% endblock %} diff --git a/templates/thread.html b/templates/thread.html index ff1cdad..2275454 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -14,7 +14,7 @@

{{ board.description }}

Katalog
- {% call post_form::post_form(board, tcx.perms, true, thread.id) %} + {% call post_form::post_form(board, true, thread.id) %}
@@ -26,6 +26,6 @@ {% endfor %}
- {% call post_actions::post_actions(tcx.perms) %} + {% call post_actions::post_actions() %} {% endblock %}
Režim: Odpověď [Zpět]