diff --git a/.gitignore b/.gitignore index f365e9cd..0d19f0bc 100644 --- a/.gitignore +++ b/.gitignore @@ -30,4 +30,4 @@ files/map.txt .sass-cache/* files/sslsites.zip .tm_properties -black_box.rb +./black_box.rb diff --git a/app.rb b/app.rb index 14bab112..f8eb15cd 100644 --- a/app.rb +++ b/app.rb @@ -267,10 +267,6 @@ get '/plan/?' do erb :'plan/index' end -get '/plan/create' do - erb :'' -end - =begin get '/plan/?' do @title = 'Supporter' @@ -510,7 +506,7 @@ end post '/create_validate_all' do content_type :json - fields = params.select {|p| p.match /username|password|email|new_tags_string/} + fields = params.select {|p| p.match /^username$|^password$|^email$|^new_tags_string$/} site = Site.new fields return [].to_json if site.valid? @@ -520,7 +516,7 @@ end post '/create_validate' do content_type :json - if !params[:field].match /username|password|email|new_tags_string/ + if !params[:field].match /^username$|^password$|^email$|^new_tags_string$/ return {error: 'not a valid field'}.to_json end diff --git a/models/site.rb b/models/site.rb index 5137a3d7..a3a7870b 100644 --- a/models/site.rb +++ b/models/site.rb @@ -75,22 +75,6 @@ class Site < Sequel::Model COMMENTING_ALLOWED_UPDATED_COUNT = 2 - PLAN_FEATURES = { - fatcat: { - name: 'Fat Cat', - space: Filesize.from('50GB').to_i, - bandwidth: Filesize.from('3TB').to_i, - price: 10, - custom_domains: true, - custom_ssl_certificates: true, - global_cdn: true, - ddos_mitigation: true, - unlimited_site_creation: true, - site_mounting: true, - no_file_restrictions: true - } - } - SUGGESTIONS_LIMIT = 30 SUGGESTIONS_VIEWS_MIN = 500 CHILD_SITES_MAX = 100 @@ -98,11 +82,23 @@ class Site < Sequel::Model IP_CREATE_LIMIT = 50 TOTAL_IP_CREATE_LIMIT = 300 + PLAN_FEATURES = { + fatcat: { + name: 'Fat Cat', + space: Filesize.from('20GB').to_i, + bandwidth: Filesize.from('3TB').to_i, + price: 10, + unlimited_site_creation: true, + custom_ssl_certificates: true, + no_file_restrictions: true + } + } + PLAN_FEATURES[:catbus] = PLAN_FEATURES[:fatcat].merge( name: 'Cat Bus', - space: Filesize.from('10GB').to_i, + space: Filesize.from('5GB').to_i, bandwidth: Filesize.from('1TB').to_i, - price: 5 + price: 5, ) PLAN_FEATURES[:supporter] = PLAN_FEATURES[:catbus].merge( @@ -110,20 +106,16 @@ class Site < Sequel::Model space: Filesize.from('1GB').to_i, bandwidth: Filesize.from('0.5TB').to_i, price: 2, - unlimited_site_creation: false, custom_ssl_certificates: false, no_file_restrictions: false ) PLAN_FEATURES[:free] = PLAN_FEATURES[:supporter].merge( name: 'Free', - space: Filesize.from('20MB').to_i, + space: Filesize.from('30MB').to_i, bandwidth: Filesize.from('100GB').to_i, price: 0, - custom_domains: false, - global_cdn: false, - ddos_mitigation: false, - site_mounting: false + unlimited_site_creation: false ) many_to_many :tags diff --git a/views/plan/_pricing.erb b/views/plan/_pricing.erb index 5558e14c..6b89ce17 100644 --- a/views/plan/_pricing.erb +++ b/views/plan/_pricing.erb @@ -1,6 +1,25 @@ +<% + def plan_pricing_button(plan_type) + plan_type = plan_type.to_s + + if !parent_site + %{Sign Up} + elsif parent_site && parent_site.plan_type == plan_type + %{
Current Plan
} + else + if plan_type == 'supporter' + plan_price = "$#{Site::PLAN_FEATURES[plan_type.to_sym][:price]*12}, once per year" + else + plan_price = "$#{Site::PLAN_FEATURES[plan_type.to_sym][:price]}, monthly" + end + %{Choose} + end + end +%> +
Free$<%= Site::PLAN_FEATURES[:free][:price] %>/mo - Choose + <%== plan_pricing_button :free %> |
Supporter$<%= Site::PLAN_FEATURES[:supporter][:price] %>/mo - Choose + <%== plan_pricing_button :supporter %> |
Cat Bus$<%= Site::PLAN_FEATURES[:catbus][:price] %>/mo - Choose + <%== plan_pricing_button :catbus %> |
Fat Cat$<%= Site::PLAN_FEATURES[:fatcat][:price] %>/mo - Choose + <%== plan_pricing_button :fatcat %> |
---|
- You currently have the <%= parent_site.plan_name %> (<%= parent_site.maximum_space.to_space_pretty %>) - <%= @plan_name %>. -
-- If you need to end the plan, you can do that here. We'll be sorry to see you go. If there's a reason you're ending that we can help with, please contact us and we'll see if we can help you with your issue. Regardless, we'll let you keep your site and the extra space. We hope you'll decide to become a supporter again in the future! -
- - <% if @error %> -<%= @error %>
-- You currently have the <%= parent_site.plan_name %> (<%= parent_site.maximum_space.to_space_pretty %>). -
-- Your support means a lot to us. On behalf of Penelope the cat and everyone at Neocities, thank you. If there's anything we can do to make your experience even better, please don't hesitate to contact us. -
- - Manage plan - <% else %> - <% if parent_site %> -You currently have the Free Plan (<%= parent_site.maximum_space.to_space_pretty %>). Need more space? Become a Neocities Supporter!
- -The Neocities Supporter Plan is a way to help sustain the site. When you join the Supporter Plan, you are directly helping our quest to bring back the creative, independent web, and to continue to improve Neocities for everyone. -
-If you would like to become a Neocities Supporter, Sign In and click the Settings link. If you haven't created a site yet, create your web site now! We would love if you became a Supporter, but base sites on Neocities will always be free.
- <% else %> -- Prefer to not use a credit card? Neocities has many other ways to become a supporter! Click here to learn about other ways to contribute. We accept PayPal, Bitcoin and Gittip, and will be happy to upgrade your account for you if you contribute and contact us with your site username. -
-- You currently have the <%= parent_site.plan_name %> (<%= parent_site.maximum_space.to_space_pretty %>) - <%= @plan_name %>. -
- - End plan -