vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Merge release channels into the account database and rename it instance.db
3047be84e9bce79372051c09854ce9b05f12a9bf · Keenan Nemetz · 17d ago · parent 262e516e
Merge release channels into the account database and rename it instance.db The instance keeps four SQLite files instead of five. Release channels were in a file of their own only because they were added beside the derived index; they are authoritative source state, like the roster, so they belong in the file an operator restores. Nothing has to be migrated: channels.db never shipped in a release, so only an instance tracking main can have one. The account database is now data/instance.db. The package comments already called it that; only the filename disagreed. Moving an existing instance is an operator step, by decision: a rename under a live server can lose the -wal file a hook subprocess still has open. Vole refuses to start while data/users.db is still in place, and says what to move, rather than creating an empty database beside it that would look like a successful upgrade. The list of databases now lives in Config.Databases, which TightenSecrets, the hook plumbing, and the admin commands read, so a missed -wal file is no longer a nine-file change. `vole admin account backup <path>` becomes `vole admin db backup <dir>` and covers every authoritative database; `db list` and `db check` answer what to back up and whether it is intact.
forge/session/session.go +4−4
| @@ -1,12 +1,12 @@ | |||
| 1 | 1 | // Package session stores browser login sessions in the instance database. | |
| 2 | 2 | // | |
| 3 | 3 | // A session is an opaque random token held in a cookie. The database stores only | |
| 4 | // the token's hash, so a copy of users.db cannot be replayed as a login. Sessions | ||
| 4 | // the token's hash, so a copy of instance.db cannot be replayed as a login. Sessions | ||
| 5 | 5 | // carry the account name and the passkey that created them: revoking that passkey | |
| 6 | 6 | // deletes exactly the sessions it authorized, and retiring the account deletes | |
| 7 | 7 | // all of them. | |
| 8 | 8 | // | |
| 9 | // The table lives beside the roster in users.db. That is what makes the | ||
| 9 | // The table lives beside the roster in instance.db. That is what makes the | ||
| 10 | 10 | // lifecycle rules enforceable with foreign keys and one transaction instead of | |
| 11 | 11 | // a cleanup routine that can drift. The trade-off is write traffic, so last_seen | |
| 12 | 12 | // is updated coarsely rather than on every request. | |
| @@ -93,7 +93,7 @@ type Store struct { | |||
| 93 | 93 | path string | |
| 94 | 94 | } | |
| 95 | 95 | ||
| 96 | // Open opens the session table in an existing users.db. The schema is created | ||
| 96 | // Open opens the session table in an existing instance.db. The schema is created | ||
| 97 | 97 | // with the roster by identity.Init or identity.Open, so a missing database is a | |
| 98 | 98 | // configuration error rather than something this package creates silently. | |
| 99 | 99 | func Open(path string) (*Store, error) { | |
| @@ -276,7 +276,7 @@ func (s *Store) RevokeAccount(name string) (int64, error) { | |||
| 276 | 276 | } | |
| 277 | 277 | ||
| 278 | 278 | // RevokeAll deletes every session on the instance. It is the recovery step after | |
| 279 | // restoring an old users.db, where the restored rows would otherwise still name | ||
| 279 | // restoring an old instance.db, where the restored rows would otherwise still name | ||
| 280 | 280 | // sessions whose cookies may exist. | |
| 281 | 281 | func (s *Store) RevokeAll() (int64, error) { | |
| 282 | 282 | var n int64 | |