robin*
Builds for 1 pipeline failed in 0 seconds

클플 헤더로 ip 수정

......@@ -24,6 +24,6 @@ app.post('/board/:bid', async(req, res) => {
res.status(404).send('그런 판은 우리에게 있을 수 없어.');
}
let thread = await db.get('thread').insert({board: board._id, title: req.body.title, content: req.body.content, lastUpdated: Date.now(), count: 1});
await db.get('thread').update(thread._id, {$set: {writer: hash(thread._id, req.get('x-real-ip') || req.ip)}});
await db.get('thread').update(thread._id, {$set: {writer: hash(thread._id, req.get('CF-Connecting-IP') || req.ip)}});
res.redirect('/thread/' + thread._id);
});
......
......@@ -22,7 +22,7 @@ module.exports = {
});
socket.on('write', async(content) => {
console.log(`write ${content}`);
let subthread = await db.get('subthread').insert({parent: thread._id, writer: hash(thread._id, socket.handshake.headers['x-real-ip'] || socket.handshake.address), content, no: ++thread.count});
let subthread = await db.get('subthread').insert({parent: thread._id, writer: hash(thread._id, socket.handshake.headers['cf-connecting-ip'] || socket.handshake.address), content, no: ++thread.count});
db.get('thread').update(thread._id, {$set: {count: thread.count, lastUpdated: Date.now()}});
io.to(`thread-${thread._id}`).emit('thread', subthread);
console.log(`broadcast thread-${thread._id}`);
......