Skip to content

Commit

Permalink
Refactored API endpoints, updated styles, and improved configuration …
Browse files Browse the repository at this point in the history
…handling
  • Loading branch information
achul123 committed Feb 1, 2024
1 parent 670723a commit e1773a6
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 60 deletions.
2 changes: 0 additions & 2 deletions api/extras.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const settings = require("../settings.json");
const fs = require('fs');

const indexjs = require("../index.js");
const fetch = require('node-fetch');

module.exports.load = async function(app, db) {
Expand Down
9 changes: 8 additions & 1 deletion api/servers.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,20 @@ module.exports.load = async function (app, db) {
let ok = await deletionresults.ok;
if (ok !== true) return res.send("An error has occur while attempting to delete the server.");
let pterodactylinfo = req.session.pterodactyl;

pterodactylinfo.relationships.servers.data = pterodactylinfo.relationships.servers.data.filter(server => server.attributes.id.toString() !== req.query.id);
req.session.pterodactyl = pterodactylinfo;

await db.delete(`lastrenewal-${req.query.id}`)

adminjs.suspend(req.session.userinfo.id);

const deletedServer = pterodactylinfo.relationships.servers.data.find(server => server.attributes.id.toString() === req.query.id);
if (deletedServer && deletedServer.attributes) {
log('deleted server', `${req.session.userinfo.username}#${req.session.userinfo.discriminator} deleted server ${deletedServer.attributes.name}.`);
} else {
log('deleted server', `${req.session.userinfo.username}#${req.session.userinfo.discriminator} deleted server with unknown name.`);
};

return res.redirect('/servers?err=DELETEDSERVER');
} else {
res.redirect(theme.settings.redirect.deleteserverdisabled ? theme.settings.redirect.deleteserverdisabled : "/");
Expand Down
83 changes: 62 additions & 21 deletions assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -16072,58 +16072,99 @@ code {
color: #e4eaec;
border: 1px solid #e4eaec; }

.badge-outline-green {
.badge-outline-info {
color: #8f5fe8;
border: 1px solid #8f5fe8; }

.badge-outline-warning {
color: #ffab00;
border: 1px solid #ffab00; }

.badge-outline-danger {
color: #fc424a;
border: 1px solid #fc424a; }

.badge-outline-light {
color: #ffffff;
border: 1px solid #ffffff; }

.badge-outline-dark {
color: #0d0d0d;
border: 1px solid #0d0d0d; }


/*Badge background variations*/

.badge-background-blue {
color: white;
background-color: #0090e7;
border: 1px;
transition-duration: 0.1s;
}

.badge-background-blue:hover {
color: white;
background-color: #00569c;
border: 1px;
transition-duration: 0.1s;
}

.badge-background-green {
color: white;
background-color: #00d25b;
border: 1px;
transition-duration: 0.1s;
}

.badge-outline-green:hover {
.badge-background-green:hover {
color: white;
background-color: #00d25b;
border: 1px;
transition-duration: 0.1s;
}

.badge-outline-red {
.badge-background-orange {
color: white;
background-color: #ffA500;
border: 1px;
transition-duration: 0.1s;
}

.badge-background-orange:hover {
color: white;
background-color: #bd7e00;
border: 1px;
transition-duration: 0.1s;
}

.badge-background-red {
color: white;
background-color: #ff0000;
border: 1px;
transition-duration: 0.1s;
}

.badge-outline-red:hover {
.badge-background-red:hover {
color: white;
background-color: #bd0000;
border: 1px;
transition-duration: 0.1s;
}

.badge-outline-info {
color: #8f5fe8;
border: 1px solid #8f5fe8; }

.badge-outline-warning {
color: #ffab00;
border: 1px solid #ffab00; }

.badge-outline-danger {
color: #fc424a;
border: 1px solid #fc424a; }
/* Buttons */

.badge-outline-light {
color: #ffffff;
border: 1px solid #ffffff; }
.btn-g {
margin-right: -15px;
}

.badge-outline-dark {
color: #0d0d0d;
border: 1px solid #0d0d0d; }
.btn-g a {
margin-right: 8px;
}

.btn-primary {
border-radius: 12px; }

/* Buttons */
.btn, .fc button, .ajax-upload-dragdrop .ajax-file-upload, .swal2-modal .swal2-buttonswrapper .swal2-styled, .swal2-modal .swal2-buttonswrapper .swal2-styled.swal2-confirm, .swal2-modal .swal2-buttonswrapper .swal2-styled.swal2-cancel, .wizard > .actions a {
font-size: 0.9375rem;
line-height: 1;
Expand Down
2 changes: 1 addition & 1 deletion assets/info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
Heliactyl 12.7 CSS
Based on Corona Admin

-------------------------
-------------------------
7 changes: 0 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// Heliactyl 12.7, Codename Gekyume
//
// * Copyright SrydenCloud Limited & Pine Platforms Ltd
// * Please read the "License" file
//

"use strict";

// Load packages.
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Heliactyl",
"version": "12.7.7",
"name": "heliactyl",
"version": "12.7.8",
"description": "The best Pterodactyl client area.",
"main": "index.js",
"author": "Heliactyl-Fixed",
Expand Down
7 changes: 4 additions & 3 deletions settings_exemple.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "12.7.7",
"version": "12.7.8",
"name": "Heliactyl",
"letter": "H",
"icon": "https://cdn.discordapp.com/attachments/1063585626022223892/1065305275826966609/Screenshot_2023-01-18_162220.jpg",
Expand Down Expand Up @@ -184,7 +184,7 @@
"cpu": null
},
"info": {
"egg": 1,
"egg": 4,
"docker_image": "ghcr.io/pterodactyl/yolks:java_17",
"startup": "java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}",
"environment": {
Expand All @@ -210,7 +210,7 @@
"cpu": null
},
"info": {
"egg": 3,
"egg": 1,
"docker_image": "ghcr.io/pterodactyl/yolks:java_17",
"startup": "java -Xms128M -Xmx{{SERVER_MEMORY}}M -Dterminal.jline=false -Dterminal.ansi=true -jar {{SERVER_JARFILE}}",
"environment": {
Expand Down Expand Up @@ -289,6 +289,7 @@
"user": {
"signup": true,
"created server": true,
"deleted server": true,
"coupon redeemed": true,
"gifted coins": true,
"modify server": true,
Expand Down
2 changes: 1 addition & 1 deletion themes/default/components/head.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,4 @@
transform: rotate(1turn);
}
}
</style>
</style>
40 changes: 21 additions & 19 deletions themes/default/dashboard.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<h2>Dashboard</h2>
<p class="text-gray">View your resources & other things here.</p>

<%- include('./components/alert') %>
<% if (req.query.err == "ALREADY_OPEN") { %>
<div class="alert">
Expand Down Expand Up @@ -76,32 +76,34 @@
<th> CPU </th>
<th> RAM </th>
<th> Disk </th>
<th style="position: relative; left: 50px;"> Options </th>
<th> Options </th>
</tr>
</thead>
<tbody>
<% if (pterodactyl.relationships.servers.data.length == 0) { %>
<% if (pterodactyl.relationships.servers.data.length == 0) { %>
<tr>
<td> You do not own any servers! Why not create one? </td>
</tr>
<% } else { %>
<% for (let i = 0, len = pterodactyl.relationships.servers.data.length; i < len; i++) { %>
<tr>
<td> You do not own any servers! Why not create one? </td>
</tr>
<% } else { %>
<% for (let i = 0, len = pterodactyl.relationships.servers.data.length; i < len; i++) { %>
<tr>
<td>
<span class="pl-2"><%= pterodactyl.relationships.servers.data[i].attributes.name.length > 40 ? pterodactyl.relationships.servers.data[i].attributes.name.slice(0, 40) + "..." : pterodactyl.relationships.servers.data[i].attributes.name %></span>
</td>
<td> <%= pterodactyl.relationships.servers.data[i].attributes.limits.cpu %>% </td>
<td> <%= pterodactyl.relationships.servers.data[i].attributes.limits.memory %>MB </td>
<td> <%= pterodactyl.relationships.servers.data[i].attributes.limits.disk %>MB </td>
<td>
<a role="button" class="badge badge-outline-green" href="/servers/edit?id=<%= pterodactyl.relationships.servers.data[i].attributes.id %>">Edit</a>
</td>
<td>
<span class="pl-2"><%= pterodactyl.relationships.servers.data[i].attributes.name.length > 40 ? pterodactyl.relationships.servers.data[i].attributes.name.slice(0, 40) + "..." : pterodactyl.relationships.servers.data[i].attributes.name %></span>
</td>
<td> <%= pterodactyl.relationships.servers.data[i].attributes.limits.cpu %>% </td>
<td> <%= pterodactyl.relationships.servers.data[i].attributes.limits.memory %>MB </td>
<td> <%= pterodactyl.relationships.servers.data[i].attributes.limits.disk %>MB </td>
<td>
<a role="button" class="badge badge-outline-red" onclick="if (confirm('Are you sure you want to delete the server? This action is irreversible.')) { window.location.href='/delete?id=<%= pterodactyl.relationships.servers.data[i].attributes.id %>' }">Delete</a>
<div class="btn-g">
<a role="button" class="badge badge-background-blue" href="/panel">Link</a>
<a role="button" class="badge badge-background-green" href="/renew?id=<%= pterodactyl.relationships.servers.data[i].attributes.id %>">Renew</a>
<a role="button" class="badge badge-background-orange" href="/servers/edit?id=<%= pterodactyl.relationships.servers.data[i].attributes.id %>">Edit</a>
<a role="button" class="badge badge-background-red" onclick="if (confirm('Are you sure you want to delete the server? This action is irreversible.')) { window.location.href='/delete?id=<%= pterodactyl.relationships.servers.data[i].attributes.id %>' }">Delete</a>
</div>
</td>
</tr>
<% } %>
<% } %>
<% } %>
</tbody>
</table>
</div>
Expand Down

0 comments on commit e1773a6

Please sign in to comment.