Skip to content

Commit 77f34c3

Browse files
committed
Add assembly to plugin info
1 parent 555a3c2 commit 77f34c3

File tree

11 files changed

+44
-31
lines changed

11 files changed

+44
-31
lines changed

src/Impostor.Api.Extension/packages.lock.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@
105105
},
106106
"NextFast.Hazel.Abstractions": {
107107
"type": "Transitive",
108-
"resolved": "1.0.2-ci.7",
109-
"contentHash": "YFTuYOB9UjNj4NelmATDQCJbhAyW4wpRli11HIoBz9b9YVYJOBRGrzP41iih37PB1InlCMlQlP4g/TUJHQ2oqg=="
108+
"resolved": "1.0.2-ci.8",
109+
"contentHash": "eaYyO/+c1l48bjq7ZbGRRohn6FIkDnyMrN8/zO4rxwVeIl6Tbdmw9FnrXXg7BxHzDcuSJP8AZcjXmfq6L8ovvQ=="
110110
},
111111
"Serilog": {
112112
"type": "Transitive",
@@ -123,7 +123,7 @@
123123
"dependencies": {
124124
"Microsoft.Extensions.Hosting.Abstractions": "[9.0.2, )",
125125
"Microsoft.Extensions.Logging.Abstractions": "[9.0.2, )",
126-
"NextFast.Hazel.Abstractions": "[1.0.2-ci.7, )",
126+
"NextFast.Hazel.Abstractions": "[1.0.2-ci.8, )",
127127
"Serilog": "[4.2.1-dev-02340, )"
128128
}
129129
}

src/Impostor.Api/Impostor.Api.csproj

+1-6
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,11 @@
2525
<ItemGroup>
2626
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.2"/>
2727
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.2"/>
28-
<PackageReference Include="NextFast.Hazel.Abstractions" Version="1.0.2-ci.7"/>
28+
<PackageReference Include="NextFast.Hazel.Abstractions" Version="1.0.2-ci.8"/>
2929
<PackageReference Include="Serilog" Version="4.2.1-dev-02340"/>
3030

3131
<ProjectReference Include="..\Impostor.Api.Generator\Impostor.Api.Generator.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
3232
<AdditionalFiles Include="Innersloth/Data/**/*.json"/>
3333
<AdditionalFiles Include="Languages/*.json"/>
3434
</ItemGroup>
35-
36-
<ItemGroup>
37-
<Compile Remove="Config\DebugConfig.cs"/>
38-
<Compile Remove="Plugins\PluginBase.cs"/>
39-
</ItemGroup>
4035
</Project>

src/Impostor.Api/packages.lock.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
},
2727
"NextFast.Hazel.Abstractions": {
2828
"type": "Direct",
29-
"requested": "[1.0.2-ci.7, )",
30-
"resolved": "1.0.2-ci.7",
31-
"contentHash": "YFTuYOB9UjNj4NelmATDQCJbhAyW4wpRli11HIoBz9b9YVYJOBRGrzP41iih37PB1InlCMlQlP4g/TUJHQ2oqg=="
29+
"requested": "[1.0.2-ci.8, )",
30+
"resolved": "1.0.2-ci.8",
31+
"contentHash": "eaYyO/+c1l48bjq7ZbGRRohn6FIkDnyMrN8/zO4rxwVeIl6Tbdmw9FnrXXg7BxHzDcuSJP8AZcjXmfq6L8ovvQ=="
3232
},
3333
"Serilog": {
3434
"type": "Direct",

src/Impostor.Server/Controllers/PublicController.cs

+13-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Impostor.Api.Games.Managers;
55
using Impostor.Api.Innersloth;
66
using Impostor.Api.Net.Manager;
7+
using Impostor.Server.Utils;
78
using Microsoft.AspNetCore.Mvc;
89

910
namespace Impostor.Server.Controllers;
@@ -37,6 +38,17 @@ public IActionResult GameList()
3738
Host = game.Host?.Client.Name ?? "Unknown",
3839
});
3940

40-
return Ok(JsonSerializer.Serialize(list));
41+
return list.OkJson();
42+
}
43+
44+
[HttpGet]
45+
public IActionResult ImpostorInfo()
46+
{
47+
return new
48+
{
49+
DotnetUtils.Version,
50+
DotnetUtils.Environment,
51+
DotnetUtils.IsDev,
52+
}.OkJson();
4153
}
4254
}

src/Impostor.Server/Impostor.Server.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="9.0.2"/>
3030
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.2"/>
3131
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="9.0.2"/>
32-
<PackageReference Include="NextFast.Hazel" Version="1.0.2-ci.7"/>
32+
<PackageReference Include="NextFast.Hazel" Version="1.0.2-ci.8"/>
3333
<PackageReference Include="Scalar.AspNetCore" Version="2.0.18" />
3434
<PackageReference Include="Serilog.Extensions.Hosting" Version="9.0.1-dev-02307" />
3535
<PackageReference Include="Serilog.Settings.Configuration" Version="9.0.1-dev-02317"/>

src/Impostor.Server/Plugins/Informations/PluginInformation.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ public class PluginInformation
1010
{
1111
private readonly ImpostorPluginAttribute _attribute;
1212

13-
public PluginInformation(IPluginStartup? startup, Type pluginType)
13+
public PluginInformation(IPluginStartup? startup, Type pluginType, Assembly assembly)
1414
{
1515
_attribute = pluginType.GetCustomAttribute<ImpostorPluginAttribute>()!;
16-
17-
var assembly = pluginType.Assembly;
16+
1817
Name = _attribute.Name ??
1918
assembly.GetCustomAttribute<AssemblyTitleAttribute>()?.Title ?? assembly.GetName().Name!;
2019
Author = _attribute.Author ?? assembly.GetCustomAttribute<AssemblyCompanyAttribute>()?.Company ?? string.Empty;
@@ -26,6 +25,7 @@ public PluginInformation(IPluginStartup? startup, Type pluginType)
2625
.Select(t => new DependencyInformation(t)).ToList();
2726
Startup = startup;
2827
PluginType = pluginType;
28+
Assembly = assembly;
2929
}
3030

3131
public string Id

src/Impostor.Server/Plugins/PluginLoader.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,7 @@ public static IHostBuilder UsePluginLoader(this IHostBuilder builder, PluginConf
135135
.Select(Activator.CreateInstance)
136136
.Cast<IPluginStartup>()
137137
.FirstOrDefault(),
138-
plugin.Single())
139-
{
140-
Assembly = assembly,
141-
});
138+
plugin.Single(), assembly));
142139
}
143140

144141
AllPluginLoad = LoadOrderPlugins(plugins);

src/Impostor.Server/Utils/DotnetUtils.cs

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System.Reflection;
2+
using System.Text.Json;
3+
using Microsoft.AspNetCore.Mvc;
24
using Microsoft.Extensions.Hosting;
35

46
namespace Impostor.Server.Utils;
@@ -7,6 +9,11 @@ public static class DotnetUtils
79
{
810
private static string? _version;
911

12+
public static IActionResult OkJson<T>(this T content)
13+
{
14+
return new OkObjectResult(JsonSerializer.Serialize(content));
15+
}
16+
1017
public static string Version
1118
{
1219
get

src/Impostor.Server/packages.lock.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@
7373
},
7474
"NextFast.Hazel": {
7575
"type": "Direct",
76-
"requested": "[1.0.2-ci.7, )",
77-
"resolved": "1.0.2-ci.7",
78-
"contentHash": "DMkvup+qwilMhG1BGWKkzpqNRswp7FbyUu6nQMfF1I7rtAw5yTKxH6eJPDlhq4qlJZWYbMlDCLSqbiAGEOOB6w==",
76+
"requested": "[1.0.2-ci.8, )",
77+
"resolved": "1.0.2-ci.8",
78+
"contentHash": "y1m+ZDYmqGORe0dsYpPblcWt9kin/LKBZTtGGPiPc2704giUUXEhTWrnAqZMfvGQZmtBRlF/KnxxuQn/63cOVg==",
7979
"dependencies": {
8080
"BouncyCastle.Cryptography": "2.5.1",
8181
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.2",
8282
"Microsoft.Extensions.ObjectPool": "9.0.2",
83-
"NextFast.Hazel.Abstractions": "1.0.2-ci.7",
83+
"NextFast.Hazel.Abstractions": "1.0.2-ci.8",
8484
"Serilog": "4.2.1-dev-02340"
8585
}
8686
},
@@ -481,8 +481,8 @@
481481
},
482482
"NextFast.Hazel.Abstractions": {
483483
"type": "Transitive",
484-
"resolved": "1.0.2-ci.7",
485-
"contentHash": "YFTuYOB9UjNj4NelmATDQCJbhAyW4wpRli11HIoBz9b9YVYJOBRGrzP41iih37PB1InlCMlQlP4g/TUJHQ2oqg=="
484+
"resolved": "1.0.2-ci.8",
485+
"contentHash": "eaYyO/+c1l48bjq7ZbGRRohn6FIkDnyMrN8/zO4rxwVeIl6Tbdmw9FnrXXg7BxHzDcuSJP8AZcjXmfq6L8ovvQ=="
486486
},
487487
"Serilog": {
488488
"type": "Transitive",
@@ -522,7 +522,7 @@
522522
"dependencies": {
523523
"Microsoft.Extensions.Hosting.Abstractions": "[9.0.2, )",
524524
"Microsoft.Extensions.Logging.Abstractions": "[9.0.2, )",
525-
"NextFast.Hazel.Abstractions": "[1.0.2-ci.7, )",
525+
"NextFast.Hazel.Abstractions": "[1.0.2-ci.8, )",
526526
"Serilog": "[4.2.1-dev-02340, )"
527527
}
528528
},

src/Plugins/SelfHttpMatchmaker/Controllers/TokenController.cs

+2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ public class TokenRequest
5454
/// </summary>
5555
public sealed class Token
5656
{
57+
// 定义一个名为Content的属性,类型为TokenPayload,使用JsonPropertyName特性指定序列化时的名称为"Content"
5758
[JsonPropertyName("Content")] public required TokenPayload Content { get; init; }
5859

60+
// 定义一个名为Hash的属性,类型为string,使用JsonPropertyName特性指定序列化时的名称为"Hash"
5961
[JsonPropertyName("Hash")] public required string Hash { get; init; }
6062
}
6163

src/Plugins/SelfHttpMatchmaker/packages.lock.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,8 @@
683683
},
684684
"NextFast.Hazel.Abstractions": {
685685
"type": "Transitive",
686-
"resolved": "1.0.2-ci.7",
687-
"contentHash": "YFTuYOB9UjNj4NelmATDQCJbhAyW4wpRli11HIoBz9b9YVYJOBRGrzP41iih37PB1InlCMlQlP4g/TUJHQ2oqg=="
686+
"resolved": "1.0.2-ci.8",
687+
"contentHash": "eaYyO/+c1l48bjq7ZbGRRohn6FIkDnyMrN8/zO4rxwVeIl6Tbdmw9FnrXXg7BxHzDcuSJP8AZcjXmfq6L8ovvQ=="
688688
},
689689
"runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": {
690690
"type": "Transitive",
@@ -1632,7 +1632,7 @@
16321632
"dependencies": {
16331633
"Microsoft.Extensions.Hosting.Abstractions": "[9.0.2, )",
16341634
"Microsoft.Extensions.Logging.Abstractions": "[9.0.2, )",
1635-
"NextFast.Hazel.Abstractions": "[1.0.2-ci.7, )",
1635+
"NextFast.Hazel.Abstractions": "[1.0.2-ci.8, )",
16361636
"Serilog": "[4.2.1-dev-02340, )"
16371637
}
16381638
},

0 commit comments

Comments
 (0)