diff --git a/ChatTwo/ChatTwo.yaml b/ChatTwo/ChatTwo.yaml index e77595a..74f381c 100755 --- a/ChatTwo/ChatTwo.yaml +++ b/ChatTwo/ChatTwo.yaml @@ -22,14 +22,32 @@ tags: - Chat - Replacement changelog: |- - **Added** - - Implement 24-hour clock timestamp option [default false] + **Welcome to future~** + - Webinterface added + - *Does not work if your game client is offline or you are logged out* - **Fixes** - - Bozja/Eureka tells should work again - - Invites in Bozja/Eureka should work again - - Added a notification that warns about fails duo missing player id - - Hide activity channels are now saved across sessions + **Features** + - Browse chat on any device + - Write chat messages + - Easily copy & paste messages + - Automatically start with plugin load + + **Security** + - This feature is not intended to be used outside of your local network + - Do not forward this port + - Never share your authcode + - Multibox support is not given, first client only + + **To be added very soon** + - Display errors as small notifications + + **Planned** + - Tab support + - Browser specific settings + - Styling support + + **Welcomed** + - User that want to expand this to apps or other platforms + + *Note: A FAQ will be provided in the chat2 thread on dalamud's discord, linked in About* - **Misc** - - Loc updates diff --git a/ChatTwo/Http/HostContext.cs b/ChatTwo/Http/HostContext.cs index 491d8e4..9fa2600 100644 --- a/ChatTwo/Http/HostContext.cs +++ b/ChatTwo/Http/HostContext.cs @@ -79,7 +79,6 @@ public class HostContext { IsActive = false; IsStopping = true; - await Task.Delay(10000); Host.Stop(); // Save our session tokens @@ -114,9 +113,9 @@ public class HostContext Plugin.Log.Error(args.Exception, "Webserver threw an exception."); } - private async Task DefaultRoute(HttpContextBase ctx) + private async Task DefaultRoute(HttpContextBase ctx) { - await ctx.Response.Send("Nothing to see here."); + return await ctx.Response.Send("Nothing to see here."); } private async Task CheckAuthenticationCookie(HttpContextBase ctx) diff --git a/ChatTwo/Http/RouteController.cs b/ChatTwo/Http/RouteController.cs index c79c667..2e8152b 100644 --- a/ChatTwo/Http/RouteController.cs +++ b/ChatTwo/Http/RouteController.cs @@ -36,10 +36,12 @@ public class RouteController // Pre Auth Core.Host.Routes.PreAuthentication.Static.Add(HttpMethod.GET, "/", AuthRoute, ExceptionRoute); + Core.Host.Routes.PreAuthentication.Static.Add(HttpMethod.GET, "/auth", GetAuthenticateClient, ExceptionRoute); Core.Host.Routes.PreAuthentication.Static.Add(HttpMethod.POST, "/auth", AuthenticateClient, ExceptionRoute); Core.Host.Routes.PreAuthentication.Static.Add(HttpMethod.GET, "/files/gfdata.gfd", GetGfdData, ExceptionRoute); Core.Host.Routes.PreAuthentication.Static.Add(HttpMethod.GET, "/files/fonticon_ps5.tex", GetTexData, ExceptionRoute); Core.Host.Routes.PreAuthentication.Static.Add(HttpMethod.GET, "/files/FFXIV_Lodestone_SSF.ttf", GetLodestoneFont, ExceptionRoute); + Core.Host.Routes.PreAuthentication.Static.Add(HttpMethod.GET, "/favicon.ico", GetFavicon, ExceptionRoute); Core.Host.Routes.PreAuthentication.Parameter.Add(HttpMethod.GET, "/emote/{name}", GetEmote, ExceptionRoute); Core.Host.Routes.PreAuthentication.Content.Add("/static", true, ExceptionRoute); @@ -87,6 +89,12 @@ public class RouteController await ctx.Response.Send(data); } + private async Task GetFavicon(HttpContextBase ctx) + { + ctx.Response.StatusCode = 404; + await ctx.Response.Send(); + } + private async Task GetEmote(HttpContextBase ctx) { var name = ctx.Request.Url.Parameters["name"] ?? ""; @@ -122,9 +130,11 @@ public class RouteController #region PreAuthRoutes private async Task AuthenticateClient(HttpContextBase ctx) { + Plugin.Log.Information($"Auth requested"); + var currentTick = Environment.TickCount64; if (RateLimit.TryGetValue(ctx.Request.Source.IpAddress, out var timestamp) && timestamp > currentTick) - return await Redirect(ctx, "/", ("message", "Rate limit active."), ("retry", "12345")); + return await Redirect(ctx, "/", ("message", "Rate limit active.")); // The next request will be rate limited for 10s RateLimit[ctx.Request.Source.IpAddress] = currentTick + 10_000; @@ -139,6 +149,15 @@ public class RouteController ctx.Response.Headers.Add("Set-Cookie", $"ChatTwo-token={token}"); return await Redirect(ctx, "/chat"); } + + private async Task GetAuthenticateClient(HttpContextBase ctx) + { + Plugin.Log.Information($"Get was used for auth requested"); + Plugin.Log.Information($"{ctx.Request.Url.Full}"); + Plugin.Log.Information($"{ctx.RouteType}"); + + return await Redirect(ctx, "/", ("message", "Rate limit active.")); + } #endregion #region PostAuthRoutes diff --git a/ChatTwo/Http/templates/auth.html b/ChatTwo/Http/templates/auth.html index b6153a6..27d85f2 100644 --- a/ChatTwo/Http/templates/auth.html +++ b/ChatTwo/Http/templates/auth.html @@ -13,7 +13,7 @@

Authcode

- +