Commit Graph

979 Commits

Author SHA1 Message Date
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
Scott Lamb
4a7f22723c Merge branch 'master' into new-schema 2021-10-21 12:26:31 -07:00
Scott Lamb
7b0099fb4e use typed errors in /view.mp4 path
This fixes #178. Before, everything got translated to 5xx status;
now it produces the correct type in several cases.

Ideally I'd get rid of the untyped errors in all of web.rs; this is
a small step.
2021-10-21 10:31:54 -07:00
Scott Lamb
97bfe0afc3 fix nvr init error message on mkdir failure
Before it would produce this incorrect message that told you to run
the command you just ran:

```
$ nvr init --db-dir=/nonexistent/db
E20211021 09:08:23.798 main moonfire_nvr] Exiting due to error: db dir /nonexistent/db not found; try running moonfire-nvr init
caused by: ENOENT: No such file or directory
```

Now the same command produces the following:

```
$ nvr init --db-dir=/nonexistent/db
E20211021 09:09:11.056 main moonfire_nvr] Exiting due to error: unable to create db dir /nonexistent/db
caused by: ENOENT: No such file or directory
```

Add tests just for good measure.
2021-10-21 09:44:27 -07:00
Scott Lamb
9c708ec557 cargo update, rusqlite major version bump 2021-10-20 18:09:16 -07:00
Scott Lamb
f9d33cd446 continue CI if nightly fails
It seems to be failing spuriously now, eg:
https://github.com/scottlamb/moonfire-nvr/runs/3957348093?check_suite_focus=true

```
error[E0277]: the trait bound `dyn view_trait::View: view_trait::View` is not satisfied
  --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive_core-0.2.2/src/views/list_view.rs:98:14
   |
98 |         view.take_focus(direction::Direction::none());
   |              ^^^^^^^^^^ the trait `view_trait::View` is not implemented for `dyn view_trait::View`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `cursive_core` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
Error: Process completed with exit code 101.
```
2021-10-20 15:12:56 -07:00
Scott Lamb
985f6e675f prepare v0.6.7 w/ Retina v0.3.3
This improves authentication over RTSP.
2021-10-20 14:59:33 -07:00
Scott Lamb
ad35a1ca5e UNTESTED: note trailing zeros in /recordings reply 2021-10-20 14:55:06 -07:00
Scott Lamb
ecbe86153d improve API docs, including caveats and bugs
For #178
2021-10-20 14:55:06 -07:00
Scott Lamb
6671c3791f fix example URI to match grammar
Fixes #177
2021-10-09 08:13:17 -07:00
Scott Lamb
52ec6403d6 add svg mime type mapping, sort mappings 2021-10-02 08:31:04 -07:00
Scott Lamb
8da5c4aa56 update various Rust deps 2021-10-02 08:31:04 -07:00
John Poole
19a9324649 Update build.md
change directory step between server and ui builds.
2021-09-29 20:32:17 -07:00
clydebarrow
166fb5f733 Documentation updates 2021-09-29 20:31:56 -07:00
Scott Lamb
095417bb20 Retina 0.3.2, better TEARDOWNs 2021-09-29 05:56:20 -07:00
Scott Lamb
74b9f36a75 upgrade to @mui v5 release
This requires a bunch of package name changes. See
[https://mui.com/blog/material-ui-is-now-mui/] for their rationale.
[https://mui.com/guides/migration-v4/] lists the changes:

```
@material-ui/core -> @mui/material
@material-ui/system -> @mui/system
@material-ui/unstyled -> @mui/core
@material-ui/styles -> @mui/styles
@material-ui/icons -> @mui/icons-material
@material-ui/lab -> @mui/lab
@material-ui/types -> @mui/types
@material-ui/styled-engine -> @mui/styled-engine
@material-ui/styled-engine-sc ->@mui/styled-engine-sc
@material-ui/private-theming -> @mui/private-theming
@material-ui/codemod -> @mui/codemod
@material-ui/docs -> @mui/docs
@material-ui/envinfo -> @mui/envinfo
```

We only use a few of these.
2021-09-24 10:57:29 -07:00
Scott Lamb
82102c0d17 trim whitespace from /etc/timezone 2021-09-24 10:49:04 -07:00
Scott Lamb
0c0c0692f3 prepare version 0.6.6 2021-09-23 20:02:31 -07:00
Scott Lamb
19faa0f028 changelog tweak 2021-09-23 18:16:39 -07:00
Scott Lamb
b41a6c43da shutdown better
After a frustrating search for a suitable channel to use for shutdown
(tokio::sync::Receiver and
futures::future::Shared<tokio::sync::oneshot::Receiver> didn't look
quite right) in which I rethought my life decisions, I finally just made
my own (server/base/shutdown.rs). We can easily poll it or wait for it
in async or sync contexts. Most importantly, it's convenient; not that
it really matters here, but it's also efficient.

We now do a slightly better job of propagating a "graceful" shutdown
signal, and this channel will give us tools to improve it over time.

* Shut down even when writer or syncer operations are stuck. Fixes #117
* Not done yet: streamers should instantly shut down without waiting for
  a connection attempt or frame or something. I'll probably
  implement that when removing --rtsp-library=ffmpeg. The code should be
  cleaner then.
* Not done yet: fix a couple places that sleep for up to a second when
  they could shut down immediately. I just need to do the plumbing for
  mock clocks to work.

I also implemented an immediate shutdown mode, activated by a second
signal. I think this will mitigate the streamer wait situation.
2021-09-23 16:33:29 -07:00
Scott Lamb
66f76079c0 improve error when db and dir meta don't match
I saw this recently while working on new-schema. It was probably due
to some manual upgrade or downgrade I did rather than an actual bug.
Improve debuggability a little nonetheless.
2021-09-22 12:39:02 -07:00
Scott Lamb
f7aa71d2af record boot uuid on open
This can be used to match up with eg `journalctl --list-boots` for
debugging.
2021-09-22 12:35:17 -07:00
Scott Lamb
901ba121a2 include suspended time in monotonic timestamps 2021-09-16 18:21:27 -07:00
Scott Lamb
f86f03cf59 end reason for recording runs
Part of #155
2021-09-16 16:24:17 -07:00
John Poole
156d3dde9d Update build.md
See Issue #163
2021-09-16 16:18:56 -07:00
Scott Lamb
dafd9041d6 json-based config for cameras and streams
for #155

The config interface code for changing cameras is quite messy but
seems to work for now.
2021-09-16 16:13:41 -07:00
John Poole
de7c93bdfa Update time.md
flagged "ppm" to indicate it is defined in the glossary
2021-09-13 17:00:43 -07:00
John Poole
a6bcb82341 Update glossary.md
Defining ppm and giving example of how it is relevent
2021-09-13 17:00:20 -07:00
Scott Lamb
92f594ef58 handle stale RTSP sessions
* upgrade to Retina 0.3.1 which automatically tears down sessions
* wait out stale sessions before reconnecting
* wait for teardown to complete before shutting down

This adds some pressure on #117: it will keep waiting for the stale
session to expire even if the user has requested shutdown. I'll try
to address that next.
2021-09-09 22:10:45 -07:00
Scott Lamb
070400095d simplify UI preferences change logic
I copied the example of the password field by introducing a setter.
But I forgot: it was only that way because the password field has
the complexity of hashing/salting. For fields where setting is
idempotent, it can be directly exposed.
2021-09-01 21:17:44 -07:00
Scott Lamb
c42314edb5 UI preferences: #153 #155 2021-09-01 15:08:09 -07:00
Scott Lamb
33b3b669df start schema version 7 (#155)
This isn't yet any different than schema version 6.
2021-08-31 21:03:52 -07:00
Scott Lamb
981a91c425 add changelog entry for #157 2021-08-31 16:44:53 -07:00
Scott Lamb
7e5bc42646 improve init segment fetch error msg
Fixes #146, in combination with earlier commit 4892ed7.
2021-08-31 16:41:43 -07:00
Scott Lamb
d2c7b62771 fix #157: problem with live multi-camera selection
When you select the first camera in the drop-down on a grid square
that isn't the top left, then select a camera in the top-left, it
behaves strangely.

The root cause is that I had a dumb mistake in how I assigned React
keys. I used the camera index when a camera is selected, and the
inverse of the selected index when one is. But 0 == -0!
2021-08-31 16:20:24 -07:00
dependabot[bot]
0a38044b02 Bump tar from 6.1.0 to 6.1.11 in /ui
Bumps [tar](https://github.com/npm/node-tar) from 6.1.0 to 6.1.11.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v6.1.0...v6.1.11)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-31 15:17:30 -07:00
Scott Lamb
d53450dd3b bump versions of blake3, nom, tokio-tungstenite 2021-08-31 13:05:10 -07:00
Scott Lamb
806d7b6d20 cargo update 2021-08-31 12:59:39 -07:00
Scott Lamb
30d5807dd3 include ids in api responses for debugging 2021-08-31 12:05:03 -07:00
Scott Lamb
3de605be6c improve some log msgs' readability 2021-08-31 08:59:33 -07:00
Scott Lamb
78bafb01f6 support udp with retina or ffmpeg 2021-08-31 08:11:18 -07:00
Scott Lamb
7ed02bd112 improve install guide wording (see #151) 2021-08-26 09:49:43 -07:00
Scott Lamb
71e5248c6b fix tests broken with 95dec97 2021-08-23 15:58:12 -07:00
Scott Lamb
95dec9791c config: validate more in cameras dialog box
Fixes #152

This won't win any awards for best UI or cleanest UI code, but it's an
improvement. Long-term I want the web config UI instead.
2021-08-23 15:55:47 -07:00
Scott Lamb
30cea5cfcb several documentation improvements
*   prefix docker/nvr commands with sudo (fixes #142).
    I was just going to link to the docker documentation on setting
    up non-root access, but that's kind of a personal preference.
    I included a `<details>` about it instead and made all the commands
    work with sudo.

*   take better advantage of github markdown's code block syntax
    highlighting. Use "console" for shell session stuff, put the
    "nvr" wrapper script in its own block with "bash".

*   add some comments to nvr wrapper script where people need to
    make changes and/or will be confused.

*   add a `<details>` that talks about shutting down and restarting
    the session around `nvr config` (see #151). Still not user-friendly
    but at least it's better documented now.
2021-08-23 12:44:48 -07:00