Merge branch 'master' of ssh://github.com/majestrate/nntpchan
This commit is contained in:
commit
bcddab9af6
@ -903,21 +903,21 @@ func (self *NNTPDaemon) processMessage(msgid string) {
|
||||
if self.expire != nil {
|
||||
// expire posts
|
||||
log.Println("expire", group, "for", rollover, "threads")
|
||||
self.expire.ExpireGroup(group, rollover)
|
||||
go self.expire.ExpireGroup(group, rollover)
|
||||
}
|
||||
// send to mod panel
|
||||
if group == "ctl" {
|
||||
log.Println("process mod message", msgid)
|
||||
self.mod.HandleMessage(msgid)
|
||||
go self.mod.HandleMessage(msgid)
|
||||
}
|
||||
// inform callback hooks
|
||||
go self.informHooks(group, msgid, ref)
|
||||
// federate
|
||||
self.sendAllFeeds(ArticleEntry{msgid, group})
|
||||
go self.sendAllFeeds(ArticleEntry{msgid, group})
|
||||
// send to frontend
|
||||
if self.frontend != nil {
|
||||
if self.frontend.AllowNewsgroup(group) {
|
||||
self.frontend.HandleNewPost(frontendPost{msgid, ref, group})
|
||||
go self.frontend.HandleNewPost(frontendPost{msgid, ref, group})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ func (lc *liveChan) SendBanned() {
|
||||
msg, _ := json.Marshal(map[string]string{
|
||||
"Type": "ban",
|
||||
// TODO: real ban message
|
||||
"Reason": "your an faget, your IP was: " + lc.IP,
|
||||
"Reason": "your an fagt, your IP was: " + lc.IP,
|
||||
})
|
||||
if lc.datachnl != nil {
|
||||
lc.datachnl <- msg
|
||||
@ -324,10 +324,10 @@ func (self *httpFrontend) poll_liveui() {
|
||||
th := threads[c-idx-1]
|
||||
th.Update(self.daemon.database)
|
||||
// send root post
|
||||
live.Inform(th.OP())
|
||||
go live.Inform(th.OP())
|
||||
// send replies
|
||||
for _, post := range th.Replies() {
|
||||
live.Inform(post)
|
||||
go live.Inform(post)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -392,15 +392,17 @@ func (self *httpFrontend) HandleNewPost(nntp frontendPost) {
|
||||
if len(ref) > 0 {
|
||||
msgid = ref
|
||||
}
|
||||
entry := ArticleEntry{msgid, group}
|
||||
// regnerate thread
|
||||
self.Regen(entry)
|
||||
// regenerate all board pages if not archiving
|
||||
if !self.archive {
|
||||
self.RegenerateBoard(group)
|
||||
}
|
||||
// regen front page
|
||||
self.RegenFrontPage()
|
||||
go func() {
|
||||
entry := ArticleEntry{msgid, group}
|
||||
// regnerate thread
|
||||
self.Regen(entry)
|
||||
// regenerate all board pages if not archiving
|
||||
if !self.archive {
|
||||
self.RegenerateBoard(group)
|
||||
}
|
||||
// regen front page
|
||||
self.RegenFrontPage()
|
||||
}()
|
||||
}
|
||||
|
||||
// create a new captcha, return as json object
|
||||
|
@ -138,9 +138,9 @@ func createArticleStore(config map[string]string, thumbConfig *ThumbnailConfig,
|
||||
compression: config["compression"] == "1",
|
||||
spamd: spamd,
|
||||
spamdir: filepath.Join(config["store_dir"], "spam"),
|
||||
hamdir: filepath.Join(config["store_dir"], "ham"),
|
||||
|
||||
thumbnails: thumbConfig,
|
||||
hamdir: filepath.Join(config["store_dir"], "ham"),
|
||||
|
||||
thumbnails: thumbConfig,
|
||||
}
|
||||
store.Init()
|
||||
return store
|
||||
@ -591,21 +591,14 @@ func (self *articleStore) GetMessage(msgid string) (nntp NNTPMessage) {
|
||||
br := bufio.NewReader(r)
|
||||
msg, err := readMIMEHeader(br)
|
||||
if err == nil {
|
||||
chnl := make(chan NNTPMessage)
|
||||
hdr := textproto.MIMEHeader(msg.Header)
|
||||
err = read_message_body(msg.Body, hdr, nil, nil, true, func(n NNTPMessage) {
|
||||
c := chnl
|
||||
if n != nil {
|
||||
// inject pubkey for mod
|
||||
n.Headers().Set("X-PubKey-Ed25519", hdr.Get("X-PubKey-Ed25519"))
|
||||
c <- n
|
||||
}
|
||||
nntp = n
|
||||
})
|
||||
if err == nil {
|
||||
nntp = <-chnl
|
||||
} else {
|
||||
log.Println("GetMessage() failed to load", msgid, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
|
Reference in New Issue
Block a user