openvibers/openvibe.media Commits

The codes tenant, token-only: task screenshots, private to the person (#232)

OP OpenVibers committed 14 days ago · 8340bd83b2 · 2 files, +2 −1

Codes #188 keeps task screenshots as private objects. Like every first-party tenant since C-71, codes is created at
boot with no app key and is reached only with Codes' Network service token (Network #432 grants upload and read on it).
Quota 5 GB.

Changes

ddiff --git a/server/auth.js b/server/auth.js
iindex 78396aa..7976748 100644
---- a/server/auth.js
++++ b/server/auth.js
@@@ -211,6 +211,7 @@ async function ensureTokenOnlyApps() {
['blog', 'OpenVibe.Blog', 10, []], // Wave 16 post attachments
['inventory', 'OpenVibe.Inventory', 1, []], // Workshop badge images
['media-hub', 'OpenVibe.MediaHub', 100, []], // the OpenVibe.Download drive
++ ['codes', 'OpenVibe.Codes', 5, []], // a task's screenshots, private to the person (Codes #188, 10-30)
]) {
if (!await db.getApp(appId)) {
await db.run("INSERT INTO apps (app_id, name, api_key_hash, quota_bytes, allowed_origins) VALUES (?, ?, '', ?, ?)", [appId, name, quotaGb * 1024 ** 3, JSON.stringify(origins)]);
ddiff --git a/test/app-tenants.test.js b/test/app-tenants.test.js
iindex 81e409a..450e97c 100644
---- a/test/app-tenants.test.js
++++ b/test/app-tenants.test.js
@@@ -36,7 +36,7 @@ const crypto = require('crypto');
await auth.ensureTokenOnlyApps();
// C-71: every first-party tenant exists without seeding, and one boot created carries no app key. An existing row
// (live, written with a test key just above) is left exactly as it was.
-- for (const id of ['community', 'tools', 'games', 'wiki', 'blog', 'inventory', 'media-hub']) {
++ for (const id of ['community', 'tools', 'games', 'wiki', 'blog', 'inventory', 'media-hub', 'codes']) {
const row = await db.getApp(id);
assert.ok(row, `${id} exists without seeding`);
assert.strictEqual(row.api_key_hash, '', `${id} has no app key`);