From adc12addfa1a78ac27f0e61bb6a594e56ac5f035 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Thu, 7 Oct 2021 13:53:12 +0200 Subject: Add config option to display source code URL in footer (#2450) --- src/invidious/helpers/helpers.cr | 4 +++ src/invidious/routes/preferences.cr | 2 ++ src/invidious/views/preferences.ecr | 5 ++++ src/invidious/views/template.ecr | 59 +++++++++++++++++++++---------------- 4 files changed, 45 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr index 99adcd30..968062d6 100644 --- a/src/invidious/helpers/helpers.cr +++ b/src/invidious/helpers/helpers.cr @@ -97,6 +97,10 @@ class Config property hsts : Bool? = true # Enables 'Strict-Transport-Security'. Ensure that `domain` and all subdomains are served securely property disable_proxy : Bool? | Array(String)? = false # Disable proxying server-wide: options: 'dash', 'livestreams', 'downloads', 'local' + # URL to the modified source code to be easily AGPL compliant + # Will display in the footer, next to the main source code link + property modified_source_code_url : String? = nil + @[YAML::Field(converter: Preferences::FamilyConverter)] property force_resolve : Socket::Family = Socket::Family::UNSPEC # Connect to YouTube over 'ipv6', 'ipv4'. Will sometimes resolve fix issues with rate-limiting (see https://github.com/ytdl-org/youtube-dl/issues/21729) property port : Int32 = 3000 # Port to listen for connections (overrided by command line argument) diff --git a/src/invidious/routes/preferences.cr b/src/invidious/routes/preferences.cr index 9410ac30..ae5407dc 100644 --- a/src/invidious/routes/preferences.cr +++ b/src/invidious/routes/preferences.cr @@ -200,6 +200,8 @@ module Invidious::Routes::PreferencesRoute statistics_enabled ||= "off" CONFIG.statistics_enabled = statistics_enabled == "on" + CONFIG.modified_source_code_url = env.params.body["modified_source_code_url"]?.try &.as(String) + File.write("config/config.yml", CONFIG.to_yaml) end else diff --git a/src/invidious/views/preferences.ecr b/src/invidious/views/preferences.ecr index be021c59..401c15ea 100644 --- a/src/invidious/views/preferences.ecr +++ b/src/invidious/views/preferences.ecr @@ -286,6 +286,11 @@ checked<% end %>> + +
+ + checked<% end %>> +
<% end %> <% if env.get? "user" %> diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr index 7be95959..b7020598 100644 --- a/src/invidious/views/template.ecr +++ b/src/invidious/views/template.ecr @@ -117,38 +117,47 @@ +
-- cgit v1.2.3