mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-20 17:30:13 +08:00
@@ -11,6 +11,7 @@ import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
|
||||
@@ -107,7 +108,7 @@ class AccountManager extends Interceptor {
|
||||
|
||||
// app端不需要管理cookie
|
||||
if (path.startsWith(HttpString.appBaseUrl)) {
|
||||
// debugPrint('is app: ${options.path}');
|
||||
// if (kDebugMode) debugPrint('is app: ${options.path}');
|
||||
// bytes是grpc响应
|
||||
if (options.responseType != ResponseType.bytes) {
|
||||
final dataPtr = (options.method == 'POST' && options.data is Map
|
||||
@@ -121,7 +122,7 @@ class AccountManager extends Interceptor {
|
||||
dataPtr['ts'] ??=
|
||||
(DateTime.now().millisecondsSinceEpoch ~/ 1000).toString();
|
||||
Utils.appSign(dataPtr);
|
||||
// debugPrint(dataPtr.toString());
|
||||
// if (kDebugMode) debugPrint(dataPtr.toString());
|
||||
}
|
||||
}
|
||||
return handler.next(options);
|
||||
@@ -213,7 +214,7 @@ class AccountManager extends Interceptor {
|
||||
'site/getCoin',
|
||||
];
|
||||
String url = err.requestOptions.uri.toString();
|
||||
debugPrint('🌹🌹ApiInterceptor: $url');
|
||||
if (kDebugMode) debugPrint('🌹🌹ApiInterceptor: $url');
|
||||
if (skipShow.any((i) => url.contains(i)) ||
|
||||
(url.contains('skipSegments') && err.requestOptions.method == 'GET')) {
|
||||
// skip
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/url_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:app_links/app_links.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -64,7 +65,7 @@ class PiliScheme {
|
||||
int? businessId,
|
||||
int? oid,
|
||||
}) async {
|
||||
// debugPrint('onAppLink: $uri');
|
||||
// if (kDebugMode) debugPrint('onAppLink: $uri');
|
||||
|
||||
final String scheme = uri.scheme;
|
||||
final String host = uri.host;
|
||||
@@ -459,7 +460,7 @@ class PiliScheme {
|
||||
return false;
|
||||
default:
|
||||
if (!selfHandle) {
|
||||
debugPrint('$uri');
|
||||
if (kDebugMode) debugPrint('$uri');
|
||||
SmartDialog.showToast('未知路径:$uri,请截图反馈给开发者');
|
||||
}
|
||||
return false;
|
||||
@@ -487,7 +488,7 @@ class PiliScheme {
|
||||
return true;
|
||||
}
|
||||
if (!selfHandle) {
|
||||
debugPrint('$uri');
|
||||
if (kDebugMode) debugPrint('$uri');
|
||||
SmartDialog.showToast('未知路径:$uri,请截图反馈给开发者');
|
||||
}
|
||||
return false;
|
||||
@@ -591,7 +592,7 @@ class PiliScheme {
|
||||
pathSegments.first == 'mobile' || pathSegments.first == 'h5'
|
||||
? pathSegments.getOrNull(1)
|
||||
: pathSegments.first;
|
||||
debugPrint('area: $area');
|
||||
if (kDebugMode) debugPrint('area: $area');
|
||||
switch (area) {
|
||||
case 'note' || 'note-app':
|
||||
String? id = uri.queryParameters['cvid'];
|
||||
@@ -649,7 +650,7 @@ class PiliScheme {
|
||||
return false;
|
||||
case 'bangumi':
|
||||
// www.bilibili.com/bangumi/play/ep{eid}?start_progress={offset}&thumb_up_dm_id={dmid}
|
||||
debugPrint('番剧');
|
||||
if (kDebugMode) debugPrint('番剧');
|
||||
String? id = RegExp(r'(ss|ep)\d+').firstMatch(path)?.group(0);
|
||||
if (id != null) {
|
||||
bool isSeason = id.startsWith('ss');
|
||||
@@ -664,7 +665,7 @@ class PiliScheme {
|
||||
launchURL();
|
||||
return false;
|
||||
case 'video':
|
||||
debugPrint('投稿');
|
||||
if (kDebugMode) debugPrint('投稿');
|
||||
final Map<String, dynamic> map = IdUtils.matchAvorBv(input: path);
|
||||
if (map.isNotEmpty) {
|
||||
final queryParameters = uri.queryParameters;
|
||||
@@ -695,7 +696,7 @@ class PiliScheme {
|
||||
launchURL();
|
||||
return false;
|
||||
}
|
||||
debugPrint('专栏');
|
||||
if (kDebugMode) debugPrint('专栏');
|
||||
String? id =
|
||||
RegExp(r'cv(\d+)', caseSensitive: false).firstMatch(path)?.group(1);
|
||||
if (id != null) {
|
||||
@@ -712,7 +713,7 @@ class PiliScheme {
|
||||
launchURL();
|
||||
return false;
|
||||
case 'space':
|
||||
debugPrint('个人空间');
|
||||
if (kDebugMode) debugPrint('个人空间');
|
||||
String? mid = uriDigitRegExp.firstMatch(path)?.group(1);
|
||||
if (mid != null) {
|
||||
PageUtils.toDupNamed(
|
||||
|
||||
@@ -25,6 +25,7 @@ import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/url_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:floating/floating.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show FilteringTextInputFormatter;
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -34,7 +35,7 @@ import 'package:url_launcher/url_launcher.dart';
|
||||
class PageUtils {
|
||||
static Future<void> pmShare(BuildContext context,
|
||||
{required Map content}) async {
|
||||
// debugPrint(content.toString());
|
||||
// if (kDebugMode) debugPrint(content.toString());
|
||||
|
||||
int? selectedIndex;
|
||||
List<UserModel> userList = <UserModel>[];
|
||||
@@ -372,7 +373,7 @@ class PageUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
// debugPrint('pushDynDetail: ${item.type}');
|
||||
// if (kDebugMode) debugPrint('pushDynDetail: ${item.type}');
|
||||
|
||||
switch (item.type) {
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
@@ -431,7 +432,7 @@ class PageUtils {
|
||||
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_PGC':
|
||||
debugPrint('番剧');
|
||||
if (kDebugMode) debugPrint('番剧');
|
||||
SmartDialog.showToast('暂未支持的类型,请联系开发者');
|
||||
break;
|
||||
|
||||
@@ -473,7 +474,7 @@ class PageUtils {
|
||||
|
||||
/// 番剧查看
|
||||
case 'DYNAMIC_TYPE_PGC_UNION':
|
||||
debugPrint('DYNAMIC_TYPE_PGC_UNION 番剧');
|
||||
if (kDebugMode) debugPrint('DYNAMIC_TYPE_PGC_UNION 番剧');
|
||||
DynamicArchiveModel pgc = item.modules.moduleDynamic!.major!.pgc!;
|
||||
if (pgc.epid != null) {
|
||||
viewBangumi(epId: pgc.epid);
|
||||
@@ -769,7 +770,7 @@ class PageUtils {
|
||||
} catch (e) {
|
||||
SmartDialog.dismiss();
|
||||
SmartDialog.showToast('$e');
|
||||
debugPrint('$e');
|
||||
if (kDebugMode) debugPrint('$e');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:PiliPlus/utils/accounts/account.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart' show Accounts;
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
|
||||
@@ -89,7 +90,7 @@ class ReplyUtils {
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
debugPrint('biliSendCommAntifraud: $e');
|
||||
if (kDebugMode) debugPrint('biliSendCommAntifraud: $e');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import 'package:PiliPlus/pages/group_panel/view.dart';
|
||||
import 'package:PiliPlus/pages/later/controller.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -255,7 +256,7 @@ class RequestUtils {
|
||||
// return jsonDecode(
|
||||
// Uri.decodeComponent(scriptElement?.text ?? ''))['access_id'];
|
||||
// } catch (e) {
|
||||
// debugPrint('failed to get wwebid: $e');
|
||||
// if (kDebugMode) debugPrint('failed to get wwebid: $e');
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
@@ -279,7 +280,7 @@ class RequestUtils {
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('create dyn $e');
|
||||
if (kDebugMode) debugPrint('create dyn $e');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,7 +302,7 @@ class RequestUtils {
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('check dyn error: $e');
|
||||
if (kDebugMode) debugPrint('check dyn error: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -473,7 +474,7 @@ class RequestUtils {
|
||||
SmartDialog.showToast('关闭验证');
|
||||
},
|
||||
onResult: (Map<String, dynamic> message) async {
|
||||
debugPrint("Captcha result: $message");
|
||||
if (kDebugMode) debugPrint("Captcha result: $message");
|
||||
String code = message["code"];
|
||||
if (code == "1") {
|
||||
// 发送 message["result"] 中的数据向 B 端的业务服务接口进行查询
|
||||
@@ -502,7 +503,7 @@ class RequestUtils {
|
||||
}
|
||||
} else {
|
||||
// 终端用户完成验证失败,自动重试 If the verification fails, it will be automatically retried.
|
||||
debugPrint("Captcha result code : $code");
|
||||
if (kDebugMode) debugPrint("Captcha result code : $code");
|
||||
}
|
||||
},
|
||||
onError: (Map<String, dynamic> message) {
|
||||
|
||||
@@ -36,6 +36,7 @@ import 'package:PiliPlus/utils/global_data.dart';
|
||||
import 'package:PiliPlus/utils/login_utils.dart';
|
||||
import 'package:PiliPlus/utils/set_int_adapter.dart';
|
||||
import 'package:cookie_jar/cookie_jar.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
@@ -909,7 +910,7 @@ class Accounts {
|
||||
final String tempPath = "${tempDir.path}/.plpl/";
|
||||
final Directory dir = Directory(tempPath);
|
||||
if (dir.existsSync()) {
|
||||
debugPrint('migrating...');
|
||||
if (kDebugMode) debugPrint('migrating...');
|
||||
final cookieJar =
|
||||
PersistCookieJar(ignoreExpires: true, storage: FileStorage(tempPath));
|
||||
await cookieJar.forceInit();
|
||||
@@ -931,7 +932,7 @@ class Accounts {
|
||||
localAccessKey['refresh'], AccountType.values.toSet())
|
||||
.onChange()
|
||||
]);
|
||||
debugPrint('migrated successfully');
|
||||
if (kDebugMode) debugPrint('migrated successfully');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,13 +62,6 @@ class ThemeUtils {
|
||||
contentTextStyle: TextStyle(color: colorScheme.secondary),
|
||||
elevation: 20,
|
||||
),
|
||||
pageTransitionsTheme: const PageTransitionsTheme(
|
||||
builders: <TargetPlatform, PageTransitionsBuilder>{
|
||||
TargetPlatform.android: ZoomPageTransitionsBuilder(
|
||||
allowEnterRouteSnapshotting: false,
|
||||
),
|
||||
},
|
||||
),
|
||||
popupMenuTheme: PopupMenuThemeData(
|
||||
surfaceTintColor: isDynamic ? colorScheme.onSurfaceVariant : null,
|
||||
),
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
|
||||
@@ -27,7 +28,7 @@ class UrlUtils {
|
||||
),
|
||||
);
|
||||
redirectUrl = response.headers['location']?.firstOrNull;
|
||||
debugPrint('redirectUrl: $redirectUrl');
|
||||
if (kDebugMode) debugPrint('redirectUrl: $redirectUrl');
|
||||
if (redirectUrl != null && !redirectUrl.startsWith('http')) {
|
||||
redirectUrl = Uri.parse(url).resolve(redirectUrl).toString();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -207,7 +208,7 @@ class Utils {
|
||||
number *= getUnit(match.group(2));
|
||||
return number.toInt();
|
||||
} catch (e) {
|
||||
debugPrint('parse failed: "$numberStr" : $e');
|
||||
if (kDebugMode) debugPrint('parse failed: "$numberStr" : $e');
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -497,7 +498,7 @@ class Utils {
|
||||
|
||||
// 检查更新
|
||||
static Future<void> checkUpdate([bool isAuto = true]) async {
|
||||
if (BuildConfig.isDebug) return;
|
||||
if (kDebugMode) return;
|
||||
SmartDialog.dismiss();
|
||||
try {
|
||||
final res = await Request().get(Api.latestApp, uaType: 'mob');
|
||||
@@ -581,7 +582,7 @@ class Utils {
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('failed to check update: $e');
|
||||
if (kDebugMode) debugPrint('failed to check update: $e');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@ class VideoUtils {
|
||||
if (videoUrl.isNullOrEmpty) {
|
||||
return "";
|
||||
}
|
||||
// debugPrint("videoUrl:$videoUrl");
|
||||
// if (kDebugMode) debugPrint("videoUrl:$videoUrl");
|
||||
|
||||
String defaultCDNHost = CDNService.fromCode(defaultCDNService).host;
|
||||
// debugPrint("defaultCDNHost:$defaultCDNHost");
|
||||
// if (kDebugMode) debugPrint("defaultCDNHost:$defaultCDNHost");
|
||||
if (videoUrl!.contains("szbdyd.com")) {
|
||||
final uri = Uri.parse(videoUrl);
|
||||
String hostname = uri.queryParameters['xy_usource'] ?? defaultCDNHost;
|
||||
@@ -53,7 +53,7 @@ class VideoUtils {
|
||||
// videoUrl =
|
||||
// 'https://proxy-tf-all-ws.bilivideo.com/?url=${Uri.encodeComponent(videoUrl)}';
|
||||
}
|
||||
// debugPrint("videoUrl:$videoUrl");
|
||||
// if (kDebugMode) debugPrint("videoUrl:$videoUrl");
|
||||
|
||||
// /// 先获取backupUrl 一般是upgcxcode地址 播放更稳定
|
||||
// if (item is VideoItem) {
|
||||
|
||||
Reference in New Issue
Block a user