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 delNote = '/x/note/del';
|
||||||
|
|
||||||
|
static const String delPublishNote = '/x/note/publish/del';
|
||||||
|
|
||||||
static const String archiveNote = '/x/note/list/archive';
|
static const String archiveNote = '/x/note/list/archive';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,13 +270,17 @@ class Request {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static String headerUa({type = 'mob'}) {
|
static String headerUa({type = 'mob'}) {
|
||||||
return type == 'mob'
|
return switch (type) {
|
||||||
? Platform.isIOS
|
'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 (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'
|
: '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'
|
'android' =>
|
||||||
? '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',
|
||||||
: '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';
|
'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,
|
static String responseDecoder(List<int> responseBytes, RequestOptions options,
|
||||||
|
|||||||
@@ -1176,12 +1176,13 @@ class VideoHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Future delNote({
|
static Future delNote({
|
||||||
|
required bool isPublish,
|
||||||
required List noteIds,
|
required List noteIds,
|
||||||
}) async {
|
}) async {
|
||||||
final res = await Request().post(
|
final res = await Request().post(
|
||||||
Api.delNote,
|
isPublish ? Api.delPublishNote : Api.delNote,
|
||||||
data: {
|
data: {
|
||||||
'note_ids': noteIds.join(','),
|
isPublish ? 'cvids' : 'note_ids': noteIds.join(','),
|
||||||
'csrf': Accounts.main.csrf,
|
'csrf': Accounts.main.csrf,
|
||||||
},
|
},
|
||||||
options: Options(
|
options: Options(
|
||||||
|
|||||||
@@ -53,7 +53,11 @@ class FavNoteController extends MultiSelectController {
|
|||||||
List dataList = (loadingState.value as Success).response as List;
|
List dataList = (loadingState.value as Success).response as List;
|
||||||
Set removeList = dataList.where((item) => item['checked'] == true).toSet();
|
Set removeList = dataList.where((item) => item['checked'] == true).toSet();
|
||||||
final res = await VideoHttp.delNote(
|
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']) {
|
if (res['status']) {
|
||||||
List remainList = dataList.toSet().difference(removeList).toList();
|
List remainList = dataList.toSet().difference(removeList).toList();
|
||||||
loadingState.value = LoadingState.success(remainList);
|
loadingState.value = LoadingState.success(remainList);
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ class _NoteListPageState extends CommonSlidePageState<NoteListPage> {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
_key.currentState?.showBottomSheet(
|
_key.currentState?.showBottomSheet(
|
||||||
(context) => WebviewPageNew(
|
(context) => WebviewPageNew(
|
||||||
|
uaType: 'android',
|
||||||
oid: widget.oid,
|
oid: widget.oid,
|
||||||
title: widget.title,
|
title: widget.title,
|
||||||
url:
|
url:
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import 'dart:async';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:PiliPlus/http/init.dart';
|
import 'package:PiliPlus/http/init.dart';
|
||||||
import 'package:PiliPlus/http/video.dart';
|
|
||||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||||
import 'package:PiliPlus/utils/cache_manage.dart';
|
import 'package:PiliPlus/utils/cache_manage.dart';
|
||||||
@@ -193,20 +192,33 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
|
|||||||
_webViewController?.evaluateJavascript(source: """
|
_webViewController?.evaluateJavascript(source: """
|
||||||
Array.from(document.querySelectorAll('.ql-editor > p')).map(p => p.textContent).join('\\n');
|
Array.from(document.querySelectorAll('.ql-editor > p')).map(p => p.textContent).join('\\n');
|
||||||
""").then((value) {
|
""").then((value) {
|
||||||
try {
|
// try {
|
||||||
String? summary = (value as String?);
|
// String? summary = (value as String?);
|
||||||
if (summary?.isNotEmpty == true) {
|
// if (summary?.isNotEmpty == true) {
|
||||||
VideoHttp.addNote(
|
// VideoHttp.addNote(
|
||||||
oid: widget.oid!,
|
// oid: widget.oid!,
|
||||||
title: widget.title!,
|
// title: widget.title!,
|
||||||
summary: summary!,
|
// summary: summary!,
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
} catch (_) {}
|
// } catch (_) {}
|
||||||
Get.back();
|
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) {
|
onProgressChanged: (controller, progress) {
|
||||||
_progressStream.add(progress / 100);
|
_progressStream.add(progress / 100);
|
||||||
@@ -223,6 +235,11 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
|
|||||||
document.querySelector('.finish-btn').addEventListener('click', function() {
|
document.querySelector('.finish-btn').addEventListener('click', function() {
|
||||||
window.flutter_inappwebview.callHandler('finishButtonClicked');
|
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')) {
|
} else if (url.toString().startsWith('https://live.bilibili.com')) {
|
||||||
_webViewController?.evaluateJavascript(
|
_webViewController?.evaluateJavascript(
|
||||||
|
|||||||
Reference in New Issue
Block a user