- Partially implement tab switch

- Better support character switch
This commit is contained in:
Infi
2024-08-28 18:18:20 +02:00
parent 17ed40307c
commit f6531907a4
7 changed files with 35 additions and 5 deletions
+3 -1
View File
@@ -38,10 +38,12 @@ public class HostContext
Host.Events.ExceptionEncountered += ExceptionEncountered;
// Settings
#if DEBUG
Host.Settings.Debug.Requests = true;
Host.Settings.Debug.Routing = true;
Host.Settings.Debug.Responses = true;
Host.Settings.Debug.AccessControl = true;
#endif
Host.Events.Logger = logMessage => Plugin.Log.Information(logMessage);
IsActive = true;
@@ -116,7 +118,6 @@ public class HostContext
{
await ctx.Response.Send("Nothing to see here.");
}
#endregion
private async Task CheckAuthenticationCookie(HttpContextBase ctx)
{
@@ -132,4 +133,5 @@ public class HostContext
// Do nothing to let auth pass
}
#endregion
}
+2 -1
View File
@@ -50,7 +50,8 @@ public class Processing
var channels = await Plugin.Framework.RunOnTick(Plugin.ChatLogWindow.GetAvailableChannels);
var channelName = await Plugin.Framework.RunOnTick(() => ReadChannelName(Plugin.ChatLogWindow.PreviousChannel));
sse.OutboundQueue.Enqueue(new NewMessageEvent(new Messages(messages)));
// Using the bulk message event to clear everything on the client side that may still exist
sse.OutboundQueue.Enqueue(new BulkMessagesEvent(new Messages(messages)));
sse.OutboundQueue.Enqueue(new SwitchChannelEvent(new SwitchChannel(channelName)));
sse.OutboundQueue.Enqueue(new ChannelListEvent(new ChannelList(channels.ToDictionary(pair => pair.Key, pair => (uint)pair.Value))));
}
+19
View File
@@ -92,6 +92,25 @@ public class ServerCore : IAsyncDisposable
Plugin.Log.Error(ex, "Sending channel switch over SSE failed.");
}
}
internal void SendNewLogin()
{
if (!HostContext.IsActive)
return;
try
{
Plugin.Framework.RunOnTick(async () =>
{
foreach (var eventServer in HostContext.EventConnections)
await HostContext.Processing.PrepareNewClient(eventServer);
});
}
catch (Exception ex)
{
Plugin.Log.Error(ex, "Preparing all clients after login failed.");
}
}
#endregion
public void InvalidateSessions()