diff --git a/Partypacker.sln b/Partypacker.sln
index 62fb997..754d4ab 100644
--- a/Partypacker.sln
+++ b/Partypacker.sln
@@ -1,9 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.33927.289
+# Visual Studio Version 17
+VisualStudioVersion = 17.8.34219.65
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Partypacker", "Partypacker\Partypacker.csproj", "{FE06B383-0C7A-4A35-B208-66133110BB32}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Partypacker", "Partypacker\Partypacker.csproj", "{BCB1E673-FE06-4360-895D-07FE682C720D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -11,15 +11,15 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {FE06B383-0C7A-4A35-B208-66133110BB32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FE06B383-0C7A-4A35-B208-66133110BB32}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FE06B383-0C7A-4A35-B208-66133110BB32}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FE06B383-0C7A-4A35-B208-66133110BB32}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BCB1E673-FE06-4360-895D-07FE682C720D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BCB1E673-FE06-4360-895D-07FE682C720D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BCB1E673-FE06-4360-895D-07FE682C720D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BCB1E673-FE06-4360-895D-07FE682C720D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {16591BB0-2EFE-43B1-917D-7CD574AB32C8}
+ SolutionGuid = {F12064C4-E05B-464A-BF11-E0E20C7D2B3F}
EndGlobalSection
EndGlobal
diff --git a/Partypacker/App.xaml b/Partypacker/App.xaml
new file mode 100644
index 0000000..5b0fbe9
--- /dev/null
+++ b/Partypacker/App.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Partypacker/App.xaml.cs b/Partypacker/App.xaml.cs
new file mode 100644
index 0000000..51b8ee0
--- /dev/null
+++ b/Partypacker/App.xaml.cs
@@ -0,0 +1,14 @@
+using System.Configuration;
+using System.Data;
+using System.Windows;
+
+namespace Partypacker
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+
+}
diff --git a/Partypacker/AssemblyInfo.cs b/Partypacker/AssemblyInfo.cs
new file mode 100644
index 0000000..b0ec827
--- /dev/null
+++ b/Partypacker/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/Partypacker/Classes.cs b/Partypacker/Classes.cs
new file mode 100644
index 0000000..a910f87
--- /dev/null
+++ b/Partypacker/Classes.cs
@@ -0,0 +1,10 @@
+namespace Partypacker
+{
+ public class UserDetailObject
+ {
+ public string ID;
+ public string Username;
+ public string GlobalName;
+ public string Avatar;
+ }
+}
\ No newline at end of file
diff --git a/Partypacker/Core/AppRegistry.cs b/Partypacker/Core/AppRegistry.cs
index 2170bd9..ade09a0 100644
--- a/Partypacker/Core/AppRegistry.cs
+++ b/Partypacker/Core/AppRegistry.cs
@@ -47,4 +47,4 @@ namespace Partypacker.Core
public RegistryValueKind RegistryValueKind { get; set; }
}
-}
+}
\ No newline at end of file
diff --git a/Partypacker/Core/Extensions.cs b/Partypacker/Core/Extensions.cs
index 7fb58bc..00f9fe8 100644
--- a/Partypacker/Core/Extensions.cs
+++ b/Partypacker/Core/Extensions.cs
@@ -17,4 +17,4 @@ namespace Partypacker.Core
.ForEach(x => registryKey
.SetValue(x.Name, x.Value, x.RegistryValueKind));
}
-}
+}
\ No newline at end of file
diff --git a/Partypacker/Core/Server.cs b/Partypacker/Core/PartypackServer.cs
similarity index 82%
rename from Partypacker/Core/Server.cs
rename to Partypacker/Core/PartypackServer.cs
index f89f38a..26d0e06 100644
--- a/Partypacker/Core/Server.cs
+++ b/Partypacker/Core/PartypackServer.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Net;
using System.Text;
@@ -7,12 +8,26 @@ using System.Threading.Tasks;
namespace Partypacker.Core
{
- internal class Server
+ internal class PartypackServer
{
+ public static string BaseURL =
+#if DEBUG
+ "http://localhost:6677";
+#else
+ "https://partypack.mcthe.dev";
+#endif
+
+ public static string DashboardURL =
+#if DEBUG
+ "http://localhost:5173";
+#else
+ "https://partypack.mcthe.dev";
+#endif
+
public static KeyValuePair GET(string URL = "/")
{
if (URL.StartsWith("/"))
- URL = "https://example.com" + URL;
+ URL = BaseURL + URL;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.Method = "GET";
@@ -38,7 +53,7 @@ namespace Partypacker.Core
public static KeyValuePair POST(string URL = "/", string Body = "")
{
if (URL.StartsWith("/"))
- URL = "https://example.com" + URL;
+ URL = BaseURL + URL;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.Method = "POST";
@@ -66,5 +81,5 @@ namespace Partypacker.Core
}
}
-
-}
+
+}
\ No newline at end of file
diff --git a/Partypacker/Core/Win32.cs b/Partypacker/Core/Win32.cs
index 6320995..242e8f2 100644
--- a/Partypacker/Core/Win32.cs
+++ b/Partypacker/Core/Win32.cs
@@ -87,4 +87,4 @@ namespace Partypacker
INTERNET_OPTION_SETTINGS_CHANGED = 39
}
}
-}
+}
\ No newline at end of file
diff --git a/Partypacker/MainWindow.xaml b/Partypacker/MainWindow.xaml
new file mode 100644
index 0000000..f3a7828
--- /dev/null
+++ b/Partypacker/MainWindow.xaml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Partypacker/MainWindow.xaml.cs b/Partypacker/MainWindow.xaml.cs
new file mode 100644
index 0000000..a0f0850
--- /dev/null
+++ b/Partypacker/MainWindow.xaml.cs
@@ -0,0 +1,91 @@
+using Newtonsoft.Json;
+using Partypacker.Core;
+using Partypacker.Net;
+using System.Diagnostics;
+using System.Net;
+using System.Text;
+using System.Web;
+using System.Windows;
+using System.Windows.Controls;
+using WatsonWebserver;
+
+namespace Partypacker
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ static Proxy Proxx;
+ static string DiscordAuthURL;
+ static int Port = 6969;
+ static string Token;
+ static UserDetailObject UserDetails;
+ static Server sv;
+
+ public MainWindow()
+ {
+ InitializeComponent();
+ Application.Current.Exit += OnApplicationExit;
+
+ var DiscordURL = PartypackServer.GET("/api/discord/url");
+ if (!DiscordURL.Key)
+ {
+ MessageBox.Show("Failed to contact the Partypack API. (Is it running?)", "Partypack API Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ Environment.Exit(-1);
+ return;
+ }
+
+ DiscordAuthURL = DiscordURL.Value;
+ }
+
+ void OnApplicationExit(object sender, ExitEventArgs e) => Proxx?.StopProxy();
+ void OnChangePort(object sender, TextChangedEventArgs e) {
+ if (!int.TryParse(((TextBox)sender).Text, out int P))
+ return;
+
+ Port = P;
+ }
+
+ void OnDashboard(object sender, RoutedEventArgs e) => Process.Start(new ProcessStartInfo { UseShellExecute = true, FileName = PartypackServer.DashboardURL });
+
+ private static async Task DefaultRoute(HttpContext ctx)
+ {
+ string _Token = ctx.Request.Query.Elements["token"];
+ string _UserDetails = ctx.Request.Query.Elements["user"];
+
+ if (_Token == null || _UserDetails == null)
+ {
+ await ctx.Response.Send($"Invalid request. ({_Token}, {_UserDetails})");
+ return;
+ }
+
+ Token = _Token;
+ UserDetails = JsonConvert.DeserializeObject(Encoding.UTF8.GetString(Convert.FromBase64String(HttpUtility.UrlDecode(_UserDetails))));
+
+ await ctx.Response.Send("All done! You can close this tab now.");
+ sv.Stop();
+ }
+
+ 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
+ {
+ Client = "PartypackerDesktop"
+ }))))}" });
+
+ sv = new Server("127.0.0.1", 14968, false, DefaultRoute);
+ sv.Start();
+ }
+
+ void OnLaunch(object sender, RoutedEventArgs e)
+ {
+ Proxx = new Proxy(Port);
+ // please make this dynamic later :D
+ Proxx.Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJRCI6IjQ1NDk2ODU0MjcyMzU3MTcxNSIsImlhdCI6MTcwNTkyODQ0M30.ogINqFZ_3DBkECbHo87HjW9c6p2imT1CnCvfIR3iGJ4";
+ Proxx.StartProxy();
+
+ //Process.Start(new ProcessStartInfo { UseShellExecute = true, FileName = "com.epicgames.launcher://apps/fn%3A4fe75bbc5a674f4f9b356b5c90567da5%3AFortnite?action=launch&silent=true" });
+ }
+ }
+}
\ No newline at end of file
diff --git a/Partypacker/Partypacker.csproj b/Partypacker/Partypacker.csproj
index da8caf9..65bb4a7 100644
--- a/Partypacker/Partypacker.csproj
+++ b/Partypacker/Partypacker.csproj
@@ -1,27 +1,22 @@
-
+
- Exe
- net7.0
- enable
+ WinExe
+ net7.0-windows
enable
- icon.ico
- icon.ico
+ enable
+ true
+
+
+
-
-
-
-
-
- True
-
-
+
diff --git a/Partypacker/Program.cs b/Partypacker/Program.cs
deleted file mode 100644
index c5cd813..0000000
--- a/Partypacker/Program.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-using Partypacker.Net;
-using Pastel;
-using System.Diagnostics;
-using System.Drawing;
-using static Partypacker.Win32;
-
-namespace Partypacker
-{
- public static class Program
- {
- private static SetConsoleCtrlEventHandler CtrlHandler;
- private static Proxy Proxx;
-
- private static void Main(string[] args)
- {
- ushort? port = 6969;
-
- Console.SetWindowSize(75, 20);
-
- Console.CursorVisible = false;
-
- Console.WriteLine(@"
- _____ _ _
- | __ \ | | | |
- | |__) |_ _ _ __| |_ _ _ _ __ __ _ ___| | _____ _ __
- | ___/ _` | '__| __| | | | '_ \ / _` |/ __| |/ / _ \ '__|
- | | | (_| | | | |_| |_| | |_) | (_| | (__| < __/ |
- |_| \__,_|_| \__|\__, | .__/ \__,_|\___|_|\_\___|_|
- __/ | |
- |___/|_| ".Pastel(Color.IndianRed));
- Console.WriteLine("-----------------------------------------------------------".Pastel(Color.CadetBlue));
-
- Console.WriteLine("Welcome to Partypacker - Select an option below:");
-
- ConsoleKeyInfo ReceivedKeyInput;
- int SelectedOptionIndex = 0;
- bool Running = true;
- SelectableOption[] Options = new SelectableOption[]
- {
- new SelectableOption("Launch Fortnite", () =>
- Run(port, () => Process.Start(new ProcessStartInfo { FileName = "com.epicgames.launcher://apps/fn%3A4fe75bbc5a674f4f9b356b5c90567da5%3AFortnite?action=launch&silent=true", UseShellExecute = true }))),
- new SelectableOption("Open Dashboard", () => Process.Start(new ProcessStartInfo { FileName = "https://partypack.mcthe.dev", UseShellExecute = true }))
- };
-
- try
- {
- while (Running)
- {
- (int left, int top) = Console.GetCursorPosition();
- for (int i = 0; i < Options.Length; i++)
- {
- bool Selected = SelectedOptionIndex == i;
- SelectableOption Option = Options[i];
- Console.WriteLine($"{(Selected ? ">".Pastel(Color.LimeGreen) : " ")} {Option.Name.Pastel(Selected ? Color.DarkGreen : Color.Gray)}");
- }
-
- ReceivedKeyInput = Console.ReadKey();
- switch (ReceivedKeyInput.Key)
- {
- case ConsoleKey.UpArrow:
- SelectedOptionIndex--;
- break;
- case ConsoleKey.DownArrow:
- SelectedOptionIndex++;
- break;
- case ConsoleKey.Enter:
- Options[SelectedOptionIndex].OnPress.Invoke();
- break;
- }
-
- Console.SetCursorPosition(left, top);
- SelectedOptionIndex = Math.Clamp(SelectedOptionIndex, 0, Options.Length);
- }
- }
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- Debug.Fail(e.StackTrace);
- }
- finally
- {
- OnApplicationExit();
- }
- }
-
- private static void Run(ushort? port, Action Finish)
- {
- CtrlHandler = CleanUp;
- SetConsoleCtrlHandler(CtrlHandler, true);
- Proxx = port switch
- {
- null => new Proxy(),
- _ => new Proxy((ushort)port)
- };
- Proxx.StartProxy();
-
- Finish.Invoke();
- }
-
- public static void OnApplicationExit()
- {
- CleanUp(CtrlType.CTRL_C_EVENT);
- }
-
- private static bool CleanUp(CtrlType ctrlType)
- {
- Proxx?.StopProxy();
- return true;
- }
- }
-}
-
diff --git a/Partypacker/Proxy/PrivateKeyDeleters.cs b/Partypacker/Proxy/PrivateKeyDeleters.cs
index 3c1bf04..6ada03c 100644
--- a/Partypacker/Proxy/PrivateKeyDeleters.cs
+++ b/Partypacker/Proxy/PrivateKeyDeleters.cs
@@ -47,4 +47,4 @@ namespace Partypacker.Net
rsaCng.Clear();
}
}
-}
+}
\ No newline at end of file
diff --git a/Partypacker/Proxy/Proxy.cs b/Partypacker/Proxy/Proxy.cs
index be6a5d8..8f690f6 100644
--- a/Partypacker/Proxy/Proxy.cs
+++ b/Partypacker/Proxy/Proxy.cs
@@ -20,6 +20,7 @@ namespace Partypacker.Net
// https://github.com/PsychoPast/LawinServer/blob/master/LawinServer/Proxy/Proxy.cs
// without it, fiddler-less proxying would have never been achieved
+ public string Token = "";
private const string Proxy_Server = "ProxyServer";
private const string Proxy_Enable = "ProxyEnable";
private readonly AppRegistry appRegistry;
@@ -31,14 +32,14 @@ namespace Partypacker.Net
public Proxy() : this(9999) { } //default port
- public Proxy(ushort port)
+ public Proxy(int port)
{
appRegistry = new AppRegistry();
GetDefaultProxySettingsValue();
ConfigureFiddlerSettings(out bool fiddlerCertRegKeysExist);
startupSettings = new FiddlerCoreStartupSettingsBuilder()
- .ListenOnPort(port)
+ .ListenOnPort((ushort)port)
.RegisterAsSystemProxy()
.DecryptSSL()
.OptimizeThreadPool()
@@ -129,9 +130,8 @@ namespace Partypacker.Net
#region EVENT_HANDLERS
private void OnBeforeRequest(Session oSession)
{
- if (oSession.PathAndQuery.Contains("/content/api/pages/fortnite-game/spark-tracks")
+ if (oSession.PathAndQuery.Contains("/content/api/pages/fortnite-game")
|| oSession.HostnameIs("cdn.qstv.on.epicgames.com")
- || oSession.HostnameIs("cdn-0001.qstv.on.epicgames.com")
|| oSession.PathAndQuery.Contains("/master.blurl")
|| oSession.PathAndQuery.Contains("/main.blurl")
)
@@ -149,6 +149,8 @@ namespace Partypacker.Net
"https://api.partypack.mcthe.dev";
#endif
+ oSession.RequestHeaders.Add("X-Partypack-Token", Token);
+
if (oSession.PathAndQuery.Contains("/master.blurl")
|| oSession.PathAndQuery.Contains("/main.blurl"))
oSession.fullUrl = BaseURL + "/song/download" + oSession.PathAndQuery;
@@ -156,7 +158,7 @@ namespace Partypacker.Net
oSession.fullUrl = BaseURL + oSession.PathAndQuery;
}
}
-#endregion
+ #endregion
#region CLEANUP
private bool ResetProxySettings()
@@ -187,4 +189,4 @@ namespace Partypacker.Net
}
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/Partypacker/SelectableOption.cs b/Partypacker/SelectableOption.cs
deleted file mode 100644
index 2154892..0000000
--- a/Partypacker/SelectableOption.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Partypacker
-{
- public class SelectableOption
- {
- public string Name;
- public Action OnPress;
-
- public SelectableOption(string name, Action onPress)
- {
- Name = name;
- OnPress = onPress;
- }
- }
-}
diff --git a/Partypacker/icon.ico b/Partypacker/icon.ico
deleted file mode 100644
index 1d1c49c..0000000
Binary files a/Partypacker/icon.ico and /dev/null differ