mirror of
https://github.com/fergalmoran/podnoms.git
synced 2025-12-25 18:58:12 +00:00
Removed outdated user repo stuff
This commit is contained in:
@@ -4,36 +4,35 @@ using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using HandlebarsDotNet;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using PodNoms.Api.Models;
|
||||
using PodNoms.Api.Models.ViewModels.RssViewModels;
|
||||
using PodNoms.Api.Persistence;
|
||||
using PodNoms.Api.Services.Auth;
|
||||
using PodNoms.Api.Utils;
|
||||
using PodNoms.Api.Utils.Extensions;
|
||||
|
||||
namespace PodNoms.Api.Controllers
|
||||
{
|
||||
namespace PodNoms.Api.Controllers {
|
||||
[Route("[controller]")]
|
||||
public class RssController : Controller
|
||||
{
|
||||
public class RssController : Controller {
|
||||
private readonly IPodcastRepository _podcastRepository;
|
||||
private readonly IUserRepository _userRepository;
|
||||
private readonly UserManager<ApplicationUser> _userManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly AppSettings _appOptions;
|
||||
private readonly StorageSettings _storageOptions;
|
||||
private readonly ImageFileStorageSettings _imageOptions;
|
||||
|
||||
public RssController(IPodcastRepository podcastRespository,
|
||||
IUserRepository userRepository,
|
||||
IOptions<AppSettings> appOptions,
|
||||
IOptions<ImageFileStorageSettings> imageOptions,
|
||||
IOptions<StorageSettings> storageOptions,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
UserManager<ApplicationUser> userManager,
|
||||
ILoggerFactory loggerFactory) {
|
||||
_podcastRepository = podcastRespository;
|
||||
_userRepository = userRepository;
|
||||
_userManager = userManager;
|
||||
_appOptions = appOptions.Value;
|
||||
_imageOptions = imageOptions.Value;
|
||||
_storageOptions = storageOptions.Value;
|
||||
@@ -42,19 +41,16 @@ namespace PodNoms.Api.Controllers
|
||||
|
||||
[HttpGet("{slug}/{entry}")]
|
||||
[Produces("application/xml")]
|
||||
public async Task<IActionResult> Get(string slug, string entry)
|
||||
{
|
||||
public async Task<IActionResult> Get(string slug, string entry) {
|
||||
_logger.LogDebug("RSS: Retrieving podcast");
|
||||
var user = await _userRepository.GetBySlugAsync(slug);
|
||||
if (user != null)
|
||||
{
|
||||
var podcast = await _podcastRepository.GetAsync(user.EmailAddress, entry);
|
||||
if (podcast != null)
|
||||
{
|
||||
|
||||
var user = await _userManager.FindBySlugAsync(slug);
|
||||
if (user != null) {
|
||||
var podcast = await _podcastRepository.GetAsync(user.Id, entry);
|
||||
if (podcast != null) {
|
||||
string xml = ResourceReader.ReadResource("podcast.xml", _logger);
|
||||
var template = Handlebars.Compile(xml);
|
||||
var compiled = new PodcastEnclosureViewModel
|
||||
{
|
||||
var compiled = new PodcastEnclosureViewModel {
|
||||
Title = podcast.Title,
|
||||
Description = podcast.Description,
|
||||
Author = "PodNoms Podcasts",
|
||||
@@ -65,8 +61,7 @@ namespace PodNoms.Api.Controllers
|
||||
Copyright = $"© {DateTime.Now.Year} PodNoms",
|
||||
Items = (
|
||||
from e in podcast.PodcastEntries
|
||||
select new PodcastEnclosureItemViewModel
|
||||
{
|
||||
select new PodcastEnclosureItemViewModel {
|
||||
Title = e.Title.StripNonXMLChars(),
|
||||
Description = e.Description.StripNonXMLChars(),
|
||||
Author = e.Author.StripNonXMLChars(),
|
||||
|
||||
Reference in New Issue
Block a user