diff --git a/src/config.rs b/src/config.rs index c7ebb58..cd33492 100644 --- a/src/config.rs +++ b/src/config.rs @@ -60,6 +60,10 @@ pub struct Config { #[serde(alias = "LIBREDDIT_DEFAULT_USE_HLS")] pub(crate) default_use_hls: Option, + #[serde(rename = "REDLIB_DEFAULT_FFMPEG_VIDEO_DOWNLOADS")] + #[serde(alias = "LIBREDDIT_DEFAULT_FFMPEG_VIDEO_DOWNLOADS")] + pub(crate) default_ffmpeg_video_downloads: Option, + #[serde(rename = "REDLIB_DEFAULT_HIDE_HLS_NOTIFICATION")] #[serde(alias = "LIBREDDIT_DEFAULT_HIDE_HLS_NOTIFICATION")] pub(crate) default_hide_hls_notification: Option, @@ -129,6 +133,7 @@ impl Config { default_show_nsfw: parse("REDLIB_DEFAULT_SHOW_NSFW"), default_blur_nsfw: parse("REDLIB_DEFAULT_BLUR_NSFW"), default_use_hls: parse("REDLIB_DEFAULT_USE_HLS"), + default_ffmpeg_video_downloads: parse("REDLIB_DEFAULT_FFMPEG_VIDEO_DOWNLOADS"), default_hide_hls_notification: parse("REDLIB_DEFAULT_HIDE_HLS_NOTIFICATION"), default_hide_awards: parse("REDLIB_DEFAULT_HIDE_AWARDS"), default_hide_sidebar_and_summary: parse("REDLIB_DEFAULT_HIDE_SIDEBAR_AND_SUMMARY"), @@ -153,6 +158,7 @@ fn get_setting_from_config(name: &str, config: &Config) -> Option { "REDLIB_DEFAULT_SHOW_NSFW" => config.default_show_nsfw.clone(), "REDLIB_DEFAULT_BLUR_NSFW" => config.default_blur_nsfw.clone(), "REDLIB_DEFAULT_USE_HLS" => config.default_use_hls.clone(), + "REDLIB_DEFAULT_FFMPEG_VIDEO_DOWNLOADS" => config.default_ffmpeg_video_downloads.clone(), "REDLIB_DEFAULT_HIDE_HLS_NOTIFICATION" => config.default_hide_hls_notification.clone(), "REDLIB_DEFAULT_WIDE" => config.default_wide.clone(), "REDLIB_DEFAULT_HIDE_AWARDS" => config.default_hide_awards.clone(), diff --git a/src/settings.rs b/src/settings.rs index 6964675..4d6d72c 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -19,7 +19,7 @@ struct SettingsTemplate { // CONSTANTS -const PREFS: [&str; 16] = [ +const PREFS: [&str; 17] = [ "theme", "front_page", "layout", @@ -29,6 +29,7 @@ const PREFS: [&str; 16] = [ "show_nsfw", "blur_nsfw", "use_hls", + "ffmpeg_video_downloads", "hide_hls_notification", "autoplay_videos", "hide_sidebar_and_summary", diff --git a/src/utils.rs b/src/utils.rs index dbaf1de..3436c3e 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -579,6 +579,7 @@ pub struct Preferences { pub hide_hls_notification: String, pub hide_sidebar_and_summary: String, pub use_hls: String, + pub ffmpeg_video_downloads: String, pub autoplay_videos: String, pub fixed_navbar: String, pub disable_visit_reddit_confirmation: String, @@ -615,6 +616,7 @@ impl Preferences { hide_sidebar_and_summary: setting(req, "hide_sidebar_and_summary"), blur_nsfw: setting(req, "blur_nsfw"), use_hls: setting(req, "use_hls"), + ffmpeg_video_downloads: setting(req, "ffmpeg_video_downloads"), hide_hls_notification: setting(req, "hide_hls_notification"), autoplay_videos: setting(req, "autoplay_videos"), fixed_navbar: setting_or_default(req, "fixed_navbar", "on".to_string()), diff --git a/templates/settings.html b/templates/settings.html index 2caa345..dcb9ac4 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -91,6 +91,15 @@ +
+ +
+ Why? +
Downloading videos with audio requires ffmpeg (via ffmpeg.wasm) to be enabled to combine video and audio tracks. Therefore, this toggle lets you either use Redlib WebAssembly-free or utilize this feature. (videos will still play with audio)
+
+ + +
@@ -148,7 +157,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.