Commit Graph

898 Commits

Author SHA1 Message Date
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
Scott Lamb
fbb5e6b266 upgrade typescript and msw 2023-01-11 20:55:38 -08:00
Scott Lamb
f827c0647a npm update 2023-01-11 20:46:59 -08:00
Scott Lamb
9060dbfe14 adjust supported node versions 2023-01-11 19:38:47 -08:00
Scott Lamb
50fa5ce6fe update moonfire-nvr.toml desc in build.md 2023-01-11 19:35:37 -08:00
Scott Lamb
6ed23e90e8 improve docker cross-compilation
* support cross-compiling an x86-64 target on an arm64 host. This
  it turns out is a matter of *removing* an unnecessary dependency.
  (aarch64-linux-gnu-pkg-config exists but x86_64-linux-gnu-pkg-config
  doesn't. Turns out neither is necessary.) Added a comment explaining
  where ${gcc_target}-pkg-config comes from now.
* documentation tweaks
* improve debug output a bit
2023-01-11 19:35:37 -08:00
Scott Lamb
58e19265ef use react-hook-form-mui for AddEditDialog too 2023-01-11 14:54:18 -08:00
Scott Lamb
dc9c62e8bb react-hook-form-mui in ChangePassword 2023-01-09 17:16:05 -08:00
Scott Lamb
2667dd68cb CI/build improvements
- use cache restore keys so that there's some caching even after deps
  change
- don't install ffmpeg stuff that hasn't been needed in a while
2023-01-08 04:08:08 -06:00
Scott Lamb
dac0f44ed8 user admin UI 2023-01-08 03:30:53 -06:00
Scott Lamb
8c4e69f772 user admin api improvements 2023-01-08 03:21:42 -06:00
Scott Lamb
5248ebc51f improve error msg on config file problems 2023-01-06 14:28:42 -06:00
Scott Lamb
a4bc7f5218 config file reference and doc reorganization 2023-01-06 14:25:13 -06:00
Scott Lamb
abcb26b281 update some config file refs in secure.md 2023-01-06 06:49:11 -06:00
Scott Lamb
e0940979e4 upgrade nix, tungstenite deps 2023-01-05 20:18:57 -06:00
Scott Lamb
689765ea97 upgrade Rust deps 2023-01-05 17:43:45 -06:00
Scott Lamb
cc34a1aef5 Retina 0.4.4 2023-01-05 16:38:13 -06:00
Scott Lamb
7fe2284cec fix docker build (untested)
Forgot to update a symlink command in cdfb61f.
I'm not able to test this right now because my build machine is down,
but this fix should work.
2023-01-05 12:45:30 -06:00
Scott Lamb
dfa949815b tweaks to api and docs
In particular, the docs now talk about the CSRF protection. This is
increasing relevant as we start having more mutation endpoints. And
make the signals api expect a csrf for session auth to match the newer
users api.
2023-01-05 12:21:35 -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
a6bdf0bd80 change password dialog in UI 2022-12-27 23:28:42 -05:00
Scott Lamb
88d7165c3e correct and more robust update privilege check 2022-12-26 00:55:05 -05:00
Scott Lamb
163eaa4cf9 support username properly in POST /api/users/:id
I mistakenly left this out. Also, fix the behavior if something is
forgotten. Before, it'd silently ignore it. Now, it correctly returns
Unimplemented, in both POST /api/users/:id and PUT /api/users.
2022-12-25 23:01:17 -05:00
Scott Lamb
6c90077ff1 make PUT requests actually work 2022-12-25 23:01:17 -05:00
Scott Lamb
c02fc6f439 more user admin actions 2022-12-25 23:01:17 -05:00
Scott Lamb
3ab30a318f add GET /users/ endpoint 2022-12-25 23:01:17 -05:00
Scott Lamb
dffec68b2f retrieve and set users' permissions 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
918bb05d40 update @types/node 2022-10-03 21:18:49 -07:00
Scott Lamb
96e6cbfd5f update typescript and msw
No problems seen so far.

msw version 0.46.0 is advertised as supporting ts v4.8, so I updated
them together, even though tests seemed to pass without the msw update.
2022-10-03 21:15:28 -07:00
Scott Lamb
d509d3ff40 update @mui/lab
This is now only used for LoadingButton.
2022-10-03 20:55:10 -07:00
Scott Lamb
1ad14007a5 ui: update date pickers 2022-10-03 20:51:39 -07:00