This commit is contained in:
2026-01-05 14:34:34 +02:00
parent f886350eb1
commit 2b91057589
8 changed files with 111 additions and 61 deletions

View File

@@ -1 +1,75 @@
#include "appleauth/iauth.h"
#include "tier2/fileformats/xml.h"
#include "http/http.h"
IHTTPClientManager *g_pHttpClientMgr = NULL;
class CAppleAuth: public IAppleAuth
{
public:
virtual void Init() override;
virtual void Shutdown() override;
virtual EAppleAuthStatus SubmitLoginData( const char *szEmail, const char *szPassword ) override;
virtual EAppleAuthStatus Submit2FA( const char *szCode ) override;
IHTTPClient *m_pANIClient;
IHTTPClient *m_pGrandSlamClient;
CUtlString m_szProvisionStart = "/";
CUtlString m_szProvisionFinish = "/";
};
void CAppleAuth::Init()
{
CreateInterfaceFn fnHttpFactory = Sys_GetFactory("funnyhttp");
g_pHttpClientMgr = (IHTTPClientManager*)fnHttpFactory(HTTP_CLIENT_INTERFACE_VERSION, NULL);
m_pANIClient = g_pHttpClientMgr->Connect("ani.sidestore.io", true, NULL);
m_pGrandSlamClient = g_pHttpClientMgr->Connect("gsa.apple.com", true, NULL);
{
HTTPHeaderParam_t params[] = {
{"X-Apple-I-Client-Time", "2026-1-1T12:00:00"},
{"X-Apple-Locale", "en_US"},
{"X-Apple-I-TimeZone", "Europe/Kyiv"},
{"X-Mme-Client-Info", "<MacBookPro13,2> <macOS;13.1;22C65> <com.apple.AuthKit/1 (com.apple.dt.Xcode/3594.4.19)>"},
{"User-Agent", "akd/1.0 CFNetwork/808.1.4"},
{"X-Apple-I-MD-LU", "user"},
{"X-Apple-I-MD-M", "0"},
{"X-Apple-I-SRL-NO", "0"},
{"X-Mme-Device-Id", "0"},
{"Content-Type", "text/x-xml-plist"},
{"Accept", "*/*"},
};
HTTPHeader_t header = {
sizeof(params)/sizeof(HTTPHeaderParam_t),
params,
};
m_pGrandSlamClient->Get("/grandslam/GsService2/lookup", &header);
HTTPResponse_t r = m_pGrandSlamClient->GetResponse();
if (r.m_uCode == 200)
{
V_printf("%s\n",r.m_message.GetMemory());
}
}
}
void CAppleAuth::Shutdown()
{
}
EAppleAuthStatus CAppleAuth::SubmitLoginData( const char *szEmail, const char *szPassword )
{
}
EAppleAuthStatus CAppleAuth::Submit2FA( const char *szCode )
{
}
static CAppleAuth s_appleAuth;
EXPOSE_INTERFACE_GLOBALVAR(CAppleAuth, IAppleAuth, APPLE_AUTH_INTERFACE_VERSION, s_appleAuth);

View File

@@ -32,43 +32,3 @@ DECLARE_BUILD_STAGE(appleauth)
return 0;
};
DECLARE_BUILD_STAGE(appleauth_test)
{
CProject_t compileProject = {};
LinkProject_t ldProject = {};
filesystem2->MakeDirectory("build");
filesystem2->CopyFile("build",GET_PROJECT_LIBRARY(funnyhttp, "funnyhttp"));
filesystem2->CopyFile("build",GET_PROJECT_LIBRARY(appleauth, "appleauth"));
filesystem2->CopyFile("build",GET_PROJECT_LIBRARY(tier0, "tier0"));
compileProject.m_szName = "appleauth";
compileProject.files = {
"test.cpp"
};
compileProject.includeDirectories = {"../public"};
compileProject.bFPIC = true;
ldProject = ccompiler->Compile(&compileProject);
ldProject.libraryObjects = {
GET_PROJECT_LIBRARY(tier1, "tier1"),
GET_PROJECT_LIBRARY(tier2, "tier2"),
};
ldProject.libraries = {
"tier0",
};
ldProject.libraryDirectories = {
"build",
};
ldProject.linkType = ELINK_EXECUTABLE;
CUtlString szOutputDir = linker->Link(&ldProject);
filesystem2->CopyFile("build",szOutputDir);
CUtlVector<CUtlString> args = {};
runner->Run("build/appleauth", args);
runner->Wait();
return 0;
};

View File