Compare commits
No commits in common. "05d82767adab8fd95805198bb28be985caafbc77" and "8b0c3eb9632d05523c6b210fa6102ebdfd858a25" have entirely different histories.
05d82767ad
...
8b0c3eb963
2
Makefile
2
Makefile
@ -39,7 +39,7 @@ docker-publish:
|
|||||||
|
|
||||||
.PHONY: run # Run the application
|
.PHONY: run # Run the application
|
||||||
run:
|
run:
|
||||||
@go run main.go
|
@go run main.go@npm start
|
||||||
|
|
||||||
.PHONY: ci # Perform CI specific tasks to perform on a pull request
|
.PHONY: ci # Perform CI specific tasks to perform on a pull request
|
||||||
ci:
|
ci:
|
||||||
|
9
main.go
9
main.go
@ -75,16 +75,19 @@ func getTweet(w http.ResponseWriter, r *http.Request) {
|
|||||||
for _, emoji := range emojis {
|
for _, emoji := range emojis {
|
||||||
emojiCount += len([]byte(emoji)) - 1
|
emojiCount += len([]byte(emoji)) - 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println(tweet.FullText)
|
||||||
|
|
||||||
tweet.FullText = tweet.FullText[tweet.DisplayTextRange[0] : tweet.DisplayTextRange[1]+emojiCount]
|
tweet.FullText = tweet.FullText[tweet.DisplayTextRange[0] : tweet.DisplayTextRange[1]+emojiCount]
|
||||||
|
|
||||||
for _, user := range tweet.Entities.User_mentions {
|
for _, user := range tweet.Entities.User_mentions {
|
||||||
tweet.FullText = strings.ReplaceAll(tweet.FullText, "@"+user.Screen_name, fmt.Sprintf("<a rel=\"noopener\" target=\"_blank\" href=\"https://twitter.com/%s/\">@%s</a>", user.Screen_name, user.Screen_name))
|
tweet.FullText = strings.ReplaceAll(tweet.FullText, "@"+user.Screen_name, fmt.Sprintf("<a href=\"https://twitter.com/%s/\">@%s</a>", user.Screen_name, user.Screen_name))
|
||||||
}
|
}
|
||||||
for _, url := range tweet.Entities.Urls {
|
for _, url := range tweet.Entities.Urls {
|
||||||
tweet.FullText = strings.ReplaceAll(tweet.FullText, url.Url, fmt.Sprintf("<a rel=\"noopener\" target=\"_blank\" href=\"https://twitter.com/%s/\">%s</a>", url.Expanded_url, url.Display_url))
|
tweet.FullText = strings.ReplaceAll(tweet.FullText, url.Url, fmt.Sprintf("<a href=\"https://twitter.com/%s/\">%s</a>", url.Expanded_url, url.Display_url))
|
||||||
}
|
}
|
||||||
for _, hashtag := range tweet.Entities.Hashtags {
|
for _, hashtag := range tweet.Entities.Hashtags {
|
||||||
tweet.FullText = strings.ReplaceAll(tweet.FullText, "#"+hashtag.Text, fmt.Sprintf("<a rel=\"noopener\" target=\"_blank\" href=\"https://twitter.com/hashtag/%s\">#%s</a>", hashtag.Text, hashtag.Text))
|
tweet.FullText = strings.ReplaceAll(tweet.FullText, "#"+hashtag.Text, fmt.Sprintf("<a href=\"https://twitter.com/hashtag/%s\">#%s</a>", hashtag.Text, hashtag.Text))
|
||||||
}
|
}
|
||||||
|
|
||||||
templateFuncs := template.FuncMap{
|
templateFuncs := template.FuncMap{
|
||||||
|
@ -16,14 +16,14 @@
|
|||||||
.tweetsvg.reply{font-size:15px;color:rgb(110, 118, 125);}
|
.tweetsvg.reply{font-size:15px;color:rgb(110, 118, 125);}
|
||||||
</style>
|
</style>
|
||||||
<blockquote class="tweetsvg" xmlns="http://www.w3.org/1999/xhtml">
|
<blockquote class="tweetsvg" xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<a rel="noopener" target="_blank" class="tweetsvg" href="https://twitter.com/{{ .User.ScreenName }}/"><img class="avatar-tweetsvg" alt="" src="data:image/jpeg;base64,{{ base64 .User.ProfileImageUrlHttps }}" /></a>
|
<a class="tweetsvg" href="https://twitter.com/{{ .User.ScreenName }}/"><img class="avatar-tweetsvg" alt="" src="data:image/jpeg;base64,{{ base64 .User.ProfileImageUrlHttps }}" /></a>
|
||||||
|
|
||||||
<a rel="noopener" target="_blank" class="tweetsvg" href="https://twitter.com/{{ .User.ScreenName }}/"><h1 class="tweetsvg">{{ .User.Name }}</h1></a>
|
<a class="tweetsvg" href="https://twitter.com/{{ .User.ScreenName }}/"><h1 class="tweetsvg">{{ .User.Name }}</h1></a>
|
||||||
|
|
||||||
<a rel="noopener" target="_blank" class="tweetsvg" href="https://twitter.com/{{ .User.ScreenName }}/"><h2 class="tweetsvg">@{{ .User.ScreenName }}</h2></a>
|
<a class="tweetsvg" href="https://twitter.com/{{ .User.ScreenName }}/"><h2 class="tweetsvg">@{{ .User.ScreenName }}</h2></a>
|
||||||
|
|
||||||
{{ if .InReplyToScreenName }}
|
{{ if .InReplyToScreenName }}
|
||||||
<p class="tweetsvg reply">Replying to <a rel="noopener" target="_blank" href="https://twitter.com/{{ .InReplyToScreenName }}/">@{{ .InReplyToScreenName }}</a></p>
|
<p class="tweetsvg reply">Replying to <a href="https://twitter.com/{{ .InReplyToScreenName }}/">@{{ .InReplyToScreenName }}</a></p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<p class="tweetsvg text">{{ html .FullText }}</p>
|
<p class="tweetsvg text">{{ html .FullText }}</p>
|
||||||
@ -31,12 +31,12 @@
|
|||||||
{{ if .ExtendedEntities }}
|
{{ if .ExtendedEntities }}
|
||||||
{{ range .ExtendedEntities.Media }}
|
{{ range .ExtendedEntities.Media }}
|
||||||
|
|
||||||
<a rel="noopener" target="_blank" href="{{ .Media_url_https }}" target="_blank"><img class="media-tweetsvg" width="{{ .Sizes.Small.W }}" src="data:image/jpeg;base64,{{ base64 .Media_url }}" alt="{{ .ExtAltText }}"/></a>
|
<a href="{{ .Media_url_https }}" target="_blank"><img class="media-tweetsvg" width="{{ .Sizes.Small.W }}" src="data:image/jpeg;base64,{{ base64 .Media_url }}" alt="{{ .ExtAltText }}"/></a>
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<a rel="noopener" target="_blank" class="tweetsvg" href="https://twitter.com/{{ .User.ScreenName }}/status/{{ .Id }}">
|
<a class="tweetsvg" href="https://twitter.com/{{ .User.ScreenName }}/status/{{ .Id }}">
|
||||||
<time class="tweetsvg" datetime="{{ isoDate .CreatedAt }}">{{ humanDate .CreatedAt }}</time>
|
<time class="tweetsvg" datetime="{{ isoDate .CreatedAt }}">{{ humanDate .CreatedAt }}</time>
|
||||||
</a>
|
</a>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.5 KiB |
Loading…
Reference in New Issue
Block a user