Toot title is less important (h3), decode url query for tag, use account handle instead of username

This commit is contained in:
Romain de Laage 2021-03-04 09:27:50 +01:00
parent 8aad570ab4
commit ce86ff0386
Signed by: rdelaage
GPG Key ID: 534845FADDF0C329
3 changed files with 13 additions and 2 deletions

View File

@ -38,7 +38,7 @@ type Config struct {
type Account struct { type Account struct {
Id string `json:"id"` Id string `json:"id"`
DisplayName string `json:"display_name"` DisplayName string `json:"display_name"`
Name string `json:"username"` Name string `json:"acct"`
Url string `json:"url"` Url string `json:"url"`
} }

View File

@ -292,6 +292,17 @@ func printTag(conn *tls.Conn, baseURL, tag string) {
return return
} }
//decode tag (url encoded char like space)
tag, err = url.QueryUnescape(tag)
if err != nil {
_, err = fmt.Fprintf(conn, "59 Invalid url encoded tag\r\n")
if err != nil {
log.Println("handleConn: %s", err)
return
}
return
}
// Print header // Print header
_, err = fmt.Fprintf(conn, "20 text/gemini\r\n# Toots for %s\n", tag) _, err = fmt.Fprintf(conn, "20 text/gemini\r\n# Toots for %s\n", tag)
if err != nil { if err != nil {

View File

@ -99,5 +99,5 @@ func formatBlog(toot Blog) string {
author = toot.Author.DisplayName author = toot.Author.DisplayName
} }
return "## Written by " + author + " on " + toot.Date[0:10] + " at " + toot.Date[11:16] + "\n" + content return "### Written by " + author + " on " + toot.Date[0:10] + " at " + toot.Date[11:16] + "\n" + content
} }