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/swagger] Fix federation swagger document

+12 -11
+12 -11
Iceshrimp.Backend/Controllers/Federation/WellKnownController.cs
··· 1 + using System.Net.Http.Headers; 1 2 using System.Net.Mime; 2 3 using System.Text; 3 4 using System.Xml.Serialization; 4 - using Iceshrimp.Backend.Controllers.Attributes; 5 5 using Iceshrimp.Backend.Controllers.Federation.Attributes; 6 6 using Iceshrimp.Backend.Controllers.Federation.Schemas; 7 7 using Iceshrimp.Backend.Controllers.Schemas; ··· 106 106 } 107 107 108 108 [HttpGet("host-meta")] 109 - [Produces("application/xrd+xml", "application/xml")] 110 - [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(object))] 109 + [Produces("application/xrd+xml", "application/jrd+json")] 110 + [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(HostMetaJsonResponse))] 111 111 public IActionResult HostMeta() 112 112 { 113 + var accept = Request.Headers.Accept.OfType<string>() 114 + .Select(MediaTypeWithQualityHeaderValue.Parse) 115 + .Select(p => p.MediaType) 116 + .ToList(); 117 + 118 + if (accept.Contains("application/jrd+json") || accept.Contains("application/json")) 119 + return HostMetaJson(); 120 + 113 121 var obj = new HostMetaXmlResponse(config.Value.WebDomain); 114 122 var serializer = new XmlSerializer(obj.GetType()); 115 123 var writer = new Utf8StringWriter(); ··· 118 126 return Content(writer.ToString(), "application/xrd+xml"); 119 127 } 120 128 121 - [HttpGet("host-meta")] 122 - [Produces("application/jrd+json")] 123 - [MediaTypeRouteFilter("application/jrd+json", "application/json")] 124 - [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(object))] 125 - public IActionResult HostMetaJsonFallback() 126 - => HostMetaJson(); 127 - 128 129 [HttpGet("host-meta.json")] 129 130 [Produces("application/jrd+json")] 130 - [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(object))] 131 + [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(HostMetaJsonResponse))] 131 132 public IActionResult HostMetaJson() 132 133 { 133 134 return Ok(new HostMetaJsonResponse(config.Value.WebDomain));