Skip to content

Commit

Permalink
add access verb
Browse files Browse the repository at this point in the history
  • Loading branch information
InvoxiPlayGames committed Dec 12, 2023
1 parent 16450ca commit 93bc19d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
4 changes: 4 additions & 0 deletions EpicLogin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class EpicLogin
{
public const string LAUNCHER_CLIENT = "34a02cf8f4414e29b15921876da36f9a";
public const string LAUNCHER_SECRET = "daafbccc737745039dffe53d94fc76cf";

public const string FORTNITE_PC_CLIENT = "ec684b8c687f479fadea3cb2ad83f5c6";
public const string FORTNITE_PC_SECRET = "e1f31c211f28413186262d37a13fc84d";

public const string ACCOUNTS_API_BASE = "https://account-public-service-prod.ol.epicgames.com";

private const string TOKEN_API_URL = "/account/api/oauth/token";
Expand Down
4 changes: 1 addition & 3 deletions FortniteUpdateCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ public class FortniteCloudContent

class FortniteUpdateCheck
{
public const string FORTNITE_PC_CLIENT = "ec684b8c687f479fadea3cb2ad83f5c6";
public const string FORTNITE_PC_SECRET = "e1f31c211f28413186262d37a13fc84d";

public static async Task<bool> IsUpToDate(string fortnite_version, string platform)
{
EpicLogin epic = new EpicLogin(FORTNITE_PC_CLIENT, FORTNITE_PC_SECRET);
EpicLogin epic = new EpicLogin(EpicLogin.FORTNITE_PC_CLIENT, EpicLogin.FORTNITE_PC_SECRET);
string? client_credentials = await epic.GetClientCredentials();
HttpClient client = new();
client.DefaultRequestHeaders.Accept.Clear();
Expand Down
25 changes: 23 additions & 2 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ static async Task Main(string[] args)
// handle special exe names
bool exchange_code_only = false;
bool caldera_only = false;
bool access_token_only = false;
bool logout = false;
if (exe_name.StartsWith("exchange")) exchange_code_only = true;
if (exe_name.EndsWith("caldera")) caldera_only = true;
if (exe_name == "access") access_token_only = true;
if (exe_name == "logout") logout = true;
// all these options imply an online dry run with no manifest
if (exchange_code_only || caldera_only || logout)
if (exchange_code_only || caldera_only || access_token_only || logout)
{
no_manifest = true;
dry_run = true;
Expand Down Expand Up @@ -254,7 +256,12 @@ static async Task Main(string[] args)
EGLManifest? manifest = null;
if (!no_manifest && manifest_path == null)
{
manifest = GetEGLManifest(Path.GetFileName(exe_name));
// always use FortniteLauncher.exe manifest for FortniteGame
// so many edge cases im boutta bust
if (Path.GetFileName(exe_name).StartsWith("FortniteGame"))
manifest = GetEGLManifest("FortniteLauncher.exe");
else
manifest = GetEGLManifest(Path.GetFileName(exe_name));
} else if (!no_manifest && manifest_path != null)
{
string jsonstring = File.ReadAllText(manifest_path);
Expand All @@ -277,6 +284,20 @@ static async Task Main(string[] args)
if (!caldera_only) return;
}

if (access_token_only)
{
EpicLogin fnLogin = new(EpicLogin.FORTNITE_PC_CLIENT, EpicLogin.FORTNITE_PC_SECRET);
EpicAccount? fnAccount = await fnLogin.LoginWithExchangeCode(exchange);
if (fnAccount != null)
{
Console.WriteLine($"Access Token: {fnAccount.AccessToken}");
} else
{
Console.WriteLine("Failed to get access token.");
}
return;
}

// caldera simulation
if ((caldera && Path.GetFileName(exe_name).StartsWith("Fortnite")) || caldera_only)
{
Expand Down

0 comments on commit 93bc19d

Please sign in to comment.