Skip to content

Commit

Permalink
Multireddit support.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jan 12, 2015
1 parent 46c79d1 commit 3ec5a1c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
33 changes: 33 additions & 0 deletions feed/index.php
Expand Up @@ -278,6 +278,39 @@ function verify_cache($fname, $url, $subreddit, $maxage)
$subreddit = $str;
} // if
} // if
else if (isset($_REQUEST['multireddit']))
{
$use_google = false; // these tend to be broken on Google Reader. :/

if (!isset($_REQUEST['user']))
{
header('HTTP/1.0 400 Bad Request');
header('Connection: close');
header('Content-Type: text/plain');
print("\n\nRequested multireddit without username.\n\n");
exit(0);
} // if

$user = $_REQUEST['user'];
if ((strlen($user) > 64) || (preg_match('/^[a-zA-Z0-9\-_]+$/', $user) != 1))
{
header('HTTP/1.0 400 Bad Request');
header('Connection: close');
header('Content-Type: text/plain');
print("\n\nBogus multireddit username.\n\n");
exit(0);
} // if

$str = $_REQUEST['multireddit'];
if ((strlen($str) < 32) && (preg_match('/^[a-zA-Z0-9]+$/', $str) == 1))
{
$cachefname = "multireddit-user-$user-$str-$cachefname";
$cachefname = "$str-$cachefname";
$name = "user/$user/m/$str";
$feedurl .= $name;
$subreddit = "Multireddit $name";
} // if
} // if

$feedurl .= '.rss';

Expand Down
6 changes: 6 additions & 0 deletions index.html
Expand Up @@ -50,6 +50,12 @@
http://inline-reddit.com/feed/?subreddit=AskReddit
</a>

<p>
<b>multireddits:</b> You get them like this:
<a href="feed/?multireddit=redditpets&user=reddit">
http://inline-reddit.com/feed/?multireddit=redditpets&amp;user=reddit
</a>

<p>
<b>private feeds:</b> You get the feed info <a href="http://www.reddit.com/prefs/feeds/">here</a>, and use it like this:<br/>
http://inline-reddit.com/feed/?feed=&lt;some_sha1_looking_hash&gt;&amp;user=&lt;your_reddit_login_name&gt;<br/>
Expand Down

0 comments on commit 3ec5a1c

Please sign in to comment.