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

1
.gitignore vendored
View file

@ -25,3 +25,4 @@ files/letsencrypt.key
files/tor.txt
.bundle
ext/black_box.rb
files/trumpplan.txt

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
if params[:plan_type] == 'trumpplan'
plan_type = 'trumpplan'
else
plan_type = 'supporter'
end
if is_special_upgrade
require_admin

View file

@ -112,6 +112,14 @@ class Site < Sequel::Model
maximum_site_files: 100_000
}
PLAN_FEATURES[:trumpplan] = PLAN_FEATURES[:supporter].merge(
name: 'Trump Plan',
price: 100,
space: Filesize.from('2MB').to_i,
no_file_restrictions: false,
bandwidth: Filesize.from('604800KB').to_i
)
PLAN_FEATURES[:free] = PLAN_FEATURES[:supporter].merge(
name: 'Free',
space: Filesize.from('1GB').to_i,

View file

@ -19,7 +19,7 @@
</div>
</div>
<div class="col col-50 profile-info">
<h2 class="eps title-with-badge"><span><%= site.title %></span> <% if site.supporter? %><a href="/supporter" class="supporter-badge" title="Neocities Supporter"></a> <% end %></h2>
<h2 class="eps title-with-badge"><span><%= site.title %></span> <% if site.supporter? %><a href="/supporter" class="supporter-badge" title="Neocities Supporter"></a> <% end %> <% if site.plan_type == 'trumpplan' %><img src="/img/fatcat.png" alt="FAT CAT"><BR>FAT CAT SUPPORTER<br><small>Tips <i>really</i> well at Sarge's Deli</i><% end %></h2>
<p class="site-url"><a href="<%= site.uri %>"><%= site.host %></a></p>
<!--
<% if site.latest_archive %>

View file

@ -26,7 +26,6 @@
<div class="plan-image free">
</div>
<div class="price">$<%= Site::PLAN_FEATURES[:free][:price] %></div>
<div class="interval">per month</div>
<ul class="main-features">
<li><strong><%= Site::PLAN_FEATURES[:free][:space].to_space_pretty %></strong> <span data-original-title="How much space you have to upload files. The more space, the bigger your site can be.">storage</span></li>
@ -36,11 +35,82 @@
</div>
<div class="row content txt-Center">
<% if request.path == '/welcome' %>
<% if @is_trump_plan %>
<b>Sorry!</b><br><small style="text-align: left">Not available for Trump Hotel / FCC / US Senate / White House guests.<br><br>Thank you for opposing Net Neutrality, it was suppressing our freedom to do this.</small>
<% else %>
<a href="/tutorial" class="btn-Action">Continue</a>
<% end %>
<% end %>
</div>
</div>
<% if @is_trump_plan %>
<div class="col supporter">
<div class="row content">
<div class="col col-33">
<img src="/img/trumpplan.png" width="200px;">
<br>
<p>Trump Hotel / FCC / US Senate / White House guests: Introducing this exclusive offer just for you! Bathe in the luxury of a superior quality web site hosting experience that has been tailor-made by the finest artisans for the choicest tastes of your demanding lifestyle.</p>
<div class="plan-image supporter" style="background-image: url(/img/fatcat.png);">
</div>
<div class="price" style="color: green">$100</div>
<div class="interval">per month</div>
<ul class="main-features">
<li><strong>2 MB</strong> <span data-original-title="Your internet bill after Net Neutrality is gutted is going to be big, folks. Really big.">storage bigness</span></li>
<li><strong>604,800 KB</strong> <span data-original-title="The exact amount of bandwidth a 56K modem can download at theoretical perfect speeds in one day. The extra cost creates jobs!">ultra-premium bandwidth</span></li>
<li><strong>INCLUDED </strong> <span data-original-title="Be the talk of Upper East Side with this exclusive badge showing how wealthy you are!">"Fat Cat" Site Profile Badge</span> <small><strong><a href="/img/fatcatbadgeexample.png">(sample)</a></strong></small></li>
<li><strong>INCLUDED</strong> <span data-original-title="The finest of 18th century late-baroque faux-luxury and other miscellaneous Veblen Goods">tacky gold-plated Rococo garbage</span></li>
</ul>
</div>
<div class="col col-66">
<p class="instructions">Just enter your credit card info to upgrade to the pinnacle of luxury:</p>
<div>
<div id="plan_error" class="alert alert-block alert-error" style="display:none"></div>
<form id="upgradeForm" method="POST" action="/supporter/update">
<%== csrf_token_input_html %>
<input type="hidden" value="trumpplan" name="plan_type">
<input id="stripe_token" name="stripe_token" type="hidden" value="<%= params[:stripe_token] %>">
<div class="credit-card-input no-js" id="skeuocard" style="margin-left: auto; margin-right: auto; margin-bottom: 20px">
<p class="no-support-warning"></p>
<label for="cc_type">Card Type</label>
<select name="cc_type">
<option value="">...</option>
<option value="visa">Visa</option>
<option value="discover">Discover</option>
<option value="mastercard">MasterCard</option>
<option value="maestro">Maestro</option>
<option value="jcb">JCB</option>
<option value="unionpay">China UnionPay</option>
<option value="amex">American Express</option>
<option value="dinersclubintl">Diners Club</option>
</select>
<label for="cc_number">Card Number</label>
<input type="text" name="cc_number" id="cc_number" placeholder="XXXX XXXX XXXX XXXX" maxlength="19" size="19">
<label for="cc_exp_month">Expiration Month</label>
<input type="text" name="cc_exp_month" id="cc_exp_month" placeholder="00">
<label for="cc_exp_year">Expiration Year</label>
<input type="text" name="cc_exp_year" id="cc_exp_year" placeholder="00">
<label for="cc_name">Cardholder's Name</label>
<input type="text" name="cc_name" id="cc_name" placeholder="John Doe">
<label for="cc_cvc">Card Validation Code</label>
<input type="text" name="cc_cvc" id="cc_cvc" placeholder="123" maxlength="3" size="3">
</div>
</form>
</div>
</div>
</div>
<div class="row content txt-Center">
<a id="upgradeLink" href="/" class="btn-Action" onclick="$('#upgradeForm').submit(); return false">
Begin the lifestyle you've always dreamed of for only $100
</a><br>
or pay with <a href="/supporter/bitcoin">E-Gold</a>
</div>
</div>
<% else %>
<div class="col supporter">
<div class="row content">
<div class="col col-33">
@ -114,6 +184,7 @@
or pay with <a href="/supporter/paypal">PayPal</a> or <a href="/supporter/bitcoin">Bitcoin</a>
</div>
</div>
<% end %>
</div>
<% end %>
@ -148,10 +219,12 @@
</div>
</section>
<% unless @is_trump_plan %>
<section class="section" style="padding-top: 0;">
<%== erb :'supporter/_compare', layout: false %>
</section>
<% end %>
<%== erb :'supporter/_signupcode', layout: false %>
<script>