bring back yahoo pipes!
2
fork

Configure Feed

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

feat: use rss data view everywhere

dunkirk.sh de9e6b84 f3a90c14

verified
+55 -8
+24 -5
nodes/outputs/rss.go
··· 4 4 "context" 5 5 "encoding/xml" 6 6 "fmt" 7 + "time" 7 8 8 9 "github.com/kierank/pipes/nodes" 9 10 ) ··· 32 33 33 34 // Build RSS feed 34 35 type RSSItem struct { 35 - Title string `xml:"title"` 36 - Description string `xml:"description"` 37 - Link string `xml:"link"` 38 - PubDate string `xml:"pubDate,omitempty"` 36 + Title string `xml:"title"` 37 + Description string `xml:"description"` 38 + Link string `xml:"link"` 39 + PubDate string `xml:"pubDate,omitempty"` 40 + GUID string `xml:"guid,omitempty"` 41 + Author string `xml:"author,omitempty"` 42 + Categories []string `xml:"category,omitempty"` 39 43 } 40 44 41 45 type RSSChannel struct { ··· 62 66 Title: getStringFromMap(itemMap, "title", "Untitled"), 63 67 Description: getStringFromMap(itemMap, "description", ""), 64 68 Link: getStringFromMap(itemMap, "link", ""), 69 + GUID: getStringFromMap(itemMap, "guid", ""), 70 + Author: getStringFromMap(itemMap, "author", ""), 65 71 } 66 72 67 - if pubDate, ok := itemMap["pubDate"].(string); ok { 73 + // Try to get published date - check "published" first, then fall back to "published_at" timestamp 74 + if pubDate, ok := itemMap["published"].(string); ok && pubDate != "" { 68 75 rssItem.PubDate = pubDate 76 + } else if timestamp, ok := itemMap["published_at"].(int64); ok && timestamp > 0 { 77 + // Convert Unix timestamp to RFC1123 format for RSS 78 + rssItem.PubDate = time.Unix(timestamp, 0).UTC().Format(time.RFC1123Z) 79 + } 80 + 81 + // Extract categories if present 82 + if categories, ok := itemMap["categories"].([]interface{}); ok { 83 + for _, cat := range categories { 84 + if catStr, ok := cat.(string); ok { 85 + rssItem.Categories = append(rssItem.Categories, catStr) 86 + } 87 + } 69 88 } 70 89 71 90 items = append(items, rssItem)
+31 -3
web/templates/editor.html
··· 1185 1185 const data = JSON.parse(dataLog.metadata); 1186 1186 dataContent.className = 'output-content'; 1187 1187 1188 - // Format data based on node type 1188 + // Format data based on node type or data structure 1189 1189 const node = nodes.find(n => n.id === nodeID); 1190 - if (node && node.type === 'rss-source' && Array.isArray(data)) { 1190 + const isRSSData = Array.isArray(data) && data.length > 0 && 1191 + data[0].title && (data[0].link || data[0].published || data[0].published_at); 1192 + 1193 + if ((node && node.type === 'rss-source' && Array.isArray(data)) || isRSSData) { 1191 1194 // Format RSS items with colored field names 1192 1195 dataContent.classList.add('rss-view'); 1193 1196 let html = '<pre>'; ··· 1202 1205 if (item.published) { 1203 1206 html += `<span class="key">published:</span> ${escapeHtml(item.published)}\n`; 1204 1207 } 1208 + if (item.published_at) { 1209 + const date = new Date(item.published_at * 1000); 1210 + html += `<span class="key">published_at:</span> ${item.published_at} (${date.toLocaleString()})\n`; 1211 + } 1212 + if (item.updated_at) { 1213 + const date = new Date(item.updated_at * 1000); 1214 + html += `<span class="key">updated_at:</span> ${item.updated_at} (${date.toLocaleString()})\n`; 1215 + } 1216 + if (item.categories && item.categories.length > 0) { 1217 + html += `<span class="key">categories:</span> ${escapeHtml(item.categories.join(', '))}\n`; 1218 + } 1205 1219 if (item.description) { 1206 - html += `<span class="key">description:</span> ${escapeHtml(item.description)}\n`; 1220 + const preview = item.description.length > 200 ? item.description.substring(0, 200) + '...' : item.description; 1221 + html += `<span class="key">description:</span> ${escapeHtml(preview)}\n`; 1222 + } 1223 + if (item.content && item.content !== item.description) { 1224 + const preview = item.content.length > 200 ? item.content.substring(0, 200) + '...' : item.content; 1225 + html += `<span class="key">content:</span> ${escapeHtml(preview)}\n`; 1226 + } 1227 + if (item.image) { 1228 + html += `<span class="key">image:</span> ${escapeHtml(item.image)}\n`; 1229 + } 1230 + if (item.enclosures && item.enclosures.length > 0) { 1231 + html += `<span class="key">enclosures:</span> ${item.enclosures.length} file(s)\n`; 1232 + item.enclosures.forEach(enc => { 1233 + html += ` - ${escapeHtml(enc.type || 'unknown')}: ${escapeHtml(enc.url)}\n`; 1234 + }); 1207 1235 } 1208 1236 html += '\n'; 1209 1237 });