Skip to content

Commit 42f67cf

Browse files
committed
country login fixed v2
1 parent cdc5dee commit 42f67cf

4 files changed

Lines changed: 31 additions & 4 deletions

File tree

SD.API/Core/HttpRequestDataExtensions.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,26 @@ public static async Task<HttpResponseData> CreateResponse<T>(this HttpRequestDat
6363
return response;
6464
}
6565

66+
public static async Task<HttpResponseData> CreateResponse(this HttpRequestData req, string? text, TtlCache maxAge, CancellationToken cancellationToken)
67+
{
68+
var response = req.CreateResponse();
69+
70+
if (text.NotEmpty())
71+
{
72+
response.StatusCode = HttpStatusCode.OK;
73+
response.Headers.Add("Content-Type", "text/plain; charset=utf-8");
74+
await response.WriteStringAsync(text, cancellationToken);
75+
}
76+
else
77+
{
78+
response.StatusCode = HttpStatusCode.NoContent;
79+
}
80+
81+
response.Headers.Add("Cache-Control", $"public, max-age={(int)maxAge}");
82+
83+
return response;
84+
}
85+
6686
public static async Task<HttpResponseData> CreateResponse(this HttpRequestData req, Stream? stream, TtlCache maxAge, CancellationToken cancellationToken)
6787
{
6888
var response = req.CreateResponse();
@@ -186,4 +206,4 @@ public struct Method
186206
public const string Put = "PUT";
187207

188208
public const string Delete = "DELETE";
189-
}
209+
}

SD.API/Functions/ExternalFunction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public async Task<HttpResponseData> Country([HttpTrigger(AuthorizationLevel.Anon
3131
if (ip.NotEmpty() && ip != "127.0.0.1")
3232
{
3333
var result = await client.GetStringAsync($"https://ipinfo.io/{ip}/country", cancellationToken);
34-
return await req.CreateResponse(result.RemoveUnsafeControlChars(), TtlCache.OneMinute, cancellationToken);
34+
return await req.CreateResponse(result.Trim(), TtlCache.OneMinute, cancellationToken);
3535
}
3636

37-
return await req.CreateResponse(null, TtlCache.OneMinute, cancellationToken);
37+
return await req.CreateResponse((string?)null, TtlCache.OneMinute, cancellationToken);
3838
}
3939
}

SD.WEB/Modules/Subscription/Components/SubscriptionPlans.razor

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@
140140
{
141141
var priceId = Config?.GetPriceId(product, Cycle);
142142

143+
if (priceId.Empty())
144+
{
145+
await ShowWarning($"Price not available for {product.GetFieldSettings().Name}");
146+
_processing = false; StateHasChanged();
147+
return;
148+
}
149+
143150
if (Provider == PaymentProvider.Paddle)
144151
{
145152
await ShowWarning($"Provider not available: {Provider.GetFieldSettings().Name}");

SD.WEB/wwwroot/js/app-version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
window.appVersion = '2026.07.14'
1+
window.appVersion = '2026.07.16'

0 commit comments

Comments
 (0)