diff --git a/README.md b/README.md index 84952db..23ace11 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ # opml-gen Simple web tool to generate OPML files to let you use RSS feeds everywhere + +Currently only support GitHub Starred Repos: It generates an OPML file so you can follow all of your starred repos easily. + +I plan to add more OPML generators: GoodReads feed perhaps? diff --git a/app.rb b/app.rb index 6cfa2d1..0d06d16 100644 --- a/app.rb +++ b/app.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'dotenv/load' +require 'dotenv' require 'sinatra/base' require 'sinatra/reloader' require 'octokit' @@ -13,7 +13,9 @@ class MyApp < Sinatra::Base configure :development do register Sinatra::Reloader also_reload 'opml.rb' + Dotenv.load end + configure do set :r, Redis.new set :client, Octokit::Client.new( @@ -44,12 +46,26 @@ class MyApp < Sinatra::Base [repos, time] end + get '/' do + File.read File.join 'public', 'index.html' + end + + post '/submit/:type' do + if params[:type] == 'github' + username = params[:username] + redirect "/github/#{username}/starred.opml" + else + "Invalid Type" + end + end + get '/github/:user/starred.opml' do user = params[:user] repos, time = get_starred_repos_from_cache(user) opml = OPML.new do @title = "Releases: #{user}/starred" - @date_created = Time.new(time.to_i).rfc822 + # TODO: Fix this + @date_created = Time.now.rfc822 @date_modified = Time.now.rfc822 @owner_name = user end diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..7deb850 --- /dev/null +++ b/public/index.html @@ -0,0 +1,37 @@ + + + + + opml-gen + + + + +

opml-gen

+

Generate OPML Files for easy use

+
+
+ +

GitHub/Starred

+

Generate an OPML file for your starred repositories on GitHub

+
+ + + +
+
+
+ +
+

Why?

+

GitHub publishes an RSS feed for releases for every repository. I've been trying to switch things to RSS, and Release Notifications on GitHub is a very big pain point. This solves the problem by using your trusty RSS feed reader application instead of it's own thing.

+

You should also check out kill-the-newsletter for a similar solution with newsletters. +

OPML is a common format used to share lists of RSS feeds that you can import in your RSS application

+
+ + + +