diff --git a/.gitignore b/.gitignore index 51e1634..3d14070 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ node_modules -electron \ No newline at end of file +electron +dist +.env diff --git a/README.md b/README.md index 1aef6ed..0b03e29 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,53 @@ -# WaifuBoard v2.0.0 (RECODE) -The official recode repo, its private no one should know about this or have the code but 2 people. +# 🎀 WaifuBoard -# Things to get done: +**Lightweight all-in-one app for boorus, manga and light novels — no sources included, total freedom via extensions.** -| Task | Status | Notes | -| -----|----------| ------ | -| Book Reader | ✅ | N/A | -| Multi book provider loading | ✅ | N/A | -| Better Code Organization | ✅ | N/A | -| Mobile View | Not Done | N/A | -| Gallery | ✅ | N/A | -| Anime Schedule (Release Calendar for the week/month) | ✅ | N/A | -| My List (Tracking) | ✅ | Persistent data would be in a data.db file in waifuboard directory | -| Marketplace | ✅ | Uses the gitea repo | -| Add to list / library | ✅ | Persistent data would be in data.db file in waifuboard directory| -| Gallery favorites | ✅ | Persistent in data.db like how it was previously | -| Change "StreamFlow" to "WaifuBoard" | ✅ | N/A | -| Change the cube icon next to "StreamFlow" to the current ico file | ✅ | Use the ico file from the current waifuboard ver | -| Favicon | ✅ | Use the ico file from the current waifuboard ver | -| Make video player more professional looking | ✅ | N/A | +WaifuBoard Hero +
-***This stuff will get updated as time goes on, please check things off with a green checkmark as you complete them.*** \ No newline at end of file +[![Windows](https://img.shields.io/badge/Windows-SUPPORTED-0078D6?style=for-the-badge&logo=windows&logoColor=white)](https://waifuboard.app) +[![Latest](https://img.shields.io/gitea/v/release/ItsSkaiya/WaifuBoard?gitea_url=https://git.waifuboard.app&style=for-the-badge)](https://git.waifuboard.app/ItsSkaiya/WaifuBoard/releases/latest) +[![Extensions](https://img.shields.io/badge/Extensions-Repository-8257e5?style=for-the-badge)](https://git.waifuboard.app/ItsSkaiya/WaifuBoard-Extensions) + +**[Website](https://waifuboard.app)** • **[Documentation](https://waifuboard.app/docs)** • **[Download Latest](https://git.waifuboard.app/ItsSkaiya/WaifuBoard/releases/latest)** • **[Discord (soon)](#)** + +
+ + +## 🚀 What is WaifuBoard? + +**A lightweight and privacy-friendly desktop app designed around modular extensions.** WaifuBoard delivers a clean, organized reading experience for boorus, manga, and light novels, powered entirely by community-made sources. + +## ✨ Features + +- Lightweight +- Discord Rich Presence +- Super clean & fast UI +- Built-in **Extension Marketplace** +- Fully open-source & community-driven +- Future mobile ports planned + +## 🖥️ Download & Platform Support + +| Platform | Status | Link | +|------------|-----------------|-----------------------------------------------------------| +| Windows | ✅ Available now | [Latest Release](https://git.waifuboard.app/ItsSkaiya/WaifuBoard/releases/latest) | +| Linux | ⏳ Coming soon | — | +| macOS | ⏳ Coming soon | — | + +## 📦 Extensions & Marketplace + +WaifuBoard ships empty. **You decide exactly what sources you want.** + +**Official Extensions Repository** → https://git.waifuboard.app/ItsSkaiya/WaifuBoard-Extensions
+**Extension Development Docs** → https://waifuboard.app/docs + +## ⚠️ Legal Disclaimer + +**WaifuBoard does not host, store, or distribute any content. +All material is retrieved in real time through third-party extensions installed by the user. +You are fully responsible for ensuring that the sources you access comply with the laws of your region.** + +--- + +**Designed for the otakus by an otaku.** 💜 diff --git a/dist/Waifu Board 2.0.0.exe b/dist/Waifu Board 2.0.0.exe index 224f21b..ebc9fe6 100644 Binary files a/dist/Waifu Board 2.0.0.exe and b/dist/Waifu Board 2.0.0.exe differ diff --git a/dist/builder-debug.yml b/dist/builder-debug.yml index fcf8c05..4c888b0 100644 --- a/dist/builder-debug.yml +++ b/dist/builder-debug.yml @@ -29,4 +29,4 @@ x64: - src/scripts/**/* - public/assets/* nsis: - script: "!include \"C:\\Users\\synta\\Documents\\WaifuBoard SRC Code (Multiple In Here)\\Waifu Board (Server)\\node_modules\\app-builder-lib\\templates\\nsis\\include\\StdUtils.nsh\"\n!addincludedir \"C:\\Users\\synta\\Documents\\WaifuBoard SRC Code (Multiple In Here)\\Waifu Board (Server)\\node_modules\\app-builder-lib\\templates\\nsis\\include\"\n!macro _isUpdated _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"updated\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isUpdated `\"\" isUpdated \"\"`\n\n!macro _isForceRun _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"force-run\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForceRun `\"\" isForceRun \"\"`\n\n!macro _isKeepShortcuts _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"keep-shortcuts\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isKeepShortcuts `\"\" isKeepShortcuts \"\"`\n\n!macro _isNoDesktopShortcut _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"no-desktop-shortcut\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isNoDesktopShortcut `\"\" isNoDesktopShortcut \"\"`\n\n!macro _isDeleteAppData _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"delete-app-data\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isDeleteAppData `\"\" isDeleteAppData \"\"`\n\n!macro _isForAllUsers _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"allusers\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForAllUsers `\"\" isForAllUsers \"\"`\n\n!macro _isForCurrentUser _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"currentuser\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForCurrentUser `\"\" isForCurrentUser \"\"`\n\n!macro addLangs\n !insertmacro MUI_LANGUAGE \"English\"\n !insertmacro MUI_LANGUAGE \"German\"\n !insertmacro MUI_LANGUAGE \"French\"\n !insertmacro MUI_LANGUAGE \"SpanishInternational\"\n !insertmacro MUI_LANGUAGE \"SimpChinese\"\n !insertmacro MUI_LANGUAGE \"TradChinese\"\n !insertmacro MUI_LANGUAGE \"Japanese\"\n !insertmacro MUI_LANGUAGE \"Korean\"\n !insertmacro MUI_LANGUAGE \"Italian\"\n !insertmacro MUI_LANGUAGE \"Dutch\"\n !insertmacro MUI_LANGUAGE \"Danish\"\n !insertmacro MUI_LANGUAGE \"Swedish\"\n !insertmacro MUI_LANGUAGE \"Norwegian\"\n !insertmacro MUI_LANGUAGE \"Finnish\"\n !insertmacro MUI_LANGUAGE \"Russian\"\n !insertmacro MUI_LANGUAGE \"Portuguese\"\n !insertmacro MUI_LANGUAGE \"PortugueseBR\"\n !insertmacro MUI_LANGUAGE \"Polish\"\n !insertmacro MUI_LANGUAGE \"Ukrainian\"\n !insertmacro MUI_LANGUAGE \"Czech\"\n !insertmacro MUI_LANGUAGE \"Slovak\"\n !insertmacro MUI_LANGUAGE \"Hungarian\"\n !insertmacro MUI_LANGUAGE \"Arabic\"\n !insertmacro MUI_LANGUAGE \"Turkish\"\n !insertmacro MUI_LANGUAGE \"Thai\"\n !insertmacro MUI_LANGUAGE \"Vietnamese\"\n!macroend\n\n!include \"C:\\Users\\synta\\AppData\\Local\\Temp\\t-D6BYI7\\2-messages.nsh\"\n!addplugindir /x86-unicode \"C:\\Users\\synta\\AppData\\Local\\electron-builder\\Cache\\nsis\\nsis-resources-3.4.1\\plugins\\x86-unicode\"\n\n!include \"common.nsh\"\n!include \"extractAppPackage.nsh\"\n\n# https://github.com/electron-userland/electron-builder/issues/3972#issuecomment-505171582\nCRCCheck off\nWindowIcon Off\nAutoCloseWindow True\nRequestExecutionLevel ${REQUEST_EXECUTION_LEVEL}\n\nFunction .onInit\n !ifndef SPLASH_IMAGE\n SetSilent silent\n !endif\n\n !insertmacro check64BitAndSetRegView\nFunctionEnd\n\nFunction .onGUIInit\n InitPluginsDir\n\n !ifdef SPLASH_IMAGE\n File /oname=$PLUGINSDIR\\splash.bmp \"${SPLASH_IMAGE}\"\n BgImage::SetBg $PLUGINSDIR\\splash.bmp\n BgImage::Redraw\n !endif\nFunctionEnd\n\nSection\n !ifdef SPLASH_IMAGE\n HideWindow\n !endif\n\n StrCpy $INSTDIR \"$PLUGINSDIR\\app\"\n !ifdef UNPACK_DIR_NAME\n StrCpy $INSTDIR \"$TEMP\\${UNPACK_DIR_NAME}\"\n !endif\n\n RMDir /r $INSTDIR\n SetOutPath $INSTDIR\n\n !ifdef APP_DIR_64\n !ifdef APP_DIR_ARM64\n !ifdef APP_DIR_32\n ${if} ${IsNativeARM64}\n File /r \"${APP_DIR_ARM64}\\*.*\"\n ${elseif} ${RunningX64}\n File /r \"${APP_DIR_64}\\*.*\"\n ${else}\n File /r \"${APP_DIR_32}\\*.*\"\n ${endIf}\n !else\n ${if} ${IsNativeARM64}\n File /r \"${APP_DIR_ARM64}\\*.*\"\n ${else}\n File /r \"${APP_DIR_64}\\*.*\"\n {endIf}\n !endif\n !else\n !ifdef APP_DIR_32\n ${if} ${RunningX64}\n File /r \"${APP_DIR_64}\\*.*\"\n ${else}\n File /r \"${APP_DIR_32}\\*.*\"\n ${endIf}\n !else\n File /r \"${APP_DIR_64}\\*.*\"\n !endif\n !endif\n !else\n !ifdef APP_DIR_32\n File /r \"${APP_DIR_32}\\*.*\"\n !else\n !insertmacro extractEmbeddedAppPackage\n !endif\n !endif\n\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_DIR\", \"$EXEDIR\").r0'\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_FILE\", \"$EXEPATH\").r0'\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_APP_FILENAME\", \"${APP_FILENAME}\").r0'\n ${StdUtils.GetAllParameters} $R0 0\n\n !ifdef SPLASH_IMAGE\n BgImage::Destroy\n !endif\n\n\tExecWait \"$INSTDIR\\${APP_EXECUTABLE_FILENAME} $R0\" $0\n SetErrorLevel $0\n\n SetOutPath $EXEDIR\n\tRMDir /r $INSTDIR\nSectionEnd\n" + script: "!include \"C:\\Users\\synta\\Documents\\WaifuBoard SRC Code (Multiple In Here)\\Waifu Board (Server)\\node_modules\\app-builder-lib\\templates\\nsis\\include\\StdUtils.nsh\"\n!addincludedir \"C:\\Users\\synta\\Documents\\WaifuBoard SRC Code (Multiple In Here)\\Waifu Board (Server)\\node_modules\\app-builder-lib\\templates\\nsis\\include\"\n!macro _isUpdated _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"updated\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isUpdated `\"\" isUpdated \"\"`\n\n!macro _isForceRun _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"force-run\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForceRun `\"\" isForceRun \"\"`\n\n!macro _isKeepShortcuts _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"keep-shortcuts\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isKeepShortcuts `\"\" isKeepShortcuts \"\"`\n\n!macro _isNoDesktopShortcut _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"no-desktop-shortcut\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isNoDesktopShortcut `\"\" isNoDesktopShortcut \"\"`\n\n!macro _isDeleteAppData _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"delete-app-data\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isDeleteAppData `\"\" isDeleteAppData \"\"`\n\n!macro _isForAllUsers _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"allusers\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForAllUsers `\"\" isForAllUsers \"\"`\n\n!macro _isForCurrentUser _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"currentuser\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForCurrentUser `\"\" isForCurrentUser \"\"`\n\n!macro addLangs\n !insertmacro MUI_LANGUAGE \"English\"\n !insertmacro MUI_LANGUAGE \"German\"\n !insertmacro MUI_LANGUAGE \"French\"\n !insertmacro MUI_LANGUAGE \"SpanishInternational\"\n !insertmacro MUI_LANGUAGE \"SimpChinese\"\n !insertmacro MUI_LANGUAGE \"TradChinese\"\n !insertmacro MUI_LANGUAGE \"Japanese\"\n !insertmacro MUI_LANGUAGE \"Korean\"\n !insertmacro MUI_LANGUAGE \"Italian\"\n !insertmacro MUI_LANGUAGE \"Dutch\"\n !insertmacro MUI_LANGUAGE \"Danish\"\n !insertmacro MUI_LANGUAGE \"Swedish\"\n !insertmacro MUI_LANGUAGE \"Norwegian\"\n !insertmacro MUI_LANGUAGE \"Finnish\"\n !insertmacro MUI_LANGUAGE \"Russian\"\n !insertmacro MUI_LANGUAGE \"Portuguese\"\n !insertmacro MUI_LANGUAGE \"PortugueseBR\"\n !insertmacro MUI_LANGUAGE \"Polish\"\n !insertmacro MUI_LANGUAGE \"Ukrainian\"\n !insertmacro MUI_LANGUAGE \"Czech\"\n !insertmacro MUI_LANGUAGE \"Slovak\"\n !insertmacro MUI_LANGUAGE \"Hungarian\"\n !insertmacro MUI_LANGUAGE \"Arabic\"\n !insertmacro MUI_LANGUAGE \"Turkish\"\n !insertmacro MUI_LANGUAGE \"Thai\"\n !insertmacro MUI_LANGUAGE \"Vietnamese\"\n!macroend\n\n!include \"C:\\Users\\synta\\AppData\\Local\\Temp\\t-eWlL23\\2-messages.nsh\"\n!addplugindir /x86-unicode \"C:\\Users\\synta\\AppData\\Local\\electron-builder\\Cache\\nsis\\nsis-resources-3.4.1\\plugins\\x86-unicode\"\n\n!include \"common.nsh\"\n!include \"extractAppPackage.nsh\"\n\n# https://github.com/electron-userland/electron-builder/issues/3972#issuecomment-505171582\nCRCCheck off\nWindowIcon Off\nAutoCloseWindow True\nRequestExecutionLevel ${REQUEST_EXECUTION_LEVEL}\n\nFunction .onInit\n !ifndef SPLASH_IMAGE\n SetSilent silent\n !endif\n\n !insertmacro check64BitAndSetRegView\nFunctionEnd\n\nFunction .onGUIInit\n InitPluginsDir\n\n !ifdef SPLASH_IMAGE\n File /oname=$PLUGINSDIR\\splash.bmp \"${SPLASH_IMAGE}\"\n BgImage::SetBg $PLUGINSDIR\\splash.bmp\n BgImage::Redraw\n !endif\nFunctionEnd\n\nSection\n !ifdef SPLASH_IMAGE\n HideWindow\n !endif\n\n StrCpy $INSTDIR \"$PLUGINSDIR\\app\"\n !ifdef UNPACK_DIR_NAME\n StrCpy $INSTDIR \"$TEMP\\${UNPACK_DIR_NAME}\"\n !endif\n\n RMDir /r $INSTDIR\n SetOutPath $INSTDIR\n\n !ifdef APP_DIR_64\n !ifdef APP_DIR_ARM64\n !ifdef APP_DIR_32\n ${if} ${IsNativeARM64}\n File /r \"${APP_DIR_ARM64}\\*.*\"\n ${elseif} ${RunningX64}\n File /r \"${APP_DIR_64}\\*.*\"\n ${else}\n File /r \"${APP_DIR_32}\\*.*\"\n ${endIf}\n !else\n ${if} ${IsNativeARM64}\n File /r \"${APP_DIR_ARM64}\\*.*\"\n ${else}\n File /r \"${APP_DIR_64}\\*.*\"\n {endIf}\n !endif\n !else\n !ifdef APP_DIR_32\n ${if} ${RunningX64}\n File /r \"${APP_DIR_64}\\*.*\"\n ${else}\n File /r \"${APP_DIR_32}\\*.*\"\n ${endIf}\n !else\n File /r \"${APP_DIR_64}\\*.*\"\n !endif\n !endif\n !else\n !ifdef APP_DIR_32\n File /r \"${APP_DIR_32}\\*.*\"\n !else\n !insertmacro extractEmbeddedAppPackage\n !endif\n !endif\n\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_DIR\", \"$EXEDIR\").r0'\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_FILE\", \"$EXEPATH\").r0'\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_APP_FILENAME\", \"${APP_FILENAME}\").r0'\n ${StdUtils.GetAllParameters} $R0 0\n\n !ifdef SPLASH_IMAGE\n BgImage::Destroy\n !endif\n\n\tExecWait \"$INSTDIR\\${APP_EXECUTABLE_FILENAME} $R0\" $0\n SetErrorLevel $0\n\n SetOutPath $EXEDIR\n\tRMDir /r $INSTDIR\nSectionEnd\n" diff --git a/dist/win-unpacked/Waifu Board.exe b/dist/win-unpacked/Waifu Board.exe index 9a50a4d..538eccd 100644 Binary files a/dist/win-unpacked/Waifu Board.exe and b/dist/win-unpacked/Waifu Board.exe differ diff --git a/dist/win-unpacked/resources/app.asar b/dist/win-unpacked/resources/app.asar index f3a9afc..81b6e7f 100644 Binary files a/dist/win-unpacked/resources/app.asar and b/dist/win-unpacked/resources/app.asar differ diff --git a/package-lock.json b/package-lock.json index 15caa4b..3b0b9a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,6 @@ "fastify": "^5.6.2", "jsonwebtoken": "^9.0.3", "node-addon-api": "^8.5.0", - "playwright": "^1.57.0", "playwright-chromium": "^1.57.0", "sqlite3": "^5.1.7" }, @@ -4020,20 +4019,6 @@ "devOptional": true, "license": "ISC" }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -5825,24 +5810,6 @@ "integrity": "sha512-e906FRY0+tV27iq4juKzSYPbUj2do2X2JX4EzSca1631EB2QJQUqGbDuERal7LCtOpxl6x3+nvo9NPZcmjkiFA==", "license": "MIT" }, - "node_modules/playwright": { - "version": "1.57.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.57.0.tgz", - "integrity": "sha512-ilYQj1s8sr2ppEJ2YVadYBN0Mb3mdo9J0wQ+UuDhzYqURwSoW4n1Xs5vs7ORwgDGmyEh33tRMeS8KhdkMoLXQw==", - "license": "Apache-2.0", - "dependencies": { - "playwright-core": "1.57.0" - }, - "bin": { - "playwright": "cli.js" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "fsevents": "2.3.2" - } - }, "node_modules/playwright-chromium": { "version": "1.57.0", "resolved": "https://registry.npmjs.org/playwright-chromium/-/playwright-chromium-1.57.0.tgz", diff --git a/src/scripts/updateNotifier.js b/src/scripts/updateNotifier.js index 0ef6787..b6a1517 100644 --- a/src/scripts/updateNotifier.js +++ b/src/scripts/updateNotifier.js @@ -1,103 +1,102 @@ -const Gitea_OWNER = 'ItsSkaiya'; -const Gitea_REPO = 'WaifuBoard'; -const CURRENT_VERSION = 'v1.6.4'; +const Gitea_OWNER = "ItsSkaiya"; +const Gitea_REPO = "WaifuBoard"; +const CURRENT_VERSION = "v2.0.0-rc.0"; const UPDATE_CHECK_INTERVAL = 5 * 60 * 1000; let currentVersionDisplay; let latestVersionDisplay; let updateToast; -document.addEventListener('DOMContentLoaded', () => { +document.addEventListener("DOMContentLoaded", () => { + currentVersionDisplay = document.getElementById("currentVersionDisplay"); + latestVersionDisplay = document.getElementById("latestVersionDisplay"); + updateToast = document.getElementById("updateToast"); - currentVersionDisplay = document.getElementById('currentVersionDisplay'); - latestVersionDisplay = document.getElementById('latestVersionDisplay'); - updateToast = document.getElementById('updateToast'); + if (currentVersionDisplay) { + currentVersionDisplay.textContent = CURRENT_VERSION; + } - if (currentVersionDisplay) { - currentVersionDisplay.textContent = CURRENT_VERSION; - } + checkForUpdates(); - checkForUpdates(); - - setInterval(checkForUpdates, UPDATE_CHECK_INTERVAL); + setInterval(checkForUpdates, UPDATE_CHECK_INTERVAL); }); function showToast(latestVersion) { - - if (latestVersionDisplay && updateToast) { - latestVersionDisplay.textContent = latestVersion; - updateToast.classList.add('update-available'); - updateToast.classList.remove('hidden'); - - } else { - console.error("Error: Cannot display toast because one or more DOM elements were not found."); - } + if (latestVersionDisplay && updateToast) { + latestVersionDisplay.textContent = latestVersion; + updateToast.classList.add("update-available"); + updateToast.classList.remove("hidden"); + } else { + console.error( + "Error: Cannot display toast because one or more DOM elements were not found.", + ); + } } function hideToast() { - if (updateToast) { - updateToast.classList.add('hidden'); - updateToast.classList.remove('update-available'); - } + if (updateToast) { + updateToast.classList.add("hidden"); + updateToast.classList.remove("update-available"); + } } function isVersionOutdated(versionA, versionB) { + const vA = versionA.replace(/^v/, "").split(".").map(Number); + const vB = versionB.replace(/^v/, "").split(".").map(Number); - const vA = versionA.replace(/^v/, '').split('.').map(Number); - const vB = versionB.replace(/^v/, '').split('.').map(Number); + for (let i = 0; i < Math.max(vA.length, vB.length); i++) { + const numA = vA[i] || 0; + const numB = vB[i] || 0; - for (let i = 0; i < Math.max(vA.length, vB.length); i++) { - const numA = vA[i] || 0; - const numB = vB[i] || 0; + if (numA < numB) return true; + if (numA > numB) return false; + } - if (numA < numB) return true; - if (numA > numB) return false; - } - - return false; + return false; } async function checkForUpdates() { - console.log(`Checking for updates for ${Gitea_OWNER}/${Gitea_REPO}...`); + console.log(`Checking for updates for ${Gitea_OWNER}/${Gitea_REPO}...`); - const apiUrl = `https://git.waifuboard.app/api/v1/repos/${Gitea_OWNER}/${Gitea_REPO}/releases/latest`; + const apiUrl = `https://git.waifuboard.app/api/v1/repos/${Gitea_OWNER}/${Gitea_REPO}/releases/latest`; - try { - const response = await fetch(apiUrl, { - method: 'GET', - headers: { - 'Accept': 'application/json' - } - }); + try { + const response = await fetch(apiUrl, { + method: "GET", + headers: { + Accept: "application/json", + }, + }); - if (!response.ok) { - if (response.status === 404) { - console.info('No releases found for this repository.'); - return; - } - throw new Error(`Gitea API error: ${response.status} ${response.statusText}`); - } - - const data = await response.json(); - - const latestVersion = data.tag_name; - - if (!latestVersion) { - console.warn("Release found but no tag_name present"); - return; - } - - console.log(`Latest Gitea Release: ${latestVersion}`); - - if (isVersionOutdated(CURRENT_VERSION, latestVersion)) { - console.warn('Update available!'); - showToast(latestVersion); - } else { - console.info('Package is up to date.'); - hideToast(); - } - - } catch (error) { - console.error('Failed to fetch Gitea release:', error); + if (!response.ok) { + if (response.status === 404) { + console.info("No releases found for this repository."); + return; + } + throw new Error( + `Gitea API error: ${response.status} ${response.statusText}`, + ); } -} \ No newline at end of file + + const data = await response.json(); + + const latestVersion = data.tag_name; + + if (!latestVersion) { + console.warn("Release found but no tag_name present"); + return; + } + + console.log(`Latest Gitea Release: ${latestVersion}`); + + if (isVersionOutdated(CURRENT_VERSION, latestVersion)) { + console.warn("Update available!"); + showToast(latestVersion); + } else { + console.info("Package is up to date."); + hideToast(); + } + } catch (error) { + console.error("Failed to fetch Gitea release:", error); + } +}