mirror of
https://github.com/neocities/neocities.git
synced 2025-08-27 03:13:26 +02:00
implement skeuocard and upgrade capability
This commit is contained in:
parent
f2180b1385
commit
d2f46fdf66
41 changed files with 304 additions and 42 deletions
36
app.rb
36
app.rb
|
@ -267,6 +267,42 @@ get '/plan/?' do
|
|||
erb :'plan/index'
|
||||
end
|
||||
|
||||
post '/plan/update' do
|
||||
require_login
|
||||
|
||||
DB.transaction do
|
||||
customer = Stripe::Customer.create(
|
||||
card: params[:stripe_token],
|
||||
description: "#{parent_site.username} - #{parent_site.id}",
|
||||
email: (current_site.email || parent_site.email),
|
||||
plan: params[:plan_type]
|
||||
)
|
||||
|
||||
parent_site.update(
|
||||
stripe_customer_id: customer.id,
|
||||
plan_ended: false,
|
||||
plan_type: params[:plan_type]
|
||||
)
|
||||
|
||||
if current_site.email || parent_site.email
|
||||
EmailWorker.perform_async({
|
||||
from: 'web@neocities.org',
|
||||
reply_to: 'contact@neocities.org',
|
||||
to: current_site.email || parent_site.email,
|
||||
subject: "[Neocities] You've become a supporter!",
|
||||
body: Tilt.new('./views/templates/email_subscription.erb', pretty: true).render(self, plan_name: Site::PLAN_FEATURES[params[:plan_type].to_sym][:name])
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
redirect '/plan/thanks'
|
||||
end
|
||||
|
||||
get '/plan/thanks' do
|
||||
require_login
|
||||
erb :'plan/thanks'
|
||||
end
|
||||
|
||||
=begin
|
||||
get '/plan/?' do
|
||||
@title = 'Supporter'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue