openvibers/openvibe.live Commits
agent.json: what an id in a Live address is and where it goes (AGT-4) (#598)
Changes
@@@ -14,5 +14,11 @@ module.exports = {policy: {auth: ['none', 'Network OIDC'],rateLimit: '900 GET/HEAD API requests a minute per address, 180 writes; sign-in and registration attempts are limited to 20 per 15 minutes',++ // What an id in a page's address is, and where it goes (AGT-4; server/web/page-status.js, video-handover.js).++ stableIds: [++ { kind: 'channel', url: 'https://openvibe.live/@{username}', id: 'the streamer\'s OpenVibe username (never a bare /{username}); a renamed channel\'s old name answers 301 to the current one', gone: 'a name no one has answers 404' },++ { kind: 'recording', url: 'https://openvibe.live/vod/{id}', id: 'OpenVibe.Media\'s recording id; answers 301 to its watch page, https://openvibe.video/v/{id}, whose manifest has the rule' },++ { kind: 'clip', url: 'https://openvibe.live/clip/{id}', id: 'OpenVibe.Media\'s clip id; answers 301 to https://openvibe.video/c/{id}' },++ ],},};nnew file mode 100644@@@ -0,0 +1,23 @@++'use strict';++// AGT-4: agent.json says what an id in a Live address is and where it goes, as the routes really behave.++const assert = require('assert');++const fs = require('fs');++const path = require('path');++const { agentManifest } = require('openvibe-shared/agent-layer');++++const m = agentManifest(require('../server/agent-descriptor'));++const ids = m.policy.stableIds;++assert.deepStrictEqual(ids.map((x) => [x.kind, x.url]), [++ ['channel', 'https://openvibe.live/@{username}'],++ ['recording', 'https://openvibe.live/vod/{id}'],++ ['clip', 'https://openvibe.live/clip/{id}'],++]);++// The claims are the routes': a renamed channel's old name 301s to the current one, and a numeric VOD or clip id 301s++// to OpenVibe.Video's watch page.++const status = fs.readFileSync(path.join(__dirname, '..', 'server', 'web', 'page-status.js'), 'utf8');++assert.match(status, /a renamed one's old name\s*\n\s*\*\s+answers 301 → \/@current/);++assert.match(status, /\/vod\/:id\s+\/clip\/:id\s+a numeric id 301s to OpenVibe\.Video/);++const { videoUrl } = require('../server/web/video-url');++assert.strictEqual(videoUrl('vod', 12), 'https://openvibe.video/v/12');++assert.strictEqual(videoUrl('clip', 12), 'https://openvibe.video/c/12');++console.log('agent stable ids: ok');
@@ -14,5 +14,11 @@ module.exports = {
@@ -14,5 +14,11 @@ module.exports = {
policy: {
policy: {
auth: ['none', 'Network OIDC'],
auth: ['none', 'Network OIDC'],
rateLimit: '900 GET/HEAD API requests a minute per address, 180 writes; sign-in and registration attempts are limited to 20 per 15 minutes',
rateLimit: '900 GET/HEAD API requests a minute per address, 180 writes; sign-in and registration attempts are limited to 20 per 15 minutes',
+ // What an id in a page's address is, and where it goes (AGT-4; server/web/page-status.js, video-handover.js).
+ stableIds: [
+ { kind: 'channel', url: 'https://openvibe.live/@{username}', id: 'the streamer\'s OpenVibe username (never a bare /{username}); a renamed channel\'s old name answers 301 to the current one', gone: 'a name no one has answers 404' },
+ { kind: 'recording', url: 'https://openvibe.live/vod/{id}', id: 'OpenVibe.Media\'s recording id; answers 301 to its watch page, https://openvibe.video/v/{id}, whose manifest has the rule' },
+ { kind: 'clip', url: 'https://openvibe.live/clip/{id}', id: 'OpenVibe.Media\'s clip id; answers 301 to https://openvibe.video/c/{id}' },
+ ],
},
},
};
};
new file mode 100644
new file mode 100644
@@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
+'use strict';
+// AGT-4: agent.json says what an id in a Live address is and where it goes, as the routes really behave.
+const assert = require('assert');
+const fs = require('fs');
+const path = require('path');
+const { agentManifest } = require('openvibe-shared/agent-layer');
+
+const m = agentManifest(require('../server/agent-descriptor'));
+const ids = m.policy.stableIds;
+assert.deepStrictEqual(ids.map((x) => [x.kind, x.url]), [
+ ['channel', 'https://openvibe.live/@{username}'],
+ ['recording', 'https://openvibe.live/vod/{id}'],
+ ['clip', 'https://openvibe.live/clip/{id}'],
+]);
+// The claims are the routes': a renamed channel's old name 301s to the current one, and a numeric VOD or clip id 301s
+// to OpenVibe.Video's watch page.
+const status = fs.readFileSync(path.join(__dirname, '..', 'server', 'web', 'page-status.js'), 'utf8');
+assert.match(status, /a renamed one's old name\s*\n\s*\*\s+answers 301 → \/@current/);
+assert.match(status, /\/vod\/:id\s+\/clip\/:id\s+a numeric id 301s to OpenVibe\.Video/);
+const { videoUrl } = require('../server/web/video-url');
+assert.strictEqual(videoUrl('vod', 12), 'https://openvibe.video/v/12');
+assert.strictEqual(videoUrl('clip', 12), 'https://openvibe.video/c/12');
+console.log('agent stable ids: ok');