-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: generate exchange code with launcherAppClient2 (#2)
- Loading branch information
Showing
7 changed files
with
187 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { readdirSync, readFileSync } from 'node:fs' | ||
import path from 'node:path' | ||
|
||
export class Manifest { | ||
static get() { | ||
try { | ||
const manifestsDirectory = | ||
'C:\\ProgramData\\Epic\\EpicGamesLauncher\\Data\\Manifests' | ||
|
||
const getFile = (filename: string) => { | ||
const filePath = path.join(manifestsDirectory, filename) | ||
const file = JSON.parse(readFileSync(filePath).toString()) as { | ||
AppVersionString: string | ||
LaunchCommand: string | ||
DisplayName: string | ||
} | ||
const appVersionString = file.AppVersionString?.trim() | ||
|
||
return { | ||
AppVersionString: appVersionString ?? '', | ||
DisplayName: file.DisplayName?.trim().toLowerCase() ?? '', | ||
LaunchCommand: file.LaunchCommand?.trim() ?? '', | ||
UserAgent: appVersionString | ||
? `Fortnite/${appVersionString}` | ||
: '', | ||
} | ||
} | ||
|
||
const responseItem = readdirSync(manifestsDirectory).find( | ||
(filename) => { | ||
if (filename.endsWith('item')) { | ||
return getFile(filename).DisplayName === 'fortnite' | ||
} | ||
|
||
return false | ||
} | ||
) | ||
|
||
if (responseItem) { | ||
const manifestItem = getFile(responseItem) | ||
|
||
return manifestItem | ||
} | ||
} catch (error) { | ||
// | ||
} | ||
|
||
return null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters