Commit Graph

109 Commits

Author SHA1 Message Date
Scott Lamb aa60bc991c test and fix #282
Sessions' last use updates weren't getting persisted to the database
because the update statement wasn't passing through the hash.

Also address a TODO of tracing in tests by using the same tracing
setup as in production.
2023-07-04 20:53:53 -07:00
Scott Lamb 028243532a upgrade to Rust 1.70, use `std::sync::OnceLock`
The most notable part of this is that `db::auth` no longer holds a lock
during password hashing operations. That was probably never a great
idea...
2023-07-04 20:44:21 -07:00
Scott Lamb ebcdd76084 switch from `log` to `tracing`
I think this is a big improvement in readability.

I removed the `lnav` config, which is a little sad, but I don't think it
supports this structured logging format well. Still seems worthwhile on
balance.
2023-07-04 16:51:22 -07:00
Skye 1fde947f36 Tiny misc code improvements 2023-07-04 16:37:36 -07:00
Scott Lamb e4ecd0d853 compile and lint cleanly on latest nightly 2023-07-04 13:46:15 -07:00
Scott Lamb 2b27797f42
tweak bpaf usage message
As discussed here: https://github.com/pacak/bpaf/discussions/165#discussioncomment-4967176

I also snuck in a conversion from `lazy_static` to `once_cell`, rather
than adding another usage of the former.
2023-02-13 22:55:22 -08:00
dependabot[bot] 23c1b9404b Bump tokio from 1.24.0 to 1.24.2 in /server
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.24.0 to 1.24.2.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/commits)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-03 17:41:41 -08:00
Scott Lamb a9430464b6
cargo clippy --fix
This switches to inlining variable names into format args. clippy
now suggests this syntax, and I like it.
2023-01-29 15:01:19 -08:00
Scott Lamb 284a59b05e
clean up some clippy warnings 2023-01-28 11:59:21 -08:00
Scott Lamb 3965cbc547
rm unused var 2023-01-28 11:32:56 -08:00
Scott Lamb 8c4e69f772
user admin api improvements 2023-01-08 03:21:42 -06:00
Scott Lamb a4bc7f5218
config file reference and doc reorganization 2023-01-06 14:25:13 -06:00
Scott Lamb e0940979e4
upgrade nix, tungstenite deps 2023-01-05 20:18:57 -06:00
Scott Lamb 42fe054d46
make `GET /api/` return current permissions
This is useful for e.g. deciding whether or not to present the user
admin UI in navigation.

As part of this change, I adjusted the casing in Permissions, and then
all the toml stuff for consistency. Noted in changelog.
2022-12-31 12:43:13 -05:00
Scott Lamb c02fc6f439 more user admin actions 2022-12-25 23:01:17 -05:00
Scott Lamb be4e11c506 extend POST /users/:id
Now you can set a password for a user while the server is running,
e.g. via the following command:

```shell
curl \
    -H 'Content-Type: application/json' \
    -d '{"update": {"password": "asdf"}}' \
    --unix-socket /var/lib/moonfire-nvr/sock \
    http://nvr/api/users/1
```
2022-12-23 13:14:24 -08:00
Scott Lamb a5824b8633 fix inverted cond on deleting sample file dir
Symptom: in `nvr config`, if you create a dir and then immediately try
to delete it, it would fail saying it's in-use. This check is supposed
to be for having a running syncer on the directory, which would be
an arc count > 1.
2022-10-03 08:29:11 -04:00
Scott Lamb ae502200c0 upgrade various Rust dependencies
This stops using parking_lot entirely. Since Rust 1.62, the std
implementations on Linux are direct futexes, not the boxed pthread
mutexes they used to be. No real reason to use parking_lot anymore, so
shed this dependency.
2022-09-28 22:20:48 -07:00
Scott Lamb 0866b23991 clean up the easy clippy errors
I'm still not running clippy on CI and probably should.
There are a few left that were a little more involved to address.
2022-09-28 09:29:16 -07:00
Scott Lamb b03eceb21a upgrade to Retina 0.4.1
Fixes #234
2022-08-09 08:02:07 -07:00
Scott Lamb 8e8b48b906 prepare 0.7.5 with Retina 0.3.10
Fixes #224
2022-05-09 13:17:18 -07:00
Scott Lamb 841e06e354 update a few deps 2022-05-02 11:23:03 -07:00
Scott Lamb 13bfb76855 prepare v0.7.4 2022-04-13 15:08:15 -07:00
Scott Lamb 2e2de8cc6a fix db tests for 3bc552b
(I ran `cargo test` rather than `cargo test --all`, oops!)
2022-04-13 14:52:18 -07:00
Scott Lamb 3bc552b950 seamless mid-stream video parameter changes
For #217. This handles the recording logic. May still need fixes to
playback and/or live stream logic.
2022-04-13 14:39:47 -07:00
Scott Lamb 3bc410b417 prepare v0.7.3 2022-03-22 14:56:15 -07:00
Scott Lamb be3a5b200e prepare v0.7.2 2022-03-16 18:31:12 -07:00
Scott Lamb 78cdd82f36 fix warnings 2022-03-11 12:01:35 -08:00
Scott Lamb ceaef46ea9 introduce /etc/moonfire-nvr.json (#133) 2022-03-09 13:18:33 -08:00
Scott Lamb 8720495608 upgrade scrypt dependency 2022-03-08 11:40:25 -08:00
Scott Lamb ce3cf9c096 upgrade rusqlite 2022-03-08 11:37:45 -08:00
Scott Lamb 9d70d68710 fix #187 via a dependency upgrade
I did a full `cargo upgrade` and fixed what it broke:

*   a couple things for the latest protobuf 3.0 alphas
    (note alphas don't promise API stability)
*   new minimum supported Rust version

This should have some other nice effects: parking_lot now uses inline
assembler, tokio has gotten faster, etc.
2022-03-08 11:24:44 -08:00
Scott Lamb 77775a82e5 make `moonfire-nvr sql` enforce integrity
https://github.com/scottlamb/moonfire-nvr/issues/175#issuecomment-1008096087
2022-01-08 10:54:40 -08:00
Scott Lamb 0f6c1b3856 use github URLs in doc pointers
This is better particularly when the user is following the docker
instructions and doesn't have a local checkout at all. It also is a
rendered HTML view rather than raw markdown.

It'd be nice to link to the exact release we're using, not tip of
master. I didn't do this now because it'll likely take some work with
build.rs to check if the user is on a tagged release or not.

Fixes #180
2021-11-23 10:49:42 -08:00
Scott Lamb cf492a2ffa fix #182: error on upgrade when onvif_host empty 2021-11-23 10:17:47 -08:00
Scott Lamb 1c9a55653d allow setting rtsp transport per-stream 2021-10-27 14:28:44 -07:00
Scott Lamb 981cee0706 revert cursive upgrade
SelectView::set_selection doesn't seem to be working properly. The
symptom is editing an existing camera will clear the sample file dir,
and thus hitting edit without making any changes will fail.
2021-10-27 14:27:10 -07:00
Scott Lamb 504f1a36ab switch from libpasta to just scrypt
This drops several older dependencies and reduces final binary size
(text section by ~200KiB, unstripped binary by ~12MiB)

I'll have to manually add new hash formats, and I won't ever be able
to take advantage of libpasta's (currently unused) facility to wrap
hashes, but I think it's worth it. libpasta isn't well-maintained.
2021-10-27 11:50:55 -07:00
Scott Lamb 4f22cf66e3 switch from prettydiff to diff
prettydiff has a weird chain of dependencies starting with
prettytable-rs and ending up with (among other things) argon2rs.
2021-10-27 10:20:53 -07:00
Scott Lamb e5707f6557 update some Rust deps
In particular, retina 0.3.4 no longer pulls in an old nom.
2021-10-26 21:41:03 -07:00
Scott Lamb ddda01e4fa preparing v0.7.0 2021-10-26 18:54:26 -07:00
Scott Lamb caa0878004 fix incorrect open uuid from f7aa71d 2021-10-26 14:41:54 -07:00
Scott Lamb 7ad5bf56a7 fix out-of-date sql in `nvr check` 2021-10-26 14:32:37 -07:00
Scott Lamb 96cc02d48e fix incorrect onvif url on upgrade 2021-10-26 14:14:28 -07:00
Scott Lamb 7b86db3c03 fix swapped record on 6->7 upgrade 2021-10-26 14:10:05 -07:00
Scott Lamb 08cef6e790 test and fix signal_camera upgrade problems
- after 3->4 upgrade, it left the foreign key referring to the
  nonexistent old_camera table. Likely no one who did the upgrade
  has ever inserted anything into this table, so no one's noticed.
- 6->7 upgrade dropped tables in the wrong order, so if there was
  anything in the signal_camera table, the upgrade would fail.
2021-10-26 14:00:18 -07:00
Scott Lamb 363fc8a267 fix upgrade foreign key error on garbage table
It was still referencing old_sample_file_dir.
2021-10-26 13:28:49 -07:00
Scott Lamb 24a0b2a9f1 add config json to user table 2021-10-26 13:16:08 -07:00
Scott Lamb 721141770f flexible config for sample_file_dir 2021-10-26 11:47:13 -07:00
Scott Lamb dad349840d more flexible signals
Now there's room to add arbitrary configuration to signals and types.
Several things are no longer fixed columns/tables but instead within
the configuration types.
2021-10-26 10:15:09 -07:00