Commit Graph

161 Commits

Author SHA1 Message Date
Scott Lamb
6ca9f451c2 update retina to 0.3.7
Notably, this includes scottlamb/retina#50, which fixes a panic
parsing the DESCRIBE response sent by some cameras. Should improve #192.
2022-01-28 22:49:41 -08:00
Greg V
64142b7684 Do not check for video codec by checking SDP video parameters
Since retina now supports in-band parameters, we should only check the media type for this.
2022-01-28 22:48:27 -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
0406e09ca4 reduce debug output in release/bench builds
This reduces the binary size from 154 MiB to 70 MiB (#70 progress).
Tools like `cargo flamegraph` still work fine.

As suggested by "EarthFeet" on reddit:
https://www.reddit.com/r/rust/comments/rw0jad/cargos_strip_profile_option_has_been_stabilized/hra193k/
2022-01-05 10:28:32 -08:00
Scott Lamb
9b241c80dc update retina and http-serve deps
* new retina notably fixes #184
* new http-serve removes an accidental debug print on stdout
2021-12-29 22:16:21 -08:00
Scott Lamb
5c7263b1bd include ext stream in API response; better docs
In particular, the docs now explicitly call out that API changes can
happen at any version, and from 0.7.0 onward they're described in
the changelog.
2021-11-23 13:04:02 -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
af9c8bb05a remove obsolete CameraConfig
Since 0.7.0, the one in the db package is used both for actual storage
within the database and for API use. I left the API-specific version
around by accident.
2021-11-23 09:56:05 -08:00
Scott Lamb
a7c574eb43 extract_cookie should check all Cookie headers 2021-10-28 15:09:02 -07:00
Scott Lamb
1e17a53280 separate out signals API to own file 2021-10-28 14:09:30 -07:00
Scott Lamb
1f41a27cc3 extract /api/{login,logout} to their own file 2021-10-28 13:57:32 -07:00
Scott Lamb
bae45a0855 move /view.{mp4,m4s} to their own file 2021-10-28 13:23:49 -07:00
Scott Lamb
87f9736d80 separate live view into its own file 2021-10-28 13:07:39 -07:00
Scott Lamb
cf08c95a4b split static file serving into its own file 2021-10-28 12:49:50 -07:00
Scott Lamb
4231ec45ce start splitting up web.rs
It's getting huge and hard to work with. The path stuff is easy to pull
out.
2021-10-28 12:38:29 -07: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
973d2fbfe2 use newer cargo version resolver
This trims ~700KiB off moonfire-nvr's text section, much of it by
eliminating h2. See #70.
2021-10-27 13:19:37 -07:00
Scott Lamb
4aab6baebb add server version to /api response
Fixes #171
2021-10-27 13:09:20 -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
a899ba0290 upgrade cursive
This gets rid of a couple redundant dependency versions like ahash.
2021-10-27 10:25:39 -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
884c3333cc always use smallvec unions
They only require Rust 1.51, and our minimum is 1.52 now.
2021-10-27 08:05:07 -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
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
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
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
Scott Lamb
095417bb20 Retina 0.3.2, better TEARDOWNs 2021-09-29 05:56:20 -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
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