Skip to content

Comments

feat: add script engine, refine entry/initOnce constraints#7

Merged
cwuom merged 2 commits intocwuom:masterfrom
huajiqaq:patch2
Feb 13, 2026
Merged

feat: add script engine, refine entry/initOnce constraints#7
cwuom merged 2 commits intocwuom:masterfrom
huajiqaq:patch2

Conversation

@huajiqaq
Copy link
Contributor

描述 / Description

  1. 新增脚本功能
    基于 Rhino JavaScript 引入简易脚本功能实现,用户可直接编写 .js 文件作为自定义 Hook 接收到的请求和接收到的响应。
  2. 核心类设计优化
    • entry:从抽象方法改为非抽象,提供默认实现,子类可不被重写
    • initOnce:标记为 final / 强制调用,确保不可被跳过、不可被重写

类型 / Type

  • Bug 修复 / Bug Fix
  • 新功能 / New Feature
  • 文档更新 / Documentation Update
  • 其他(请描述)/ Other (please describe):

修复或解决的问题 / Issues Fixed or Closed by This PR

  • 解决子类必须实现 entry 导致的冗余代码问题
  • 解决 initOnce 被子类覆盖或遗漏调用导致的初始化不可靠问题
  • 新增简单的脚本能力

清单 / Checklist

  • 我已阅读并遵循贡献指南 / I have read and followed the contribution guidelines
  • 我已在本地测试这些更改 / I have tested these changes locally
  • 我已更新相关文档或注释(如适用) / I have updated relevant documentation or comments (if applicable)
  • 我确认此更改不会破坏任何原有功能 / I confirm this change does not break any existing features
  • 我已进行多版本适配(如适用) / I have used MMVersion for version compatibility (if applicable)
  • 我已在多个微信版本上测试此更改(如适用) / I have tested this change on multiple WeChat versions (if applicable)

其他信息 / Additional Information

@huajiqaq huajiqaq changed the title feat: add script engine, refine entry/initOnce constraints #6 feat: add script engine, refine entry/initOnce constraints Feb 12, 2026
…lation failure due to command line length limits
@cwuom cwuom merged commit c813d5e into cwuom:master Feb 13, 2026
2 checks passed
@cwuom
Copy link
Owner

cwuom commented Feb 13, 2026

ScriptConfigHookItem.kt 在 release 中处理 onClick 时崩溃,建议参考一下我之前写的 onClick,release 用了 hidden dex,弹窗请使用 com.afollestad.materialdialogs.MaterialDialog 或者 BaseRikkaDialog

@cwuom
Copy link
Owner

cwuom commented Feb 13, 2026

java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/content/ContextCompat;
at moe.ouom.wekit.hooks.item.script.ScriptConfigHookItem$ScriptManagerDialog.renderEmptyView(ScriptConfigHookItem.kt:135)
at moe.ouom.wekit.hooks.item.script.ScriptConfigHookItem$ScriptManagerDialog.renderScriptList(ScriptConfigHookItem.kt:116)
at moe.ouom.wekit.hooks.item.script.ScriptConfigHookItem$ScriptManagerDialog.initList(ScriptConfigHookItem.kt:106)
at moe.ouom.wekit.ui.creator.dialog.BaseSettingsDialog.onCreate(SourceFile:91)
at android.app.Dialog.dispatchOnCreate(Dialog.java:459)
at android.app.Dialog.show(Dialog.java:344)
at moe.ouom.wekit.ui.creator.dialog.BaseSettingsDialog.show(SourceFile:104)
at moe.ouom.wekit.hooks.item.script.ScriptConfigHookItem.onClick(ScriptConfigHookItem.kt:88)
at moe.ouom.wekit.ui.creator.dialog.CategorySettingsDialog.renderClickableItem$lambda$2(SourceFile:157)
at moe.ouom.wekit.ui.creator.dialog.CategorySettingsDialog.$r8$lambda$b730SlI11i83_yYnlCLBlZmpH8M(SourceFile:0)
at moe.ouom.wekit.ui.creator.dialog.CategorySettingsDialog$$ExternalSyntheticLambda4.onClick(SourceFile:0)
at android.view.View.performClick(View.java:8299)
at android.view.View.performClickInternal(View.java:8276)
at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
at android.view.View$PerformClick.run(View.java:33408)
at android.os.Handler.handleCallback(Handler.java:995)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loopOnce(Looper.java:265)
at android.os.Looper.loop(Looper.java:358)
at android.app.ActivityThread.main(ActivityThread.java:10049)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:616)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1115)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.core.content.ContextCompat" on path: DexPathList[[dex file "InMemoryDexFile[cookie=[0, 481702445904]]"],nativeLibraryDirectories=[/system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
at java.lang.ClassLoader.loadClass(ClassLoader.java:637)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
... 23 more

这是崩溃日志

@cwuom
Copy link
Owner

cwuom commented Feb 13, 2026

签名校验在 native 层,你可以删除签名校验后再进行测试。你可以强制 hidden dex 加载并移除掉 abort(),Java 层的签名校验在 SignatureVerifier.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants