mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
@@ -735,5 +735,7 @@ class Api {
|
||||
|
||||
static const String delNote = '/x/note/del';
|
||||
|
||||
static const String delPublishNote = '/x/note/publish/del';
|
||||
|
||||
static const String archiveNote = '/x/note/list/archive';
|
||||
}
|
||||
|
||||
@@ -270,13 +270,17 @@ class Request {
|
||||
}
|
||||
|
||||
static String headerUa({type = 'mob'}) {
|
||||
return type == 'mob'
|
||||
? Platform.isIOS
|
||||
? 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 BiliApp/62000200'
|
||||
: 'Mozilla/5.0 (Linux; Android 10; SM-G975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Mobile Safari/537.36'
|
||||
: type == 'ios'
|
||||
? 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 BiliApp/62000200'
|
||||
: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15';
|
||||
return switch (type) {
|
||||
'mob' => Platform.isIOS
|
||||
? 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 BiliApp/62000200'
|
||||
: 'Mozilla/5.0 (Linux; Android 10; SM-G975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Mobile Safari/537.36',
|
||||
'android' =>
|
||||
'Mozilla/5.0 (Linux; Android 10; SM-G975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Mobile Safari/537.36',
|
||||
'ios' =>
|
||||
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 BiliApp/62000200',
|
||||
_ =>
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15'
|
||||
};
|
||||
}
|
||||
|
||||
static String responseDecoder(List<int> responseBytes, RequestOptions options,
|
||||
|
||||
@@ -1176,12 +1176,13 @@ class VideoHttp {
|
||||
}
|
||||
|
||||
static Future delNote({
|
||||
required bool isPublish,
|
||||
required List noteIds,
|
||||
}) async {
|
||||
final res = await Request().post(
|
||||
Api.delNote,
|
||||
isPublish ? Api.delPublishNote : Api.delNote,
|
||||
data: {
|
||||
'note_ids': noteIds.join(','),
|
||||
isPublish ? 'cvids' : 'note_ids': noteIds.join(','),
|
||||
'csrf': Accounts.main.csrf,
|
||||
},
|
||||
options: Options(
|
||||
|
||||
@@ -53,7 +53,11 @@ class FavNoteController extends MultiSelectController {
|
||||
List dataList = (loadingState.value as Success).response as List;
|
||||
Set removeList = dataList.where((item) => item['checked'] == true).toSet();
|
||||
final res = await VideoHttp.delNote(
|
||||
noteIds: removeList.map((item) => item['note_id']).toList());
|
||||
isPublish: isPublish,
|
||||
noteIds: removeList
|
||||
.map((item) => isPublish ? item['cvid'] : item['note_id'])
|
||||
.toList(),
|
||||
);
|
||||
if (res['status']) {
|
||||
List remainList = dataList.toSet().difference(removeList).toList();
|
||||
loadingState.value = LoadingState.success(remainList);
|
||||
|
||||
@@ -111,6 +111,7 @@ class _NoteListPageState extends CommonSlidePageState<NoteListPage> {
|
||||
onPressed: () {
|
||||
_key.currentState?.showBottomSheet(
|
||||
(context) => WebviewPageNew(
|
||||
uaType: 'android',
|
||||
oid: widget.oid,
|
||||
title: widget.title,
|
||||
url:
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:PiliPlus/http/init.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/cache_manage.dart';
|
||||
@@ -193,20 +192,33 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
|
||||
_webViewController?.evaluateJavascript(source: """
|
||||
Array.from(document.querySelectorAll('.ql-editor > p')).map(p => p.textContent).join('\\n');
|
||||
""").then((value) {
|
||||
try {
|
||||
String? summary = (value as String?);
|
||||
if (summary?.isNotEmpty == true) {
|
||||
VideoHttp.addNote(
|
||||
oid: widget.oid!,
|
||||
title: widget.title!,
|
||||
summary: summary!,
|
||||
);
|
||||
}
|
||||
} catch (_) {}
|
||||
// try {
|
||||
// String? summary = (value as String?);
|
||||
// if (summary?.isNotEmpty == true) {
|
||||
// VideoHttp.addNote(
|
||||
// oid: widget.oid!,
|
||||
// title: widget.title!,
|
||||
// summary: summary!,
|
||||
// );
|
||||
// }
|
||||
// } catch (_) {}
|
||||
Get.back();
|
||||
});
|
||||
},
|
||||
);
|
||||
_webViewController?.addJavaScriptHandler(
|
||||
handlerName: 'infoBarClicked',
|
||||
callback: (args) async {
|
||||
WebUri? uri = await _webViewController?.getUrl();
|
||||
if (uri != null) {
|
||||
String? oid =
|
||||
RegExp(r'oid=(\d+)').firstMatch(uri.toString())?.group(1);
|
||||
if (oid != null) {
|
||||
PiliScheme.videoPush(int.parse(oid), null);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
onProgressChanged: (controller, progress) {
|
||||
_progressStream.add(progress / 100);
|
||||
@@ -223,6 +235,11 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
|
||||
document.querySelector('.finish-btn').addEventListener('click', function() {
|
||||
window.flutter_inappwebview.callHandler('finishButtonClicked');
|
||||
});
|
||||
""");
|
||||
_webViewController?.evaluateJavascript(source: """
|
||||
document.querySelector('.info-bar').addEventListener('click', function() {
|
||||
window.flutter_inappwebview.callHandler('infoBarClicked');
|
||||
});
|
||||
""");
|
||||
} else if (url.toString().startsWith('https://live.bilibili.com')) {
|
||||
_webViewController?.evaluateJavascript(
|
||||
|
||||
Reference in New Issue
Block a user