Add raw JSON view
This commit is contained in:
parent
8dcdc58043
commit
84d5d1810c
2
index.js
2
index.js
|
@ -12,6 +12,7 @@ const author = require('./routes/author')
|
|||
const hashtag = require('./routes/hashtag')
|
||||
const home = require('./routes/home')
|
||||
const profile = require('./routes/profile')
|
||||
const raw = require('./routes/raw')
|
||||
const thread = require('./routes/thread')
|
||||
|
||||
const assets = new Koa()
|
||||
|
@ -37,6 +38,7 @@ router
|
|||
.get('/hashtag/:id', hashtag)
|
||||
.get('/profile/', profile)
|
||||
.get('/thread/:id', thread)
|
||||
.get('/raw/:id', raw)
|
||||
|
||||
app.use(router.routes())
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ h1, h2, h3, h4, h5, h6 {
|
|||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
.message pre {
|
||||
pre {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,6 @@ nav a {
|
|||
border-radius: 2px;
|
||||
}
|
||||
|
||||
|
||||
ul {
|
||||
padding-left: 1rem;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
const cooler = require('../lib/cooler')
|
||||
|
||||
module.exports = async function thread (ctx) {
|
||||
const ssb = await cooler.connect()
|
||||
const rawMsg = await cooler.get(ssb.get, {
|
||||
id: ctx.params.id,
|
||||
meta: true,
|
||||
private: true
|
||||
})
|
||||
|
||||
ctx.body = rawMsg
|
||||
}
|
|
@ -38,5 +38,6 @@
|
|||
<% } %>
|
||||
<% } %>
|
||||
|
||||
<a href="/raw/<%= encodeURIComponent(msg.value.content.root) %>">raw</a>
|
||||
</footer>
|
||||
</section>
|
||||
|
|
Loading…
Reference in New Issue