aboutsummaryrefslogtreecommitdiff
path: root/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'renderer')
-rw-r--r--renderer/model.go36
-rw-r--r--renderer/renderer.go16
2 files changed, 38 insertions, 14 deletions
diff --git a/renderer/model.go b/renderer/model.go
index e7cfbfb..f3e7d5d 100644
--- a/renderer/model.go
+++ b/renderer/model.go
@@ -49,17 +49,18 @@ type SigninData struct {
}
type RootData struct {
- Title string
+ *CommonData
}
type TimelineData struct {
*CommonData
- Title string
- Type string
- Instance string
- Statuses []*mastodon.Status
- NextLink string
- PrevLink string
+ Title string
+ Type string
+ Q string
+ Statuses []*mastodon.Status
+ NextLink string
+ PrevLink string
+ RefreshLink string
}
type ListsData struct {
@@ -99,12 +100,11 @@ type NotificationData struct {
type UserData struct {
*CommonData
- User *mastodon.Account
- IsCurrent bool
- Type string
- Users []*mastodon.Account
- Statuses []*mastodon.Status
- NextLink string
+ User *mastodon.Account
+ Type string
+ Users []*mastodon.Account
+ Statuses []*mastodon.Status
+ NextLink string
}
type UserSearchData struct {
@@ -155,3 +155,13 @@ type FiltersData struct {
*CommonData
Filters []*mastodon.Filter
}
+
+type ProfileData struct {
+ *CommonData
+ User *mastodon.Account
+}
+
+type MuteData struct {
+ *CommonData
+ User *mastodon.Account
+}
diff --git a/renderer/renderer.go b/renderer/renderer.go
index 7afeb14..e97fee4 100644
--- a/renderer/renderer.go
+++ b/renderer/renderer.go
@@ -33,6 +33,8 @@ const (
SearchPage = "search.tmpl"
SettingsPage = "settings.tmpl"
FiltersPage = "filters.tmpl"
+ ProfilePage = "profile.tmpl"
+ MutePage = "mute.tmpl"
)
type TemplateData struct {
@@ -41,7 +43,7 @@ type TemplateData struct {
}
func emojiHTML(e mastodon.Emoji, height string) string {
- return `<img class="emoji" src="` + e.URL + `" alt=":` + e.ShortCode + `:" title=":` + e.ShortCode + `:" height="` + height + `"/>`
+ return `<img class="emoji" src="` + e.URL + `" alt=":` + e.ShortCode + `:" title=":` + e.ShortCode + `:" height="` + height + `">`
}
func emojiFilter(content string, emojis []mastodon.Emoji) string {
@@ -66,6 +68,17 @@ func statusContentFilter(content string, emojis []mastodon.Emoji, mentions []mas
return strings.NewReplacer(replacements...).Replace(content)
}
+func getQuote(s *mastodon.Status) *mastodon.Status {
+ if s.Pleroma.Quote == nil || !s.Pleroma.QuoteVisible {
+ return nil
+ }
+ q := s.Pleroma.Quote
+ q.RetweetedByID = s.ID
+ // Disable nested quotes
+ q.Pleroma.QuoteVisible = false
+ return q
+}
+
func displayInteractionCount(c int64) string {
if c > 0 {
return strconv.Itoa(int(c))
@@ -143,6 +156,7 @@ func NewRenderer(templateGlobPattern string) (r *renderer, err error) {
t, err = t.Funcs(template.FuncMap{
"EmojiFilter": emojiFilter,
"StatusContentFilter": statusContentFilter,
+ "GetQuote": getQuote,
"DisplayInteractionCount": displayInteractionCount,
"TimeSince": timeSince,
"TimeUntil": timeUntil,