feature: Embed Frame Player
This commit is contained in:
@@ -59,6 +59,41 @@ public class TrackProxyController : ControllerBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Proxies single-track metadata lookup by vault entry key from DeepDrftAPI. Unauthenticated,
|
||||
/// same posture as the paged listing. Small JSON, so it is buffered and relayed; a 404 from
|
||||
/// upstream (no track with that entry key) passes through. Declared before the parameterized
|
||||
/// "{trackId}" route, though the 3-segment template makes a collision impossible regardless.
|
||||
/// </summary>
|
||||
[HttpGet("meta/by-key/{entryKey}")]
|
||||
public async Task<ActionResult> GetMetaByKey(string entryKey, CancellationToken ct = default)
|
||||
{
|
||||
var path = $"api/track/meta/by-key/{Uri.EscapeDataString(entryKey)}";
|
||||
|
||||
HttpResponseMessage upstream;
|
||||
try
|
||||
{
|
||||
upstream = await _upstream.GetAsync(path, HttpCompletionOption.ResponseHeadersRead, ct);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Upstream call to DeepDrftAPI track/meta/by-key/{EntryKey} failed", entryKey);
|
||||
return StatusCode(502, "Upstream unavailable");
|
||||
}
|
||||
|
||||
using (upstream)
|
||||
{
|
||||
if (!upstream.IsSuccessStatusCode)
|
||||
{
|
||||
_logger.LogWarning("DeepDrftAPI track/meta/by-key/{EntryKey} returned {Status}", entryKey, (int)upstream.StatusCode);
|
||||
return StatusCode((int)upstream.StatusCode);
|
||||
}
|
||||
|
||||
var json = await upstream.Content.ReadAsStringAsync(ct);
|
||||
return Content(json, "application/json");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Proxies audio streaming from DeepDrftAPI. Passes the optional byte offset
|
||||
/// so seek-beyond-buffer works through the proxy without buffering.
|
||||
|
||||
Reference in New Issue
Block a user