Don't allow to create audio feeds for Vimeo

This commit is contained in:
Maksym Pavlenko
2017-01-12 11:48:06 -08:00
parent de9a7f4222
commit 5f24489d2b
2 changed files with 9 additions and 3 deletions
+2 -2
View File
@@ -47,9 +47,9 @@ namespace Podsync.Controllers
{
var linkInfo = _linkService.Parse(new Uri(request.Url));
if (linkInfo.LinkType == LinkType.Video)
if (linkInfo.Provider != Provider.YouTube && request.Quality.HasValue && request.Quality.Value.IsAudio())
{
throw new ArgumentException("Direct links are not supported, you should provide group, channel or user link");
throw new ArgumentException("Only YouTube supports audio feeds");
}
var feed = new FeedMetadata
+7 -1
View File
@@ -4,6 +4,7 @@ using System.Security.Claims;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Podsync.Services;
using Podsync.Services.Resolver;
namespace Podsync.Helpers
{
@@ -68,9 +69,14 @@ namespace Podsync.Helpers
?? "noname :(";
}
public static string GetClaim(this ClaimsPrincipal claimsPrincipal, string type)
private static string GetClaim(this ClaimsPrincipal claimsPrincipal, string type)
{
return claimsPrincipal.Claims.FirstOrDefault(x => x.Type == type)?.Value;
}
public static bool IsAudio(this ResolveFormat format)
{
return format == ResolveFormat.AudioHigh || format == ResolveFormat.AudioLow;
}
}
}