gui push
This commit is contained in:
parent
cda1b8ccf0
commit
41b09152d3
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 16.0.33927.289
|
VisualStudioVersion = 17.8.34219.65
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
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
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -11,15 +11,15 @@ Global
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{FE06B383-0C7A-4A35-B208-66133110BB32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{BCB1E673-FE06-4360-895D-07FE682C720D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{FE06B383-0C7A-4A35-B208-66133110BB32}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{BCB1E673-FE06-4360-895D-07FE682C720D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{FE06B383-0C7A-4A35-B208-66133110BB32}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{BCB1E673-FE06-4360-895D-07FE682C720D}.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}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {16591BB0-2EFE-43B1-917D-7CD574AB32C8}
|
SolutionGuid = {F12064C4-E05B-464A-BF11-E0E20C7D2B3F}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
15
Partypacker/App.xaml
Normal file
15
Partypacker/App.xaml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<Application x:Class="Partypacker.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:Partypacker"
|
||||||
|
xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/AdonisUI;component/ColorSchemes/Dark.xaml"/>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/AdonisUI.ClassicTheme;component/Resources.xaml"/>
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
14
Partypacker/App.xaml.cs
Normal file
14
Partypacker/App.xaml.cs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Partypacker
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
10
Partypacker/AssemblyInfo.cs
Normal file
10
Partypacker/AssemblyInfo.cs
Normal file
|
@ -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)
|
||||||
|
)]
|
10
Partypacker/Classes.cs
Normal file
10
Partypacker/Classes.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
namespace Partypacker
|
||||||
|
{
|
||||||
|
public class UserDetailObject
|
||||||
|
{
|
||||||
|
public string ID;
|
||||||
|
public string Username;
|
||||||
|
public string GlobalName;
|
||||||
|
public string Avatar;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -7,12 +8,26 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Partypacker.Core
|
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<bool, string> GET(string URL = "/")
|
public static KeyValuePair<bool, string> GET(string URL = "/")
|
||||||
{
|
{
|
||||||
if (URL.StartsWith("/"))
|
if (URL.StartsWith("/"))
|
||||||
URL = "https://example.com" + URL;
|
URL = BaseURL + URL;
|
||||||
|
|
||||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
|
||||||
request.Method = "GET";
|
request.Method = "GET";
|
||||||
|
@ -38,7 +53,7 @@ namespace Partypacker.Core
|
||||||
public static KeyValuePair<bool, string> POST(string URL = "/", string Body = "")
|
public static KeyValuePair<bool, string> POST(string URL = "/", string Body = "")
|
||||||
{
|
{
|
||||||
if (URL.StartsWith("/"))
|
if (URL.StartsWith("/"))
|
||||||
URL = "https://example.com" + URL;
|
URL = BaseURL + URL;
|
||||||
|
|
||||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
|
||||||
request.Method = "POST";
|
request.Method = "POST";
|
39
Partypacker/MainWindow.xaml
Normal file
39
Partypacker/MainWindow.xaml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<Window x:Class="Partypacker.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:Partypacker"
|
||||||
|
xmlns:adonisControls="clr-namespace:AdonisUI.Controls;assembly=AdonisUI"
|
||||||
|
xmlns:adonisExtensions="clr-namespace:AdonisUI.Extensions;assembly=AdonisUI"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
ResizeMode="CanMinimize"
|
||||||
|
Title="MainWindow" Height="450" Width="800">
|
||||||
|
<Window.Style>
|
||||||
|
<Style TargetType="Window" BasedOn="{StaticResource {x:Type Window}}"/>
|
||||||
|
</Window.Style>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
<RowDefinition Height="10" />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
<RowDefinition Height="10" />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
<RowDefinition Height="10" />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
<RowDefinition Height="10" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="10" />
|
||||||
|
<ColumnDefinition Width="250" />
|
||||||
|
<ColumnDefinition Width="10"/>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition Width="10" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" adonisExtensions:WatermarkExtension.Watermark="Proxy Port (default: 6969)" TextChanged="OnChangePort" />
|
||||||
|
<Button Grid.Row="3" Grid.Column="1" Click="OnLaunch">Launch</Button>
|
||||||
|
<Button Grid.Row="5" Grid.Column="1" Click="OnDashboard">Open Dashboard</Button>
|
||||||
|
<Button Grid.Row="7" Grid.Column="1" Click="OnLoginUsingDiscord">Log in using Discord</Button>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
91
Partypacker/MainWindow.xaml.cs
Normal file
91
Partypacker/MainWindow.xaml.cs
Normal file
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
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<UserDetailObject>(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" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,27 +1,22 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0-windows</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<PackageIcon>icon.ico</PackageIcon>
|
<UseWPF>true</UseWPF>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AdonisUI" Version="1.17.1" />
|
||||||
|
<PackageReference Include="AdonisUI.ClassicTheme" Version="1.17.1" />
|
||||||
<PackageReference Include="BCMakeCert" Version="2.0.9" />
|
<PackageReference Include="BCMakeCert" Version="2.0.9" />
|
||||||
<PackageReference Include="FiddlerCore.Trial" Version="5.0.0" />
|
<PackageReference Include="FiddlerCore.Trial" Version="5.0.0" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Pastel" Version="5.0.0" />
|
<PackageReference Include="Pastel" Version="5.0.0" />
|
||||||
<PackageReference Include="System.ComponentModel.Composition" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Telerik.NetworkConnections" Version="0.2.0" />
|
<PackageReference Include="Telerik.NetworkConnections" Version="0.2.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="Watson" Version="5.1.3" />
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="icon.ico">
|
|
||||||
<Pack>True</Pack>
|
|
||||||
<PackagePath></PackagePath>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace Partypacker.Net
|
||||||
// https://github.com/PsychoPast/LawinServer/blob/master/LawinServer/Proxy/Proxy.cs
|
// https://github.com/PsychoPast/LawinServer/blob/master/LawinServer/Proxy/Proxy.cs
|
||||||
// without it, fiddler-less proxying would have never been achieved
|
// without it, fiddler-less proxying would have never been achieved
|
||||||
|
|
||||||
|
public string Token = "";
|
||||||
private const string Proxy_Server = "ProxyServer";
|
private const string Proxy_Server = "ProxyServer";
|
||||||
private const string Proxy_Enable = "ProxyEnable";
|
private const string Proxy_Enable = "ProxyEnable";
|
||||||
private readonly AppRegistry appRegistry;
|
private readonly AppRegistry appRegistry;
|
||||||
|
@ -31,14 +32,14 @@ namespace Partypacker.Net
|
||||||
|
|
||||||
public Proxy() : this(9999) { } //default port
|
public Proxy() : this(9999) { } //default port
|
||||||
|
|
||||||
public Proxy(ushort port)
|
public Proxy(int port)
|
||||||
{
|
{
|
||||||
appRegistry = new AppRegistry();
|
appRegistry = new AppRegistry();
|
||||||
|
|
||||||
GetDefaultProxySettingsValue();
|
GetDefaultProxySettingsValue();
|
||||||
ConfigureFiddlerSettings(out bool fiddlerCertRegKeysExist);
|
ConfigureFiddlerSettings(out bool fiddlerCertRegKeysExist);
|
||||||
startupSettings = new FiddlerCoreStartupSettingsBuilder()
|
startupSettings = new FiddlerCoreStartupSettingsBuilder()
|
||||||
.ListenOnPort(port)
|
.ListenOnPort((ushort)port)
|
||||||
.RegisterAsSystemProxy()
|
.RegisterAsSystemProxy()
|
||||||
.DecryptSSL()
|
.DecryptSSL()
|
||||||
.OptimizeThreadPool()
|
.OptimizeThreadPool()
|
||||||
|
@ -129,9 +130,8 @@ namespace Partypacker.Net
|
||||||
#region EVENT_HANDLERS
|
#region EVENT_HANDLERS
|
||||||
private void OnBeforeRequest(Session oSession)
|
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.qstv.on.epicgames.com")
|
||||||
|| oSession.HostnameIs("cdn-0001.qstv.on.epicgames.com")
|
|
||||||
|| oSession.PathAndQuery.Contains("/master.blurl")
|
|| oSession.PathAndQuery.Contains("/master.blurl")
|
||||||
|| oSession.PathAndQuery.Contains("/main.blurl")
|
|| oSession.PathAndQuery.Contains("/main.blurl")
|
||||||
)
|
)
|
||||||
|
@ -149,6 +149,8 @@ namespace Partypacker.Net
|
||||||
"https://api.partypack.mcthe.dev";
|
"https://api.partypack.mcthe.dev";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
oSession.RequestHeaders.Add("X-Partypack-Token", Token);
|
||||||
|
|
||||||
if (oSession.PathAndQuery.Contains("/master.blurl")
|
if (oSession.PathAndQuery.Contains("/master.blurl")
|
||||||
|| oSession.PathAndQuery.Contains("/main.blurl"))
|
|| oSession.PathAndQuery.Contains("/main.blurl"))
|
||||||
oSession.fullUrl = BaseURL + "/song/download" + oSession.PathAndQuery;
|
oSession.fullUrl = BaseURL + "/song/download" + oSession.PathAndQuery;
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 264 KiB |
Loading…
Reference in New Issue
Block a user