Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "moonlight",
"version": "1.3.26",
"packageManager": "pnpm@10.7.1",
"packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748",
"description": "Yet another Discord mod",
"license": "LGPL-3.0-or-later",
"homepage": "https://moonlight-mod.github.io/",
Expand Down
3 changes: 3 additions & 0 deletions packages/browser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ window._moonlightBrowserInit = async () => {
getExtensionDir: (ext: string) => {
return `/extensions/${ext}`;
},
getDistDir() {
return "/dist";
},

async writeConfig(newConfig) {
await writeConfig(newConfig);
Expand Down
10 changes: 6 additions & 4 deletions packages/core-extensions/src/moonbase/native.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MoonlightBranch } from "@moonlight-mod/types";
import type { MoonbaseNatives, RepositoryManifest } from "./types";
import extractAsar from "@moonlight-mod/core/asar";
import { distDir, repoUrlFile, installedVersionFile } from "@moonlight-mod/types/constants";
import { repoUrlFile, installedVersionFile } from "@moonlight-mod/types/constants";
import { parseTarGzip } from "nanotar";

const moonlightGlobal = globalThis.moonlightHost ?? globalThis.moonlightNode;
Expand Down Expand Up @@ -103,9 +103,11 @@ export default function getNatives(): MoonbaseNatives {

if (!tar || !ref) return;

const dist = moonlightNodeSandboxed.fs.join(moonlightGlobal.getMoonlightDir(), distDir);
if (await moonlightNodeSandboxed.fs.exists(dist)) await moonlightNodeSandboxed.fs.rmdir(dist);
await moonlightNodeSandboxed.fs.mkdir(dist);
const dist = moonlightNode.getDistDir();
if (!(await moonlightNodeSandboxed.fs.exists(dist))) await moonlightNodeSandboxed.fs.mkdir(dist);
for (const entry of await moonlightNodeSandboxed.fs.readdir(dist)) {
await moonlightNodeSandboxed.fs.rmdir(entry);
}

logger.debug("Extracting update");
const files = await parseTarGzip(tar);
Expand Down
3 changes: 3 additions & 0 deletions packages/node-preload/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ async function injectGlobals() {
},
getExtensionDir: (ext: string) => {
return path.join(extensionsPath, ext);
},
getDistDir() {
return module.path;
}
};

Expand Down
1 change: 1 addition & 0 deletions packages/types/src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export type MoonlightNode = {
getLogger: (id: string) => Logger;
getMoonlightDir: () => string;
getExtensionDir: (ext: string) => string;
getDistDir: () => string;
};

export type MoonlightNodeSandboxed = {
Expand Down