mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-15 05:33:59 +08:00
Compare commits
2 Commits
1.1.3.39-f
...
1.1.3.39-f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b43c07bd51 | ||
|
|
7cdcd6df97 |
@@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:PiliPlus/http/api.dart';
|
||||||
import 'package:PiliPlus/http/constants.dart';
|
import 'package:PiliPlus/http/constants.dart';
|
||||||
import 'package:PiliPlus/http/retry_interceptor.dart';
|
import 'package:PiliPlus/http/retry_interceptor.dart';
|
||||||
import 'package:PiliPlus/http/user.dart';
|
import 'package:PiliPlus/http/user.dart';
|
||||||
@@ -11,6 +12,7 @@ import 'package:PiliPlus/utils/accounts/account_manager/account_mgr.dart';
|
|||||||
import 'package:PiliPlus/utils/global_data.dart';
|
import 'package:PiliPlus/utils/global_data.dart';
|
||||||
import 'package:PiliPlus/utils/storage.dart';
|
import 'package:PiliPlus/utils/storage.dart';
|
||||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||||
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
import 'package:archive/archive.dart';
|
import 'package:archive/archive.dart';
|
||||||
import 'package:brotli/brotli.dart';
|
import 'package:brotli/brotli.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
@@ -62,36 +64,35 @@ class Request {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static Future<void> buvidActive(Account account) async {
|
static Future<void> buvidActive(Account account) async {
|
||||||
// // 这样线程不安全, 但仍按预期进行
|
// 这样线程不安全, 但仍按预期进行
|
||||||
// if (account.activited) return;
|
if (account.activited) return;
|
||||||
// account.activited = true;
|
account.activited = true;
|
||||||
// try {
|
try {
|
||||||
// final html = await Request().get(Api.dynamicSpmPrefix,
|
// final html = await Request().get(Api.dynamicSpmPrefix,
|
||||||
// options: Options(extra: {'account': account}));
|
// options: Options(extra: {'account': account}));
|
||||||
// final String spmPrefix = _spmPrefixExp.firstMatch(html.data)!.group(1)!;
|
// final String spmPrefix = _spmPrefixExp.firstMatch(html.data)!.group(1)!;
|
||||||
// final String randPngEnd = base64.encode(
|
final String randPngEnd = base64.encode(
|
||||||
// List<int>.generate(32, (_) => _rand.nextInt(256)) +
|
List<int>.generate(32, (_) => Utils.random.nextInt(256)) +
|
||||||
// List<int>.filled(4, 0) +
|
List<int>.filled(4, 0) +
|
||||||
// [73, 69, 78, 68] +
|
[73, 69, 78, 68] +
|
||||||
// List<int>.generate(4, (_) => _rand.nextInt(256)));
|
List<int>.generate(4, (_) => Utils.random.nextInt(256)));
|
||||||
|
|
||||||
// String jsonData = json.encode({
|
String jsonData = json.encode({
|
||||||
// '3064': 1,
|
'3064': 1,
|
||||||
// '39c8': '$spmPrefix.fp.risk',
|
'39c8':
|
||||||
// '3c43': {
|
'${account is AnonymousAccount ? '333.1365' : '333.788'}.fp.risk',
|
||||||
// 'adca': 'Linux',
|
'3c43': {
|
||||||
// 'bfe9': randPngEnd.substring(randPngEnd.length - 50),
|
'adca': 'Linux',
|
||||||
// },
|
'bfe9': randPngEnd.substring(randPngEnd.length - 50),
|
||||||
// });
|
},
|
||||||
|
});
|
||||||
|
|
||||||
// await Request().post(Api.activateBuvidApi,
|
await Request().post(Api.activateBuvidApi,
|
||||||
// data: {'payload': jsonData},
|
data: {'payload': jsonData},
|
||||||
// options: Options(contentType: Headers.jsonContentType));
|
options: Options(contentType: Headers.jsonContentType));
|
||||||
// } catch (e) {
|
} catch (_) {}
|
||||||
// log("setCookie, $e");
|
}
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* config it and create
|
* config it and create
|
||||||
|
|||||||
@@ -47,115 +47,109 @@ Widget module(
|
|||||||
orig.modules.moduleDynamic?.major?.type == 'MAJOR_TYPE_NONE';
|
orig.modules.moduleDynamic?.major?.type == 'MAJOR_TYPE_NONE';
|
||||||
late final isNormalAuth =
|
late final isNormalAuth =
|
||||||
orig.modules.moduleAuthor!.type == 'AUTHOR_TYPE_NORMAL';
|
orig.modules.moduleAuthor!.type == 'AUTHOR_TYPE_NORMAL';
|
||||||
return orig.type == 'DYNAMIC_TYPE_NONE'
|
if (isNoneMajor) {
|
||||||
? const SizedBox.shrink()
|
if (orig.modules.moduleDynamic?.major?.none?.tips?.isNotEmpty == true) {
|
||||||
: InkWell(
|
return Container(
|
||||||
onTap: isNoneMajor
|
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 8),
|
||||||
? null
|
color: theme.dividerColor.withValues(alpha: 0.08),
|
||||||
: () => PageUtils.pushDynDetail(orig, floor + 1),
|
child: Row(
|
||||||
onLongPress: isNoneMajor
|
children: [
|
||||||
? null
|
Icon(
|
||||||
: () {
|
Icons.error,
|
||||||
String? title, cover, bvid;
|
size: 18,
|
||||||
late var origMajor = orig.modules.moduleDynamic?.major;
|
color: theme.colorScheme.outline,
|
||||||
late var major = item.modules.moduleDynamic?.major;
|
),
|
||||||
switch (orig.type) {
|
const SizedBox(width: 5),
|
||||||
case 'DYNAMIC_TYPE_AV':
|
Text(
|
||||||
title = origMajor?.archive?.title;
|
orig.modules.moduleDynamic!.major!.none!.tips!,
|
||||||
cover = origMajor?.archive?.cover;
|
style: TextStyle(color: theme.colorScheme.outline),
|
||||||
bvid = origMajor?.archive?.bvid;
|
),
|
||||||
break;
|
],
|
||||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
),
|
||||||
title = origMajor?.ugcSeason?.title;
|
);
|
||||||
cover = origMajor?.ugcSeason?.cover;
|
} else {
|
||||||
bvid = origMajor?.ugcSeason?.bvid;
|
return const SizedBox.shrink();
|
||||||
break;
|
}
|
||||||
case 'DYNAMIC_TYPE_PGC' || 'DYNAMIC_TYPE_PGC_UNION':
|
}
|
||||||
title = origMajor?.pgc?.title;
|
return InkWell(
|
||||||
cover = origMajor?.pgc?.cover;
|
onTap: () => PageUtils.pushDynDetail(orig, floor + 1),
|
||||||
break;
|
onLongPress: () {
|
||||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
String? title, cover, bvid;
|
||||||
title = major?.liveRcmd?.title;
|
late var origMajor = orig.modules.moduleDynamic?.major;
|
||||||
cover = major?.liveRcmd?.cover;
|
late var major = item.modules.moduleDynamic?.major;
|
||||||
break;
|
switch (orig.type) {
|
||||||
case 'DYNAMIC_TYPE_LIVE':
|
case 'DYNAMIC_TYPE_AV':
|
||||||
title = major?.live?.title;
|
title = origMajor?.archive?.title;
|
||||||
cover = major?.live?.cover;
|
cover = origMajor?.archive?.cover;
|
||||||
break;
|
bvid = origMajor?.archive?.bvid;
|
||||||
default:
|
break;
|
||||||
return;
|
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||||
}
|
title = origMajor?.ugcSeason?.title;
|
||||||
imageSaveDialog(
|
cover = origMajor?.ugcSeason?.cover;
|
||||||
title: title,
|
bvid = origMajor?.ugcSeason?.bvid;
|
||||||
cover: cover,
|
break;
|
||||||
bvid: bvid,
|
case 'DYNAMIC_TYPE_PGC' || 'DYNAMIC_TYPE_PGC_UNION':
|
||||||
);
|
title = origMajor?.pgc?.title;
|
||||||
},
|
cover = origMajor?.pgc?.cover;
|
||||||
child: Container(
|
break;
|
||||||
padding:
|
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||||
const EdgeInsets.symmetric(horizontal: 15, vertical: 8),
|
title = major?.liveRcmd?.title;
|
||||||
color: theme.dividerColor.withValues(alpha: 0.08),
|
cover = major?.liveRcmd?.cover;
|
||||||
child: isNoneMajor
|
break;
|
||||||
? Row(
|
case 'DYNAMIC_TYPE_LIVE':
|
||||||
children: [
|
title = major?.live?.title;
|
||||||
Icon(
|
cover = major?.live?.cover;
|
||||||
Icons.error,
|
break;
|
||||||
size: 18,
|
default:
|
||||||
color: theme.colorScheme.outline,
|
return;
|
||||||
),
|
}
|
||||||
const SizedBox(width: 5),
|
imageSaveDialog(
|
||||||
Text(
|
title: title,
|
||||||
orig.modules.moduleDynamic?.major?.none?.tips ??
|
cover: cover,
|
||||||
'NONE',
|
bvid: bvid,
|
||||||
style: TextStyle(color: theme.colorScheme.outline),
|
);
|
||||||
),
|
},
|
||||||
],
|
child: Container(
|
||||||
)
|
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 8),
|
||||||
: Column(
|
color: theme.dividerColor.withValues(alpha: 0.08),
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Row(
|
children: [
|
||||||
children: [
|
Row(
|
||||||
GestureDetector(
|
children: [
|
||||||
onTap: isNormalAuth
|
GestureDetector(
|
||||||
? () => Get.toNamed(
|
onTap: isNormalAuth
|
||||||
'/member?mid=${orig.modules.moduleAuthor!.mid}')
|
? () => Get.toNamed(
|
||||||
: null,
|
'/member?mid=${orig.modules.moduleAuthor!.mid}')
|
||||||
child: Text(
|
: null,
|
||||||
'${isNormalAuth ? '@' : ''}${orig.modules.moduleAuthor!.name}',
|
child: Text(
|
||||||
style: TextStyle(
|
'${isNormalAuth ? '@' : ''}${orig.modules.moduleAuthor!.name}',
|
||||||
color: theme.colorScheme.primary),
|
style: TextStyle(color: theme.colorScheme.primary),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
Text(
|
Text(
|
||||||
DateUtil.dateFormat(
|
DateUtil.dateFormat(orig.modules.moduleAuthor!.pubTs),
|
||||||
orig.modules.moduleAuthor!.pubTs),
|
style: TextStyle(
|
||||||
style: TextStyle(
|
color: theme.colorScheme.outline,
|
||||||
color: theme.colorScheme.outline,
|
fontSize: theme.textTheme.labelSmall!.fontSize),
|
||||||
fontSize:
|
),
|
||||||
theme.textTheme.labelSmall!.fontSize),
|
],
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 5),
|
|
||||||
content(
|
|
||||||
theme, isSave, context, orig, isDetail, callback,
|
|
||||||
floor: floor + 1),
|
|
||||||
module(
|
|
||||||
theme, isSave, orig, context, isDetail, callback,
|
|
||||||
floor: floor + 1),
|
|
||||||
if (orig.modules.moduleDynamic?.additional != null)
|
|
||||||
addWidget(theme, orig, context, floor: floor + 1),
|
|
||||||
if (orig.modules.moduleDynamic?.major?.blocked !=
|
|
||||||
null)
|
|
||||||
blockedItem(theme,
|
|
||||||
orig.modules.moduleDynamic!.major!.blocked!),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
const SizedBox(height: 5),
|
||||||
|
content(theme, isSave, context, orig, isDetail, callback,
|
||||||
|
floor: floor + 1),
|
||||||
|
module(theme, isSave, orig, context, isDetail, callback,
|
||||||
|
floor: floor + 1),
|
||||||
|
if (orig.modules.moduleDynamic?.additional != null)
|
||||||
|
addWidget(theme, orig, context, floor: floor + 1),
|
||||||
|
if (orig.modules.moduleDynamic?.major?.blocked != null)
|
||||||
|
blockedItem(theme, orig.modules.moduleDynamic!.major!.blocked!),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
// 直播
|
// 直播
|
||||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||||
return liveRcmdPanel(theme, isDetail, item, context, floor: floor);
|
return liveRcmdPanel(theme, isDetail, item, context, floor: floor);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:PiliPlus/http/init.dart';
|
||||||
import 'package:PiliPlus/models/common/account_type.dart';
|
import 'package:PiliPlus/models/common/account_type.dart';
|
||||||
import 'package:PiliPlus/pages/mine/controller.dart';
|
import 'package:PiliPlus/pages/mine/controller.dart';
|
||||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||||
@@ -55,7 +56,7 @@ class Accounts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void refresh() {
|
static Future<void> refresh() async {
|
||||||
for (var a in account.values) {
|
for (var a in account.values) {
|
||||||
for (var t in a.type) {
|
for (var t in a.type) {
|
||||||
accountMode[t] = a;
|
accountMode[t] = a;
|
||||||
@@ -64,9 +65,9 @@ class Accounts {
|
|||||||
for (var type in AccountType.values) {
|
for (var type in AccountType.values) {
|
||||||
accountMode[type] ??= AnonymousAccount();
|
accountMode[type] ??= AnonymousAccount();
|
||||||
}
|
}
|
||||||
// await Future.wait((accountMode.values.toSet()
|
await Future.wait((accountMode.values.toSet()
|
||||||
// ..retainWhere((i) => !i.activited))
|
..retainWhere((i) => !i.activited))
|
||||||
// .map((i) => Request.buvidActive(i)));
|
.map((i) => Request.buvidActive(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> clear() async {
|
static Future<void> clear() async {
|
||||||
@@ -75,7 +76,7 @@ class Accounts {
|
|||||||
accountMode[i] = AnonymousAccount();
|
accountMode[i] = AnonymousAccount();
|
||||||
}
|
}
|
||||||
await AnonymousAccount().delete();
|
await AnonymousAccount().delete();
|
||||||
// Request.buvidActive(AnonymousAccount());
|
Request.buvidActive(AnonymousAccount());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void close() {
|
static void close() {
|
||||||
@@ -98,7 +99,7 @@ class Accounts {
|
|||||||
await (accountMode[key]?..type.remove(key))?.onChange();
|
await (accountMode[key]?..type.remove(key))?.onChange();
|
||||||
accountMode[key] = account..type.add(key);
|
accountMode[key] = account..type.add(key);
|
||||||
await account.onChange();
|
await account.onChange();
|
||||||
// if (!account.activited) await Request.buvidActive(account);
|
if (!account.activited) await Request.buvidActive(account);
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case AccountType.main:
|
case AccountType.main:
|
||||||
await (account.isLogin
|
await (account.isLogin
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ abstract class Account {
|
|||||||
late String csrf;
|
late String csrf;
|
||||||
final Map<String, String> headers = const {};
|
final Map<String, String> headers = const {};
|
||||||
|
|
||||||
// bool activited = false;
|
bool activited = false;
|
||||||
|
|
||||||
Future<void> delete();
|
Future<void> delete();
|
||||||
Future<void> onChange();
|
Future<void> onChange();
|
||||||
@@ -40,6 +40,9 @@ class LoginAccount implements Account {
|
|||||||
@HiveField(3)
|
@HiveField(3)
|
||||||
late final Set<AccountType> type;
|
late final Set<AccountType> type;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool activited = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
late final int mid = int.parse(_midStr);
|
late final int mid = int.parse(_midStr);
|
||||||
|
|
||||||
@@ -113,6 +116,9 @@ class AnonymousAccount implements Account {
|
|||||||
@override
|
@override
|
||||||
final Map<String, String> headers = const {};
|
final Map<String, String> headers = const {};
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool activited = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> delete() async {
|
Future<void> delete() async {
|
||||||
await cookieJar.deleteAll();
|
await cookieJar.deleteAll();
|
||||||
|
|||||||
Reference in New Issue
Block a user