Skip to content

Commit

Permalink
fix conflic
Browse files Browse the repository at this point in the history
  • Loading branch information
agile.zhou committed Jan 27, 2024
2 parents bdee391 + fe86291 commit d2e23d2
Show file tree
Hide file tree
Showing 42 changed files with 412 additions and 209 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/arm32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.100
dotnet-version: 8.0.*
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.100
dotnet-version: 8.0.*
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/master-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- '**/*.yml'
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
build-reactapp:
Expand Down Expand Up @@ -41,7 +42,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.100
dotnet-version: 8.0.*
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mysqlconnector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.100
dotnet-version: 8.0.*
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/preview-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.100
dotnet-version: 8.0.*
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ on:
paths-ignore:
- '**/*.md'
- '**/*.yml'

workflow_dispatch:

jobs:
build-reactapp:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -39,7 +40,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.100
dotnet-version: 8.0.*
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-xxx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- '**/*.yml'
tags:
- 'v-*'

workflow_dispatch:
jobs:
build-reactapp:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.100
dotnet-version: 8.0.*
- name: Install dependencies
run: dotnet restore
- name: Build
Expand All @@ -50,10 +50,10 @@ jobs:
name: agileconfig-ui
path: src/AgileConfig.Server.Apisite/wwwroot/ui
- name: build server release xxx
run: dotnet publish AgileConfig.Server.Apisite/AgileConfig.Server.Apisite.csproj -c Release
run: dotnet publish src/AgileConfig.Server.Apisite/AgileConfig.Server.Apisite.csproj -c Release
- uses: vimtor/action-zip@v1
with:
files: AgileConfig.Server.Apisite/bin/Release/net6.0/publish/
files: src/AgileConfig.Server.Apisite/bin/Release/net8.0/publish/
dest: agileconfig_server_deploy.zip
- name: create release
uses: ncipollo/release-action@v1
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Change log
------------------------------
[1.8.0]
* 升级到 .NET8

[1.7.2]
* 修复 appid 为中文时无法获取配置的问题

[1.7.1]
* 修复在严格区分大小写的 SQLServer 上建表失败的问题

[1.7.0]
* 支持 SSO 登录

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal-arm32v7 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-arm32v7 AS base
WORKDIR /app
EXPOSE 5000

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["src/AgileConfig.Server.Apisite/AgileConfig.Server.Apisite.csproj", "AgileConfig.Server.Apisite/"]
COPY ["src/AgileConfig.Server.Data.Entity/AgileConfig.Server.Data.Entity.csproj", "AgileConfig.Server.Data.Entity/"]
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ services:
- "15000:5000"
networks:
- net0
security_opt:
- seccomp=unconfined
volumes:
- /etc/localtime:/etc/localtime
environment:
Expand All @@ -20,6 +22,8 @@ services:
- "15001:5000"
networks:
- net0
security_opt:
- seccomp=unconfined
volumes:
- /etc/localtime:/etc/localtime
environment:
Expand All @@ -35,6 +39,8 @@ services:
- "15002:5000"
networks:
- net0
security_opt:
- seccomp=unconfined
volumes:
- /etc/localtime:/etc/localtime
environment:
Expand Down
2 changes: 1 addition & 1 deletion src/Agile.Config.Protocol/Agile.Config.Protocol.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<AssemblyVersion>1.8</AssemblyVersion>
<Version>1.8</Version>
<PackageVersion>1.6.20</PackageVersion>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<FileVersion>1.7.3</FileVersion>
<Authors>kklldog</Authors>
<Company>kklldog</Company>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Debug\AgileConfig.Server.Apisite.xml</DocumentationFile>
<NoWarn>1701;1702;1591;1573</NoWarn>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DocumentationFile>bin\Release\AgileConfig.Server.Apisite.xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
<None Remove="agile_config.db" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.0" />
<PackageReference Include="NLog" Version="5.2.6" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.5" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.5.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Agile.Config.Protocol\Agile.Config.Protocol.csproj" />
<ProjectReference Include="..\AgileConfig.Server.Data.Entity\AgileConfig.Server.Data.Entity.csproj" />
<ProjectReference Include="..\AgileConfig.Server.Data.Freesql\AgileConfig.Server.Data.Freesql.csproj" />
<ProjectReference Include="..\AgileConfig.Server.OIDC\AgileConfig.Server.OIDC.csproj" />
<ProjectReference Include="..\AgileConfig.Server.Service\AgileConfig.Server.Service.csproj" />
</ItemGroup>

<ItemGroup>
<Content Update="appsettings.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="nlog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Folder Include="logs\" />
<Folder Include="Views\Shared" />
<Folder Include="wwwroot\ui\" />
</ItemGroup>

<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>

</Project>
28 changes: 14 additions & 14 deletions src/AgileConfig.Server.Apisite/AgileConfig.Server.Apisite.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<AssemblyVersion>1.7.0</AssemblyVersion>
<Version>1.7.0-rc</Version>
<PackageVersion>1.6.20</PackageVersion>
<AssemblyVersion>1.8</AssemblyVersion>
<Version>1.8</Version>
<PackageVersion>1.8</PackageVersion>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<FileVersion>1.7.0</FileVersion>
<FileVersion>1.8</FileVersion>
<Authors>kklldog</Authors>
<Company>kklldog</Company>
</PropertyGroup>
Expand All @@ -26,15 +26,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.0" />
<PackageReference Include="NLog" Version="4.7.12" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.2.3" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.2.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.0" />
<PackageReference Include="NLog" Version="5.2.6" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.5" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 10 additions & 2 deletions src/AgileConfig.Server.Apisite/Controllers/AdminController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class AdminController : Controller
private readonly IJwtService _jwtService;
private readonly IOidcClient _oidcClient;
public AdminController(

Check warning on line 25 in src/AgileConfig.Server.Apisite/Controllers/AdminController.cs

View workflow job for this annotation

GitHub Actions / build-dotnet

Missing XML comment for publicly visible type or member 'AdminController.AdminController(ISettingService, IUserService, IPremissionService, IJwtService, IOidcClient)'
ISettingService settingService,
ISettingService settingService,
IUserService userService,
IPremissionService permissionService,
IJwtService jwtService,
Expand Down Expand Up @@ -54,7 +54,7 @@ public async Task<IActionResult> Login4AntdPro([FromBody] LoginVM model)
var result = await _userService.ValidateUserPassword(userName, model.password);
if (result)
{
var response = await LoginSuccessful(userName);
var response = await LoginSuccessful(userName);
return Json(response);
}

Expand Down Expand Up @@ -134,6 +134,14 @@ public async Task<IActionResult> OidcLoginByCode(string code)
await _userService.AddAsync(newUser);
await _userService.UpdateUserRolesAsync(newUser.Id, new List<Role> { Role.NormalUser });
}
else if (user.Status == UserStatus.Deleted)
{
return Json(new
{
status = "error",
message = "该用户已被删除"
});
}

var response = await LoginSuccessful(userInfo.UserName);
return Json(response);
Expand Down
4 changes: 0 additions & 4 deletions src/AgileConfig.Server.Apisite/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
using System;
using System.IO;
using AgileConfig.Server.Common;
using AgileConfig.Server.IService;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Web;

namespace AgileConfig.Server.Apisite
Expand Down
22 changes: 20 additions & 2 deletions src/AgileConfig.Server.Apisite/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text;
using AgileConfig.Server.Apisite.UIExtension;
using AgileConfig.Server.Apisite.Websocket;
using AgileConfig.Server.Common;
using AgileConfig.Server.Common.RestClient;
using AgileConfig.Server.Data.Freesql;
using AgileConfig.Server.OIDC;
using AgileConfig.Server.Service;
Expand All @@ -27,13 +29,23 @@ public Startup(IConfiguration configuration, ILoggerFactory loggerFactory)
Configuration = configuration;
Global.LoggerFactory = loggerFactory;

TrustSSL(configuration);
SetTrustSSL(configuration);
}

private void TrustSSL(IConfiguration configuration)
private static bool IsTrustSSL(IConfiguration configuration)
{
var alwaysTrustSsl = configuration["alwaysTrustSsl"];
if (!string.IsNullOrEmpty(alwaysTrustSsl) && alwaysTrustSsl.ToLower() == "true")
{
return true;
}

return false;
}

private static void SetTrustSSL(IConfiguration configuration)
{
if (IsTrustSSL(configuration))
{
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
}
Expand All @@ -47,6 +59,9 @@ public IConfiguration Configuration
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddDefaultHttpClient(IsTrustSSL(Configuration));
services.AddRestClient();

var jwtService = new JwtService();
services.AddMemoryCache();
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
Expand All @@ -71,6 +86,7 @@ public void ConfigureServices(IServiceCollection services)
services.AddBusinessServices();
services.AddHostedService<InitService>();
services.AddAntiforgery(o => o.SuppressXFrameOptionsHeader = true);

services.AddOIDC();
}

Expand Down Expand Up @@ -138,5 +154,7 @@ private void AddSwaggerMiddleWare(IApplicationBuilder app)
c.SwaggerEndpoint("v1/swagger.json", "My API V1");
});
}


}
}
Loading

0 comments on commit d2e23d2

Please sign in to comment.