Commit graph

47 commits

Author SHA1 Message Date
NBA2K1
8b1f7fc581 Add service disposal and lifecycle cleanup
This commit improves memory management, reduces redundant interpreter
instantiation, and standardizes service usage patterns.

- Add `dispose()` to `ExtensionService` interface and implement it across
  Dart, JS, LNReader, and Mihon services.
- Replace repeated interpreter creation in `DartExtensionService` with a
  persistent `_interpreter` instance initialized once in the constructor.
- Add disposal logic for JS DOM selector and Cheerio instances to prevent
  memory leaks.
- Introduce `withExtensionService()` helper to ensure services are always
  disposed after use.
- Update call sites across the codebase to use `withExtensionService()`
  or manual try/finally disposal.
- Improve isolate service message handling by extracting `responsePort`
  earlier.
- Ensure safer defaults (e.g., returning empty lists, const lists) when
  service calls fail.
2026-01-13 01:11:19 +01:00
Moustapha Kodjo Amadou
7c4c8d8a20 + 2026-01-05 12:12:56 +01:00
Schnitzel5
08b3991f5f Merge branch 'temp/mpv' into enhance/mpv 2025-08-06 03:12:50 +02:00
Moustapha Kodjo Amadou
01dc5dba45 Bump d4rt version 2025-08-05 15:50:57 +01:00
Schnitzel5
1450641f16 added mpv config for Anime4K 2025-07-24 22:25:14 +02:00
Moustapha Kodjo Amadou
084f241746 Register additional bridged classes for SortState and HeaderFilter in the interpreter 2025-07-09 13:20:45 +01:00
Moustapha Kodjo Amadou
21282efbaf Add nativeNames property to BaseRequest bridged class 2025-07-08 13:14:13 +01:00
Moustapha Kodjo Amadou
87fd4ef340 fix Undefined variable for client 2025-06-02 10:10:14 +01:00
NBA2K1
00c666fe3f Fix Exception when leaving Code Editor
When leaving the Code Editor of certain Extensions, this Exception would throw:
```
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Runtime Error: Undefined variable: source (Original error: Undefined property 'source' on Madara.)
#0      InterpreterVisitor.visitSimpleIdentifier (package:d4rt/src/interpreter_visitor.dart:393:7)
interpreter_visitor.dart:393
#1      SimpleIdentifierImpl.accept (package:analyzer/src/dart/ast/ast.dart:16123:50)
ast.dart:16123
#2      InterpreterVisitor.visitPostfixExpression (package:d4rt/src/interpreter_visitor.dart:3930:41)
interpreter_visitor.dart:3930
#3      PostfixExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:14311:50)
ast.dart:14311
#4      InterpreterVisitor._evaluateArguments (package:d4rt/src/interpreter_visitor.dart:5569:23)
interpreter_visitor.dart:5569
#5      InterpreterVisitor.visitMethodInvocation (package:d4rt/src/interpreter_visitor.dart:2178:13)
interpreter_visitor.dart:2178
#6      MethodInvocationImpl.accept (package:analyzer/src/dart/ast/ast.dart:12246:50)
ast.dart:12246
#7      InterpretedClass.createAndInitializeInstance (package:d4rt/src/runtime_types.dart:232:53)
runtime_types.dart:232
#8      InterpretedClass.call (package:d4rt/src/runtime_types.dart:299:22)
runtime_types.dart:299
#9      InterpreterVisitor.visitMethodInvocation (package:d4rt/src/interpreter_visitor.dart:2161:28)
interpreter_visitor.dart:2161
#10     MethodInvocationImpl.accept (package:analyzer/src/dart/ast/ast.dart:12246:50)
ast.dart:12246
#11     InterpreterVisitor.visitVariableDeclarationList (package:d4rt/src/interpreter_visitor.dart:3026:42)
interpreter_visitor.dart:3026
#12     VariableDeclarationListImpl.accept (package:analyzer/src/dart/ast/ast.dart:18695:15)
ast.dart:18695
#13     InterpreterVisitor.visitVariableDeclarationStatement (package:d4rt/src/interpreter_visitor.dart:135:27)
interpreter_visitor.dart:135
#14     VariableDeclarationStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:18753:15)
ast.dart:18753
#15     InterpreterVisitor.executeBlock (package:d4rt/src/interpreter_visitor.dart:66:33)
interpreter_visitor.dart:66
#16     InterpretedFunction.call (package:d4rt/src/callable.dart:589:36)
callable.dart:589
#17     D4rt.execute (package:d4rt/src/d4rt_base.dart:220:43)
d4rt_base.dart:220
#18     DartExtensionService._executeLib (package:mangayomi/eval/dart/service.dart:24:17)
service.dart:24
#19     DartExtensionService.getSourcePreferences (package:mangayomi/eval/dart/service.dart:179:25)
service.dart:179
#20     getSourcePreference (package:mangayomi/services/get_source_preference.dart:6:38)
get_source_preference.dart:6
#21     _ExtensionDetailState.build.<anonymous closure>.<anonymous closure> (package:mangayomi/modules/browse/extension/extension_detail.dart:173:44)
extension_detail.dart:173
#22     State.setState (package:flutter/src/widgets/framework.dart:1199:30)
framework.dart:1199
#23     _ExtensionDetailState.build.<anonymous closure> (package:mangayomi/modules/browse/extension/extension_detail.dart:171:23)
extension_detail.dart:171
<asynchronous suspension>
```
2025-06-01 19:52:21 +02:00
Moustapha Kodjo Amadou
80efee40d1 dart format 2025-05-30 17:43:42 +01:00
Moustapha Kodjo Amadou
6ea8d088ed + 2025-05-22 18:05:08 +01:00
Moustapha Kodjo Amadou
2371d52661 update to d4rt v0.0.5 2025-05-18 13:20:35 +01:00
Moustapha Kodjo Amadou
206a51df69 + 2025-05-10 12:26:02 +01:00
Moustapha Kodjo Amadou
c558c08376 migrate to d4rt package 2025-05-09 17:47:27 +01:00
Schnitzel5
3677938bf8 added support for epubs
embedded images not supported yet
2025-05-07 22:17:23 +02:00
Schnitzel5
7e9202ceeb added extension notes/hints 2025-04-23 23:33:18 +02:00
Moustapha Kodjo Amadou
3e401c8af2 dart format 2025-02-23 15:31:49 +01:00
Schnitzel5
5ae7a8d581 added option to download novels 2025-01-07 23:37:29 +01:00
kodjomoustapha
b4c09bbee0 feat: add evaluateJavascriptViaWebview 2025-01-06 13:04:04 +01:00
Schnitzel5
34179a17a5 Merge branch 'feature/novel' into feature/light-novel 2024-12-20 15:59:06 +01:00
kodjomoustapha
a41ccaff22 fix & reformat 2024-12-20 10:15:15 +01:00
Moustapha Kodjo Amadou
9d712654a9
Merge branch 'main' into refactor/refactor-extensions-service 2024-12-20 09:15:26 +01:00
Schnitzel5
50eff04fe6 added extension functions 2024-12-20 00:22:18 +01:00
kodjomoustapha
f99bc996b1 fix 2024-12-19 17:52:47 +01:00
Yegor Shovkun
73b144ed16 refactor: move try-catch 2024-12-14 14:01:42 +02:00
Yegor Shovkun
f0cf52813a refactor: refactor extension services 2024-12-14 13:55:40 +02:00
Yegor Shovkun
adbd1529f7 fix: cs fix (reformat with 120 line length) 2024-12-14 12:38:56 +02:00
kodjomoustapha
d6f4c99ea1 add show btn to resolve cloudflare challenge 2024-10-13 18:02:12 +01:00
yxxyun
c5bd38719f add UC extractor 2024-10-05 21:13:16 +08:00
yxxyun
4dedb6bfa2 update quark 2024-10-02 15:33:55 +08:00
yxxyun
a382044329 add quark 2024-10-02 12:50:56 +08:00
kodjomoustapha
ad9f292c0e + 2024-08-02 17:25:59 +01:00
kodjomoustapha
7d5640e2b0 feat: add a custom request headers for getPageList #235 2024-08-02 14:51:39 +01:00
kodjomoustapha
59ed4da8de Add a wonderfull css package(pseudom) with custom pseudo selectors 2024-06-15 13:27:44 +01:00
kodjomoustapha
fd5b4b04b4 rm source_test 2024-05-25 19:39:14 +01:00
kodjomoustapha
170f07e3be fix 2024-05-25 18:06:27 +01:00
kodjomoustapha
cbd01a3c17 refactor code 2024-05-23 11:19:23 +01:00
kodjomoustapha
f2187df237 Add support for SubtitleTrack from data 2024-05-08 18:23:11 +01:00
kodjomoustapha
d0ee7d3260 Fix extension getHeaders method 2024-04-15 12:13:31 +01:00
kodjomoustapha
1449fae220 Fix filter toJson 2024-04-08 16:09:38 +01:00
kodjomoustapha
72ecdfbd97 Fix getFilterList for JS extensions 2024-04-07 16:54:48 +01:00
kodjomoustapha
4f131de97d more 2024-03-22 15:17:12 +01:00
kodjomoustapha
9b6528064e background_downloader + 2024-03-20 17:45:05 +01:00
kodjomoustapha
6f7a179f02 Added create extension page 2024-03-19 17:32:14 +01:00
kodjomoustapha
d49de188a4 rename 2024-03-14 17:46:53 +01:00
kodjomoustapha
d168b6ddcd Added cronet_http & cupertino_http, remove unnecessary packages 2024-03-14 17:40:15 +01:00
kodjomoustapha
6fa0e8a89f Added JavaScript extension runtime, gridview count 2024-03-12 17:24:41 +01:00