Merge branch 'master' of github.com:JPyke3/libreddit into master

This commit is contained in:
JPyke3 2021-02-01 11:13:36 +01:00
commit 0a140a6ffc
No known key found for this signature in database
GPG Key ID: C7833DB15753380A
7 changed files with 47 additions and 13 deletions

2
Cargo.lock generated
View File

@ -994,7 +994,7 @@ checksum = "1cca32fa0182e8c0989459524dc356b8f2b5c10f1b9eb521b7d182c03cf8c5ff"
[[package]]
name = "libreddit"
version = "0.2.8"
version = "0.2.9"
dependencies = [
"actix-web",
"askama",

View File

@ -3,7 +3,7 @@ name = "libreddit"
description = " Alternative private front-end to Reddit"
license = "AGPL-3.0"
repository = "https://github.com/spikecodes/libreddit"
version = "0.2.8"
version = "0.2.9"
authors = ["spikecodes <19519553+spikecodes@users.noreply.github.com>"]
edition = "2018"

View File

@ -2,7 +2,7 @@
> An alternative private front-end to Reddit
![screenshot](https://i.ibb.co/FxxbKM6/libreddit-rust.png)
![screenshot](https://i.ibb.co/F0JsY5K/image.png)
---

View File

@ -171,7 +171,11 @@ async fn parse_comments(json: &serde_json::Value) -> Vec<Comment> {
},
distinguished: val(&comment, "distinguished"),
},
score: format_num(score),
score: if comment["data"]["score_hidden"].as_bool().unwrap_or_default() {
"".to_string()
} else {
format_num(score)
},
rel_time,
created,
replies,

View File

@ -145,7 +145,7 @@ pub fn prefs(req: HttpRequest) -> Preferences {
wide: cookie(&req, "wide"),
show_nsfw: cookie(&req, "show_nsfw"),
comment_sort: cookie(&req, "comment_sort"),
subs: cookie(&req, "subscriptions").split('+').map(String::from).filter(|s| s != "").collect(),
subs: cookie(&req, "subscriptions").split('+').map(String::from).filter(|s| !s.is_empty()).collect(),
}
}
@ -343,7 +343,11 @@ pub async fn fetch_posts(path: &str, fallback_title: String) -> Result<(Vec<Post
},
distinguished: val(post, "distinguished"),
},
score: format_num(score),
score: if post["data"]["hide_score"].as_bool().unwrap_or_default() {
"".to_string()
} else {
format_num(score)
},
upvote_ratio: ratio as i64,
post_type,
thumbnail: Media {

View File

@ -58,6 +58,11 @@
background: var(--accent);
}
:focus {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
html, body, div, h1, h2, h3, h4, h5, h6, ul, ol, dl, li, dt, dd, p, blockquote,
pre, form, fieldset, table, th, td, select, input {
margin: 0;
@ -93,12 +98,23 @@ nav {
}
nav * { color: var(--text); }
nav #reddit, #code { color: var(--accent); }
nav #logo { grid-area: logo; }
nav #reddit, #code > span { color: var(--accent); }
nav #code > svg { stroke: var(--accent); }
nav #logo {
grid-area: logo;
white-space: nowrap;
margin-right: 5px;
}
nav #links {
grid-area: links;
margin-left: 10px;
display: flex;
}
nav #links svg {
display: none;
}
nav #version {
@ -115,6 +131,10 @@ nav #libreddit {
opacity: 0.8;
}
#code {
margin-left: 5px;
}
main {
display: flex;
justify-content: center;
@ -1070,6 +1090,8 @@ td, th {
}
nav #links { margin-left: auto; }
nav #links span { display: none; }
nav #links svg { display: block; }
#subscriptions { position: unset; }

View File

@ -30,16 +30,20 @@
<!-- NAVIGATION BAR -->
<nav>
<div id="logo">
<a id="libreddit" href="/">
<span id="lib">lib</span><span id="reddit">reddit.</span>
</a>
<a id="libreddit" href="/"><span id="lib">lib</span><span id="reddit">reddit.</span></a>
<span id="version">v{{ env!("CARGO_PKG_VERSION") }}</span>
{% block subscriptions %}{% endblock %}
</div>
{% block search %}{% endblock %}
<div id="links">
<a id="settings_link" href="/settings">settings</a>
<a id="code" href="https://github.com/spikecodes/libreddit">code</a>
<a id="settings_link" href="/settings">
<span>settings</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>
</a>
<a id="code" href="https://github.com/spikecodes/libreddit">
<span>code</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>
</a>
</div>
</nav>