some cleanups
This commit is contained in:
parent
f7a6578ecb
commit
bae6e430d6
|
@ -1335,16 +1335,13 @@ func investigate(name string) (*Honker, error) {
|
||||||
if name == "" {
|
if name == "" {
|
||||||
return nil, fmt.Errorf("no name")
|
return nil, fmt.Errorf("no name")
|
||||||
}
|
}
|
||||||
log.Printf("digging up some info on %s", name)
|
|
||||||
obj, err := GetJunkFast(name)
|
obj, err := GetJunkFast(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("error investigating honker: %s", err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
t, _ := obj.GetString("type")
|
t, _ := obj.GetString("type")
|
||||||
if !isactor(t) {
|
if !isactor(t) {
|
||||||
log.Printf("it's not a person! %s", name)
|
return nil, fmt.Errorf("not a person")
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
xid, _ := obj.GetString("id")
|
xid, _ := obj.GetString("id")
|
||||||
handle, _ := obj.GetString("preferredUsername")
|
handle, _ := obj.GetString("preferredUsername")
|
||||||
|
|
7
honk.go
7
honk.go
|
@ -97,7 +97,6 @@ type Donk struct {
|
||||||
URL string
|
URL string
|
||||||
Media string
|
Media string
|
||||||
Local bool
|
Local bool
|
||||||
Content []byte
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Place struct {
|
type Place struct {
|
||||||
|
@ -136,12 +135,6 @@ type Honker struct {
|
||||||
Combos []string
|
Combos []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Zonker struct {
|
|
||||||
ID int64
|
|
||||||
Name string
|
|
||||||
Wherefore string
|
|
||||||
}
|
|
||||||
|
|
||||||
var serverName string
|
var serverName string
|
||||||
var iconName = "icon.png"
|
var iconName = "icon.png"
|
||||||
var serverMsg = "Things happen."
|
var serverMsg = "Things happen."
|
||||||
|
|
14
web.go
14
web.go
|
@ -99,6 +99,7 @@ func homepage(w http.ResponseWriter, r *http.Request) {
|
||||||
userid = u.UserID
|
userid = u.UserID
|
||||||
switch r.URL.Path {
|
switch r.URL.Path {
|
||||||
case "/atme":
|
case "/atme":
|
||||||
|
templinfo["PageName"] = "at me!"
|
||||||
templinfo["PageName"] = "atme"
|
templinfo["PageName"] = "atme"
|
||||||
honks = gethonksforme(userid)
|
honks = gethonksforme(userid)
|
||||||
case "/events":
|
case "/events":
|
||||||
|
@ -820,7 +821,7 @@ func submitbonk(w http.ResponseWriter, r *http.Request) {
|
||||||
oonker = xonk.Honker
|
oonker = xonk.Honker
|
||||||
}
|
}
|
||||||
dt := time.Now().UTC()
|
dt := time.Now().UTC()
|
||||||
bonk := Honk{
|
bonk := &Honk{
|
||||||
UserID: userinfo.UserID,
|
UserID: userinfo.UserID,
|
||||||
Username: userinfo.Username,
|
Username: userinfo.Username,
|
||||||
What: "bonk",
|
What: "bonk",
|
||||||
|
@ -837,17 +838,16 @@ func submitbonk(w http.ResponseWriter, r *http.Request) {
|
||||||
Convoy: xonk.Convoy,
|
Convoy: xonk.Convoy,
|
||||||
Audience: []string{thewholeworld, oonker},
|
Audience: []string{thewholeworld, oonker},
|
||||||
Public: true,
|
Public: true,
|
||||||
|
Format: "html",
|
||||||
}
|
}
|
||||||
|
|
||||||
bonk.Format = "html"
|
err = savehonk(bonk)
|
||||||
|
|
||||||
err = savehonk(&bonk)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("uh oh")
|
log.Printf("uh oh")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
go honkworldwide(user, &bonk)
|
go honkworldwide(user, bonk)
|
||||||
|
|
||||||
if r.FormValue("js") != "1" {
|
if r.FormValue("js") != "1" {
|
||||||
templinfo := getInfo(r)
|
templinfo := getInfo(r)
|
||||||
|
@ -860,7 +860,7 @@ func submitbonk(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendzonkofsorts(xonk *Honk, user *WhatAbout, what string) {
|
func sendzonkofsorts(xonk *Honk, user *WhatAbout, what string) {
|
||||||
zonk := Honk{
|
zonk := &Honk{
|
||||||
What: what,
|
What: what,
|
||||||
XID: xonk.XID,
|
XID: xonk.XID,
|
||||||
Date: time.Now().UTC(),
|
Date: time.Now().UTC(),
|
||||||
|
@ -869,7 +869,7 @@ func sendzonkofsorts(xonk *Honk, user *WhatAbout, what string) {
|
||||||
zonk.Public = !keepitquiet(zonk.Audience)
|
zonk.Public = !keepitquiet(zonk.Audience)
|
||||||
|
|
||||||
log.Printf("announcing %sed honk: %s", what, xonk.XID)
|
log.Printf("announcing %sed honk: %s", what, xonk.XID)
|
||||||
go honkworldwide(user, &zonk)
|
go honkworldwide(user, zonk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func zonkit(w http.ResponseWriter, r *http.Request) {
|
func zonkit(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
Loading…
Reference in New Issue