mirror of
https://github.com/spacebarchat/server.git
synced 2026-08-29 03:18:40 +00:00
Discovery fixes, nix updates
This commit is contained in:
@@ -11,8 +11,10 @@ using Spacebar.Models.Db.Contexts;
|
||||
using Spacebar.UApi.Services;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("APPSETTINGS_PATH")))
|
||||
if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("APPSETTINGS_PATH"))) {
|
||||
Console.WriteLine("Loading appsettings from path: " + Environment.GetEnvironmentVariable("APPSETTINGS_PATH"));
|
||||
builder.Configuration.AddJsonFile(Environment.GetEnvironmentVariable("APPSETTINGS_PATH")!);
|
||||
}
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
@@ -70,9 +72,23 @@ app.UseAuthorization();
|
||||
app.MapControllers();
|
||||
StreamingHttpClient.LogRequests = false;
|
||||
app.Use((context, next) => {
|
||||
context.Response.Headers["Access-Control-Allow-Origin"] = "*";
|
||||
context.Response.Headers["Access-Control-Allow-Methods"] = "GET, POST, PUT, DELETE, OPTIONS";
|
||||
context.Response.Headers["Access-Control-Allow-Headers"] = "*, Authorization";
|
||||
context.Response.Headers["Access-Control-Allow-Origin"] =
|
||||
string.IsNullOrWhiteSpace(context.Request.Headers.Origin)
|
||||
? "*"
|
||||
: context.Request.Headers.Origin;
|
||||
|
||||
context.Response.Headers["Access-Control-Allow-Methods"] =
|
||||
string.IsNullOrWhiteSpace(context.Request.Headers.AccessControlRequestMethod)
|
||||
? "GET, POST, PUT, DELETE, OPTIONS"
|
||||
: context.Request.Headers.AccessControlRequestMethod.ToString();
|
||||
|
||||
context.Response.Headers["Access-Control-Allow-Headers"] =
|
||||
string.IsNullOrWhiteSpace(context.Request.Headers.AccessControlRequestHeaders)
|
||||
? "*, Authorization"
|
||||
: context.Request.Headers.AccessControlRequestHeaders.ToString();
|
||||
|
||||
context.Response.Headers.AccessControlAllowCredentials = "true";
|
||||
|
||||
if (context.Request.Method == "OPTIONS") {
|
||||
context.Response.StatusCode = 200;
|
||||
return Task.CompletedTask;
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
<div class="@("guild-card " + (guild.DiscoveryExcluded ? "excluded" : ""))">
|
||||
<img class="guild-icon" src="@(guild.Icon is null ? $"{Config.CdnUrl}/embed/avatars/0.png" : $"{Config.CdnUrl}/icons/{guild.Id}/{guild.Icon}")" alt="@guild.Name"/>
|
||||
@if (guild.Banner is not null) {
|
||||
<img class="guild-banner" src="@($"{Config.CdnUrl}/banners/{guild.Id}/{guild.Banner}")"
|
||||
alt="@guild.Name"/>
|
||||
<img class="guild-banner" src="@($"{Config.CdnUrl}/banners/{guild.Id}/{guild.Banner}")" alt="@guild.Name"/>
|
||||
}
|
||||
<h4>@guild.Name</h4>
|
||||
<p>@guild.Description</p>
|
||||
|
||||
Reference in New Issue
Block a user