1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-13 09:08:17 -05:00

feat: allow custom app-id.json location for rootless

Co-authored-by: Justin Baur <justindbaur@users.noreply.github.com>
This commit is contained in:
tangowithfoxtrot 2025-03-04 09:33:01 -08:00
parent 9c67d7cf5b
commit a9d15790d5
No known key found for this signature in database

View File

@ -26,7 +26,8 @@ public class Startup
public void Configure(
IApplicationBuilder app,
IConfiguration configuration)
IConfiguration configuration,
ILogger<Startup> logger)
{
if (configuration.GetValue<bool?>("serveUnknown") ?? false)
{
@ -44,6 +45,22 @@ public class Startup
}
else if (configuration.GetValue<bool?>("webVault") ?? false)
{
var appIdLocation = configuration.GetValue<string>("appIdLocation");
if (!string.IsNullOrEmpty(appIdLocation))
{
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/app-id.json", async context =>
{
var appId = await File.ReadAllTextAsync(appIdLocation);
context.Response.ContentType = "application/json";
await context.Response.WriteAsync(appId);
});
});
}
// TODO: This should be removed when asp.net natively support avif
var provider = new FileExtensionContentTypeProvider { Mappings = { [".avif"] = "image/avif" } };