Commit a0803c887394176602811abef6db8f2823ad8c12
use latest normalizeChannel from ssb-ref in index
Matt McKegg committed on 12/12/2017, 9:50:20 PMParent: 63473326fe541d972b5ba754532fa7fd7aa7d1db
Files changed
emit-links.js | changed |
index.js | changed |
package.json | changed |
emit-links.js | ||
---|---|---|
@@ -8,17 +8,20 @@ | ||
8 | 8 … | function emitLinks (msg, emit) { |
9 | 9 … | var links = new Set() |
10 | 10 … | walk(msg.value.content, function (path, value) { |
11 | 11 … | // HACK: handle legacy channel mentions |
12 | - if (deepEqual(path, ['channel']) && typeof value === 'string' && value.length < 30) { | |
13 | - value = `#${ref.normalizeChannel(value)}` | |
12 … | + if (deepEqual(path, ['channel'])) { | |
13 … | + var channel = ref.normalizeChannel(value) | |
14 … | + if (channel) { | |
15 … | + value = `#${channel}` | |
16 … | + } | |
14 | 17 … | } |
15 | 18 … | |
16 | 19 … | // TODO: should add channel matching to ref.type |
17 | 20 … | if (ref.type(value)) { |
18 | 21 … | links.add(value) |
19 | 22 … | } else if (isChannel(value)) { |
20 | - links.add(ref.normalizeChannel(value)) | |
23 … | + links.add(`#${ref.normalizeChannel(value.slice(1))}`) | |
21 | 24 … | } |
22 | 25 … | }) |
23 | 26 … | links.forEach(link => { |
24 | 27 … | emit(extend(msg, { |
index.js | ||
---|---|---|
@@ -8,9 +8,9 @@ | ||
8 | 8 … | { key: 'DTA', value: [['dest'], ['rts']] }, // asserted timestamp |
9 | 9 … | { key: 'TDT', value: [['value', 'content', 'type'], ['dest'], ['rts']] } |
10 | 10 … | ] |
11 | 11 … | |
12 | -var indexVersion = 6 | |
12 … | +var indexVersion = 7 | |
13 | 13 … | |
14 | 14 … | exports.name = 'backlinks' |
15 | 15 … | exports.version = require('./package.json').version |
16 | 16 … | exports.manifest = { |
Built with git-ssb-web