-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathversion.php
76 lines (70 loc) · 1.8 KB
/
version.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
<?php
/*
* @Author: hujiayucc
* @Date: 2023-03-29 00:29:07
* @Description: Fuck AD应用更新以及热更新后端接口
*/
/**
* Nginx 伪静态规则
*
* location / {
* index version.php;
* if (!-e $request_filename) {
* rewrite ^/(.*)$ /version.php last;
* }
* }
*/
// 禁用缓存
header("Pragma:no-cache");
// 软件版本
$versionCode = 2222;
// Dex版本 用于版本校验
$hotFixVersion = 2023;
// 热更新版本名
$hotFixName = "1.2.3.1";
// APK下载地址
$url = "https://hujiayucc.lanzoum.com/i0yGF0s84pvc";
// Dex文件名
$dexName = "classes.zip";
// 获取Dex文件数据
$dex = file_get_contents($dexName);
// 更新日志
$updateLog = file_get_contents("Update Log.txt");
$array = [
"versionCode" => $versionCode,
"url" => $url,
"hotFixVersion" => $hotFixVersion,
"hotFixName" => $hotFixName,
"dexMd5" => md5($dex),
"dexUrl" => getScheme() . $_SERVER['HTTP_HOST'] . "/" . $dexName,
"updateLog" => $updateLog
];
printStrToJson($array);
/**
* 输出字符串数组为JSON
* @param array $jsonStr 字符串数组
* @return void
* @author hujiayucc
* @link https://github.com/Xposed-Modules-Repo/com.hujiayucc.hook
*/
function printStrToJson(array $jsonStr)
{
$json = json_encode($jsonStr, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
// JSON Mine Type
header('content-type:application/json;charset=utf8');
echo ($json);
}
/**
* 获取当前访问协议
* @return string Scheme
*/
function getScheme(): string
{
if (isset($_SERVER['HTTP_X_CLIENT_SCHEME'])) {
return ($_SERVER['HTTP_X_CLIENT_SCHEME'] . '://');
} elseif (isset($_SERVER['REQUEST_SCHEME'])) {
return ($_SERVER['REQUEST_SCHEME'] . '://');
} else {
return 'http://';
}
}