-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdevice.php
273 lines (253 loc) · 13 KB
/
device.php
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<?php
error_reporting(E_ALL & ~E_NOTICE);
include_once('./config/constants.php');
include_once('utils.php');
if (
isset($_POST['device']) &&
isset($_POST['deviceVariant']) &&
isset($_POST['deviceVersion']) &&
isset($_POST['supportedVersions']) &&
isset($_POST['supportedVariants'])
) {
$device = $_POST['device'];
$deviceVariant = $_POST['deviceVariant'];
$deviceVersion = $_POST['deviceVersion'];
$supportedVersions = json_decode($_POST['supportedVersions']);
$supportedVariants = json_decode($_POST['supportedVariants']);
do {
// Fallback legacy api call for arrow-9.x
if ($deviceVersion == "arrow-9.x") {
$vanilla_device_info = fetch_api_data(
str_replace(
array('{device}', '{variant}', '{version}', '{zipvariant}'),
array($device, $deviceVariant, $deviceVersion, 'pie'),
$API_URL_CALLS['device_info']
)
);
break;
}
$vanilla_device_info = fetch_api_data(
str_replace(
array('{device}', '{variant}', '{version}', '{zipvariant}'),
array($device, $deviceVariant, $deviceVersion, 'vanilla'),
$API_URL_CALLS['device_info']
)
);
$gapps_device_info = fetch_api_data(
str_replace(
array('{device}', '{variant}', '{version}', '{zipvariant}'),
array($device, $deviceVariant, $deviceVersion, 'gapps'),
$API_URL_CALLS['device_info']
)
);
break;
} while (0);
if ($vanilla_device_info['code'] == "200" || $gapps_device_info['code'] == "200") {
$vanilla_device_info = json_decode($vanilla_device_info['data'], true);
$gapps_device_info = json_decode($gapps_device_info['data'], true);
$vanilla_device_info = $vanilla_device_info['response'][0];
$gapps_device_info = $gapps_device_info['response'][0];
if (!isset($vanilla_device_info) && !isset($gapps_device_info)) http_response_code(404);
if (isset($vanilla_device_info))
$initial_device_info = $vanilla_device_info;
elseif (isset($gapps_device_info))
$initial_device_info = $gapps_device_info;
} else {
http_response_code(404);
}
} else {
exit("Something went wrong!");
}
?>
<div style="padding-top: 50px;" class="container">
<div class="row">
<div class="row">
<h4 class="primary-color" style="padding-bottom: 20px;"><?php echo ucwords(strtolower($initial_device_info['model']));
if (!$initial_device_info['status']) echo " [DISCONTINUED]"; ?></h4>
</div>
<div style="padding-left: 15px;" class="row">
<div class="card card-theme-color darken-1 col s12 m12 l10 ">
<div class="card-content white-text">
<h5 id="device-codename" name="<?php echo $device ?>">Codename:</h5> <?php echo ucfirst($device) ?>
<h5>Maintained by:</h5> <?php echo ucfirst($initial_device_info['maintainer']) ?>
</div>
</div>
</div>
<div style="padding-left: 15px;" class="row">
<div class="col s12 m12 l10 ">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="fluid" data-ad-layout-key="-gw-3+1f-3d+2z" data-ad-client="ca-pub-5568741006164863" data-ad-slot="9060655737"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
</div>
</div>
<div style="margin-bottom: 25px;margin-top: 25px; background-color: #424242;" class="divider"></div>
<div class="container">
<div class="row">
<div class="row">
<h4 id="downloads-section" class="primary-color" style="padding-bottom: 20px;">Downloads</h4>
<div class="input-field col s12 m4 l4">
<select id="version-selector" selected="selected">
<?php foreach ($VERSIONS as $version) { ?>
<option value="<?php echo strtolower($version); ?>" <?php if (!in_array(strtolower($version), $supportedVersions)) {
echo "disabled";
} ?>><?php echo ucfirst($version); ?></option>
<?php } ?>
</select>
<label>Select version</label>
</div>
<div class="input-field col s12 m4 l4">
<select id="variant-selector" selected="selected">
<?php foreach ($VARIANTS as $variant) { ?>
<option value="<?php echo strtolower($variant) ?>" <?php if ($variant == "community_experiments" && in_array("community", $supportedVariants)) echo "";
elseif (!in_array(strtolower($variant), $supportedVariants)) {
echo "disabled";
} ?>><?php echo ($variant == "community_experiments") ? ucfirst(str_replace('_', ' ', $variant)) : ucfirst($variant) ?></option>
<?php } ?>
</select>
<label>Select Build</label>
</div>
</div>
<?php if (isset($vanilla_device_info)) { ?>
<div class="col s12 m6 l6">
<div class="card card-theme-color darken-1">
<div class="card-content white-text">
<span class="card-title"><b>VANILLA</b> build</span>
<p><b>Size:</b> <?php echo number_format((float)$vanilla_device_info['size'] / 1000000, 2, '.', '') ?> MB</p>
<p><b>Type:</b> <?php echo ucfirst($vanilla_device_info['type']) ?></p>
<p id="vanilla-version"><b>Version:</b> <?php echo $vanilla_device_info['version'] ?></p>
<p><b>Date:</b> <?php echo $vanilla_device_info['date'] ?></p>
<p id="vanilla-datetime" name="<?php echo $vanilla_device_info['datetime'] ?>"></p>
<p id="vanilla-filename" name="<?php echo $vanilla_device_info['filename'] ?>"></p>
</div>
<div style="border-radius: 10px;" class="card-action center">
<ul>
<li>
<a class="btn-flat">
<div id="fetch-mirrors" name="vanilla" class="card-theme-color center">
<i class="material-icons">file_download</i>
DOWNLOAD
</div>
</a>
</li>
<li>
<div id="vanilla-fetch-progress" class="center"></div>
</li>
</ul>
</div>
</div>
</div>
<?php } ?>
<?php if (isset($gapps_device_info)) { ?>
<div class="col s12 m6 l6">
<div class="card card-theme-color">
<div class="card-content white-text">
<span class="card-title"><b>GAPPS</b> build</span>
<p><b>Size:</b> <?php echo number_format((float)$gapps_device_info['size'] / 1000000, 2, '.', '') ?> MB</p>
<p><b>Type:</b> <?php echo ucfirst($gapps_device_info['type']) ?></p>
<p id="gapps-version"><b>Version:</b> <?php echo $gapps_device_info['version'] ?></p>
<p><b>Date:</b> <?php echo $gapps_device_info['date'] ?></p>
<p id="gapps-datetime" name="<?php echo $gapps_device_info['datetime'] ?>"></p>
<p id="gapps-filename" name="<?php echo $gapps_device_info['filename'] ?>"></p>
</div>
<div style="border-radius: 10px;" class="card-action center">
<ul>
<li>
<a class="btn-flat">
<div id="fetch-mirrors" name="gapps" class="card-theme-color center">
<i class="material-icons">file_download</i>
DOWNLOAD
</div>
</a>
</li>
<li>
<div id="gapps-fetch-progress" class="center"></div>
</li>
</ul>
</div>
</div>
</div>
<?php } ?>
</div>
<div class="center">
<a id="downloads-archive" class="btn-small card card-theme-color waves-effect grey darken-4 waves-light">
<i class="material-icons left">archive</i>archive
</a>
<div id="archive-fetch-progress" class="center"></div>
</div>
<br>
</div>
<div style="margin-bottom: 25px;margin-top: 25px; background-color: #424242;" class="divider"></div>
<div class="container">
<div class="row" style="overflow-x:auto;">
<h4 class="primary-color" style="padding-bottom: 20px;">Integrity check</h4>
<strong>The sha256 of the following build types are:</strong>
<table class="highlight responsive-table">
<?php if (isset($vanilla_device_info)) { ?>
<tbody>
<tr>
<td><b>VANILLA:</b></td>
<td id="vanilla-file_sha256"><?php echo $vanilla_device_info['sha256'] ?></td>
</tr>
</tbody>
<?php } ?>
<?php if (isset($gapps_device_info)) { ?>
<tbody>
<tr>
<td><b>GAPPS:</b></td>
<td id="gapps-file_sha256"><?php echo $gapps_device_info['sha256'] ?></td>
</tr>
</tbody>
<?php } ?>
</table>
</div>
<a href="https://blog.arrowos.net/posts/checking-build-integrity" target="_blank">Check our blog post for detailed info.</a>
<div style="padding-left: 15px;" class="row">
<div class="col s12 m12 l10 ">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="fluid" data-ad-layout-key="-gw-3+1f-3d+2z" data-ad-client="ca-pub-5568741006164863" data-ad-slot="9060655737"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
</div>
<div style="margin-bottom: 25px;margin-top: 25px; background-color: #424242;" class="divider"></div>
<div class="container">
<div class="row">
<h4 class="primary-color" style="padding-bottom: 20px;">Changelogs</h4>
<div class="col s12 m12 l10">
<div class="card card-theme-color darken-1">
<div class="card-content white-text">
<span class="card-title">Device side changes</span>
<p>
<?php
echo nl2br(stripcslashes($initial_device_info['changelog']));
?>
</p>
</div>
</div>
<a id="source-changelog" class="btn-large card card-theme-color waves-effect grey darken-4 waves-light" href="/changelog.php"><i class="material-icons left">reorder</i>source changelog</a>
</div>
</div>
</div>
<div class="container">
<div class="row">
<h4 class="primary-color" style="padding-bottom: 20px;">Ads</h4>
<div class="col s12 m6 l10">
<div class="card card-theme-color z-depth-3 radius">
<div class="center card-content">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle" style="display:block; text-align:center;" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-5568741006164863" data-ad-slot="7462336018"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
</div>
</div>
</div>
<script src="/js/device.js"></script>