MAWHAHAHA

This commit is contained in:
McMistrzYT 2024-02-04 21:28:46 +01:00
parent aa104a9660
commit f042c4adb3
4 changed files with 37 additions and 32 deletions

View File

@ -1,10 +1,21 @@
namespace Partypacker namespace Partypacker
{ {
public enum UserRole
{
User = 100,
VerifiedUser = 200,
TrackVerifier = 250,
Moderator = 300,
Administrator = 400
}
public class UserDetailObject public class UserDetailObject
{ {
public string ID; public string ID;
public string Username; public string Username;
public string GlobalName; public string GlobalName;
public string Avatar; public string Avatar;
public bool IsAdmin;
public UserRole Role;
} }
} }

View File

@ -12,14 +12,14 @@ namespace Partypacker.Core
{ {
public static string BaseURL = public static string BaseURL =
#if DEBUG #if DEBUG
"http://localhost:6677"; "https://sparks-staging.coolmath.tech";
#else #else
MainWindow.settings.GetValue("Launcher", "apiurl") ?? "https://partypack.mcthe.dev"; MainWindow.settings.GetValue("Launcher", "apiurl") ?? "https://partypack.mcthe.dev";
#endif #endif
public static string DashboardURL = public static string DashboardURL =
#if DEBUG #if DEBUG
"http://localhost:5173"; "https://sparks-staging.coolmath.tech";
#else #else
MainWindow.settings.GetValue("Launcher", "dashurl") ?? "https://partypack.mcthe.dev"; MainWindow.settings.GetValue("Launcher", "dashurl") ?? "https://partypack.mcthe.dev";
#endif #endif
@ -30,6 +30,7 @@ namespace Partypacker.Core
URL = BaseURL + URL; URL = BaseURL + URL;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.Headers.Add("x-sparks-staging", "f3d0e05928afb8257b01477120739a93264c1817edf93999a46af1e226a5e18aee19111578ee73814c7eaffae7b57b50ae0a2902ebd868fe3fbd91b5a25391b46a5b0ce54d2f57d11bf249381370def840d3e6aaf929023892104f701298830478f62297cef250153ad5acc1ec09de494a644206dc275a4692b360315737ab96");
request.Method = "GET"; request.Method = "GET";
// request.Headers.Add("my-header", "my-value"); // request.Headers.Add("my-header", "my-value");
@ -58,6 +59,7 @@ namespace Partypacker.Core
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.Method = "POST"; request.Method = "POST";
request.ContentType = "text/plain"; request.ContentType = "text/plain";
request.Headers.Add("x-sparks-staging", "f3d0e05928afb8257b01477120739a93264c1817edf93999a46af1e226a5e18aee19111578ee73814c7eaffae7b57b50ae0a2902ebd868fe3fbd91b5a25391b46a5b0ce54d2f57d11bf249381370def840d3e6aaf929023892104f701298830478f62297cef250153ad5acc1ec09de494a644206dc275a4692b360315737ab96");
string Response = ""; string Response = "";
try try

View File

@ -50,9 +50,7 @@ namespace Partypacker
DiscordAuthURL = DiscordURL.Value; DiscordAuthURL = DiscordURL.Value;
if (!string.IsNullOrWhiteSpace(settings.GetValue("Launcher", "token"))) if (!string.IsNullOrWhiteSpace(settings.GetValue("Launcher", "token")))
{
AutoLogin(); AutoLogin();
}
} }
void OnApplicationExit(object sender, ExitEventArgs e) => Proxx?.StopProxy(); void OnApplicationExit(object sender, ExitEventArgs e) => Proxx?.StopProxy();
@ -84,10 +82,7 @@ namespace Partypacker
Token = NonB64Str; Token = NonB64Str;
UserDetails = JsonConvert.DeserializeObject<UserDetailObject>(Encoding.UTF8.GetString(Convert.FromHexString(HttpUtility.UrlDecode(settings.GetValue("Launcher", "user"))))); UserDetails = JsonConvert.DeserializeObject<UserDetailObject>(Encoding.UTF8.GetString(Convert.FromHexString(HttpUtility.UrlDecode(settings.GetValue("Launcher", "user")))));
UpdateUserUI(); UpdateUserUI();
Dispatcher.Invoke(() => Dispatcher.Invoke(() => LaunchButton.IsEnabled = true);
{
LaunchButton.IsEnabled = true;
});
ConvertLoginToLogout(); ConvertLoginToLogout();
} }
@ -147,10 +142,9 @@ namespace Partypacker
void OnLoginUsingDiscord(object sender, RoutedEventArgs e) 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" Client = "PartypackerDesktop"
}))))}"}); }))))}"});
if (sv == null) if (sv == null)
@ -169,29 +163,25 @@ namespace Partypacker
if (WaitingForGameToOpen) if (WaitingForGameToOpen)
{ {
if (processes.Length > 0) if (processes.Length > 0)
{
WaitingForGameToOpen = false; WaitingForGameToOpen = false;
}
return;
} }
else
if (processes.Length > 0)
return;
Dispatcher.Invoke(() =>
{ {
if (processes.Length <= 0) LaunchButton.IsEnabled = true;
{ });
Dispatcher.Invoke(() => WaitingForGameToOpen = true;
{ GameCheckTimer.Stop();
LaunchButton.IsEnabled = true;
});
WaitingForGameToOpen = true;
GameCheckTimer.Stop();
}
}
} }
async void OnLaunch(object sender, RoutedEventArgs e) async void OnLaunch(object sender, RoutedEventArgs e)
{ {
Proxx = new Proxy(Port); Proxx = new Proxy(Port);
// please make this dynamic later :D
// ok
Proxx.Token = Token; Proxx.Token = Token;
Proxx.StartProxy(); Proxx.StartProxy();

View File

@ -130,10 +130,18 @@ namespace Partypacker.Net
#region EVENT_HANDLERS #region EVENT_HANDLERS
private void OnBeforeRequest(Session oSession) 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") if (oSession.PathAndQuery.Contains("/content/api/pages/fortnite-game")
|| oSession.HostnameIs("cdn.qstv.on.epicgames.com") || oSession.HostnameIs("cdn.qstv.on.epicgames.com")
|| oSession.PathAndQuery.Contains("/master.blurl") || oSession.PathAndQuery.Contains("/master.blurl")
|| oSession.PathAndQuery.Contains("/main.blurl") || oSession.PathAndQuery.Contains("/main.blurl")
|| oSession.fullUrl.StartsWith(BaseURL)
) )
{ {
if (oSession.HTTPMethodIs("CONNECT")) if (oSession.HTTPMethodIs("CONNECT"))
@ -142,14 +150,8 @@ namespace Partypacker.Net
return; 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-Partypack-Token", Token);
oSession.RequestHeaders.Add("x-sparks-staging", "f3d0e05928afb8257b01477120739a93264c1817edf93999a46af1e226a5e18aee19111578ee73814c7eaffae7b57b50ae0a2902ebd868fe3fbd91b5a25391b46a5b0ce54d2f57d11bf249381370def840d3e6aaf929023892104f701298830478f62297cef250153ad5acc1ec09de494a644206dc275a4692b360315737ab96");
if (oSession.PathAndQuery.Contains("/master.blurl") if (oSession.PathAndQuery.Contains("/master.blurl")
|| oSession.PathAndQuery.Contains("/main.blurl")) || oSession.PathAndQuery.Contains("/main.blurl"))