Write on the margins of the internet. Powered by the AT Protocol.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix OG and profile not respecting the user's external links preferences

scanash00 a383627d 213bd4eb

+19 -51
+9 -49
backend/internal/api/og.go
··· 1039 1039 drawText(img, source, padding, yPos+32, textSecondary, 24, false) 1040 1040 1041 1041 if logoImage != nil { 1042 - logoSize := 36 1043 - drawScaledImage(img, logoImage, width-padding-logoSize, height-80, logoSize, logoSize) 1044 - drawText(img, "margin.at", width-padding-logoSize-120, height-52, textSecondary, 22, true) 1042 + logoSize := 32 1043 + drawScaledImage(img, logoImage, width-padding-logoSize, height-90, logoSize, logoSize) 1045 1044 } 1046 1045 1047 1046 return img ··· 1188 1187 iconY := 120 1189 1188 var iconWidth int 1190 1189 if icon != "" { 1191 - emojiImg := fetchTwemojiImage(icon) 1192 - if emojiImg != nil { 1193 - iconSize := 96 1194 - drawScaledImage(img, emojiImg, padding, iconY, iconSize, iconSize) 1195 - iconWidth = iconSize + 32 1196 - } else { 1197 - drawText(img, icon, padding, iconY+70, textPrimary, 80, true) 1198 - iconWidth = 100 1199 - } 1190 + // Render emoji using the fallback font directly 1191 + drawText(img, icon, padding, iconY+70, textPrimary, 80, true) 1192 + iconWidth = 100 1200 1193 } 1201 1194 1202 1195 drawText(img, collectionName, padding+iconWidth, iconY+65, textPrimary, 64, true) ··· 1237 1230 drawText(img, author, handleX, avatarY+42, textTertiary, 28, false) 1238 1231 1239 1232 if logoImage != nil { 1240 - logoSize := 36 1241 - drawScaledImage(img, logoImage, width-padding-logoSize, height-80, logoSize, logoSize) 1242 - drawText(img, "margin.at", width-padding-logoSize-120, height-52, textSecondary, 22, true) 1243 - } 1244 - 1245 - return img 1246 - } 1247 - 1248 - func fetchTwemojiImage(emoji string) image.Image { 1249 - var codes []string 1250 - for _, r := range emoji { 1251 - codes = append(codes, fmt.Sprintf("%x", r)) 1252 - } 1253 - hexCode := strings.Join(codes, "-") 1254 - 1255 - url := fmt.Sprintf("https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/72x72/%s.png", hexCode) 1256 - 1257 - resp, err := http.Get(url) 1258 - if err != nil || resp.StatusCode != 200 { 1259 - if strings.Contains(hexCode, "-fe0f") { 1260 - simpleHex := strings.ReplaceAll(hexCode, "-fe0f", "") 1261 - url = fmt.Sprintf("https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/72x72/%s.png", simpleHex) 1262 - resp, err = http.Get(url) 1263 - if err != nil || resp.StatusCode != 200 { 1264 - return nil 1265 - } 1266 - } else { 1267 - return nil 1268 - } 1233 + logoSize := 32 1234 + drawScaledImage(img, logoImage, width-padding-logoSize, height-90, logoSize, logoSize) 1269 1235 } 1270 - defer resp.Body.Close() 1271 1236 1272 - img, _, err := image.Decode(resp.Body) 1273 - if err != nil { 1274 - return nil 1275 - } 1276 1237 return img 1277 1238 } 1278 1239 ··· 1360 1321 } 1361 1322 1362 1323 if logoImage != nil { 1363 - logoSize := 36 1364 - drawScaledImage(img, logoImage, width-padding-logoSize, height-80, logoSize, logoSize) 1365 - drawText(img, "margin.at", width-padding-logoSize-120, height-52, textSecondary, 22, true) 1324 + logoSize := 32 1325 + drawScaledImage(img, logoImage, width-padding-logoSize, height-90, logoSize, logoSize) 1366 1326 } 1367 1327 1368 1328 return img
+10 -2
web/src/views/profile/Profile.tsx
··· 583 583 ? link 584 584 : `https://${link}`; 585 585 try { 586 + const prefs = $preferences.get(); 587 + if (prefs.disableExternalLinkWarning) { 588 + window.open( 589 + fullUrl, 590 + "_blank", 591 + "noopener,noreferrer", 592 + ); 593 + return; 594 + } 586 595 const hostname = new URL(fullUrl).hostname; 587 - const skipped = 588 - $preferences.get().externalLinkSkippedHostnames; 596 + const skipped = prefs.externalLinkSkippedHostnames; 589 597 if (skipped.includes(hostname)) { 590 598 window.open( 591 599 fullUrl,