Release Lunaris 2.0 customization update
This commit is contained in:
@@ -26,7 +26,7 @@ class KemonoProvider
|
||||
receiveTimeout: const Duration(seconds: 20),
|
||||
headers: const {
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': 'Lunaris/1.1 Flutter local booru browser',
|
||||
'User-Agent': 'Lunaris/2.0 Flutter local booru browser',
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -99,11 +99,9 @@ class KemonoProvider
|
||||
if (searchText.isNotEmpty) {
|
||||
try {
|
||||
final response = await _creatorDio.get<dynamic>(
|
||||
'/search',
|
||||
_creatorPath(),
|
||||
queryParameters: {
|
||||
'q': searchText,
|
||||
'query': searchText,
|
||||
'site': _isCoomer ? 'coomer' : 'kemono',
|
||||
'keyword': searchText,
|
||||
'page': page,
|
||||
'itemsPerPage': limit.clamp(1, 100),
|
||||
},
|
||||
@@ -460,7 +458,7 @@ class KemonoProvider
|
||||
receiveTimeout: const Duration(seconds: 25),
|
||||
headers: const {
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': 'Lunaris/1.1 Flutter local booru browser',
|
||||
'User-Agent': 'Lunaris/2.0 Flutter local booru browser',
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -210,23 +210,24 @@ class ProviderManager {
|
||||
Set<String> seen,
|
||||
) {
|
||||
final posts = <Post>[];
|
||||
var index = 0;
|
||||
while (true) {
|
||||
var added = false;
|
||||
for (final providerPosts in results) {
|
||||
if (index >= providerPosts.length) continue;
|
||||
final post = providerPosts[index];
|
||||
if (seen.add(post.cacheKey)) {
|
||||
posts.add(post);
|
||||
added = true;
|
||||
}
|
||||
for (final providerPosts in results) {
|
||||
for (final post in providerPosts) {
|
||||
if (seen.add(post.cacheKey)) posts.add(post);
|
||||
}
|
||||
if (!added && results.every((items) => index >= items.length)) break;
|
||||
index++;
|
||||
}
|
||||
posts.sort((a, b) => _mixKey(a).compareTo(_mixKey(b)));
|
||||
return posts;
|
||||
}
|
||||
|
||||
int _mixKey(Post post) {
|
||||
var hash = 0x811c9dc5;
|
||||
for (final code in post.cacheKey.codeUnits) {
|
||||
hash ^= code;
|
||||
hash = (hash * 0x01000193) & 0x7fffffff;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
Future<Result<List<PostComment>>> getComments(
|
||||
String providerId,
|
||||
String postId,
|
||||
|
||||
Reference in New Issue
Block a user