{"id":13569321,"url":"https://github.com/ikws4/WeiJu2","last_synced_at":"2025-04-04T05:32:00.649Z","repository":{"id":41039349,"uuid":"508131916","full_name":"ikws4/WeiJu2","owner":"ikws4","description":"Scriptable Xposed Module","archived":false,"fork":false,"pushed_at":"2024-01-10T00:14:28.000Z","size":1818,"stargazers_count":151,"open_issues_count":2,"forks_count":17,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-11-05T01:34:49.205Z","etag":null,"topics":["xposed","xposed-module"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ikws4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-06-28T02:46:46.000Z","updated_at":"2024-10-30T05:36:47.000Z","dependencies_parsed_at":"2024-03-17T02:03:56.443Z","dependency_job_id":"7d1db79b-7da1-4789-9f6d-a535c0a5e5ae","html_url":"https://github.com/ikws4/WeiJu2","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikws4%2FWeiJu2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikws4%2FWeiJu2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikws4%2FWeiJu2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikws4%2FWeiJu2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ikws4","download_url":"https://codeload.github.com/ikws4/WeiJu2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128702,"owners_count":20888232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["xposed","xposed-module"],"created_at":"2024-08-01T14:00:38.519Z","updated_at":"2025-04-04T05:31:58.997Z","avatar_url":"https://github.com/ikws4.png","language":"Java","funding_links":[],"categories":["Xposed Modules"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/47056144/184565081-fab04563-4590-4f3c-8f86-12d2dd429f8a.png\" width=\"40%\" alt=\"WeiJu2\" /\u003e\n\u003c/h1\u003e\n\nThe first scriptable xposed module, provides a new way to change the application behavior.\n\nPowered by Lua and made with ♥\n\n# Features\n\n- Lua scripting\n- Simple and intuitive hook API\n- AI assistant\n- Share your package with others by publish it at [WeiJu2-Scripts](https://github.com/ikws4/WeiJu2-Scripts)\n\n[![](https://markdown-videos.deta.dev/youtube/FHwR7rCHLkQ)](https://youtu.be/FHwR7rCHLkQ)\n\n# Q\u0026A\n\n### How to write a hook?\n\n```lua\n-- You can import any java class\nlocal Toast = import(\"android.widget.Toast\")\nlocal Activity = import(\"android.app.Activity\")\nlocal Bundle = import(\"android.os.Bundle\")\nlocal StringBuilder = import(\"java.lang.StringBuilder\")\n\n-- Hook a method\nhook {\n  class = Activity,\n  returns = void,\n  method = \"onCreate\",\n  params = {\n    Bundle\n  },\n  after = function(this, params)\n    -- This will call the `StringBuilder(CharSequence seq)` constructor\n    -- to instantiate a StringBuilder object\n    local sb = StringBuilder(\"Hello, \")\n    sb:append(\"WeiJu2\")\n  \n    Toast:makeText(this, sb:toString(), Toast.LENGTH_SHORT):show()\n    --              ^\n    -- Note: `this` is the Activity instance\n  end,\n}\n\n-- Hook a constructor\nlocal View = import(\"android.view.View\")\nlocal Context = import(\"android.content.Context\")\nlocal AttributeSet = import(\"android.util.AttributeSet\")\n\nhook {\n  class = View,\n  params = {\n    Context,\n    AttributeSet,\n    int\n  },\n  after = function(this, params)\n  \n  end,\n}\n```\n\n\n### How to modify class fields?\n\n```lua\n-- With the `import` function you can bind any java class, and access all the fields and methods that defined\n-- in that class. No more `XposedHelper.setStaticObjectField(Build.class, \"DEVICE\", \"coral\")` much cleaner!\nlocal Build = import(\"android.os.Build\")\n\nBuild.DEVICE = \"coral\"\nBuild.PRODUCT = \"coral\"\nBuild.MODEL = \"Google Pixel 4XL\"\nBuild.BRAND = \"google\"\nBuild.MANUFACTURER = \"google\"\nBuild.VERSION.RELEASE = \"13\"\n```\n\n\n### How to import a package?\n\n```lua\nrequire(\"ikws4.system_variable\").setup {\n  -- config goes here\n}\n```\n\n\n### How to create a package?\n\nA basic package template:\n\n```lua\n--[=[ \n@metadata\n  return {\n    name = \"your_package\",\n    author = \"you\",\n    version = \"1.0.0\",\n    description = \"Describle your package\",\n    example = [[\n      -- you can provide an example here for others to reference\n    ]]\n  }\n@end\n--]=]\n\nlocal config = {\n}\n\nlocal M = {}\n\nM.setup = function(opts)\n  config = table.extend(config, opts or {})\n  \n  -- write hook here\nend\n\nreturn M\n```\n\n### How to get the result in after hook?\n\n```lua\nhook {\n  class = String,\n  returns = char,\n  method = \"charAt\",\n  params = {\n    int\n  },\n  after = function(this, params, ret)\n    print(\"return value: \" .. ret)\n    -- make it always return 'a'\n    return string.byte(\"a\")\n  end\n}\n```\n\nWant to share your work with others? Create a PR at [WeiJu2-Scripts](https://github.com/ikws4/WeiJu2-Scripts).\n\n\n# API\n\n### import\n```lua\n--- Examples:\n---   local StringBuilder = import(\"java.lang.StringBuilder\")\n---   local my_string_builder = StringBuilder(\"hi\")\n---   print(my_string_builder:toString())\n---\n--- @param class_name string\n--- @return Class\nfunction import(class_name) end\n```\n\n### object\n```lua\n--- Examples:\n---   local Runnable = import(\"java.lang.Runnable\")\n---   local my_runnable = object(Runnable, {\n---     run = function(this)\n---     \n---     end\n---   })\n---   my_runnable:run()\n---\n--- @param class Class\n--- @param proxy table\u003cstring, function\u003e\n--- @return Class\nfunction object(class, proxy) end\n```\n\n### hook\n```lua\n--- Exampels:\n---   local View = import(\"android.view.View\")\n---   local Context = import(\"android.content.Context\")\n---   local AttributeSet = import(\"android.util.AttributeSet\")\n---\n---   hook {\n---     class = View,\n---     params = {\n---       Context,\n---       AttributeSet,\n---       int\n---     },\n---     after = function(this, params)\n---       -- Add your own logic after constructor is called\n---        \n---     end\n---   }\n---\n---   local Canvas = import(\"android.graphics.Canvas\")\n---\n---   hook {\n---     class = View,\n---     returns = void,\n---     method = \"onDraw\",\n---     params = {\n---       Canvas\n---     },\n---     after = function(this, params)\n---       local canvas = params[1]\n---       -- Using canvas to draw anything you want\n---     \n---     end\n---   }\n---\n--- @param config table This table accepts the following keys\n---                     - class: (Class) The hook target.\n---                     - returns: (nil|Class) The method return type.\n---                     - method: (string) The method name.\n---                     - params: (nil|table) The method argument types, can be nil if there is no argument.\n---                     - before: (nil|function) Executed before the method is called.\n---                     - after: (nil|function) Executed after the method is called.\n---                     - replace: (nil|function) A simple version of `before`, use to rewrite the whole method.\n--- @return Unhook\nfunction hook(config) end\n```\n\n### Auto imported common java types\n\nThese types are common used in scripts, therefore we auto imported them for you, [View Source](https://github.com/ikws4/WeiJu2/blob/main/app/src/main/resources/java_common_types.lua).\n\n```lua\nbyte\nshort\nint\nlong\nfloat\ndouble\nchar\nboolean\nvoid\n\nString\nList\n```\n\n# Screenshots\n\n\u003cimg src=\"https://user-images.githubusercontent.com/47056144/183251553-9dce66f7-953c-45b9-b741-0ae8e0b567af.png\" /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikws4%2FWeiJu2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fikws4%2FWeiJu2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikws4%2FWeiJu2/lists"}