all repos

moviefeed @ 1875224f9bc529f58d7112bd12fe12b8501a15d3

rss feed server for tracking new tv show episodes
3 files changed, 12 insertions(+), 4 deletions(-)
add some layer of auth
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-01-18 14:21:00 +0200
Change ID: kqrqqxtrnxptzktmtzlnyytpkyvxrksu
Parent: 2bda86d
M README.md

@@ -16,7 +16,7 @@ # Run

./moviefeed -config config.yaml ``` -Server starts on port 8000 (configurable). Access the RSS feed at `http://localhost:8000/`. +Server starts on port 8000 (configurable). Access the RSS feed at `http://localhost:8000/`, or `http://localhost:8000/?access_key=mySecretKey` ## Configuration

@@ -24,6 +24,7 @@ Create `config.yaml` (or `config.json`):

```yaml api_key: "your_tmdb_api_key" # required: get from themoviedb.org/settings/api +access_key: "sercret-key" # adds a layer of "auth", only users that know the key can access the api port: "8000" # optional: defaults to "8000" shows: # required - "tt22202452" # IMDB ID (Pluribus)
M config.go

@@ -11,9 +11,10 @@ "gopkg.in/yaml.v2"

) type Config struct { - APIKey string `json:"api_key" yaml:"api_key"` - Port string `json:"port" yaml:"port"` - Shows []string `json:"shows" yaml:"shows"` + APIKey string `json:"api_key" yaml:"api_key"` + AccessKey string `json:"access_key" yaml:"access_key"` + Port string `json:"port" yaml:"port"` + Shows []string `json:"shows" yaml:"shows"` } func loadConfig(path string) (*Config, error) {
M main.go

@@ -25,6 +25,12 @@ }

http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { slog.Info("incoming request", "method", r.Method, "url", r.URL.String()) + + if r.URL.Query().Get("access_key") != config.AccessKey { + w.WriteHeader(http.StatusUnauthorized) + return + } + episodes, err := fetchNewEpisodes(config) if err != nil { slog.Error("failed to fetch episodes", "err", err)