feat(subsonic): add internet radio support
* Initial commit of internet radio support. * Added first test for internet radio. * Refactor to prepare for more test cases. * Added a few more tests. Realized that I was not calling as admin so added ability to mock admin. * Added more internet radio tests. Added proper JSON unmarshaling for ID. * More test cases. Fixed some accidental tabs in files. * Fixed some more tabs. * lint fixes * Changed placeholder for homepage URL to fit into box. * Finished out internet radio test cases. Found a few bad error codes in internet radio AND podcasts (mea culpa). * Realized that delete via website was not checking properly if id existed. Fixed. gofmt
This commit is contained in:
@@ -46,7 +46,7 @@ func (c *Controller) ServeGetNewestPodcasts(r *http.Request) *spec.Response {
|
||||
func (c *Controller) ServeDownloadPodcastEpisode(r *http.Request) *spec.Response {
|
||||
user := r.Context().Value(CtxUser).(*db.User)
|
||||
if (!user.IsAdmin) {
|
||||
return spec.NewError(10, "user not admin")
|
||||
return spec.NewError(50, "user not admin")
|
||||
}
|
||||
params := r.Context().Value(CtxParams).(params.Params)
|
||||
id, err := params.GetID("id")
|
||||
@@ -62,7 +62,7 @@ func (c *Controller) ServeDownloadPodcastEpisode(r *http.Request) *spec.Response
|
||||
func (c *Controller) ServeCreatePodcastChannel(r *http.Request) *spec.Response {
|
||||
user := r.Context().Value(CtxUser).(*db.User)
|
||||
if (!user.IsAdmin) {
|
||||
return spec.NewError(10, "user not admin")
|
||||
return spec.NewError(50, "user not admin")
|
||||
}
|
||||
params := r.Context().Value(CtxParams).(params.Params)
|
||||
rssURL, _ := params.Get("url")
|
||||
@@ -80,7 +80,7 @@ func (c *Controller) ServeCreatePodcastChannel(r *http.Request) *spec.Response {
|
||||
func (c *Controller) ServeRefreshPodcasts(r *http.Request) *spec.Response {
|
||||
user := r.Context().Value(CtxUser).(*db.User)
|
||||
if (!user.IsAdmin) {
|
||||
return spec.NewError(10, "user not admin")
|
||||
return spec.NewError(50, "user not admin")
|
||||
}
|
||||
if err := c.Podcasts.RefreshPodcasts(); err != nil {
|
||||
return spec.NewError(10, "failed to refresh feeds: %s", err)
|
||||
@@ -91,7 +91,7 @@ func (c *Controller) ServeRefreshPodcasts(r *http.Request) *spec.Response {
|
||||
func (c *Controller) ServeDeletePodcastChannel(r *http.Request) *spec.Response {
|
||||
user := r.Context().Value(CtxUser).(*db.User)
|
||||
if (!user.IsAdmin) {
|
||||
return spec.NewError(10, "user not admin")
|
||||
return spec.NewError(50, "user not admin")
|
||||
}
|
||||
params := r.Context().Value(CtxParams).(params.Params)
|
||||
id, err := params.GetID("id")
|
||||
@@ -107,7 +107,7 @@ func (c *Controller) ServeDeletePodcastChannel(r *http.Request) *spec.Response {
|
||||
func (c *Controller) ServeDeletePodcastEpisode(r *http.Request) *spec.Response {
|
||||
user := r.Context().Value(CtxUser).(*db.User)
|
||||
if (!user.IsAdmin) {
|
||||
return spec.NewError(10, "user not admin")
|
||||
return spec.NewError(50, "user not admin")
|
||||
}
|
||||
params := r.Context().Value(CtxParams).(params.Params)
|
||||
id, err := params.GetID("id")
|
||||
|
||||
Reference in New Issue
Block a user