Persistant Desktop settings #11
+1
-1
@@ -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()
|
||||
|
||||
@@ -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();
|
||||
|
|
||||
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,
|
||||
})
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user
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.