Commit 946379b16a68ffd636d8fed3925367cfa8e2e6f6
Render some dark-crystal stuff
cel committed on 8/18/2018, 6:13:21 PMParent: 2e87d6f2847b51ee3828ea6fe18df2ebaf4957d3
Files changed
lib/app.js | changed |
lib/render-msg.js | changed |
lib/serve.js | changed |
lib/app.js | ||
---|---|---|
@@ -1018,4 +1018,17 @@ | ||
1018 | 1018 … | values: true |
1019 | 1019 … | }) |
1020 | 1020 … | ]) |
1021 | 1021 … | } |
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.js | ||
---|---|---|
@@ -305,8 +305,10 @@ | ||
305 | 305 … | case 'scat_message': return this.scat(cb) |
306 | 306 … | case 'share': return this.share(cb) |
307 | 307 … | case 'tag': return this.tag(cb) |
308 | 308 … | case 'edit': return this.edit(cb) |
309 … | + case 'dark-crystal/shard': return this.shard(cb) | |
310 … | + case 'invite': return this.invite(cb) | |
309 | 311 … | default: return this.object(cb) |
310 | 312 … | } |
311 | 313 … | } |
312 | 314 … | |
@@ -1915,4 +1917,32 @@ | ||
1915 | 1917 … | cb(null, (self.c.tagged ? 'tagged ' : 'untagged ') |
1916 | 1918 … | + msgName + ' as ' + rootName) |
1917 | 1919 … | }) |
1918 | 1920 … | } |
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.js | ||
---|---|---|
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