Skip to main content

## current_server

# Function current_server

Source

    async fn current_server(
        db: &Arc<RusqliteService>,
        auth_manager: &State<'_, AuthManagerWrapper>,
    ) -> Result<(String, String), String>

Expand description

The server this device is signed in to, as `(server_id, server_url)`.

Every profile operation is scoped to it — this is where the same-server constraint is actually enforced, rather than by omitting a URL field from a form.

The fallback to the `servers` table is not a convenience. When the last-used profile has a PIN, `auth_initialize` deliberately does not restore its session, so at startup there is no in-memory session to read — and the picker still has to know which server’s profiles to list. Reading it from storage is what lets the PIN gate a real thing rather than just a screen.