Archived
1
0

Merge branch 'master' of ssh://github.com/majestrate/nntpchan

This commit is contained in:
Jeff Becker 2019-01-29 06:50:38 -05:00
commit bcddab9af6
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
3 changed files with 22 additions and 27 deletions

View File

@ -903,21 +903,21 @@ func (self *NNTPDaemon) processMessage(msgid string) {
if self.expire != nil { if self.expire != nil {
// expire posts // expire posts
log.Println("expire", group, "for", rollover, "threads") log.Println("expire", group, "for", rollover, "threads")
self.expire.ExpireGroup(group, rollover) go self.expire.ExpireGroup(group, rollover)
} }
// send to mod panel // send to mod panel
if group == "ctl" { if group == "ctl" {
log.Println("process mod message", msgid) log.Println("process mod message", msgid)
self.mod.HandleMessage(msgid) go self.mod.HandleMessage(msgid)
} }
// inform callback hooks // inform callback hooks
go self.informHooks(group, msgid, ref) go self.informHooks(group, msgid, ref)
// federate // federate
self.sendAllFeeds(ArticleEntry{msgid, group}) go self.sendAllFeeds(ArticleEntry{msgid, group})
// send to frontend // send to frontend
if self.frontend != nil { if self.frontend != nil {
if self.frontend.AllowNewsgroup(group) { if self.frontend.AllowNewsgroup(group) {
self.frontend.HandleNewPost(frontendPost{msgid, ref, group}) go self.frontend.HandleNewPost(frontendPost{msgid, ref, group})
} }
} }
} }

View File

@ -125,7 +125,7 @@ func (lc *liveChan) SendBanned() {
msg, _ := json.Marshal(map[string]string{ msg, _ := json.Marshal(map[string]string{
"Type": "ban", "Type": "ban",
// TODO: real ban message // 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 { if lc.datachnl != nil {
lc.datachnl <- msg lc.datachnl <- msg
@ -324,10 +324,10 @@ func (self *httpFrontend) poll_liveui() {
th := threads[c-idx-1] th := threads[c-idx-1]
th.Update(self.daemon.database) th.Update(self.daemon.database)
// send root post // send root post
live.Inform(th.OP()) go live.Inform(th.OP())
// send replies // send replies
for _, post := range th.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 { if len(ref) > 0 {
msgid = ref msgid = ref
} }
entry := ArticleEntry{msgid, group} go func() {
// regnerate thread entry := ArticleEntry{msgid, group}
self.Regen(entry) // regnerate thread
// regenerate all board pages if not archiving self.Regen(entry)
if !self.archive { // regenerate all board pages if not archiving
self.RegenerateBoard(group) if !self.archive {
} self.RegenerateBoard(group)
// regen front page }
self.RegenFrontPage() // regen front page
self.RegenFrontPage()
}()
} }
// create a new captcha, return as json object // create a new captcha, return as json object

View File

@ -138,9 +138,9 @@ func createArticleStore(config map[string]string, thumbConfig *ThumbnailConfig,
compression: config["compression"] == "1", compression: config["compression"] == "1",
spamd: spamd, spamd: spamd,
spamdir: filepath.Join(config["store_dir"], "spam"), spamdir: filepath.Join(config["store_dir"], "spam"),
hamdir: filepath.Join(config["store_dir"], "ham"), hamdir: filepath.Join(config["store_dir"], "ham"),
thumbnails: thumbConfig, thumbnails: thumbConfig,
} }
store.Init() store.Init()
return store return store
@ -591,21 +591,14 @@ func (self *articleStore) GetMessage(msgid string) (nntp NNTPMessage) {
br := bufio.NewReader(r) br := bufio.NewReader(r)
msg, err := readMIMEHeader(br) msg, err := readMIMEHeader(br)
if err == nil { if err == nil {
chnl := make(chan NNTPMessage)
hdr := textproto.MIMEHeader(msg.Header) hdr := textproto.MIMEHeader(msg.Header)
err = read_message_body(msg.Body, hdr, nil, nil, true, func(n NNTPMessage) { err = read_message_body(msg.Body, hdr, nil, nil, true, func(n NNTPMessage) {
c := chnl
if n != nil { if n != nil {
// inject pubkey for mod // inject pubkey for mod
n.Headers().Set("X-PubKey-Ed25519", hdr.Get("X-PubKey-Ed25519")) 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 return