From aadedda1115853bec8130a34d9248ae350b099ec Mon Sep 17 00:00:00 2001 From: NKIPSC <15067635+NKIPSC@users.noreply.github.com> Date: Sun, 10 Apr 2022 20:45:24 +0200 Subject: [PATCH] Add option to blur nsfw previews --- app.json | 3 +++ src/settings.rs | 3 ++- src/utils.rs | 2 ++ templates/settings.html | 7 ++++++- templates/utils.html | 10 +++++----- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/app.json b/app.json index 8573671..fd41fc8 100644 --- a/app.json +++ b/app.json @@ -32,6 +32,9 @@ "LIBREDDIT_DEFAULT_SHOW_NSFW": { "required": false }, + "LIBREDDIT_DEFAULT_BLUR_NSFW": { + "required": false + }, "LIBREDDIT_USE_HLS": { "required": false }, diff --git a/src/settings.rs b/src/settings.rs index 9cdd266..0fd2640 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -19,7 +19,7 @@ struct SettingsTemplate { // CONSTANTS -const PREFS: [&str; 10] = [ +const PREFS: [&str; 11] = [ "theme", "front_page", "layout", @@ -27,6 +27,7 @@ const PREFS: [&str; 10] = [ "comment_sort", "post_sort", "show_nsfw", + "blur_nsfw", "use_hls", "hide_hls_notification", "autoplay_videos", diff --git a/src/utils.rs b/src/utils.rs index 56a7de7..c64f4e5 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -450,6 +450,7 @@ pub struct Preferences { pub layout: String, pub wide: String, pub show_nsfw: String, + pub blur_nsfw: String, pub hide_hls_notification: String, pub use_hls: String, pub autoplay_videos: String, @@ -468,6 +469,7 @@ impl Preferences { layout: setting(&req, "layout"), wide: setting(&req, "wide"), show_nsfw: setting(&req, "show_nsfw"), + blur_nsfw: setting(&req, "blur_nsfw"), use_hls: setting(&req, "use_hls"), hide_hls_notification: setting(&req, "hide_hls_notification"), autoplay_videos: setting(&req, "autoplay_videos"), diff --git a/templates/settings.html b/templates/settings.html index 8a70912..dade97a 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -54,6 +54,11 @@ +
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.