diff options
Diffstat (limited to 'ShiftOS.Server')
| -rw-r--r-- | ShiftOS.Server/Core.cs | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/ShiftOS.Server/Core.cs b/ShiftOS.Server/Core.cs index 4ec421d..e14ca27 100644 --- a/ShiftOS.Server/Core.cs +++ b/ShiftOS.Server/Core.cs @@ -96,10 +96,11 @@ namespace ShiftOS.Server { Name = "run", GUID = "Server", - Contents = $@"{{ - script:""{File.ReadAllText($"scripts/{user}/{script}.lua").Replace("\"", "\\\"")}"", - args:""{sArgs}"" - }}" + Contents = JsonConvert.SerializeObject(new + { + script = File.ReadAllText($"scripts/{user}/{script}.lua"), + args = sArgs + }) })); } else @@ -115,7 +116,7 @@ namespace ShiftOS.Server { Name = "Error", GUID = "Server", - Contents = JsonConvert.SerializeObject(new MudException("Command parse error")) + Contents = JsonConvert.SerializeObject(new MudException("<script_runner> Script not found or script error detected.")) })); } catch @@ -126,6 +127,17 @@ namespace ShiftOS.Server } + [MudRequest("diag_log", typeof(string))] + public static void Diagnostic(string guid, string line) + { + List<string> lines = new List<string>(); + if (File.Exists("diagnostics.log")) + lines = new List<string>(File.ReadAllLines("diagnostics.log")); + + lines.Add(line); + File.WriteAllLines("diagnostics.log", lines.ToArray()); + } + [MudRequest("getusers", typeof(string))] public static void GetAllUsers(string guid, string contents) { @@ -182,8 +194,8 @@ namespace ShiftOS.Server GUID = "server", Contents = JsonConvert.SerializeObject(saveFile) })); + return; } - return; } } foreach (var sve in Directory.GetFiles("saves")) @@ -199,8 +211,8 @@ namespace ShiftOS.Server GUID = "server", Contents = JsonConvert.SerializeObject(saveFile) })); + return; } - return; } } |
