, St
#[cfg(test)]
mod tests {
use super::format_num;
+ use super::rewrite_urls;
#[test]
fn format_num_works() {
@@ -708,4 +727,14 @@ mod tests {
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()));
}
+
+ #[test]
+ fn rewrite_urls_removes_backslashes() {
+ let comment_body_html =
+ r#"https://www.reddit.com/r/linux\\_gaming/comments/x/just\\_a\\_test/ "#;
+ assert_eq!(
+ rewrite_urls(comment_body_html),
+ r#"https://www.reddit.com/r/linux_gaming/comments/x/just_a_test/ "#
+ )
+ }
}
diff --git a/static/style.css b/static/style.css
index 92ef7c2..664caee 100644
--- a/static/style.css
+++ b/static/style.css
@@ -45,124 +45,7 @@
}
}
-/* Light theme setting */
-.light {
- --accent: #009a9a;
- --green: #00a229;
- --text: black;
- --foreground: #f5f5f5;
- --background: #ddd;
- --outside: #ececec;
- --post: #eee;
- --panel-border: 1px solid #ccc;
- --highlighted: white;
- --visited: #555;
- --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
-}
-
-/* Black theme setting */
-.black {
- --accent: #009a9a;
- --green: #00a229;
- --text: white;
- --foreground: #0f0f0f;
- --background: black;
- --outside: black;
- --post: black;
- --panel-border: 2px solid #0f0f0f;
- --highlighted: #0f0f0f;
- --visited: #aaa;
- --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
-}
-
-/* Dracula theme setting */
-.dracula {
- --accent: #bd93f9;
- --green: #50fa7b;
- --text: #f8f8f2;
- --foreground: #3d4051;
- --background: #282a36;
- --outside: #393c4d;
- --post: #333544;
- --panel-border: 2px solid #44475a;
- --highlighted: #4e5267;
- --visited: #969692;
- --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
-}
-
-/* Nord theme setting */
-.nord {
- --accent: #8fbcbb;
- --green: #a3be8c;
- --text: #eceff4;
- --foreground: #3b4252;
- --background: #2e3440;
- --outside: #434c5e;
- --post: #434c5e;
- --panel-border: 2px solid #4c566a;
- --highlighted: #3b4252;
- --visited: #a3a5aa;
- --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
-}
-
-/* Laserwave theme setting */
-.laserwave {
- --accent: #eb64b9;
- --green: #74dfc4;
- --text: #e0dfe1;
- --foreground: #302a36;
- --background: #27212e;
- --outside: #3e3647;
- --post: #3e3647;
- --panel-border: 2px solid #2f2738;
- --highlighted: #302a36;
- --visited: #91889b;
- --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
-}
-
-/* Violet theme setting */
-.violet {
- --accent: #7c71dd;
- --green: #5cff85;
- --text: white;
- --foreground: #1F2347;
- --background: #12152b;
- --outside: #181c3a;
- --post: #181c3a;
- --panel-border: 1px solid #1F2347;
- --highlighted: #1F2347;
- --visited: #aaa;
- --shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
-}
-
-/* Gold theme setting */
-.gold {
- --accent: #f2aa4c;
- --green: #5cff85;
- --text: white;
- --foreground: #234;
- --background: #101820;
- --outside: #1b2936;
- --post: #1b2936;
- --panel-border: 0px solid black;
- --highlighted: #234;
- --visited: #aaa;
- --shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
-}
-
-/* Rosebox theme setting */
-.rosebox {
- --accent: #a57562;
- --green: #a3be8c;
- --text: white;
- --foreground: #222;
- --background: #262626;
- --outside: #222;
- --post: #222;
- --panel-border: 1px solid #222;
- --highlighted: #262626;
- --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
-}
+/* Other themes are located in the "themes" folder */
/* General */
@@ -177,6 +60,7 @@
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 {
+ accent-color: var(--accent);
margin: 0;
color: var(--text);
font-family: "Inter", sans-serif;
@@ -487,7 +371,7 @@ aside {
/* Sorting and Search */
-select, #search, #sort_options, #inside, #searchbox > *, #sort_submit {
+select, #search, #sort_options, #listing_options, #inside, #searchbox > *, #sort_submit {
height: 38px;
}
@@ -563,6 +447,11 @@ button.submit:hover > svg { stroke: var(--accent); }
border-radius: 5px 0px 0px 5px;
}
+#listing_options + #sort_select {
+ margin-left: 10px;
+ border-radius: 5px 0px 0px 5px;
+}
+
#search_sort {
background: var(--highlighted);
border-radius: 5px;
@@ -591,7 +480,7 @@ button.submit:hover > svg { stroke: var(--accent); }
margin-bottom: 20px;
}
-#sort_options, footer > a {
+#sort_options, #listing_options, footer > a {
border-radius: 5px;
align-items: center;
box-shadow: var(--shadow);
@@ -600,7 +489,7 @@ button.submit:hover > svg { stroke: var(--accent); }
overflow: hidden;
}
-#sort_options > a, footer > a {
+#sort_options > a, #listing_options > a, footer > a {
color: var(--text);
padding: 10px 20px;
text-align: center;
@@ -608,12 +497,12 @@ button.submit:hover > svg { stroke: var(--accent); }
transition: 0.2s background;
}
-#sort_options > a.selected {
+#sort_options > a.selected, #listing_options > a.selected {
background: var(--accent);
color: var(--foreground);
}
-#sort_options > a:not(.selected):hover {
+#sort_options > a:not(.selected):hover, #listing_options > a:not(.selected):hover {
background: var(--foreground);
}
@@ -749,6 +638,7 @@ a.search_subreddit:hover {
font-size: 16px;
font-weight: 500;
line-height: 1.5;
+ overflow-wrap: anywhere;
margin: 5px 15px 5px 12px;
grid-area: post_title;
}
@@ -878,6 +768,7 @@ a.search_subreddit:hover {
color: var(--accent);
margin: 5px 12px;
grid-area: post_media;
+ overflow-wrap: anywhere;
}
.post_body {
@@ -1311,6 +1202,8 @@ input[type="submit"] {
.md table {
margin: 5px;
overflow-x: auto;
+ display: block;
+ max-width: fit-content;
}
.md code {
diff --git a/static/themes/black.css b/static/themes/black.css
new file mode 100644
index 0000000..5906b5b
--- /dev/null
+++ b/static/themes/black.css
@@ -0,0 +1,14 @@
+/* Black theme setting */
+.black {
+ --accent: #009a9a;
+ --green: #00a229;
+ --text: white;
+ --foreground: #0f0f0f;
+ --background: black;
+ --outside: black;
+ --post: black;
+ --panel-border: 2px solid #0f0f0f;
+ --highlighted: #0f0f0f;
+ --visited: #aaa;
+ --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
+}
\ No newline at end of file
diff --git a/static/themes/dracula.css b/static/themes/dracula.css
new file mode 100644
index 0000000..0e36e2b
--- /dev/null
+++ b/static/themes/dracula.css
@@ -0,0 +1,14 @@
+/* Dracula theme setting */
+.dracula {
+ --accent: #bd93f9;
+ --green: #50fa7b;
+ --text: #f8f8f2;
+ --foreground: #3d4051;
+ --background: #282a36;
+ --outside: #393c4d;
+ --post: #333544;
+ --panel-border: 2px solid #44475a;
+ --highlighted: #4e5267;
+ --visited: #969692;
+ --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
+}
\ No newline at end of file
diff --git a/static/themes/gold.css b/static/themes/gold.css
new file mode 100644
index 0000000..4ff7d6e
--- /dev/null
+++ b/static/themes/gold.css
@@ -0,0 +1,14 @@
+/* Gold theme setting */
+.gold {
+ --accent: #f2aa4c;
+ --green: #5cff85;
+ --text: white;
+ --foreground: #234;
+ --background: #101820;
+ --outside: #1b2936;
+ --post: #1b2936;
+ --panel-border: 0px solid black;
+ --highlighted: #234;
+ --visited: #aaa;
+ --shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
+}
\ No newline at end of file
diff --git a/static/themes/laserwave.css b/static/themes/laserwave.css
new file mode 100644
index 0000000..dde21f3
--- /dev/null
+++ b/static/themes/laserwave.css
@@ -0,0 +1,14 @@
+/* Laserwave theme setting */
+.laserwave {
+ --accent: #eb64b9;
+ --green: #74dfc4;
+ --text: #e0dfe1;
+ --foreground: #302a36;
+ --background: #27212e;
+ --outside: #3e3647;
+ --post: #3e3647;
+ --panel-border: 2px solid #2f2738;
+ --highlighted: #302a36;
+ --visited: #91889b;
+ --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
+}
\ No newline at end of file
diff --git a/static/themes/light.css b/static/themes/light.css
new file mode 100644
index 0000000..1fe0387
--- /dev/null
+++ b/static/themes/light.css
@@ -0,0 +1,14 @@
+/* Light theme setting */
+.light {
+ --accent: #009a9a;
+ --green: #00a229;
+ --text: black;
+ --foreground: #f5f5f5;
+ --background: #ddd;
+ --outside: #ececec;
+ --post: #eee;
+ --panel-border: 1px solid #ccc;
+ --highlighted: white;
+ --visited: #555;
+ --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
+}
\ No newline at end of file
diff --git a/static/themes/nord.css b/static/themes/nord.css
new file mode 100644
index 0000000..d75fd11
--- /dev/null
+++ b/static/themes/nord.css
@@ -0,0 +1,14 @@
+/* Nord theme setting */
+.nord {
+ --accent: #8fbcbb;
+ --green: #a3be8c;
+ --text: #eceff4;
+ --foreground: #3b4252;
+ --background: #2e3440;
+ --outside: #434c5e;
+ --post: #434c5e;
+ --panel-border: 2px solid #4c566a;
+ --highlighted: #3b4252;
+ --visited: #a3a5aa;
+ --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
+}
diff --git a/static/themes/rosebox.css b/static/themes/rosebox.css
new file mode 100644
index 0000000..903931d
--- /dev/null
+++ b/static/themes/rosebox.css
@@ -0,0 +1,13 @@
+/* Rosebox theme setting */
+.rosebox {
+ --accent: #a57562;
+ --green: #a3be8c;
+ --text: white;
+ --foreground: #222;
+ --background: #262626;
+ --outside: #222;
+ --post: #222;
+ --panel-border: 1px solid #222;
+ --highlighted: #262626;
+ --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
+}
\ No newline at end of file
diff --git a/static/themes/violet.css b/static/themes/violet.css
new file mode 100644
index 0000000..0d836ee
--- /dev/null
+++ b/static/themes/violet.css
@@ -0,0 +1,14 @@
+/* Violet theme setting */
+.violet {
+ --accent: #7c71dd;
+ --green: #5cff85;
+ --text: white;
+ --foreground: #1F2347;
+ --background: #12152b;
+ --outside: #181c3a;
+ --post: #181c3a;
+ --panel-border: 1px solid #1F2347;
+ --highlighted: #1F2347;
+ --visited: #aaa;
+ --shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
+}
\ No newline at end of file
diff --git a/templates/settings.html b/templates/settings.html
index 8a70912..60ee109 100644
--- a/templates/settings.html
+++ b/templates/settings.html
@@ -15,7 +15,7 @@
Theme:
- {% call utils::options(prefs.theme, ["system", "light", "dark", "black", "dracula", "nord", "laserwave", "violet", "gold", "rosebox"], "system") %}
+ {% call utils::options(prefs.theme, prefs.available_themes, "system") %}
Interface
@@ -110,7 +110,7 @@
Note: settings and subscriptions are saved in browser cookies. Clearing your cookies will reset them.
-
You can restore your current settings and subscriptions after clearing your cookies using this link .
+
You can restore your current settings and subscriptions after clearing your cookies using this link .
diff --git a/templates/subreddit.html b/templates/subreddit.html
index bddf0e3..3ef318e 100644
--- a/templates/subreddit.html
+++ b/templates/subreddit.html
@@ -41,7 +41,7 @@
{% if sub.name.contains("+") %}
-
{% endif %}
@@ -74,12 +74,12 @@
{% endif %}
- {% if is_filtered || (!sub.name.is_empty() && !sub.name.contains("+")) %}
+ {% if is_filtered || (!sub.name.is_empty() && sub.name != "all" && sub.name != "popular" && !sub.name.contains("+")) %}
{% if is_filtered %}
(Content from r/{{ sub.name }} has been filtered)
{% endif %}
- {% if !sub.name.is_empty() && !sub.name.contains("+") %}
+ {% if !sub.name.is_empty() && sub.name != "all" && sub.name != "popular" && !sub.name.contains("+") %}
{% if sub.wiki %}
@@ -101,22 +101,22 @@
{% if prefs.subscriptions.contains(sub.name) %}
-
{% else %}
-
{% endif %}
{% if prefs.filters.contains(sub.name) %}
-
{% else %}
-
{% endif %}
diff --git a/templates/user.html b/templates/user.html
index 690ccb7..2e6278d 100644
--- a/templates/user.html
+++ b/templates/user.html
@@ -16,9 +16,12 @@
{% if !is_filtered %}