feat(meditate): the operator's library on the server, and a course's lessons done synced

An operator's folder (MEDITATE_LIBRARY_DIR) of recordings, pictures and a
YAML manifest, library.yaml (commented sample: library.example.yaml), read
as the server starts and every ten minutes, held in memory. Items without
a licence or credit, files outside the folder, unknown categories and
courses pointing at items not served are refused and logged; a manifest
that doesn't read keeps the library served before. bin/check_library.dart
checks a folder before deploying.

The catalogue goes to signed-in people alone (LibraryEndpoint), with a
12-hour access the server signs; the web server's /library/<served name>
serves the files to that access only, by ranges (relic's StaticHandler).
No request path reaches the file system.

lesson_done: a lesson done, sealed and synced, a row each; the migration
creates the table with its spaceId index and the cascading foreign key to
the sync engine's spaces, as dream's did. ADR 0038, D16.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-03 15:36:11 +01:00
commit 929974443d
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -52,8 +52,8 @@ void main() {
});
test(
'deleting a person deletes their space with every key, sitting, dream and '
"their settings in it, and nobody else's",
'deleting a person deletes their space with every key, sitting, dream, '
"lesson done and their settings in it, and nobody else's",
() async {
for (final person in [alice, bob]) {
await _sittingOf(session, person);
@ -100,7 +100,13 @@ void main() {
final _syncDatabases = Expando<OfflineSyncDatabase>();
/// Every synced table of Meditate's.
const _tables = ['content_key', 'sitting', 'meditate_settings', 'dream'];
const _tables = [
'content_key',
'sitting',
'meditate_settings',
'dream',
'lesson_done',
];
/// A key, a sitting, the settings and a dream in [person]'s personal space,
/// written as their device would through the sync engine (payloads stand in
@ -132,4 +138,9 @@ Future<void> _sittingOf(Session session, UuidValue person) =>
Dream(keyId: 'meditate1.0.key', payload: sealed, nonce: sealed),
transaction: transaction,
);
await LessonDone.db.insertRow(
session,
LessonDone(keyId: 'meditate1.0.key', payload: sealed, nonce: sealed),
transaction: transaction,
);
});