Commit Graph

140 Commits

Author SHA1 Message Date
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
Scott Lamb f86f03cf59 end reason for recording runs
Part of #155
2021-09-16 16:24:17 -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
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 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 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 a16bda8fb1 use retina v0.2.0 2021-08-20 16:52:58 -07:00
Scott Lamb f904ba7a79 allow specifying username with empty password
Reolink cameras ship with username "admin", password "", so this is
necessary to use them fresh out of the box.
2021-08-20 09:45:58 -07:00
Scott Lamb 4892ed77d1 update http-serve to fix erroneous 304
This mostly affects .mp4 init segments (#146), which currently set the
Last-Modified: date to the epoch. It could also affect other resources
(static files, other .mp4 changes) but only if the clock has gone
backwards.
2021-08-19 21:30:47 -07:00
Scott Lamb 5c3c61838f improve Reolink interoperability with new Retina
Attempt at #114 and #144. Let's see how much it helps.
2021-08-19 15:06:20 -07:00
Scott Lamb 6270cc0ee4 adjust minimum SQLite version
"without rowid" was introduced in 3.8.2, not 3.14.0. The latter
was just "without rowid" virtual tables, a more obscure feature.
2021-08-19 10:59:38 -07:00
Scott Lamb 4e77a26410 document and check minimum SQLite version
Fixes #147
2021-08-19 10:08:53 -07:00
Scott Lamb dd4a901adb bump etag format version when headers change
I forgot to do this in 27395ec resulting in #146. Bump the version now,
and update the digest used in the tests so they will remind me to
bump the version any time the headers change.
2021-08-19 09:51:09 -07:00
Scott Lamb 711071f003 prepare version 0.6.5 2021-08-13 12:08:19 -07:00