Add API endpoint for retrieving config.json (without any secure access details)

This commit is contained in:
NG (Graham) committed 2026-06-21 21:58:36 -04:00
1 parent c4f297eb18
commit e60a4927a6
8 files changed
+102

No files matched your search

+15
View File
@@ -610,4 +610,19 @@ impl <C: Clone + Send> super::ConfigProvider<C> for CubeConfig {
team_deathmatch: self.battle.games.team_deathmatch.team_chooser.clone(),
}
}
fn redacted_json(&self) -> String {
use super::RedactedClone;
let redacted_self = Self {
cubes: self.cubes.clone(),
movement: self.movement.clone(),
lerp_value: self.lerp_value,
battle: self.battle.clone(),
chat: self.chat.clone(),
factory: self.factory.redacted_clone(),
shop: self.shop.clone(),
settings: self.settings.redacted_clone(),
};
serde_json::to_string(&redacted_self).expect("Failed to re-serialize config.json")
}
}
+1
View File
@@ -3,6 +3,7 @@ pub use cubes_json::CubeConfig;
mod traits;
pub use traits::{ConfigProvider, DevMessageProvider, ServerConfig, GarageUpgrades, GarageUpgradeIncrement, ChatSystemConfig, GameEventSequence, GameEvents, GameRotationStrategy, GameEvent, GameMap, GameVisibility, GameType, SingleplayerConfig, VehicleInfo, VehicleDescriptor, QueueChangeMode, Point, Sphere, MapConfig, LinksConfig, FakePlayer, ClientEmulator, EnergyConfig, BattleArenaResolver, PitSettings, PitWinCondition, TeamDeathMatchSettings, ShopEntriesResolver, ShopAction, ShopGain, PromoCode, MultiplayerSettings, BattleArenaCrystalParams, VehicleValidators, TeamChoosers, FactoryConfig, PlatformConfig};
pub(super) use traits::RedactedClone;
mod validation;
pub use validation::{SelfValidator, ValidationInfo, ValidationMessage};
+5
View File
@@ -45,6 +45,7 @@ pub trait ConfigProvider<C: Clone> {
fn vehicle_validation(&self) -> VehicleValidators;
fn garage_slot_limit(&self) -> i32;
fn team_choosers(&self) -> TeamChoosers;
fn redacted_json(&self) -> String;
}
pub struct DevMessageProvider<C: Clone> {
@@ -573,3 +574,7 @@ pub struct PlatformConfig {
pub enable_analytics: bool,
pub enable_standard_units: bool,
}
pub trait RedactedClone {
fn redacted_clone(&self) -> Self;
}