Skip to content

Commit

Permalink
feat: Add SHOW_MP_COMMANDS in dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
ck committed May 21, 2024
1 parent 3d02ce7 commit 943c111
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/server/assets/homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ async function saveSettings(element) {
const STATIC_FOLDER_PATH = document.querySelector('#STATIC_FOLDER_PATH');
const ENABLE_AUTOUPDATE = document.querySelector('#ENABLE_AUTOUPDATE');
const OPEN_DASHBOARD_ON_STARTUP = document.querySelector('#OPEN_DASHBOARD_ON_STARTUP');
const SHOW_MP_COMMANDS = document.querySelector('#SHOW_MP_COMMANDS');

if (BACKUP_SERVER_IP != SERVER_IP.value || BACKUP_SERVER_PORT != SERVER_PORT.value)
redirect = true;
Expand All @@ -366,6 +367,7 @@ async function saveSettings(element) {
ENABLE_AUTOUPDATE: ENABLE_AUTOUPDATE.checked,
OPEN_DASHBOARD_ON_STARTUP: OPEN_DASHBOARD_ON_STARTUP.checked,
CALCULATE_PP: CALCULATE_PP.checked,
SHOW_MP_COMMANDS: SHOW_MP_COMMANDS.checked,
ENABLE_KEY_OVERLAY: ENABLE_KEY_OVERLAY.checked,
ENABLE_GOSU_OVERLAY: ENABLE_GOSU_OVERLAY.checked,
POLL_RATE: POLL_RATE.value,
Expand Down
18 changes: 18 additions & 0 deletions packages/server/utils/counters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,23 @@ export function buildSettings(res: http.ServerResponse) {
.replace('{VALUE}', `${config.staticFolderPath}`)
);

const showMpCommandsHTML = settingsItemHTML
.replace('{NAME}', 'SHOW_MP_COMMANDS')
.replace(
'{DESCRIPTION}',
`Shows !mp commands (messages starting with '!mp') in tournament manager chat (hidden by default)`
)
.replace(
'{INPUT}',
checkboxHTML
.replace(/{ID}/gm, 'SHOW_MP_COMMANDS')
.replace(
'{ADDON}',
config.showMpCommands ? 'checked="true"' : ''
)
.replace('{VALUE}', `${config.showMpCommands}`)
);

const settings = `<div class="settings">
${debugHTML}
<div></div>
Expand All @@ -778,6 +795,7 @@ export function buildSettings(res: http.ServerResponse) {
<div></div>
<div></div>
${calculatePPHTML}
${showMpCommandsHTML}
<div></div>
<div></div>
${pollRateHTML}
Expand Down

0 comments on commit 943c111

Please sign in to comment.