#StandWithUkraine

Add RSS support to HTTP File Server (HFS)

hfs_icon

I had previously covered HFS which is excellent software for setting up HTTP file-sharing server. Unfortunately it does not natively provide RSS feeds that would be perfect for notifications about new files available for download.

After some poking and bugging fellow HFS users and developer himself last year I had put together usable workaround.

File list

HFS has native support for file lists. It outputs nice pack of URLs that is easy to feed to download managers (like Free Download Manager) instead of clicking each file.

Add some XML markup to that list and we have ourselves RSS feed.

File list template

Create text file named filelist.tpl in same directory as HFS executable and paste following code in it:

<?xml version="1.0" ?>
<rss version="2.0">
<channel>
<title>%host%%folder% directory feed</title> 
<description>Files in %host%%folder% directory</description> 
<link>http://%host%</link> 
%files%
</channel>
</rss>
[files]
%list%
[file]
<item>
<title><![CDATA[%item-name%]]></title>
<description><![CDATA[%item-name% (%item-size%)]]></description>
<guid><![CDATA[http://%host%%folder%%item-url%]]></guid>
</item>

Browser discovery

File list is replaced with RSS feed and it should be obvious as such.

Menu > Edit HTML template…

Insert following line right before and press Ok.

<link rel="alternate" type="application/rss+xml" title="RSS for folder" href="http://%host%%folder%~files.lst?recursive" />

Now browsers that support feed discovery will show available RSS feed in each folder.

File list link that is shown on page can also be renamed (or removed).

Limitations

  • feed is served as plain test instead of XML – should not be a problem but may limit compatibility with some readers;
  • no timestamps on RSS items because of complex time format used, currently impossible to replicate it in HFS;
  • some characters (square brackets for example) are not properly encoded;
  • resulting RSS includes all files instead of few recent ones, no workaround because of way sorting in HFS works.

Overall

Method is far from perfect but is easy to implement and doesn’t require additional software. Definitely beats constant explaining why I had deleted something before someone had seen it. :)

Link to old discussion about RSS at HFS forum

Related Posts

1 Comments

  • Planning ultimate online collaboration setup | Rarst.net #

    [...] with my very own RSS template had proved itself very convenient for distributing files from one user to others. However it [...]