From c4296b59a7f9d667d295f9c37b71f7849b818fb3 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Tue, 28 Jan 2025 22:47:15 +0100 Subject: Big overhaul patch and style changes --- app/views/rss/recent_changes.xml.builder | 8 ++++---- app/views/rss/updates.rdf.builder | 18 +++++++++--------- app/views/rss/updates.xml.builder | 7 ++++--- 3 files changed, 17 insertions(+), 16 deletions(-) (limited to 'app/views/rss') diff --git a/app/views/rss/recent_changes.xml.builder b/app/views/rss/recent_changes.xml.builder index c3b3ec9..cce3b5d 100644 --- a/app/views/rss/recent_changes.xml.builder +++ b/app/views/rss/recent_changes.xml.builder @@ -2,19 +2,19 @@ xml.instruct! xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do xml.title("CCC.de Recent Change") - xml.link(:href => "http://www.ccc.de/") + xml.link(:href => "https://www.ccc.de/") xml.link(:rel => "self", :href => "/rss/updates.xml") xml.updated(@items.first.updated_at.xmlschema) xml.author do xml.name("Chaos Computer Club e.V.") end - xml.id("http://www.ccc.de/") + xml.id("https://www.ccc.de/") @items.each do |item| xml.entry do xml.title(item.title) xml.link( - :href => "http://www.ccc.de/#{item.node.unique_path}", + :href => "https://www.ccc.de/#{item.node.unique_path}", :rel => "alternate" ) xml.id(content_url_helper(item.node.unique_path)) @@ -26,4 +26,4 @@ xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do end -end \ No newline at end of file +end diff --git a/app/views/rss/updates.rdf.builder b/app/views/rss/updates.rdf.builder index 00b6242..cc63201 100644 --- a/app/views/rss/updates.rdf.builder +++ b/app/views/rss/updates.rdf.builder @@ -2,26 +2,26 @@ xml.instruct! xml.tag!("rdf:RDF", "xmlns:rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "xmlns:dc" => "http://purl.org/dc/elements/1.1/", "xmlns" => "http://purl.org/rss/1.0/") do xml.tag!( "rdf:Description", "rdf:about" => "http://www.w3.org/TR/rdf-syntax-grammar", "dc:title"=>"RDF/XML Syntax Specification (Revised)") - xml.channel do + xml.channel( "rdf:about" => "https://www.ccc.de/de/rss/updates.xml" ) do xml.title("Chaos Computer Club: Updates") - xml.link("http://www.ccc.de") + xml.link("https://www.ccc.de") xml.description("Kabelsalat ist gesund.") xml.tag!("dc:date", @items.first.published_at.xmlschema) end - - xml.image( "rdf:about" => "http://www.ccc.de/images/chaosknoten.gif") do + + xml.image( "rdf:about" => "https://www.ccc.de/images/chaosknoten.gif") do xml.title("Chaos Computer Club (Chaosknoten)") - xml.link("http://www.ccc.de") - xml.url("http://www.ccc.de/images/chaosknoten.gif") + xml.link("https://www.ccc.de") + xml.url("https://www.ccc.de/images/chaosknoten.gif") end - + @items.each do |item| xml.item("rdf:about" => content_url(:page_path => item.node.unique_path)) do xml.title(item.title) xml.link(content_url(:page_path => item.node.unique_path)) xml.description(item.abstract) - xml.tag!("dc:creator", item.user.login) + xml.tag!("dc:creator", (item.user ? item.user.login : "CCC")) xml.tag!("dc:date", item.published_at.xmlschema) end end -end \ No newline at end of file +end diff --git a/app/views/rss/updates.xml.builder b/app/views/rss/updates.xml.builder index c09c9c9..6afcd56 100644 --- a/app/views/rss/updates.xml.builder +++ b/app/views/rss/updates.xml.builder @@ -2,13 +2,13 @@ xml.instruct! xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do xml.title("Chaos Computer Club Updates") - xml.link(:href => "http://www.ccc.de/") + xml.link(:href => "https://www.ccc.de/") xml.link(:rel => "self", :href => "#{@host}/rss/updates") xml.updated(@items.first.published_at.xmlschema) xml.author do xml.name("Chaos Computer Club e.V.") end - xml.id("#{@host}/rss/updates") + xml.id("https://www.ccc.de/rss/updates") @items.each do |item| xml.entry do @@ -21,6 +21,7 @@ xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do xml.id(content_url(:page_path => item.node.feed_id)) xml.updated(item.updated_at.xmlschema) xml.published(item.published_at.xmlschema) + xml.summary(item.abstract) xml.content(:type => "xhtml") do xml.div(item.body, :xmlns => "http://www.w3.org/1999/xhtml") end @@ -28,4 +29,4 @@ xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do end -end \ No newline at end of file +end -- cgit v1.3 From e86897c7c3ce7dea169be7f2c027aae3a7a4edab Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 27 Jun 2026 20:29:25 +0200 Subject: Stop forcing escaped HTML into the database just because XML Builder was used wrong --- app/views/nodes/edit.html.erb | 2 +- app/views/rss/updates.rdf.builder | 4 ++-- app/views/rss/updates.xml.builder | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'app/views/rss') diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index 596f992..b45c700 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb @@ -76,7 +76,7 @@
Title
-
<%= d.text_field :title, :pattern => "(?:[^<>&]|&amp;|&lt;|&gt;)*", :title => "Warning: Unescaped HTML entities detected! Use &lt;, &gt;, &amp; instead of <, >, &." %>
+
<%= d.text_field :title %>
Abstract
<%= d.text_area :abstract %>
diff --git a/app/views/rss/updates.rdf.builder b/app/views/rss/updates.rdf.builder index cc63201..b02d34f 100644 --- a/app/views/rss/updates.rdf.builder +++ b/app/views/rss/updates.rdf.builder @@ -17,9 +17,9 @@ xml.tag!("rdf:RDF", "xmlns:rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#" @items.each do |item| xml.item("rdf:about" => content_url(:page_path => item.node.unique_path)) do - xml.title(item.title) + xml.title(CGI.escapeHTML(item.title.to_s)) xml.link(content_url(:page_path => item.node.unique_path)) - xml.description(item.abstract) + xml.description(CGI.escapeHTML(item.abstract.to_s)) xml.tag!("dc:creator", (item.user ? item.user.login : "CCC")) xml.tag!("dc:date", item.published_at.xmlschema) end diff --git a/app/views/rss/updates.xml.builder b/app/views/rss/updates.xml.builder index 6afcd56..0ea08fa 100644 --- a/app/views/rss/updates.xml.builder +++ b/app/views/rss/updates.xml.builder @@ -12,7 +12,7 @@ xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do @items.each do |item| xml.entry do - xml.title(item.title) + xml.title(CGI.escapeHTML(item.title.to_s)) xml.link( :href => content_url(:page_path => item.node.unique_path), :rel => "alternate", @@ -21,7 +21,7 @@ xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do xml.id(content_url(:page_path => item.node.feed_id)) xml.updated(item.updated_at.xmlschema) xml.published(item.published_at.xmlschema) - xml.summary(item.abstract) + xml.summary(CGI.escapeHTML(item.abstract.to_s)) xml.content(:type => "xhtml") do xml.div(item.body, :xmlns => "http://www.w3.org/1999/xhtml") end -- cgit v1.3 From 1853082fcd8c067390c246f9daa01a9b47387497 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 27 Jun 2026 22:49:21 +0200 Subject: rss: fix self link to include .xml suffix /rss/updates without format suffix returns HTTP 406 when the client does not send an appropriate Accept header. The self link in the Atom feed was pointing to the format-less URL, causing feed readers that follow the self link to hit the 406. Fixed to /rss/updates.xml. --- app/views/rss/updates.xml.builder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views/rss') diff --git a/app/views/rss/updates.xml.builder b/app/views/rss/updates.xml.builder index 0ea08fa..4b2e2f7 100644 --- a/app/views/rss/updates.xml.builder +++ b/app/views/rss/updates.xml.builder @@ -3,7 +3,7 @@ xml.instruct! xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do xml.title("Chaos Computer Club Updates") xml.link(:href => "https://www.ccc.de/") - xml.link(:rel => "self", :href => "#{@host}/rss/updates") + xml.link(:rel => "self", :href => "#{@host}/rss/updates.xml") xml.updated(@items.first.published_at.xmlschema) xml.author do xml.name("Chaos Computer Club e.V.") -- cgit v1.3