mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: 缓解投稿视频接口风控
This commit is contained in:
@@ -338,4 +338,17 @@ class Utils {
|
||||
|
||||
return md5String;
|
||||
}
|
||||
|
||||
static String generateRandomString(int minLength, int maxLength) {
|
||||
const String printable = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#\$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ ';
|
||||
|
||||
var random = Random();
|
||||
int length = minLength + random.nextInt(maxLength - minLength + 1);
|
||||
return List<String>.generate(length, (index) => printable[random.nextInt(printable.length)]).join();
|
||||
}
|
||||
|
||||
static String base64EncodeRandomString(int minLength, int maxLength) {
|
||||
String randomString = generateRandomString(minLength, maxLength);
|
||||
return base64.encode(utf8.encode(randomString));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user