mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-01-11 22:40:36 +00:00
24 lines
906 B
Dart
24 lines
906 B
Dart
import 'package:mangayomi/eval/dart/service.dart';
|
|
import 'package:mangayomi/eval/javascript/service.dart';
|
|
import 'package:mangayomi/models/chapter.dart';
|
|
import 'package:mangayomi/models/source.dart';
|
|
import 'package:mangayomi/utils/utils.dart';
|
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
part 'get_html_content.g.dart';
|
|
|
|
@riverpod
|
|
Future<String> getHtmlContent(Ref ref, {required Chapter chapter}) async {
|
|
if (!chapter.manga.isLoaded) {
|
|
chapter.manga.loadSync();
|
|
}
|
|
final source =
|
|
getSource(chapter.manga.value!.lang!, chapter.manga.value!.source!);
|
|
String? html;
|
|
if (source!.sourceCodeLanguage == SourceCodeLanguage.dart) {
|
|
html = await DartExtensionService(source).getHtmlContent(chapter.url!);
|
|
} else {
|
|
html = await JsExtensionService(source).getHtmlContent(chapter.url!);
|
|
}
|
|
return html;
|
|
}
|