Skip to content

Commit

Permalink
Can I say it? Introducing ModConf Standalone?
Browse files Browse the repository at this point in the history
  • Loading branch information
DerGoogler committed Aug 1, 2024
1 parent bf04a0e commit 6af65d0
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Website/src/native/IsolatedEval/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class IsolatedEval<T = any> {
DOMParser: IsoDOMParser,
XMLSerializer: IsoXMLSerializer,
SuFile: SuFile,
SuZip: SuZip,
Terminal: Terminal,
Chooser: Chooser,
Shell: Shell,
Expand Down Expand Up @@ -121,6 +122,7 @@ class IsolatedEval<T = any> {
this._prototypeWhitelist.set(IsoXMLSerializer, new Set());
this._prototypeWhitelist.set(XMLSerializer, new Set());
this._prototypeWhitelist.set(SuFile, new Set());
this._prototypeWhitelist.set(SuZip, new Set());
this._prototypeWhitelist.set(ShellClass, new Set());
this._prototypeWhitelist.set(View, new Set());
this._prototypeWhitelist.set(OsClass, new Set());
Expand Down
42 changes: 42 additions & 0 deletions docs/ModConf/STANDALONE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# ModConf Standalone

ModConf Standalone nearly supports everything from the normal ModConf.

## Getting started

Create `/data/adb/mmrl/modconf/<MODID>/modconf.json` with the following content

```json
{
"id": "<MODID>",
"name": "Your name",
"description": "your description",
"main": "<MCALONECWD>/src/index.jsx",
"cwd": "<MCALONECWD>/src"
}
```

### `modconf.json` fields

| Key | Required | Description |
| ------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `id` | Yes | The `id` should always match the folder name otherwise it won't show up |
| `name` | Optional | Used to display the name |
| `description` | Optional | Use to display the description and that it does |
| `main` | No | Here can you set your own index file. Useful when you have a `src` folder.<br/><blockquote>ModFS supported</blockquote> |
| `cwd` | No (yes if `main` is set) | It is required to use `cwd` if `main` is set to ensure the the imports are working<br/><blockquote>ModFS supported</blockquote> |

## Index file

As above decribed you can set your own index path

`src/index.jsx`

```jsx
import React from "react";
import { Page } from "@mmrl/ui";

export default () => {
return <Page>Test</Page>;
};
```
48 changes: 48 additions & 0 deletions docs/ModConf/functions/SuZip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# SuZip

Here will you learn, how `SuZip` works in MMRL. It has the same style as `SuFile`

> [!NOTE]
> `SuZip` is a global part in ModConf. No need to import it.
>
> Unstable class!
## Reading files

```js
const mkprop = new SuZip("file.zip", "path/to/file");
console.log(mkprop.read());
```

## Check for existing

```js
const mkprop = new SuZip("file.zip", "path/to/file");

if (mkprop.exist()) {
console.log("File exist!");
} else {
// stops ModConf
throw new Error("File does not exist!");
}
```

## Listing files

```js
const modules = new SuZip("file.zip", "path/to/file");

if (modules.exist()) {
// path is ignored here
console.log(modules.list());
} else {
throw new Error("Modules folder does not exist");
}
```

## Access native methods

```js
const native = new SuZip("file.zip", "path/to/file");
native.interface;
```

0 comments on commit 6af65d0

Please sign in to comment.