mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 00:28:18 +08:00
feat: manual check dyn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -488,10 +488,11 @@ class _CreateDynPanelState extends CommonPublishPageState<CreateDynPanel> {
|
|||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
Get.back();
|
Get.back();
|
||||||
SmartDialog.showToast('发布成功');
|
SmartDialog.showToast('发布成功');
|
||||||
Future.wait([
|
Utils.insertCreatedDyn(result);
|
||||||
Utils.insertCreatedDyn(result),
|
Utils.checkCreatedDyn(
|
||||||
Utils.checkCreatedDyn(result, editController.text)
|
id: result['data']?['dyn_id'],
|
||||||
]);
|
dynText: editController.text,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
debugPrint('failed to publish: ${result['msg']}');
|
debugPrint('failed to publish: ${result['msg']}');
|
||||||
|
|||||||
@@ -386,10 +386,11 @@ class _RepostPanelState extends CommonPublishPageState<RepostPanel> {
|
|||||||
Get.back();
|
Get.back();
|
||||||
SmartDialog.showToast('转发成功');
|
SmartDialog.showToast('转发成功');
|
||||||
widget.callback?.call();
|
widget.callback?.call();
|
||||||
Future.wait([
|
Utils.insertCreatedDyn(result);
|
||||||
Utils.insertCreatedDyn(result),
|
Utils.checkCreatedDyn(
|
||||||
Utils.checkCreatedDyn(result, editController.text)
|
id: result['data']?['dyn_id'],
|
||||||
]);
|
dynText: editController.text,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:PiliPlus/utils/storage.dart';
|
|||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||||
@@ -22,6 +21,7 @@ class AuthorPanel extends StatelessWidget {
|
|||||||
final Function? addBannedList;
|
final Function? addBannedList;
|
||||||
final String? source;
|
final String? source;
|
||||||
final Function? onRemove;
|
final Function? onRemove;
|
||||||
|
|
||||||
const AuthorPanel({
|
const AuthorPanel({
|
||||||
super.key,
|
super.key,
|
||||||
required this.item,
|
required this.item,
|
||||||
@@ -310,6 +310,62 @@ class AuthorPanel extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
minLeadingWidth: 0,
|
minLeadingWidth: 0,
|
||||||
),
|
),
|
||||||
|
if (item.modules.moduleAuthor.mid == Accounts.main.mid) ...[
|
||||||
|
ListTile(
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
Utils.checkCreatedDyn(id: item.idStr, isManual: true);
|
||||||
|
},
|
||||||
|
minLeadingWidth: 0,
|
||||||
|
leading: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.shield_outlined, size: 19),
|
||||||
|
const Icon(Icons.published_with_changes_sharp, size: 12),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
title:
|
||||||
|
Text('检查动态', style: Theme.of(context).textTheme.titleSmall!),
|
||||||
|
),
|
||||||
|
if (onRemove != null)
|
||||||
|
ListTile(
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: const Text('确定删除该动态?'),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: Get.back,
|
||||||
|
child: Text(
|
||||||
|
'取消',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
onRemove?.call(item.idStr);
|
||||||
|
},
|
||||||
|
child: const Text('确定'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
minLeadingWidth: 0,
|
||||||
|
leading: Icon(Icons.delete_outline,
|
||||||
|
color: Theme.of(context).colorScheme.error, size: 19),
|
||||||
|
title: Text('删除',
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleSmall!
|
||||||
|
.copyWith(color: Theme.of(context).colorScheme.error)),
|
||||||
|
),
|
||||||
|
],
|
||||||
if (Accounts.main.isLogin)
|
if (Accounts.main.isLogin)
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
@@ -357,44 +413,6 @@ class AuthorPanel extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
minLeadingWidth: 0,
|
minLeadingWidth: 0,
|
||||||
),
|
),
|
||||||
if (item.modules.moduleAuthor.mid == Accounts.main.mid &&
|
|
||||||
onRemove != null)
|
|
||||||
ListTile(
|
|
||||||
onTap: () async {
|
|
||||||
Get.back();
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => AlertDialog(
|
|
||||||
title: const Text('确定删除该动态?'),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: Get.back,
|
|
||||||
child: Text(
|
|
||||||
'取消',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
Get.back();
|
|
||||||
onRemove?.call(item.idStr);
|
|
||||||
},
|
|
||||||
child: const Text('确定'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
));
|
|
||||||
},
|
|
||||||
minLeadingWidth: 0,
|
|
||||||
leading: Icon(Icons.delete_outline,
|
|
||||||
color: Theme.of(context).colorScheme.error, size: 19),
|
|
||||||
title: Text('删除',
|
|
||||||
style: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.titleSmall!
|
|
||||||
.copyWith(color: Theme.of(context).colorScheme.error)),
|
|
||||||
),
|
|
||||||
const Divider(thickness: 0.1, height: 1),
|
const Divider(thickness: 0.1, height: 1),
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: Get.back,
|
onTap: Get.back,
|
||||||
|
|||||||
@@ -123,6 +123,11 @@ class AccountManager extends Interceptor {
|
|||||||
}
|
}
|
||||||
return handler.next(options);
|
return handler.next(options);
|
||||||
} else {
|
} else {
|
||||||
|
if (account is AnonymousAccount) {
|
||||||
|
options.headers[HttpHeaders.cookieHeader] = '';
|
||||||
|
handler.next(options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
account.cookieJar.loadForRequest(options.uri).then((cookies) {
|
account.cookieJar.loadForRequest(options.uri).then((cookies) {
|
||||||
final previousCookies =
|
final previousCookies =
|
||||||
options.headers[HttpHeaders.cookieHeader] as String?;
|
options.headers[HttpHeaders.cookieHeader] as String?;
|
||||||
|
|||||||
@@ -472,12 +472,13 @@ class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future checkCreatedDyn(result, dynText) async {
|
static Future checkCreatedDyn({id, dynText, isManual}) async {
|
||||||
if (GStorage.enableCreateDynAntifraud) {
|
if (isManual == true || GStorage.enableCreateDynAntifraud) {
|
||||||
try {
|
try {
|
||||||
dynamic id = result['data']['dyn_id'];
|
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
await Future.delayed(const Duration(seconds: 5));
|
if (isManual != true) {
|
||||||
|
await Future.delayed(const Duration(seconds: 5));
|
||||||
|
}
|
||||||
dynamic res =
|
dynamic res =
|
||||||
await DynamicsHttp.dynamicDetail(id: id, clearCookie: true);
|
await DynamicsHttp.dynamicDetail(id: id, clearCookie: true);
|
||||||
showDialog(
|
showDialog(
|
||||||
@@ -485,11 +486,13 @@ class Utils {
|
|||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: Text('动态检查结果'),
|
title: Text('动态检查结果'),
|
||||||
content: SelectableText(
|
content: SelectableText(
|
||||||
'${res['status'] ? '无账号状态下找到了你的动态,动态正常!' : '你的动态被shadow ban(仅自己可见)!'} \n\n动态内容: $dynText'),
|
'${res['status'] ? '无账号状态下找到了你的动态,动态正常!' : '你的动态被shadow ban(仅自己可见)!'}${dynText != null ? ' \n\n动态内容: $dynText' : ''}'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (e) {
|
||||||
|
debugPrint('check dyn error: $e');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user