diff --git a/README.md b/README.md index 8f80a88..b49ad63 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ## 下载: -* [下载(GitHub) v2.9.5](https://github.com/david082321/BiliRoaming-PHP-Server/raw/main/Server_v2.9.5.zip) +* [下载(GitHub) v2.9.6](https://github.com/david082321/BiliRoaming-PHP-Server/raw/main/Server_v2.9.6.zip) ## 用法: diff --git a/ServerServer_v2.9.6.zip b/ServerServer_v2.9.6.zip new file mode 100644 index 0000000..eafb91c Binary files /dev/null and b/ServerServer_v2.9.6.zip differ diff --git a/Server_v2.9.5.zip b/Server_v2.9.5.zip deleted file mode 100644 index f6d6ed3..0000000 Binary files a/Server_v2.9.5.zip and /dev/null differ diff --git a/config.php b/config.php index 49a4499..62c1bf4 100644 --- a/config.php +++ b/config.php @@ -3,7 +3,8 @@ define('BLOCK_TYPE','blacklist'); // 封锁类型:none 不封锁, blacklist 黑名单, whitelist 本地白名单 define('REPLACE_TYPE', "tom"); // 是否替换视频(仅黑/白名单时生效)。hlw 葫芦娃, tom 猫和老鼠, xyy 喜羊羊 define('NEED_LOGIN', 0); //是否要登录用户才能用。0 否, 1 是 -define('BILIROAMING', 1); //是否要用哔哩漫游才能使用。0 否, 1 是 +define('BILIROAMING', 1); //是否要用哔哩漫游才能使用。0 否, 1 是 +define('WEB_ON', 0);//是否开启web接口 0 否, 1 是 目前Web接口不受哔哩漫游请求头影响(待更新) define('LOCK_AREA', 0); //服务器锁区,须设置$SERVER_AREA。0 否, 1 是 $WHITELIST = array('1', '2', '3'); // 本地白名单,填写 uid,可自行添加、删除,注意使用英文,和' diff --git a/index.php b/index.php index 7f48adf..a799327 100644 --- a/index.php +++ b/index.php @@ -30,13 +30,28 @@ if ($path=="/intl/gateway/v2/ogv/playurl") { $host = CUSTOM_HOST_DEFAULT; } lock_area(); -} else { +}elseif ($path=="/pgc/player/web/playurl") { + if(WEB_ON == 0){ + exit(BLOCK_RETURN); + }else if(AREA=="cn") { + $host = CUSTOM_HOST_CN; + } else if (AREA=="hk") { + $host = CUSTOM_HOST_HK; + } else if (AREA=="tw") { + $host = CUSTOM_HOST_TW; + } else { + $host = CUSTOM_HOST_DEFAULT; + } + header("Access-Control-Allow-Origin: https://www.bilibili.com"); + header("Access-Control-Allow-Credentials: true"); + // lock_area(); //网页脚本目前未实现区域判断,走默认api +}else { // 欢迎语 exit(WELCOME); } -// 模块请求都会带上X-From-Biliroaming的请求头,为了防止被盗用,可以加上请求头判断 +// 模块请求都会带上X-From-Biliroaming的请求头,为了防止被盗用,可以加上请求头判断,WEB接口暂不限制 $headerStringValue = $_SERVER['HTTP_X_FROM_BILIROAMING']; -if ($headerStringValue=="" && BILIROAMING==1) { +if ($headerStringValue=="" && BILIROAMING==1 && $path!="/pgc/player/web/playurl") { exit(BLOCK_RETURN); } // 服务器锁区 @@ -73,7 +88,7 @@ if (IP_RESOLVE==1) { } print($output); // 写入缓存 -if (SAVE_CACHE==1) { +if (SAVE_CACHE==1 && $path!="/pgc/player/web/playurl") { //屏蔽web缓存 write_cache(); } diff --git a/pgc/player/web/playurl/index.php b/pgc/player/web/playurl/index.php new file mode 100644 index 0000000..be39458 --- /dev/null +++ b/pgc/player/web/playurl/index.php @@ -0,0 +1,3 @@ + \ No newline at end of file