Persistant Desktop settings #11

Merged
samuel127849 merged 3 commits from swarfield/desktop-settings into main 2026-01-10 23:26:22 +00:00
3 changed files with 11 additions and 3 deletions
Showing only changes of commit f2474591cb - Show all commits
+1 -1
View File
@@ -558,7 +558,7 @@ pub fn LoginView(config: Resource<ClientConfig>) -> Element {
}
});
let mut address_input = use_signal(|| None::<String>);
let mut address_input = use_signal(|| imp::load_server_url());
let address = use_memo(move || {
if let Some(addr) = address_input() {
addr.clone()
+6 -2
View File
@@ -361,10 +361,14 @@ pub fn load_username() -> Option<String> {
config.get("username").cloned()
}
pub async fn load_config() -> color_eyre::Result<ClientConfig> {
pub fn load_server_url() -> Option<String> {
let config = load_config_map();
Review

Load config should not change, because this is (confusingly) the server->client config, not really the user's own config. TBH we should rename it to "server_params" or something, but probably not in this PR.

Anyway, we should instead plumb the remembered last-used server address to the initial value of address_input of LoginView. That is, use it to pre-fill the field.

Load config should not change, because this is (confusingly) the server->client config, not really the user's own config. TBH we should rename it to "server_params" or something, but probably not in this PR. Anyway, we should instead plumb the remembered last-used server address to the initial value of address_input of LoginView. That is, use it to pre-fill the field.
config.get("server").cloned()
}
pub async fn load_config() -> color_eyre::Result<ClientConfig> {
Ok(ClientConfig {
proxy_url: config.get("server").cloned(),
proxy_url: None,
cert_hash: None,
any_server: true,
})
+4
View File
@@ -412,6 +412,10 @@ pub fn load_username() -> Option<String> {
.ok()?
}
pub fn load_server_url() -> Option<String> {
None
}
pub fn absolute_url(path: &str) -> Result<Url, Error> {
let window: web_sys::Window = web_sys::window().expect("no global `window` exists");
let location = window.location();