git ssb

0+

Matt McKegg / ssb-backlinks



Commit a0803c887394176602811abef6db8f2823ad8c12

use latest normalizeChannel from ssb-ref in index

Matt McKegg committed on 12/12/2017, 9:50:20 PM
Parent: 63473326fe541d972b5ba754532fa7fd7aa7d1db

Files changed

emit-links.jschanged
index.jschanged
package.jsonchanged
emit-links.jsView
@@ -8,17 +8,20 @@
88 function emitLinks (msg, emit) {
99 var links = new Set()
1010 walk(msg.value.content, function (path, value) {
1111 // 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 + }
1417 }
1518
1619 // TODO: should add channel matching to ref.type
1720 if (ref.type(value)) {
1821 links.add(value)
1922 } else if (isChannel(value)) {
20- links.add(ref.normalizeChannel(value))
23 + links.add(`#${ref.normalizeChannel(value.slice(1))}`)
2124 }
2225 })
2326 links.forEach(link => {
2427 emit(extend(msg, {
index.jsView
@@ -8,9 +8,9 @@
88 { key: 'DTA', value: [['dest'], ['rts']] }, // asserted timestamp
99 { key: 'TDT', value: [['value', 'content', 'type'], ['dest'], ['rts']] }
1010 ]
1111
12-var indexVersion = 6
12 +var indexVersion = 7
1313
1414 exports.name = 'backlinks'
1515 exports.version = require('./package.json').version
1616 exports.manifest = {
package.jsonView
@@ -15,9 +15,9 @@
1515 "map-filter-reduce": "^3.0.3",
1616 "pull-flatmap": "0.0.1",
1717 "pull-stream": "^3.6.0",
1818 "ssb-keys": "^7.0.9",
19- "ssb-ref": "^2.8.0",
19 + "ssb-ref": "^2.9.0",
2020 "xtend": "^4.0.1"
2121 },
2222 "devDependencies": {},
2323 "scripts": {},

Built with git-ssb-web