Skip to content

Commit 90fdca1

Browse files
committed
v0.2.0
允许基于xip.io的A记录设置
1 parent 8c0b4a9 commit 90fdca1

File tree

5 files changed

+26
-6
lines changed

5 files changed

+26
-6
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Cloudflare Partner Management Panel
33

44
打开config.php,根据里面的注释进行设置后即可使用
55

6-
可用示例:[https://cf.131.re/](https://cf.131.re/)
6+
## 功能
7+
* CNAME接入
8+
* reCAPTCHA
9+
* A记录设置(基于xip.io)(默认关闭此功能)
710

8-
PS:支持reCAPTCHA
11+
可用示例:[https://cf.131.re/](https://cf.131.re/)

cf.class.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,20 @@ public function update_record($zone_name,$record){
7676
}
7777
$at=$record["@"];
7878
unset($record["@"]);
79+
if ((Enable_A_Record) && (filter_var($at,FILTER_VALIDATE_IP,FILTER_FLAG_IPV4))){
80+
$at=$at.'.xip.io';
81+
}
7982
$str="";
8083
foreach ($record as $key => $value){
81-
$str.=$key.":".$value.",";
84+
if ((Enable_A_Record) && (filter_var($value,FILTER_VALIDATE_IP,FILTER_FLAG_IPV4))){
85+
$str.=$key.":".$value.".xip.io,";
86+
}else{
87+
$str.=$key.":".$value.",";
88+
}
8289
}
83-
if (empty($str)){$str="www:".$zone_name;}else{
90+
if (empty($str)){
91+
$str="www:".$zone_name;
92+
}else{
8493
$str=substr($str,0,strlen($str)-1);
8594
}
8695
return self::zone_set($zone_name,$at,$str);

config.php

+3
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
define("Enable_reCAPTCHA",false);
1111
define("reCAPTCHA_Site","");
1212
define("reCAPTCHA_Secret","");
13+
14+
//A记录解析(基于xip.io)
15+
define("Enable_A_Record",false);

footer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</a>.</span>
88
<br />
99
<span>
10-
<a href="https://github.com/Netrvin/CFPMP" target="_blank">CFPMP</a> v0.1.1</span>
10+
<a href="https://github.com/Netrvin/CFPMP" target="_blank">CFPMP</a> v0.2.0</span>
1111
</center>
1212
</div>
1313
</body>

manage_domain.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ function msg($s){
7979
{
8080
$is_ssl=true;
8181
}
82+
if ((Enable_A_Record) && (filter_var(str_replace('.xip.io','',$set),FILTER_VALIDATE_IP,FILTER_FLAG_IPV4))){
83+
$set=str_replace('.xip.io','',$set);
84+
}
8285
echo "<tr>".
8386
'<td><button style="display:inline;" class="mdui-btn mdui-btn-icon mdui-shadow-3 ';
8487
if ($is_ssl)
@@ -95,7 +98,7 @@ function msg($s){
9598
}else{
9699
echo $r["forward_tos"][$record];
97100
}
98-
echo "</td><td>".$set.'</td></tr>';
101+
echo '</td><td>'.$set.'</td></tr>';
99102
}
100103
?>
101104
</tbody>
@@ -107,9 +110,11 @@ function msg($s){
107110
<p>
108111
注 (2):根据先前的测试(2018-02-15),目前启用Universal SSL无需再专门配置CNAME记录,只需配置所需接入的域名的CNAME记录。证书将在24小时内下发。一切以实际情况为准
109112
</p>
113+
<?php if (!Enable_A_Record): ?>
110114
<p>
111115
注 (3):回源地址以<strong>CNAME</strong>形式填写,暂时不支持<strong>A</strong>记录和<strong>AAAA</strong>记录
112116
</p>
117+
<?php endif; ?>
113118
</div>
114119
</div>
115120
</div>

0 commit comments

Comments
 (0)