git ssb

0+

dangerousbeans / yap



forked from Dominic / yap

Commit 0eb5dc6cf73ccf4ac6861f11d65e655eb32def0a

oops, listen on localhost only (fix security vuln, thanks @cel)

Dominic Tarr committed on 2/22/2019, 9:24:08 AM
Parent: 9f6842d31239574b9aae7935976aeef22e7a67fa

Files changed

index.jschanged
index.jsView
@@ -58,13 +58,8 @@
5858 },
5959
6060 //theme, in cookie
6161
62- //renders immediately
63-// preview: function (opts, req, cb) {
64-// cb(null, opts)
65-// },
66-
6762 publish: function (opts, req, cb) {
6863 if(opts.content.recps === '')
6964 delete opts.content.recps
7065 else if('string' === typeof opts.content.recps) {
@@ -107,36 +102,18 @@
107102 function (req, res, next) {
108103 if(req.method == 'GET') return next()
109104 var id = req.cookies.id || sbot.id
110105 var opts = req.body
111-// function callApi (path, opts) {
112-// try {
113-// var fn = nested.get(apis, path)
114-// if(!fn) return next()
115-// return fn(opts, apply, req)
116-// } catch(err) {
117-// next(err)
118-// }
119-// }
120106
121107 // handle preview specially, (to confirm a message)
122- //
123108
124109 if(opts.type === 'preview') {
125110 // TODO: pass opts.id in, and wether this message
126111 // preview should allow recipient selection, or changing id.
127112 // api.preview can set the shape of the message if it likes.
128113
129114 req.url = '/preview?'+QS.stringify(opts)
130115 return coherence(req, res, next)
131-
132- //XXX this isn't working
133-
134-// toHTML(layout.call(self, callApi(['preview'], opts))) (function (err, result) {
135-// if(err) next(err)
136-// else res.end('<!DOCTYPE html>'+result.outerHTML)
137-// })
138-// return
139116 }
140117 actions[opts.type](opts, req, function (err, _opts, context) {
141118 if(err) return next(err)
142119 if(context) {
@@ -165,10 +142,18 @@
165142 Static({
166143 root: path.join(__dirname, 'static'), baseDir: '/static'
167144 }),
168145 coherence
169- )).listen(8005)
170-})
146+ )).listen(8005, 'localhost')
171147
148+ /*
149+ generic ssb invalidation
150+ if a message links to another, invalidate the other key.
151+ (this will get threads, likes, etc)
152+ if a message links to a feed, invalidate the feed.
172153
154+ that doesn't cover follows though... but maybe that can be invalidated
155+ as one thing?
156+ */
157+})
173158
174159

Built with git-ssb-web