fix(invidious): automatically create hmac key (#16523)

**Description**
<!--
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.
-->
⚒️ Fixes  #16366

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [ ] ⚖️ My code follows the style guidelines of this project
- [ ] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [ ] ⬆️ I increased versions for any altered app according to semantic
versioning

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🪞 I have opened a PR on
[truecharts/containers](https://github.com/truecharts/containers) adding
the container to TrueCharts mirror repo.
- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._

---------

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
This commit is contained in:
Stavros Kois
2023-12-25 14:52:00 +02:00
committed by GitHub
parent 465ad3387c
commit 6bfe0d7df4
5 changed files with 16 additions and 16 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
kubeVersion: '>=1.24.0-0'
apiVersion: v2
name: invidious
version: 7.0.12
version: 7.0.13
appVersion: latest
description: Open source alternative front-end to YouTube.
home: https://truecharts.org/charts/stable/invidious
-7
View File
@@ -346,13 +346,6 @@ questions:
schema:
type: boolean
default: false
- variable: hmac_key
label: HMAC Key
description: HMAC signing key used for CSRF tokens and pubsub subscriptions verification. A random key must be generated and placed here.
schema:
type: string
private: true
default: ""
- variable: dmca_content
label: DMCA Content
description: List of video IDs where the "download" widget must be disabled, in order to comply with DMCA requests.
+10 -2
View File
@@ -1,5 +1,12 @@
{{/* Define the configmap */}}
{{- define "invidious.config" -}}
{{- define "invidious.secret" -}}
{{- $secretName := printf "%s-invidious-secret" (include "tc.v1.common.lib.chart.names.fullname" .) -}}
{{- $hmac := randAlphaNum 64 -}}
{{- with (lookup "v1" "Secret" .Release.Namespace $secretName) -}}
{{- $hmac = (index .data "HMAC_KEY") | b64dec -}}
{{- end -}}
{{- $vNet := .Values.invidious.network }}
{{- $vLog := .Values.invidious.logging }}
@@ -17,6 +24,7 @@
{{- $vUserMisc := .Values.invidious.default_user_preferences.miscellaneous }}
enabled: true
data:
HMAC_KEY: {{ $hmac }}
INVIDIOUS_CONFIG: |
# Database
check_tables: true
@@ -85,7 +93,7 @@ data:
# Miscellaneaous
banner: {{ $vMisc.banner }}
use_pubsub_feeds: {{ $vMisc.use_pubsub_feeds }}
hmac_key: {{ $vMisc.hmac_key }}
hmac_key: {{ $hmac }}
{{- if $vMisc.dmca_content }}
dmca_content:
{{- range $vMisc.dmca_content }}
@@ -2,9 +2,9 @@
{{- include "tc.v1.common.loader.init" . }}
{{/* Render configmap for invidious */}}
{{- $configmapFile := include "invidious.config" . | fromYaml -}}
{{- if $configmapFile -}}
{{- $_ := set .Values.configmap "invidious-config" $configmapFile -}}
{{- $secretFile := include "invidious.secret" . | fromYaml -}}
{{- if $secretFile -}}
{{- $_ := set .Values.secret "invidious-secret" $secretFile -}}
{{- end -}}
{{/* Render the templates */}}
+2 -3
View File
@@ -64,8 +64,8 @@ workload:
startup:
type: http
envFrom:
- configMapRef:
name: invidious-config
- secretRef:
name: invidious-secret
invidious:
network:
inbound:
@@ -110,7 +110,6 @@ invidious:
miscellaneous:
banner: ""
use_pubsub_feeds: false
hmac_key: ""
dmca_content: []
cache_annotations: false
playlist_length_limit: 500