Add TRUMP PLAN to pay for upcoming Net Neutrality

Removes the free plan for the White House, FCC, US Senate and Trump
hotels. Introduces special Trump Plan, 2MB of disk space for only $100/mo.
This commit is contained in:
Kyle Drake 2017-04-26 16:38:43 -07:00
parent e7be10fb8e
commit ebc3ffe7e9
6 changed files with 145 additions and 27 deletions

View file

@ -54,10 +54,41 @@ get '/?' do
@blog_feed_html = SimpleCache.get :blog_feed_html
end
if params[:trumpplan]
flash[:is_trump_plan] = true
end
erb :index, layout: :index_layout
end
def trump_plan_eligible?
trumpplan_path = File.join 'files', 'trumpplan.txt'
ranges = []
if File.exist? trumpplan_path
File.readlines(trumpplan_path).each do |range|
ranges << IPAddress.parse(range.strip)
end
parsed_ip = IPAddress.parse(request.ip)
matched_ip = false
ranges.each do |range|
if range.include? parsed_ip
matched_ip = true
end
end
return matched_ip
end
false
end
get '/welcome' do
if params[:trumpplan] || flash[:is_trump_plan] || trump_plan_eligible?
@is_trump_plan = true
end
require_login
redirect '/' if current_site.supporter?
erb :'welcome', locals: {site: current_site}

View file

@ -14,7 +14,12 @@ end
post '/supporter/update' do
require_login
plan_type = 'supporter'
if params[:plan_type] == 'trumpplan'
plan_type = 'trumpplan'
else
plan_type = 'supporter'
end
if is_special_upgrade
require_admin