Commit Graph

129 Commits

Author SHA1 Message Date
Scott Lamb f9e3fb56b3 update some deps 2024-08-23 21:37:21 -07:00
Scott Lamb 140f625a80 clippy 2024-08-19 08:13:35 -07:00
Scott Lamb dad664c244 upgrade to retina 0.4.9
This is a step toward H.265 recording support (#33) by using Retina
for the `VisualSampleEncoding` instead of the prior H.264-specific
logic. The only further change to Moonfire itself needed for H.265 is to
add `| "h265"` to the check for the right video stream.

This also adds support for recording MJPEG, although browser playback
almost certainly won't work.
2024-08-19 08:13:32 -07:00
Scott Lamb 89f230004e avoid unbounded channels in live streams
It's cleaner anyway to use `tokio::broadcast::channel` than the list
of callbacks.

Also make it send pings only on long pauses between frames, as when
the camera is disconnected.
2024-08-15 17:32:08 -07:00
Scott Lamb 0422593ec6 ui list view: tool tip to see why recording ended
Users are often puzzled why there are short recordings. Previously
the only way to see this was to examine Moonfire's logs. This should
be a much better experience to find it right in the UI where you're
wondering, and without the potential the logs are gone.

Fixes #302
2024-06-01 07:46:11 -07:00
Scott Lamb e6c7b800fe tolerate bad sps/pps, continued 2024-05-30 18:19:58 -07:00
Scott Lamb f385215d6e clippy 2024-02-12 17:32:37 -08:00
Scott Lamb 86816e862a update some Rust dependencies
I didn't go to quite the latest version of everything, in an effort to
minimize duplicates in the cargo tree.
2024-01-06 11:41:28 -08:00
Scott Lamb 7d12e8033d upgrade Rust deps including Retina 2023-12-29 15:30:17 -08:00
Scott Lamb 4a0cb6e62d fix incorrect comment
Fixes #288
2023-10-20 22:13:01 -07:00
Scott Lamb faf0201b52 clear pkg versions in subcrates too 2023-10-17 10:18:28 -07:00
Scott Lamb a76483a912 stop using cargo pkg version
One fewer thing to manage at release time.
2023-10-17 09:44:30 -07:00
Scott Lamb ef62ebfc6c Merge remote-tracking branch 'origin/release-0.7.7' 2023-10-16 22:05:54 -07:00
Scott Lamb b4eb573ca2 `cargo fmt`
...necessary to pass CI since changes to stable Rust's formatting.
2023-09-30 16:15:02 -07:00
Scott Lamb 2a8c1bb632 let libtest capture logs 2023-08-08 18:24:50 -07:00
Scott Lamb cff832e646 prep v0.7.7 2023-08-03 14:03:48 -07:00
Scott Lamb b9db9c11cc improve some error logs
...in particular, pass the error as a tracing param rather than directly
in the main error message. The new behavior is nicer with e.g.
OpenTelemetry.
2023-08-03 15:46:36 -05:00
Scott Lamb 64ca096ff3 massive error overhaul
* fully stop using ancient `failure` crate in favor of own error type
* set an `ErrorKind` on everything
2023-07-09 22:04:17 -07:00
Scott Lamb 6a5b751bd6 log error messages in web paths
HTTP requests were only returning the error message to the caller, not
logging locally. In most cases the problem could be understood
client-side, but there are some exceptions. E.g. if Moonfire returns
a 403 on WebSocket update, even in the Chrome debug tools's network
tab the HTTP response body seems to be unavailable. And in general,
it's nice to have more context server-side.

Logging a `response::Body` isn't practical (it could be a stream), so
convert all the web stuff to use `base::Error` err returns.

Convert the `METHOD_NOT_ALLOWED` paths to return `Ok` for now. This is a
bit lame but punts on having some way of plumbing an explicit/overridden
status code in `base::Error`, as no gRPC error kind cleanly maps to
that.

Also convert `db::auth`, rather than making up an error kind in the web
layer.

This is also a small step toward getting rid of `failure::Error`.
2023-07-09 10:15:56 -07:00
Scott Lamb 4ad627b997 prep 0.7.6 release 2023-07-08 10:22:04 -07:00
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