Server-side linking to Unite

This commit is contained in:
Michael VanOverbeek 2017-04-30 15:44:29 +00:00
parent 03d01cdb4d
commit baddaee3a8
2 changed files with 19 additions and 0 deletions

View file

@ -45,6 +45,8 @@ namespace ShiftOS.Objects
public int MinorVersion { get; set; }
public int Revision { get; set; }
public string UniteAuthToken { get; set; }
public bool IsPatreon { get; set; }
public UserClass Class { get; set; }

View file

@ -32,6 +32,7 @@ using System.IO;
using Newtonsoft.Json;
using NetSockets;
using static ShiftOS.Server.Program;
using System.Net;
namespace ShiftOS.Server
{
@ -172,6 +173,9 @@ namespace ShiftOS.Server
try
{
Program.server.DispatchTo(new Guid(guid), new NetObject("auth_failed", new ServerMessage
{
Name = "mud_saved",
@ -179,6 +183,19 @@ namespace ShiftOS.Server
}));
}
catch { }
try
{
//Update the shiftos website with the user's codepoints.
if (!string.IsNullOrWhiteSpace(sav.UniteAuthToken))
{
var wreq = WebRequest.Create("http://getshiftos.ml/API/SetCodepoints/" + sav.Codepoints.ToString());
wreq.Headers.Add("Authentication: Token " + sav.UniteAuthToken);
wreq.GetResponse();
}
}
catch { }
}
[MudRequest("delete_save", typeof(ClientSave))]