Commit 6e3760338297dc69b6f60760d58b197927d44110
click through to full screen images
Dominic Tarr committed on 8/16/2017, 9:55:26 PMParent: 1253a399464b2bc0274bac6368670c17c3cca16d
Files changed
app/index.js | changed |
app/page/image.js | added |
router/sync/routes.js | changed |
app/index.js | ||
---|---|---|
@@ -10,8 +10,9 @@ | ||
10 | 10 | }, |
11 | 11 | page: { |
12 | 12 | channel: require('./page/channel'), |
13 | 13 | error: require('./page/error'), |
14 | + image: require('./page/image'), | |
14 | 15 | groupFind: require('./page/groupFind'), |
15 | 16 | groupIndex: require('./page/groupIndex'), |
16 | 17 | groupNew: require('./page/groupNew'), |
17 | 18 | groupShow: require('./page/groupShow'), |
@@ -28,4 +29,5 @@ | ||
28 | 29 | |
29 | 30 | |
30 | 31 | |
31 | 32 | |
33 | + |
app/page/image.js | ||
---|---|---|
@@ -1,0 +1,34 @@ | ||
1 | +const nest = require('depnest') | |
2 | +const { h } = require('mutant') | |
3 | + | |
4 | +exports.gives = nest('app.page.image') | |
5 | + | |
6 | +exports.needs = nest({ | |
7 | + 'translations.sync.strings': 'first', | |
8 | + 'about.html.image': 'first', | |
9 | + 'about.obs.name': 'first', | |
10 | + 'app.html.thread': 'first', | |
11 | + 'blob.sync.url': 'first' | |
12 | +}) | |
13 | + | |
14 | +exports.create = (api) => { | |
15 | + var strings = api.translations.sync.strings() | |
16 | + | |
17 | + return nest('app.page.image', function (location) { | |
18 | + return h('img', {src: api.blob.sync.url(location.blob || location)}) | |
19 | + }) | |
20 | +// | |
21 | +// function threadNew (location) { | |
22 | +// return h('Page -Im', {title: "Image"}, [ | |
23 | +// blob.sync.url(location) | |
24 | +// ]) | |
25 | +// } | |
26 | +} | |
27 | + | |
28 | + | |
29 | + | |
30 | + | |
31 | + | |
32 | + | |
33 | + | |
34 | + |
router/sync/routes.js | ||
---|---|---|
@@ -1,6 +1,6 @@ | ||
1 | 1 | const nest = require('depnest') |
2 | -const { isMsg, isFeed } = require('ssb-ref') | |
2 | +const { isMsg, isFeed, isBlob } = require('ssb-ref') | |
3 | 3 | exports.gives = nest('router.sync.routes') |
4 | 4 | |
5 | 5 | exports.needs = nest({ |
6 | 6 | 'app.page.error': 'first', |
@@ -14,16 +14,18 @@ | ||
14 | 14 | 'app.page.userFind': 'first', |
15 | 15 | 'app.page.userShow': 'first', |
16 | 16 | 'app.page.threadNew': 'first', |
17 | 17 | 'app.page.threadShow': 'first', |
18 | + 'app.page.image': 'first', | |
18 | 19 | }) |
19 | 20 | |
20 | 21 | exports.create = (api) => { |
21 | 22 | return nest('router.sync.routes', (sofar = []) => { |
22 | 23 | const pages = api.app.page |
23 | 24 | // route format: [ routeValidator, routeFunction ] |
24 | 25 | |
25 | 26 | const routes = [ |
27 | + [ location => isBlob(location.blob), pages.image ], | |
26 | 28 | [ location => location.page === 'home', pages.home ], |
27 | 29 | [ location => location.channel , pages.channel ], |
28 | 30 | [ location => location.page === 'settings', pages.settings ], |
29 | 31 | |
@@ -51,12 +53,4 @@ | ||
51 | 53 | } |
52 | 54 | |
53 | 55 | |
54 | 56 | |
55 | - | |
56 | - | |
57 | - | |
58 | - | |
59 | - | |
60 | - | |
61 | - | |
62 | - |
Built with git-ssb-web