Skip to content

Commit

Permalink
Send JSON data of new apps
Browse files Browse the repository at this point in the history
  • Loading branch information
ocdtrekkie committed Jun 22, 2024
1 parent 15f24c8 commit 3ff9c5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion modSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public static void Unload()
/// <param name="Destination">(string) Intended destination of the message</param>
/// <param name="MessageType">(string) Type of message being sent</param>
/// <param name="Message">(string) Contents of message being sent</param>
public static async void SendMessage(string Destination, string MessageType, string Message)
/// <param name="ExtendedMessage">(string) Contents of extended message data</param>
public static async void SendMessage(string Destination, string MessageType, string Message, string ExtendedMessage = "")
{
// TODO Only send messages if we are online
try
Expand All @@ -70,6 +71,7 @@ public static async void SendMessage(string Destination, string MessageType, str
MessageClient.Timeout = httpTimeout;
string EncodedCreds = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes("sandstorm:" + Sync_SandstormToken));
MessageBuilder.Headers.Add("Authorization", "Basic " + EncodedCreds);
if (ExtendedMessage != "") { MessageBuilder.Content = new StringContent(ExtendedMessage); }
HttpResponseMessage MessageResponse = await MessageClient.SendAsync(MessageBuilder);

if (MessageResponse.IsSuccessStatusCode != true)
Expand Down
2 changes: 1 addition & 1 deletion modSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static string GetInstalledSoftware()
NewSoftware = NewSoftware.Substring(0, NewSoftware.Length - 2);
NewSoftwareJSON = NewSoftwareJSON.Substring(0, NewSoftwareJSON.Length - 1) + "]}";
modLogging.LogEvent("Detected new software installed: " + NewSoftware, EventLogEntryType.Information, 6051);
modLogging.LogEvent(NewSoftwareJSON, EventLogEntryType.Information, 6051);
modSync.SendMessage("server", "nodedata", "newsoftware", NewSoftwareJSON);
}
return "Installed Applications: " + count.ToString();
}
Expand Down

0 comments on commit 3ff9c5c

Please sign in to comment.