chore 优化代码

This commit is contained in:
2025-10-16 10:30:51 +08:00
parent f1c609b4be
commit 1f5bc3e971
367 changed files with 2705 additions and 3083 deletions

View File

@ -26,7 +26,7 @@ namespace KonSoft;
typeof(AbpAccountApplicationModule),
typeof(AbpAccountHttpApiModule),
typeof(KonSoftSharedHostingMicroservicesModule)
)]
)]
public class KonSoftAuthServerModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
@ -53,7 +53,8 @@ public class KonSoftAuthServerModule : AbpModule
PreConfigure<OpenIddictServerBuilder>(serverBuilder =>
{
serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx", "59464dba-b66e-48cd-8b81-2e4a9c08c977");
serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx",
"59464dba-b66e-48cd-8b81-2e4a9c08c977");
});
}
}
@ -77,23 +78,17 @@ public class KonSoftAuthServerModule : AbpModule
{
options.StyleBundles.Configure(
BasicThemeBundles.Styles.Global,
bundle =>
{
bundle.AddFiles("/global-styles.css");
}
bundle => { bundle.AddFiles("/global-styles.css"); }
);
});
Configure<AbpAuditingOptions>(options =>
{
options.IsEnabledForGetRequests = true;
options.ApplicationName = "AuthServer";
options.IsEnabledForGetRequests = true;
options.ApplicationName = "AuthServer";
});
Configure<AbpBackgroundJobOptions>(options =>
{
options.IsJobExecutionEnabled = false;
});
Configure<AbpBackgroundJobOptions>(options => { options.IsJobExecutionEnabled = false; });
context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options =>
{
@ -138,4 +133,4 @@ public class KonSoftAuthServerModule : AbpModule
app.UseAbpSerilogEnrichers();
app.UseConfiguredEndpoints();
}
}
}

View File

@ -8,7 +8,7 @@ namespace KonSoft;
[Dependency(ReplaceServices = true)]
public class KonSoftBrandingProvider : DefaultBrandingProvider
{
private IStringLocalizer<KonSoftResource> _localizer;
private readonly IStringLocalizer<KonSoftResource> _localizer;
public KonSoftBrandingProvider(IStringLocalizer<KonSoftResource> localizer)
{
@ -16,4 +16,4 @@ public class KonSoftBrandingProvider : DefaultBrandingProvider
}
public override string AppName => _localizer["AppName"];
}
}

View File

@ -1,12 +1,13 @@
@page
@using System.Net
@using KonSoft.Shared.Localization.Localization
@using Microsoft.AspNetCore.Http.Extensions
@using Microsoft.AspNetCore.Mvc.Localization
@using KonSoft.Pages
@using KonSoft.Shared.Localization.Localization
@using Volo.Abp.Users
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid
@using Volo.Abp.AspNetCore.Mvc.UI.Theming
@using Volo.Abp.Ui.Branding
@model IndexModel
@using Volo.Abp.Users
@model KonSoft.Pages.IndexModel
@inject IHtmlLocalizer<KonSoftResource> L
@inject ICurrentUser CurrentUser
@inject IBrandingProvider BrandingProvider
@ -45,32 +46,32 @@
<abp-row>
<abp-column size="_6">
<div class="mr-auto p-2 float-start">
<div class="">
@if (CurrentUser.IsAuthenticated)
{
<div class="">
<a abp-button="Outline_Primary" asp-controller="Manage" asp-action="Index" asp-area="Account" class="me-2">@L["MyAccount"]</a>
<a abp-button="Primary" asp-controller="Logout" asp-action="Index" asp-area="Account" asp-route-returnUrl="/" >@L["Logout"]</a>
</div>
}
else
{
<a abp-button="Primary" asp-controller="Login" asp-action="Index" asp-area="Account">@L["Login"]</a>
}
</div>
<div class="">
@if (CurrentUser.IsAuthenticated)
{
<div class="">
<a abp-button="Outline_Primary" asp-controller="Manage" asp-action="Index" asp-area="Account" class="me-2">@L["MyAccount"]</a>
<a abp-button="Primary" asp-controller="Logout" asp-action="Index" asp-area="Account" asp-route-returnUrl="/">@L["Logout"]</a>
</div>
}
else
{
<a abp-button="Primary" asp-controller="Login" asp-action="Index" asp-area="Account">@L["Login"]</a>
}
</div>
</div>
</abp-column>
<abp-column size="_6">
<div class="ml-auto p-2 float-end">
<abp-dropdown>
<abp-dropdown-button text="@Model.CurrentLanguage" />
@if (@Model.Languages != null)
<abp-dropdown-button text="@Model.CurrentLanguage"/>
@if (Model.Languages != null)
{
<abp-dropdown-menu>
@foreach (var language in Model.Languages)
{
var languageUrl = Url.Content($"~/Abp/Languages/Switch?culture={language.CultureName}&uiCulture={language.UiCultureName}&returnUrl={System.Net.WebUtility.UrlEncode(Request.GetEncodedPathAndQuery())}");
var languageUrl = Url.Content($"~/Abp/Languages/Switch?culture={language.CultureName}&uiCulture={language.UiCultureName}&returnUrl={WebUtility.UrlEncode(Request.GetEncodedPathAndQuery())}");
<abp-dropdown-item href="@languageUrl">@language.DisplayName</abp-dropdown-item>
}
</abp-dropdown-menu>
@ -82,18 +83,18 @@
@if (Model.Applications != null)
{
<hr class="m-2" />
<hr class="m-2"/>
<abp-row class="mt-3">
@foreach (var application in Model.Applications)
{
<abp-column size-md="@Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid.ColumnSize._4" class="mb-2">
<abp-column size-md="@ColumnSize._4" class="mb-2">
<abp-card>
<abp-card-body>
@{
var clientUri = application.ClientUri.Contains("Swagger") ? application.ClientUri.EnsureEndsWith('/') + "swagger/index.html" : application.ClientUri;
@{
var clientUri = application.ClientUri.Contains("Swagger") ? application.ClientUri.EnsureEndsWith('/') + "swagger/index.html" : application.ClientUri;
}
@if (!application.LogoUri.IsNullOrEmpty())
{
<div class="mx-auto">
@ -115,4 +116,4 @@
</div>
</abp-row>
</div>
</div>
</div>

View File

@ -9,6 +9,12 @@ namespace KonSoft.Pages;
public class IndexModel : AbpPageModel
{
public IndexModel(IOpenIddictApplicationRepository openIdApplicationRepository, ILanguageProvider languageProvider)
{
OpenIdApplicationRepository = openIdApplicationRepository;
LanguageProvider = languageProvider;
}
public List<OpenIddictApplication>? Applications { get; protected set; }
public IReadOnlyList<LanguageInfo>? Languages { get; protected set; }
@ -19,12 +25,6 @@ public class IndexModel : AbpPageModel
protected ILanguageProvider LanguageProvider { get; }
public IndexModel(IOpenIddictApplicationRepository openIdApplicationRepository, ILanguageProvider languageProvider)
{
OpenIdApplicationRepository = openIdApplicationRepository;
LanguageProvider = languageProvider;
}
public async Task OnGetAsync()
{
Applications = await OpenIdApplicationRepository.GetListAsync();
@ -32,4 +32,4 @@ public class IndexModel : AbpPageModel
Languages = await LanguageProvider.GetLanguagesAsync();
CurrentLanguage = CultureInfo.CurrentCulture.DisplayName;
}
}
}

View File

@ -10,7 +10,7 @@ namespace KonSoft;
public class Program
{
public async static Task<int> Main(string[] args)
public static async Task<int> Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
#if DEBUG
@ -53,4 +53,4 @@ public class Program
Log.CloseAndFlush();
}
}
}
}

View File

@ -1,18 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\KonSoft.AuthServer.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="x-powered-by" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\KonSoft.AuthServer.dll" stdoutLogEnabled="false"
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="x-powered-by" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>