2025-06-03 16:24:58 +07:00
|
|
|
import {
|
|
|
|
|
onSettingsModulesLoaded,
|
2025-09-17 16:57:53 +07:00
|
|
|
refreshSettingsNavigator,
|
2025-06-09 19:47:00 +07:00
|
|
|
refreshSettingsOverviewScreen,
|
2025-06-03 16:24:58 +07:00
|
|
|
} from '@revenge-mod/discord/modules/settings'
|
2026-07-07 00:03:14 +07:00
|
|
|
import {
|
|
|
|
|
InternalPluginFlags,
|
2026-07-26 16:01:09 +07:00
|
|
|
isPluginStartedLate,
|
2026-07-07 00:03:14 +07:00
|
|
|
PluginFlags,
|
feat!: new repo system + versioning system support + bug fixes
BREAKING CHANGES:
- New versioning system: Allowing any amount of number segments, with prerelease support.
- Any number of segments is supported: 1, 1.0, 1.0.0, 1.0.0.0, ...
- Prerelease labels are compared "digit-run", similar to Debian.
- Plugins must specify a version.
- User-facing plugins should use CalVer. API plugins should use SemVer.
Revenge APIs use SemVer while the new `discord` dependency parses the Discord version string directly.
- Dependency is now a Map, with support for version ranges and optional. Suggested URL is removed. (See new repo system)
- Plugins will now have to declare a dependency on `revenge.api` (Revenge API version) and `discord` (Discord version).
- Manifest now requires a format version (currently `1`)
New APIs:
- lib/plugins/utils: Utilities to format versioning
Features:
- New repo system: Repository design is inspired by Linux package repositories.
- Repos host manifest, versions, channels, download URL/size, and hash for multiple plugins.
- New dependency system: Plugins are versioned, and shouldn't break when updates come.
Plugins can now declare dependency on supported Discord/Revenge API versions, so they won't break with auto-updates.
Dependencies can be optional, but dependency on `revenge.api` and `discord` must be required.
Dependents are soft-disabled when dependencies don't satisfy. Once satisfied, the plugin can start again.
- All updates for running plugins REQUIRE a reload to prevent stale linking issues. Both native and JS-side.
- Update checking is handled entirely by JS. But the native-side still handles installation, indexing, and verification.
- Local indexes are updated against remote indexes. Dependency checking always uses local indexes.
- Users can add custom repositories and custom their priority order. URL is the identity.
- Plugins can now have custom data URI icons instead of being restricted to React Native app assets.
- External plugin installs require UI confirmation before installing.
- Pending Update and Pending Reload filters in Plugins page.
- Ability to browse external plugins in repositories. Official repository will be added soon.
Fixes/Refactor:
- Refactored Plugin-related settings to a separate "Plugin Settings" plugin.
- Masonry layout fixes in landscape.
- Updated plugins now show "reload to apply" toast instead.
- Removed dead code.
2026-07-25 23:35:23 +07:00
|
|
|
registerInternalPlugin,
|
2026-07-07 00:03:14 +07:00
|
|
|
} from '@revenge-mod/plugins/_'
|
2025-07-21 22:42:37 +07:00
|
|
|
import pluginSettings from '../settings'
|
2025-10-14 00:16:49 +07:00
|
|
|
import * as dt from './devtools'
|
2025-09-17 16:57:53 +07:00
|
|
|
import defer * as rdt from './react-devtools'
|
|
|
|
|
import defer * as utils from './utils'
|
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 {
|
2026-06-10 23:58:23 +07:00
|
|
|
devTools: DevToolsSettings & { alias?: string }
|
2025-10-14 00:16:49 +07:00
|
|
|
reactDevTools: DevToolsSettings
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface DevToolsSettings {
|
|
|
|
|
address: string
|
|
|
|
|
autoConnect: boolean
|
2025-05-22 02:48:54 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const defaultStorage: Storage = {
|
2025-10-14 00:16:49 +07:00
|
|
|
devTools: {
|
|
|
|
|
address: 'localhost:7864',
|
|
|
|
|
autoConnect: false,
|
|
|
|
|
},
|
|
|
|
|
reactDevTools: {
|
2025-05-22 02:48:54 +07:00
|
|
|
address: 'localhost:8097',
|
|
|
|
|
autoConnect: false,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-18 18:29:50 +07:00
|
|
|
// TODO(PalmDevs): only register in development builds once updates can be made automatic
|
feat!: new repo system + versioning system support + bug fixes
BREAKING CHANGES:
- New versioning system: Allowing any amount of number segments, with prerelease support.
- Any number of segments is supported: 1, 1.0, 1.0.0, 1.0.0.0, ...
- Prerelease labels are compared "digit-run", similar to Debian.
- Plugins must specify a version.
- User-facing plugins should use CalVer. API plugins should use SemVer.
Revenge APIs use SemVer while the new `discord` dependency parses the Discord version string directly.
- Dependency is now a Map, with support for version ranges and optional. Suggested URL is removed. (See new repo system)
- Plugins will now have to declare a dependency on `revenge.api` (Revenge API version) and `discord` (Discord version).
- Manifest now requires a format version (currently `1`)
New APIs:
- lib/plugins/utils: Utilities to format versioning
Features:
- New repo system: Repository design is inspired by Linux package repositories.
- Repos host manifest, versions, channels, download URL/size, and hash for multiple plugins.
- New dependency system: Plugins are versioned, and shouldn't break when updates come.
Plugins can now declare dependency on supported Discord/Revenge API versions, so they won't break with auto-updates.
Dependencies can be optional, but dependency on `revenge.api` and `discord` must be required.
Dependents are soft-disabled when dependencies don't satisfy. Once satisfied, the plugin can start again.
- All updates for running plugins REQUIRE a reload to prevent stale linking issues. Both native and JS-side.
- Update checking is handled entirely by JS. But the native-side still handles installation, indexing, and verification.
- Local indexes are updated against remote indexes. Dependency checking always uses local indexes.
- Users can add custom repositories and custom their priority order. URL is the identity.
- Plugins can now have custom data URI icons instead of being restricted to React Native app assets.
- External plugin installs require UI confirmation before installing.
- Pending Update and Pending Reload filters in Plugins page.
- Ability to browse external plugins in repositories. Official repository will be added soon.
Fixes/Refactor:
- Refactored Plugin-related settings to a separate "Plugin Settings" plugin.
- Masonry layout fixes in landscape.
- Updated plugins now show "reload to apply" toast instead.
- Removed dead code.
2026-07-25 23:35:23 +07:00
|
|
|
registerInternalPlugin<{ jsonStorage: Storage }>(
|
2025-05-05 21:16:44 +07:00
|
|
|
{
|
2025-07-18 18:29:50 +07:00
|
|
|
id: 'revenge.developer-kit',
|
|
|
|
|
name: 'Developer Kit',
|
|
|
|
|
description: 'Tools assisting Revenge developers.',
|
2025-05-05 21:16:44 +07:00
|
|
|
author: 'Revenge',
|
|
|
|
|
icon: 'WrenchIcon',
|
feat!: new repo system + versioning system support + bug fixes
BREAKING CHANGES:
- New versioning system: Allowing any amount of number segments, with prerelease support.
- Any number of segments is supported: 1, 1.0, 1.0.0, 1.0.0.0, ...
- Prerelease labels are compared "digit-run", similar to Debian.
- Plugins must specify a version.
- User-facing plugins should use CalVer. API plugins should use SemVer.
Revenge APIs use SemVer while the new `discord` dependency parses the Discord version string directly.
- Dependency is now a Map, with support for version ranges and optional. Suggested URL is removed. (See new repo system)
- Plugins will now have to declare a dependency on `revenge.api` (Revenge API version) and `discord` (Discord version).
- Manifest now requires a format version (currently `1`)
New APIs:
- lib/plugins/utils: Utilities to format versioning
Features:
- New repo system: Repository design is inspired by Linux package repositories.
- Repos host manifest, versions, channels, download URL/size, and hash for multiple plugins.
- New dependency system: Plugins are versioned, and shouldn't break when updates come.
Plugins can now declare dependency on supported Discord/Revenge API versions, so they won't break with auto-updates.
Dependencies can be optional, but dependency on `revenge.api` and `discord` must be required.
Dependents are soft-disabled when dependencies don't satisfy. Once satisfied, the plugin can start again.
- All updates for running plugins REQUIRE a reload to prevent stale linking issues. Both native and JS-side.
- Update checking is handled entirely by JS. But the native-side still handles installation, indexing, and verification.
- Local indexes are updated against remote indexes. Dependency checking always uses local indexes.
- Users can add custom repositories and custom their priority order. URL is the identity.
- Plugins can now have custom data URI icons instead of being restricted to React Native app assets.
- External plugin installs require UI confirmation before installing.
- Pending Update and Pending Reload filters in Plugins page.
- Ability to browse external plugins in repositories. Official repository will be added soon.
Fixes/Refactor:
- Refactored Plugin-related settings to a separate "Plugin Settings" plugin.
- Masonry layout fixes in landscape.
- Updated plugins now show "reload to apply" toast instead.
- Removed dead code.
2026-07-25 23:35:23 +07:00
|
|
|
dependencies: { [pluginSettings]: {} },
|
2025-05-05 21:16:44 +07:00
|
|
|
},
|
|
|
|
|
{
|
2026-07-09 23:09:29 +07:00
|
|
|
jsonStorage: {
|
2025-05-22 02:48:54 +07:00
|
|
|
load: true,
|
|
|
|
|
default: defaultStorage,
|
|
|
|
|
},
|
2025-09-17 16:57:53 +07:00
|
|
|
async start(api_) {
|
2025-05-18 22:24:48 +07:00
|
|
|
api = api_
|
2025-05-22 02:48:54 +07:00
|
|
|
|
2025-09-17 16:57:53 +07:00
|
|
|
onSettingsModulesLoaded(utils.register)
|
2025-05-22 02:48:54 +07:00
|
|
|
|
2026-07-26 16:01:09 +07:00
|
|
|
if (isPluginStartedLate(api_.plugin)) {
|
2025-06-09 19:47:00 +07:00
|
|
|
refreshSettingsOverviewScreen()
|
2025-09-17 16:57:53 +07:00
|
|
|
refreshSettingsNavigator()
|
|
|
|
|
}
|
2025-06-08 21:19:25 +07:00
|
|
|
|
2026-07-09 23:09:29 +07:00
|
|
|
const settings = await api.jsonStorage.get()
|
2025-10-14 00:16:49 +07:00
|
|
|
|
|
|
|
|
dt.DTContext.addr = settings.devTools.address
|
2026-06-13 21:42:27 +07:00
|
|
|
dt.DTContext.alias = settings.devTools.alias ?? ''
|
2025-10-14 00:16:49 +07:00
|
|
|
rdt.RDTContext.addr = settings.reactDevTools.address
|
|
|
|
|
|
|
|
|
|
if (settings.devTools.autoConnect) dt.connect()
|
|
|
|
|
if (settings.reactDevTools.autoConnect) rdt.connect()
|
2025-05-05 21:16:44 +07:00
|
|
|
},
|
2025-07-21 22:42:37 +07:00
|
|
|
stop({ cleanup }) {
|
2025-09-17 16:57:53 +07:00
|
|
|
cleanup(refreshSettingsOverviewScreen, refreshSettingsNavigator)
|
2025-07-18 02:02:34 +07:00
|
|
|
},
|
2025-05-05 21:16:44 +07:00
|
|
|
},
|
|
|
|
|
PluginFlags.Enabled,
|
|
|
|
|
InternalPluginFlags.Internal,
|
|
|
|
|
)
|
|
|
|
|
|
2025-07-13 15:52:14 +07:00
|
|
|
// Expose to EvalJSSetting
|
2026-07-09 23:09:29 +07:00
|
|
|
export let api: PluginApi<{ jsonStorage: Storage }>
|