Fix indentation and formatting
This commit is contained in:
parent
6d73024183
commit
85ae7c1f60
7 changed files with 27 additions and 43 deletions
|
@ -133,8 +133,7 @@ async fn main() {
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
let address = matches.value_of("address").unwrap_or("0.0.0.0");
|
let address = matches.value_of("address").unwrap_or("0.0.0.0");
|
||||||
let port = std::env::var("PORT")
|
let port = std::env::var("PORT").unwrap_or_else(|_| matches.value_of("port").unwrap_or("8080").to_string());
|
||||||
.unwrap_or_else(|_| matches.value_of("port").unwrap_or("8080").to_string());
|
|
||||||
let hsts = matches.value_of("hsts");
|
let hsts = matches.value_of("hsts");
|
||||||
|
|
||||||
let listener = [address, ":", &port].concat();
|
let listener = [address, ":", &port].concat();
|
||||||
|
|
33
src/utils.rs
33
src/utils.rs
|
@ -632,27 +632,12 @@ pub async fn error(req: Request<Body>, msg: String) -> Result<Response<Body>, St
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::format_num;
|
use super::format_num;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn format_num_works() {
|
fn format_num_works() {
|
||||||
assert_eq!(
|
assert_eq!(format_num(567), ("567".to_string(), "567".to_string()));
|
||||||
format_num(567),
|
assert_eq!(format_num(1234), ("1.2k".to_string(), "1234".to_string()));
|
||||||
("567".to_string(), "567".to_string())
|
assert_eq!(format_num(1999), ("2.0k".to_string(), "1999".to_string()));
|
||||||
);
|
assert_eq!(format_num(1001), ("1.0k".to_string(), "1001".to_string()));
|
||||||
assert_eq!(
|
assert_eq!(format_num(1_999_999), ("2.0m".to_string(), "1999999".to_string()));
|
||||||
format_num(1234),
|
}
|
||||||
("1.2k".to_string(), "1234".to_string())
|
}
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
format_num(1999),
|
|
||||||
("2.0k".to_string(), "1999".to_string())
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
format_num(1001),
|
|
||||||
("1.0k".to_string(), "1001".to_string())
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
format_num(1_999_999),
|
|
||||||
("2.0m".to_string(), "1999999".to_string())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<meta name="apple-mobile-web-app-title" content="Libreddit">
|
<meta name="apple-mobile-web-app-title" content="Libreddit">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
||||||
<!-- Android -->
|
<!-- Android -->
|
||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<!-- iOS Logo -->
|
<!-- iOS Logo -->
|
||||||
<link href="/touch-icon-iphone.png" rel="apple-touch-icon">
|
<link href="/touch-icon-iphone.png" rel="apple-touch-icon">
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{% if kind == "more" && parent_kind == "t1" %}
|
{% if kind == "more" && parent_kind == "t1" %}
|
||||||
<a class="deeper_replies" href="{{ post_link }}{{ parent_id }}">→ More replies</a>
|
<a class="deeper_replies" href="{{ post_link }}{{ parent_id }}">→ More replies</a>
|
||||||
{% else if kind == "t1" %}
|
{% else if kind == "t1" %}
|
||||||
<div id="{{ id }}" class="comment">
|
<div id="{{ id }}" class="comment">
|
||||||
<div class="comment_left">
|
<div class="comment_left">
|
||||||
<p class="comment_score" title="{{ score.1 }}">{{ score.0 }}</p>
|
<p class="comment_score" title="{{ score.1 }}">{{ score.0 }}</p>
|
||||||
|
|
|
@ -104,16 +104,16 @@
|
||||||
<details class="panel" id="sidebar">
|
<details class="panel" id="sidebar">
|
||||||
<summary id="sidebar_label">Sidebar</summary>
|
<summary id="sidebar_label">Sidebar</summary>
|
||||||
<div id="sidebar_contents">
|
<div id="sidebar_contents">
|
||||||
{{ sub.info }}
|
{{ sub.info }}
|
||||||
{# <hr>
|
{# <hr>
|
||||||
<h2>Moderators</h2>
|
<h2>Moderators</h2>
|
||||||
<br>
|
<br>
|
||||||
<ul>
|
<ul>
|
||||||
{% for moderator in sub.moderators %}
|
{% for moderator in sub.moderators %}
|
||||||
<li><a style="color: var(--accent)" href="/u/{{ moderator }}">{{ moderator }}</a></li>
|
<li><a style="color: var(--accent)" href="/u/{{ moderator }}">{{ moderator }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul> #}
|
</ul> #}
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
</aside>
|
</aside>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
</p>
|
</p>
|
||||||
<!-- POST MEDIA/THUMBNAIL -->
|
<!-- POST MEDIA/THUMBNAIL -->
|
||||||
{% if (prefs.layout.is_empty() || prefs.layout == "card") && post.post_type == "image" %}
|
{% if (prefs.layout.is_empty() || prefs.layout == "card") && post.post_type == "image" %}
|
||||||
<a href="{{ post.media.url }}" class="post_media_image {% if post.media.height / post.media.width < 2 %}short{% endif %}" >
|
<a href="{{ post.media.url }}" class="post_media_image {% if post.media.height / post.media.width < 2 %}short{% endif %}" >
|
||||||
<svg
|
<svg
|
||||||
width="{{ post.media.width }}px"
|
width="{{ post.media.width }}px"
|
||||||
height="{{ post.media.height }}px"
|
height="{{ post.media.height }}px"
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
</svg>
|
</svg>
|
||||||
{% else %}
|
{% else %}
|
||||||
<svg width="{{ post.thumbnail.width }}px" height="{{ post.thumbnail.height }}px" xmlns="http://www.w3.org/2000/svg">
|
<svg width="{{ post.thumbnail.width }}px" height="{{ post.thumbnail.height }}px" xmlns="http://www.w3.org/2000/svg">
|
||||||
<image width="100%" height="100%" href="{{ post.thumbnail.url }}"/>
|
<image width="100%" height="100%" href="{{ post.thumbnail.url }}"/>
|
||||||
<desc>
|
<desc>
|
||||||
<img loading="lazy" alt="Thumbnail" src="{{ post.thumbnail.url }}"/>
|
<img loading="lazy" alt="Thumbnail" src="{{ post.thumbnail.url }}"/>
|
||||||
</desc>
|
</desc>
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="wall">
|
<div id="wall">
|
||||||
<h1>{{ title }}</h1>
|
<h1>{{ title }}</h1>
|
||||||
<br>
|
<br>
|
||||||
<p>{{ msg }}</p>
|
<p>{{ msg }}</p>
|
||||||
<form action="/r/{{ sub }}?redir={{ url }}" method="POST">
|
<form action="/r/{{ sub }}?redir={{ url }}" method="POST">
|
||||||
<input id="save" type="submit" value="Continue">
|
<input id="save" type="submit" value="Continue">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue