Skip to content

Commit c40db7c

Browse files
committed
fix: some things with display urls
1 parent f035aa1 commit c40db7c

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

bridge/bridge.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ type Media struct {
163163
// Sizes map[string]MediaSize `json:"sizes"`
164164
Type string `json:"type" xml:"type"`
165165
Indices []int `json:"indices,omitempty" xml:"-"`
166-
Start int `xml:"start"`
167-
End int `xml:"end"`
168-
StartAttr int `xml:"start,attr"`
169-
EndAttr int `xml:"end,attr"`
166+
Start int `xml:"start" json:"-"`
167+
End int `xml:"end" json:"-"`
168+
StartAttr int `xml:"start,attr" json:"-"`
169+
EndAttr int `xml:"end,attr" json:"-"`
170170
}
171171

172172
type Entities struct {

config/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ func LoadConfig() (*Config, error) {
4949
viper.SetDefault("TRACK_ANALYTICS", true)
5050
viper.SetDefault("CDN_URL", "http://localhost:3000")
5151
viper.SetDefault("USE_X_FORWARDED_FOR", false)
52-
viper.SetDefault("IMG_DISPLAY_TEXT", "pic.twitter.com/{shortblob}")
52+
//viper.SetDefault("IMG_DISPLAY_TEXT", "pic.twitter.com/{shortblob}")
53+
// Since IMG_DISPLAY_TEXT isn't fully implemented, we'll have it disabled
54+
viper.SetDefault("IMG_DISPLAY_TEXT", "")
5355
viper.SetDefault("VID_DISPLAY_TEXT", "pic.twitter.com/{shortblob}")
5456

5557
// Read config file

twitterv1/post_viewing.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ func TranslatePostToTweet(tweet blueskyapi.Post, replyMsgBskyURI string, replyUs
302302
// Add the image "url" to the text
303303
startLen, endLen := 0, 0
304304
displayURL := configData.ImgDisplayText
305+
mediaWebURL := ""
305306
if displayURL != "" {
306307
displayURL = strings.ReplaceAll(displayURL, "{shortblob}", image.Image.Ref.Link[len(image.Image.Ref.Link)-6:])
307308
displayURL = strings.ReplaceAll(displayURL, "{fullblob}", image.Image.Ref.Link)
@@ -317,6 +318,7 @@ func TranslatePostToTweet(tweet blueskyapi.Post, replyMsgBskyURI string, replyUs
317318

318319
processedText = processedText + " " + displayURL
319320
}
321+
mediaWebURL = configData.CdnURL + "/cdn/img/bsky/" + tweet.Author.DID + "/" + image.Image.Ref.Link + ".jpg"
320322
}
321323

322324
// Process each image
@@ -330,8 +332,8 @@ func TranslatePostToTweet(tweet blueskyapi.Post, replyMsgBskyURI string, replyUs
330332
DisplayURL: displayURL,
331333
//ExpandedURL: displayURL,
332334
//URL: displayURL,
333-
ExpandedURL: configData.CdnURL + "/cdn/img/bsky/" + tweet.Author.DID + "/" + image.Image.Ref.Link + ".jpg",
334-
URL: configData.CdnURL + "/cdn/img/bsky/" + tweet.Author.DID + "/" + image.Image.Ref.Link + ".jpg",
335+
ExpandedURL: mediaWebURL,
336+
URL: mediaWebURL,
335337

336338
Sizes: bridge.MediaSize{
337339
Thumb: func() bridge.Size {

0 commit comments

Comments
 (0)