IDM
@@ -191,6 +200,15 @@
Due to Baidu restrictions, you need to modify the browser "User Agent" before downloading.
+
+
+ - Download Motrix from https://motrix.app/.
+ - Install and run Motrix.
+ - Open the file download page and click Send to aria2(Motrix)
+ - Type ws://localhost:16800/jsonrpc in the "RPC地址".Click send button.
+
diff --git a/static/functions.js b/static/functions.js
index f88cc6cd..0b290d4d 100644
--- a/static/functions.js
+++ b/static/functions.js
@@ -93,8 +93,7 @@ function getCookie(name) {
}
function addUri() {
//配置
- var host = $('#host').val();
- var port = $('#port').val();
+ var wsurl = $('#wsurl').val();
var uris = [$('#http')[0].href, $('#https')[0].href];
var token = $('#token').val();
var filename = $('#filename b').text();;
@@ -117,35 +116,37 @@ function addUri() {
};
if (token != "") {
- json.params.push("token:" + token);
+ json.params.unshift("token:" + token);//坑死了,必须要加在第一个
}
- var ws = new WebSocket("ws://" + host + ":" + port + "/jsonrpc");
- ws.onerror = function (event) {
+ var ws = new WebSocket(wsurl);
+ ws.onerror = (event) => {
console.log(event);
- Swal.fire('连接错误', 'aria2连接错误,请打开控制台查看详情', 'error')
+ Swal.fire('连接错误', 'aria2连接错误,请打开控制台查看详情', 'error');
};
ws.onopen = () => { ws.send(JSON.stringify(json)); }
- ws.onmessage = function wsmessage(event) {
+ ws.onmessage = (event) => {
console.log(event);
received_msg = JSON.parse(event.data);
+ if (received_msg.error !== undefined){
+ if (received_msg.error.code == 1) Swal.fire('通过RPC连接失败', '请打开控制台查看详细错误信息,返回信息:' + received_msg.error.message, 'error');
+ }
switch (received_msg.method) {
case "aria2.onDownloadStart":
- Swal.fire('aria2发送成功', '已经开始下载 ' + filename, 'success')
- document.cookie = 'aria2host=' + utoa(host); // add aria2 config to cookie
- document.cookie = 'aria2port=' + utoa(port);
+ Swal.fire('aria2发送成功', 'aria2已经开始下载 ' + filename, 'success');
+ document.cookie = 'aria2wsurl=' + utoa(wsurl); // add aria2 config to cookie
if (token != "" && token != null) {
document.cookie = 'aria2token=' + utoa(token);
}
break;
case "aria2.onDownloadError": ;
- Swal.fire('下载错误', 'aria2下载错误', 'error')
+ Swal.fire('下载错误', 'aria2下载错误', 'error');
break;
case "aria2.onDownloadComplete":
- Swal.fire('下载完成', 'aria2下载完成', 'success')
+ Swal.fire('下载完成', 'aria2下载完成', 'success');
break;
default:
From 8b1900d3c2ad5febd0c2d75f4b529048ce00e069 Mon Sep 17 00:00:00 2001
From: yuantuo666
Date: Sun, 11 Apr 2021 17:11:24 +0800
Subject: [PATCH 2/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=89=88=E6=9C=AC?=
=?UTF-8?q?=E5=8F=B7=E5=8F=8A=E6=9B=B4=E6=96=B0=E5=86=85=E5=AE=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 16 ++++++----------
Update.md | 11 +++++++++++
index.php | 4 ++--
install/config_raw | 4 ++--
4 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/README.md b/README.md
index c469a981..1bfdba42 100644
--- a/README.md
+++ b/README.md
@@ -65,20 +65,16 @@ PanDownload 网页复刻版,PHP 语言版
在**SVIP账号**中可设置**SVIP账号**的**BDUSS**和**STOKEN**,添加账号后记得进入**会员账号切换模式**将模式改成**顺序模式**或**轮换模式**。
## 📦New Changes
-- 当前版本:`2.1.5`
-- 更新日期:2021-04-03
+- 当前版本:`2.1.6`
+- 更新日期:2021-04-11
- 修改内容:
- 💥新增功能
- - 账号状态检查
- - Aria2在线管理页面
+ - 新增Motrix下载方式
- ⚠错误修复
- - 修复未开启数据库情况下无法正常获取文件下载地址 Thanks to kwxiaozhu
- - 修复GetDir()支持PHP8 Thanks to zzjin
- - 改用WebSocket推送下载链接到aria2
+ - 修复aria2推送token问题
- ♻代码优化
- - 增加账号失效提示
- - 版权信息改为Github项目页面
- - 删除不必要的版本检测和版本号
+ - 隐藏未启用数据库时奇怪的提示
+ - 增加推送错误提示
[查看更多](Update.md)
diff --git a/Update.md b/Update.md
index 72984935..5dcc3689 100644
--- a/Update.md
+++ b/Update.md
@@ -1,4 +1,15 @@
# Update
+### `2.1.6` 版本:
+- 更新日期:2021-04-11
+- 修改内容:
+ - 💥新增功能
+ - 新增Motrix下载方式
+ - ⚠错误修复
+ - 修复aria2推送token问题
+ - ♻代码优化
+ - 隐藏未启用数据库时奇怪的提示
+ - 增加推送错误提示
+
### `2.1.5` 版本:
- 更新日期:2021-04-03
- 修改内容:
diff --git a/index.php b/index.php
index d2475d50..3e71cfdc 100644
--- a/index.php
+++ b/index.php
@@ -9,14 +9,14 @@
*
* 此项目 GitHub 地址:https://github.com/yuantuo666/baiduwp-php
*
- * @version 2.1.5
+ * @version 2.1.6
*
* @author Yuan_Tuo
* @link https://imwcr.cn/
* @link https://space.bilibili.com/88197958
*
*/
-$programVersion_Index = "2.1.5";
+$programVersion_Index = "2.1.6";
session_start();
define('init', true);
if (version_compare(PHP_VERSION, '7.0.0', '<')) {
diff --git a/install/config_raw b/install/config_raw
index 78cd38e1..64e76da4 100644
--- a/install/config_raw
+++ b/install/config_raw
@@ -3,12 +3,12 @@
* PanDownload 网页复刻版,PHP 语言版配置文件
* !!!请勿修改本文件,如果手动修改后再在后台设置,可能导致config.php文件被清空!!!
*
- * @version 2.1.5
+ * @version 2.1.6
* @author Yuan_Tuo
* @link https://imwcr.cn/
* @link https://space.bilibili.com/88197958
*/
-const programVersion = '2.1.5';
+const programVersion = '2.1.6';
if (!defined('init')) {
http_response_code(403); header('Content-Type: text/plain; charset=utf-8'); header('Refresh: 3;url=./');
die("HTTP 403 禁止访问!\r\n此文件是 PanDownload 网页复刻版 PHP 语言版项目版本 " . programVersion . " 的配置文件!\r\n禁止直接访问!");
From 2963e8ed294de83d6b41dbc05f5c6cb354a0e8df Mon Sep 17 00:00:00 2001
From: yuantuo666
Date: Sun, 18 Apr 2021 14:06:14 +0800
Subject: [PATCH 3/9] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=85=A8=E8=B4=A6?=
=?UTF-8?q?=E5=8F=B7=E8=BD=AE=E6=8D=A2=E6=A8=A1=E5=BC=8F=EF=BC=8C=E6=97=A0?=
=?UTF-8?q?=E8=A7=86=E6=98=AF=E5=90=A6=E9=99=90=E9=80=9F=EF=BC=8C=E8=BD=AE?=
=?UTF-8?q?=E6=8D=A2=E6=95=B0=E6=8D=AE=E5=BA=93=E4=B8=AD=E8=B4=A6=E5=8F=B7?=
=?UTF-8?q?=20#108?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
functions.php | 175 +++++++++++++++++++++++++++++---------------------
index.php | 2 +
install.php | 6 +-
settings.php | 17 +++--
4 files changed, 118 insertions(+), 82 deletions(-)
diff --git a/functions.php b/functions.php
index 4a4f8bb8..69b6e961 100644
--- a/functions.php
+++ b/functions.php
@@ -531,6 +531,33 @@ function GetDBBDUSS()
$id = "-1";
}
break;
+ case 4:
+ //模式4:轮番上(无视限速)
+ // 时间顺序输出第一项限速账号
+ $sql = "SELECT `id`,`svip_bduss`,`svip_stoken` FROM `" . $dbtable . "_svip` ORDER BY `is_using` ASC,`id` DESC LIMIT 0,1";
+
+ $Result = mysqli_query($conn, $sql);
+ if ($Result = mysqli_fetch_assoc($Result)) {
+ $SVIP_BDUSS = $Result["svip_bduss"];
+ $SVIP_STOKEN = $Result["svip_stoken"];
+ $id = $Result["id"];
+ //不论解析成功与否,将当前账号更新时间,下一次使用另一账号
+ // 开始处理
+ // 这里最新的时间表示可用账号,按顺序排序
+ $is_using = date("Y-m-d H:i:s");
+ $sql = "UPDATE `" . $dbtable . "_svip` SET `is_using`= '$is_using' WHERE `id`=$id";
+ $mysql_query = mysqli_query($conn, $sql);
+ if ($mysql_query == false) {
+ // 失败 但可继续解析
+ dl_error("数据库错误", "请联系站长修复无法自动切换账号问题!");
+ }
+ } else {
+ // 数据库中所有SVIP账号已经用完,启用本地SVIP账号
+ $SVIP_BDUSS = SVIP_BDUSS;
+ $SVIP_STOKEN = SVIP_STOKEN;
+ $id = "-1";
+ }
+ break;
case 0:
//模式0:使用本地解析
default:
@@ -548,57 +575,57 @@ function GetDBBDUSS()
*/
function AccountStatus(string $BDUSS, string $STOKEN)
{
- $Url = "https://pan.baidu.com/api/gettemplatevariable?channel=chunlei&web=1&app_id=250528&clienttype=0";
- $Header = [
- "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.514.1919.810 Safari/537.36",
- "Cookie: BDUSS=$BDUSS;STOKEN=$STOKEN;"
- ];
- $Data = "fields=[%22username%22,%22loginstate%22,%22is_vip%22,%22is_svip%22,%22is_evip%22]";
- $Result = post($Url, $Data, $Header);
- $Result = json_decode($Result, true);
- if (DEBUG) {
- echo '账号状态:';
- var_dump($Result);
- echo '
';
- }
- if ($Result["errno"] == 0) {
- // 正常
- $Username = $Result["result"]["username"];
- $LoginStatus = $Result["result"]["loginstate"];
- if ($Result["result"]["is_vip"] == 1) {
- $SVIP = 1; //会员账号
- } elseif ($Result["result"]["is_svip"] == 1 or $Result["result"]["is_evip"] == 1) {
- $SVIP = 2; //超级会员账号
- } else {
- $SVIP = 0; //普通账号
- return array(0, $SVIP, $Username, $LoginStatus, 0);
- }
+ $Url = "https://pan.baidu.com/api/gettemplatevariable?channel=chunlei&web=1&app_id=250528&clienttype=0";
+ $Header = [
+ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.514.1919.810 Safari/537.36",
+ "Cookie: BDUSS=$BDUSS;STOKEN=$STOKEN;"
+ ];
+ $Data = "fields=[%22username%22,%22loginstate%22,%22is_vip%22,%22is_svip%22,%22is_evip%22]";
+ $Result = post($Url, $Data, $Header);
+ $Result = json_decode($Result, true);
+ if (DEBUG) {
+ echo '账号状态:';
+ var_dump($Result);
+ echo '
';
+ }
+ if ($Result["errno"] == 0) {
+ // 正常
+ $Username = $Result["result"]["username"];
+ $LoginStatus = $Result["result"]["loginstate"];
+ if ($Result["result"]["is_vip"] == 1) {
+ $SVIP = 1; //会员账号
+ } elseif ($Result["result"]["is_svip"] == 1 or $Result["result"]["is_evip"] == 1) {
+ $SVIP = 2; //超级会员账号
+ } else {
+ $SVIP = 0; //普通账号
+ return array(0, $SVIP, $Username, $LoginStatus, 0);
+ }
- $Url = "https://pan.baidu.com/rest/2.0/membership/user?channel=chunlei&web=1&app_id=250528&clienttype=0";
- $Header = [
- "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.514.1919.810 Safari/537.36",
- "Cookie: BDUSS=$BDUSS;STOKEN=$STOKEN;"
- ];
- $Data = "method=query";
- $Result = post($Url, $Data, $Header);
- $Result = json_decode($Result, true);
- if (DEBUG) {
- echo '会员状态:';
- var_dump($Result);
- echo '
';
- }
- if (isset($Result["reminder"]["svip"])) {
- //存在会员信息
- $LeftSeconds = $Result["reminder"]["svip"]["leftseconds"];
- return array(0, $SVIP, $Username, $LoginStatus, $LeftSeconds);
- }
- } elseif ($Result["errno"] == -6) {
- // 账号失效
- return array(-6);
- } else {
- //未知错误
- return array($Result["errno"]);
- }
+ $Url = "https://pan.baidu.com/rest/2.0/membership/user?channel=chunlei&web=1&app_id=250528&clienttype=0";
+ $Header = [
+ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.514.1919.810 Safari/537.36",
+ "Cookie: BDUSS=$BDUSS;STOKEN=$STOKEN;"
+ ];
+ $Data = "method=query";
+ $Result = post($Url, $Data, $Header);
+ $Result = json_decode($Result, true);
+ if (DEBUG) {
+ echo '会员状态:';
+ var_dump($Result);
+ echo '
';
+ }
+ if (isset($Result["reminder"]["svip"])) {
+ //存在会员信息
+ $LeftSeconds = $Result["reminder"]["svip"]["leftseconds"];
+ return array(0, $SVIP, $Username, $LoginStatus, $LeftSeconds);
+ }
+ } elseif ($Result["errno"] == -6) {
+ // 账号失效
+ return array(-6);
+ } else {
+ //未知错误
+ return array($Result["errno"]);
+ }
}
/**
* 时间差计算
@@ -610,30 +637,30 @@ function AccountStatus(string $BDUSS, string $STOKEN)
*/
function time2Units(int $time)
{
- $year = floor($time / 60 / 60 / 24 / 365);
- $time -= $year * 60 * 60 * 24 * 365;
- $month = floor($time / 60 / 60 / 24 / 30);
- $time -= $month * 60 * 60 * 24 * 30;
- $day = floor($time / 60 / 60 / 24);
- $time -= $day * 60 * 60 * 24;
- $hour = floor($time / 60 / 60);
- $time -= $hour * 60 * 60;
- $minute = floor($time / 60);
- $time -= $minute * 60;
- $second = $time;
- $elapse = '';
+ $year = floor($time / 60 / 60 / 24 / 365);
+ $time -= $year * 60 * 60 * 24 * 365;
+ $month = floor($time / 60 / 60 / 24 / 30);
+ $time -= $month * 60 * 60 * 24 * 30;
+ $day = floor($time / 60 / 60 / 24);
+ $time -= $day * 60 * 60 * 24;
+ $hour = floor($time / 60 / 60);
+ $time -= $hour * 60 * 60;
+ $minute = floor($time / 60);
+ $time -= $minute * 60;
+ $second = $time;
+ $elapse = '';
- $unitArr = array(
- '年' => 'year', '个月' => 'month', '天' => 'day',
- '小时' => 'hour', '分钟' => 'minute', '秒' => 'second'
- );
+ $unitArr = array(
+ '年' => 'year', '个月' => 'month', '天' => 'day',
+ '小时' => 'hour', '分钟' => 'minute', '秒' => 'second'
+ );
- foreach ($unitArr as $cn => $u) {
- if ($$u > 0) {
- $elapse = $$u . $cn;
- break;
- }
- }
+ foreach ($unitArr as $cn => $u) {
+ if ($$u > 0) {
+ $elapse = $$u . $cn;
+ break;
+ }
+ }
- return $elapse;
-}
\ No newline at end of file
+ return $elapse;
+}
diff --git a/index.php b/index.php
index 3e71cfdc..ba866237 100644
--- a/index.php
+++ b/index.php
@@ -453,6 +453,8 @@ function getip()
break;
case 3:
//模式3:手动切换,不管限速
+ case 4:
+ //模式4:轮番上(无视限速)
case 0:
//模式0:使用本地解析
default:
diff --git a/install.php b/install.php
index 45926b64..7ea711d4 100644
--- a/install.php
+++ b/install.php
@@ -321,13 +321,15 @@ function getDbConfig(&$var, string $key)
本地模式:不管是否限速,一直使用本地账号解析。
顺序模式:一直使用设置的账号解析,用到会员账号失效切换下一账号;当数据库中会员账号失效后,会使用本地账号解析。
- 轮换模式:解析一次就切换一次账号,只使用会员账号;当数据库中会员账号失效后,会使用本地账号解析。
+ 会员账号轮换模式:解析一次就切换一次账号,只使用会员账号;当数据库中会员账号失效后,会使用本地账号解析。
+ 所有账号轮换模式:解析一次就切换一次账号,无视是否限速。
手动模式:不管是否限速,一直使用数据库中设置的账号。
diff --git a/settings.php b/settings.php
index 0a1286ab..49938f98 100644
--- a/settings.php
+++ b/settings.php
@@ -470,7 +470,8 @@ function IPLoadmore() {
?>
本地模式:不管是否限速,一直使用本地账号解析。
顺序模式:一直使用设置的账号解析,用到会员账号失效切换下一账号;当数据库中会员账号失效后,会使用本地账号解析。
- 轮换模式:解析一次就切换一次账号,只使用会员账号;当数据库中会员账号失效后,会使用本地账号解析。
+ 会员账号轮换模式:解析一次就切换一次账号,只使用会员账号;当数据库中会员账号失效后,会使用本地账号解析。
+ 所有账号轮换模式:解析一次就切换一次账号,无视是否限速。
手动模式:不管是否限速,一直使用数据库中设置的账号。
注意!此功能需要修改config.php的信息,请小心使用。
@@ -481,10 +482,11 @@ function IPLoadmore() {
@@ -684,11 +686,14 @@ function IPLoadmore() {
$Mod = "顺序模式";
break;
case '2':
- $Mod = "轮换模式";
+ $Mod = "会员账号轮换模式";
break;
case '3':
$Mod = "手动模式";
break;
+ case '4':
+ $Mod = "所有账号轮换模式";
+ break;
default:
$Mod = "未知模式";
break;
From 2254d3269487680e453a3bb1dff6f92663db508e Mon Sep 17 00:00:00 2001
From: Yuan_Tuo
Date: Mon, 19 Apr 2021 22:56:45 +0800
Subject: [PATCH 4/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?=
=?UTF-8?q?=E6=A0=87=E8=AE=B0bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/index.php b/index.php
index ba866237..b0dfecbc 100644
--- a/index.php
+++ b/index.php
@@ -349,7 +349,7 @@ function getip()
$bdstoken = $_POST["bdstoken"];
$filesize = $_POST["filesize"];
$smallfile = ((int)$filesize < 52428800) ? true : false; // 如果是小文件 那么可以不需要传入SVIP的BDUSS 仅需普通用户的即可
- // $smallfile = false; // 小文件竟然也会限速,醉了,现在先不搞这个
+ $smallfile = false; // 小文件竟然也会限速,醉了,现在先不搞这个
// 文件小于50MB可以使用这种方法获取:
// $nouarealLink="";// 重置
// if((int)$filesize<=52428800){
@@ -685,4 +685,4 @@ function getip()
?>