git ssb

16+

cel / patchfoo



Commit 946379b16a68ffd636d8fed3925367cfa8e2e6f6

Render some dark-crystal stuff

cel committed on 8/18/2018, 6:13:21 PM
Parent: 2e87d6f2847b51ee3828ea6fe18df2ebaf4957d3

Files changed

lib/app.jschanged
lib/render-msg.jschanged
lib/serve.jschanged
lib/app.jsView
@@ -1018,4 +1018,17 @@
10181018 values: true
10191019 })
10201020 ])
10211021 }
1022 +
1023 +App.prototype.getShard = function (id, cb) {
1024 + var self = this
1025 + this.getMsgDecrypted(id, function (err, msg) {
1026 + if (err) return cb(new Error('Unable to get shard message: ' + err.stack))
1027 + var c = msg.value.content || {}
1028 + if (!c.shard) return cb(new Error('Message missing shard: ' + id))
1029 + self.unboxContent(c.shard, function (err, shard) {
1030 + if (err) return cb(new Error('Unable to decrypt shard: ' + err.stack))
1031 + cb(null, shard)
1032 + })
1033 + })
1034 +}
lib/render-msg.jsView
@@ -305,8 +305,10 @@
305305 case 'scat_message': return this.scat(cb)
306306 case 'share': return this.share(cb)
307307 case 'tag': return this.tag(cb)
308308 case 'edit': return this.edit(cb)
309 + case 'dark-crystal/shard': return this.shard(cb)
310 + case 'invite': return this.invite(cb)
309311 default: return this.object(cb)
310312 }
311313 }
312314
@@ -1915,4 +1917,32 @@
19151917 cb(null, (self.c.tagged ? 'tagged ' : 'untagged ')
19161918 + msgName + ' as ' + rootName)
19171919 })
19181920 }
1921 +
1922 +RenderMsg.prototype.shard = function (cb) {
1923 + // this.c.errors
1924 + // this.c.version
1925 + var self = this
1926 + self.link(self.c.root, function (err, rootLink) {
1927 + self.wrap(h('div', [
1928 + h('div', h('small', h('span.symbol', '  ↳'), ' dark-crystal ', rootLink || '?')),
1929 + h('p', [
1930 + h('a', {
1931 + href: self.toUrl('/shard/' + encodeURIComponent(self.msg.key)),
1932 + title: 'view shard'
1933 + }, 'shard')
1934 + ])
1935 + ]), cb)
1936 + })
1937 +}
1938 +
1939 +RenderMsg.prototype.invite = function (cb) {
1940 + // this.c.version
1941 + var self = this
1942 + self.link(self.c.root, function (err, rootLink) {
1943 + self.wrap(h('div', [
1944 + h('div', h('small', h('span.symbol', '  ↳'), ' ', rootLink || '?')),
1945 + self.c.body ? h('div', {innerHTML: self.render.markdown(self.c.body)}) : '',
1946 + ]), cb)
1947 + })
1948 +}
lib/serve.jsView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 106373 bytes
New file size: 107010 bytes

Built with git-ssb-web