update:github的反代

This commit is contained in:
Akatsuki-Misaki 2025-05-04 18:03:28 +08:00
parent 0dfa2b995d
commit e93fe95524
5 changed files with 90 additions and 170 deletions

View File

@ -4,8 +4,8 @@ header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type, Authorization');
// 获取ip
$ip_address = $_SERVER['X-Real-IP'];
// 从设备获取ip
$ip_address = $_SERVER['REMOTE_ADDR'];
// 将获取到的IP进行地址查询 小小API

View File

@ -1,5 +1,48 @@
<?php
//允许跨域
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type, Authorization');
// 获取用户 IP 地址
$ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
// 可能会获取到多个ip仅此使用最前面的IP
$ip_address = explode(',', $ip_address)[0];
$info_ip = file_get_contents("https://v2.xxapi.cn/api/ip?ip=".$ip_address);
// 获取网络json的data中的address
$info_ip = json_decode($info_ip, true);
$info_ip_address = $info_ip['data']['address'];
$info_ip_isp = $info_ip['data']['isp'];
$format = $_GET['format'];
if($format === 'json'){
if($ip_address !== ''){
header('Content-Type: application/json');
http_response_code(200);
$data = array(
'ip' => $ip_address,
'address' => $info_ip_address,
'isp' => $info_ip_isp
);
echo json_encode($data);
exit();
}else{
header('Content-Type: application/json');
http_response_code(403);
$data = array(
'info' => '获取失败'
);
echo json_encode($data);
exit();
}
}else if($format === 'text'){
echo $ip_address;
exit();
}
// 获取文件名
$file = $_SERVER['REQUEST_URI'];
// 获取文件类型
@ -7,7 +50,7 @@ $file_info = pathinfo($file);
// 获取文件后缀名
$file_ext = $file_info['extension'];
// 定义允许的后缀
$allow_ext = array('js', 'css', 'png', 'jpg', 'jpeg', 'gif', 'ico', 'json', 'txt', 'moc', 'moc3', 'svg', 'webp' , 'hosts', 'ttf', 'woff', 'woff2', 'eot', 'sgmodule');
$allow_ext = array('js', 'css', 'png', 'jpg', 'jpeg', 'gif', 'ico', 'json', 'txt', 'moc', 'moc3', 'svg', 'webp' , 'hosts', 'ttf', 'woff', 'woff2', 'eot', 'sgmodule', 'apk', 'zip', 'exe');
if($_SERVER['REQUEST_URI'] == '/'){
// 输出首页
header('content-type: text/html;charset=utf-8');
@ -21,7 +64,7 @@ if($_SERVER['REQUEST_URI'] == '/help'){
'title'=> 'Welcome to use OvOfish Studio API',
'message' => '这是一个反代接口,如有需要请联系管理员。',
'How_to_use' => '您只需将原有的域名更改为本站域名如需要使用jsdelivr的反代请添加/jsd如需要raw.githubusercontent.com则添加/gh',
'support_list' => '支持的接口:'.implode(',', array('/gh', '/jsd', '/unpkg')),
'support_list' => '支持的接口:'.implode(',', array('/gh', '/jsd', '/unpkg' ,'/releases')),
'file_ext_list' => '允许的后缀列表:'.implode(',', $allow_ext)
));
exit();
@ -75,6 +118,9 @@ if (strpos($_SERVER['REQUEST_URI'], '/gh') === 0) {
}elseif (strpos($_SERVER['REQUEST_URI'], '/unpkg') === 0) {
$target_host = "https://unpkg.com";
$new_request_uri = substr($_SERVER['REQUEST_URI'], 6);
}elseif (strpos($_SERVER['REQUEST_URI'], '/releases') === 0) {
$target_host = "https://github.com";
$new_request_uri = substr($_SERVER['REQUEST_URI'], 9);
} else {
header('content-type: application/json;charset=utf-8');
// 返回404状态
@ -176,7 +222,10 @@ function get_mimetype($extension) {
'moc' => 'text/plain',
'moc3' => 'text/plain',
'svg' => 'image/svg+xml',
'webp' => 'image/webp'
'webp' => 'image/webp',
'zip' => 'application/zip',
'exe' => 'application/octet-stream',
'apk' => 'application/vnd.android.package-archive'
);
return isset($ct[strtolower($extension)]) ? $ct[strtolower($extension)] : 'text/plain';
}
@ -200,4 +249,7 @@ function array_to_str($array)
}
// 输出网页内容
echo $homepage;
?>

View File

@ -222,7 +222,7 @@
<li class="nav-item dropdown"></li>
</ul><!-- /.navbar-nav -->
<div class="offcanvas-footer d-lg-none">
<div><a href="mailto:mirai@lolicon.team" class="link-inverse">mirai@lolicon.team</a><br />
<div><a href="mailto:i@ovofish.com" class="link-inverse">i@ovofish.com</a><br />
QQ:1709964150<br />
</div>
</div><!-- /.offcanvas-footer -->
@ -357,7 +357,7 @@
<div class="widget">
<h4 class="widget-title text-white mb-3">联系我们</h4>
<address class="pe-xl-15 pe-xxl-17">中国·广东·肇庆</address><a
href="mailto:mirai@lolicon.team">mirai@lolicon.team</a><br />
href="mailto:i@ovofish.com">i@ovofish.com</a><br />
</div><!-- /.widget -->
</div><!-- /column -->
<div class="col-md-4 col-lg-3">
@ -371,8 +371,8 @@
<div class="col-md-12 col-lg-3">
<div class="widget">
<h4 class="widget-title text-white mb-3">电子邮件</h4>
<p class="mb-5">您可以发送邮件到:<a href="mail:mirai@lolicon.team"
class="hover">mirai@lolicon.team</a>联系我们!</p><!-- /.newsletter-wrapper -->
<p class="mb-5">您可以发送邮件到:<a href="mail:i@ovofish.com"
class="hover">i@ovofish.com</a>联系我们!</p><!-- /.newsletter-wrapper -->
</div><!-- /.widget -->
</div><!-- /column -->
</div><!--/.row -->

19
PHP/jsd加速/web.config Normal file
View File

@ -0,0 +1,19 @@
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite to index.php" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<!-- 检查请求路径不是实际文件 -->
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<!-- 检查请求路径不是实际目录 -->
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<!-- 重写到index.php并保留原始查询参数 -->
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

171
ip.txt
View File

@ -1,161 +1,10 @@
10.10.50.90
10.10.50.91
10.10.50.92
10.10.50.93
10.10.50.94
10.10.50.95
10.10.50.96
10.10.50.97
10.10.50.98
10.10.50.99
10.10.50.100
10.10.50.101
10.10.50.102
10.10.50.103
10.10.50.104
10.10.50.105
10.10.50.106
10.10.50.107
10.10.50.108
10.10.50.109
10.10.50.110
10.10.50.111
10.10.50.112
10.10.50.113
10.10.50.114
10.10.50.115
10.10.50.116
10.10.50.117
10.10.50.118
10.10.50.119
10.10.50.120
10.10.50.121
10.10.50.122
10.10.50.123
10.10.50.124
10.10.50.125
10.10.50.126
10.10.50.127
10.10.50.128
10.10.50.129
10.10.50.130
10.10.50.131
10.10.50.132
10.10.50.133
10.10.50.134
10.10.50.135
10.10.50.136
10.10.50.137
10.10.50.138
10.10.50.139
10.10.50.140
10.10.50.141
10.10.50.142
10.10.50.143
10.10.50.144
10.10.50.145
10.10.50.146
10.10.50.147
10.10.50.148
10.10.50.149
10.10.50.150
10.10.50.151
10.10.50.152
10.10.50.153
10.10.50.154
10.10.50.155
10.10.50.156
10.10.50.157
10.10.50.158
10.10.50.159
10.10.50.160
10.10.50.161
10.10.50.162
10.10.50.163
10.10.50.164
10.10.50.165
10.10.50.166
10.10.50.167
10.10.50.168
10.10.50.169
10.10.50.170
10.10.50.171
10.10.50.172
10.10.50.173
10.10.50.174
10.10.50.175
10.10.50.176
10.10.50.177
10.10.50.178
10.10.50.179
10.10.50.180
10.10.50.181
10.10.50.182
10.10.50.183
10.10.50.184
10.10.50.185
10.10.50.186
10.10.50.187
10.10.50.188
10.10.50.189
10.10.50.190
10.10.50.191
10.10.50.192
10.10.50.193
10.10.50.194
10.10.50.195
10.10.50.196
10.10.50.197
10.10.50.198
10.10.50.199
10.10.50.200
10.10.50.201
10.10.50.202
10.10.50.203
10.10.50.204
10.10.50.205
10.10.50.206
10.10.50.207
10.10.50.208
10.10.50.209
10.10.50.210
10.10.50.211
10.10.50.212
10.10.50.213
10.10.50.214
10.10.50.215
10.10.50.216
10.10.50.217
10.10.50.218
10.10.50.219
10.10.50.220
10.10.50.221
10.10.50.222
10.10.50.223
10.10.50.224
10.10.50.225
10.10.50.226
10.10.50.227
10.10.50.228
10.10.50.229
10.10.50.230
10.10.50.231
10.10.50.232
10.10.50.233
10.10.50.234
10.10.50.235
10.10.50.236
10.10.50.237
10.10.50.238
10.10.50.239
10.10.50.240
10.10.50.241
10.10.50.242
10.10.50.243
10.10.50.244
10.10.50.245
10.10.50.246
10.10.50.247
10.10.50.248
10.10.50.249
10.10.50.250
13.225.99.128 authserver.mojang.com
13.107.246.31 resources.download.minecraft.net
13.107.246.31 libraries.minecraft.net
13.107.246.31 launcher.mojang.com
13.107.246.31 launchermeta.mojang.com
13.107.246.31 sessionserver.mojang.com
13.107.246.31 api.minecraftservices.com
13.107.246.31 textures.minecraft.net
13.107.246.31 redstone-launcher.mojang.com
13.107.246.31 api.mojang.com