[Bug 14994] New: Add RSS/Atom feed proxy
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14994 Bug ID: 14994 Summary: Add RSS/Atom feed proxy Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Web services Assignee: koha-bugs@lists.koha-community.org Reporter: xarragon@gmail.com QA Contact: testopia@bugs.koha-community.org Some libraries uses a separate blog on an external site such as blogspot.com. We are working on enhancements to make Koha a fully-featured blog in the future, removing that need. The external blogs publishes the content as RSS/Atom feeds which can then be pulled to the OPAC via some Javascript and/or Yahoo Pipes. Pipes was recently decomissioned and I am now trying to solve this issue. I do not have full information yet. At present I have created a small web proxy that pulls RSS/Atom from an external source via LWP. This allows us to overcome the same-origin limitation. There are security considerations for this that must be looked at. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14994 --- Comment #1 from Martin Persson <xarragon@gmail.com> --- Created attachment 43690 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43690&action=edit Bug 14994 - Request proxy (added syspref) Adds a web proxy allowing external RSS and Atom feeds to be displayed in OPAC and staff interface pages. This patch adds system preference(s) under the 'Web services' tabs. Sponsored-By: Halland County Library -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14994 --- Comment #2 from Martin Persson <xarragon@gmail.com> --- Created attachment 43691 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43691&action=edit Bug 14994 - Request proxy (added opac-proxy.pl) This patch adds a new opac page that is used as an endpoint for external web requests such as RSS feeds. This allows user scripts to pull data via XHR requests from external resources without violating the 'same-origin' restriction. I would appreciate some feedback on security implications of doing this. Might need to add some DoS protection etc. The script takes a single parameter; 'id', the number of the feed to retrieve. This is an offset into an array of URLs stored in the system preference named 'RequestProxyURL'. The offset i based on 1 to make it easier for non-technical people. The first feed is '1', '0' is invalid. Test plan: 1) Apply the syspref patch first. 2) Apply this patch. 3) Enable the request proxy by going into System Preferences, Web Services, set RequestProxyEnabled to 'yes' and enter a test URL such as: http://hyltebiblioteken.blogspot.se/feeds/posts/default and: http://bokbastisarna.blogspot.com/feeds/posts/default into RequestProxyURL. 4) Save and go to the new url: http://127.0.1.1/cgi-bin/koha/opac-proxy.pl?id=1 You should get the content of the first URL with 'id' = 1. With 'id' = 2 you should get the second URL. With 'id' = 3 you should get a 503 error. 5) Disable the service again, 'RequestProxyEnabled' = no. 6) Go back to the proxy url, you should now receive a 503 error even for valid feed id's AND for invalid ones. Sponsored-By: Halland County Library -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14994 --- Comment #3 from Martin Persson <xarragon@gmail.com> --- For a working example which puts the first three posts from two separate Atom feeds on the OPAC front page via jQuery, add this code to the system preferences. It is used with the example URLs used in the test plan: URL1: http://hyltebiblioteken.blogspot.se/feeds/posts/default URL2: http://bokbastisarna.blogspot.com/feeds/posts/default OpacNavRight ============ <div class="rss-widget-container"> <div class="rss-widget-head"> Rubriker från bloggen </div> <div class="rss-widget-body" id="bloggen"> <ul class="rss-items"></ul> <div class="loading"> Laddar innehåll från bloggen. Detta kräver Javascript aktiverat i din webbläsare. </div> </div> </div> <div class="rss-widget-container"> <div class="rss-widget-head"> Bokbästisarna </div> <div class="rss-widget-body" id="bokbastisarna"> <ul class="rss-items"></ul> <div class="loading"> Laddar innehåll från bloggen. Detta kräver Javascript aktiverat i din webbläsare. </div> </div> </div> ============ OPACUserJS ========== $('#bloggen').ready(function() { var url = 'http://127.0.1.1/cgi-bin/koha/opac-proxy.pl?id=1'; $.ajax(url, { dataType: 'xml', success: function(xmldata) { var item_html = ''; var xml = $(xmldata).find('entry').slice(0,3).each(function(index, value) { var title = $(this).children('title'); var link = $(this).children('link'); item_html += '<li><a href="' + link.text() + '">' + title.text() + "</a></li>\n"; }); $('#bloggen div.loading').fadeOut('slow', function () { $(this).html(item_html); $(this).slideDown('slow'); }); } }); }); $('#bokbastisarna').ready(function() { var url = 'http://127.0.1.1/cgi-bin/koha/opac-proxy.pl?id=2'; $.ajax(url, { dataType: 'xml', success: function(xmldata) { var item_html = ''; var xml = $(xmldata).find('entry').slice(0,3).each(function(index, value) { var title = $(this).children('title'); var link = $(this).children('link'); item_html += '<li><a href="' + link.text() + '">' + title.text() + "</a></li>\n"; }); $('#bokbastisarna div.loading').fadeOut('slow', function () { $(this).html(item_html); $(this).slideDown('slow'); }); } }); }); ========== These examples are in Swedish, based on real-life usage. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14994 Martin Persson <xarragon@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org