diff --git a/lib/http/init.dart b/lib/http/init.dart index 89b31cf6..788db89a 100644 --- a/lib/http/init.dart +++ b/lib/http/init.dart @@ -284,7 +284,7 @@ class Request { token.cancel("cancelled"); } - String headerUa({type = 'mob'}) { + static String headerUa({type = 'mob'}) { String headerUa = ''; if (type == 'mob') { if (Platform.isIOS) { diff --git a/lib/http/video.dart b/lib/http/video.dart index 130b57f3..832c5192 100644 --- a/lib/http/video.dart +++ b/lib/http/video.dart @@ -820,12 +820,30 @@ class VideoHttp { // 操作用户关系 static Future relationMod( {required int mid, required int act, required int reSrc}) async { - var res = await Request().post(Api.relationMod, queryParameters: { - 'fid': mid, - 'act': act, - 're_src': reSrc, - 'csrf': await Request.getCsrf(), - }); + var res = await Request().post( + Api.relationMod, + data: { + 'fid': mid, + 'act': act, + 're_src': reSrc, + 'gaia_source': 'web_main', + 'spmid': '333.999.0.0', + 'extend_content': { + "entity": "user", + "entity_id": mid, + 'fp': Request.headerUa(type: 'pc'), + }, + 'csrf': await Request.getCsrf(), + }, + options: Options( + contentType: Headers.formUrlEncodedContentType, + headers: { + 'origin': 'https://space.bilibili.com', + 'referer': 'https://space.bilibili.com/$mid/dynamic', + 'user-agent': Request.headerUa(type: 'pc'), + }, + ), + ); if (res.data['code'] == 0) { return {'status': true}; } else { diff --git a/lib/pages/webview/webview_page.dart b/lib/pages/webview/webview_page.dart index ab76103a..890c6302 100644 --- a/lib/pages/webview/webview_page.dart +++ b/lib/pages/webview/webview_page.dart @@ -171,7 +171,7 @@ class _WebviewPageNewState extends State { useHybridComposition: false, algorithmicDarkeningAllowed: true, useShouldOverrideUrlLoading: true, - userAgent: Request().headerUa(type: uaType), + userAgent: Request.headerUa(type: uaType), mixedContentMode: MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW, ), initialUrlRequest: