-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2954c55
commit a5e110b
Showing
103 changed files
with
3,312 additions
and
27 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
File renamed without changes.
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,12 @@ | ||
program HaloTracker_API; | ||
|
||
{$APPTYPE CONSOLE} | ||
|
||
{$R *.res} | ||
|
||
uses | ||
browserconsole; | ||
|
||
begin | ||
// 🤘🏻🤘🏻🤘🏻 | ||
end. |
Large diffs are not rendered by default.
Oops, something went wrong.
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,141 @@ | ||
<?php | ||
header("access-control-allow-origin: *"); | ||
header("access-control-allow-methods: get, post, options"); | ||
header("access-control-allow-headers: content-type"); | ||
|
||
function apiGet($url) { | ||
$curl = curl_init(); | ||
|
||
// Set cURL options | ||
curl_setopt_array($curl, [ | ||
CURLOPT_URL => $url, | ||
CURLOPT_RETURNTRANSFER => true, | ||
CURLOPT_TIMEOUT => 30, | ||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | ||
CURLOPT_CUSTOMREQUEST => 'GET', | ||
CURLOPT_HTTPHEADER => ['cache-control: no-cache'], | ||
]); | ||
|
||
// Execute the cURL request | ||
$response = curl_exec($curl); | ||
$error = curl_error($curl); | ||
|
||
// Close the cURL session | ||
curl_close($curl); | ||
|
||
if ($error) { | ||
// Handle any errors here | ||
return [ | ||
"success" => false, | ||
"error" => $error | ||
]; | ||
} else { | ||
return [ | ||
"success" => true, | ||
"response" => $response | ||
]; | ||
} | ||
} | ||
|
||
$Platform_Param = $_GET['platform']; | ||
$SteamID_Param = $_GET['steamid']; | ||
$Game_Param = $_GET['game']; | ||
$GameID = ""; | ||
|
||
$Games = [ | ||
"halomcc" => [ | ||
"name" => "Halo: The Master Chief Collection", | ||
"id" => "976730" | ||
], | ||
"haloinfinite" => [ | ||
"name" => "Halo Infinite", | ||
"id" => "1240440" | ||
] | ||
]; | ||
|
||
$Platforms = [ | ||
"steam" | ||
]; | ||
|
||
$MyJSON = [ | ||
"success" => true | ||
]; | ||
|
||
$Platform_Found = False; | ||
foreach ($Platforms as $Platform) { | ||
if ((strtolower($Platform_Param) === $Platform) || ($Platform_Param == "")) { | ||
$Platform_Found = True; | ||
foreach ($Games as $key => $Game) { | ||
if ((strtolower($Game_Param) === $key) || ($Game_Param == "")) { | ||
$GameID = $Game["id"]; | ||
|
||
$url = "https://steamcommunity.com/id/$SteamID_Param/stats/$GameID/achievements/"; | ||
|
||
$response = apiGet($url); | ||
|
||
// echo $response["response"]; | ||
|
||
if ($response["success"] === false) { | ||
$MyJSON["success"] = false; | ||
$MyJSON["reason"] = "API Failed"; | ||
} else { | ||
$dom = new DOMDocument; | ||
libxml_use_internal_errors(true); | ||
$dom->loadHTML($response["response"]); | ||
libxml_clear_errors(); | ||
|
||
$ProfileFound = False; | ||
if (($MyJSON[$Platform]["profile"]["name"] === "") || ($MyJSON[$Platform]["profile"]["name"] === null)) { | ||
$profile_name = ""; | ||
$profile_picture = "assets/pfp.jpg"; | ||
$profile_name_text_content = $dom->getElementById("responsive_page_template_content")->getElementsByTagName("a"); | ||
// loop through all anchor elements and find the one that contains a class of persona_name_text_content | ||
foreach ($profile_name_text_content as $element) { | ||
$class = $element->getAttribute("class"); | ||
if (strpos($class, 'persona_name_text_content') !== false) { | ||
$profile_name = trim($element->textContent); | ||
$ProfileFound = True; | ||
} | ||
} | ||
$profile_picture_div = $dom->getElementById("responsive_page_template_content")->getElementsByTagName("div"); | ||
// loop through all divs and find the one that contains a class of playerAvatar | ||
foreach ($profile_picture_div as $element) { | ||
$class = $element->getAttribute("class"); | ||
if (strpos($class, "playerAvatar") !== false) { | ||
$profile_picture = $element->getElementsByTagName("img")[0]->getAttribute("src"); | ||
} | ||
} | ||
if ($ProfileFound === True) { | ||
$MyJSON[$Platform]["profile"] = [ | ||
"name" => $profile_name, | ||
"profile_picture" => $profile_picture, | ||
]; | ||
} | ||
} | ||
|
||
$achievements_earned = $dom->getElementById("topSummaryAchievements"); | ||
|
||
if ($achievements_earned) { | ||
$MyJSON[$Platform]["games"][] = [ | ||
"name" => $Game["name"], | ||
"achievements_earned" => str_replace(" achievements earned:", "", trim($achievements_earned->textContent)), | ||
"achievements" => [] | ||
]; | ||
} else { | ||
$MyJSON["success"] = false; | ||
$MyJSON["reason"] = "achievements_earned Not Found"; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
if ($Platform_Found === False) { | ||
$MyJSON["success"] = false; | ||
$MyJSON["reason"] = "Platform ($Platform_Param) not supported"; | ||
} | ||
|
||
echo json_encode($MyJSON); | ||
?> | ||
|
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,76 @@ | ||
# Uncomment these types if you want even more clean repository. But be careful. | ||
# It can make harm to an existing project source. Read explanations below. | ||
# | ||
# Resource files are binaries containing manifest, project icon and version info. | ||
# They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. | ||
#*.res | ||
# | ||
# Type library file (binary). In old Delphi versions it should be stored. | ||
# Since Delphi 2009 it is produced from .ridl file and can safely be ignored. | ||
#*.tlb | ||
# | ||
# Diagram Portfolio file. Used by the diagram editor up to Delphi 7. | ||
# Uncomment this if you are not using diagrams or use newer Delphi version. | ||
#*.ddp | ||
# | ||
# Visual LiveBindings file. Added in Delphi XE2. | ||
# Uncomment this if you are not using LiveBindings Designer. | ||
#*.vlb | ||
# | ||
# Deployment Manager configuration file for your project. Added in Delphi XE2. | ||
# Uncomment this if it is not mobile development and you do not use remote debug feature. | ||
#*.deployproj | ||
# | ||
# C++ object files produced when C/C++ Output file generation is configured. | ||
# Uncomment this if you are not using external objects (zlib library for example). | ||
#*.obj | ||
# | ||
|
||
# Delphi compiler-generated binaries (safe to delete) | ||
*.exe | ||
*.dll | ||
*.bpl | ||
*.bpi | ||
*.dcp | ||
*.so | ||
*.apk | ||
*.drc | ||
*.map | ||
*.dres | ||
*.rsm | ||
*.tds | ||
*.dcu | ||
*.lib | ||
*.a | ||
*.o | ||
*.ocx | ||
|
||
# Delphi autogenerated files (duplicated info) | ||
*.cfg | ||
*.hpp | ||
*Resource.rc | ||
|
||
# Delphi local files (user-specific info) | ||
*.local | ||
*.identcache | ||
*.projdata | ||
*.tvsconfig | ||
*.dsk | ||
|
||
# Delphi history and backups | ||
__history/ | ||
__recovery/ | ||
*.~* | ||
|
||
# Castalia statistics file (since XE7 Castalia is distributed with Delphi) | ||
*.stat | ||
|
||
# Boss dependency manager vendor folder https://github.com/HashLoad/boss | ||
modules/ | ||
|
||
# Compiled Binary Folders | ||
Android64/ | ||
Linux64/ | ||
Win32/ | ||
Win64/ | ||
TMSWEB/DEBUG/ |
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,14 @@ | ||
program HaloTracker_App; | ||
|
||
uses | ||
System.StartUpCopy, | ||
FMX.Forms, | ||
uIndex in 'uIndex.pas' {frmMain}; | ||
|
||
{$R *.res} | ||
|
||
begin | ||
Application.Initialize; | ||
Application.CreateForm(TfrmMain, frmMain); | ||
Application.Run; | ||
end. |
Oops, something went wrong.