Adjust emote size and implement load delay

This commit is contained in:
Infi
2024-08-26 00:10:56 +02:00
parent bb3e1fd98b
commit f6ea2c0dd3
3 changed files with 18 additions and 3 deletions
+9 -1
View File
@@ -100,13 +100,21 @@ public class RouteController
var emote = EmoteCache.GetEmote(name);
if (emote is not { IsLoaded: true })
if (emote is null)
{
ctx.Response.StatusCode = 400;
await ctx.Response.Send("Emote not valid.");
return;
}
// Wait for the emote to be loaded a maximum of 5 times
var timeout = 5;
while (!emote.IsLoaded && timeout > 0)
{
timeout--;
await Task.Delay(25);
}
ctx.Response.Headers.Add("Cache-Control", "max-age=86400");
await ctx.Response.Send(emote.RawData);
}