diff --git a/Partypacker/Classes.cs b/Partypacker/Classes.cs index a910f87..4d5bd71 100644 --- a/Partypacker/Classes.cs +++ b/Partypacker/Classes.cs @@ -1,10 +1,21 @@ namespace Partypacker { + public enum UserRole + { + User = 100, + VerifiedUser = 200, + TrackVerifier = 250, + Moderator = 300, + Administrator = 400 + } + public class UserDetailObject { public string ID; public string Username; public string GlobalName; public string Avatar; + public bool IsAdmin; + public UserRole Role; } } \ No newline at end of file diff --git a/Partypacker/Core/PartypackServer.cs b/Partypacker/Core/PartypackServer.cs index b06effe..3bb2d5f 100644 --- a/Partypacker/Core/PartypackServer.cs +++ b/Partypacker/Core/PartypackServer.cs @@ -12,14 +12,14 @@ namespace Partypacker.Core { public static string BaseURL = #if DEBUG - "http://localhost:6677"; + "https://sparks-staging.coolmath.tech"; #else MainWindow.settings.GetValue("Launcher", "apiurl") ?? "https://partypack.mcthe.dev"; #endif public static string DashboardURL = #if DEBUG - "http://localhost:5173"; + "https://sparks-staging.coolmath.tech"; #else MainWindow.settings.GetValue("Launcher", "dashurl") ?? "https://partypack.mcthe.dev"; #endif @@ -30,6 +30,7 @@ namespace Partypacker.Core URL = BaseURL + URL; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL); + request.Headers.Add("x-sparks-staging", "f3d0e05928afb8257b01477120739a93264c1817edf93999a46af1e226a5e18aee19111578ee73814c7eaffae7b57b50ae0a2902ebd868fe3fbd91b5a25391b46a5b0ce54d2f57d11bf249381370def840d3e6aaf929023892104f701298830478f62297cef250153ad5acc1ec09de494a644206dc275a4692b360315737ab96"); request.Method = "GET"; // request.Headers.Add("my-header", "my-value"); @@ -58,6 +59,7 @@ namespace Partypacker.Core HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL); request.Method = "POST"; request.ContentType = "text/plain"; + request.Headers.Add("x-sparks-staging", "f3d0e05928afb8257b01477120739a93264c1817edf93999a46af1e226a5e18aee19111578ee73814c7eaffae7b57b50ae0a2902ebd868fe3fbd91b5a25391b46a5b0ce54d2f57d11bf249381370def840d3e6aaf929023892104f701298830478f62297cef250153ad5acc1ec09de494a644206dc275a4692b360315737ab96"); string Response = ""; try diff --git a/Partypacker/MainWindow.xaml.cs b/Partypacker/MainWindow.xaml.cs index 58551a7..2b6b9ea 100644 --- a/Partypacker/MainWindow.xaml.cs +++ b/Partypacker/MainWindow.xaml.cs @@ -50,9 +50,7 @@ namespace Partypacker DiscordAuthURL = DiscordURL.Value; if (!string.IsNullOrWhiteSpace(settings.GetValue("Launcher", "token"))) - { AutoLogin(); - } } void OnApplicationExit(object sender, ExitEventArgs e) => Proxx?.StopProxy(); @@ -84,10 +82,7 @@ namespace Partypacker Token = NonB64Str; UserDetails = JsonConvert.DeserializeObject(Encoding.UTF8.GetString(Convert.FromHexString(HttpUtility.UrlDecode(settings.GetValue("Launcher", "user"))))); UpdateUserUI(); - Dispatcher.Invoke(() => - { - LaunchButton.IsEnabled = true; - }); + Dispatcher.Invoke(() => LaunchButton.IsEnabled = true); ConvertLoginToLogout(); } @@ -147,10 +142,9 @@ namespace Partypacker void OnLoginUsingDiscord(object sender, RoutedEventArgs e) { - Process.Start(new ProcessStartInfo { UseShellExecute = true, FileName = $@"{DiscordAuthURL}&state={HttpUtility.UrlEncode(Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(new + Process.Start(new ProcessStartInfo { UseShellExecute = true, FileName = $"{DiscordAuthURL}&state={HttpUtility.UrlEncode(Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(new { Client = "PartypackerDesktop" - }))))}"}); if (sv == null) @@ -169,29 +163,25 @@ namespace Partypacker if (WaitingForGameToOpen) { if (processes.Length > 0) - { WaitingForGameToOpen = false; - } + + return; } - else + + if (processes.Length > 0) + return; + + Dispatcher.Invoke(() => { - if (processes.Length <= 0) - { - Dispatcher.Invoke(() => - { - LaunchButton.IsEnabled = true; - }); - WaitingForGameToOpen = true; - GameCheckTimer.Stop(); - } - } + LaunchButton.IsEnabled = true; + }); + WaitingForGameToOpen = true; + GameCheckTimer.Stop(); } async void OnLaunch(object sender, RoutedEventArgs e) { Proxx = new Proxy(Port); - // please make this dynamic later :D - // ok Proxx.Token = Token; Proxx.StartProxy(); diff --git a/Partypacker/Proxy/Proxy.cs b/Partypacker/Proxy/Proxy.cs index 8f690f6..0e01780 100644 --- a/Partypacker/Proxy/Proxy.cs +++ b/Partypacker/Proxy/Proxy.cs @@ -130,10 +130,18 @@ namespace Partypacker.Net #region EVENT_HANDLERS private void OnBeforeRequest(Session oSession) { + string BaseURL = +#if DEBUG + "https://sparks-staging.coolmath.tech"; +#else + "https://partypack.mcthe.dev"; +#endif + if (oSession.PathAndQuery.Contains("/content/api/pages/fortnite-game") || oSession.HostnameIs("cdn.qstv.on.epicgames.com") || oSession.PathAndQuery.Contains("/master.blurl") || oSession.PathAndQuery.Contains("/main.blurl") + || oSession.fullUrl.StartsWith(BaseURL) ) { if (oSession.HTTPMethodIs("CONNECT")) @@ -142,14 +150,8 @@ namespace Partypacker.Net return; } - string BaseURL = -#if DEBUG - "http://localhost:6677"; -#else - "https://api.partypack.mcthe.dev"; -#endif - oSession.RequestHeaders.Add("X-Partypack-Token", Token); + oSession.RequestHeaders.Add("x-sparks-staging", "f3d0e05928afb8257b01477120739a93264c1817edf93999a46af1e226a5e18aee19111578ee73814c7eaffae7b57b50ae0a2902ebd868fe3fbd91b5a25391b46a5b0ce54d2f57d11bf249381370def840d3e6aaf929023892104f701298830478f62297cef250153ad5acc1ec09de494a644206dc275a4692b360315737ab96"); if (oSession.PathAndQuery.Contains("/master.blurl") || oSession.PathAndQuery.Contains("/main.blurl"))