Skip to content

Commit

Permalink
Merge branch 'fish'
Browse files Browse the repository at this point in the history
  • Loading branch information
k3yw committed Dec 25, 2023
2 parents d212479 + 0d045bc commit 161187f
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
script: |
mkdir benchmark_run_${{ github.sha }}
cd benchmark_run_${{ github.sha }}
git clone https://github.com/space-wizards/RobustToolbox.git repo_dir --recursive
git clone https://github.com/k3yw/RobustToolbox.git repo_dir --recursive
cd repo_dir
git checkout ${{ github.sha }}
cd Robust.Benchmarks
Expand Down
6 changes: 5 additions & 1 deletion Robust.Server/Console/ServerConsoleHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ private void ProcessCommand(MsgConCmd message)
var sender = message.MsgChannel;
var session = _players.GetSessionByChannel(sender);

LogManager.GetSawmill(SawmillName).Info($"{FormatPlayerString(session)}:{text}");
// Crappy fast hack to avoid OOC spam in console
if (!text.StartsWith("ooc"))
{
LogManager.GetSawmill(SawmillName).Info($"{FormatPlayerString(session)}:{text}");
}

ExecuteCommand(session, text);
}
Expand Down
46 changes: 45 additions & 1 deletion Robust.Server/ServerStatus/StatusHost.Handlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
using System.Web;
using Robust.Shared;
using Robust.Shared.Utility;
using System.Linq;
using static Robust.Shared.Network.Messages.MsgConCmdReg;
using System.Collections.Generic;

namespace Robust.Server.ServerStatus
{
Expand All @@ -17,10 +20,50 @@ private void RegisterHandlers()
{
AddHandler(HandleTeapot);
AddHandler(HandleStatus);
AddHandler(HandleDerp);
AddHandler(HandleInfo);
AddAczHandlers();
}

private async Task<bool> HandleDerp(IStatusHandlerContext context)
{
if (!context.IsGetLike || context.Url!.AbsolutePath != "/derp")
{
return false;
}


var jObject = new JsonObject
{
["players"] = _playerManager.PlayerCount
};

try
{
//var test = _playerManager.GetAllPlayerData().ToArray().Select(a => a.UserId.UserId).ToList();
var test = _playerManager.Sessions.Select(a => a.UserId.UserId).ToList();
if (test != null)
{
var tags = new JsonArray();
foreach (var tag in test)
{
tags.Add(tag);
}
jObject["online"] = tags;
}
}
catch (Exception e)
{
System.Console.WriteLine(e);
}

OnStatusRequest?.Invoke(jObject);

await context.RespondJsonAsync(jObject);

return true;
}

private static async Task<bool> HandleTeapot(IStatusHandlerContext context)
{
if (!context.IsGetLike || context.Url!.AbsolutePath != "/teapot")
Expand All @@ -33,12 +76,13 @@ private static async Task<bool> HandleTeapot(IStatusHandlerContext context)
}

private async Task<bool> HandleStatus(IStatusHandlerContext context)
{
{
if (!context.IsGetLike || context.Url!.AbsolutePath != "/status")
{
return false;
}


var jObject = new JsonObject
{
// We need to send at LEAST name and player count to have the launcher work with us.
Expand Down

0 comments on commit 161187f

Please sign in to comment.