Skip to content

Commit

Permalink
v0.2.0
Browse files Browse the repository at this point in the history
允许基于xip.io的A记录设置
  • Loading branch information
Netrvin committed Jul 7, 2018
1 parent 8c0b4a9 commit 90fdca1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Cloudflare Partner Management Panel

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

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

PS:支持reCAPTCHA
可用示例:[https://cf.131.re/](https://cf.131.re/)
13 changes: 11 additions & 2 deletions cf.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,20 @@ public function update_record($zone_name,$record){
}
$at=$record["@"];
unset($record["@"]);
if ((Enable_A_Record) && (filter_var($at,FILTER_VALIDATE_IP,FILTER_FLAG_IPV4))){
$at=$at.'.xip.io';
}
$str="";
foreach ($record as $key => $value){
$str.=$key.":".$value.",";
if ((Enable_A_Record) && (filter_var($value,FILTER_VALIDATE_IP,FILTER_FLAG_IPV4))){
$str.=$key.":".$value.".xip.io,";
}else{
$str.=$key.":".$value.",";
}
}
if (empty($str)){$str="www:".$zone_name;}else{
if (empty($str)){
$str="www:".$zone_name;
}else{
$str=substr($str,0,strlen($str)-1);
}
return self::zone_set($zone_name,$at,$str);
Expand Down
3 changes: 3 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
define("Enable_reCAPTCHA",false);
define("reCAPTCHA_Site","");
define("reCAPTCHA_Secret","");

//A记录解析(基于xip.io)
define("Enable_A_Record",false);
2 changes: 1 addition & 1 deletion footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</a>.</span>
<br />
<span>
<a href="https://github.com/Netrvin/CFPMP" target="_blank">CFPMP</a> v0.1.1</span>
<a href="https://github.com/Netrvin/CFPMP" target="_blank">CFPMP</a> v0.2.0</span>
</center>
</div>
</body>
Expand Down
7 changes: 6 additions & 1 deletion manage_domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ function msg($s){
{
$is_ssl=true;
}
if ((Enable_A_Record) && (filter_var(str_replace('.xip.io','',$set),FILTER_VALIDATE_IP,FILTER_FLAG_IPV4))){
$set=str_replace('.xip.io','',$set);
}
echo "<tr>".
'<td><button style="display:inline;" class="mdui-btn mdui-btn-icon mdui-shadow-3 ';
if ($is_ssl)
Expand All @@ -95,7 +98,7 @@ function msg($s){
}else{
echo $r["forward_tos"][$record];
}
echo "</td><td>".$set.'</td></tr>';
echo '</td><td>'.$set.'</td></tr>';
}
?>
</tbody>
Expand All @@ -107,9 +110,11 @@ function msg($s){
<p>
注 (2):根据先前的测试(2018-02-15),目前启用Universal SSL无需再专门配置CNAME记录,只需配置所需接入的域名的CNAME记录。证书将在24小时内下发。一切以实际情况为准
</p>
<?php if (!Enable_A_Record): ?>
<p>
注 (3):回源地址以<strong>CNAME</strong>形式填写,暂时不支持<strong>A</strong>记录和<strong>AAAA</strong>记录
</p>
<?php endif; ?>
</div>
</div>
</div>
Expand Down

0 comments on commit 90fdca1

Please sign in to comment.