a fork of iceshrimp.net but a tweaked frontend to my personal liking. waow
fediverse social-media social iceshrimp fedi
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[backend/web] Add controller for Webmanifest

authored by

Lilian and committed by
Laura Hausmann
aac01b6a 88bf04a5

+57
+29
Iceshrimp.Backend/Controllers/Web/ManifestController.cs
··· 1 + using System.Net; 2 + using System.Net.Mime; 3 + using Iceshrimp.Backend.Controllers.Shared.Attributes; 4 + using Iceshrimp.Backend.Controllers.Web.Schemas; 5 + using Iceshrimp.Backend.Core.Configuration; 6 + using Microsoft.AspNetCore.Mvc; 7 + using Microsoft.AspNetCore.RateLimiting; 8 + using Microsoft.Extensions.Options; 9 + 10 + namespace Iceshrimp.Backend.Controllers.Web; 11 + 12 + [ApiController] 13 + [EnableRateLimiting("sliding")] 14 + [Route("/manifest.webmanifest")] 15 + [Produces(MediaTypeNames.Application.Json)] 16 + public class ManifestController(IOptions<Config.InstanceSection> config) : ControllerBase 17 + { 18 + [HttpGet] 19 + [ProducesResults(HttpStatusCode.OK)] 20 + public WebManifest GetWebManifest() 21 + { 22 + return new WebManifest 23 + { 24 + Name = config.Value.AccountDomain, ShortName = config.Value.AccountDomain 25 + }; 26 + } 27 + } 28 + 29 +
+28
Iceshrimp.Backend/Controllers/Web/Schemas/WebManifest.cs
··· 1 + namespace Iceshrimp.Backend.Controllers.Web.Schemas; 2 + using J = System.Text.Json.Serialization.JsonPropertyNameAttribute; 3 + 4 + 5 + public class WebManifest 6 + { 7 + [J("name")] public required string Name { get; set; } 8 + [J("short_name")] public required string ShortName { get; set; } 9 + [J("id")] public string Id { get; set; } = "./"; 10 + [J("start_url")] public string StartUrl { get; set; } = "./"; 11 + [J("display")] public string Display { get; set; } = "standalone"; 12 + [J("background_color")] public string BackgroundColor { get; set; } = "#ffffff"; 13 + [J("theme_color")] public string ThemeColor { get; set; } = "#03173d"; 14 + [J("prefer_related_applications")] public bool PreferRelatedApplications { get; set; } = false; 15 + 16 + [J("icons")] public List<Icon> Icons { get; set; } = 17 + [ 18 + new() { Src = "_content/Iceshrimp.Assets.Branding/512.png", Type = "image/png", Sizes = "512x512" }, 19 + new() { Src = "_content/Iceshrimp.Assets.Branding/192.png", Type = "image/png", Sizes = "192x192" } 20 + ]; 21 + 22 + public class Icon 23 + { 24 + [J("src")] public required string Src { get; set; } 25 + [J("type")] public required string Type { get; set; } 26 + [J("sizes")] public required string Sizes { get; set; } 27 + } 28 + }