This commit is contained in:
kodjomoustapha
2024-09-22 00:21:04 +01:00
parent 8a6e8a2658
commit d37f884e6d
9 changed files with 4 additions and 1864 deletions

View File

@@ -15,7 +15,7 @@ class MangaDex extends MProvider {
Future<MPages> getPopular(int page) async {
page = (20 * (page - 1));
final url =
"https://api.mangadex.org/manga?limit=20&offset=$page&availableTranslatedLanguage[]=${source.lang}&includes[]=cover_art${preferenceContentRating(source.id)}${preferenceOriginalLanguages(source.id)}&order[followedCount]=desc";
"https://api.mangadex.org/manga?limit=20&offset=$page&availableTranslatedLanguage[]=${source.lang}&includes[]=cover_art&contentRating[]=safe&contentRating[]=suggestive${preferenceOriginalLanguages(source.id)}&order[followedCount]=desc";
final res = (await client.get(Uri.parse(url), headers: headers)).body;
return mangaRes(res);
}
@@ -34,7 +34,7 @@ class MangaDex extends MProvider {
mangaIdss += "&ids[]=$id";
}
final newUrl =
"https://api.mangadex.org/manga?includes[]=cover_art&limit=${mangaIds.length}${preferenceContentRating(source.id)}${preferenceOriginalLanguages(source.id)}$mangaIdss";
"https://api.mangadex.org/manga?includes[]=cover_art&limit=${mangaIds.length}&contentRating[]=safe&contentRating[]=suggestive${preferenceOriginalLanguages(source.id)}$mangaIdss";
final res = (await client.get(Uri.parse(newUrl), headers: headers)).body;
return mangaRes(res);
}
@@ -521,27 +521,6 @@ class MangaDex extends MProvider {
valueIndex: 0,
entries: ["Original", "Medium", "Low"],
entryValues: ["", ".512.jpg", ".256.jpg"]),
MultiSelectListPreference(
key: "content_rating",
title: "Default content rating",
summary: "Show content with the selected rating by default",
valueIndex: 0,
entries: [
"safe",
"suggestive",
"erotica",
"pornographic"
],
entryValues: [
"contentRating[]=safe",
"contentRating[]=suggestive",
"contentRating[]=erotica",
"contentRating[]=pornographic"
],
values: [
"contentRating[]=safe",
"contentRating[]=suggestive"
]),
MultiSelectListPreference(
key: "original_languages",
title: "Filter original languages",
@@ -572,19 +551,6 @@ class MangaDex extends MProvider {
];
}
String preferenceContentRating(int sourceId) {
final contentRating =
getPreferenceValue(sourceId, "content_rating") as List<String>;
String contentRatingStr = "";
if (contentRating.isNotEmpty) {
contentRatingStr = "&";
for (var ctn in contentRating) {
contentRatingStr += "&$ctn";
}
}
return contentRatingStr;
}
String preferenceOriginalLanguages(int sourceId) {
final originalLanguages =
getPreferenceValue(sourceId, "original_languages") as List<String>;

View File

@@ -3,7 +3,7 @@ import '../../../../../model/source.dart';
const _apiUrl = 'https://api.mangadex.org';
const _baseUrl = 'https://mangadex.org';
const _isNsfw = true;
const _mangadexVersion = "0.0.8";
const _mangadexVersion = "0.0.85";
const _mangadexSourceCodeUrl =
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/dart/manga/src/all/mangadex/mangadex.dart";
String _iconUrl =