This commit is contained in:
parent
207fd8ecd6
commit
6ed7dc8ddb
|
@ -34,7 +34,15 @@ func simplify(itemType string, item map[string][]interface{}) map[string]interfa
|
||||||
for k, v := range item {
|
for k, v := range item {
|
||||||
if k == "bookmark-of" || k == "like-of" || k == "repost-of" || k == "in-reply-to" {
|
if k == "bookmark-of" || k == "like-of" || k == "repost-of" || k == "in-reply-to" {
|
||||||
if value, ok := v[0].(*microformats.Microformat); ok {
|
if value, ok := v[0].(*microformats.Microformat); ok {
|
||||||
feedItem[k] = value.Value
|
if value.Type[0] == "h-cite" {
|
||||||
|
refs := make(map[string]interface{})
|
||||||
|
u := value.Properties["url"][0].(string)
|
||||||
|
refs[u] = SimplifyMicroformat(value)
|
||||||
|
feedItem["refs"] = refs
|
||||||
|
feedItem[k] = u
|
||||||
|
} else {
|
||||||
|
feedItem[k] = value.Value
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
feedItem[k] = v
|
feedItem[k] = v
|
||||||
}
|
}
|
||||||
|
@ -216,6 +224,18 @@ func MapToItem(result map[string]interface{}) microsub.Item {
|
||||||
item.Checkin = MapToAuthor(checkin.(map[string]string))
|
item.Checkin = MapToAuthor(checkin.(map[string]string))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if refsValue, e := result["refs"]; e {
|
||||||
|
if refs, ok := refsValue.(map[string]interface{}); ok {
|
||||||
|
item.Refs = make(map[string]microsub.Item)
|
||||||
|
|
||||||
|
for key, ref := range refs {
|
||||||
|
refItem := MapToItem(ref.(map[string]interface{}))
|
||||||
|
refItem.Type = "entry"
|
||||||
|
item.Refs[key] = refItem
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if content, e := result["content"]; e {
|
if content, e := result["content"]; e {
|
||||||
itemContent := µsub.Content{}
|
itemContent := µsub.Content{}
|
||||||
set := false
|
set := false
|
||||||
|
|
|
@ -57,26 +57,27 @@ type Content struct {
|
||||||
|
|
||||||
// Item is a post object
|
// Item is a post object
|
||||||
type Item struct {
|
type Item struct {
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
Published string `json:"published,omitempty"`
|
Published string `json:"published,omitempty"`
|
||||||
Updated string `json:"updated,omitempty"`
|
Updated string `json:"updated,omitempty"`
|
||||||
URL string `json:"url,omitempty"`
|
URL string `json:"url,omitempty"`
|
||||||
UID string `json:"uid,omitempty"`
|
UID string `json:"uid,omitempty"`
|
||||||
Author *Card `json:"author,omitempty"`
|
Author *Card `json:"author,omitempty"`
|
||||||
Category []string `json:"category,omitempty"`
|
Category []string `json:"category,omitempty"`
|
||||||
Photo []string `json:"photo,omitempty"`
|
Photo []string `json:"photo,omitempty"`
|
||||||
LikeOf []string `json:"like-of,omitempty"`
|
LikeOf []string `json:"like-of,omitempty"`
|
||||||
BookmarkOf []string `json:"bookmark-of,omitempty"`
|
BookmarkOf []string `json:"bookmark-of,omitempty"`
|
||||||
RepostOf []string `json:"repost-of,omitempty"`
|
RepostOf []string `json:"repost-of,omitempty"`
|
||||||
InReplyTo []string `json:"in-reply-to,omitempty"`
|
InReplyTo []string `json:"in-reply-to,omitempty"`
|
||||||
Summary []string `json:"summary,omitempty"`
|
Summary []string `json:"summary,omitempty"`
|
||||||
Content *Content `json:"content,omitempty"`
|
Content *Content `json:"content,omitempty"`
|
||||||
Latitude string `json:"latitude,omitempty"`
|
Latitude string `json:"latitude,omitempty"`
|
||||||
Longitude string `json:"longitude,omitempty"`
|
Longitude string `json:"longitude,omitempty"`
|
||||||
Checkin *Card `json:"checkin,omitempty"`
|
Checkin *Card `json:"checkin,omitempty"`
|
||||||
ID string `json:"_id,omitempty"`
|
Refs map[string]Item `json:"refs,omitempty"`
|
||||||
Read bool `json:"_is_read"`
|
ID string `json:"_id,omitempty"`
|
||||||
|
Read bool `json:"_is_read"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pagination contains information about paging
|
// Pagination contains information about paging
|
||||||
|
|
Loading…
Reference in New Issue
Block a user