chore: remove duplicate copies of the site, download center and installers (WS-C)
The landing page, download pages, invite page, assetlinks and installers existed in two or three places; only site/ and the Forgejo feed are served. - apps/api-server/wwwroot: delete the stale site build, download/invite pages, .well-known copy, legacy static admin and 1.0.0 binaries. The API no longer serves static files (UseStaticFiles/fallbacks and the apk/zip blocker removed); the Next admin is the only admin UI. - Delete 19 tracked installers/packages (~568 MiB) under site/public/releases, apps/web/public/releases and wwwroot/releases; .gitignore blocks them. - apps/web: delete the download/releases pages, desktop-release.ts, the download.html and assetlinks copies, and the accept-invite page (invites are only issued to the site's /accept-invite/). e2e specs call the /app base path and check the /download redirect instead. - scripts: delete the retired release/NAS site scripts, drop the web target from sync-version, and check assetlinks in site/public only. - Delete the unused Dockerfile.admin (apps/admin/Dockerfile is used). Policy: docs/REFACTOR_POLICY.md Wave 3, W3-5 and W3-6.
This commit is contained in:
parent
b6fe588a7c
commit
cd9d199dbf
53 changed files with 43 additions and 3278 deletions
|
|
@ -393,65 +393,9 @@ if (app.Environment.IsDevelopment())
|
|||
}
|
||||
|
||||
app.UseCors("ConfiguredOrigins");
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
var isInvitePage =
|
||||
context.Request.Path.StartsWithSegments("/accept-invite")
|
||||
|| context.Request.Path.Equals("/accept-invite.html");
|
||||
|
||||
if (isInvitePage)
|
||||
{
|
||||
context.Response.OnStarting(() =>
|
||||
{
|
||||
// The invite token lives in the query string. Do not cache the page and
|
||||
// prevent CDN HTML transforms (including analytics script injection).
|
||||
context.Response.Headers["Cache-Control"] = "no-store, no-transform";
|
||||
context.Response.Headers["Content-Security-Policy"] =
|
||||
"default-src 'self'; base-uri 'none'; connect-src 'none'; font-src 'self'; " +
|
||||
"form-action 'none'; frame-ancestors 'none'; img-src 'self' data:; " +
|
||||
"object-src 'none'; script-src 'self'; style-src 'self'";
|
||||
context.Response.Headers["Permissions-Policy"] =
|
||||
"camera=(), microphone=(), geolocation=(), payment=(), usb=()";
|
||||
context.Response.Headers["Referrer-Policy"] = "no-referrer";
|
||||
context.Response.Headers["X-Content-Type-Options"] = "nosniff";
|
||||
context.Response.Headers["X-Frame-Options"] = "DENY";
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
||||
if (context.Request.Path.Equals("/accept-invite"))
|
||||
{
|
||||
context.Response.StatusCode = StatusCodes.Status308PermanentRedirect;
|
||||
context.Response.Headers.Location = $"/accept-invite/{context.Request.QueryString}";
|
||||
return;
|
||||
}
|
||||
|
||||
await next();
|
||||
});
|
||||
app.UseDefaultFiles();
|
||||
// Historical mobile binaries remain in the checkout for forensics only. They
|
||||
// are not official releases and must never be reachable through StaticFiles.
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
var requestPath = context.Request.Path.Value ?? string.Empty;
|
||||
var fileName = Path.GetFileName(requestPath);
|
||||
var legacyMarketingAsset = requestPath.Equals("/assets/index-D7M5UQvT.js", StringComparison.OrdinalIgnoreCase)
|
||||
|| requestPath.Equals("/assets/index-JlYFxlAJ.js", StringComparison.OrdinalIgnoreCase);
|
||||
var mobileReleasePath = requestPath.StartsWith("/releases/", StringComparison.OrdinalIgnoreCase)
|
||||
&& (fileName.EndsWith(".apk", StringComparison.OrdinalIgnoreCase)
|
||||
|| fileName.EndsWith(".aab", StringComparison.OrdinalIgnoreCase)
|
||||
|| (fileName.EndsWith(".zip", StringComparison.OrdinalIgnoreCase)
|
||||
&& (fileName.Contains("android", StringComparison.OrdinalIgnoreCase)
|
||||
|| fileName.Contains("signed", StringComparison.OrdinalIgnoreCase))));
|
||||
if (mobileReleasePath || legacyMarketingAsset)
|
||||
{
|
||||
context.Response.StatusCode = StatusCodes.Status404NotFound;
|
||||
return;
|
||||
}
|
||||
await next();
|
||||
});
|
||||
|
||||
app.UseStaticFiles();
|
||||
// The API serves no static pages. Landing, download, legal, invite and
|
||||
// assetlinks pages live only in site/ (Cloudflare Pages); the admin UI is
|
||||
// apps/admin. Installers are published only through the Forgejo update feed.
|
||||
|
||||
app.UseRateLimiter();
|
||||
app.UseAuthentication();
|
||||
|
|
@ -480,10 +424,6 @@ app.MapGet("/api/health", () => Results.Ok(new
|
|||
|
||||
app.MapControllers();
|
||||
|
||||
app.MapFallbackToFile("/accept-invite", "accept-invite.html");
|
||||
// Fallback to Admin BackOffice UI index.html
|
||||
app.MapFallbackToFile("/admin/{*path}", "admin/index.html");
|
||||
|
||||
app.Run();
|
||||
|
||||
public partial class Program { }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue