From dee44c7135ab054a1985fb5aa5cf4485985f6a27 Mon Sep 17 00:00:00 2001 From: tabarra Date: Sat, 10 Sep 2022 11:10:01 -0300 Subject: [PATCH 1/4] chore: tmep disabled diagnostics processes card --- core/webroutes/diagnostics.js | 2 +- web/main/diagnostics.ejs | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/core/webroutes/diagnostics.js b/core/webroutes/diagnostics.js index 88af4b7a6..be39b3449 100644 --- a/core/webroutes/diagnostics.js +++ b/core/webroutes/diagnostics.js @@ -34,7 +34,7 @@ export default async function Diagnostics(ctx) { getHostData(), gettxAdminData(), getFXServerData(), - getProcessesData(), + // getProcessesData(), FIXME: pidusageTree is bugged ]); const timeElapsed = Date.now() - timeStart; diff --git a/web/main/diagnostics.ejs b/web/main/diagnostics.ejs index 676c10b22..7c79a9ba3 100644 --- a/web/main/diagnostics.ejs +++ b/web/main/diagnostics.ejs @@ -95,18 +95,10 @@
Processes:
- <% if (!proccesses.length) { %> - Failed to retrieve processed data.
- Check the terminal for more information (if verbosity is enabled) - <% } else { %> - <% for (const process of proccesses) { %> - Process: (<%= process.pid %>) <%= process.name %>
- Parent: <%= process.ppid %>
- Memory: <%= process.memory %>
- CPU: <%= process.cpu %>
-
- <% } %> - <% } %> +
+ This card has been temporarily disabled due to a bug in an underlying library.
+ A fix is expected to be released for txAdmin v4.20. +
From 8a230476b20bd54ef672f1a6a5933a19de07ba7d Mon Sep 17 00:00:00 2001 From: tabarra Date: Sat, 10 Sep 2022 13:42:27 -0300 Subject: [PATCH 2/4] feat: responsive perf chart labels (closes #661) --- web/public/js/txadmin/chart.js | 39 ++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/web/public/js/txadmin/chart.js b/web/public/js/txadmin/chart.js index 76b0360e7..5cd335bd4 100644 --- a/web/public/js/txadmin/chart.js +++ b/web/public/js/txadmin/chart.js @@ -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 @@ -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 @@ -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 @@ -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]); From c8b2f2219ddb1a8c68fe552f4b7d71920f3bc23f Mon Sep 17 00:00:00 2001 From: tabarra Date: Sat, 10 Sep 2022 13:43:08 -0300 Subject: [PATCH 3/4] fix(bot): fixed message content intent --- core/components/ConfigVault.js | 4 ++-- core/components/DiscordBot/index.js | 9 +++++++-- docs/dev_notes.md | 12 ++++-------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/core/components/ConfigVault.js b/core/components/ConfigVault.js index 78d728a45..0ee50c52c 100644 --- a/core/components/ConfigVault.js +++ b/core/components/ConfigVault.js @@ -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:`\n**Players:** \n**Uptime:** ', @@ -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:`\n**Players:** \n**Uptime:** '; cfg.discordBot.commandCooldown = parseInt(cfg.discordBot.commandCooldown) || 30; //not in template diff --git a/core/components/DiscordBot/index.js b/core/components/DiscordBot/index.js index 273f198f5..131121dbb 100644 --- a/core/components/DiscordBot/index.js +++ b/core/components/DiscordBot/index.js @@ -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'; @@ -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, }); diff --git a/docs/dev_notes.md b/docs/dev_notes.md index 3f90673f3..4d4561625 100644 --- a/docs/dev_notes.md +++ b/docs/dev_notes.md @@ -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 @@ -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: From b7cf8ec1e6f91096ec9e03a9741b877f81eba599 Mon Sep 17 00:00:00 2001 From: tabarra Date: Sat, 10 Sep 2022 13:43:24 -0300 Subject: [PATCH 4/4] chore: version bump --- fxmanifest.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index d32e2027e..70c3614c7 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -5,7 +5,7 @@ author 'Tabarra' description 'Remotely Manage & Monitor your GTA5 FiveM Server' repository 'https://github.com/tabarra/txAdmin' -version '4.18.0-rc1' +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.'