dev #14
| @@ -1,4 +1,4 @@ | ||||
| const appName = "EZPPLauncher"; | ||||
| const appVersion = "2.1.2"; | ||||
| const appVersion = "2.1.3"; | ||||
|  | ||||
| module.exports = { appName, appVersion }; | ||||
|   | ||||
| @@ -44,26 +44,7 @@ const osuEntities = [ | ||||
|   "scores.db", | ||||
| ]; | ||||
|  | ||||
| const patcherFiles = [ | ||||
|   { | ||||
|     name: "patcher.exe", | ||||
|     url_download: "https://ez-pp.farm/assets/patcher.exe", | ||||
|     url_hash: "https://ez-pp.farm/assets/patcher.md5", | ||||
|   }, | ||||
|   { | ||||
|     name: "patch.hook.dll", | ||||
|     url_download: "https://ez-pp.farm/assets/patch.hook.dll", | ||||
|     url_hash: "https://ez-pp.farm/assets/patch.hook.md5", | ||||
|   }, | ||||
| ]; | ||||
|  | ||||
| const uiFiles = [ | ||||
|   { | ||||
|     name: "ezpp!ui.dll", | ||||
|     url_download: "https://ez-pp.farm/assets/ezpp!ui.dll", | ||||
|     url_hash: "https://ez-pp.farm/assets/ezpp!ui.md5", | ||||
|   }, | ||||
| ]; | ||||
| const ezppLauncherUpdateList = "https://ez-pp.farm/ezpplauncher" | ||||
|  | ||||
| async function isValidOsuFolder(path) { | ||||
|   const allFiles = await fs.promises.readdir(path); | ||||
| @@ -265,115 +246,41 @@ function runOsuWithDevServer(osuPath, serverDomain, onExit) { | ||||
|   runFile(osuPath, osuExecuteable, ["-devserver", serverDomain], onExit); | ||||
| } | ||||
|  | ||||
| async function getPatcherUpdates(osuPath) { | ||||
| async function getEZPPLauncherUpdateFiles(osuPath) { | ||||
|   const filesToDownload = []; | ||||
|  | ||||
|   const patcherDir = path.join(osuPath, "EZPPLauncher"); | ||||
|   if (!fs.existsSync(patcherDir)) fs.mkdirSync(patcherDir); | ||||
|  | ||||
|   for (const patcherFile of patcherFiles) { | ||||
|     if (fs.existsSync(path.join(patcherDir, patcherFile.name))) { | ||||
|       const latestPatchFileHash = await (await fetch(patcherFile.url_hash)) | ||||
|         .text(); | ||||
|       const localPatchFileHash = crypto.createHash("md5").update( | ||||
|         fs.readFileSync(path.join(patcherDir, patcherFile.name)), | ||||
|       ).digest("hex"); | ||||
|       if ( | ||||
|         latestPatchFileHash.trim().toLowerCase() != | ||||
|           localPatchFileHash.trim().toLowerCase() | ||||
|       ) filesToDownload.push(patcherFile); | ||||
|     } else filesToDownload.push(patcherFile); | ||||
|   } | ||||
|  | ||||
|   return filesToDownload; | ||||
| } | ||||
|  | ||||
| function downloadPatcherUpdates(osuPath, patcherUpdates) { | ||||
|   const eventEmitter = new EventEmitter(); | ||||
|  | ||||
|   const startDownload = async () => { | ||||
|     const patcherDir = path.join(osuPath, "EZPPLauncher"); | ||||
|     if (!fs.existsSync(patcherDir)) fs.mkdirSync(patcherDir); | ||||
|  | ||||
|     for (const patcherFile of patcherUpdates) { | ||||
|       const fileName = patcherFile.name; | ||||
|       const fileURL = patcherFile.url_download; | ||||
|       const axiosDownloadWithProgress = await axios.get(fileURL, { | ||||
|         responseType: "stream", | ||||
|         onDownloadProgress: (progressEvent) => { | ||||
|           const { loaded, total } = progressEvent; | ||||
|           eventEmitter.emit("data", { | ||||
|             fileName, | ||||
|             loaded, | ||||
|             total, | ||||
|             progress: Math.floor((loaded / total) * 100), | ||||
|           }); | ||||
|         }, | ||||
|       }); | ||||
|  | ||||
|       try { | ||||
|         if (fs.existsSync(path.join(osuPath, "EZPPLauncher", fileName))) { | ||||
|           await fs.promises.rm(path.join(osuPath, "EZPPLauncher", fileName), { | ||||
|             force: true, | ||||
|           }); | ||||
|         } | ||||
|         await fs.promises.writeFile( | ||||
|           path.join(osuPath, "EZPPLauncher", fileName), | ||||
|           axiosDownloadWithProgress.data, | ||||
|         ); | ||||
|       } catch (err) { | ||||
|         console.log(err); | ||||
|         eventEmitter.emit("error", { | ||||
|           fileName, | ||||
|         }); | ||||
|   const updateFilesRequest = await fetch(ezppLauncherUpdateList, { method: "PATCH" }); | ||||
|   const updateFiles = await updateFilesRequest.json(); | ||||
|   for (const updateFile of updateFiles) { | ||||
|     const filePath = path.join(osuPath, ...updateFile.folder.split("/"), updateFile.name); | ||||
|     if (fs.existsSync(filePath)) { | ||||
|       const fileHash = updateFile.md5.toLowerCase(); | ||||
|       const localFileHash = crypto.createHash("md5").update( | ||||
|         fs.readFileSync(filePath), | ||||
|       ).digest("hex").toLowerCase(); | ||||
|       if (fileHash !== localFileHash) { | ||||
|         filesToDownload.push(updateFile); | ||||
|       } | ||||
|     } else { | ||||
|       filesToDownload.push(updateFile); | ||||
|     } | ||||
|   }; | ||||
|  | ||||
|   return { | ||||
|     eventEmitter, | ||||
|     startDownload, | ||||
|   }; | ||||
| } | ||||
|  | ||||
| async function getUIFiles(osuPath) { | ||||
|   const filesToDownload = []; | ||||
|  | ||||
|   const ezppLauncherDir = path.join(osuPath, "EZPPLauncher"); | ||||
|   if (!fs.existsSync(ezppLauncherDir)) fs.mkdirSync(ezppLauncherDir); | ||||
|  | ||||
|   for (const uiFile of uiFiles) { | ||||
|     if (fs.existsSync(path.join(ezppLauncherDir, uiFile.name))) { | ||||
|       const latestPatchFileHash = await (await fetch(uiFile.url_hash)).text(); | ||||
|       const localPatchFileHash = crypto.createHash("md5").update( | ||||
|         fs.readFileSync(path.join(ezppLauncherDir, uiFile.name)), | ||||
|       ).digest("hex"); | ||||
|       if ( | ||||
|         latestPatchFileHash.trim().toLowerCase() != | ||||
|           localPatchFileHash.trim().toLowerCase() | ||||
|       ) filesToDownload.push(uiFile); | ||||
|     } else filesToDownload.push(uiFile); | ||||
|   } | ||||
|  | ||||
|   return filesToDownload; | ||||
| } | ||||
|  | ||||
| function downloadUIFiles(osuPath, uiFiles) { | ||||
| async function downloadEZPPLauncherUpdateFiles(osuPath, updateFiles) { | ||||
|   const eventEmitter = new EventEmitter(); | ||||
|  | ||||
|   const startDownload = async () => { | ||||
|     const ezpplauncherDir = path.join(osuPath, "EZPPLauncher"); | ||||
|     if (!fs.existsSync(ezpplauncherDir)) fs.mkdirSync(ezpplauncherDir); | ||||
|  | ||||
|     for (const uiFile of uiFiles) { | ||||
|       const fileName = uiFile.name; | ||||
|       const fileURL = uiFile.url_download; | ||||
|       const axiosDownloadWithProgress = await axios.get(fileURL, { | ||||
|     for (const updateFile of updateFiles) { | ||||
|       const filePath = path.join(osuPath, ...updateFile.folder.split("/"), updateFile.name); | ||||
|       const folder = path.dirname(filePath); | ||||
|       if (!fs.existsSync(folder)) await fs.promises.mkdir(folder, { recursive: true }); | ||||
|       const axiosDownloadWithProgress = await axios.get(updateFile.url, { | ||||
|         responseType: "stream", | ||||
|         onDownloadProgress: (progressEvent) => { | ||||
|           const { loaded, total } = progressEvent; | ||||
|           eventEmitter.emit("data", { | ||||
|             fileName, | ||||
|             fileName: path.basename(filePath), | ||||
|             loaded, | ||||
|             total, | ||||
|             progress: Math.floor((loaded / total) * 100), | ||||
| @@ -381,24 +288,23 @@ function downloadUIFiles(osuPath, uiFiles) { | ||||
|         }, | ||||
|       }); | ||||
|       try { | ||||
|         if (fs.existsSync(path.join(osuPath, "EZPPLauncher", fileName))) { | ||||
|           await fs.promises.rm(path.join(osuPath, "EZPPLauncher", fileName), { | ||||
|         if (fs.existsSync(filePath)) { | ||||
|           await fs.promises.rm(filePath, { | ||||
|             force: true, | ||||
|           }); | ||||
|         } | ||||
|  | ||||
|         await fs.promises.writeFile( | ||||
|           path.join(osuPath, "EZPPLauncher", fileName), | ||||
|           filePath, | ||||
|           axiosDownloadWithProgress.data, | ||||
|         ); | ||||
|       } catch (err) { | ||||
|         console.log(err); | ||||
|         eventEmitter.emit("error", { | ||||
|           fileName, | ||||
|           fileName: path.basename(filePath), | ||||
|         }); | ||||
|       } | ||||
|     } | ||||
|   }; | ||||
|   } | ||||
|  | ||||
|   return { | ||||
|     eventEmitter, | ||||
| @@ -406,23 +312,41 @@ function downloadUIFiles(osuPath, uiFiles) { | ||||
|   }; | ||||
| } | ||||
|  | ||||
| async function replaceUIFile(osuPath, revert) { | ||||
| async function replaceUIFiles(osuPath, revert) { | ||||
|   if (!revert) { | ||||
|     const ezppUIFile = path.join(osuPath, "EZPPLauncher", "ezpp!ui.dll"); | ||||
|     const oldOsuUIFile = path.join(osuPath, "osu!ui.dll"); | ||||
|     const ezppGameplayFile = path.join(osuPath, "EZPPLauncher", "ezpp!gameplay.dll"); | ||||
|     const oldOsuGameplayFile = path.join(osuPath, "osu!gameplay.dll"); | ||||
|  | ||||
|     await fs.promises.rename( | ||||
|       oldOsuUIFile, | ||||
|       path.join(osuPath, "osu!ui.dll.bak"), | ||||
|     ); | ||||
|     await fs.promises.rename(ezppUIFile, oldOsuUIFile); | ||||
|  | ||||
|     await fs.promises.rename( | ||||
|       oldOsuGameplayFile, | ||||
|       path.join(osuPath, "osu!gameplay.dll.bak"), | ||||
|     ); | ||||
|     await fs.promises.rename(ezppGameplayFile, oldOsuGameplayFile); | ||||
|   } else { | ||||
|     const oldOsuUIFile = path.join(osuPath, "osu!ui.dll"); | ||||
|     const ezppUIFile = path.join(osuPath, "EZPPLauncher", "ezpp!ui.dll"); | ||||
|     const oldOsuGameplayFile = path.join(osuPath, "osu!gameplay.dll"); | ||||
|     const ezppGameplayFile = path.join(osuPath, "EZPPLauncher", "ezpp!gameplay.dll"); | ||||
|  | ||||
|     await fs.promises.rename(oldOsuUIFile, ezppUIFile); | ||||
|     await fs.promises.rename( | ||||
|       path.join(osuPath, "osu!ui.dll.bak"), | ||||
|       oldOsuUIFile, | ||||
|     ); | ||||
|  | ||||
|     await fs.promises.rename(oldOsuGameplayFile, ezppGameplayFile); | ||||
|     await fs.promises.rename( | ||||
|       path.join(osuPath, "osu!gameplay.dll.bak"), | ||||
|       oldOsuGameplayFile, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|  | ||||
| @@ -483,13 +407,11 @@ module.exports = { | ||||
|   getFilesThatNeedUpdate, | ||||
|   downloadUpdateFiles, | ||||
|   runOsuWithDevServer, | ||||
|   getPatcherUpdates, | ||||
|   downloadPatcherUpdates, | ||||
|   downloadUIFiles, | ||||
|   getUIFiles, | ||||
|   replaceUIFile, | ||||
|   replaceUIFiles, | ||||
|   findOsuInstallation, | ||||
|   updateOsuConfigHashes, | ||||
|   runOsuUpdater, | ||||
|   getEZPPLauncherUpdateFiles, | ||||
|   downloadEZPPLauncherUpdateFiles, | ||||
|   gamemodes | ||||
| }; | ||||
|   | ||||
							
								
								
									
										62
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										62
									
								
								main.js
									
									
									
									
									
								
							| @@ -3,15 +3,6 @@ const { app, BrowserWindow, Menu, ipcMain, dialog, shell } = require( | ||||
|   "electron", | ||||
| ); | ||||
|  | ||||
| /* const unhandled = require("electron-unhandled"); | ||||
| unhandled({ | ||||
|   logger: console.error, | ||||
|   showDialog: true, | ||||
|   reportButton: () => { | ||||
|     shell.openExternal("https://ez-pp.farm/discord"); | ||||
|   }, | ||||
| }); */ | ||||
|  | ||||
| const path = require("path"); | ||||
| const serve = require("electron-serve"); | ||||
| const loadURL = serve({ directory: "public" }); | ||||
| @@ -27,15 +18,13 @@ const { | ||||
|   downloadUpdateFiles, | ||||
|   getUserConfig, | ||||
|   runOsuWithDevServer, | ||||
|   getPatcherUpdates, | ||||
|   downloadPatcherUpdates, | ||||
|   getUIFiles, | ||||
|   downloadUIFiles, | ||||
|   replaceUIFile, | ||||
|   replaceUIFiles, | ||||
|   findOsuInstallation, | ||||
|   updateOsuConfigHashes, | ||||
|   runOsuUpdater, | ||||
|   gamemodes, | ||||
|   getEZPPLauncherUpdateFiles, | ||||
|   downloadEZPPLauncherUpdateFiles, | ||||
| } = require("./electron/osuUtil"); | ||||
| const { formatBytes } = require("./electron/formattingUtil"); | ||||
| const windowName = require("get-window-by-name"); | ||||
| @@ -98,7 +87,8 @@ function startOsuStatus() { | ||||
|             const patcherExecuteable = path.join( | ||||
|               userOsuPath, | ||||
|               "EZPPLauncher", | ||||
|               "patcher.exe", | ||||
|               "patcher", | ||||
|               "osu!.patcher.exe", | ||||
|             ); | ||||
|             if (fs.existsSync(patcherExecuteable)) { | ||||
|               runFileDetached(userOsuPath, patcherExecuteable); | ||||
| @@ -414,6 +404,7 @@ function registerIPCPipes() { | ||||
|         type: "error", | ||||
|         message: "osu! path not set!", | ||||
|       }); | ||||
|       mainWindow.webContents.send("ezpplauncher:open-settings"); | ||||
|       return; | ||||
|     } | ||||
|     if (!(await isValidOsuFolder(osuPath))) { | ||||
| @@ -430,38 +421,7 @@ function registerIPCPipes() { | ||||
|     await new Promise((res) => setTimeout(res, 1000)); | ||||
|     const releaseStream = await getGlobalConfig(osuPath).get("_ReleaseStream"); | ||||
|     const latestFiles = await getUpdateFiles(releaseStream); | ||||
|     const uiFiles = await getUIFiles(osuPath); | ||||
|     const updateFiles = await getFilesThatNeedUpdate(osuPath, latestFiles); | ||||
|     if (uiFiles.length > 0) { | ||||
|       const uiDownloader = downloadUIFiles(osuPath, uiFiles); | ||||
|       let errored = false; | ||||
|       uiDownloader.eventEmitter.on("error", (data) => { | ||||
|         const filename = data.fileName; | ||||
|         errored = true; | ||||
|         mainWindow.webContents.send("ezpplauncher:alert", { | ||||
|           type: "error", | ||||
|           message: | ||||
|             `Failed to download/replace ${filename}!\nMaybe try to restart EZPPLauncher.`, | ||||
|         }); | ||||
|       }); | ||||
|       uiDownloader.eventEmitter.on("data", (data) => { | ||||
|         mainWindow.webContents.send("ezpplauncher:launchprogress", { | ||||
|           progress: Math.ceil(data.progress), | ||||
|         }); | ||||
|         mainWindow.webContents.send("ezpplauncher:launchstatus", { | ||||
|           status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${formatBytes(data.total) | ||||
|             })...`, | ||||
|         }); | ||||
|       }); | ||||
|       await uiDownloader.startDownload(); | ||||
|       mainWindow.webContents.send("ezpplauncher:launchprogress", { | ||||
|         progress: -1, | ||||
|       }); | ||||
|       if (errored) { | ||||
|         mainWindow.webContents.send("ezpplauncher:launchabort"); | ||||
|         return; | ||||
|       } | ||||
|     } | ||||
|     if (updateFiles.length > 0) { | ||||
|       const updateDownloader = downloadUpdateFiles(osuPath, updateFiles); | ||||
|       let errored = false; | ||||
| @@ -507,9 +467,9 @@ function registerIPCPipes() { | ||||
|         status: "Looking for patcher updates...", | ||||
|       }); | ||||
|       await new Promise((res) => setTimeout(res, 1000)); | ||||
|       const patchFiles = await getPatcherUpdates(osuPath); | ||||
|       const patchFiles = await getEZPPLauncherUpdateFiles(osuPath); | ||||
|       if (patchFiles.length > 0) { | ||||
|         const patcherDownloader = downloadPatcherUpdates(osuPath, patchFiles); | ||||
|         const patcherDownloader = await downloadEZPPLauncherUpdateFiles(osuPath, patchFiles); | ||||
|         let errored = false; | ||||
|         patcherDownloader.eventEmitter.on("error", (data) => { | ||||
|           const filename = data.fileName; | ||||
| @@ -580,14 +540,14 @@ function registerIPCPipes() { | ||||
|     }); | ||||
|  | ||||
|     await updateOsuConfigHashes(osuPath); | ||||
|     await replaceUIFile(osuPath, false); | ||||
|     await replaceUIFiles(osuPath, false); | ||||
|  | ||||
|     const forceUpdateFiles = [ | ||||
|       ".require_update", | ||||
|       "help.txt", | ||||
|       "_pending", | ||||
|     ]; | ||||
|     //TODO: needs testing | ||||
|  | ||||
|     try { | ||||
|       for (const updateFileName of forceUpdateFiles) { | ||||
|         const updateFile = path.join(osuPath, updateFileName); | ||||
| @@ -635,7 +595,7 @@ function registerIPCPipes() { | ||||
|       }); | ||||
|  | ||||
|       setTimeout(async () => { | ||||
|         await replaceUIFile(osuPath, true); | ||||
|         await replaceUIFiles(osuPath, true); | ||||
|         mainWindow.webContents.send("ezpplauncher:launchabort"); | ||||
|         osuLoaded = false; | ||||
|       }, 5000); | ||||
|   | ||||
							
								
								
									
										1113
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1113
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "ezpplauncher-next", | ||||
|   "version": "2.1.2", | ||||
|   "version": "2.1.3", | ||||
|   "description": "EZPPLauncher rewritten with Svelte.", | ||||
|   "private": false, | ||||
|   "license": "MIT", | ||||
| @@ -61,7 +61,6 @@ | ||||
|     "@rollup/plugin-node-resolve": "^15.2.3", | ||||
|     "@rollup/plugin-terser": "^0.4.4", | ||||
|     "@rollup/plugin-typescript": "^11.1.5", | ||||
|     "@sveltejs/vite-plugin-svelte": "^3.0.1", | ||||
|     "@tsconfig/svelte": "^5.0.2", | ||||
|     "autoprefixer": "^10.4.16", | ||||
|     "concurrently": "^8.2.2", | ||||
|   | ||||
| @@ -115,3 +115,9 @@ ipcRenderer.addListener("ezpplauncher:update", (e, args) => { | ||||
|     new CustomEvent("update", { detail: args }), | ||||
|   ); | ||||
| }); | ||||
|  | ||||
| ipcRenderer.addListener("ezpplauncher:open-settings", (e, args) => { | ||||
|   window.dispatchEvent( | ||||
|     new CustomEvent("open-settings"), | ||||
|   ); | ||||
| }); | ||||
|   | ||||
| @@ -66,6 +66,10 @@ | ||||
|     window.dispatchEvent(new CustomEvent("updateExit")); | ||||
|   }); | ||||
|  | ||||
|   window.addEventListener("open-settings", (e) => { | ||||
|     currentPage.set(Page.Settings); | ||||
|   }); | ||||
|  | ||||
|   window.addEventListener("launchStatusUpdate", (e) => { | ||||
|     const status = (e as CustomEvent).detail.status; | ||||
|     launchStatus.set(status); | ||||
|   | ||||
| @@ -26,12 +26,12 @@ | ||||
|     green: "bg-green-600 dark:bg-green-500", | ||||
|     yellow: "bg-yellow-400", | ||||
|     purple: "bg-purple-600 dark:bg-purple-500", | ||||
|     indigo: "bg-indigo-600 dark:bg-indigo-500", | ||||
|     indigo: "bg-indigo-600 dark:bg-indigo-500" | ||||
|   }; | ||||
|  | ||||
|   let _progress = tweened(0, { | ||||
|     duration: tweenDuration, | ||||
|     easing, | ||||
|     easing | ||||
|   }); | ||||
|  | ||||
|   $: { | ||||
| @@ -50,8 +50,12 @@ | ||||
|     > | ||||
|     <span class="text-sm font-medium text-blue-700 dark:text-white" | ||||
|       >{animate | ||||
|         ? $_progress.toFixed(precision) | ||||
|         : progress.toFixed(precision)}%</span | ||||
|         ? isNaN($_progress) | ||||
|           ? parseInt("100").toFixed(precision) | ||||
|           : $_progress.toFixed(precision) | ||||
|         : isNaN(progress) | ||||
|           ? parseInt("100").toFixed(precision) | ||||
|           : progress.toFixed(precision)}%</span | ||||
|     > | ||||
|   </div> | ||||
| {/if} | ||||
| @@ -63,7 +67,13 @@ | ||||
|         class={twJoin(labelInsideClass, barColors[color])} | ||||
|         style="width: {animate ? $_progress : progress}%" | ||||
|       > | ||||
|         {animate ? $_progress.toFixed(precision) : progress.toFixed(precision)}% | ||||
|         {animate | ||||
|           ? isNaN($_progress) | ||||
|             ? parseInt("100").toFixed(precision) | ||||
|             : $_progress.toFixed(precision) | ||||
|           : isNaN(progress) | ||||
|             ? parseInt("100").toFixed(precision) | ||||
|             : progress.toFixed(precision)}% | ||||
|       </div> | ||||
|     {:else} | ||||
|       <div | ||||
|   | ||||
| @@ -1,11 +1,11 @@ | ||||
| <script lang="ts"> | ||||
|   import { Button, Checkbox } from "flowbite-svelte"; | ||||
|   import { Button } from "flowbite-svelte"; | ||||
|   import Progressbar from "../lib/Progressbar.svelte"; | ||||
|   import { | ||||
|     launching, | ||||
|     patch, | ||||
|     launchStatus, | ||||
|     launchPercentage, | ||||
|     launchPercentage | ||||
|   } from "./../storage/localStore"; | ||||
|   let progressbarFix = true; | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,6 @@ | ||||
| <script lang="ts"> | ||||
|   import { Input, Button, Spinner, Checkbox } from "flowbite-svelte"; | ||||
|   import type { User } from "../types/user"; | ||||
|   import type { Error } from "../types/error"; | ||||
|   import { type User } from "../types/user"; | ||||
|   import { currentPage, currentUser, startup } from "../storage/localStore"; | ||||
|   import toast from "svelte-french-toast"; | ||||
|   import { Page } from "../consts/pages"; | ||||
| @@ -43,14 +42,14 @@ | ||||
|             position: "bottom-center", | ||||
|             className: | ||||
|               "dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100", | ||||
|             duration: 3000, | ||||
|             duration: 3000 | ||||
|           }); | ||||
|         }, | ||||
|         { once: true } | ||||
|       ); | ||||
|       window.dispatchEvent( | ||||
|         new CustomEvent("login-attempt", { | ||||
|           detail: { username, password, saveCredentials }, | ||||
|           detail: { username, password, saveCredentials } | ||||
|         }) | ||||
|       ); | ||||
|     }); | ||||
| @@ -59,13 +58,13 @@ | ||||
|       { | ||||
|         loading: "Logging in...", | ||||
|         success: "Successfully logged in!", | ||||
|         error: "Invalid Username or Password!", | ||||
|         error: "Invalid Username or Password!" | ||||
|       }, | ||||
|       { | ||||
|         position: "bottom-center", | ||||
|         className: | ||||
|           "dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100", | ||||
|         duration: 3000, | ||||
|         duration: 3000 | ||||
|       } | ||||
|     ); | ||||
|   }; | ||||
| @@ -87,7 +86,7 @@ | ||||
|               position: "bottom-center", | ||||
|               className: | ||||
|                 "dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100", | ||||
|               duration: 3000, | ||||
|               duration: 3000 | ||||
|             }); | ||||
|             return; | ||||
|           } | ||||
| @@ -104,7 +103,7 @@ | ||||
|             position: "bottom-center", | ||||
|             className: | ||||
|               "dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100", | ||||
|             duration: 3000, | ||||
|             duration: 3000 | ||||
|           }); | ||||
|           loading = false; | ||||
|         }, | ||||
| @@ -117,13 +116,13 @@ | ||||
|       { | ||||
|         loading: "Logging in...", | ||||
|         success: "Successfully logged in!", | ||||
|         error: "Failed to login.", | ||||
|         error: "Failed to login." | ||||
|       }, | ||||
|       { | ||||
|         position: "bottom-center", | ||||
|         className: | ||||
|           "dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100", | ||||
|         duration: 3000, | ||||
|         duration: 3000 | ||||
|       } | ||||
|     ); | ||||
|   }; | ||||
| @@ -135,7 +134,7 @@ | ||||
|       position: "bottom-center", | ||||
|       className: | ||||
|         "dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100", | ||||
|       duration: 3000, | ||||
|       duration: 3000 | ||||
|     }); | ||||
|   }; | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| const { vitePreprocess } = require("@sveltejs/vite-plugin-svelte"); | ||||
| const preprocess = require("svelte-preprocess"); | ||||
|  | ||||
| const config = { | ||||
|   preprocess: [vitePreprocess({})], | ||||
|   preprocess: [preprocess()], | ||||
| }; | ||||
|  | ||||
| module.exports = config; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user