adds forge support, fixes some critical errors
This commit is contained in:
@@ -40,27 +40,38 @@ export const handler: Handlers = {
|
||||
|
||||
return Response.redirect(req.url);
|
||||
},
|
||||
async GET(_, ctx) {
|
||||
const activeMods: string[] = [];
|
||||
const disabledMods: string[] = [];
|
||||
if (
|
||||
SERVER_STATE.serverType !== "unset" &&
|
||||
SERVER_STATE.serverType !== "vanilla"
|
||||
) {
|
||||
for await (const fileEntry of Deno.readDir("./server/mods")) {
|
||||
if (fileEntry.isFile) {
|
||||
activeMods.push(fileEntry.name);
|
||||
}
|
||||
}
|
||||
await ensureDir("./server/disabled-mods");
|
||||
for await (const fileEntry of Deno.readDir("./server/disabled-mods")) {
|
||||
if (fileEntry.isFile) {
|
||||
disabledMods.push(fileEntry.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ctx.render({
|
||||
activeMods,
|
||||
disabledMods,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default async function ModsFolder({ url }: PageProps) {
|
||||
const activeMods: string[] = [];
|
||||
const disabledMods: string[] = [];
|
||||
if (
|
||||
SERVER_STATE.serverType !== "unset" && SERVER_STATE.serverType !== "vanilla"
|
||||
) {
|
||||
for await (const fileEntry of Deno.readDir("./server/mods")) {
|
||||
if (fileEntry.isFile) {
|
||||
activeMods.push(fileEntry.name);
|
||||
}
|
||||
}
|
||||
ensureDir("./server/disabled-mods");
|
||||
for await (const fileEntry of Deno.readDir("./server/disabled-mods")) {
|
||||
if (fileEntry.isFile) {
|
||||
disabledMods.push(fileEntry.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default function ModsFolder(
|
||||
{ url, data: { activeMods, disabledMods } }: PageProps<
|
||||
{ activeMods: string[]; disabledMods: string[] }
|
||||
>,
|
||||
) {
|
||||
return (
|
||||
<div className="container p-8 flex flex-col gap-8">
|
||||
<Content>
|
||||
|
Reference in New Issue
Block a user