Archived
1
0

Merge pull request #1 from majestrate/master

rebase
This commit is contained in:
ZiRo- 2016-02-25 20:02:06 +01:00
commit 22a3564f22
6 changed files with 59 additions and 10 deletions

View File

@ -234,10 +234,6 @@ a, a:visited {
margin-top: 1em; margin-top: 1em;
} }
#board_graph {
margin-top: 5em;
}
.navLinks { .navLinks {
padding-bottom: 50px; padding-bottom: 50px;
} }

View File

@ -1,9 +1,9 @@
{{! {{!
frontpage.mustache -- template for index.html frontpage.mustache -- template for index.html
template parameters: template parameters:
- boardgraph ( a boardPageRows instance, see srnd/model.go ) - boardgraph ( markup of boardPageRows instance, see srnd/model.go )
- postgraph ( a postsGraph instance , see srnd/model.go ) - postgraph ( markup of postsGraph instance , see srnd/model.go )
- overview ( an overviewModel instance, see srnd/model.go ) - overview ( markup of overviewModel instance , see srnd/model.go )
- totalposts ( the number of total posts we have ever seen ) - totalposts ( the number of total posts we have ever seen )
- frontend ( the name of the frontend ) - frontend ( the name of the frontend )
- prefix ( the site's prefix ) - prefix ( the site's prefix )
@ -36,7 +36,7 @@
<tbody> <tbody>
<tr> <tr>
<td class="posts_td"> <td class="posts_td">
{{{postsgraph.Render}}} {{{postsgraph}}}
</td> </td>
<td class="board_td"> <td class="board_td">
{{! todo: move boardgraph into its own file like postsgraph }} {{! todo: move boardgraph into its own file like postsgraph }}
@ -72,7 +72,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
{{{overview.Render}}} {{{overview}}}
</div> </div>
</div> </div>
</center> </center>

View File

@ -9,6 +9,7 @@
<label for="mod_key">secret</label> <label for="mod_key">secret</label>
<input type="password" id="mod_key" name="privkey" /> <input type="password" id="mod_key" name="privkey" />
<input type="submit" value="login" /> <input type="submit" value="login" />
{{{csrfField}}}
</form> </form>
</body> </body>
</html> </html>

View File

@ -6,8 +6,10 @@
- reference ( the post we are replying to, or empty string if it's an op ) - reference ( the post we are replying to, or empty string if it's an op )
- button ( the text for the reply button ) - button ( the text for the reply button )
- files ( bool, do we allow attachments ? ) - files ( bool, do we allow attachments ? )
- csrf ( csrf token )
}} }}
<form action="{{post_url}}" enctype="multipart/form-data" name="post" method="post"> <form action="{{post_url}}" enctype="multipart/form-data" name="post" method="post">
{{{csrf}}}
<input type="hidden" name="reference" value="{{reference}}" /> <input type="hidden" name="reference" value="{{reference}}" />
<div id="postform-outer"> <div id="postform-outer">
<div id="postform-inner"> <div id="postform-inner">

View File

@ -3,7 +3,6 @@
template parameters: template parameters:
- board ( the Board Model of the board this thread was posted in ) - board ( the Board Model of the board this thread was posted in )
- thread ( the Thread Model of the current thread being rendered ) - thread ( the Thread Model of the current thread being rendered )
- form ( the post form markup )
Thread Model attributes: Thread Model attributes:
- OP , the Post Model of the original poster - OP , the Post Model of the original poster

View File

@ -0,0 +1,51 @@
var http = require('http');
var makeIpBans = function(cidrs, privkey, cb) {
cb({
message: cidrs.join("\noverchan-inet-ban "),
name: "mod#"+privkey,
frontend: "memegod.censor",
newsgroup: "ctl"
})
}
var makeDeletePosts = function(msgids, privkey, cb) {
cb({
message: msgids.join("\ndelete "),
name: "mod#"+privkey,
frontend: "memegod.censor",
newsgroup: "ctl",
})
}
var moderate = function(req) {
j = JSON.stringify(req);
var r = http.request({
port: 8800,
method: "POST",
path: "/api/post",
auth: "user:pass",
headers: {
"Content-Type": "text/json",
"Content-Length": j.length
}
}, function (res) {
res.on('data', function (chunk) {
var r = chunk.toString();
var rj = JSON.parse(r);
console.log(rj.id);
});
});
r.write(j);
r.end();
}
var privateKey = "longhexgoestripcodegoeshere";
// ban 192.168.0.1/16 and sign with private key
makeIpBans(["192.168.0.1/16"], privateKey, moderate);
// delete <msg1@place.tld> and <msg2@otherplace.tld> and sign with private key
makeDeletPosts(["<msg1@place.tld>", "<msg2@otherplace.tld>"], privateKey, moderate);