Skip to content

Commit

Permalink
Merge pull request #25 from NerosoftDev/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Codespilot authored Feb 25, 2024
2 parents ec6ded1 + 648a366 commit cf6be4a
Show file tree
Hide file tree
Showing 189 changed files with 2,891 additions and 4,439 deletions.
46 changes: 23 additions & 23 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<EnablePackageVersionOverride>true</EnablePackageVersionOverride>
<EuoniaPackageVersion>8.1.21</EuoniaPackageVersion>
<EuoniaPackageVersion>8.1.22</EuoniaPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Blazored.LocalStorage" Version="4.4.0" />
<PackageVersion Include="Blazored.LocalStorage" Version="4.5.0" />
<PackageVersion Include="BlazorMonaco" Version="3.1.0" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageVersion Include="Dapper" Version="2.1.28" />
Expand All @@ -29,37 +29,37 @@
<PackageVersion Include="Euonia.Pipeline" Version="$(EuoniaPackageVersion)" />
<PackageVersion Include="Euonia.Validation" Version="$(EuoniaPackageVersion)" />
<PackageVersion Include="Euonia.Repository.EfCore" Version="$(EuoniaPackageVersion)" />
<PackageVersion Include="Google.Api.CommonProtos" Version="2.13.0" />
<PackageVersion Include="Google.Protobuf" Version="3.25.2" />
<PackageVersion Include="Google.Api.CommonProtos" Version="2.14.0" />
<PackageVersion Include="Google.Protobuf" Version="3.25.3" />
<PackageVersion Include="Grpc.Net.Client" Version="2.60.0" />
<PackageVersion Include="Grpc.Tools" Version="2.60.0" />
<PackageVersion Include="Grpc.Tools" Version="2.61.0" />
<PackageVersion Include="IdentityModel" Version="6.2.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.2" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.2" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.2" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageVersion Include="Microsoft.FeatureManagement.AspNetCore" Version="3.1.1" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.3.1" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Emoji" Version="4.3.1" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.3.1" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.4.1" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Emoji" Version="4.4.0" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.4.0" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageVersion Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.11" />
<PackageVersion Include="Refit" Version="7.0.0" />
<PackageVersion Include="Refit.HttpClientFactory" Version="7.0.0" />
<PackageVersion Include="Refit.Newtonsoft.Json" Version="7.0.0" />
<PackageVersion Include="StackExchange.Redis" Version="2.7.17" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.3.0" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.3.1" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.1" />
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.0-beta.2" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.2" />
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.0" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
<PackageVersion Include="MongoDB.EntityFrameworkCore" Version="7.0.0-preview.1" />
</ItemGroup>
<ItemGroup>
Expand All @@ -72,7 +72,7 @@
</PackageVersion>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageVersion Include="System.Text.Json" Version="8.0.1" />
<PackageVersion Include="System.Text.Json" Version="8.0.2" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFrameworkVersion.Equals('v5.0')) ">
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
Expand Down Expand Up @@ -102,9 +102,9 @@
<!-- Tests -->
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.13.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="xunit" Version="2.6.6" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6">
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="xunit" Version="2.7.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
Expand Down
10 changes: 4 additions & 6 deletions Source/Starfish.Client/Clients/HttpConfigurationClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ internal class HttpConfigurationClient : IConfigurationClient
{
private readonly HttpClient _httpClient = new();

private readonly string _app;
private readonly string _id;
private readonly string _secret;
private readonly string _env;

public HttpConfigurationClient(Uri host, string app, string secret, string env)
public HttpConfigurationClient(Uri host, string id, string secret)
{
_httpClient.BaseAddress = host;
_app = app;
_id = id;
_secret = secret;
_env = env;

// _httpClient.DefaultRequestHeaders.Add(Constants.RequestHeaders.Team, team);
// _httpClient.DefaultRequestHeaders.Add(Constants.RequestHeaders.App, app);
Expand All @@ -28,7 +26,7 @@ public async Task GetConfigurationAsync(Action<byte[], int> dataAction, Cancella
try
{
attempts++;
using var request = new HttpRequestMessage(HttpMethod.Get, $"es?app={_app}&secret={_secret}&env={_env}");
using var request = new HttpRequestMessage(HttpMethod.Get, $"es?id={_id}&secret={_secret}");

var response = await _httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken);

Expand Down
4 changes: 2 additions & 2 deletions Source/Starfish.Client/Clients/SocketConfigurationClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ internal class SocketConfigurationClient : IConfigurationClient
private readonly ClientWebSocket _client = new();
private readonly Uri _uri;

public SocketConfigurationClient(Uri host, string app, string secret, string env)
public SocketConfigurationClient(Uri host, string id, string secret)
{
_uri = new Uri($"{host.AbsoluteUri}ws?app={app}&secret={secret}&env={env}");
_uri = new Uri($"{host.AbsoluteUri}ws?app={id}&secret={secret}");
// _client.Options.SetRequestHeader(Constants.RequestHeaders.Team, team);
// _client.Options.SetRequestHeader(Constants.RequestHeaders.App, app);
// _client.Options.SetRequestHeader(Constants.RequestHeaders.Secret, secret);
Expand Down
14 changes: 4 additions & 10 deletions Source/Starfish.Client/ConfigurationClientOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ public class ConfigurationClientOptions
/// <summary>
/// 应用Id
/// </summary>
public string App { get; set; }

/// <summary>
/// 应用环境
/// </summary>
public string Env { get; set; }
public string Id { get; set; }

/// <summary>
/// 密钥
Expand Down Expand Up @@ -67,9 +62,9 @@ public static ConfigurationClientOptions Load(IConfiguration configuration)
throw new InvalidOperationException(Resources.IDS_ERROR_STARFISH_SECTION_NOT_FOUND);
}

var app = section[nameof(App)];
var id = section[nameof(Id)];

if (string.IsNullOrWhiteSpace(app))
if (string.IsNullOrWhiteSpace(id))
{
throw new InvalidOperationException(Resources.IDS_ERROR_APP_SECTION_NOT_FOUND);
}
Expand All @@ -83,8 +78,7 @@ public static ConfigurationClientOptions Load(IConfiguration configuration)
var options = new ConfigurationClientOptions
{
Host = host,
App = app,
Env = section[nameof(Env)] ?? Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"),
Id = id,
Secret = section[nameof(Secret)],
CacheDirectory = section[nameof(CacheDirectory)] ?? AppDomain.CurrentDomain.BaseDirectory
};
Expand Down
6 changes: 3 additions & 3 deletions Source/Starfish.Client/StarfishConfigurationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal class StarfishConfigurationProvider : ConfigurationProvider, IDisposabl
public StarfishConfigurationProvider(ConfigurationClientOptions options)
{
_options = options;
_cacheFile = Path.Combine(_options.CacheDirectory, $"{_options.App}.starfish.{_options.Env}.cache");
_cacheFile = Path.Combine(_options.CacheDirectory, $"{_options.Id}.starfish.cache");
HostChanged += OnHostChanged;
ConnectionLost += (_, _) =>
{
Expand Down Expand Up @@ -58,8 +58,8 @@ private async void OnHostChanged(object sender, HostChangedEventArgs args)
var uri = new Uri(args.Host);
IConfigurationClient client = uri.Scheme switch
{
"http" or "https" => new HttpConfigurationClient(uri, _options.App, _options.Secret, _options.Env),
"ws" or "wss" => new SocketConfigurationClient(uri, _options.App, _options.Secret, _options.Env),
"http" or "https" => new HttpConfigurationClient(uri, _options.Id, _options.Secret),
"ws" or "wss" => new SocketConfigurationClient(uri, _options.Id, _options.Secret),
_ => throw new NotSupportedException(string.Format(Resources.IDS_ERROR_SCHEMA_NOT_SUPPORTED, uri.Scheme)),
};
try
Expand Down
8 changes: 8 additions & 0 deletions Source/Starfish.Common/PermissionState.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Nerosoft.Starfish.Common;

public enum PermissionState
{
None = 0,
Read = 1,
Edit = 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public override void AheadConfigureServices(ServiceConfigurationContext context)
{
options.AddProfile<IdentityMappingProfile>();
options.AddProfile<LogsMappingProfile>();
options.AddProfile<AppsMappingProfile>();
options.AddProfile<ConfigurationMappingProfile>();
});
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
namespace Nerosoft.Starfish.Application;
using Nerosoft.Euonia.Domain;

public class ConfigurationCreateCommand : ConfigurationAbstractCommand
namespace Nerosoft.Starfish.Application;

public class ConfigurationCreateCommand : Command
{
public ConfigurationCreateCommand(string appId, string environment)
: base(appId, environment)
public ConfigurationCreateCommand(string teamId)
{
TeamId = teamId;
}

/// <summary>
/// 描述
/// </summary>

public string TeamId { get; set; }

public string Name { get; set; }

public string Description { get; set; }

/// <summary>
/// 配置项内容
/// </summary>
public IDictionary<string, string> Data { get; set; }
public string Secret { get; set; }
}
Loading

0 comments on commit cf6be4a

Please sign in to comment.