Create new generic config abstraction #25

Merged
restitux merged 1 commits from new-config into main 2026-03-11 04:02:23 +00:00
Owner

This change migrates the config logic to a new generic key+value abstraction. This allows config parameters to be get and set with arbitrary string keys. Config value types can be anything that serde knows how to serialize / deserialize.

Implementations:
Desktop:
Uses a json file in a platform specific directory (pulled from etcetera). This is mostly the same as the existing code. Implemented in native_config.rs
Android:
Uses the same mechanism as desktop, with a different path selection that calls out to the android apis (via jni) to get the correct directory.
Web:
Uses browser local storage. Values are stored as strings instead of actual json objects to keep things simple for now. We might want to update this at some point.

Desktop support:
2026-03-04-223906_grim.png

% cat ~/.config/mumble-web2/config.json
{
  "username": "restitux-test",
  "server_url": "voip.ohea.xyz"
}%

Web support:
2026-03-04-223243_grim.png
Android support:
image.png

root@c053bdd1b4da:/# adb shell
tokay:/ $ run-as xyz.ohea.mumble_web_2
tokay:/data/user/0/xyz.ohea.mumble_web_2 $ ls 
app_textures  app_webview  cache  code_cache  files  no_backup  shared_prefs
tokay:/data/user/0/xyz.ohea.mumble_web_2 $ ls files
config.json  oat  permission_manager.dex
tokay:/data/user/0/xyz.ohea.mumble_web_2 $ cat files/config.json
{
  "server_url": "voip.ohea.xyz",
  "username": "test"
}tokay:/data/user/0/xyz.ohea.mumble_web_2 $    
This change migrates the config logic to a new generic key+value abstraction. This allows config parameters to be get and set with arbitrary string keys. Config value types can be anything that serde knows how to serialize / deserialize. Implementations: Desktop: Uses a json file in a platform specific directory (pulled from etcetera). This is mostly the same as the existing code. Implemented in `native_config.rs` Android: Uses the same mechanism as desktop, with a different path selection that calls out to the android apis (via jni) to get the correct directory. Web: Uses browser local storage. Values are stored as strings instead of actual json objects to keep things simple for now. We might want to update this at some point. Desktop support: ![2026-03-04-223906_grim.png](/attachments/18bfea3e-456c-40f3-9b14-f865c062fcb0) ``` % cat ~/.config/mumble-web2/config.json { "username": "restitux-test", "server_url": "voip.ohea.xyz" }% ``` Web support: ![2026-03-04-223243_grim.png](/attachments/fc55c0c0-1422-4ae8-8e43-9829c6ab7920) Android support: ![image.png](/attachments/28d9c0f1-ef87-4561-83db-9e4916208267) ``` root@c053bdd1b4da:/# adb shell tokay:/ $ run-as xyz.ohea.mumble_web_2 tokay:/data/user/0/xyz.ohea.mumble_web_2 $ ls app_textures app_webview cache code_cache files no_backup shared_prefs tokay:/data/user/0/xyz.ohea.mumble_web_2 $ ls files config.json oat permission_manager.dex tokay:/data/user/0/xyz.ohea.mumble_web_2 $ cat files/config.json { "server_url": "voip.ohea.xyz", "username": "test" }tokay:/data/user/0/xyz.ohea.mumble_web_2 $ ```
sam approved these changes 2026-03-07 04:01:07 +00:00
@@ -50,11 +50,24 @@ pub trait AudioPlayerInterface {
fn play_opus(&mut self, payload: &[u8]);
}
pub trait ConfigSystemInterface: Sized {
Owner

I'll definitely rebase on top of this when you merge!

I'll definitely rebase on top of this when you merge!
@@ -165,2 +174,4 @@
let _ = assert_platform::<stub::StubPlatform>;
};
fn global_default_config() -> HashMap<String, serde_json::Value> {
Owner

What is the default_config logic used for? It seems a bit tangled right now, and we might as well leave it out until we need it for some reason

What is the default_config logic used for? It seems a bit tangled right now, and we might as well leave it out until we need it for some reason
Author
Owner

The idea is that we might want default values for some config options. For example, we might want to default the voice activation detection mode to "raw amplitude" instead of "signal to noise". The platform vs global logic is to allow us to set a default value for all platforms and override it with a platform specific variable. I can remove this but I anticipate wanting a feature like this right away once we start adding different configuration toggles.

The idea is that we might want default values for some config options. For example, we might want to default the voice activation detection mode to "raw amplitude" instead of "signal to noise". The platform vs global logic is to allow us to set a default value for all platforms and override it with a platform specific variable. I can remove this but I anticipate wanting a feature like this right away once we start adding different configuration toggles.
Owner

I guess the reason it feels weird to me is that instead of doing config_get("thing").unwrap_or("default") you just have to config_get("thing").unwrap() and trust the default is somewhere else. But IDK, it is probably fine

I guess the reason it feels weird to me is that instead of doing `config_get("thing").unwrap_or("default")` you just have to `config_get("thing").unwrap()` and trust the default is somewhere else. But IDK, it is probably fine
restitux force-pushed new-config from 8c8f0c6ef2 to 55c8722b1e 2026-03-11 03:51:16 +00:00 Compare
restitux force-pushed new-config from 55c8722b1e to ce4f3ee934 2026-03-11 03:52:49 +00:00 Compare
restitux merged commit d67a19c478 into main 2026-03-11 04:02:23 +00:00
restitux deleted branch new-config 2026-03-11 04:02:23 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mumble/mumble-web2#25