forked from wgroeneveld/go-jamming
parent
92252f8bc9
commit
4c2326b887
|
@ -233,20 +233,25 @@ type MfType string
|
|||
const (
|
||||
TypeLink MfType = "link"
|
||||
TypeReply MfType = "reply"
|
||||
TypeRepost MfType = "repost"
|
||||
TypeLike MfType = "like"
|
||||
TypeBookmark MfType = "bookmark"
|
||||
TypeMention MfType = "mention"
|
||||
)
|
||||
|
||||
func Type(hEntry *microformats.Microformat) MfType {
|
||||
likeOf := Str(hEntry, "like-of")
|
||||
if likeOf != "" {
|
||||
hType := Str(hEntry, "like-of")
|
||||
if hType != "" {
|
||||
return TypeLike
|
||||
}
|
||||
bookmarkOf := Str(hEntry, "bookmark-of")
|
||||
if bookmarkOf != "" {
|
||||
hType = Str(hEntry, "bookmark-of")
|
||||
if hType != "" {
|
||||
return TypeBookmark
|
||||
}
|
||||
hType = Str(hEntry, "repost-of")
|
||||
if hType != "" {
|
||||
return TypeRepost
|
||||
}
|
||||
return TypeMention
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ func TestReceive(t *testing.T) {
|
|||
json: `{"author":{"name":"Jamie Tanna","picture":"/pictures/brainbaking.com"},"name":"","content":"Recommended read:\nThe IndieWeb Mixed Bag - Thoughts about the (d)evolution of blog interactions\nhttps://brainbaking.com/post/2021/03/the-indieweb-mixed-bag/","published":"2021-03-15T12:42:00+00:00","url":"https://brainbaking.com/mf2/2021/03/1bkre/","type":"bookmark","source":"https://brainbaking.com/valid-bridgy-twitter-source.html","target":"https://brainbaking.com/post/2021/03/the-indieweb-mixed-bag"}`,
|
||||
},
|
||||
{
|
||||
label: "receive a brid.gy Webmention like",
|
||||
label: "receive a brid.gy (Mastodon) Webmention like",
|
||||
wm: mf.Mention{
|
||||
Source: "https://brainbaking.com/valid-bridgy-like.html",
|
||||
// wrapped in a a class="u-like-of" tag
|
||||
|
@ -155,7 +155,17 @@ func TestReceive(t *testing.T) {
|
|||
json: `{"author":{"name":"Stampeding Longhorn","picture":"/pictures/brainbaking.com"},"name":"","content":"","published":"2020-01-01T12:30:00+00:00","url":"https://chat.brainbaking.com/notice/A4nx1rFwKUJYSe4TqK#favorited-by-A4nwg4LYyh4WgrJOXg","type":"like","source":"https://brainbaking.com/valid-bridgy-like.html","target":"https://brainbaking.com/valid-indieweb-target.html"}`,
|
||||
},
|
||||
{
|
||||
label: "receive a brid.gy Webmention that has a url and photo without value",
|
||||
label: "receive a brid.gy (Twitter) Webmention repost",
|
||||
wm: mf.Mention{
|
||||
Source: "https://brainbaking.com/valid-bridgy-twitter-repost.html",
|
||||
// wrapped in a a class="u-like-of" tag
|
||||
Target: "https://brainbaking.com/valid-indieweb-target.html",
|
||||
},
|
||||
// no dates in bridgy-to-mastodon likes...
|
||||
json: `{"author":{"name":"cartocalypse.tif","picture":"/pictures/brainbaking.com"},"name":"My quest in creating a Google Maps clone\n\n chringel.dev/2022/06/creati…","content":"My quest in creating a Google Maps clone\n\n chringel.dev/2022/06/creati…","published":"2022-06-21T06:23:53+00:00","url":"https://twitter.com/cartocalypse/status/1539131976879308800","type":"repost","source":"https://brainbaking.com/valid-bridgy-twitter-repost.html","target":"https://brainbaking.com/valid-indieweb-target.html"}`,
|
||||
},
|
||||
{
|
||||
label: "receive a brid.gy (Mastodon) Webmention that has a url and photo without value",
|
||||
wm: mf.Mention{
|
||||
Source: "https://brainbaking.com/valid-bridgy-source.html",
|
||||
Target: "https://brainbaking.com/valid-indieweb-target.html",
|
||||
|
@ -201,6 +211,7 @@ func TestReceive(t *testing.T) {
|
|||
RestClient: &mocks.RestClientMock{
|
||||
GetBodyFunc: mocks.RelPathGetBodyFunc("../../../mocks/"),
|
||||
},
|
||||
Notifier: ¬ifier.StringNotifier{},
|
||||
}
|
||||
|
||||
receiver.Receive(tc.wm)
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="refresh" content="0;url=https://twitter.com/cartocalypse/status/1539131976879308800">
|
||||
<title>My quest in creating a Google Maps clone
|
||||
|
||||
chringel.dev/2022/06/creati…</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
display: none;
|
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
.p-uid {
|
||||
display: none;
|
||||
}
|
||||
.u-photo {
|
||||
max-width: 50px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.e-content {
|
||||
margin-top: 10px;
|
||||
font-size: 1.3em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<article class="h-entry">
|
||||
<span class="p-uid">tag:twitter.com,2013:1539131976879308800</span>
|
||||
|
||||
<time class="dt-published" datetime="2022-06-21T06:23:53+00:00">2022-06-21T06:23:53+00:00</time>
|
||||
|
||||
<span class="p-author h-card">
|
||||
<data class="p-uid" value="tag:twitter.com,2013:cartocalypse"></data>
|
||||
<data class="p-numeric-id" value="1710706561"></data>
|
||||
<a class="p-name u-url" href="https://twitter.com/cartocalypse">cartocalypse.tif</a>
|
||||
<a class="u-url" href="https://hannes.enjoys.it/blog/"></a>
|
||||
<a class="u-url" href="https://m.youtube.com/watch?v=MEBK3ZUn0c4"></a>
|
||||
<span class="p-nickname">cartocalypse</span>
|
||||
<img class="u-photo" src="https://brainbaking.com/picture.jpg" alt="" />
|
||||
</span>
|
||||
|
||||
<a class="u-url" href="https://twitter.com/cartocalypse/status/1539131976879308800">https://twitter.com/cartocalypse/status/1539131976879308800</a>
|
||||
<div class="e-content p-name">
|
||||
|
||||
<div style="white-space: pre">My quest in creating a Google Maps clone
|
||||
|
||||
chringel.dev/2022/06/creati…</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a class="u-repost-of" href="https://twitter.com/DeEgge/status/1538902082698231808"></a>
|
||||
<a class="u-repost-of" href="https://brainbaking.com/valid-indieweb-target.html"></a>
|
||||
|
||||
</article>
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue