mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat(bot): listen on multiple addresses, for v4/v6
This commit is contained in:
parent
f7b594e415
commit
3d0eb562bf
1 changed files with 14 additions and 6 deletions
|
|
@ -25,7 +25,14 @@ public class HttpListenerService
|
|||
|
||||
public void Start(string host)
|
||||
{
|
||||
var server = new WebserverLite(new WebserverSettings(host, 5002), DefaultRoute);
|
||||
var hosts = new[] { host };
|
||||
if (host == "allv4v6")
|
||||
{
|
||||
hosts = new[] { "[::]", "0.0.0.0" };
|
||||
}
|
||||
foreach (var h in hosts)
|
||||
{
|
||||
var server = new WebserverLite(new WebserverSettings(h, 5002), DefaultRoute);
|
||||
|
||||
server.Routes.PreAuthentication.Static.Add(WatsonWebserver.Core.HttpMethod.GET, "/runtime_config", RuntimeConfigGet);
|
||||
server.Routes.PreAuthentication.Parameter.Add(WatsonWebserver.Core.HttpMethod.POST, "/runtime_config/{key}", RuntimeConfigSet);
|
||||
|
|
@ -35,6 +42,7 @@ public class HttpListenerService
|
|||
|
||||
server.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DefaultRoute(HttpContextBase ctx)
|
||||
=> await ctx.Response.Send("hellorld");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue