From 851568fd4c5fe6a23f1140543d8ac893b84acbd4 Mon Sep 17 00:00:00 2001 From: Lkeme <19500576+lkeme@users.noreply.github.com> Date: Tue, 25 Oct 2022 13:36:25 +0800 Subject: [PATCH] [update] Version-2.0.2.221025 --- README.md | 2 +- docs/CHANGELOG.md | 21 +++++++++++++++++++++ plugin/Login/Login.php | 19 +++++++++++++++++++ resources/version.json | 6 +++--- src/Api/WWW/ApiMain.php | 33 +++++++++++++++++++++++++++++++++ src/Request/Request.php | 7 ++++++- 6 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 src/Api/WWW/ApiMain.php diff --git a/README.md b/README.md index e1428ba..fbcde74 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@
-
+
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 1ebc696..2ad74be 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -8,6 +8,27 @@
[comment]: <> ()
+
+
+## v2.0.2.221025 alpha (2022-10-25)
+
+### Added
+
+-
+
+### Changed
+
+-
+
+### Fixed
+
+- 尝试修复主站部分功能`账号异常,操作失败`
+-
+
+### Remarks
+
+-
+
## v2.0.1.220911 alpha (2022-09-11)
### Added
diff --git a/plugin/Login/Login.php b/plugin/Login/Login.php
index 9c1cec1..cc7b5a1 100644
--- a/plugin/Login/Login.php
+++ b/plugin/Login/Login.php
@@ -19,6 +19,7 @@ use Bhp\Api\Passport\ApiCaptcha;
use Bhp\Api\Passport\ApiLogin;
use Bhp\Api\Passport\ApiOauth2;
use Bhp\Api\PassportTv\ApiQrcode;
+use Bhp\Api\WWW\ApiMain;
use Bhp\Cache\Cache;
use Bhp\Log\Log;
use Bhp\Plugin\BasePlugin;
@@ -224,6 +225,22 @@ class Login extends BasePlugin
return true;
}
+ /**
+ * cookie补丁
+ * @return string
+ */
+ public function patchCookie(): string
+ {
+ $response = ApiMain::home();
+ $headers = $response['Set-Cookie'];
+ $cookies = [];
+ foreach ($headers as $header) {
+ preg_match_all('/^(.*);/iU', $header, $cookie);
+ $cookies[] = $cookie[0][0];
+ }
+ return implode("", array_reverse($cookies));
+ }
+
/**
* 更新登录信息
* @param array $data
@@ -239,6 +256,8 @@ class Login extends BasePlugin
//
$cookie = $this->formatCookie($data['data']['cookie_info']['cookies']);
$this->updateInfo('cookie', $cookie);
+ // patch cookie
+ $this->updateInfo('pc_cookie', $cookie . $this->patchCookie());
//
$user = User::parseCookie();
$this->updateInfo('uid', $user['uid'], false);
diff --git a/resources/version.json b/resources/version.json
index d8df29b..6133c6e 100644
--- a/resources/version.json
+++ b/resources/version.json
@@ -7,10 +7,10 @@
"dev_raw_url": "https://gh.notifyplus.cf/https://github.com/lkeme/BiliHelper-personal/blob/dev/resources/version.json",
"master_purge_url": "https://cdn.staticaly.com/gh/lkeme/BiliHelper-personal/master/resources/version.json",
"dev_purge_url": "https://cdn.staticaly.com/gh/lkeme/BiliHelper-personal/dev/resources/version.json",
- "version": "2.0.1.220911",
+ "version": "2.0.2.221025",
"des": "程序有更新,请及时线上查看更新哦~",
- "time": "2022年09月11日",
+ "time": "2022年10月25日",
"ini_version": "0.0.1",
"ini_des": "配置有更新,请及时线上查看更新哦~",
- "ini_time": "2022年09月11日"
+ "ini_time": "2022年10月25日"
}
diff --git a/src/Api/WWW/ApiMain.php b/src/Api/WWW/ApiMain.php
new file mode 100644
index 0000000..cdf9c8c
--- /dev/null
+++ b/src/Api/WWW/ApiMain.php
@@ -0,0 +1,33 @@
+setRequest($request_id, 'headers', array_merge($default_headers, $headers));