From 05786f822cd0efae84c1db6cbb5a72d3e5316577 Mon Sep 17 00:00:00 2001 From: zumbiepig <121742281+zumbiepig@users.noreply.github.com> Date: Thu, 25 Jul 2024 15:09:32 -0700 Subject: [PATCH] . --- .github/dependabot.yml | 6 +- .github/workflows/build.yml | 2 +- .github/workflows/gh-pages.yml | 4 +- .prettierrc.json | 3 +- eslint.config.js | 14 +- public/404.html | 6 +- public/home/archive/index.html | 4 +- public/home/clients/index.html | 4 +- public/home/downloads/index.html | 4 +- public/home/game/index.html | 4 +- public/index.html | 28 +-- public/mobile/index.html | 4 +- public/mods/client/index.html | 4 +- public/mods/mods/index.html | 4 +- public/mods/resourcepacks/index.html | 4 +- public/resources/styles/default.css | 10 +- public/servers/index.html | 4 +- public/settings/index.html | 4 +- public/temp.html | 4 +- public/updates/index.html | 6 +- routes/index.js | 6 +- routes/users.js | 6 +- server.js | 60 +++---- src/resources/scripts/main.ts | 184 +++++++++++--------- src/resources/scripts/mods/mods.ts | 20 +-- src/resources/scripts/mods/resourcepacks.ts | 20 +-- tsconfig.json | 2 +- 27 files changed, 216 insertions(+), 205 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 42adb44..301e978 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,7 @@ version: 2 updates: - - package-ecosystem: "npm" - directory: "/" + - package-ecosystem: 'npm' + directory: '/' schedule: - interval: "weekly" + interval: 'weekly' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec6c22e..50062bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version-file: "package.json" + node-version-file: 'package.json' - name: Install dependencies run: npm ci - name: Lint diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 627ca96..2c661d5 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: concurrency: - group: "gh-pages" + group: 'gh-pages' cancel-in-progress: false jobs: @@ -21,7 +21,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version-file: "package.json" + node-version-file: 'package.json' - name: Install dependencies run: npm ci - name: Build diff --git a/.prettierrc.json b/.prettierrc.json index 8cf5d1d..db76700 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,4 +1,5 @@ { "printWidth": 1000, - "useTabs": true + "useTabs": true, + "singleQuote": true } diff --git a/eslint.config.js b/eslint.config.js index e8ca6af..07b1e7f 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,12 +1,4 @@ -import eslint from "@eslint/js"; -import tseslint from "typescript-eslint"; +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; -export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked, { - ignores: ["node_modules"], - languageOptions: { - parserOptions: { - project: true, - tsconfigRootDir: import.meta.dirname, - }, - }, -}); +export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended); diff --git a/public/404.html b/public/404.html index 7657efd..b3b25d6 100644 --- a/public/404.html +++ b/public/404.html @@ -3,7 +3,7 @@ - + diff --git a/public/home/archive/index.html b/public/home/archive/index.html index d3b7c79..cc16fac 100644 --- a/public/home/archive/index.html +++ b/public/home/archive/index.html @@ -11,8 +11,8 @@ function gtag() { dataLayer.push(arguments); } - gtag("js", new Date()); - gtag("config", "G-972V2NZ2ZK"); + gtag('js', new Date()); + gtag('config', 'G-972V2NZ2ZK'); diff --git a/public/home/clients/index.html b/public/home/clients/index.html index 3e59d51..47a57a2 100644 --- a/public/home/clients/index.html +++ b/public/home/clients/index.html @@ -11,8 +11,8 @@ function gtag() { dataLayer.push(arguments); } - gtag("js", new Date()); - gtag("config", "G-972V2NZ2ZK"); + gtag('js', new Date()); + gtag('config', 'G-972V2NZ2ZK'); diff --git a/public/home/downloads/index.html b/public/home/downloads/index.html index 6d7fc74..b9d5965 100644 --- a/public/home/downloads/index.html +++ b/public/home/downloads/index.html @@ -11,8 +11,8 @@ function gtag() { dataLayer.push(arguments); } - gtag("js", new Date()); - gtag("config", "G-972V2NZ2ZK"); + gtag('js', new Date()); + gtag('config', 'G-972V2NZ2ZK'); diff --git a/public/home/game/index.html b/public/home/game/index.html index 0eff225..1caf7c7 100644 --- a/public/home/game/index.html +++ b/public/home/game/index.html @@ -11,8 +11,8 @@ function gtag() { dataLayer.push(arguments); } - gtag("js", new Date()); - gtag("config", "G-972V2NZ2ZK"); + gtag('js', new Date()); + gtag('config', 'G-972V2NZ2ZK'); diff --git a/public/index.html b/public/index.html index 5561ee2..e66fd97 100644 --- a/public/index.html +++ b/public/index.html @@ -19,15 +19,15 @@ function gtag() { dataLayer.push(arguments); } - gtag("js", new Date()); - gtag("config", "G-972V2NZ2ZK"); + gtag('js', new Date()); + gtag('config', 'G-972V2NZ2ZK'); diff --git a/public/mods/client/index.html b/public/mods/client/index.html index cfa8b05..a5033f2 100644 --- a/public/mods/client/index.html +++ b/public/mods/client/index.html @@ -11,8 +11,8 @@ function gtag() { dataLayer.push(arguments); } - gtag("js", new Date()); - gtag("config", "G-972V2NZ2ZK"); + gtag('js', new Date()); + gtag('config', 'G-972V2NZ2ZK'); diff --git a/public/mods/mods/index.html b/public/mods/mods/index.html index f8dabb9..a6556da 100644 --- a/public/mods/mods/index.html +++ b/public/mods/mods/index.html @@ -12,8 +12,8 @@ function gtag() { dataLayer.push(arguments); } - gtag("js", new Date()); - gtag("config", "G-972V2NZ2ZK"); + gtag('js', new Date()); + gtag('config', 'G-972V2NZ2ZK'); diff --git a/public/mods/resourcepacks/index.html b/public/mods/resourcepacks/index.html index cc84f38..e80847b 100644 --- a/public/mods/resourcepacks/index.html +++ b/public/mods/resourcepacks/index.html @@ -12,8 +12,8 @@ function gtag() { dataLayer.push(arguments); } - gtag("js", new Date()); - gtag("config", "G-972V2NZ2ZK"); + gtag('js', new Date()); + gtag('config', 'G-972V2NZ2ZK'); diff --git a/public/resources/styles/default.css b/public/resources/styles/default.css index f382ab6..ce2128b 100644 --- a/public/resources/styles/default.css +++ b/public/resources/styles/default.css @@ -1,6 +1,6 @@ body { margin: 0; - font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #1e1e1e; color: #fff; overflow: hidden; @@ -188,7 +188,7 @@ nav { display: flex; align-items: center; justify-content: center; - font-family: "MinecraftRegular", sans-serif; + font-family: 'MinecraftRegular', sans-serif; font-size: 1em; padding: 7px; border: 2px solid #000; @@ -273,7 +273,7 @@ nav { } .play-button::before { - content: ""; + content: ''; position: absolute; top: 50%; left: 50%; @@ -441,14 +441,14 @@ nav { select { width: 100%; padding: 10px; - font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight: bold; color: #e0e0e0; background-color: #08a74a; box-shadow: 4px 4px 0px #2a2a2a, -4px -4px 0px #2a2a2a; border-radius: 3px; appearance: none; - background-image: url("/resources/images/icons/dropdown-selector.png"), linear-gradient(45deg, #0a8338, #086126); + background-image: url('/resources/images/icons/dropdown-selector.png'), linear-gradient(45deg, #0a8338, #086126); background-repeat: no-repeat, repeat; background-position: right 10px center, 0 0; background-size: 15px auto, 100%; diff --git a/public/servers/index.html b/public/servers/index.html index c8d8672..63fd198 100644 --- a/public/servers/index.html +++ b/public/servers/index.html @@ -11,8 +11,8 @@ function gtag() { dataLayer.push(arguments); } - gtag("js", new Date()); - gtag("config", "G-972V2NZ2ZK"); + gtag('js', new Date()); + gtag('config', 'G-972V2NZ2ZK'); diff --git a/public/settings/index.html b/public/settings/index.html index b1a14f7..a44aa75 100644 --- a/public/settings/index.html +++ b/public/settings/index.html @@ -11,8 +11,8 @@ function gtag() { dataLayer.push(arguments); } - gtag("js", new Date()); - gtag("config", "G-972V2NZ2ZK"); + gtag('js', new Date()); + gtag('config', 'G-972V2NZ2ZK'); diff --git a/public/temp.html b/public/temp.html index 81d6c73..8b920dc 100644 --- a/public/temp.html +++ b/public/temp.html @@ -11,8 +11,8 @@ function gtag() { dataLayer.push(arguments); } - gtag("js", new Date()); - gtag("config", "G-972V2NZ2ZK"); + gtag('js', new Date()); + gtag('config', 'G-972V2NZ2ZK'); diff --git a/public/updates/index.html b/public/updates/index.html index ebbf97f..d30191b 100644 --- a/public/updates/index.html +++ b/public/updates/index.html @@ -3,7 +3,7 @@ - + diff --git a/routes/index.js b/routes/index.js index b74eae6..e94eedb 100644 --- a/routes/index.js +++ b/routes/index.js @@ -1,9 +1,9 @@ -import { Router } from "express"; +import { Router } from 'express'; const router = Router(); /* GET home page. */ -router.get("/", function (req, res, next) { - res.render("index", { title: "Express" }); +router.get('/', function (req, res, next) { + res.render('index', { title: 'Express' }); }); export default router; diff --git a/routes/users.js b/routes/users.js index 2b0d593..e2e5cd4 100644 --- a/routes/users.js +++ b/routes/users.js @@ -1,9 +1,9 @@ -import { Router } from "express"; +import { Router } from 'express'; const router = Router(); /* GET users listing. */ -router.get("/", function (req, res, next) { - res.send("respond with a resource"); +router.get('/', function (req, res, next) { + res.send('respond with a resource'); }); export default router; diff --git a/server.js b/server.js index 3873a52..c4b4f82 100755 --- a/server.js +++ b/server.js @@ -1,28 +1,28 @@ -import createError from "http-errors"; -import express, { json, urlencoded, static as serveStatic } from "express"; -import { join } from "path"; -import cookieParser from "cookie-parser"; -import logger from "morgan"; -import debug from "debug"; -import { createServer } from "http"; -import indexRouter from "./routes/index.js"; -import usersRouter from "./routes/users.js"; +import createError from 'http-errors'; +import express, { json, urlencoded, static as serveStatic } from 'express'; +import { join } from 'path'; +import cookieParser from 'cookie-parser'; +import logger from 'morgan'; +import debug from 'debug'; +import { createServer } from 'http'; +import indexRouter from './routes/index.js'; +import usersRouter from './routes/users.js'; const __dirname = import.meta.dirname; const app = express(); -app.set("views", join(__dirname, "views")); -app.set("view engine", "pug"); +app.set('views', join(__dirname, 'views')); +app.set('view engine', 'pug'); -app.use(logger("dev")); +app.use(logger('dev')); app.use(json()); app.use(urlencoded({ extended: false })); app.use(cookieParser()); -app.use(serveStatic(join(__dirname, "public"))); +app.use(serveStatic(join(__dirname, 'public'))); -app.use("/", indexRouter); -app.use("/users", usersRouter); +app.use('/', indexRouter); +app.use('/users', usersRouter); app.use(function (req, res, next) { next(createError(404)); @@ -30,22 +30,22 @@ app.use(function (req, res, next) { app.use(function (err, req, res, next) { res.locals.message = err.message; - res.locals.error = req.app.get("env") === "development" ? err : {}; + res.locals.error = req.app.get('env') === 'development' ? err : {}; res.status(err.status || 500); - res.render("error"); + res.render('error'); }); -const debugLogger = debug("minexlauncher:server"); +const debugLogger = debug('minexlauncher:server'); -const port = normalizePort(process.env.PORT || "3000"); -app.set("port", port); +const port = normalizePort(process.env.PORT || '3000'); +app.set('port', port); const server = createServer(app); server.listen(port); -server.on("error", onError); -server.on("listening", onListening); +server.on('error', onError); +server.on('listening', onListening); function normalizePort(val) { const port = parseInt(val, 10); @@ -59,17 +59,17 @@ function normalizePort(val) { } function onError(error) { - if (error.syscall !== "listen") { + if (error.syscall !== 'listen') { throw error; } - const bind = typeof port === "string" ? "Pipe " + port : "Port " + port; + const bind = typeof port === 'string' ? 'Pipe ' + port : 'Port ' + port; switch (error.code) { - case "EACCES": - console.error(bind + " requires elevated privileges"); + case 'EACCES': + console.error(bind + ' requires elevated privileges'); process.exit(1); break; - case "EADDRINUSE": - console.error(bind + " is already in use"); + case 'EADDRINUSE': + console.error(bind + ' is already in use'); process.exit(1); break; default: @@ -79,6 +79,6 @@ function onError(error) { function onListening() { const addr = server.address(); - const bind = typeof addr === "string" ? "pipe " + addr : "port " + addr.port; - debugLogger("Listening on " + bind); + const bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port; + debugLogger('Listening on ' + bind); } diff --git a/src/resources/scripts/main.ts b/src/resources/scripts/main.ts index cc2b695..ffe2e0a 100644 --- a/src/resources/scripts/main.ts +++ b/src/resources/scripts/main.ts @@ -1,52 +1,44 @@ -let selectedVersion = ""; - -document.addEventListener("DOMContentLoaded", function () { - const usernameForm = document.getElementById("username-form") as HTMLFormElement; - const usernameInput = document.getElementById("username-input") as HTMLInputElement; - const profileName = document.getElementById("profile-name"); - - const savedUsername = cookie.get("launcher_username"); - if (profileName && savedUsername) { - profileName.textContent = savedUsername; - } else if (profileName && !savedUsername) { - profileName.textContent = "Default"; - } - - if (profileName && window.location.pathname === "/settings/") { - usernameForm.addEventListener("submit", function (event) { - event.preventDefault(); - const username = usernameInput.value.trim(); - if (username) { - profileName.textContent = username; - cookie.set("launcher_username", username, 30); - } - }); - } -}); +const theme = { + load() { + const setTheme = cookie.get('minexlauncher.theme'); + if (setTheme === null) { + theme.set('default'); + } else if (setTheme !== 'default') { + const link = document.createElement('link'); + link.rel = 'stylesheet'; + link.href = '/resources/styles/' + setTheme + '.css'; + document.head.appendChild(link); + } + }, + set(setTheme: string) { + cookie.set('minexlauncher.theme', setTheme, 30); + window.location.reload(); + }, +}; const versionSelector = { open() { - const customOptions = document.querySelector(".custom-options"); - const customSelect = document.querySelector(".custom-select"); + const customOptions = document.querySelector('.custom-options'); + const customSelect = document.querySelector('.custom-select'); if (customOptions && customSelect) { - customOptions.classList.add("open"); - customSelect.classList.add("open"); + customOptions.classList.add('open'); + customSelect.classList.add('open'); } }, close() { - const customOptions = document.querySelector(".custom-options"); - const customSelect = document.querySelector(".custom-select"); + const customOptions = document.querySelector('.custom-options'); + const customSelect = document.querySelector('.custom-select'); if (customOptions && customSelect) { - customOptions.classList.remove("open"); - customSelect.classList.remove("open"); + customOptions.classList.remove('open'); + customSelect.classList.remove('open'); } }, toggle() { - const customOptions = document.querySelector(".custom-options"); - const customSelect = document.querySelector(".custom-select"); + const customOptions = document.querySelector('.custom-options'); + const customSelect = document.querySelector('.custom-select'); if (customOptions && customSelect) { - customOptions.classList.toggle("open"); - customSelect.classList.toggle("open"); + customOptions.classList.toggle('open'); + customSelect.classList.toggle('open'); } }, }; @@ -55,20 +47,20 @@ const game = { play(version?: string) { if (version) { embed.remove(); - // @ts-expect-error 1234567890 + // @ts-expect-error 123 window.top.location.href = version; } else if (selectedVersion) { embed.remove(); - // @ts-expect-error 1234567890 + // @ts-expect-error 123 window.top.location.href = selectedVersion; } else { - alert("Please select a version to play."); + alert('Please select a version to play.'); return; } }, select(path: string, name: string) { selectedVersion = path; - const selector = document.querySelector(".custom-select"); + const selector = document.querySelector('.custom-select'); if (selector?.textContent) { if (name) { selector.textContent = `Selected: ${name}`; @@ -80,13 +72,13 @@ const game = { }, archive(client: string) { const clients: Record = { - "1.8.8": "18-client-version", - "1.5.2": "15-client-version", - "b1.3": "b13-client-version", + '1.8.8': '18-client-version', + '1.5.2': '15-client-version', + 'b1.3': 'b13-client-version', }; const dropdown = clients[client] ? (document.getElementById(clients[client]) as HTMLSelectElement) : null; if (dropdown?.value) { - selectedVersion = `https://archive.eaglercraft.rip/Eaglercraft${client === "b1.3" ? "_b1.3" : `_${client}`}/client/${dropdown.value}/index.html`; + selectedVersion = `https://archive.eaglercraft.rip/Eaglercraft${client === 'b1.3' ? '_b1.3' : `_${client}`}/client/${dropdown.value}/index.html`; game.play(); } }, @@ -94,23 +86,23 @@ const game = { const embed = { create() { - const iframe = document.createElement("iframe"); - iframe.id = "embed"; - iframe.style.position = "fixed"; - iframe.style.top = "0"; - iframe.style.left = "0"; - iframe.style.width = "100%"; - iframe.style.height = "100%"; - iframe.style.border = "none"; + const iframe = document.createElement('iframe'); + iframe.id = 'embed'; + iframe.style.position = 'fixed'; + iframe.style.top = '0'; + iframe.style.left = '0'; + iframe.style.width = '100%'; + iframe.style.height = '100%'; + iframe.style.border = 'none'; if (isMobile()) { - iframe.src = "/mobile/"; + iframe.src = '/mobile/'; } else { - iframe.src = "/home/"; + iframe.src = '/home/'; } document.body.appendChild(iframe); }, remove() { - const iframe = document.getElementById("embed"); + const iframe = document.getElementById('embed'); iframe?.remove(); }, }; @@ -118,62 +110,64 @@ const embed = { const navigate = { home: { game() { - window.location.href = "/home/game/"; + window.location.href = '/home/game/'; }, clients() { - window.location.href = "/home/clients/"; + window.location.href = '/home/clients/'; }, archive() { - window.location.href = "/home/archive/"; + window.location.href = '/home/archive/'; }, downloads() { - window.location.href = "/home/downloads/"; + window.location.href = '/home/downloads/'; }, }, mods: { client() { - window.location.href = "/mods/client/"; + window.location.href = '/mods/client/'; }, mods() { - window.location.href = "/mods/mods/"; + window.location.href = '/mods/mods/'; }, resourcepacks() { - window.location.href = "/mods/resourcepacks/"; + window.location.href = '/mods/resourcepacks/'; }, }, mobile() { - window.location.href = "/mobile/"; + window.location.href = '/mobile/'; }, updates() { - window.location.href = "/updates/"; + window.location.href = '/updates/'; }, servers() { - window.location.href = "/servers/"; + window.location.href = '/servers/'; }, settings() { - window.location.href = "/settings/"; + window.location.href = '/settings/'; }, }; const cookie = { - get(name: string): string | null { - const cookieArr = document.cookie.split(";"); - for (const cookie of cookieArr) { - const cookiePair = cookie.split("="); - if (name === cookiePair[0]?.trim()) { - return decodeURIComponent(cookiePair[1] ?? ""); + get(key: string): string | null { + for (const cookie of document.cookie.replaceAll('; ', ';').split(';')) { + const cookiePair = cookie.split('='); + if (encodeURIComponent(key) === cookiePair[0]) { + return decodeURIComponent(cookiePair[1]); } } return null; }, - set(name: string, value: string, days: number) { - let expires = ""; + set(key: string, value: string, days: number) { + let maxAge; if (days) { - const date = new Date(); - date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); - expires = "; expires=" + date.toUTCString(); + maxAge = days * 60 * 60 * 24; + } else { + maxAge = 31536000; } - document.cookie = name + "=" + (value || "") + expires + "; path=/; domain=" + window.location.hostname.replace(/^www\./, ""); + document.cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)}; max-age=${maxAge}; path=/; secure`; + }, + delete(key: string) { + document.cookie = `${encodeURIComponent(key)}=; max-age=0; path=/`; }, }; @@ -193,10 +187,34 @@ function isMobile(): boolean { } } -if (window.location.hostname === "0.0.0.0") { - versionSelector; - game; +if (window.location.hostname === '0.0.0.0') { navigate; query; - isMobile; } + +let selectedVersion: string; +theme.load(); + +document.addEventListener('DOMContentLoaded', function () { + const usernameForm = document.getElementById('username-form') as HTMLFormElement; + const usernameInput = document.getElementById('username-input') as HTMLInputElement; + const profileName = document.getElementById('profile-name'); + + const savedUsername = cookie.get('minexlauncher.username'); + if (profileName && savedUsername) { + profileName.textContent = savedUsername; + } else if (profileName && !savedUsername) { + profileName.textContent = 'Default'; + } + + if (profileName && window.location.pathname === '/settings/') { + usernameForm.addEventListener('submit', function (event) { + event.preventDefault(); + const username = usernameInput.value.trim(); + if (username) { + cookie.set('minexlauncher.username', username, 30); + profileName.textContent = cookie.get('minexlauncher.username'); + } + }); + } +}); diff --git a/src/resources/scripts/mods/mods.ts b/src/resources/scripts/mods/mods.ts index beaef27..84b8acf 100644 --- a/src/resources/scripts/mods/mods.ts +++ b/src/resources/scripts/mods/mods.ts @@ -1,22 +1,22 @@ -document.addEventListener("DOMContentLoaded", function () { - fetch("/resources/data/mods.json") +document.addEventListener('DOMContentLoaded', function () { + fetch('/resources/data/mods.json') .then((response) => response.json()) .then((data: { mods: { [x: string]: string; icon: string; author: string; description: string }[] }) => { - const modListElement = document.querySelector(".mod-list"); + const modListElement = document.querySelector('.mod-list'); data.mods.forEach((mod: { [x: string]: string; icon: string; author: string; description: string }) => { - const modItem = document.createElement("div"); - modItem.classList.add("mod-item"); + const modItem = document.createElement('div'); + modItem.classList.add('mod-item'); modItem.innerHTML = `
-

${mod["display-name"] ?? ""}

-

By ${mod.author}

+

${mod['display-name'] ?? ''}

+

By ${mod.author}

${mod.description}

`; @@ -24,6 +24,6 @@ document.addEventListener("DOMContentLoaded", function () { }); }) .catch((error: unknown) => { - console.error("Error fetching mods:", error); + console.error('Error fetching mods:', error); }); }); diff --git a/src/resources/scripts/mods/resourcepacks.ts b/src/resources/scripts/mods/resourcepacks.ts index 76e880f..804c281 100644 --- a/src/resources/scripts/mods/resourcepacks.ts +++ b/src/resources/scripts/mods/resourcepacks.ts @@ -1,22 +1,22 @@ -document.addEventListener("DOMContentLoaded", function () { - fetch("/resources/data/mods.json") +document.addEventListener('DOMContentLoaded', function () { + fetch('/resources/data/mods.json') .then((response) => response.json()) .then((data: { resourcepacks: { [x: string]: string; icon: string; author: string; description: string }[] }) => { - const modListElement = document.querySelector(".mod-list"); + const modListElement = document.querySelector('.mod-list'); data.resourcepacks.forEach((mod: { [x: string]: string; icon: string; author: string; description: string }) => { - const modItem = document.createElement("div"); - modItem.classList.add("mod-item"); + const modItem = document.createElement('div'); + modItem.classList.add('mod-item'); modItem.innerHTML = `
-

${mod["display-name"] ?? ""}

-

By ${mod.author}

+

${mod['display-name'] ?? ''}

+

By ${mod.author}

${mod.description}

`; @@ -24,6 +24,6 @@ document.addEventListener("DOMContentLoaded", function () { }); }) .catch((error: unknown) => { - console.error("Error fetching resource packs:", error); + console.error('Error fetching resource packs:', error); }); }); diff --git a/tsconfig.json b/tsconfig.json index 1de6b70..36c1cfd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": ["@tsconfig/node20/tsconfig", "@tsconfig/strictest/tsconfig"], + "extends": ["@tsconfig/node20/tsconfig"], "compilerOptions": { "moduleResolution": "bundler", "module": "preserve",