-
Notifications
You must be signed in to change notification settings - Fork 0
V17/dev #312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V17/dev #312
Changes from all commits
06389c8
ffde534
5bdd9c0
7fcc7df
73c43cb
e8d479a
d71786c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| using uTPro.Feature.GeoLocation.Extensions; | ||
| using uTPro.Foundation.Middleware; | ||
| using WebMarkupMin.AspNetCoreLatest; | ||
|
|
||
|
|
@@ -26,6 +27,7 @@ public static WebApplication ConfigurePipeline(this WebApplication app) | |
| app.UseWebMarkupMin(); | ||
| app.UseOutputCache(); | ||
| app.UseCookiePolicy(); | ||
| app.UseGeoLocationDetection(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🤖 get_repo_knowledge executed:
Length of output: 401 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- target file ---'
cat -n uTPro/Project/uTPro.Project.Web/Startup/PipelineSetup.cs | sed -n '1,100p'
printf '%s\n' '--- relevant definitions and registrations ---'
rg -n -S -g '*.cs' 'UseGeoLocationDetection|UseFrontendCaching|UseOutputCache|OutputCache|uTPro\.Culture|CultureInfo|GeoLocation' uTPro/Project/uTPro.Project.WebRepository: T4VN/uTPro Length of output: 6487 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- performance registration ---'
cat -n uTPro/Project/uTPro.Project.Web/Startup/PerformanceSetup.cs | sed -n '90,150p'
printf '%s\n' '--- geolocation files ---'
fd -i -t f 'geo|culture|local' uTPro | head -80
printf '%s\n' '--- relevant symbols ---'
rg -n -S -g '*.cs' 'class .*Geo|UseGeoLocationDetection|GeoLocationDetection|uTPro\.Culture|RequestCulture|CurrentCulture|CultureCookie|CookieRequestCultureProvider|SetThread|ResponseCache|OutputCache' uTProRepository: T4VN/uTPro Length of output: 6610 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- localization middleware ---'
cat -n uTPro/Foundation/uTPro.Foundation.Middleware/RequestLocalizationOptionMiddleware.cs | sed -n '1,220p'
printf '%s\n' '--- localization registration and pipeline usage ---'
cat -n uTPro/Foundation/uTPro.Foundation.Middleware/UseWebRequestLocalizationMiddleware.cs
rg -n -S -g '*.cs' 'UseWebRequestLocalizationMiddleware|RequestLocalizationOptionMiddleware|AddPolicy\("Page"|PolicyName\s*=\s*"Page"|OutputCache\(' uTPro
printf '%s\n' '--- geolocation binding and project references ---'
rg -n -S -g '*.csproj' -g '*.props' -g '*.targets' -g '*.cs' 'GeoLocation' uTProRepository: T4VN/uTPro Length of output: 15734 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- root culture resolution ---'
cat -n uTPro/Foundation/uTPro.Foundation.Middleware/RequestLocalizationOptionMiddleware.cs | sed -n '270,375p'
printf '%s\n' '--- remaining pipeline configuration ---'
cat -n uTPro/Project/uTPro.Project.Web/Startup/PipelineSetup.cs | sed -n '94,150p'Repository: T4VN/uTPro Length of output: 5964 🏁 Script executed: #!/bin/bash
set -eu
cat -n uTPro/Foundation/uTPro.Foundation.Middleware/RequestLocalizationOptionMiddleware.cs | sed -n '193,270p'
printf '%s\n' '--- domain culture configuration ---'
for f in uTPro/Project/uTPro.Project.Web/uSync/v17/Domains/*.config; do
printf '%s\n' "--- $f"
sed -n '1,80p' "$f"
doneRepository: T4VN/uTPro Length of output: 6154 Do not mark the culture-dependent root response as publicly cacheable.
🤖 Prompt for AI AgentsSource: MCP tools |
||
| app.UseInitMiddleware(); | ||
| app.ConfigureUmbracoPipeline(); | ||
| app.MapControllers(); | ||
|
|
@@ -44,16 +46,23 @@ private static void UseFrontendCaching(this WebApplication app) | |
| && !path.StartsWith("/umbraco", StringComparison.OrdinalIgnoreCase) | ||
| && !path.StartsWith("/app_plugins", StringComparison.OrdinalIgnoreCase) | ||
| && !path.Contains('.'); | ||
| var isRootPage = string.IsNullOrEmpty(path) || path == "/"; | ||
|
|
||
| if (isWebsitePage) | ||
| { | ||
| context.Response.OnStarting(() => | ||
| { | ||
| if (context.Response.StatusCode == 200 | ||
| && !context.Response.Headers.ContainsKey("Cache-Control")) | ||
| if (context.Response.StatusCode == 200) | ||
| { | ||
| context.Response.Headers.CacheControl = | ||
| "public, max-age=120, stale-while-revalidate=60"; | ||
| if (isRootPage) | ||
| { | ||
| context.Response.Headers.CacheControl = "private, no-store"; | ||
| } | ||
| else if (!context.Response.Headers.ContainsKey("Cache-Control")) | ||
| { | ||
| context.Response.Headers.CacheControl = | ||
| "public, max-age=120, stale-while-revalidate=60"; | ||
| } | ||
| } | ||
| return Task.CompletedTask; | ||
| }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Continue fallback when the culture cookie is unsupported.
At Line 309, any non-empty cookie value blocks both GeoLocation and the site-default branch. If the cookie is stale or names a culture absent from
domains,SelectDomainForCulturereturns null.cultureremains non-empty, so Lines 325-326 skipGetLanguageDefault, and root handling returns no culture. Treat an unsupported cookie as empty before selecting the GeoLocation or default culture.🤖 Prompt for AI Agents