Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	fxmanifest.lua
  • Loading branch information
tabarra committed Sep 10, 2022
2 parents c67abe0 + b7cf8ec commit bb47c18
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions core/components/ConfigVault.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default class ConfigVault {
enabled: toDefault(cfg.discordBot.enabled, null),
token: toDefault(cfg.discordBot.token, null),
announceChannel: toDefault(cfg.discordBot.announceChannel, null),
prefix: toDefault(cfg.discordBot.prefix, '/'),
prefix: toDefault(cfg.discordBot.prefix, '!'),
statusMessage: toDefault(
cfg.discordBot.statusMessage,
'**IP:** `change-me:<port>`\n**Players:** <players>\n**Uptime:** <uptime>',
Expand Down Expand Up @@ -222,7 +222,7 @@ export default class ConfigVault {

//DiscordBot
cfg.discordBot.enabled = (cfg.discordBot.enabled === 'true' || cfg.discordBot.enabled === true);
cfg.discordBot.prefix = cfg.discordBot.prefix || '/';
cfg.discordBot.prefix = cfg.discordBot.prefix || '!';
cfg.discordBot.statusMessage = cfg.discordBot.statusMessage || '**Join:** `change-me:<port>`\n**Players:** <players>\n**Uptime:** <uptime>';
cfg.discordBot.commandCooldown = parseInt(cfg.discordBot.commandCooldown) || 30; //not in template

Expand Down
9 changes: 7 additions & 2 deletions core/components/DiscordBot/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const modulename = 'DiscordBot';
import Discord from '@citizenfx/discord.js'
import Discord, { Intents } from '@citizenfx/discord.js'
import logger from '@core/extras/console.js';
import { verbose } from '@core/globalData.js';
import commands from './commands';
Expand Down Expand Up @@ -96,8 +96,13 @@ export default class DiscordBot {
}

//Setup client
const clientIntents = new Intents([
Discord.Intents.FLAGS.GUILDS,
Discord.Intents.FLAGS.GUILD_MESSAGES,
]);
clientIntents.add(15); //equivalent to MESSAGE_CONTENT, but our client is outdated.
this.client = new Discord.Client({
intents: [Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_MESSAGES],
intents: clientIntents,
autoReconnect: true,
});

Expand Down
2 changes: 1 addition & 1 deletion core/webroutes/diagnostics.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default async function Diagnostics(ctx) {
getHostData(),
gettxAdminData(),
getFXServerData(),
getProcessesData(),
// getProcessesData(), FIXME: pidusageTree is bugged
]);

const timeElapsed = Date.now() - timeStart;
Expand Down
12 changes: 4 additions & 8 deletions docs/dev_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ v4.18.0:
- [x] fix HealthMonitor resource boot time limit
- [x] prevent external modifications of admins.json
- [x] update some packages

somehow backup the stashes
add newDatabase to the docs folder (don't i have it anywhere else?!)
re-clone folder
merge dev into master, try to release rc again
pagar contas
check discord intent
- [x] create beta release action
- [x] temp disable process info
- [x] fix perf chart labels (closes #661)
- [x] fix discord message intent

Optional:
- [ ] fix cfx.re login match by admin id
Expand All @@ -22,7 +19,6 @@ Optional:
- [ ] stats: add recipe name + if ptero + random collisions + how many scheduled restart times + drop zap/discord as login methods
- [ ] stats: jwe
- [ ] playerlist remove rtl characters
- [ ] create beta release action
- [ ] set nui/vite.config.ts > target > chrome103

The Big Things before ts+react rewrite:
Expand Down
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
author 'Tabarra'
description 'Remotely Manage & Monitor your GTA5 FiveM Server'
repository 'https://github.com/tabarra/txAdmin'
version '4.18.0-rc2'
version '4.18.0'
ui_label 'txAdmin'

rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.'
Expand Down
16 changes: 4 additions & 12 deletions web/main/diagnostics.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,10 @@
<div class="card card-accent-info">
<div class="card-header font-weight-bold">Processes:</div>
<div class="card-body">
<% if (!proccesses.length) { %>
Failed to retrieve processed data. <br>
Check the terminal for more information (if verbosity is enabled)
<% } else { %>
<% for (const process of proccesses) { %>
<strong>Process:</strong> (<%= process.pid %>) <%= process.name %> <br>
<strong>Parent:</strong> <%= process.ppid %> <br>
<strong>Memory:</strong> <%= process.memory %> <br>
<strong>CPU:</strong> <%= process.cpu %> <br>
<br>
<% } %>
<% } %>
<div class="text-center">
This card has been temporarily disabled due to a bug in an underlying library. <br>
A fix is expected to be released for txAdmin v4.20.
</div>
</div>
</div>

Expand Down
39 changes: 23 additions & 16 deletions web/public/js/txadmin/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,21 @@ const translate = (x, y) => {
return `translate(${x}, ${y})`;
};

const clientsToMargin = (maxClients) => {
//each char is about 5px
return 12 + (maxClients.toString().length * 5);
};

const yLabels = ['5 ms', '10 ms', '25 ms', '50 ms', '75 ms', '100 ms', '250 ms', '500 ms', '750 ms', '1.0 s', '2.5 s', '5.0 s', '7.5 s', '10 s', '+Inf'];


const drawHeatmap = (d3Container, perfData, options = {}) => {
//Options
if (typeof options.margin == 'undefined') options.margin = {}
const margin = {
top: options.margin.top || 5,
right: options.margin.right || 45,
bottom: options.margin.bottom || 20,
left: options.margin.left || 27
};
const height = options.height || 340;
const colorScheme = options.colorScheme || d3.interpolateViridis;

//TODO: make it responsive with screen size
const tickIntervalMod = Math.min(
//Dynamic label interval size
// got the points manually, plotted to https://www.geogebra.org/graphing
// then made a function with a slider to help me match the best fitting one
const tickIntervalMod = Math.max(
15,
Math.ceil(perfData.length / 20)
Math.ceil(55 - (d3Container.offsetWidth * 0.051))
);

//Flatten data
Expand All @@ -34,7 +30,7 @@ const drawHeatmap = (d3Container, perfData, options = {}) => {
snapAvgTickTimes.push(snap.avgTime);
snapClients.push({
x: snapIndex,
c: snap.clients
c: snap.clients,
});

//Process skips
Expand Down Expand Up @@ -63,6 +59,18 @@ const drawHeatmap = (d3Container, perfData, options = {}) => {
})
}
}
const maxClients = d3.max(snapClients.map(t => t.c));

//Options
if (typeof options.margin == 'undefined') options.margin = {}
const margin = {
top: options.margin.top || 5,
right: options.margin.right || 45,
bottom: options.margin.bottom || 20,
left: options.margin.left || clientsToMargin(maxClients)
};
const height = options.height || 340;
const colorScheme = options.colorScheme || d3.interpolateViridis;


//Macro drawing stuff
Expand Down Expand Up @@ -130,7 +138,6 @@ const drawHeatmap = (d3Container, perfData, options = {}) => {

// Y2 Axis - Player count
const y2Padding = Math.round(tickBucketsScale.bandwidth() / 2);
const maxClients = d3.max(snapClients.map(t => t.c));
const clientsScale = d3.scaleLinear()
.domain([0, maxClients])
.range([height - margin.bottom - y2Padding, margin.top + y2Padding]);
Expand Down

0 comments on commit bb47c18

Please sign in to comment.