diff --git a/.env b/.env index 105fba8..43b0b2f 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ CONFIG=. DATA=./assets -CHECK_FREQUENCY = 10 \ No newline at end of file +CHECK_FREQUENCY = 10 +PASSWORD= \ No newline at end of file diff --git a/Readme.md b/Readme.md index 65e51a4..4c789c3 100644 --- a/Readme.md +++ b/Readme.md @@ -115,6 +115,7 @@ services: container_name: podgrab environment: - CHECK_FREQUENCY=240 + # - PASSWORD=password ## Uncomment to enable basic authentication, username = podgrab volumes: - /path/to/config:/config - /path/to/data:/assets @@ -132,6 +133,7 @@ services: | Name | Description | Default | | --------------- | ----------------------------------------------------------------------- | ------- | | CHECK_FREQUENCY | How frequently to check for new episodes and missing files (in minutes) | 30 | +| PASSWORD | Set to some no empty value to enable Basic Authentication, username `podgrab`|(empty)| @@ -141,11 +143,19 @@ Distributed under the MIT License. See `LICENSE` for more information. ## Roadmap -Following are the things that I plan to complete in the near future. +- [x] Basic Authentication +- [x] Append Date to filename +- [x] iTunes Search +- [x] Existing episodes detection (Will not redownload if files exist even with a fresh install) +- [x] Rudimentary downloading/downloaded indicator +- [x] Played/Unplayed Flag +- [x] OPML import +- [ ] OPML export +- [ ] Set ID3 tags if not set +- [ ] Filtering and Sorting options +- [ ] In built podcast player + -- Some more code refactoring. -- API standardisation so that it can be used to build apps on top of it. -- Better search and discovery diff --git a/main.go b/main.go index 2b046ba..150fe77 100644 --- a/main.go +++ b/main.go @@ -94,32 +94,42 @@ func main() { //r.LoadHTMLGlob("client/*") r.SetHTMLTemplate(tmpl) - r.POST("/podcasts", controllers.AddPodcast) - r.GET("/podcasts", controllers.GetAllPodcasts) - r.GET("/podcasts/:id", controllers.GetPodcastById) - r.DELETE("/podcasts/:id", controllers.DeletePodcastById) - r.GET("/podcasts/:id/items", controllers.GetPodcastItemsByPodcastId) - r.GET("/podcasts/:id/download", controllers.DownloadAllEpisodesByPodcastId) - r.DELETE("/podcasts/:id/items", controllers.DeletePodcastEpisodesById) - - r.GET("/podcastitems", controllers.GetAllPodcastItems) - r.GET("/podcastitems/:id", controllers.GetPodcastItemById) - r.GET("/podcastitems/:id/markUnplayed", controllers.MarkPodcastItemAsUnplayed) - r.GET("/podcastitems/:id/markPlayed", controllers.MarkPodcastItemAsPlayed) - r.PATCH("/podcastitems/:id", controllers.PatchPodcastItemById) - r.GET("/podcastitems/:id/download", controllers.DownloadPodcastItem) - r.GET("/podcastitems/:id/delete", controllers.DeletePodcastItem) - - r.GET("/add", controllers.AddPage) - r.GET("/search", controllers.Search) - r.GET("/", controllers.HomePage) - r.GET("/podcasts/:id/view", controllers.PodcastPage) - r.GET("/episodes", controllers.AllEpisodesPage) - r.GET("/settings", controllers.SettingsPage) - r.POST("/settings", controllers.UpdateSetting) - r.GET("/backups", controllers.BackupsPage) - r.POST("/opml", controllers.UploadOpml) - r.GET("/opml", controllers.GetOmpl) + pass := os.Getenv("PASSWORD") + var router *gin.RouterGroup + if pass != "" { + router = r.Group("/", gin.BasicAuth(gin.Accounts{ + "podgrab": pass, + })) + } else { + router = &r.RouterGroup + } + + router.POST("/podcasts", controllers.AddPodcast) + router.GET("/podcasts", controllers.GetAllPodcasts) + router.GET("/podcasts/:id", controllers.GetPodcastById) + router.DELETE("/podcasts/:id", controllers.DeletePodcastById) + router.GET("/podcasts/:id/items", controllers.GetPodcastItemsByPodcastId) + router.GET("/podcasts/:id/download", controllers.DownloadAllEpisodesByPodcastId) + router.DELETE("/podcasts/:id/items", controllers.DeletePodcastEpisodesById) + + router.GET("/podcastitems", controllers.GetAllPodcastItems) + router.GET("/podcastitems/:id", controllers.GetPodcastItemById) + router.GET("/podcastitems/:id/markUnplayed", controllers.MarkPodcastItemAsUnplayed) + router.GET("/podcastitems/:id/markPlayed", controllers.MarkPodcastItemAsPlayed) + router.PATCH("/podcastitems/:id", controllers.PatchPodcastItemById) + router.GET("/podcastitems/:id/download", controllers.DownloadPodcastItem) + router.GET("/podcastitems/:id/delete", controllers.DeletePodcastItem) + + router.GET("/add", controllers.AddPage) + router.GET("/search", controllers.Search) + router.GET("/", controllers.HomePage) + router.GET("/podcasts/:id/view", controllers.PodcastPage) + router.GET("/episodes", controllers.AllEpisodesPage) + router.GET("/settings", controllers.SettingsPage) + router.POST("/settings", controllers.UpdateSetting) + router.GET("/backups", controllers.BackupsPage) + router.POST("/opml", controllers.UploadOpml) + router.GET("/opml", controllers.GetOmpl) go assetEnv() go intiCron()