- 404 favicon
- Try to fix chrome redirect bug
This commit is contained in:
+27
-9
@@ -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
|
||||
|
||||
@@ -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<bool> 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)
|
||||
|
||||
@@ -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<bool> 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<bool> 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
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<main class="auth">
|
||||
<h1>Authcode</h1>
|
||||
<form action="/auth" method="POST">
|
||||
<input type="password" name="authcode">
|
||||
<label><input type="password" name="authcode"></label>
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
<img src="/emote/Sure">
|
||||
|
||||
Reference in New Issue
Block a user