From c9d4c257836743a46b8df02bd779629a8b24d41a Mon Sep 17 00:00:00 2001 From: yuantuo666 Date: Sun, 11 Apr 2021 17:10:50 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=9C=AA=E5=90=AF?= =?UTF-8?q?=E7=94=A8=E6=95=B0=E6=8D=AE=E5=BA=93=E6=97=B6=E5=A5=87=E6=80=AA?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA=EF=BC=9B=E6=96=B0=E5=A2=9EMotrix?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=96=B9=E5=BC=8F=EF=BC=9B=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Daria2=E6=8E=A8=E9=80=81token=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=9B=E5=A2=9E=E5=8A=A0=E6=8E=A8=E9=80=81=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 138 ++++++++++++++++++++++---------------------- language.php | 24 +++++++- static/functions.js | 25 ++++---- 3 files changed, 103 insertions(+), 84 deletions(-) diff --git a/index.php b/index.php index dff54ddc..d2475d50 100644 --- a/index.php +++ b/index.php @@ -97,7 +97,7 @@ '; - if (IsConfirmDownload) { + if (USING_DB and IsConfirmDownload) { $Language = Language; $JSCode['echo']( <<

-

恭喜你,中奖啦!本次解析不消耗次数哦~"; - else echo "服务器将保存下载地址8小时,时限内再次解析不消耗免费次数。"; ?>

- 下载链接从数据库中提取,不消耗免费次数。

"; + elseif ($smallfile) echo "

恭喜你,中奖啦!本次解析不消耗次数哦~

"; + else echo "

服务器将保存下载地址8小时,时限内再次解析不消耗免费次数。

"; + } + echo FileInfo($filename, $size, $md5, $server_ctime); + echo '

' . Language["Rreview"] . '

'; if ($_SERVER['HTTP_USER_AGENT'] == "LogStatistic" or $smallfile) { @@ -522,7 +525,7 @@ function getip() echo '

'; ?>

- 推送到Aria2 + (Motrix)

(必读)

@@ -538,23 +541,17 @@ function getip() @@ -592,8 +588,10 @@ function getip()
- - Loading... + + + Loading... +
@@ -615,61 +613,63 @@ function getip()
- + }); + +
"暂不支持当前文件。", "NotSupportWithoutUA" => "目前只支持50MB以下文件设置UA后使用在线预览功能。", "DownloadLink" => "下载链接", - "DownloadTip" => "Tips:电脑端右键即可复制下载链接,手机端长按可复制下载链接。推荐使用Aria2下载,速度更快,使用方法请访问帮助页面。", - "SendToAria2" => "发送到aria2", + "DownloadTip" => "Tips:电脑端右键即可复制下载链接,手机端长按可复制下载链接。推荐使用Aria2、Motrix下载,速度更快,使用方法请访问帮助页面。", + "SendToAria2" => "发送到Aria2", "Send" => "发送", "Close" => "关闭", "IndexTitle" => "百度网盘在线解析", @@ -65,13 +65,22 @@

因百度限制,需修改浏览器 User Agent 后下载。你可以在下方选择你喜欢的方式进行下载。

+
+

Motrix(推荐)

+
+
    +
  1. 前往 Motrix官网 下载 Motrix 对应版本
  2. +
  3. 安装后运行Motrix。
  4. +
  5. 打开解析下载页面,点击 推送到Aria2(Motrix)
  6. +
  7. 在“RPC地址”中输入 ws://localhost:16800/jsonrpc 并 点击发送。
  8. +

aria2(推荐)

  1. 点击此处 下载 aria2.zip
  2. 解压 aria2.zip 文件并运行其中的 点此启动.bat
  3. -
  4. 打开解析下载页面,点击 推送到Aria2
  5. +
  6. 打开解析下载页面,点击 推送到Aria2(Motrix)

IDM

@@ -191,6 +200,15 @@

Due to Baidu restrictions, you need to modify the browser "User Agent" before downloading.

+
+

Motrix(Recommend)

+
+
    +
  1. Download Motrix from https://motrix.app/.
  2. +
  3. Install and run Motrix.
  4. +
  5. Open the file download page and click Send to aria2(Motrix)
  6. +
  7. Type ws://localhost:16800/jsonrpc in the "RPC地址".Click send button.
  8. +

aria2(Recommend)

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() ?> - \ No newline at end of file + From 7ef8ebfb3970c6c6f67dd9010d6395358ce0b2db Mon Sep 17 00:00:00 2001 From: yuantuo666 Date: Sat, 1 May 2021 20:52:07 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E6=96=87=E5=AD=97=E6=A0=BC=E5=BC=8F=EF=BC=9Bws(s)=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E6=97=B6=E6=A3=80=E6=B5=8B=EF=BC=9Baira=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E4=BF=A1=E6=81=AF=E6=96=B9=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++++- Update.md | 14 +++++++++----- index.php | 12 +++++------- language.php | 8 ++++---- static/functions.js | 38 ++++++++++++++++++-------------------- 5 files changed, 41 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 1bfdba42..7a4d5240 100644 --- a/README.md +++ b/README.md @@ -66,15 +66,19 @@ PanDownload 网页复刻版,PHP 语言版
## 📦New Changes - 当前版本:`2.1.6` -- 更新日期:2021-04-11 +- 更新日期:2021-05-01 - 修改内容: - 💥新增功能 - 新增Motrix下载方式 + - 新增全账号轮换模式(无视是否限速,轮换数据库中账号) - ⚠错误修复 - 修复aria2推送token问题 - ♻代码优化 - 隐藏未启用数据库时奇怪的提示 - 增加推送错误提示 + - 处理一些文字格式 + - ws(s)链接时检测是否有效 + - aira存储信息方式修改为localStorage [查看更多](Update.md) diff --git a/Update.md b/Update.md index 5dcc3689..bf96e271 100644 --- a/Update.md +++ b/Update.md @@ -1,6 +1,7 @@ # Update ### `2.1.6` 版本: -- 更新日期:2021-04-11 +- 当前版本:`2.1.6` +- 更新日期:2021-05-01 - 修改内容: - 💥新增功能 - 新增Motrix下载方式 @@ -9,6 +10,9 @@ - ♻代码优化 - 隐藏未启用数据库时奇怪的提示 - 增加推送错误提示 + - 处理一些文字格式 + - ws(s)链接时检测是否有效 + - aira存储信息方式修改为localStorage ### `2.1.5` 版本: - 更新日期:2021-04-03 @@ -17,8 +21,8 @@ - 账号状态检查 - Aria2在线管理页面 - ⚠错误修复 - - 修复未开启数据库情况下无法正常获取文件下载地址 Thanks to kwxiaozhu - - 修复GetDir()支持PHP8 Thanks to zzjin + - 修复未开启数据库情况下无法正常获取文件下载地址 GitHub: #kwxiaozhu + - 修复GetDir()支持PHP8 GitHub: #zzjin - 改用WebSocket推送下载链接到aria2 - ♻代码优化 - 增加账号失效提示 @@ -38,7 +42,7 @@ - 修改内容: - 💥新增功能 - 兼容老方法获取randsk(BDCLND) #84 - - aria2推送时附上文件名 #78 Thanks to @kwxiaozhu + - aria2推送时附上文件名 #78 GitHub: #@kwxiaozhu - ⚠错误修复 - 安装页面未处理默认情况丢失前缀 #76 - ♻代码优化 @@ -144,7 +148,7 @@ http://www.dupan.cc/ (站长QQ33703259) 所发布的源码已被篡改,添 ### `1.3.6` 版本: - 更新日期:2020-08-19 - 修改内容 - - 修改了因为浮点数精度造成下载未知错误的问题 Thanks to @apiee (因为合并的问题,导致丢失了贡献者信息) + - 修改了因为浮点数精度造成下载未知错误的问题 GitHub: #apiee (因为合并的问题,导致丢失了贡献者信息) ### `1.3.5` 版本: - 更新日期:2020-08-17 diff --git a/index.php b/index.php index b0dfecbc..bdc8c0cc 100644 --- a/index.php +++ b/index.php @@ -563,12 +563,10 @@ function getip()
@@ -685,4 +683,4 @@ function getip() ?> - + \ No newline at end of file diff --git a/language.php b/language.php index 171f87cc..8ed260e7 100644 --- a/language.php +++ b/language.php @@ -33,10 +33,10 @@ "DownloadLinkSuccess" => "获取下载链接成功", "Rreview" => "在线预览:", "NotSupportWithUA" => "暂不支持当前文件。", - "NotSupportWithoutUA" => "目前只支持50MB以下文件设置UA后使用在线预览功能。", + "NotSupportWithoutUA" => "目前只支持 50MB以下文件设置UA 后使用在线预览功能。", "DownloadLink" => "下载链接", - "DownloadTip" => "Tips:电脑端右键即可复制下载链接,手机端长按可复制下载链接。推荐使用Aria2、Motrix下载,速度更快,使用方法请访问帮助页面。", - "SendToAria2" => "发送到Aria2", + "DownloadTip" => "Tips: 电脑端右键即可复制下载链接,手机端长按可复制下载链接。推荐使用Aria2、Motrix下载,速度更快,使用方法请访问帮助页面。", + "SendToAria2" => "发送到 Aria2", "Send" => "发送", "Close" => "关闭", "IndexTitle" => "百度网盘在线解析", @@ -170,7 +170,7 @@ "NotSupportWithUA" => "The type is not support", "NotSupportWithoutUA" => "The type is not support", "DownloadLink" => "Download Link", - "DownloadTip" => "Tips:Copy the download link and put it in your download apps.", + "DownloadTip" => "Tips: Copy the download link and put it in your download apps.", "SendToAria2" => "Send to aria2", "Send" => "Send", "Close" => "Close", diff --git a/static/functions.js b/static/functions.js index 0b290d4d..a151dec5 100644 --- a/static/functions.js +++ b/static/functions.js @@ -74,13 +74,6 @@ function Getpw() { } } -function utoa(str) { - return window.btoa(unescape(encodeURIComponent(str))); -} -// base64 encoded ascii to ucs-2 string -function atou(str) { - return decodeURIComponent(escape(window.atob(str))); -} function getCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); @@ -119,34 +112,39 @@ function addUri() { json.params.unshift("token:" + token);//坑死了,必须要加在第一个 } + patt = /^wss?\:\/\/(([A-Za-z0-9]+[A-Za-z0-9\-]+[A-Za-z0-9]+)|([A-Za-z0-9]+))(\.([A-Za-z0-9]+[A-Za-z0-9\-]+[A-Za-z0-9]+)|([A-Za-z0-9]+))*(\.[A-Za-z0-9]{2,10})(\/.*)?$/; + if (!patt.test(wsurl)) { + Swal.fire('地址错误', 'ws 或 wss 输入错误,请检查是否填写正确', 'error'); + return; + } var ws = new WebSocket(wsurl); - ws.onerror = (event) => { + + ws.onerror = event => { console.log(event); - Swal.fire('连接错误', 'aria2连接错误,请打开控制台查看详情', 'error'); + Swal.fire('连接错误', 'aria2 连接错误,请打开控制台查看详情', 'error'); }; ws.onopen = () => { ws.send(JSON.stringify(json)); } - ws.onmessage = (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'); + 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发送成功', 'aria2已经开始下载 ' + filename, 'success'); - document.cookie = 'aria2wsurl=' + utoa(wsurl); // add aria2 config to cookie - if (token != "" && token != null) { - document.cookie = 'aria2token=' + utoa(token); - } + Swal.fire('aria2 发送成功', 'aria2已经开始下载 ' + filename, 'success'); + + localStorage.setItem('aria2wsurl', wsurl);// add aria2 config to SessionStorage + if (token != "" && token != null) localStorage.setItem('aria2token', 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: @@ -155,7 +153,7 @@ function addUri() { // version = received_msg.result.version; }; - ws.onclose = function () { + ws.onclose = () => { }; } \ No newline at end of file From 0bdc11dae0aafe3bdcc7578b3c3ffcf1984e5e5a Mon Sep 17 00:00:00 2001 From: yuantuo666 Date: Sat, 1 May 2021 20:59:30 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8DSVIPSwitchMod=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- settings.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/settings.php b/settings.php index 49938f98..ce47e07d 100644 --- a/settings.php +++ b/settings.php @@ -482,11 +482,11 @@ function IPLoadmore() {
From 9c522444428482419544caa51ae82d677b46cbee Mon Sep 17 00:00:00 2001 From: yuantuo666 Date: Sat, 1 May 2021 21:06:16 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E5=B0=86=E5=AF=B9=E8=B4=A1=E7=8C=AE?= =?UTF-8?q?=E8=80=85=E7=9A=84=E5=BC=95=E7=94=A8=E6=94=B9=E4=B8=BA@?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Update.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Update.md b/Update.md index bf96e271..0705f3ad 100644 --- a/Update.md +++ b/Update.md @@ -21,8 +21,8 @@ - 账号状态检查 - Aria2在线管理页面 - ⚠错误修复 - - 修复未开启数据库情况下无法正常获取文件下载地址 GitHub: #kwxiaozhu - - 修复GetDir()支持PHP8 GitHub: #zzjin + - 修复未开启数据库情况下无法正常获取文件下载地址 GitHub: @kwxiaozhu + - 修复GetDir()支持PHP8 GitHub: @zzjin - 改用WebSocket推送下载链接到aria2 - ♻代码优化 - 增加账号失效提示 @@ -42,7 +42,7 @@ - 修改内容: - 💥新增功能 - 兼容老方法获取randsk(BDCLND) #84 - - aria2推送时附上文件名 #78 GitHub: #@kwxiaozhu + - aria2推送时附上文件名 #78 GitHub: @kwxiaozhu - ⚠错误修复 - 安装页面未处理默认情况丢失前缀 #76 - ♻代码优化 @@ -148,7 +148,7 @@ http://www.dupan.cc/ (站长QQ33703259) 所发布的源码已被篡改,添 ### `1.3.6` 版本: - 更新日期:2020-08-19 - 修改内容 - - 修改了因为浮点数精度造成下载未知错误的问题 GitHub: #apiee (因为合并的问题,导致丢失了贡献者信息) + - 修改了因为浮点数精度造成下载未知错误的问题 GitHub: @apiee (因为合并的问题,导致丢失了贡献者信息) ### `1.3.5` 版本: - 更新日期:2020-08-17 From 700e1c838eaa1604a026187c298147d32f813aa4 Mon Sep 17 00:00:00 2001 From: yuantuo666 Date: Sat, 1 May 2021 21:52:36 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 2 +- language.php | 10 +++++----- static/functions.js | 15 ++++++--------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/index.php b/index.php index bdc8c0cc..e9232196 100644 --- a/index.php +++ b/index.php @@ -493,7 +493,7 @@ function getip() 下载链接从数据库中提取,不消耗免费次数。

"; - elseif ($smallfile) echo "

恭喜你,中奖啦!本次解析不消耗次数哦~

"; + elseif ($smallfile) echo "

此文件很小,不消耗解析次数。

"; else echo "

服务器将保存下载地址8小时,时限内再次解析不消耗免费次数。

"; } echo FileInfo($filename, $size, $md5, $server_ctime); diff --git a/language.php b/language.php index 8ed260e7..b2aa7106 100644 --- a/language.php +++ b/language.php @@ -35,7 +35,7 @@ "NotSupportWithUA" => "暂不支持当前文件。", "NotSupportWithoutUA" => "目前只支持 50MB以下文件设置UA 后使用在线预览功能。", "DownloadLink" => "下载链接", - "DownloadTip" => "Tips: 电脑端右键即可复制下载链接,手机端长按可复制下载链接。推荐使用Aria2、Motrix下载,速度更快,使用方法请访问帮助页面。", + "DownloadTip" => "Tips: 电脑端右键即可复制下载链接,手机端长按可复制下载链接。推荐使用 Aria2、Motrix 下载,速度更快,使用方法请访问帮助页面。", "SendToAria2" => "发送到 Aria2", "Send" => "发送", "Close" => "关闭", @@ -71,16 +71,16 @@
  1. 前往 Motrix官网 下载 Motrix 对应版本
  2. 安装后运行Motrix。
  3. -
  4. 打开解析下载页面,点击 推送到Aria2(Motrix)
  5. +
  6. 打开解析下载页面,点击 推送到 Aria2(Motrix)
  7. 在“RPC地址”中输入 ws://localhost:16800/jsonrpc 并 点击发送。
-

aria2(推荐)

+

Aria2(推荐)

  1. 点击此处 下载 aria2.zip
  2. 解压 aria2.zip 文件并运行其中的 点此启动.bat
  3. -
  4. 打开解析下载页面,点击 推送到Aria2(Motrix)
  5. +
  6. 打开解析下载页面,点击 推送到 Aria2(Motrix)

IDM

@@ -210,7 +210,7 @@
  • Type ws://localhost:16800/jsonrpc in the "RPC地址".Click send button.
  • -

    aria2(Recommend)

    +

    Aria2(Recommend)

    1. Click here to download aria2.zip
    2. diff --git a/static/functions.js b/static/functions.js index a151dec5..812428d9 100644 --- a/static/functions.js +++ b/static/functions.js @@ -121,7 +121,7 @@ function addUri() { ws.onerror = event => { console.log(event); - Swal.fire('连接错误', 'aria2 连接错误,请打开控制台查看详情', 'error'); + Swal.fire('连接错误', 'Aria2 连接错误,请打开控制台查看详情', 'error'); }; ws.onopen = () => { ws.send(JSON.stringify(json)); } @@ -133,18 +133,18 @@ function addUri() { } switch (received_msg.method) { case "aria2.onDownloadStart": - Swal.fire('aria2 发送成功', 'aria2已经开始下载 ' + filename, 'success'); - + Swal.fire('Aria2 发送成功', 'Aria2 已经开始下载 ' + filename, 'success'); + localStorage.setItem('aria2wsurl', wsurl);// add aria2 config to SessionStorage - if (token != "" && token != null) localStorage.setItem('aria2token', token); + if (token != "" && token != null) localStorage.setItem('aria2token', 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: @@ -153,7 +153,4 @@ function addUri() { // version = received_msg.result.version; }; - ws.onclose = () => { - - }; } \ No newline at end of file From 0a66d424a50bcd2337aa54fd6ba8f246fc3f9245 Mon Sep 17 00:00:00 2001 From: yuantuo666 Date: Sat, 1 May 2021 22:06:53 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9ws(s)=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E7=9A=84=E6=AD=A3=E5=88=99=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/functions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/functions.js b/static/functions.js index 812428d9..dc4466de 100644 --- a/static/functions.js +++ b/static/functions.js @@ -112,7 +112,7 @@ function addUri() { json.params.unshift("token:" + token);//坑死了,必须要加在第一个 } - patt = /^wss?\:\/\/(([A-Za-z0-9]+[A-Za-z0-9\-]+[A-Za-z0-9]+)|([A-Za-z0-9]+))(\.([A-Za-z0-9]+[A-Za-z0-9\-]+[A-Za-z0-9]+)|([A-Za-z0-9]+))*(\.[A-Za-z0-9]{2,10})(\/.*)?$/; + patt = /^wss?\:\/\/([\w.]+\/?)\S*/; if (!patt.test(wsurl)) { Swal.fire('地址错误', 'ws 或 wss 输入错误,请检查是否填写正确', 'error'); return;