Skip to content
This repository has been archived by the owner on Jul 6, 2024. It is now read-only.

Commit

Permalink
Fix issues in codebase, multiple new features
Browse files Browse the repository at this point in the history
* Added `Output.ScriptType`, which denotes the "type" of script that outputs in Studio. (LocalScript/Script/ModuleScript)

* Added "Fast-Flags" to the project file (`Flags`); they're specifc options for Maui's codegen to check and respect at runtime.

* Added `Flags.ContextualExecution`; which denotes if client/server context should be checked at runtime. (Only running `LocalScripts` on the client, only running `Scripts` on the server etc) It also decides the behavior of respecting `LuaSourceContainer.Disabled`, and will run scripts anyway if this option is set to false.

* Added `Flags.ReturnMainModule`; (When applicable), return the contents of a "MainModule"-named `ModuleScript` from the root of the model. This behaves exactly like Roblox's "MainModule" system, like if you were requiring a module by its' ID.

* Fixed a (very recent) issue with the `ScriptDocument:EditTextAsync` method of placing script output into the editor when it's over 200k characters; a recent Roblox API change broke how we handled the output.

* Fixed the `script` global in the project file not being set to itself. (for literal instance returns)

* Overall improvements around the codebase, fixed some issues when internally handling the project file format.
  • Loading branch information
regginator committed Jan 29, 2023
1 parent a4fa451 commit b03e6c8
Show file tree
Hide file tree
Showing 13 changed files with 268 additions and 97 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ After the script is built, Maui should open the output script's editor window, a
From there, you're done! You can run it in a script utility, another script, place it into obfuscation, etc.. It's 100% portable, and will work in almost *any* Roblox environment!
Remember, because it **literally** packs a Roblox model, you need to have at least 1 `LocalScript` (client context) or `Script` (server context) to actually initialize what you want. You can't *really* interract with Maui's script environment outside of the codegen, you need to do everything internally in the packed script. (for added security you can't, we may add something like this later on)
Remember, because it **literally** packs a Roblox model, you need to have at least 1 `LocalScript` (client context) or `Script` (server context) to actually initialize what you want. You *can* configure this to ignore context like `Script.Disabled` or running a script in the wrong context in the [project format](#the-maui-project-format). By default, if you provide a `MainModule`, Maui will return the value from it with the exact same behavior as requiring a module by ID on Roblox.
##### *This is a simple test-script for using Fusion with an exploit, you can see the source [here](tests/HelloFusion), and example output [here](examples/MauiFusionDemo_2023-01-06_13-24-23.lua)*
Expand Down Expand Up @@ -201,15 +201,20 @@ return {

-- All output options
Output = {
-- A string/function/instance (supports all) denoting/returning a specific output path in the DataModel, and a string of the filename, like so:
-- "return game:GetService("ServerStorage").SomeFolder"
Directory = "return script.Parent",
Directory = "return script.Parent", -- A string/function/instance (supports all) denoting/returning a specific output path in the DataModel, and a string of the filename
ScriptName = "MauiGeneratedScript", -- The actual name of the output script object, e.g. "SomeScript"
ScriptType = "LocalScript", -- Accepts "LocalScript", "Script", and "ModuleScript"

MinifyTable = false, -- If the codegen table itself (made from LuaEncode) is to be minified
UseMinifiedLoader = true -- Use the pre-minified LoadModule script in the codegen, which is always predefined and not useful for debugging
},

-- "Fast-Flags" to be respected at runtime
Flags = {
ContextualExecution = true, -- If client/server context should be checked at runtime, and ignores LuaSourceContainer.Disabled (e.g. LocalScripts only run on the client, Scripts only run on the server)
ReturnMainModule = true -- **If applicable**, return the contents of a "MainModule"-named ModuleScript from the root of the model. This behaves exactly like Roblox's MainModule system
},

-- Property wl/bl overrides
Properties = {
Whitelist = {}, -- [ClassName] = {PropertyName, ...}
Expand All @@ -227,11 +232,17 @@ You can *also* use [Rojo's JSON module feature](https://rojo.space/docs/v7/sync-
"Output": {
"Directory": "return script.Parent",
"ScriptName": "MauiGeneratedScript",
"ScriptType": "LocalScript",

"MinifyTable": false,
"UseMinifiedLoader": true
},

"Flags": {
"ContextualExecution": true,
"ReturnMainModule": true
},

"Properties": {
"Whitelist": {},
"Blacklist": {}
Expand Down
19 changes: 15 additions & 4 deletions THREAD.bbcode
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ After the script is built, Maui should open the output script's editor window, a

From there, you're done! You can run it in a script utility, another script, place it into obfuscation, etc.. It's 100% portable, and will work in almost [i]any[/i] Roblox environment!

Remember, because it [b]literally[/b] packs a Roblox model, you need to have at least 1 [font=Courier]LocalScript[/font] (client context) or [font=Courier]Script[/font] (server context) to actually initialize what you want. You can't [i]really[/i] interract with Maui's script environment outside of the codegen, you need to do everything internally in the packed script. (for added security you can't, we may add something like this later on)
Remember, because it [b]literally[/b] packs a Roblox model, you need to have at least 1 [font=Courier]LocalScript[/font] (client context) or [font=Courier]Script[/font] (server context) to actually initialize what you want. You [i]can[/i] configure this to ignore context like [font=Courier]Script.Disabled[/font] or running a script in the wrong context in the [url=https://github.com/latte-soft/maui#the-maui-project-format]project format[/url]. By default, if you provide a [font=Courier]MainModule[/font], Maui will return the value from it with the exact same behavior as requiring a module by ID on Roblox.

[size=small][i]This is a simple test-script for using Fusion with an exploit, you can see the source [url=https://github.com/latte-soft/maui/blob/main/tests/HelloFusion]here[/url]![/i][/size]
[img=775x372]https://media.discordapp.net/attachments/1060751075415687178/1060976562654154772/image.png?width=950&height=456[/img]
Expand Down Expand Up @@ -125,15 +125,20 @@ You can place a module named ".maui" under the model you're building, and Maui w

-- All output options
Output = {
-- A string/function/instance (supports all) denoting/returning a specific output path in the DataModel, and a string of the filename, like so:
-- "return game:GetService("ServerStorage").SomeFolder"
Directory = "return script.Parent",
Directory = "return script.Parent", -- A string/function/instance (supports all) denoting/returning a specific output path in the DataModel, and a string of the filename
ScriptName = "MauiGeneratedScript", -- The actual name of the output script object, e.g. "SomeScript"
ScriptType = "LocalScript", -- Accepts "LocalScript", "Script", and "ModuleScript"

MinifyTable = false, -- If the codegen table itself (made from LuaEncode) is to be minified
UseMinifiedLoader = true -- Use the pre-minified LoadModule script in the codegen, which is always predefined and not useful for debugging
},

-- "Fast-Flags" to be respected at runtime
Flags = {
ContextualExecution = true, -- If client/server context should be checked at runtime, and ignores LuaSourceContainer.Disabled (e.g. LocalScripts only run on the client, Scripts only run on the server)
ReturnMainModule = true -- **If applicable**, return the contents of a "MainModule"-named ModuleScript from the root of the model. This behaves exactly like Roblox's MainModule system
},

-- Property wl/bl overrides
Properties = {
Whitelist = {}, -- [ClassName] = {PropertyName, ...}
Expand All @@ -149,11 +154,17 @@ You can [i]also[/i] use [url=https://rojo.space/docs/v7/sync-details/#json-modul
"Output": {
"Directory": "return script.Parent",
"ScriptName": "MauiGeneratedScript",
"ScriptType": "LocalScript",

"MinifyTable": false,
"UseMinifiedLoader": true
},

"Flags": {
"ContextualExecution": true,
"ReturnMainModule": true
},

"Properties": {
"Whitelist": {},
"Blacklist": {}
Expand Down
Loading

0 comments on commit b03e6c8

Please sign in to comment.