mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
Don't allow to create audio feeds for Vimeo
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user