Fix more warnings.

This commit is contained in:
2026-05-05 03:26:39 +01:00
parent 1382baa8a8
commit d286fd471d
9 changed files with 14 additions and 18 deletions

View File

@@ -9,7 +9,7 @@
Variant="Variant.Outlined"
Required="true"
RequiredError="@L["Name is required."]"
Validation="ValidateNameAsync"
Validation="@(new Func<string, Task<string>>(ValidateNameAsync))"
Immediate="true"
Class="mb-4"/>

View File

@@ -9,7 +9,7 @@
Variant="Variant.Outlined"
Required="true"
RequiredError="@L["Extension is required."]"
Validation="ValidateExtensionAsync"
Validation="@(new Func<string, Task<string>>(ValidateExtensionAsync))"
Immediate="true"
Class="mb-4"/>

View File

@@ -464,13 +464,13 @@
</MudDialog>
@code {
string _validationError;
string _validationError = null;
SoftwarePlatformDto _selectedPlatform;
List<SoftwarePlatformDto> _allPlatforms;
UnM49Dto? _selectedRegionToAdd;
UnM49Dto _selectedRegionToAdd;
List<UnM49Dto> _allUnM49;
List<UnM49BySoftwareReleaseDto> _releaseRegions;
Iso639Dto? _selectedLanguageToAdd;
Iso639Dto _selectedLanguageToAdd;
List<Iso639Dto> _allLanguages;
List<LanguageBySoftwareReleaseDto> _releaseLanguages;
CompanyDto _selectedPublisher;

View File

@@ -15,7 +15,6 @@ public partial class SoftwareReleases
List<SoftwareReleaseDto> _releases;
string _successMessage;
string _versionName;
string _softwareName;
bool _isVersionContext;
bool _isSoftwareContext;

View File

@@ -511,7 +511,7 @@ public class BooksService(Marechai.ApiClient.Client client)
{
return await client.Books[bookId].Cover.Upload.PostAsync(body);
}
catch(ProblemDetails ex)
catch(ProblemDetails)
{
return null;
}

View File

@@ -27,12 +27,11 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Marechai.ApiClient.Models;
using Microsoft.Extensions.Localization;
using Microsoft.Kiota.Abstractions;
namespace Marechai.Services;
public class CompaniesService(Marechai.ApiClient.Client client, IStringLocalizer<CompaniesService> localizer)
public class CompaniesService(Marechai.ApiClient.Client client)
{
public async Task<List<CompanyDto>> GetAsync()
{

View File

@@ -27,12 +27,11 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Marechai.ApiClient.Models;
using Microsoft.Extensions.Localization;
using Microsoft.Kiota.Abstractions;
namespace Marechai.Services;
public class MachinesService(Marechai.ApiClient.Client client, IStringLocalizer<MachinesService> localizer)
public class MachinesService(Marechai.ApiClient.Client client)
{
public async Task<MachineDto> GetMachine(int id)
{

View File

@@ -26,11 +26,10 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Marechai.ApiClient.Models;
using Microsoft.Extensions.Localization;
namespace Marechai.Services;
public class NewsService(Marechai.ApiClient.Client client, IStringLocalizer<NewsService> localizer)
public class NewsService(Marechai.ApiClient.Client client)
{
public async Task<List<NewsDto>> GetNewsAsync()
{

View File

@@ -10,19 +10,19 @@ public sealed class SecurityHeadersMiddleware(RequestDelegate next)
{
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
// TODO Change the value depending of your needs
context.Response.Headers.Add("referrer-policy", new StringValues("strict-origin-when-cross-origin"));
context.Response.Headers["referrer-policy"] = new StringValues("strict-origin-when-cross-origin");
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
context.Response.Headers.Add("x-content-type-options", new StringValues("nosniff"));
context.Response.Headers["x-content-type-options"] = new StringValues("nosniff");
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
context.Response.Headers.Add("x-frame-options", new StringValues("DENY"));
context.Response.Headers["x-frame-options"] = new StringValues("DENY");
// https://security.stackexchange.com/questions/166024/does-the-x-permitted-cross-domain-policies-header-have-any-benefit-for-my-websit
context.Response.Headers.Add("X-Permitted-Cross-Domain-Policies", new StringValues("none"));
context.Response.Headers["X-Permitted-Cross-Domain-Policies"] = new StringValues("none");
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
context.Response.Headers.Add("x-xss-protection", new StringValues("1; mode=block"));
context.Response.Headers["x-xss-protection"] = new StringValues("1; mode=block");
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
// https://github.com/w3c/webappsec-feature-policy/blob/master/features.md