fix #14740: fixed backend url per build, key bound to its server
- the backend URL is no longer a setting: one constant per build (release/dev) in src-tauri/src/backend.rs; Settings shows the server read-only; an old backend_url in settings.json is ignored - the stored key records the backend it was created for; a key of another backend is discarded before any use and never stored - a refused key is discarded only if it still is the stored one - the keyring is never called while the settings are locked - one upload per call at a time, also visible after a view switch - opener plugin without its link-click script (it also ran in the remote login page); a login error says to reload the login page Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -37,23 +37,16 @@ pub fn get_settings(state: State<'_, AppState>) -> Settings {
|
||||
state.settings()
|
||||
}
|
||||
|
||||
/// Saves the settings. A changed backend URL ends the backend login
|
||||
/// (`backend-changed`). May delete from the keyring, so it runs on the
|
||||
/// blocking pool.
|
||||
#[tauri::command]
|
||||
pub async fn save_settings(app: AppHandle, settings: Settings) -> CmdResult<()> {
|
||||
blocking(app, move |app| {
|
||||
let autostart = settings.autostart;
|
||||
let backend_changed = app.state::<AppState>().save_settings(settings)?;
|
||||
apply_autostart(app, autostart);
|
||||
if backend_changed {
|
||||
if let Err(e) = app.emit_to("main", "backend-changed", ()) {
|
||||
log::error!("could not emit backend-changed: {e}");
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.await
|
||||
pub fn save_settings(
|
||||
app: AppHandle,
|
||||
state: State<'_, AppState>,
|
||||
settings: Settings,
|
||||
) -> CmdResult<()> {
|
||||
let autostart = settings.autostart;
|
||||
state.save_settings(settings)?;
|
||||
apply_autostart(&app, autostart);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Stores `key` in the keyring; an empty key deletes the entry.
|
||||
|
||||
Reference in New Issue
Block a user