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 +%> +
-

Need more power? We’ve got you covered.
Upgrading gives you more space, bandwidth, features, and helps us keep the free sites free, forever.

- +

Need more power? We’ve got you covered.
Upgrading gives you more space, bandwidth, features, and helps us stay independent and keep the free sites free.

+
@@ -10,7 +29,7 @@ Supporter
- +
@@ -18,7 +37,7 @@

Free

$<%= Site::PLAN_FEATURES[:free][:price] %>
per month
- Choose + <%== plan_pricing_button :free %>
  • <%= Site::PLAN_FEATURES[:free][:space].to_space_pretty %> storage
  • <%= Site::PLAN_FEATURES[:free][:bandwidth].to_space_pretty %> bandwidth
  • @@ -26,13 +45,13 @@
- +

Supporter

$<%= Site::PLAN_FEATURES[:supporter][:price] %>
per month, billed annually
- Choose + <%== plan_pricing_button :supporter %>
  • <%= Site::PLAN_FEATURES[:supporter][:space].to_space_pretty %> storage
  • <%= Site::PLAN_FEATURES[:supporter][:bandwidth].to_space_pretty %> bandwidth
  • @@ -42,14 +61,14 @@
  • More space
- +

Cat Bus

$<%= Site::PLAN_FEATURES[:catbus][:price] %>
per month
- Choose + <%== plan_pricing_button :catbus %>
  • <%= Site::PLAN_FEATURES[:catbus][:space].to_space_pretty %> storage
  • <%= Site::PLAN_FEATURES[:catbus][:bandwidth].to_space_pretty %> bandwidth
  • @@ -61,13 +80,13 @@
  • Even more space
- +

Fat Cat

$<%= Site::PLAN_FEATURES[:fatcat][:price] %>
per month
- Choose + <%== plan_pricing_button :fatcat %>
  • <%= Site::PLAN_FEATURES[:fatcat][:space].to_space_pretty %> storage
  • <%= Site::PLAN_FEATURES[:fatcat][:bandwidth].to_space_pretty %> bandwidth
  • @@ -79,11 +98,9 @@
  • A lot more space!
-
-
- +

Compare Plans

@@ -92,22 +109,22 @@ @@ -264,6 +281,57 @@

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 %>
+ + <% if request.path.match /\/plan/ %> +
+
+

Why get the Supporter Plan?

+
+
+ +
+
+

+ The Neocities Supporter Plans are 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. +

+
+
+ +
+
+
    +
  • + You get more space! Right now supporter plans get up to <%= Site::SUPPORTER_MAXIMUM.to_space_pretty %>. +
  • +
  • + It helps your site. Funding helps us make your site faster globally, and provide more features. +
  • +
  • + It helps us build. It allows us to work on Neocities full-time, without worrying about bills. +
  • +
  • + It helps the web. The web needs more independent, creative sites. Neocities is leading the way. +
  • +
  • + It's Open Source. Neocities is completely open source, and we share code with the community. +
  • +
  • + No lock-in. Redirecting your site is easy, free site downloads, and support for custom domains. +
  • +
  • No ads, ever. We'll never put ads or watermarks on sites, and we don't sell user data.
  • +
  • + It's safe. We use Stripe for payments, and never store your credit card information directly. +
  • +
  • + It's affordable. As low as $<%= Site::PLAN_FEATURES[:supporter][:price] %>/month (billed once every year). Higher tiers are optional (and appreciated!) +
  • +
  • + You can cancel anytime. +
  • +
+
+
+ <% end %>
\ No newline at end of file + + $(".planPricingButton").on('click', function(obj) { + $('#upgradePlanType').val($(obj.target).attr('data-plan_type')) + $('#upgradeFormPlanName').text($(obj.target).attr('data-plan_name')) + $('#upgradeFormPlanPrice').text($(obj.target).attr('data-plan_price')) + $('#planSignup').modal() + }) + + + \ No newline at end of file diff --git a/views/plan/end.erb b/views/plan/end.erb deleted file mode 100644 index 8db2f976..00000000 --- a/views/plan/end.erb +++ /dev/null @@ -1,34 +0,0 @@ -
-
-
-

End Plan

-
-
- -
-
-
- -
-

Ending the Supporter Plan

-

- 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 %>

-
- <% end %> - -
- -
- <%== recaptcha_tag :challenge, ssl: request.ssl? %> -
- -
-
\ No newline at end of file diff --git a/views/plan/index.erb b/views/plan/index.erb index 4608f14a..8ca9203e 100644 --- a/views/plan/index.erb +++ b/views/plan/index.erb @@ -1,142 +1 @@ - - - -
-
-
-

Support Neocities

-
-
- -
-
-
- -
-

- - <% if parent_site && parent_site.supporter? && !parent_site.plan_ended %> -

- 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!

- -

Why upgrade?

- <% else %> -

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. -

-

Why get the Supporter Plan?

- <% end %> - - - <% if !current_site %> -

Become a Supporter

-

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 %> -

Become a Supporter Now

- -
-
- - - - - -

- Supporter Tier: - -

- -

- Card Number: - CVC: -

-

- Expiration: - - -

- - -
-
- <% end %> - <% end %> - -

One-Time Donations

-

- 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. -

-
- - \ No newline at end of file +<%== erb :'plan/_pricing' %> \ No newline at end of file diff --git a/views/plan/manage.erb b/views/plan/manage.erb deleted file mode 100644 index a2fecc3c..00000000 --- a/views/plan/manage.erb +++ /dev/null @@ -1,19 +0,0 @@ -
-
-
-

Manage Supporter Plan

-
-
- -
-
-
- -
-

Change your Supporter Plan

-

- You currently have the <%= parent_site.plan_name %> (<%= parent_site.maximum_space.to_space_pretty %>) - <%= @plan_name %>. -

- - End plan -
\ No newline at end of file