From 5de7ddcc0ce38a508abb3d2e594995cbde58898e Mon Sep 17 00:00:00 2001 From: Selyan Morf Date: Sun, 15 Nov 2026 11:51:55 +0100 Subject: [PATCH 1/5] Add server controls to experience page menu Adds Restart servers for updates and Shut down all servers to the experience page menu for experiences you can manage, using the matchmaking API with a confirmation prompt. --- public/Assets/locales/en.json | 11 ++ src/content/core/settings/settingConfig.js | 9 ++ src/content/features/games/serverControls.js | 130 +++++++++++++++++++ src/content/index.js | 2 + 4 files changed, 152 insertions(+) create mode 100644 src/content/features/games/serverControls.js diff --git a/public/Assets/locales/en.json b/public/Assets/locales/en.json index cd5801a0f..022981473 100644 --- a/public/Assets/locales/en.json +++ b/public/Assets/locales/en.json @@ -931,6 +931,17 @@ "insufficientDataTooltip": "Not enough transaction history to make an accurate estimate. Please wait for more transactions to complete.", "label": "Unpending Robux tomorrow" }, + "serverControls": { + "restart": "Restart servers for updates", + "restartTitle": "Restart servers for updates?", + "restartMessage": "Servers running an old version will close and players will be moved to the latest version.", + "restartDone": "Servers on old versions are restarting.", + "shutdown": "Shut down all servers", + "shutdownTitle": "Shut down all servers?", + "shutdownMessage": "Every server of this place will close and all players will be kicked.", + "shutdownDone": "All servers are shutting down.", + "failed": "Couldn't update the servers." + }, "totalEarned": { "calculateEarnings": "Calculate Earnings", "calculateEarned": "Calculate Earned", diff --git a/src/content/core/settings/settingConfig.js b/src/content/core/settings/settingConfig.js index 4ef06a8ce..100c774cc 100644 --- a/src/content/core/settings/settingConfig.js +++ b/src/content/core/settings/settingConfig.js @@ -3752,6 +3752,15 @@ export const SETTINGS_CONFIG = { }, }, }, + serverControlsEnabled: { + label: 'Server Controls', + description: [ + 'Adds Restart servers for updates and Shut down all servers to the menu on experience pages you manage.', + ], + type: 'checkbox', + default: true, + contributors: ['4975603156'], + }, viewIdEnabled: { label: 'View Bundled IDs', description: diff --git a/src/content/features/games/serverControls.js b/src/content/features/games/serverControls.js new file mode 100644 index 000000000..9bef4229e --- /dev/null +++ b/src/content/features/games/serverControls.js @@ -0,0 +1,130 @@ +import { observeElement } from '../../core/observer.js'; +import { callRobloxApi, callRobloxApiJson } from '../../core/api.js'; +import { getPlaceIdFromUrl } from '../../core/idExtractor.js'; +import { settings } from '../../core/settings/getSettings.js'; +import { ts } from '../../core/locale/i18n.js'; +import { showConfirmationPrompt } from '../../core/ui/confirmationPrompt.js'; +import { showSystemAlert } from '../../core/ui/roblox/alert.js'; + +const ITEM_CLASS = 'rovalra-server-control'; + +let observer = null; +let listening = false; +let state = { universeId: null, placeId: null }; + +const ACTIONS = { + restart: { + endpoint: '/matchmaking-api/v1/game-instances/launch-update', + body: () => ({ + universeId: Number(state.universeId), + closeOldVersionsOnly: true, + }), + confirmType: 'primary', + }, + shutdown: { + endpoint: '/matchmaking-api/v1/game-instances/shutdown', + body: () => ({ placeId: Number(state.placeId) }), + confirmType: 'alert', + }, +}; + +async function canManage(universeId) { + const data = await callRobloxApiJson({ + subdomain: 'develop', + endpoint: `/v1/universes/multiget/permissions?ids=${universeId}`, + noCache: true, + }); + return data?.data?.[0]?.canManage === true; +} + +async function runAction(key) { + const action = ACTIONS[key]; + try { + const response = await callRobloxApi({ + subdomain: 'apis', + endpoint: action.endpoint, + method: 'POST', + body: action.body(), + noCache: true, + }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + showSystemAlert(ts(`serverControls.${key}Done`), 'success'); + } catch (error) { + console.error(`RoValra: Failed to ${key} servers`, error); + showSystemAlert(ts('serverControls.failed'), 'warning'); + } +} + +function onClick(event) { + const key = event.target.closest?.(`.${ITEM_CLASS} button`)?.dataset + .rovalraServerAction; + if (!key || !state.universeId) return; + + showConfirmationPrompt({ + title: ts(`serverControls.${key}Title`), + message: ts(`serverControls.${key}Message`), + confirmText: ts(`serverControls.${key}`), + confirmType: ACTIONS[key].confirmType, + onConfirm: () => runAction(key), + }); +} + +async function addMenuItems(menu) { + const universeId = document.querySelector('#game-detail-meta-data') + ?.dataset.universeId; + const placeId = getPlaceIdFromUrl(); + if ( + !/^\d+$/.test(universeId || '') || + !placeId || + menu.querySelector(`.${ITEM_CLASS}`) + ) { + return; + } + + try { + if (!(await canManage(universeId))) return; + if (menu.querySelector(`.${ITEM_CLASS}`)) return; + + state = { universeId, placeId }; + const items = Object.keys(ACTIONS).map((key) => { + const item = document.createElement('li'); + item.className = ITEM_CLASS; + const button = document.createElement('button'); + button.type = 'button'; + button.setAttribute('role', 'button'); + button.dataset.rovalraServerAction = key; + button.textContent = ts(`serverControls.${key}`); + item.append(button); + return item; + }); + + const anchor = menu.querySelector('#rbx-configure-game'); + if (anchor) anchor.after(...items); + else menu.append(...items); + + if (!listening) { + listening = true; + document.addEventListener('click', onClick); + } + } catch (error) { + console.error('RoValra: Failed to add server controls', error); + } +} + +export async function init() { + observer?.disconnect(); + observer = null; + state = { universeId: null, placeId: null }; + + if ( + !window.location.pathname.startsWith('/games/') || + !(await settings.serverControlsEnabled) + ) { + return; + } + + observer = observeElement( + '#game-context-menu ul.dropdown-menu', + addMenuItems, + ); +} diff --git a/src/content/index.js b/src/content/index.js index 41dbd93a1..8e8906c11 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -132,6 +132,7 @@ import { init as initHeatmap } from './features/games/tab/updateHistory.js'; import { init as initTotalSpentGames } from './features/games/tab/totalSpentGames.js'; import { init as initEvents } from './features/games/about/events.js'; import { init as initUnderReviewPill } from './features/games/underReviewPill.js'; +import { init as initServerControls } from './features/games/serverControls.js'; // transactions import { init as initTotalSpent } from './features/transactions/totalspent.js'; import { init as initSpending } from './features/transactions/spending.js'; @@ -431,6 +432,7 @@ const featureRoutes = [ initAutoFriendsAllowed, initCatalogExplorer, initUnderReviewPill, + initServerControls, initGameStatTimestamps, ], }, From 8d8356e84bef659ef211640c56b7c6b69a599be3 Mon Sep 17 00:00:00 2001 From: Selyan Morf Date: Sun, 15 Nov 2026 11:52:06 +0100 Subject: [PATCH 2/5] Format server controls --- src/content/features/games/serverControls.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/features/games/serverControls.js b/src/content/features/games/serverControls.js index 9bef4229e..03eaea7ae 100644 --- a/src/content/features/games/serverControls.js +++ b/src/content/features/games/serverControls.js @@ -70,8 +70,8 @@ function onClick(event) { } async function addMenuItems(menu) { - const universeId = document.querySelector('#game-detail-meta-data') - ?.dataset.universeId; + const universeId = document.querySelector('#game-detail-meta-data')?.dataset + .universeId; const placeId = getPlaceIdFromUrl(); if ( !/^\d+$/.test(universeId || '') || From 14466b157d2b3dbf93c9b4d8b565a60ce0f09829 Mon Sep 17 00:00:00 2001 From: Selyan Morf Date: Sun, 15 Nov 2026 11:55:17 +0100 Subject: [PATCH 3/5] Use launch-update for shutting down all servers --- public/Assets/locales/en.json | 2 +- src/content/features/games/serverControls.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/public/Assets/locales/en.json b/public/Assets/locales/en.json index 022981473..5fbd984ee 100644 --- a/public/Assets/locales/en.json +++ b/public/Assets/locales/en.json @@ -938,7 +938,7 @@ "restartDone": "Servers on old versions are restarting.", "shutdown": "Shut down all servers", "shutdownTitle": "Shut down all servers?", - "shutdownMessage": "Every server of this place will close and all players will be kicked.", + "shutdownMessage": "Every server of this experience will close, including servers on the latest version.", "shutdownDone": "All servers are shutting down.", "failed": "Couldn't update the servers." }, diff --git a/src/content/features/games/serverControls.js b/src/content/features/games/serverControls.js index 03eaea7ae..d5f396088 100644 --- a/src/content/features/games/serverControls.js +++ b/src/content/features/games/serverControls.js @@ -1,6 +1,5 @@ import { observeElement } from '../../core/observer.js'; import { callRobloxApi, callRobloxApiJson } from '../../core/api.js'; -import { getPlaceIdFromUrl } from '../../core/idExtractor.js'; import { settings } from '../../core/settings/getSettings.js'; import { ts } from '../../core/locale/i18n.js'; import { showConfirmationPrompt } from '../../core/ui/confirmationPrompt.js'; @@ -10,7 +9,7 @@ const ITEM_CLASS = 'rovalra-server-control'; let observer = null; let listening = false; -let state = { universeId: null, placeId: null }; +let state = { universeId: null }; const ACTIONS = { restart: { @@ -22,8 +21,11 @@ const ACTIONS = { confirmType: 'primary', }, shutdown: { - endpoint: '/matchmaking-api/v1/game-instances/shutdown', - body: () => ({ placeId: Number(state.placeId) }), + endpoint: '/matchmaking-api/v1/game-instances/launch-update', + body: () => ({ + universeId: Number(state.universeId), + closeOldVersionsOnly: false, + }), confirmType: 'alert', }, }; @@ -72,10 +74,8 @@ function onClick(event) { async function addMenuItems(menu) { const universeId = document.querySelector('#game-detail-meta-data')?.dataset .universeId; - const placeId = getPlaceIdFromUrl(); if ( !/^\d+$/.test(universeId || '') || - !placeId || menu.querySelector(`.${ITEM_CLASS}`) ) { return; @@ -85,7 +85,7 @@ async function addMenuItems(menu) { if (!(await canManage(universeId))) return; if (menu.querySelector(`.${ITEM_CLASS}`)) return; - state = { universeId, placeId }; + state = { universeId }; const items = Object.keys(ACTIONS).map((key) => { const item = document.createElement('li'); item.className = ITEM_CLASS; @@ -114,7 +114,7 @@ async function addMenuItems(menu) { export async function init() { observer?.disconnect(); observer = null; - state = { universeId: null, placeId: null }; + state = { universeId: null }; if ( !window.location.pathname.startsWith('/games/') || From f5e40d32b73ca599efbce298360d38958021522d Mon Sep 17 00:00:00 2001 From: Selyan Morf Date: Sun, 15 Nov 2026 11:57:47 +0100 Subject: [PATCH 4/5] Move Server Controls to Experiences settings with a toggle per action --- src/content/core/settings/settingConfig.js | 36 +++++++++++++++----- src/content/features/games/serverControls.js | 13 ++++++- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/content/core/settings/settingConfig.js b/src/content/core/settings/settingConfig.js index 100c774cc..ef601179f 100644 --- a/src/content/core/settings/settingConfig.js +++ b/src/content/core/settings/settingConfig.js @@ -717,6 +717,33 @@ export const SETTINGS_CONFIG = { type: 'checkbox', default: true, }, + serverControlsEnabled: { + label: 'Server Controls', + description: [ + 'Adds server actions to the menu on experience pages you manage.', + ], + type: 'checkbox', + default: true, + contributors: ['4975603156'], + childSettings: { + serverControlsRestartEnabled: { + label: 'Restart servers for updates', + description: [ + 'Closes servers running an old version and moves players to the latest version.', + ], + type: 'checkbox', + default: true, + }, + serverControlsShutdownEnabled: { + label: 'Shut down all servers', + description: [ + 'Closes every server of the experience, including servers on the latest version.', + ], + type: 'checkbox', + default: true, + }, + }, + }, TotalSpentGamesEnabled: { label: 'Total Spent on Experience', description: [ @@ -3752,15 +3779,6 @@ export const SETTINGS_CONFIG = { }, }, }, - serverControlsEnabled: { - label: 'Server Controls', - description: [ - 'Adds Restart servers for updates and Shut down all servers to the menu on experience pages you manage.', - ], - type: 'checkbox', - default: true, - contributors: ['4975603156'], - }, viewIdEnabled: { label: 'View Bundled IDs', description: diff --git a/src/content/features/games/serverControls.js b/src/content/features/games/serverControls.js index d5f396088..1b0cb2692 100644 --- a/src/content/features/games/serverControls.js +++ b/src/content/features/games/serverControls.js @@ -82,11 +82,22 @@ async function addMenuItems(menu) { } try { + const [restartEnabled, shutdownEnabled] = await Promise.all([ + settings.serverControlsRestartEnabled, + settings.serverControlsShutdownEnabled, + ]); + const keys = Object.keys(ACTIONS).filter((key) => + key === 'restart' + ? restartEnabled !== false + : shutdownEnabled !== false, + ); + if (!keys.length) return; + if (!(await canManage(universeId))) return; if (menu.querySelector(`.${ITEM_CLASS}`)) return; state = { universeId }; - const items = Object.keys(ACTIONS).map((key) => { + const items = keys.map((key) => { const item = document.createElement('li'); item.className = ITEM_CLASS; const button = document.createElement('button'); From 0d977b08a5d1366347a30428b79ea46d76dbbd39 Mon Sep 17 00:00:00 2001 From: Selyan Morf Date: Sun, 15 Nov 2026 11:58:25 +0100 Subject: [PATCH 5/5] Keep Server Controls in Developer settings --- src/content/core/settings/settingConfig.js | 54 +++++++++++----------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/content/core/settings/settingConfig.js b/src/content/core/settings/settingConfig.js index ef601179f..a90391c42 100644 --- a/src/content/core/settings/settingConfig.js +++ b/src/content/core/settings/settingConfig.js @@ -717,33 +717,6 @@ export const SETTINGS_CONFIG = { type: 'checkbox', default: true, }, - serverControlsEnabled: { - label: 'Server Controls', - description: [ - 'Adds server actions to the menu on experience pages you manage.', - ], - type: 'checkbox', - default: true, - contributors: ['4975603156'], - childSettings: { - serverControlsRestartEnabled: { - label: 'Restart servers for updates', - description: [ - 'Closes servers running an old version and moves players to the latest version.', - ], - type: 'checkbox', - default: true, - }, - serverControlsShutdownEnabled: { - label: 'Shut down all servers', - description: [ - 'Closes every server of the experience, including servers on the latest version.', - ], - type: 'checkbox', - default: true, - }, - }, - }, TotalSpentGamesEnabled: { label: 'Total Spent on Experience', description: [ @@ -3779,6 +3752,33 @@ export const SETTINGS_CONFIG = { }, }, }, + serverControlsEnabled: { + label: 'Server Controls', + description: [ + 'Adds server actions to the menu on experience pages you manage.', + ], + type: 'checkbox', + default: true, + contributors: ['4975603156'], + childSettings: { + serverControlsRestartEnabled: { + label: 'Restart servers for updates', + description: [ + 'Closes servers running an old version and moves players to the latest version.', + ], + type: 'checkbox', + default: true, + }, + serverControlsShutdownEnabled: { + label: 'Shut down all servers', + description: [ + 'Closes every server of the experience, including servers on the latest version.', + ], + type: 'checkbox', + default: true, + }, + }, + }, viewIdEnabled: { label: 'View Bundled IDs', description: