diff --git a/client/settings.html b/client/settings.html index 6beba6c..2931050 100644 --- a/client/settings.html +++ b/client/settings.html @@ -36,8 +36,11 @@
Backups
-
- Export OPML +
+ Export OPML (Original Urls) +
+
+ Export OPML (Podgrab Urls)
Rss Feed diff --git a/controllers/pages.go b/controllers/pages.go index 7f2660d..2034e22 100644 --- a/controllers/pages.go +++ b/controllers/pages.go @@ -332,7 +332,10 @@ func Search(c *gin.Context) { } func GetOmpl(c *gin.Context) { - data, err := service.ExportOmpl() + + usePodgrabLink := c.DefaultQuery("usePodgrabLink", "false") == "true" + + data, err := service.ExportOmpl(usePodgrabLink, getBaseUrl(c)) if err != nil { c.JSON(http.StatusBadRequest, gin.H{"message": "Invalid request"}) return diff --git a/service/podcastService.go b/service/podcastService.go index 8efa1fa..345d2a2 100644 --- a/service/podcastService.go +++ b/service/podcastService.go @@ -141,14 +141,22 @@ func AddOpml(content string) error { } -func ExportOmpl() ([]byte, error) { +func ExportOmpl(usePodgrabLink bool, baseUrl string) ([]byte, error) { + podcasts := GetAllPodcasts("") + var outlines []model.OpmlOutline for _, podcast := range *podcasts { + + xmlUrl := podcast.URL + if usePodgrabLink { + xmlUrl = fmt.Sprintf("%s/podcasts/%s/rss", baseUrl, podcast.ID) + } + toAdd := model.OpmlOutline{ AttrText: podcast.Summary, Type: "rss", - XmlUrl: podcast.URL, + XmlUrl: xmlUrl, Title: podcast.Title, } outlines = append(outlines, toAdd)