Commit Graph

979 Commits

Author SHA1 Message Date
Scott Lamb
1944f95974 fix moonfire-nvr ts subcommand 2023-10-16 15:18:33 -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
e103a709a0 update caniuse list 2023-09-30 16:04:03 -07:00
Scott Lamb
9820bf8883 tweak ui dev server's websocket situation
* fix the automatic reload
* document that live view doesn't work with `PROXY_TARGET`;
  link to fresh issue
2023-09-30 16:02:52 -07:00
Scott Lamb
2a8c1bb632 let libtest capture logs 2023-08-08 18:24:50 -07:00
Scott Lamb
faba358925 bundle UI files into the binary
This is optional but now enabled for release builds.

Why?

* It shrinks the release docker images a bit, as the binary
  includes only the gzipped version of files and uncompressed into RAM
  at startup (which should be fast).

* It's a step toward #160.
2023-08-06 08:16:27 -05:00
Scott Lamb
cff832e646 prep v0.7.7 2023-08-03 14:03:48 -07:00
Scott Lamb
02ac1a5570 fix #289: crash on sample dir Add button press 2023-08-03 15:58:57 -05:00
Scott Lamb
0f019b6fb3 log to stderr, not stdout 2023-08-03 15:48:59 -05: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
9d07d24bc7 camera test button: include full error chain
...otherwise this simply says `UNKNOWN`, discarding the details from
`retina`.
2023-08-03 15:29:02 -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
Leandro Silva
ed7ab5dddf Add hyperink to the latest release in installation instructions 2023-07-08 17:18:59 -07:00
Scott Lamb
4ad627b997 prep 0.7.6 release 2023-07-08 10:22:04 -07:00
Scott Lamb
baa2ee6118 use bpaf 0.9.1 2023-07-08 10:01:45 -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
db2e0f1d39 Bump minimum Rust version to 1.65 2023-07-04 16:37:36 -07:00
Skye
81ea7d8a87 Add "Copy config" option to "Add camera" dialog 2023-07-04 16:37:36 -07:00
Skye
1fde947f36 Tiny misc code improvements 2023-07-04 16:37:36 -07:00
Skye
c2d226d58e Add myself as an author 2023-07-04 16:06:50 -07:00
Skye
be53509325 Fix formatting 2023-07-04 16:06:50 -07:00
Skye
10b61ddc5e Use a vector instead of a boxed slice for tab completion results 2023-07-04 16:06:50 -07:00
Skye
3d40a39b93 Add tab completion to Add sample file dir dialog 2023-07-04 16:06:50 -07:00
Skye
930decc766 Make retention screen scroll on overflow 2023-07-04 15:34:45 -07:00
Scott Lamb
05562dae5b upgrade bpaf to nearly-0.9.1
* take advantage of new features to default to `--help` and to print
  the defaults
* remove blank lines from argument help docstrings to avoid truncating
  the output on single `--help` arg (as opposed to `--help --help`)

I'd use the actual released 0.9.1 but it looks like it's not quite out
yet. Will switch over when it is.
2023-07-04 13:55:16 -07:00
Scott Lamb
e4ecd0d853 compile and lint cleanly on latest nightly 2023-07-04 13:46:15 -07:00
Scott Lamb
53414ed903 upgrade to Retina 0.4.5 2023-07-04 13:46:15 -07:00
Skye
6acf9ad67f Make cameras list in TUI scrollable on overflow 2023-07-03 11:15:59 -07:00
Skye
5a567da652 Fix deleting a camera with no video duplicating dialog 2023-07-03 11:15:23 -07:00
Scott Lamb
438de38202
rework WebSocket error return protocol
This gives much better information to the UI layer, getting rid of a
whole troubleshooting guide entry. See #119 #132 #218 #219

I also restructured the code in anticipation of a new WebSocket event
stream (#40).
2023-02-15 17:26:40 -08:00
Scott Lamb
0ffda11d4b
bpaf improvements
* use latest published crate. This is a build fix: it was broken
  when the `exit_code` branch was deleted from the `bpaf` repo, even
  though the commit still exists!
  https://github.com/scottlamb/moonfire-nvr/pull/259

* clean up `db-dir` parsing redundancy, as suggested here:
  https://github.com/pacak/bpaf/discussions/165#discussioncomment-4983158
2023-02-15 08:32:48 -08:00
Tim Small
ad48cf2e10 Fix chown in build instructions.
The build instructions currently fail if the user doesn't have a group
matching their user name (not a universally adopted convention).  Update
the command to use the following functionality of the `chown` command:

"If a colon but no group name follows the user name, that user is made
the owner of the files and the group of the files is changed to that
user's login group."
2023-02-15 08:03:02 -08: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
Scott Lamb
015dfef9c9
fix #257
Apparently a `MenuItem` with a value of `undefined` is possible but
doesn't actually fire a change event. Strange. Use the string `"null"`
instead.
2023-02-13 11:05:27 -08:00
Scott Lamb
64d161d0a7
format string readability improvement 2023-02-11 12:20:36 -08:00
Scott Lamb
321c95a88c
username used to be positional; switch back 2023-02-11 12:19:59 -08:00
Scott Lamb
f7718edc7f
moonfire-nvr login --permissions: take JSON
This improves usability and shrinks the binary: 12.0 MiB to 11.0 MiB
just now.
2023-02-11 12:08:50 -08:00
Scott Lamb
b1a46cfb25
use new bpaf::ParseFailure::exit_code
95b5db15a8
2023-02-11 11:50:26 -08:00
Scott Lamb
e21f795e93
switch from ancient clap/structopt release to bpaf
Improves #70: this reduces binary size from 12.3 MiB to 11.9 MiB (3%) on
macOS/arm64.

The user experience is almost the same. (The help output's `Usage:`
lines lack the e.g. `moonfire-nvr run` prefix of argv[0] and subcommand,
which isn't ideal, but I guess it's pretty minor in the grand scheme of
things.)
2023-02-11 11:43:11 -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
182f6f8a1b
support disabling/enabling users by http api 2023-01-31 06:50:29 -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
159e426943
fix unsoundness in Segment::build_index
Fixes #185
2023-01-29 14:58:43 -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
6a49bffff2
CI: retry apt operations 2023-01-11 22:33:04 -08:00
Scott Lamb
098b54c9f9
upgrade to react 18
* new root rendering api
* components are now allowed to return undefine
* testing library changes for userEvent.type
2023-01-11 22:25:56 -08:00