Add repo manifest
Use title cards when non provided or is livestream
This commit is contained in:
@@ -461,4 +461,38 @@ public class StreamProxyController : ControllerBase
|
||||
return StatusCode(StatusCodes.Status502BadGateway);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a placeholder image with the given text centered.
|
||||
/// </summary>
|
||||
/// <param name="text">The text to display (base64 encoded).</param>
|
||||
/// <returns>A PNG image with the text centered.</returns>
|
||||
[HttpGet("Placeholder")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
public IActionResult GetPlaceholder([FromQuery] string text)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
return BadRequest("Text parameter is required");
|
||||
}
|
||||
|
||||
string decodedText;
|
||||
try
|
||||
{
|
||||
var bytes = Convert.FromBase64String(text);
|
||||
decodedText = System.Text.Encoding.UTF8.GetString(bytes);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
_logger.LogWarning("Invalid base64 text parameter: {Text}", text);
|
||||
return BadRequest("Invalid text encoding");
|
||||
}
|
||||
|
||||
_logger.LogDebug("Generating placeholder image for: {Text}", decodedText);
|
||||
|
||||
var imageStream = PlaceholderImageGenerator.GeneratePlaceholder(decodedText);
|
||||
return File(imageStream, "image/png");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user