Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

feat: make update interval configurable via UPDATE_INTERVAL_MINUTES env

Christian Fei856a5760ba85
diff --git a/.env.example b/.env.example
index 5963f5a..32d399c 100644
--- a/.env.example
+++ b/.env.example
@@ -3,4 +3,5 @@ AI_APIKEY=
AI_MODEL=meta-llama-3.1-8b-instruct
AI_HOST=http://127.0.0.1:1234
AI_ENDPOINT=/v1/chat/completions
-AI_TEMPERATURE=0
\ No newline at end of file
+AI_TEMPERATURE=0
+UPDATE_INTERVAL_MINUTES=30
diff --git a/README.md b/README.md
index 223fbc5..e91d9ac 100644
--- a/README.md
+++ b/README.md
@@ -98,6 +98,7 @@ docker run -d -p 3000:3000 -v $HOME/my-yt-data:/app/data christianfei/my-yt:late
| AI_HOST | string | http://127.0.0.1:1234 |
| AI_ENDPOINT | string | /v1/chat/completions |
| AI_TEMPERATURE | string | 0 |
+| UPDATE_INTERVAL_MINUTES | number | 30 |
**Simply set the env variables to your needs, by following the format above (e.g. url starting with "http", no ending slash, AI_ENDPOINT with leading slash and path)**
diff --git a/index.js b/index.js
index 4555e69..d772024 100644
--- a/index.js
+++ b/index.js
@@ -13,7 +13,7 @@ async function main ({ port = 3000 } = {}) {
let lastAdded = Date.now()
runUpdateVideos(repo, connections)
- setInterval(runUpdateVideos, 1000 * 60 * 30, repo, connections)
+ setInterval(runUpdateVideos, (+process.env.UPDATE_INTERVAL_MINUTES || 30) * 1000 * 60, repo, connections)
createServer({ repo, state, connections })
.listen(port, () => {