diff options
| -rw-r--r-- | app/controllers/rss_controller.rb | 12 | ||||
| -rw-r--r-- | app/views/rss/recent_changes.xml.builder | 29 | ||||
| -rw-r--r-- | config/routes.rb | 1 |
3 files changed, 0 insertions, 42 deletions
diff --git a/app/controllers/rss_controller.rb b/app/controllers/rss_controller.rb index 489a732..5e29698 100644 --- a/app/controllers/rss_controller.rb +++ b/app/controllers/rss_controller.rb | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | class RssController < ApplicationController | 1 | class RssController < ApplicationController |
| 2 | 2 | ||
| 3 | before_action :authenticate, :only => :recent_changes | ||
| 4 | before_action :get_host | 3 | before_action :get_host |
| 5 | 4 | ||
| 6 | def updates | 5 | def updates |
| @@ -40,18 +39,7 @@ class RssController < ApplicationController | |||
| 40 | end | 39 | end |
| 41 | end | 40 | end |
| 42 | 41 | ||
| 43 | def recent_changes | ||
| 44 | @items = Page.where( | ||
| 45 | "updated_at < ? AND updated_at > ?", Time.now, Time.now - 14.days | ||
| 46 | ).limit(20).order("updated_at desc") | ||
| 47 | end | ||
| 48 | |||
| 49 | protected | 42 | protected |
| 50 | def authenticate | ||
| 51 | authenticate_or_request_with_http_basic do |username, password| | ||
| 52 | username == "recent" && password == "d@t3N+kLAu-23" | ||
| 53 | end | ||
| 54 | end | ||
| 55 | 43 | ||
| 56 | def get_host | 44 | def get_host |
| 57 | @host = request.protocol + request.host_with_port | 45 | @host = request.protocol + request.host_with_port |
diff --git a/app/views/rss/recent_changes.xml.builder b/app/views/rss/recent_changes.xml.builder deleted file mode 100644 index cce3b5d..0000000 --- a/app/views/rss/recent_changes.xml.builder +++ /dev/null | |||
| @@ -1,29 +0,0 @@ | |||
| 1 | xml.instruct! | ||
| 2 | |||
| 3 | xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do | ||
| 4 | xml.title("CCC.de Recent Change") | ||
| 5 | xml.link(:href => "https://www.ccc.de/") | ||
| 6 | xml.link(:rel => "self", :href => "/rss/updates.xml") | ||
| 7 | xml.updated(@items.first.updated_at.xmlschema) | ||
| 8 | xml.author do | ||
| 9 | xml.name("Chaos Computer Club e.V.") | ||
| 10 | end | ||
| 11 | xml.id("https://www.ccc.de/") | ||
| 12 | |||
| 13 | @items.each do |item| | ||
| 14 | xml.entry do | ||
| 15 | xml.title(item.title) | ||
| 16 | xml.link( | ||
| 17 | :href => "https://www.ccc.de/#{item.node.unique_path}", | ||
| 18 | :rel => "alternate" | ||
| 19 | ) | ||
| 20 | xml.id(content_url_helper(item.node.unique_path)) | ||
| 21 | xml.updated(item.updated_at.xmlschema) | ||
| 22 | xml.content(:type => "text") do | ||
| 23 | xml.div("changed by #{item.user.login}") | ||
| 24 | end | ||
| 25 | end | ||
| 26 | |||
| 27 | end | ||
| 28 | |||
| 29 | end | ||
diff --git a/config/routes.rb b/config/routes.rb index 88f49a2..a7775b3 100644 --- a/config/routes.rb +++ b/config/routes.rb | |||
| @@ -70,7 +70,6 @@ Cccms::Application.routes.draw do | |||
| 70 | get 'rss/updates', :to => 'rss#updates', :as => :rss | 70 | get 'rss/updates', :to => 'rss#updates', :as => :rss |
| 71 | get 'rss/updates.:format', :to => 'rss#updates', :as => :rss_feed, | 71 | get 'rss/updates.:format', :to => 'rss#updates', :as => :rss_feed, |
| 72 | :constraints => { :format => /xml|rdf/ } | 72 | :constraints => { :format => /xml|rdf/ } |
| 73 | get 'rss/recent_changes', :to => 'rss#recent_changes' | ||
| 74 | get 'rss/tags/:tag/updates', :to => 'rss#tag_updates', :as => :rss_tag | 73 | get 'rss/tags/:tag/updates', :to => 'rss#tag_updates', :as => :rss_tag |
| 75 | get 'rss/tags/:tag/updates.:format', :to => 'rss#tag_updates', :as => :rss_tag_feed, | 74 | get 'rss/tags/:tag/updates.:format', :to => 'rss#tag_updates', :as => :rss_tag_feed, |
| 76 | :constraints => { :format => /xml/ } | 75 | :constraints => { :format => /xml/ } |
