diff --git a/LICENSE b/LICENSE index 95c5877..e53ab3e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 v182 +Copyright (c) 2024 redo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 17d9b24..1fbfc9f 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,6 @@ -

Gray shape shifter

Nero

Modern & up to date Pterodactyl Client Dashboard

- - - - -


-


## :star: Features @@ -34,9 +27,12 @@ ## :zap: Documentation [Click here](https://nero-docs.pages.dev/) -## Demo -[Click here](https://nero-demo.pages.dev) - ## Preview Preview1 Preview2 + +## Support +Open a Issue or join our [Discord](https://discord.gg/Ku7chqmbCS) + +## Note +Be aware that Nero is a reworked & updated version of the Client known as [NorthClient](https://github.com/northdevelopment/northclient) diff --git a/db.sqlite b/db.sqlite index be4ccfb..3bec4b2 100644 Binary files a/db.sqlite and b/db.sqlite differ diff --git a/routes/auth/email.js b/routes/auth/email.js index 91f79a6..fe36a1c 100644 --- a/routes/auth/email.js +++ b/routes/auth/email.js @@ -2,104 +2,146 @@ const settings = require('../../handlers/readSettings').settings(); const mailer = require("../../handlers/mailer").mailer(); const makeid = require("../../handlers/makeid"); const fetch = require("node-fetch"); +const Swal = require('sweetalert2'); + +function sendAlert(res, message) { + res.send(` + + + + + + + + + `); +} + module.exports.load = async function(app, ejs, db) { - app.get("/auth/login", async (req, res) => { - if (!req.query.email || !req.query.password) return res.send("
Missing information.
") - const user = await db.get(`user-${req.query.email}`); - if (!user) return res.send({error: "Invalid Email or Password."}); - if (user.password !== req.query.password) return res.send({error: "Invalid Email or Password."}); + app.get("/auth/login", async (req, res) => { + if (!req.query.email || !req.query.password) { + return res.json({ error: "Missing information." }); + } + const user = await db.get(`user-${req.query.email}`); + if (!user) { + return res.json({ error: "Invalid Email or Password." }); + } + if (user.password !== req.query.password) { + return res.json({ error: "Invalid Email or Password." }); + } - let cacheaccount = await fetch( - `${settings.pterodactyl.domain}/api/application/users/${await db.get(`users-${req.query.email}`)}?include=servers`, - { - method: "get", - headers: { 'Content-Type': 'application/json', "Authorization": `Bearer ${settings.pterodactyl.key}` } - } - ); - if (await cacheaccount.statusText == "Not Found") return res.send("An error has occured while attempting to get your user information."); - cacheaccount = JSON.parse(await cacheaccount.text()); + let cacheaccount = await fetch( + `${settings.pterodactyl.domain}/api/application/users/${await db.get(`users-${req.query.email}`)}?include=servers`, + { + method: "get", + headers: { 'Content-Type': 'application/json', "Authorization": `Bearer ${settings.pterodactyl.key}` } + } + ); + if (await cacheaccount.statusText == "Not Found") { + return res.json({ error: "An error has occurred while attempting to get your user information." }); + } + cacheaccount = JSON.parse(await cacheaccount.text()); - req.session.pterodactyl = cacheaccount.attributes; - req.session.userinfo = user; - return res.redirect("/dashboard") - }); + req.session.pterodactyl = cacheaccount.attributes; + req.session.userinfo = user; + return res.json({ success: true }); + }); - app.get("/auth/register", async (req, res) => { - if (!req.query.email || !req.query.username || !req.query.password) return res.send("
Missing information
") - if (await db.get(`user-${req.query.email}`)) return res.send("Already registered."); - const userinfo = { - username: req.query.username, - id: req.query.email, - password: req.query.password, - discriminator: null - } - const accountjson = await fetch( - `${settings.pterodactyl.domain}/api/application/users`, { - method: "post", - headers: { - 'Content-Type': 'application/json', - "Authorization": `Bearer ${settings.pterodactyl.key}` - }, - body: JSON.stringify({ - username: req.query.username, - email: req.query.email, - first_name: req.query.username, - last_name: "(credentials)", - password: req.query.password - }) - } - ); - if (accountjson.status == 201) { - const accountinfo = JSON.parse(await accountjson.text()); - await db.set(`users-${req.query.email}`, accountinfo.attributes.id); - } else { - let accountlistjson = await fetch( - `${settings.pterodactyl.domain}/api/application/users?include=servers&filter[email]=${encodeURIComponent(req.query.email)}`, { - method: "get", - headers: { - 'Content-Type': 'application/json', - "Authorization": `Bearer ${settings.pterodactyl.key}` - } - } - ); - const accountlist = await accountlistjson.json(); - const user = accountlist.data.filter(acc => acc.attributes.email == req.query.email); - if (user.length == 1) { - let userid = user[0].attributes.id; - await db.set(`users-${userinfo.id}`, userid); - } else { - return res.send("An error has occured when attempting to create your account."); - }; - } - let cacheaccount = await fetch( - `${settings.pterodactyl.domain}/api/application/users/${await db.get(`users-${req.query.email}`)}?include=servers`, - { - method: "get", - headers: { 'Content-Type': 'application/json', "Authorization": `Bearer ${settings.pterodactyl.key}` } - } - ); - if (await cacheaccount.statusText == "Not Found") return res.send("An error has occured while attempting to get your user information."); - let cacheaccountinfo = JSON.parse(await cacheaccount.text()); - await db.set(`user-${req.query.email}`, userinfo); - await db.set(`username-${userinfo.id}`, req.query.username); + app.get("/auth/register", async (req, res) => { + if (!req.query.email || !req.query.username || !req.query.password) { + return res.json({ error: "Missing information." }); + } + if (await db.get(`user-${req.query.email}`)) { + return res.json({ error: "Already registered." }); + } + + const userinfo = { + username: req.query.username, + id: req.query.email, + password: req.query.password, + discriminator: null + }; - let userdb = await db.get("userlist"); - userdb = userdb ? userdb : []; - if (!userdb.includes(`${userinfo.id}`)) { - userdb.push(`${userinfo.id}`); - await db.set("userlist", userdb); + const accountjson = await fetch( + `${settings.pterodactyl.domain}/api/application/users`, { + method: "post", + headers: { + 'Content-Type': 'application/json', + "Authorization": `Bearer ${settings.pterodactyl.key}` + }, + body: JSON.stringify({ + username: req.query.username, + email: req.query.email, + first_name: req.query.username, + last_name: "(credentials)", + password: req.query.password + }) + } + ); + + if (accountjson.status == 201) { + const accountinfo = JSON.parse(await accountjson.text()); + await db.set(`users-${req.query.email}`, accountinfo.attributes.id); + } else { + let accountlistjson = await fetch( + `${settings.pterodactyl.domain}/api/application/users?include=servers&filter[email]=${encodeURIComponent(req.query.email)}`, { + method: "get", + headers: { + 'Content-Type': 'application/json', + "Authorization": `Bearer ${settings.pterodactyl.key}` + } } - if (settings.smtp.enabled == true) { - mailer.sendMail({ - from: settings.smtp.mailfrom, - to: userinfo.id, - subject: `Signup`, - html: `Here are your login details for ${settings.name} Panel:\n Username: ${req.query.username}\n Email: ${userinfo.id}\n Password: ${userinfo.password}` - }); - } - req.session.pterodactyl = cacheaccountinfo.attributes; - req.session.userinfo = userinfo; - return res.redirect("/dashboard"); - }); -} \ No newline at end of file + ); + const accountlist = await accountlistjson.json(); + const user = accountlist.data.filter(acc => acc.attributes.email == req.query.email); + if (user.length == 1) { + let userid = user[0].attributes.id; + await db.set(`users-${userinfo.id}`, userid); + } else { + return res.json({ error: "An error has occurred when attempting to create your account." }); + } + } + + let cacheaccount = await fetch( + `${settings.pterodactyl.domain}/api/application/users/${await db.get(`users-${req.query.email}`)}?include=servers`, + { + method: "get", + headers: { 'Content-Type': 'application/json', "Authorization": `Bearer ${settings.pterodactyl.key}` } + } + ); + if (await cacheaccount.statusText == "Not Found") { + return res.json({ error: "An error has occurred while attempting to get your user information." }); + } + + let cacheaccountinfo = JSON.parse(await cacheaccount.text()); + await db.set(`user-${req.query.email}`, userinfo); + await db.set(`username-${userinfo.id}`, req.query.username); + + let userdb = await db.get("userlist"); + userdb = userdb ? userdb : []; + if (!userdb.includes(`${userinfo.id}`)) { + userdb.push(`${userinfo.id}`); + await db.set("userlist", userdb); + } + if (settings.smtp.enabled == true) { + mailer.sendMail({ + from: settings.smtp.mailfrom, + to: userinfo.id, + subject: `Signup`, + html: `Here are your login details for ${settings.name} Panel:\n Username: ${req.query.username}\n Email: ${userinfo.id}\n Password: ${userinfo.password}` + }); + } + req.session.pterodactyl = cacheaccountinfo.attributes; + req.session.userinfo = userinfo; + return res.redirect("/dashboard"); + }); +} diff --git a/sessions.db b/sessions.db index 15975c7..902f698 100644 Binary files a/sessions.db and b/sessions.db differ diff --git a/settings.yml b/settings.yml index a9e8b0a..2e1038d 100644 --- a/settings.yml +++ b/settings.yml @@ -1,6 +1,6 @@ name: Nero defaulttheme: default -version: 1.0 +version: 1.5.1 website: port: 3000 secret: makethishard diff --git a/themes/default/admin.ejs b/themes/default/admin.ejs index eac9d73..904eb15 100644 --- a/themes/default/admin.ejs +++ b/themes/default/admin.ejs @@ -329,7 +329,7 @@
Nero Client Dashboard
GITHUB
diff --git a/themes/default/buy.ejs b/themes/default/buy.ejs index c90f842..a7b8403 100644 --- a/themes/default/buy.ejs +++ b/themes/default/buy.ejs @@ -12,7 +12,8 @@ <% } %> + href="https://images-ext-1.discordapp.net/external/sMKkyuJo8Wn_AK_Foyl0aGrWwhe9fbqtPgkThvHxdxs/%3Fsize%3D1024/https/cdn.discordapp.com/icons/933803406513012807/bb763a3db98f9f0ae8d6029e8355dd06.png" + type="image/png">


-
+

diff --git a/themes/default/dashboard.ejs b/themes/default/dashboard.ejs index 7f2647b..397f01a 100644 --- a/themes/default/dashboard.ejs +++ b/themes/default/dashboard.ejs @@ -42,6 +42,16 @@ + + + + + + + + + + @@ -550,11 +560,11 @@
  • - +
    - Dashboard URL: + Dashboard: Go to Dashboard
    @@ -571,7 +581,7 @@
  • - Regenrate Password + Reset
    @@ -626,7 +636,7 @@ - + @@ -710,7 +720,9 @@ - + Powered by + NeroClient
    License diff --git a/themes/default/index.ejs b/themes/default/index.ejs index 555c2e3..0abc51f 100644 --- a/themes/default/index.ejs +++ b/themes/default/index.ejs @@ -1,150 +1,119 @@ - - + - - - - - - - - - Login | <%= settings.name %> - <% if (settings.api.arcio.enabled == true) { %> - - <% } %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + Login | <%= settings.name %> + <% if (settings.api.arcio.enabled == true) { %> + + <% } %> + + + + + + + + + + + + + + + + - - - -
    -
    -
    - -
    -
    - - - -
    -

    Welcome to <%= settings.name %>! 👋

    -

    Please sign-in to your account and start the adventure!

    -
    -
    - - -
    -
    -
    - -
    - -
    -
    -
    - - -
    -
    -
    - - -
    - - -

    - New on our platform? - - Create an account - -

    -
    -
    - +
    +
    +
    +
    +
    + +
    +

    Welcome to <%= settings.name %>! 👋

    +

    Please sign-in to your account and start the adventure!

    +
    +
    + + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    +
    + + +
    + + +

    + New on our platform? + + Create an account + +

    +
    - - - - - - - - - - - - - - - - - - - - - - +
    +
    + + + + + + + + + -