Merge branch 'main' into mod-not-login-recommend2
This commit is contained in:
@ -1,51 +1,65 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: constant_identifier_names, non_constant_identifier_names
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class IdUtils {
|
||||
static const String TABLE =
|
||||
'fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF';
|
||||
static const List<int> S = [11, 10, 3, 8, 4, 6]; // 位置编码表
|
||||
static const int XOR = 177451812; // 固定异或值
|
||||
static const int ADD = 8728348608; // 固定加法值
|
||||
static const List<String> r = [
|
||||
'B',
|
||||
'V',
|
||||
'1',
|
||||
'',
|
||||
'',
|
||||
'4',
|
||||
'',
|
||||
'1',
|
||||
'',
|
||||
'7',
|
||||
'',
|
||||
''
|
||||
];
|
||||
static final XOR_CODE = BigInt.parse('23442827791579');
|
||||
static final MASK_CODE = BigInt.parse('2251799813685247');
|
||||
static final MAX_AID = BigInt.one << (BigInt.from(51)).toInt();
|
||||
static final BASE = BigInt.from(58);
|
||||
|
||||
static const data =
|
||||
'FcwAPNKTMug3GV5Lj7EJnHpWsx4tb8haYeviqBz6rkCy12mUSDQX9RdoZf';
|
||||
|
||||
/// av转bv
|
||||
static String av2bv(int av) {
|
||||
int x_ = (av ^ XOR) + ADD;
|
||||
List<String> newR = [];
|
||||
newR.addAll(r);
|
||||
for (int i = 0; i < S.length; i++) {
|
||||
newR[S[i]] =
|
||||
TABLE.characters.elementAt((x_ / pow(58, i).toInt() % 58).toInt());
|
||||
static String av2bv(int aid) {
|
||||
List<String> bytes = [
|
||||
'B',
|
||||
'V',
|
||||
'1',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0'
|
||||
];
|
||||
int bvIndex = bytes.length - 1;
|
||||
BigInt tmp = (MAX_AID | BigInt.from(aid)) ^ XOR_CODE;
|
||||
while (tmp > BigInt.zero) {
|
||||
bytes[bvIndex] = data[(tmp % BASE).toInt()];
|
||||
tmp = tmp ~/ BASE;
|
||||
bvIndex -= 1;
|
||||
}
|
||||
return newR.join();
|
||||
String tmpSwap = bytes[3];
|
||||
bytes[3] = bytes[9];
|
||||
bytes[9] = tmpSwap;
|
||||
|
||||
tmpSwap = bytes[4];
|
||||
bytes[4] = bytes[7];
|
||||
bytes[7] = tmpSwap;
|
||||
|
||||
return bytes.join();
|
||||
}
|
||||
|
||||
/// bv转bv
|
||||
static int bv2av(String bv) {
|
||||
int r = 0;
|
||||
for (int i = 0; i < S.length; i++) {
|
||||
r += (TABLE.indexOf(bv.characters.elementAt(S[i])).toInt()) *
|
||||
pow(58, i).toInt();
|
||||
}
|
||||
return (r - ADD) ^ XOR;
|
||||
/// bv转av
|
||||
static int bv2av(String bvid) {
|
||||
List<String> bvidArr = bvid.split('');
|
||||
final tmpValue = bvidArr[3];
|
||||
bvidArr[3] = bvidArr[9];
|
||||
bvidArr[9] = tmpValue;
|
||||
|
||||
final tmpValue2 = bvidArr[4];
|
||||
bvidArr[4] = bvidArr[7];
|
||||
bvidArr[7] = tmpValue2;
|
||||
|
||||
bvidArr.removeRange(0, 3);
|
||||
BigInt tmp = bvidArr.fold(BigInt.zero,
|
||||
(pre, bvidChar) => pre * BASE + BigInt.from(data.indexOf(bvidChar)));
|
||||
return ((tmp & MASK_CODE) ^ XOR_CODE).toInt();
|
||||
}
|
||||
|
||||
// 匹配
|
||||
|
@ -137,7 +137,8 @@ class SettingBoxKey {
|
||||
enableMYBar = 'enableMYBar',
|
||||
hideSearchBar = 'hideSearchBar', // 收起顶栏
|
||||
hideTabBar = 'hideTabBar', // 收起底栏
|
||||
tabbarSort = 'tabbarSort'; // 首页tabbar
|
||||
tabbarSort = 'tabbarSort', // 首页tabbar
|
||||
dynamicBadgeMode = 'dynamicBadgeMode';
|
||||
}
|
||||
|
||||
class LocalCacheKey {
|
||||
@ -150,12 +151,13 @@ class LocalCacheKey {
|
||||
wbiKeys = 'wbiKeys',
|
||||
timeStamp = 'timeStamp',
|
||||
|
||||
// 弹幕相关设置 屏蔽类型 显示区域 透明度 字体大小 弹幕时间
|
||||
// 弹幕相关设置 屏蔽类型 显示区域 透明度 字体大小 弹幕时间 描边粗细
|
||||
danmakuBlockType = 'danmakuBlockType',
|
||||
danmakuShowArea = 'danmakuShowArea',
|
||||
danmakuOpacity = 'danmakuOpacity',
|
||||
danmakuFontScale = 'danmakuFontScale',
|
||||
danmakuDuration = 'danmakuDuration',
|
||||
strokeWidth = 'strokeWidth',
|
||||
|
||||
// 代理host port
|
||||
systemProxyHost = 'systemProxyHost',
|
||||
|
@ -281,16 +281,18 @@ class Utils {
|
||||
// [arm64-v8a]
|
||||
String abi = androidInfo.supportedAbis.first;
|
||||
late String downloadUrl;
|
||||
for (var i in data.assets) {
|
||||
if (i.downloadUrl.contains(abi)) {
|
||||
downloadUrl = i.downloadUrl;
|
||||
if (data.assets.isNotEmpty) {
|
||||
for (var i in data.assets) {
|
||||
if (i.downloadUrl.contains(abi)) {
|
||||
downloadUrl = i.downloadUrl;
|
||||
}
|
||||
}
|
||||
// 应用外下载
|
||||
launchUrl(
|
||||
Uri.parse(downloadUrl),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
}
|
||||
// 应用外下载
|
||||
launchUrl(
|
||||
Uri.parse(downloadUrl),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user