mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
Make links to feeds backward compatible
This commit is contained in:
@@ -37,7 +37,7 @@ namespace Podsync.Controllers
|
||||
[HttpPost]
|
||||
[Route("create")]
|
||||
[ValidateModelState]
|
||||
public Task<string> Create([FromBody] CreateFeedRequest request)
|
||||
public async Task<Uri> Create([FromBody] CreateFeedRequest request)
|
||||
{
|
||||
var linkInfo = _linkService.Parse(new Uri(request.Url));
|
||||
|
||||
@@ -56,11 +56,12 @@ namespace Podsync.Controllers
|
||||
feed.PageSize = DefaultPageSize;
|
||||
}
|
||||
|
||||
return _storageService.Save(feed);
|
||||
var feedId = await _storageService.Save(feed);
|
||||
return _linkService.Feed(feedId);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{feedId}")]
|
||||
[Route("~/{feedId:length(4, 6)}")]
|
||||
[ValidateModelState]
|
||||
public async Task<IActionResult> Feed([Required] string feedId)
|
||||
{
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace Podsync.Controllers
|
||||
_resolverService = resolverService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("~/status")]
|
||||
public async Task<string> Index()
|
||||
{
|
||||
var storageStatus = ErrorStatus;
|
||||
|
||||
@@ -9,5 +9,7 @@ namespace Podsync.Services.Links
|
||||
Uri Make(LinkInfo info);
|
||||
|
||||
Uri Download(string feedId, string videoId);
|
||||
|
||||
Uri Feed(string feedId);
|
||||
}
|
||||
}
|
||||
@@ -206,5 +206,10 @@ namespace Podsync.Services.Links
|
||||
{
|
||||
return new Uri(_baseUrl, $"download/{feedId}/{videoId}/");
|
||||
}
|
||||
|
||||
public Uri Feed(string feedId)
|
||||
{
|
||||
return new Uri(_baseUrl, feedId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ services:
|
||||
- PORT=56247
|
||||
environment:
|
||||
- Podsync:RedisConnectionString=redis
|
||||
env_file:
|
||||
- ~/podsync.env
|
||||
redis:
|
||||
image: redis
|
||||
command: redis-server --appendonly yes
|
||||
|
||||
@@ -16,10 +16,10 @@ $(function () {
|
||||
method: 'POST',
|
||||
data: JSON.stringify(data),
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
success: function (feedId) {
|
||||
var proto = $(location).attr('protocol');
|
||||
var host = $(location).attr('host');
|
||||
done(proto + '//' + host + '/feed/' + feedId);
|
||||
success: function (feedLink) {
|
||||
// HACK: remove quotes
|
||||
feedLink = JSON.parse(feedLink);
|
||||
done(feedLink);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
if (xhr.status === 400) {
|
||||
|
||||
Reference in New Issue
Block a user