From ff76e59cbb2797123401bcbe226fc50e4692def1 Mon Sep 17 00:00:00 2001 From: potatoesAreGod <118043038+potatoesAreGod@users.noreply.github.com> Date: Tue, 22 Nov 2022 19:37:27 +0100 Subject: [PATCH] created on/off setting for link confirmation --- README.md | 1 + app.json | 3 +++ src/settings.rs | 3 ++- src/utils.rs | 2 ++ templates/base.html | 5 ++++- templates/settings.html | 5 +++++ 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ed7aa30..33b355a 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,7 @@ Assign a default value for each setting by passing environment variables to Libr | `USE_HLS` | `["on", "off"]` | `off` | | `HIDE_HLS_NOTIFICATION` | `["on", "off"]` | `off` | | `AUTOPLAY_VIDEOS` | `["on", "off"]` | `off` | +| `LINK_CONFIRMATION` | `["on", "off"]` | `off` | ### Examples diff --git a/app.json b/app.json index fd41fc8..a8f859c 100644 --- a/app.json +++ b/app.json @@ -40,6 +40,9 @@ }, "LIBREDDIT_HIDE_HLS_NOTIFICATION": { "required": false + }, + "LIBREDDIT_DEFAULT_LINK_CONFIRMATION": { + "required": false } } } diff --git a/src/settings.rs b/src/settings.rs index 0fd2640..40720c5 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -19,7 +19,7 @@ struct SettingsTemplate { // CONSTANTS -const PREFS: [&str; 11] = [ +const PREFS: [&str; 12] = [ "theme", "front_page", "layout", @@ -31,6 +31,7 @@ const PREFS: [&str; 11] = [ "use_hls", "hide_hls_notification", "autoplay_videos", + "link_confirmation", ]; // FUNCTIONS diff --git a/src/utils.rs b/src/utils.rs index 9d58e31..7c07bc7 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -466,6 +466,7 @@ pub struct Preferences { pub hide_hls_notification: String, pub use_hls: String, pub autoplay_videos: String, + pub link_confirmation: String, pub comment_sort: String, pub post_sort: String, pub subscriptions: Vec, @@ -498,6 +499,7 @@ impl Preferences { use_hls: setting(&req, "use_hls"), hide_hls_notification: setting(&req, "hide_hls_notification"), autoplay_videos: setting(&req, "autoplay_videos"), + link_confirmation: setting(&req, "link_confirmation"), comment_sort: setting(&req, "comment_sort"), post_sort: setting(&req, "post_sort"), subscriptions: setting(&req, "subscriptions").split('+').map(String::from).filter(|s| !s.is_empty()).collect(), diff --git a/templates/base.html b/templates/base.html index 704f4b3..515ee1d 100644 --- a/templates/base.html +++ b/templates/base.html @@ -35,16 +35,18 @@ {% block search %}{% endblock %} +