Skip to content

Commit

Permalink
18.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
KingTino104 committed Aug 6, 2024
1 parent a507924 commit b95fe24
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 40 deletions.
9 changes: 9 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ if (cluster.isMaster) {
cluster.workers[id].kill();
}
});

// Watch for file changes and reboot workers
const watcher2 = chokidar.watch('./config.toml');
watcher2.on('change', (path) => {
console.log(chalk.yellow(`File changed: ${path}. Rebooting workers...`));
for (const id in cluster.workers) {
cluster.workers[id].kill();
}
});
}

cluster.on('online', (worker) => {
Expand Down
28 changes: 6 additions & 22 deletions config-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ timezone = "Europe/London"
icon = "https://avatars.githubusercontent.com/u/176057729"

# Plexactyl release information
version = "18.0.2"
version = "18.0.3"

# Additional settings
testing = false
Expand All @@ -19,7 +19,6 @@ key = "PTERO_KEY"
# Webserver
[website]
port = 3_000
# Secret has been removed in 18.0.2

# Module settings (formerly API)
[api.client]
Expand All @@ -29,7 +28,6 @@ accountSwitcher = true
enabled = false
code = "API_KEY"


# Frontend for j4r is unavailable.
[api.client.j4r]
enabled = false
Expand Down Expand Up @@ -106,33 +104,19 @@ accountSwitcher = true

# Packages
[api.client.packages.list.default]
ram = 4_096
disk = 40_960
cpu = 100
servers = 4

[api.client.packages.list.verified]
ram = 4_096
disk = 40_960
cpu = 100
servers = 4

[api.client.packages.list.pro]
ram = 8_192
disk = 81_920
cpu = 250
servers = 8
ram = 2_480
disk = 10_240
cpu = 150
servers = 2

[api.client.packages.rolePackages]
note = "This allows you to set a different plan/package to people who have a specific role however this requires the Discord bot to be configured and functioning. This is mainly used for Boost rewards."
roleServer = ""

[api.client.packages.rolePackages.roles]
1232687984462135377 = "verified"

[api.client.locations.1]
name = "Falkenstein, DE"
pro = false
name = "Example Location"

# Use my optimized docker images! ghcr.io/zenllc/java:21 for java 21 or ghcr.io/zenllc/java:17 for java 17!

Expand Down
14 changes: 7 additions & 7 deletions modules/admin.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@

const loadConfig = require("../handlers/config");
const settings = loadConfig("./config.toml");

if (settings.pterodactyl)
if (settings.pterodactyl.domain) {
if (settings.pterodactyl.domain.slice(-1) == "/")
settings.pterodactyl.domain = settings.pterodactyl.domain.slice(0, -1);
}

const TOML = require('@iarna/toml')
const fetch = require("node-fetch");
const fs = require("fs");
const indexjs = require("../app.js");
Expand All @@ -18,6 +12,12 @@ const log = require("../handlers/log.js");
/* Ensure platform release target is met */
const plexactylModule = { "name": "Admin", "target_platform": "18.0.x" };

if (settings.pterodactyl)
if (settings.pterodactyl.domain) {
if (settings.pterodactyl.domain.slice(-1) == "/")
settings.pterodactyl.domain = settings.pterodactyl.domain.slice(0, -1);
}

/* Module */
module.exports.plexactylModule = plexactylModule;
module.exports.load = async function (app, db) {
Expand Down
14 changes: 7 additions & 7 deletions modules/linkvertise.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ module.exports.load = async function(app, db) {
if (!req.session.pterodactyl) return res.redirect("/login");

if (cooldowns[req.session.userinfo.id] && cooldowns[req.session.userinfo.id] > Date.now()) {
return res.redirect(`/lv`)
return res.redirect(`/cp/lv`)
} else if (cooldowns[req.session.userinfo.id]) {
delete cooldowns[req.session.userinfo.id]
}

const dailyTotal = await db.get(`dailylinkvertise-${req.session.userinfo.id}`)
if (dailyTotal && dailyTotal >= settings.linkvertise.dailyLimit) {
return res.redirect(`/lv?err=REACHEDDAILYLIMIT`)
return res.redirect(`/cp/lv?err=REACHEDDAILYLIMIT`)
}

let referer = req.headers.referer
Expand All @@ -48,7 +48,7 @@ module.exports.load = async function(app, db) {
if (!req.session.pterodactyl) return res.redirect("/");

if (cooldowns[req.session.userinfo.id] && cooldowns[req.session.userinfo.id] > Date.now()) {
return res.redirect(`/lv`)
return res.redirect(`/cp/lv`)
} else if (cooldowns[req.session.userinfo.id]) {
delete cooldowns[req.session.userinfo.id]
}
Expand All @@ -58,8 +58,8 @@ module.exports.load = async function(app, db) {
if (!req.headers.referer || !req.headers.referer.includes('linkvertise.com')) return res.send('<p>Hm... our systems detected something going on! Please make sure you are not using an ad blocker (or linkvertise bypasser).</p> <img src="https://i.imgur.com/lwbn3E9.png" alt="robot" height="300">')

const usercode = lvcodes[req.session.userinfo.id]
if (!usercode) return res.redirect(`/lv`)
if (usercode.code !== code) return res.redirect(`/lv`)
if (!usercode) return res.redirect(`/cp/lv`)
if (usercode.code !== code) return res.redirect(`/cp/lv`)
delete lvcodes[req.session.userinfo.id]

// Checking at least the minimum allowed time passed between generation and completion
Expand All @@ -72,7 +72,7 @@ module.exports.load = async function(app, db) {
// Adding to daily total
const dailyTotal = await db.get(`dailylinkvertise-${req.session.userinfo.id}`)
if (dailyTotal && dailyTotal >= settings.linkvertise.dailyLimit) {
return res.redirect(`/lv?err=REACHEDDAILYLIMIT`)
return res.redirect(`/cp/lv?err=REACHEDDAILYLIMIT`)
}
if (dailyTotal) await db.set(`dailylinkvertise-${req.session.userinfo.id}`, dailyTotal + 1)
else await db.set(`dailylinkvertise-${req.session.userinfo.id}`, 1)
Expand All @@ -84,7 +84,7 @@ module.exports.load = async function(app, db) {
const coins = await db.get(`coins-${req.session.userinfo.id}`)
await db.set(`coins-${req.session.userinfo.id}`, coins + settings.linkvertise.coins)

res.redirect(`/lv?success=true`)
res.redirect(`/cp/lv?success=true`)
})

app.get(`/api/lvcooldown`, async (req, res) => {
Expand Down
2 changes: 1 addition & 1 deletion modules/oauth2.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ module.exports.load = async function (app, db) {
(err, str) => {
if (err)
return res.send(
'Another account on your IP has been detected, there can only be one account per IP. Think this is a mistake? <a href="https://discord.gg/halexnodes" target="_blank">Join our discord.</a>'
'Another account on your IP has been detected, there can only be one account per IP.'
);
res.status(200);
res.send(str);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plexactyl",
"version": "18.0.2",
"version": "18.0.3",
"description": "The official Plexactyl client area for the Pterodactyl Panel.",
"main": "app.js",
"author": "Zen Software",
Expand Down
3 changes: 1 addition & 2 deletions views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@
</div>
</div>
</div>

</body>
</html>
</html>

0 comments on commit b95fe24

Please sign in to comment.