git ssb

9+

cel / ssb-viewer



Commit 2e582bd1dc0e9a6709bc4eab94124e250aa64945

Don't linkify bad refs

cel committed on 8/24/2018, 12:41:18 AM
Parent: 9357a5e729bcc1b6addd132bf1c7a860b13364d5

Files changed

render.jschanged
render.jsView
@@ -4,8 +4,9 @@
44 var htime = require("human-time");
55 var emojis = require("emoji-named-characters");
66 var cat = require("pull-cat");
77 var h = require('hyperscript');
8 +var refs = require('ssb-ref')
89
910 var emojiDir = path.join(require.resolve("emoji-named-characters"), "../pngs");
1011
1112 exports.wrapPage = wrapPage;
@@ -30,13 +31,16 @@
3031 switch (href[0]) {
3132 case "#":
3233 return this.opts.base + "channel/" + href.slice(1);
3334 case "%":
35 + if (!refs.isMsgId(href)) return false
3436 return this.opts.msg_base + encodeURIComponent(href);
3537 case "@":
38 + if (!refs.isFeedId(href)) return false
3639 href = (this.opts.mentions && this.opts.mentions[href.substr(1)]) || href;
3740 return this.opts.feed_base + href;
3841 case "&":
42 + if (!refs.isBlobId(href)) return false
3943 return this.opts.blob_base + href;
4044 }
4145 if (href.indexOf("javascript:") === 0) return false;
4246 return href;

Built with git-ssb-web