Fix softlocks on pre-user OOBE.
This commit is contained in:
parent
4a5db39ea7
commit
75ed7e9215
10 changed files with 1091 additions and 10 deletions
1030
.vs/config/applicationhost.config
Normal file
1030
.vs/config/applicationhost.config
Normal file
File diff suppressed because it is too large
Load diff
|
@ -58,6 +58,7 @@
|
|||
<Compile Include="Shop.cs" />
|
||||
<Compile Include="Unite\Download.cs" />
|
||||
<Compile Include="Unite\ReleaseQuery.cs" />
|
||||
<Compile Include="UserConfig.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
|
37
ShiftOS.Objects/UserConfig.cs
Normal file
37
ShiftOS.Objects/UserConfig.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ShiftOS.Objects
|
||||
{
|
||||
public class UserConfig
|
||||
{
|
||||
public string UniteUrl { get; set; }
|
||||
public string DigitalSocietyAddress { get; set; }
|
||||
public int DigitalSocietyPort { get; set; }
|
||||
|
||||
public static UserConfig Get()
|
||||
{
|
||||
var conf = new UserConfig
|
||||
{
|
||||
UniteUrl = "http://getshiftos.ml",
|
||||
DigitalSocietyAddress = "michaeltheshifter.me",
|
||||
DigitalSocietyPort = 13370
|
||||
};
|
||||
|
||||
if (!File.Exists("servers.json"))
|
||||
{
|
||||
File.WriteAllText("servers.json", JsonConvert.SerializeObject(conf, Formatting.Indented));
|
||||
}
|
||||
else
|
||||
{
|
||||
conf = JsonConvert.DeserializeObject<UserConfig>(File.ReadAllText("servers.json"));
|
||||
}
|
||||
return conf;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -86,6 +86,7 @@ namespace ShiftOS.Server
|
|||
/// <param name="args">The command-line arguments.</param>
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
UserConfig.Get();
|
||||
System.Timers.Timer tmr = new System.Timers.Timer(5000);
|
||||
tmr.Elapsed += (o, a) =>
|
||||
{
|
||||
|
|
|
@ -189,7 +189,7 @@ namespace ShiftOS.Server
|
|||
//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());
|
||||
var wreq = WebRequest.Create(UserConfig.Get().UniteUrl + "/API/SetCodepoints/" + sav.Codepoints.ToString());
|
||||
wreq.Headers.Add("Authentication: Token " + sav.UniteAuthToken);
|
||||
wreq.GetResponse();
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace ShiftOS.WinForms
|
|||
Console.Write(" ");
|
||||
ConsoleEx.BackgroundColor = ConsoleColor.Black;
|
||||
}
|
||||
Engine.AudioManager.PlayStream(Properties.Resources.typesound);
|
||||
Desktop.InvokeOnWorkerThread(() => Engine.AudioManager.PlayStream(Properties.Resources.typesound));
|
||||
formatProgress++;
|
||||
Thread.Sleep(175);
|
||||
}
|
||||
|
@ -135,14 +135,16 @@ namespace ShiftOS.WinForms
|
|||
{
|
||||
Console.WriteLine("Creating: " + dir);
|
||||
Thread.Sleep(125);
|
||||
Engine.AudioManager.PlayStream(Properties.Resources.writesound);
|
||||
Desktop.InvokeOnWorkerThread(() => Engine.AudioManager.PlayStream(Properties.Resources.writesound));
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Next, let's get user information.");
|
||||
Console.WriteLine();
|
||||
ShiftOS.Engine.OutOfBoxExperience.PromptForLogin();
|
||||
|
||||
Desktop.InvokeOnWorkerThread(() =>
|
||||
{
|
||||
ShiftOS.Engine.OutOfBoxExperience.PromptForLogin();
|
||||
});
|
||||
}
|
||||
private static bool isValid(string text, string chars)
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
|||
using System.Windows.Forms;
|
||||
using ShiftOS.Engine;
|
||||
using System.Net;
|
||||
using ShiftOS.Objects;
|
||||
|
||||
namespace ShiftOS.WinForms
|
||||
{
|
||||
|
@ -59,7 +60,7 @@ namespace ShiftOS.WinForms
|
|||
|
||||
try
|
||||
{
|
||||
var webrequest = HttpWebRequest.Create("http://getshiftos.ml/Auth/Login?appname=ShiftOS&appdesc=ShiftOS+client&version=1_0_beta_2_4");
|
||||
var webrequest = HttpWebRequest.Create(UserConfig.Get().UniteUrl + "/Auth/Login?appname=ShiftOS&appdesc=ShiftOS+client&version=1_0_beta_2_4");
|
||||
string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{u}:{p}"));
|
||||
webrequest.Headers.Add("Authentication: Basic " + base64);
|
||||
var response = webrequest.GetResponse();
|
||||
|
|
|
@ -10,6 +10,7 @@ using System.Windows.Forms;
|
|||
using ShiftOS.Engine;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net;
|
||||
using ShiftOS.Objects;
|
||||
|
||||
namespace ShiftOS.WinForms
|
||||
{
|
||||
|
@ -99,7 +100,7 @@ namespace ShiftOS.WinForms
|
|||
|
||||
try
|
||||
{
|
||||
var webrequest = HttpWebRequest.Create("http://getshiftos.ml/Auth/Register?appname=ShiftOS&appdesc=ShiftOS+client&version=1_0_beta_2_4&displayname=" + txtdisplay.Text + "&sysname=" + txtsysname.Text);
|
||||
var webrequest = HttpWebRequest.Create(UserConfig.Get().UniteUrl + "/Auth/Register?appname=ShiftOS&appdesc=ShiftOS+client&version=1_0_beta_2_4&displayname=" + txtdisplay.Text + "&sysname=" + txtsysname.Text);
|
||||
string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{u}:{p}"));
|
||||
webrequest.Headers.Add("Authentication: Basic " + base64);
|
||||
var response = webrequest.GetResponse();
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace ShiftOS.Engine
|
|||
try
|
||||
{
|
||||
|
||||
ServerManager.Initiate("secondary4162.cloudapp.net", 13370);
|
||||
ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort);
|
||||
//This haults the client until the connection is successful.
|
||||
while (ServerManager.thisGuid == new Guid())
|
||||
{
|
||||
|
|
|
@ -5,13 +5,20 @@ using System.Net;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using ShiftOS.Objects;
|
||||
|
||||
namespace ShiftOS.Unite
|
||||
{
|
||||
public class UniteClient
|
||||
{
|
||||
public string Token { get; private set; }
|
||||
public string BaseURL { get; private set; }
|
||||
public string BaseURL
|
||||
{
|
||||
get
|
||||
{
|
||||
return UserConfig.Get().UniteUrl;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetDisplayNameId(string id)
|
||||
{
|
||||
|
@ -25,7 +32,8 @@ namespace ShiftOS.Unite
|
|||
|
||||
public UniteClient(string baseurl, string usertoken)
|
||||
{
|
||||
BaseURL = baseurl;
|
||||
//Handled by the servers.json file
|
||||
//BaseURL = baseurl;
|
||||
Token = usertoken;
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue