Skip to content

Commit

Permalink
make modfs core external
Browse files Browse the repository at this point in the history
  • Loading branch information
DerGoogler committed Jul 3, 2024
1 parent 3251227 commit 3b46933
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 11 deletions.
6 changes: 6 additions & 0 deletions Website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 33 additions & 8 deletions Website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,38 @@
"version_name": "2.19.18",
"version_code": 21918,
"verified_hosts": [
["mmrl", "i"],
["localhost", "i"],
["mmrl.dergoogler.com", "i"],
["dergoogler.com", "i"],
["dergoogler.github.io", "i"],
["gr.dergoogler.com", "i"],
["googlers-repo.github.io", "i"],
["(localhost|\\b(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)(?::\\d{0,4})?\\b)", "g"]
[
"mmrl",
"i"
],
[
"localhost",
"i"
],
[
"mmrl.dergoogler.com",
"i"
],
[
"dergoogler.com",
"i"
],
[
"dergoogler.github.io",
"i"
],
[
"gr.dergoogler.com",
"i"
],
[
"googlers-repo.github.io",
"i"
],
[
"(localhost|\\b(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)(?::\\d{0,4})?\\b)",
"g"
]
]
},
"main": "index.tsx",
Expand Down Expand Up @@ -68,6 +92,7 @@
"markdown-to-jsx": "^7.4.0",
"material-icons": "^1.10.8",
"material-ui-confirm": "^3.0.11",
"modfs": "^1.0.0",
"monaco-editor": "^0.48.0",
"monaco-editor-core": "^0.46.0",
"monaco-languageclient": "^6.5.0",
Expand Down
10 changes: 7 additions & 3 deletions Website/src/hooks/useModFS.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { SetStateAction } from "./useStateCallback";
import { formatObjectEntries, formatString } from "@Util/stringFormat";
import { useNativeFileStorage } from "./useNativeFileStorage";

import { default as PModFS } from "modfs";

export interface ModFS {
//cli
MSUCLI: string;
Expand Down Expand Up @@ -128,12 +130,14 @@ export const useModFS = () => {
export const ModFSProvider = (props: React.PropsWithChildren) => {
const [modFS, setModFS] = useNativeFileStorage("/data/adb/mmrl/modfs.json", INITIAL_MOD_CONF, { loader: "json" });

const pmodFS = React.useMemo(() => new PModFS(defaultComposer(INITIAL_MOD_CONF, modFS)), [modFS]);

const contextValue = React.useMemo(
() => ({
_modFS: defaultComposer(INITIAL_MOD_CONF, modFS),
__modFS: formatObjectEntries<ModFS>(defaultComposer(INITIAL_MOD_CONF, modFS)),
modFS: (key, adds) => {
return formatString(defaultComposer(INITIAL_MOD_CONF, modFS)[key], { ...modFS, ...adds });
__modFS: pmodFS.formatEntries(),
modFS<K extends keyof ModFS>(key: K, adds: ModFS | object): ModFS[K] {
return PModFS.format(pmodFS.getEntrie(key)!, { ...modFS, ...adds });
},
setModFS: (name, state) => {
setModFS((prev) => {
Expand Down
8 changes: 8 additions & 0 deletions Website/src/util/licenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,14 @@
"version": "3.0.11",
"source": "https://www.npmjs.com/package/material-ui-confirm"
},
{
"name": "modfs",
"author": null,
"license": "MIT",
"description": "ModFS is a json format processor and also used in MMRL as the ModFS system",
"version": "1.0.0",
"source": "https://www.npmjs.com/package/modfs"
},
{
"name": "monaco-editor",
"author": null,
Expand Down

0 comments on commit 3b46933

Please sign in to comment.