summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEmilien Devos <contact@emiliendevos.be>2023-06-04 17:13:48 +0200
committerEmilien Devos <contact@emiliendevos.be>2023-06-04 17:30:23 +0200
commit372192eabc9a23373023d0ed9209059138bb4e66 (patch)
tree6d42d5e9d930ce3b4d9ab647b49e80e15ffb54cb /src
parentbc06c2fc27a9f1fb4edb8a2af570d67c0af5ba0e (diff)
downloadinvidious-372192eabc9a23373023d0ed9209059138bb4e66.tar.gz
invidious-372192eabc9a23373023d0ed9209059138bb4e66.tar.bz2
invidious-372192eabc9a23373023d0ed9209059138bb4e66.zip
warn about hmac key deadline
Diffstat (limited to 'src')
-rw-r--r--src/invidious.cr9
-rw-r--r--src/invidious/views/template.ecr8
2 files changed, 15 insertions, 2 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index b5abd5c7..27c4775e 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -57,8 +57,9 @@ end
# Simple alias to make code easier to read
alias IV = Invidious
-CONFIG = Config.load
-HMAC_KEY = CONFIG.hmac_key || Random::Secure.hex(32)
+CONFIG = Config.load
+HMAC_KEY_CONFIGURED = CONFIG.hmac_key != nil
+HMAC_KEY = CONFIG.hmac_key || Random::Secure.hex(32)
PG_DB = DB.open CONFIG.database_url
ARCHIVE_URL = URI.parse("https://archive.org")
@@ -230,6 +231,10 @@ Kemal.config.host_binding = Kemal.config.host_binding != "0.0.0.0" ? Kemal.confi
Kemal.config.port = Kemal.config.port != 3000 ? Kemal.config.port : CONFIG.port
Kemal.config.app_name = "Invidious"
+if !HMAC_KEY_CONFIGURED
+ LOGGER.warn("Please configure hmac_key by July 1st, see more here: https://github.com/iv-org/invidious/issues/3854")
+end
+
# Use in kemal's production mode.
# Users can also set the KEMAL_ENV environmental variable for this to be set automatically.
{% if flag?(:release) || flag?(:production) %}
diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr
index 77265679..aa0fc15f 100644
--- a/src/invidious/views/template.ecr
+++ b/src/invidious/views/template.ecr
@@ -111,6 +111,14 @@
</div>
<% end %>
+ <% if env.get? "user" %>
+ <% if !HMAC_KEY_CONFIGURED && CONFIG.admins.includes? env.get("user").as(Invidious::User).email %>
+ <div class="h-box">
+ <h3><p>Message for admin: please configure hmac_key, <a href="https://github.com/iv-org/invidious/issues/3854">see more here</a>.</p></h3>
+ </div>
+ <% end %>
+ <% end %>
+
<%= content %>
<footer>