this repo has no description
1
fork

Configure Feed

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

feat: add SoundCloud embedded player support

Add SoundCloud as an OEmbed provider with auto-expanding
inline player. Fix OEmbedResponse.Version type to accept
both string and number values (SoundCloud returns a number).
Add SoundCloud fixture and preview tests.

+38 -2
+16
internal/assets/css/screen.css
··· 1386 1386 padding: 0 !important; 1387 1387 } 1388 1388 1389 + /* SoundCloud embed styles */ 1390 + [data-embed-type="soundcloud"] iframe { 1391 + max-width: 800px !important; 1392 + width: 100% !important; 1393 + height: 400px !important; 1394 + border-radius: var(--radius-lg); 1395 + display: block; 1396 + border: 1px solid var(--card-border); 1397 + box-shadow: var(--shadow-sm); 1398 + } 1399 + 1400 + .item [data-embed-type="soundcloud"] iframe { 1401 + margin: var(--space-2) 0 !important; 1402 + padding: 0 !important; 1403 + } 1404 + 1389 1405 /* TikTok embeds */ 1390 1406 blockquote[class*="tiktok"], 1391 1407 .tiktok-embed {
+2 -1
internal/handler/preview.go
··· 29 29 }{ 30 30 {`^https?://(www\.)?(youtube\.com|youtu\.be)/.+`, "https://www.youtube.com/oembed", ""}, 31 31 {`^https?://(open\.)?spotify\.com/.+`, "https://open.spotify.com/oembed", ""}, 32 + {`^https?://(www\.)?soundcloud\.com/.+`, "https://soundcloud.com/oembed", ""}, 32 33 {`^https?://(www\.)?tiktok\.com/.+`, "https://www.tiktok.com/oembed", ""}, 33 34 // {`^https?://(www\.)?reddit\.com/.+`, "https://www.reddit.com/oembed", ""}, // Use scraping for better metadata 34 35 {`^https?://(www\.)?flickr\.com/.+`, "https://www.flickr.com/services/oembed", ""}, ··· 44 45 // OEmbedResponse represents standard OEmbed keys 45 46 type OEmbedResponse struct { 46 47 Type string `json:"type"` 47 - Version string `json:"version"` 48 + Version interface{} `json:"version"` 48 49 Title string `json:"title"` 49 50 AuthorName string `json:"author_name"` 50 51 AuthorURL string `json:"author_url"`
+5
internal/templates/views/index.html
··· 108 108 defaultIcon: "https://www.redditstatic.com/desktop2x/img/favicon/favicon-32x32.png" 109 109 }, 110 110 "Spotify": { showTitle: false, showDescription: false, autoExpand: true }, 111 + "SoundCloud": { showTitle: false, showDescription: false, autoExpand: true }, 111 112 "GIPHY": { showTitle: false, showDescription: false }, 112 113 "Flickr": { clickableImage: true, forceAspect: "photo" }, 113 114 "_default": { ··· 430 431 // Determine appropriate height based on embed type 431 432 var isReddit = embedHtml.indexOf('reddit') !== -1; 432 433 var isSpotify = embedHtml.indexOf('spotify') !== -1; 434 + var isSoundCloud = embedHtml.indexOf('soundcloud') !== -1; 433 435 var isTikTok = embedHtml.indexOf('tiktok') !== -1; 434 436 435 437 // Auto-resize script for embeds that need dynamic height ··· 462 464 if (isSpotify) { 463 465 iframe.style.height = '152px'; 464 466 container.setAttribute('data-embed-type', 'spotify'); 467 + } else if (isSoundCloud) { 468 + iframe.style.height = '400px'; 469 + container.setAttribute('data-embed-type', 'soundcloud'); 465 470 } else if (isReddit) { 466 471 // Start with reasonable height, will auto-resize 467 472 iframe.style.height = '300px';
+4 -1
tests/load_fixtures.sh
··· 53 53 fi 54 54 fi 55 55 56 - TOTAL_FIXTURES=26 56 + TOTAL_FIXTURES=27 57 57 CURRENT=0 58 58 59 59 load_link() { ··· 115 115 116 116 # Spotify 117 117 load_link "music_lover" "https://open.spotify.com/episode/7makk4oTQel546B0PZlDM5" 118 + 119 + # SoundCloud 120 + load_link "dj_mix" "https://soundcloud.com/majorlazer/major-lazer-dj-snake-lean-on-feat-mo" 118 121 119 122 # TikTok 120 123 load_link "tiktok_star" "https://www.tiktok.com/@tiagogreis/video/6830059644233223429"
+11
tests/preview_test.sh
··· 111 111 # "https://www.flickr.com/photos/username/albums/123456/" \ 112 112 # '.provider_name == "Flickr" and .render_inline != "true"' 113 113 114 + # --- SOUNDCLOUD --- 115 + # Valid 116 + test_preview "SoundCloud Valid" \ 117 + "https://soundcloud.com/majorlazer/major-lazer-dj-snake-lean-on-feat-mo" \ 118 + '.provider_name == "SoundCloud" or .type == "rich"' 119 + 120 + # Invalid 121 + test_preview "SoundCloud Invalid" \ 122 + "https://soundcloud.com/nonexistent-user-xyz/nonexistent-track-abc-123" \ 123 + '.error != null or .title != null' 124 + 114 125 # --- TIKTOK --- 115 126 # Valid 116 127 test_preview "TikTok Valid" \