consolidate dumpactivity
This commit is contained in:
parent
b83c9bca14
commit
87104be774
16
activity.go
16
activity.go
|
@ -585,10 +585,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
||||||
what = "event"
|
what = "event"
|
||||||
default:
|
default:
|
||||||
log.Printf("unknown activity: %s", what)
|
log.Printf("unknown activity: %s", what)
|
||||||
fd, _ := os.OpenFile("savedinbox.json", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
|
dumpactivity(item)
|
||||||
item.Write(fd)
|
|
||||||
io.WriteString(fd, "\n")
|
|
||||||
fd.Close()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -904,6 +901,17 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
||||||
return xonkxonkfn(item, origin)
|
return xonkxonkfn(item, origin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func dumpactivity(item junk.Junk) {
|
||||||
|
fd, err := os.OpenFile("savedinbox.json", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("error opening inbox! %s", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer fd.Close()
|
||||||
|
item.Write(fd)
|
||||||
|
io.WriteString(fd, "\n")
|
||||||
|
}
|
||||||
|
|
||||||
func rubadubdub(user *WhatAbout, req junk.Junk) {
|
func rubadubdub(user *WhatAbout, req junk.Junk) {
|
||||||
xid, _ := req.GetString("id")
|
xid, _ := req.GetString("id")
|
||||||
actor, _ := req.GetString("actor")
|
actor, _ := req.GetString("actor")
|
||||||
|
|
9
web.go
9
web.go
|
@ -422,11 +422,7 @@ func inbox(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Printf("unknown Update activity")
|
log.Printf("unknown Update activity")
|
||||||
fd, _ := os.OpenFile("savedinbox.json", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
|
dumpactivity(j)
|
||||||
j.Write(fd)
|
|
||||||
io.WriteString(fd, "\n")
|
|
||||||
fd.Close()
|
|
||||||
|
|
||||||
case "Undo":
|
case "Undo":
|
||||||
obj, ok := j.GetMap("object")
|
obj, ok := j.GetMap("object")
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -553,6 +549,9 @@ func serverinbox(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Printf("error updating honker: %s", err)
|
log.Printf("error updating honker: %s", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
log.Printf("unhandled server activity: %s", what)
|
||||||
|
dumpactivity(j)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue