openidec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit c99ceb5bd7e7796bd436d256c01d6677b422212e
parent bb8b43e59f7e68e90bf6933e9e4c61d8a6349874
Author: Peter Kosyh <p.kosyh@gmail.com>
Date:   Sat, 30 Jan 2021 15:04:19 +0000

Merge branch 'master' of https://github.com/gl00my/ii-go

Diffstat:
Mii-node/web.go | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/ii-node/web.go b/ii-node/web.go @@ -352,6 +352,14 @@ func Select(ctx *WebContext, q ii.Query) []string { return ctx.www.db.SelectIDS(q) } +func trunc(str string, limit int) string { + result := []rune(str) + if len(result) > limit { + return string(result[:limit]) + } + return str +} + func www_query(ctx *WebContext, w http.ResponseWriter, r *http.Request, q ii.Query, page int, rss bool) error { db := ctx.www.db req := ctx.BasePath @@ -398,6 +406,9 @@ func www_query(ctx *WebContext, w http.ResponseWriter, r *http.Request, q ii.Que for _, m := range ctx.Msg { fmt.Fprintf(w, `<item><title>%s</title><guid>%s</guid><pubDate>%s</pubDate><author>%s</author><link>%s/%s</link> + <description> + %s + </description> <content:encoded> <![CDATA[ %s @@ -407,6 +418,7 @@ func www_query(ctx *WebContext, w http.ResponseWriter, r *http.Request, q ii.Que `, str_esc(m.Subj), m.MsgId, time.Unix(m.Date, 0).Format("2006-01-02 15:04:05"), str_esc(m.From), ctx.www.Host, m.MsgId, + str_esc(trunc(m.Text, 280)), fmt.Sprintf("%s -> %s<br><br>", m.From, m.To), msg_text(m)) }