[backend/razor] Set instance icon in the frontend if configured
This commit is contained in:
parent
28a04c64d0
commit
66c003daeb
2 changed files with 14 additions and 0 deletions
|
@ -135,4 +135,17 @@ public class InstanceController(
|
|||
|
||||
return new StaffResponse { Admins = adminList, Moderators = moderatorList };
|
||||
}
|
||||
|
||||
// This is only used to set the icon for the frontend
|
||||
[HttpGet("/instance-icon")]
|
||||
[ProducesResults(HttpStatusCode.Redirect)]
|
||||
public async Task<RedirectResult> GetInstanceIcon()
|
||||
{
|
||||
var iconId = await meta.GetAsync(MetaEntity.IconFileId);
|
||||
var iconUrl = iconId != null
|
||||
? await db.DriveFiles.Where(p => p.Id == iconId).Select(p => p.PublicUrl).FirstOrDefaultAsync()
|
||||
: null;
|
||||
|
||||
return new RedirectResult(iconUrl ?? "/_content/Iceshrimp.Assets.Branding/favicon.png");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<link rel="stylesheet" href="~/_content/Iceshrimp.Assets.PhosphorIcons/css/ph-regular.css"/>
|
||||
<link rel="stylesheet" href="~/_content/Iceshrimp.Assets.PhosphorIcons/css/ph-fill.css"/>
|
||||
<link rel="icon" type="image/png" href="~/_content/Iceshrimp.Assets.Branding/favicon.png"/>
|
||||
<link rel="icon" href="instance-icon">
|
||||
<link rel="stylesheet" href="~/Iceshrimp.Frontend.styles.css"/>
|
||||
<link href="manifest.webmanifest" rel="manifest"/>
|
||||
<link rel="apple-touch-icon" sizes="512x512" href="~/_content/Iceshrimp.Assets.Branding/512.png"/>
|
||||
|
|
Loading…
Add table
Reference in a new issue