mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-01-11 22:40:36 +00:00
Update
This commit is contained in:
parent
532d86129d
commit
b713d844d6
5 changed files with 19 additions and 27 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 78 KiB |
|
|
@ -312,7 +312,7 @@ class MBridge {
|
|||
return html!;
|
||||
}
|
||||
|
||||
///Deobfuscate a JS code
|
||||
///Unpack a JS code
|
||||
static const $Function evalJs = $Function(_evalJs);
|
||||
|
||||
static $Value? _evalJs(_, __, List<$Value?> args) {
|
||||
|
|
|
|||
|
|
@ -27,17 +27,4 @@ class MManga {
|
|||
this.status = Status.unknown,
|
||||
this.description,
|
||||
this.chapters});
|
||||
|
||||
// Manga toManga(Manga? manga, String source) {
|
||||
// return Manga(
|
||||
// source: manga?.source ?? source,
|
||||
// author: author,
|
||||
// genre: genre,
|
||||
// imageUrl: imageUrl,
|
||||
// lang: "lang",
|
||||
// link: link,
|
||||
// name: name,
|
||||
// status: status!,
|
||||
// description: description);
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,16 +3,18 @@ import 'package:mangayomi/models/source.dart';
|
|||
//For testing purposes, set to true
|
||||
const useTestSourceCode = false;
|
||||
|
||||
final testSourceModelList = [Source(
|
||||
name: "Test Source",
|
||||
// Example: https://gogoanime3.net
|
||||
baseUrl: "",
|
||||
// source code
|
||||
sourceCode: testSourceCode,
|
||||
// Example: en
|
||||
lang: "",
|
||||
// Example: false for anime or true for manga
|
||||
isManga: false)];
|
||||
final testSourceModelList = [
|
||||
Source(
|
||||
name: "Test Source",
|
||||
// Example: https://gogoanime3.net
|
||||
baseUrl: "",
|
||||
// source code
|
||||
sourceCode: testSourceCode,
|
||||
// Example: en
|
||||
lang: "",
|
||||
// Example: false for anime or true for manga
|
||||
isManga: false)
|
||||
];
|
||||
|
||||
const testSourceCode = r'''
|
||||
import 'package:mangayomi/bridge_lib.dart';
|
||||
|
|
@ -42,13 +44,13 @@ class TestSource extends MProvider {
|
|||
// TODO: implement
|
||||
}
|
||||
|
||||
// For anime videos
|
||||
// For anime episode video list
|
||||
@override
|
||||
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||
// TODO: implement
|
||||
}
|
||||
|
||||
// For manga pages
|
||||
// For manga chapter pages
|
||||
@override
|
||||
Future<List<String>> getPageList(MSource source, String url) {
|
||||
// TODO: implement
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ import 'package:mangayomi/sources/source_test.dart';
|
|||
|
||||
Source? getSource(String lang, String name) {
|
||||
if (testSourceModelList.isNotEmpty && useTestSourceCode) {
|
||||
if (lang.isEmpty || name.isEmpty) {
|
||||
return testSourceModelList.first;
|
||||
}
|
||||
return testSourceModelList
|
||||
.firstWhere((element) => element.lang == lang && element.name == name);
|
||||
}
|
||||
|
|
@ -14,7 +17,7 @@ Source? getSource(String lang, String name) {
|
|||
(element) =>
|
||||
element.name!.toLowerCase() == name.toLowerCase() &&
|
||||
element.lang == lang,
|
||||
orElse: () => throw (),
|
||||
orElse: () => throw ("Error when getting source"),
|
||||
);
|
||||
} catch (_) {
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue