-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9549c6d
commit 0d423cf
Showing
17 changed files
with
102 additions
and
115 deletions.
There are no files selected for viewing
3 changes: 0 additions & 3 deletions
3
Lagrange.OneBot/Core/Network/Options/ForwardHttpServiceOptions.cs
This file was deleted.
Oops, something went wrong.
7 changes: 3 additions & 4 deletions
7
Lagrange.OneBot/Core/Network/Options/ForwardWSServiceOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
namespace Lagrange.OneBot.Core.Network.Options | ||
{ | ||
public class ForwardWSServiceOptions : WSServiceOptions; | ||
} | ||
namespace Lagrange.OneBot.Core.Network.Options; | ||
|
||
public class ForwardWSServiceOptions : WSServiceOptions; |
2 changes: 1 addition & 1 deletion
2
...work/Options/ReverseHttpServiceOptions.cs → ...Network/Options/HttpPostServiceOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
namespace Lagrange.OneBot.Core.Network.Options | ||
namespace Lagrange.OneBot.Core.Network.Options; | ||
|
||
public class HttpServiceOptions | ||
{ | ||
public abstract class HttpServiceOptions | ||
{ | ||
public string Host { get; set; } = ""; | ||
public string Host { get; set; } = ""; | ||
|
||
public uint Port { get; set; } | ||
public uint Port { get; set; } | ||
|
||
public string? AccessToken { get; set; } | ||
} | ||
} | ||
public string? AccessToken { get; set; } | ||
} |
13 changes: 6 additions & 7 deletions
13
Lagrange.OneBot/Core/Network/Options/ReverseWSServiceOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
namespace Lagrange.OneBot.Core.Network.Options | ||
namespace Lagrange.OneBot.Core.Network.Options; | ||
|
||
public sealed class ReverseWSServiceOptions : WSServiceOptions | ||
{ | ||
public sealed class ReverseWSServiceOptions : WSServiceOptions | ||
{ | ||
public string Suffix { get; set; } = ""; | ||
public string Suffix { get; set; } = ""; | ||
|
||
public uint ReconnectInterval { get; set; } = 5000; | ||
} | ||
} | ||
public uint ReconnectInterval { get; set; } = 5000; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
namespace Lagrange.OneBot.Core.Network.Options | ||
namespace Lagrange.OneBot.Core.Network.Options; | ||
|
||
public abstract class WSServiceOptions | ||
{ | ||
public abstract class WSServiceOptions | ||
{ | ||
public string Host { get; set; } = ""; | ||
public string Host { get; set; } = ""; | ||
|
||
public uint Port { get; set; } | ||
public uint Port { get; set; } | ||
|
||
public uint HeartBeatInterval { get; set; } = 5000; // by default 5000 | ||
public uint HeartBeatInterval { get; set; } = 5000; // by default 5000 | ||
|
||
public string? AccessToken { get; set; } | ||
} | ||
} | ||
public string? AccessToken { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
Lagrange.OneBot/Core/Network/Service/ForwardHttpServiceFactory.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
Lagrange.OneBot/Core/Network/Service/HttpPostServiceFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Lagrange.OneBot.Core.Network.Options; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace Lagrange.OneBot.Core.Network.Service; | ||
|
||
public sealed class HttpPostServiceFactory(IServiceProvider services) : LagrangeWebServiceFactory(services), ILagrangeWebServiceFactory<HttpPostService> | ||
{ | ||
public override ILagrangeWebService Create() | ||
{ | ||
var config = _config ?? throw new InvalidOperationException("Configuration must be provided"); | ||
var options = _services.GetRequiredService<IOptionsSnapshot<HttpPostServiceOptions>>(); | ||
config.Bind(options.Value); | ||
|
||
return _services.GetRequiredService<HttpPostService>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
Lagrange.OneBot/Core/Network/Service/HttpServiceFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Lagrange.OneBot.Core.Network.Options; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace Lagrange.OneBot.Core.Network.Service; | ||
|
||
public sealed class HttpServiceFactory(IServiceProvider services) : LagrangeWebServiceFactory(services), ILagrangeWebServiceFactory<HttpService> | ||
{ | ||
public override ILagrangeWebService Create() | ||
{ | ||
var config = _config ?? throw new InvalidOperationException("Configuration must be provided"); | ||
var options = _services.GetRequiredService<IOptionsSnapshot<HttpServiceOptions>>(); | ||
config.Bind(options.Value); | ||
|
||
return _services.GetRequiredService<HttpService>(); | ||
} | ||
} |
19 changes: 0 additions & 19 deletions
19
Lagrange.OneBot/Core/Network/Service/ReverseHttpServiceFactory.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters