Static Files direkt aus Quell-wwwroot laden, Publish-Kopie deaktiviert
- Program.cs: PhysicalFileProvider auf ../../../wwwroot (Fallback auf publish/wwwroot) - Program.cs: No-Cache-Middleware für HTML/JS/CSS - gott.csproj: PublishStaticWebAssets=false, CopyToPublishDirectory=Never für wwwroot - CSS: DB-Explorer-Styling auf CSS-Variablen umgestellt
This commit is contained in:
1 parent
e61f3ef082
commit
e368abced0
3 files changed
+55
-44
No files matched your search
+32
-2
@@ -7,8 +7,10 @@ using Gott.Endpoints;
|
||||
using Gott.Middleware;
|
||||
using Gott.Services;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
@@ -113,12 +115,40 @@ builder.Services.AddSingleton<GitHubEventScannerService>();
|
||||
builder.Services.AddHostedService<GitHubEventScannerService>(sp => sp.GetRequiredService<GitHubEventScannerService>());
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// No-cache for static files (mobile browsers love caching too much)
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
var path = context.Request.Path.Value ?? "";
|
||||
if (path.EndsWith(".html") || path.EndsWith(".js") || path.EndsWith(".css") || path == "/")
|
||||
{
|
||||
var headers = context.Response.Headers;
|
||||
headers["Cache-Control"] = "no-cache, no-store, must-revalidate";
|
||||
headers["Pragma"] = "no-cache";
|
||||
headers["Expires"] = "0";
|
||||
}
|
||||
await next();
|
||||
});
|
||||
|
||||
toolService.SetHttpClientFactory(app.Services.GetRequiredService<IHttpClientFactory>());
|
||||
app.Services.GetRequiredService<AnthropicService>().SetTelegramService(app.Services.GetRequiredService<TelegramService>());
|
||||
await app.Services.GetRequiredService<OpenAiService>().LoadModelsAsync();
|
||||
app.UseWebSockets();
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
|
||||
// wwwroot: Quell-Verzeichnis bevorzugen (Live-Änderungen ohne Publish)
|
||||
var devWwwroot = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "wwwroot"));
|
||||
if (Directory.Exists(devWwwroot))
|
||||
{
|
||||
var fileProvider = new PhysicalFileProvider(devWwwroot);
|
||||
app.UseDefaultFiles(new DefaultFilesOptions { FileProvider = fileProvider });
|
||||
app.UseStaticFiles(new StaticFileOptions { FileProvider = fileProvider });
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
}
|
||||
|
||||
app.UseMiddleware<AuthMiddleware>();
|
||||
|
||||
app.MapAuthEndpoints();
|
||||
|
||||
@@ -34,6 +34,15 @@
|
||||
<None Remove="ExampleScannerProject/**" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- wwwroot wird zur Laufzeit direkt aus dem Quellverzeichnis gelesen (siehe Program.cs) -->
|
||||
<PropertyGroup>
|
||||
<PublishStaticWebAssets>false</PublishStaticWebAssets>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="wwwroot/**" CopyToPublishDirectory="Never" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Templates/**" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
+14
-42
@@ -789,56 +789,42 @@ a.admin-user-meta {
|
||||
.db-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: .9em;
|
||||
}
|
||||
|
||||
.db-table th,
|
||||
.db-table tr:not(:last-child) td {
|
||||
text-align: left;
|
||||
border-bottom: 1px solid var(--f1-border);
|
||||
}
|
||||
|
||||
.db-table th,
|
||||
.db-table td {
|
||||
padding: 8px 12px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: var(--badge-padding);
|
||||
}
|
||||
|
||||
.db-table th {
|
||||
background: var(--bg-secondary);
|
||||
font-weight: 600;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.db-table tbody tr:hover {
|
||||
background: color-mix(in srgb, var(--accent) 8%, transparent);
|
||||
}
|
||||
|
||||
.db-table-row.clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.db-table-row.clickable:hover .db-table-name {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.db-table-name {
|
||||
font-weight: 500;
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.db-table-name i {
|
||||
margin-right: 6px;
|
||||
opacity: .5;
|
||||
margin-right: var(--badge-spacing);
|
||||
opacity: var(--semi-transparent);
|
||||
}
|
||||
|
||||
.db-table-num {
|
||||
text-align: right !important;
|
||||
font-variant-numeric: tabular-nums;
|
||||
opacity: .7;
|
||||
}
|
||||
|
||||
.db-table-wrapper {
|
||||
overflow-x: auto;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
.db-data-table td {
|
||||
@@ -846,12 +832,10 @@ a.admin-user-meta {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-family: var(--font-mono, monospace);
|
||||
font-size: .85em;
|
||||
}
|
||||
|
||||
.db-null {
|
||||
opacity: .3;
|
||||
opacity: var(--semi-transparent);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@@ -859,27 +843,15 @@ a.admin-user-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 8px 0;
|
||||
font-size: .9em;
|
||||
opacity: .7;
|
||||
padding: var(--box-padding);
|
||||
}
|
||||
|
||||
.db-pagination {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.db-page-info {
|
||||
font-size: .85em;
|
||||
}
|
||||
|
||||
.db-back-link {
|
||||
opacity: .6;
|
||||
transition: opacity .15s;
|
||||
gap: var(--badge-spacing)
|
||||
}
|
||||
|
||||
.db-back-link:hover {
|
||||
opacity: 1;
|
||||
color: var(--accent);
|
||||
color: var(--primary);
|
||||
}
|
||||
Reference in new issue
Block a user