| Commit message (Collapse) | Author | Age |
| |
|
|
|
| |
That helps remove duplicated code and rustc/cargo will now also show
dead code correctly.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
## Summary
This PR enables the Atuin CLI to authenticate with Atuin Hub, unifying
authentication across CLI sync and Hub features (AI, runbooks, etc.).
### Key Changes
- **Dual auth support**: New `AuthToken` enum supports both `Bearer`
(Hub) and `Token` (legacy CLI) authentication
- **Smart protocol selection**: New `sync_protocol` setting
(`auto`/`hub`/`legacy`) determines auth method. By default,
`api.atuin.sh` uses Hub auth; custom sync addresses use legacy auth
- **Hub login flow**: `atuin login` now initiates an OAuth-like flow for
Hub users—generates a code, user authorizes in browser, CLI polls for
completion
- **Account linking**: After Hub auth, silently attempts to link
existing CLI sync account to Hub account for seamless migration
- **Graceful fallback**: `sync_auth_token()` prefers Hub token when
available, falls back to CLI session token
### Auth Flow
1. User runs `atuin login` (with default sync address)
2. CLI requests auth code from Hub, displays URL
3. User opens URL, logs in/registers on Hub
4. Hub attaches API token to code
5. CLI polls, receives token, saves as hub session
6. If user had existing CLI sync account, it's automatically linked
### Backward Compatibility
- Existing self-hosted users: unaffected (legacy auth via `Token`
header)
- Existing `api.atuin.sh` users: continue working with CLI session until
they run `atuin login`
- New users: go through Hub flow automatically
## Test Plan
- [ ] New user registration via Hub flow
- [ ] Existing CLI user can still sync without changes
- [ ] `atuin login` links CLI account to Hub account
- [ ] Self-hosted users unaffected by changes
- [ ] AI commands work after Hub auth
---------
Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These files have been known to have corruption issues. SQLite will
perform better across filesystems for reads/writes across threads, and
will lock as expected.
I've also put the session file in there, though I'm 50/50 on it - I'll
be replacing it with keyring storage asap anyway.
The key file is _not_ included. It should ~never be changed, and should
be easy for the user to secure + manage themselves
In the future, instead of creating more files, we can just use this as a
kv store
Resolves https://github.com/atuinsh/atuin/issues/2336, resolves
https://github.com/atuinsh/atuin/issues/1650
## Checks
- [ ] I am happy for maintainers to push small adjustments to this PR,
to speed up the review cycle
- [ ] I have checked that there are no existing pull requests for the
same thing
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fix: typeerror in client sync code
Fixes #2645
This is really weird
1. I have not touched this code in _years_. It has not changed. In
recent rust versions, it has a typeerror (see linked issue)
2. This does not occur when running `cargo build`, in release mode or
otherwise. It only occurs with `cargo install`
3. I can't find any other occurences of this typeerror online - unsure
if it is a compiler regression? The code here is not very complex at
all.
* chore(clippy): remove unused imports
|
| |
|
|
|
|
|
|
|
| |
* chore: upgrade to 2024 edition
* ugh unsafe
* format
* nixxxxxxxxxxx why
|
| |
|
|
|
|
|
|
| |
* fix(daemon): do not try to sync if logged out
I've also added Settings::logged_in, as there are a few places where we
switch on login state.
* make session_token a function
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fix(dotfiles): allow clearing aliases, disable import
At the moment there are far too many edge cases to handle importing
aliases.
1. We need an interactive shell to print aliases. Without it, most
shells won't report much.
2. Many people have their shells print things on startup (graphics,
fortunes, etc). This could be detected as an attempt to set an alias.
Rather than spend the next year finding import edge cases, I'm
disabling it for now. There's probably a better way we can do this?
* clippy
|
|
|
I'd like to tidy up the root a little, and it's nice to have all the
rust crates in one place
|