From 23f8efa1096f81d9e73c0a658a0b773248342f69 Mon Sep 17 00:00:00 2001 From: HyShai Date: Tue, 5 Sep 2017 13:42:10 -0400 Subject: [PATCH 1/3] add itunes podcast icon --- app/models/agents/data_output_agent.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/agents/data_output_agent.rb b/app/models/agents/data_output_agent.rb index 0fe8818e77..a376f75068 100644 --- a/app/models/agents/data_output_agent.rb +++ b/app/models/agents/data_output_agent.rb @@ -296,6 +296,7 @@ def receive_web_request(params, method, format) #{feed_icon.encode(xml: :text)} #{hub_links} + #{feed_title.encode(xml: :text)} #{feed_description.encode(xml: :text)} #{feed_link.encode(xml: :text)} From 69f4f226848b01bd64a5c8fd1accee6fe5815c4e Mon Sep 17 00:00:00 2001 From: HyShai Date: Tue, 5 Sep 2017 16:33:46 -0400 Subject: [PATCH 2/3] add tests --- spec/models/agents/data_output_agent_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/models/agents/data_output_agent_spec.rb b/spec/models/agents/data_output_agent_spec.rb index 86d82b4154..8e317a49d8 100644 --- a/spec/models/agents/data_output_agent_spec.rb +++ b/spec/models/agents/data_output_agent_spec.rb @@ -161,6 +161,7 @@ https://yoursite.com/favicon.ico + XKCD comics as a feed This is a feed of recent XKCD comics, generated by Huginn https://yoursite.com @@ -614,6 +615,7 @@ https://yoursite.com/favicon.ico + XKCD comics as a feed This is a feed of recent XKCD comics, generated by Huginn https://yoursite.com From 5e1e5a1907cf3ff1b2cf932ba9fe53e674e2253a Mon Sep 17 00:00:00 2001 From: Shaya G Date: Wed, 6 Sep 2017 23:43:34 -0400 Subject: [PATCH 3/3] only add itunes icon if ns_itunes --- app/models/agents/data_output_agent.rb | 8 +++++++- spec/models/agents/data_output_agent_spec.rb | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/models/agents/data_output_agent.rb b/app/models/agents/data_output_agent.rb index a376f75068..de73c475d7 100644 --- a/app/models/agents/data_output_agent.rb +++ b/app/models/agents/data_output_agent.rb @@ -163,6 +163,12 @@ def feed_icon interpolated['template']['icon'].presence || feed_link + '/favicon.ico' end + def itunes_icon + if(boolify(interpolated['ns_itunes'])) + "" + end + end + def feed_description interpolated['template']['description'].presence || "A feed of Events received by the '#{name}' Huginn Agent" end @@ -295,8 +301,8 @@ def receive_web_request(params, method, format) #{feed_icon.encode(xml: :text)} + #{itunes_icon} #{hub_links} - #{feed_title.encode(xml: :text)} #{feed_description.encode(xml: :text)} #{feed_link.encode(xml: :text)} diff --git a/spec/models/agents/data_output_agent_spec.rb b/spec/models/agents/data_output_agent_spec.rb index 8e317a49d8..079d656dcf 100644 --- a/spec/models/agents/data_output_agent_spec.rb +++ b/spec/models/agents/data_output_agent_spec.rb @@ -161,7 +161,6 @@ https://yoursite.com/favicon.ico - XKCD comics as a feed This is a feed of recent XKCD comics, generated by Huginn https://yoursite.com @@ -467,10 +466,11 @@ content, status, content_type = agent.receive_web_request({ 'secret' => 'secret1' }, 'get', 'text/xml') expect(status).to eq(200) expect(content_type).to eq('application/rss+xml') - + doc = Nokogiri(content) namespaces = doc.collect_namespaces expect(namespaces).not_to include("xmlns:itunes") + expect(doc.at("/rss/channel/*[local-name()='itunes:image']")).to be_nil end end @@ -485,12 +485,13 @@ content, status, content_type = agent.receive_web_request({ 'secret' => 'secret1' }, 'get', 'text/xml') expect(status).to eq(200) expect(content_type).to eq('application/rss+xml') - + doc = Nokogiri(content) namespaces = doc.collect_namespaces expect(namespaces).to include( "xmlns:itunes" => 'http://www.itunes.com/dtds/podcast-1.0.dtd' ) + expect(doc.at('/rss/channel/itunes:image').attr('href')).to eq('https://yoursite.com/favicon.ico') end end @@ -615,7 +616,6 @@ https://yoursite.com/favicon.ico - XKCD comics as a feed This is a feed of recent XKCD comics, generated by Huginn https://yoursite.com