forked from rileytestut/AltServer-Windows
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathAltServerApp.h
More file actions
executable file
·147 lines (110 loc) · 5.4 KB
/
AltServerApp.h
File metadata and controls
executable file
·147 lines (110 loc) · 5.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
//
// AltServerApp.hpp
// AltServer-Windows
//
// Created by Riley Testut on 8/30/19.
// Copyright (c) 2019 Riley Testut. All rights reserved.
//
#pragma once
#include <string>
#include "Account.hpp"
#include "AppID.hpp"
#include "Application.hpp"
#include "Certificate.hpp"
#include "Device.hpp"
#include "ProvisioningProfile.hpp"
#include "Team.hpp"
#include "AppleAPISession.h"
#include "AnisetteDataManager.h"
#include "DeveloperDiskManager.h"
#include "Semaphore.h"
#include "InstalledApp.h"
#include <pplx/pplxtasks.h>
#ifdef _WIN32
#include <filesystem>
#undef _WINSOCKAPI_
#define _WINSOCKAPI_ /* prevents <winsock.h> inclusion by <windows.h> */
#include <windows.h>
namespace fs = std::filesystem;
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
class AltServerApp
{
public:
static AltServerApp *instance();
void Start(HWND windowHandle, HINSTANCE instanceHandle);
void Stop();
void CheckForUpdates();
pplx::task<std::shared_ptr<Application>> InstallApplication(std::optional<std::string> filepath, std::shared_ptr<Device> device, std::string appleID, std::string password);
pplx::task<void> PrepareDevice(std::shared_ptr<Device> device);
pplx::task<void> EnableJIT(InstalledApp app, std::shared_ptr<Device> device);
void ShowNotification(std::string title, std::string message);
void ShowAlert(std::string title, std::string message);
void ShowErrorAlert(std::exception& exception, std::string localizedTitle);
HWND windowHandle() const;
HINSTANCE instanceHandle() const;
Error* helpError() const;
bool automaticallyLaunchAtLogin() const;
void setAutomaticallyLaunchAtLogin(bool launch);
std::string serverID() const;
void setServerID(std::string serverID);
bool reprovisionedDevice() const;
void setReprovisionedDevice(bool reprovisionedDevice);
std::string appleFolderPath() const;
std::string internetServicesFolderPath() const;
std::string applicationSupportFolderPath() const;
fs::path appDataDirectoryPath() const;
fs::path certificatesDirectoryPath() const;
fs::path developerDisksDirectoryPath() const;
bool boolValueForRegistryKey(std::string key) const;
void setBoolValueForRegistryKey(bool value, std::string key);
private:
AltServerApp();
~AltServerApp();
static AltServerApp *_instance;
pplx::task<std::shared_ptr<Application>> _InstallApplication(std::optional<std::string> filepath, std::shared_ptr<Device> installDevice, std::string appleID, std::string password);
bool CheckDependencies();
bool CheckiCloudDependencies();
std::string BrowseForFolder(std::wstring title, std::string folderPath);
bool _presentedNotification;
GUID _notificationIconGUID;
HWND _windowHandle;
HINSTANCE _instanceHandle;
Semaphore _appGroupSemaphore;
Error* _helpError;
DeveloperDiskManager _developerDiskManager;
bool presentedRunningNotification() const;
void setPresentedRunningNotification(bool presentedRunningNotification);
void setAppleFolderPath(std::string appleFolderPath);
std::string defaultAppleFolderPath() const;
void HandleAnisetteError(AnisetteError& error);
pplx::task<fs::path> DownloadApp(std::shared_ptr<Device> device);
pplx::task<std::string> FetchAltStoreDownloadURL(std::shared_ptr<Device> device);
void ShowInstallationNotification(std::string appName, std::string deviceName);
pplx::task<std::pair<std::shared_ptr<Account>, std::shared_ptr<AppleAPISession>>> Authenticate(std::string appleID, std::string password, std::shared_ptr<AnisetteData> anisetteData);
pplx::task<std::shared_ptr<Team>> FetchTeam(std::shared_ptr<Account> account, std::shared_ptr<AppleAPISession> session);
pplx::task<std::shared_ptr<Certificate>> FetchCertificate(std::shared_ptr<Team> team, std::shared_ptr<AppleAPISession> session);
pplx::task<std::map<std::string, std::shared_ptr<ProvisioningProfile>>> PrepareAllProvisioningProfiles(
std::shared_ptr<Application> application,
std::shared_ptr<Device> device,
std::shared_ptr<Team> team,
std::shared_ptr<AppleAPISession> session);
pplx::task<std::shared_ptr<ProvisioningProfile>> PrepareProvisioningProfile(
std::shared_ptr<Application> application,
std::optional<std::shared_ptr<Application>> parentApp,
std::shared_ptr<Device> device,
std::shared_ptr<Team> team,
std::shared_ptr<AppleAPISession> session);
pplx::task<std::shared_ptr<AppID>> RegisterAppID(std::string appName, std::string identifier, std::shared_ptr<Team> team, std::shared_ptr<AppleAPISession> session);
pplx::task<std::shared_ptr<AppID>> UpdateAppIDFeatures(std::shared_ptr<AppID> appID, std::shared_ptr<Application> app, std::shared_ptr<Team> team, std::shared_ptr<AppleAPISession> session);
pplx::task<std::shared_ptr<AppID>> UpdateAppIDAppGroups(std::shared_ptr<AppID> appID, std::shared_ptr<Application> app, std::shared_ptr<Team> team, std::shared_ptr<AppleAPISession> session);
pplx::task<std::shared_ptr<Device>> RegisterDevice(std::shared_ptr<Device> device, std::shared_ptr<Team> team, std::shared_ptr<AppleAPISession> session);
pplx::task<std::shared_ptr<ProvisioningProfile>> FetchProvisioningProfile(std::shared_ptr<AppID> appID, std::shared_ptr<Device> device, std::shared_ptr<Team> team, std::shared_ptr<AppleAPISession> session);
pplx::task<std::shared_ptr<Application>> InstallApp(std::shared_ptr<Application> app,
std::shared_ptr<Device> device,
std::shared_ptr<Team> team,
std::shared_ptr<Certificate> certificate,
std::map<std::string, std::shared_ptr<ProvisioningProfile>> profiles);
};