mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-19 01:20:08 +08:00
[update] Version-2.0.2.221025
This commit is contained in:
parent
5b9033f519
commit
851568fd4c
@ -16,7 +16,7 @@
|
||||
|
||||
<p align="center">
|
||||
|
||||
<img src="https://img.shields.io/badge/Version-2.0.0.220911-orange.svg?longCache=true&style=for-the-badge">
|
||||
<img src="https://img.shields.io/badge/Version-2.0.2.221025-orange.svg?longCache=true&style=for-the-badge">
|
||||
<img src="https://img.shields.io/badge/PHP-8.1+-green.svg?longCache=true&style=for-the-badge">
|
||||
<img src="https://img.shields.io/badge/Composer-latest-blueviolet.svg?longCache=true&style=for-the-badge">
|
||||
<img src="https://img.shields.io/badge/License-mit-blue.svg?longCache=true&style=for-the-badge">
|
||||
|
||||
@ -8,6 +8,27 @@
|
||||
|
||||
[comment]: <> (</details>)
|
||||
|
||||
|
||||
|
||||
## v2.0.2.221025 alpha (2022-10-25)
|
||||
|
||||
### Added
|
||||
|
||||
-
|
||||
|
||||
### Changed
|
||||
|
||||
-
|
||||
|
||||
### Fixed
|
||||
|
||||
- 尝试修复主站部分功能`账号异常,操作失败`
|
||||
-
|
||||
|
||||
### Remarks
|
||||
|
||||
-
|
||||
|
||||
## v2.0.1.220911 alpha (2022-09-11)
|
||||
|
||||
### Added
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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日"
|
||||
}
|
||||
|
||||
33
src/Api/WWW/ApiMain.php
Normal file
33
src/Api/WWW/ApiMain.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Website: https://mudew.com/
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2022 ~ 2023
|
||||
*
|
||||
* _____ _ _ _ _ _ _____ _ _____ _____ _____
|
||||
* | _ \ | | | | | | | | | | | ____| | | | _ \ | ____| | _ \ & /l、
|
||||
* | |_| | | | | | | | | |_| | | |__ | | | |_| | | |__ | |_| | (゚、 。 7
|
||||
* | _ { | | | | | | | _ | | __| | | | ___/ | __| | _ / \、゙ ~ヽ *
|
||||
* | |_| | | | | |___ | | | | | | | |___ | |___ | | | |___ | | \ \ じしf_, )ノ
|
||||
* |_____/ |_| |_____| |_| |_| |_| |_____| |_____| |_| |_____| |_| \_\
|
||||
*/
|
||||
|
||||
namespace Bhp\Api\WWW;
|
||||
|
||||
use Bhp\Request\Request;
|
||||
|
||||
class ApiMain
|
||||
{
|
||||
/**
|
||||
* 主站主页
|
||||
* @return array|mixed
|
||||
*/
|
||||
public static function home(): mixed
|
||||
{
|
||||
$url = 'https://www.bilibili.com/';
|
||||
return Request::headers('pc', $url);
|
||||
}
|
||||
}
|
||||
@ -172,7 +172,12 @@ class Request extends SingleTon
|
||||
];
|
||||
$default_headers = ${$os . "_headers"} ?? $other_headers;
|
||||
if (in_array($os, ['app', 'pc']) && getU('cookie') != "") {
|
||||
$default_headers['Cookie'] = getU('cookie');
|
||||
// patch cookie
|
||||
if ($os == 'pc' && getU('pc_cookie') != "") {
|
||||
$default_headers['Cookie'] = getU('pc_cookie');
|
||||
} else {
|
||||
$default_headers['Cookie'] = getU('cookie');
|
||||
}
|
||||
}
|
||||
//
|
||||
$this->setRequest($request_id, 'headers', array_merge($default_headers, $headers));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user