2025-06-03 16:24:58 +07:00
|
|
|
import {
|
|
|
|
|
onSettingsModulesLoaded,
|
2025-06-09 19:47:00 +07:00
|
|
|
refreshSettingsOverviewScreen,
|
2025-06-03 16:24:58 +07:00
|
|
|
} from '@revenge-mod/discord/modules/settings'
|
2025-05-05 21:16:44 +07:00
|
|
|
import { InternalPluginFlags, registerPlugin } from '@revenge-mod/plugins/_'
|
2025-05-19 01:43:41 +07:00
|
|
|
import { PluginFlags } from '@revenge-mod/plugins/constants'
|
2025-05-08 19:00:49 +07:00
|
|
|
import type { PluginApi } from '@revenge-mod/plugins/types'
|
2025-05-05 21:16:44 +07:00
|
|
|
|
2025-05-22 02:48:54 +07:00
|
|
|
interface Storage {
|
|
|
|
|
devtools: {
|
|
|
|
|
address: string
|
|
|
|
|
autoConnect: boolean
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const defaultStorage: Storage = {
|
|
|
|
|
devtools: {
|
|
|
|
|
address: 'localhost:8097',
|
|
|
|
|
autoConnect: false,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-16 09:51:30 +07:00
|
|
|
registerPlugin<{ storage: Storage }>(
|
2025-05-05 21:16:44 +07:00
|
|
|
{
|
|
|
|
|
id: 'revenge.settings.developer',
|
|
|
|
|
name: 'Developer Settings',
|
|
|
|
|
description: 'Developer settings menus for Revenge',
|
|
|
|
|
author: 'Revenge',
|
|
|
|
|
icon: 'WrenchIcon',
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-05-22 02:48:54 +07:00
|
|
|
storage: {
|
|
|
|
|
load: true,
|
|
|
|
|
default: defaultStorage,
|
|
|
|
|
},
|
2025-06-08 21:35:47 +07:00
|
|
|
start(api_) {
|
2025-05-18 22:24:48 +07:00
|
|
|
api = api_
|
2025-05-22 02:48:54 +07:00
|
|
|
|
2025-07-13 15:52:14 +07:00
|
|
|
onSettingsModulesLoaded(() => {
|
|
|
|
|
require('./utils').register()
|
|
|
|
|
})
|
2025-05-22 02:48:54 +07:00
|
|
|
|
2025-06-08 21:19:25 +07:00
|
|
|
if (api_.plugin.flags & PluginFlags.EnabledLate)
|
2025-06-09 19:47:00 +07:00
|
|
|
refreshSettingsOverviewScreen()
|
2025-06-08 21:19:25 +07:00
|
|
|
|
2025-06-08 21:35:47 +07:00
|
|
|
Promise.all([import('./react-devtools'), api.storage.get()]).then(
|
|
|
|
|
([rdt, settings]) => {
|
2025-06-09 23:35:23 +07:00
|
|
|
if (settings.devtools.autoConnect) rdt.connect()
|
2025-06-08 21:35:47 +07:00
|
|
|
},
|
|
|
|
|
)
|
2025-05-05 21:16:44 +07:00
|
|
|
},
|
2025-07-18 02:02:34 +07:00
|
|
|
stop() {
|
|
|
|
|
refreshSettingsOverviewScreen()
|
|
|
|
|
},
|
2025-05-05 21:16:44 +07:00
|
|
|
},
|
|
|
|
|
PluginFlags.Enabled,
|
|
|
|
|
InternalPluginFlags.Internal,
|
|
|
|
|
)
|
|
|
|
|
|
2025-07-13 15:52:14 +07:00
|
|
|
// Expose to EvalJSSetting
|
2025-06-16 09:51:30 +07:00
|
|
|
export let api: PluginApi<{ storage: Storage }>
|