Compare commits

...

1 Commits
gui ... master

Author SHA1 Message Date
McMistrzYT
8a9b6e1e31 current stuff 2024-01-22 23:03:20 +01:00
3 changed files with 21 additions and 6 deletions

View File

@ -9,10 +9,17 @@ namespace Partypacker.Core
{ {
internal class Server internal class Server
{ {
static string BaseURL =
#if DEBUG
"http://localhost:6677";
#else
"https://api.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 +45,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";

View File

@ -1,4 +1,5 @@
using Partypacker.Net; using Partypacker.Core;
using Partypacker.Net;
using Pastel; using Pastel;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
@ -15,6 +16,8 @@ namespace Partypacker
{ {
ushort? port = 6969; ushort? port = 6969;
var DiscordLoginLink = Server.GET("/api/discord/url");
Console.SetWindowSize(75, 20); Console.SetWindowSize(75, 20);
Console.CursorVisible = false; Console.CursorVisible = false;
@ -39,7 +42,8 @@ namespace Partypacker
{ {
new SelectableOption("Launch Fortnite", () => new SelectableOption("Launch Fortnite", () =>
Run(port, () => Process.Start(new ProcessStartInfo { FileName = "com.epicgames.launcher://apps/fn%3A4fe75bbc5a674f4f9b356b5c90567da5%3AFortnite?action=launch&silent=true", UseShellExecute = true }))), 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 })) new SelectableOption("Open Dashboard", () => Process.Start(new ProcessStartInfo { FileName = "https://partypack.mcthe.dev", UseShellExecute = true })),
new SelectableOption("Log in using Discord", () => Process.Start(new ProcessStartInfo { FileName = DiscordLoginLink.Value, UseShellExecute = true }))
}; };
try try
@ -93,6 +97,8 @@ namespace Partypacker
_ => new Proxy((ushort)port) _ => new Proxy((ushort)port)
}; };
Proxx.StartProxy(); Proxx.StartProxy();
// please make this dynamic later :D
Proxx.Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJRCI6IjQ1NDk2ODU0MjcyMzU3MTcxNSIsImlhdCI6MTcwNTkyODQ0M30.ogINqFZ_3DBkECbHo87HjW9c6p2imT1CnCvfIR3iGJ4";
Finish.Invoke(); Finish.Invoke();
} }

View File

@ -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;
@ -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;