all repos — honk @ 254d2ab513a185cb1457835fbd0d01e6befdb97b

my fork of honk

a few more serverURL conversions
Ted Unangst tedu@tedunangst.com
Mon, 19 Feb 2024 03:41:14 -0500
commit

254d2ab513a185cb1457835fbd0d01e6befdb97b

parent

c6eb3d0ef8d3377155150dcd5db2de2cb0baa3d3

3 files changed, 9 insertions(+), 9 deletions(-)

jump to
M avatar.goavatar.go

@@ -108,7 +108,7 @@ func avatarURL(user *WhatAbout) string {

if ava := user.Options.Avatar; ava != "" { return ava } - return fmt.Sprintf("https://%s/a?a=%s", serverName, url.QueryEscape(user.URL)) + return serverURL("/a?a=%s", url.QueryEscape(user.URL)) } func showflag(writer http.ResponseWriter, req *http.Request) {

@@ -176,7 +176,7 @@ h.Noise = re_flags.ReplaceAllStringFunc(h.Noise, func(m string) string {

count++ var e Emu e.Name = fmt.Sprintf(":flag%d:", count) - e.ID = fmt.Sprintf("https://%s/flag/%s", serverName, m[5:]) + e.ID = serverURL("/flag/%s", m[5:]) emus = append(emus, e) return e.Name })

@@ -186,7 +186,7 @@

func renderflags(h *Honk) { h.Noise = re_flags.ReplaceAllStringFunc(h.Noise, func(m string) string { code := m[5:] - src := fmt.Sprintf("https://%s/flag/%s", serverName, code) + src := serverURL("/flag/%s", code) return fmt.Sprintf(`<img class="emu" title="%s" src="%s">`, "flag", src) }) }
M fun.gofun.go

@@ -227,7 +227,7 @@ if d != nil {

zap[d.XID] = true base := "" if absolute { - base = "https://" + serverName + base = serverURL("") } return string(templates.Sprintf(`<img alt="%s" title="%s" src="%s/d/%s">`, alt, alt, base, d.XID)) }

@@ -438,7 +438,7 @@ _, err := os.Stat(dataDir + "/emus/" + fname + ext)

if err != nil { continue } - url := fmt.Sprintf("https://%s/emu/%s%s", serverName, fname, ext) + url := serverURL("/emu/%s%s", fname, ext) if develMode { url = fmt.Sprintf("/emu/%s%s", fname, ext) }

@@ -486,7 +486,7 @@ n, _ := fd.Read(peek[:])

ct := http.DetectContentType(peek[:n]) fd.Close() - url := fmt.Sprintf("https://%s/meme/%s", serverName, name) + url := serverURL("/meme/%s", name) fileid, err := savefile(name, name, url, ct, false, nil) if err != nil { elog.Printf("error saving meme: %s", err)

@@ -608,8 +608,8 @@ return fmt.Sprintf(fill, html.EscapeString(where), html.EscapeString(who))

} func ontoreplacer(h string) string { - return fmt.Sprintf(`<a class="mention hashtag" href="https://%s/o/%s">%s</a>`, serverName, - strings.ToLower(h[1:]), h) + return fmt.Sprintf(`<a class="mention hashtag" href="%s">%s</a>`, + serverURL("/o/%s", strings.ToLower(h[1:])), h) } var re_unurl = regexp.MustCompile("https://([^/]+).*/([^/]+)")
M main.gomain.go

@@ -137,7 +137,7 @@ getconfig("masqname", &masqName)

if masqName == "" { masqName = serverName } - serverPrefix = fmt.Sprintf("https://%s/", serverName) + serverPrefix = serverURL("/") getconfig("usersep", &userSep) getconfig("honksep", &honkSep) getconfig("devel", &develMode)