add stripe integration for safebooru
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -45,6 +45,7 @@ gem 'capistrano-ext'
|
|||||||
gem 'radix62', '~> 1.0.1'
|
gem 'radix62', '~> 1.0.1'
|
||||||
gem 'streamio-ffmpeg'
|
gem 'streamio-ffmpeg'
|
||||||
gem 'rubyzip', :require => "zip"
|
gem 'rubyzip', :require => "zip"
|
||||||
|
gem 'stripe', :git => "https://github.com/stripe/stripe-ruby"
|
||||||
|
|
||||||
# needed for looser jpeg header compat
|
# needed for looser jpeg header compat
|
||||||
gem 'ruby-imagespec', :require => "image_spec", :git => "https://github.com/r888888888/ruby-imagespec.git", :branch => "exif-fixes"
|
gem 'ruby-imagespec', :require => "image_spec", :git => "https://github.com/r888888888/ruby-imagespec.git", :branch => "exif-fixes"
|
||||||
|
|||||||
14
Gemfile.lock
14
Gemfile.lock
@@ -14,6 +14,15 @@ GIT
|
|||||||
specs:
|
specs:
|
||||||
ruby-imagespec (0.3.1)
|
ruby-imagespec (0.3.1)
|
||||||
|
|
||||||
|
GIT
|
||||||
|
remote: https://github.com/stripe/stripe-ruby
|
||||||
|
revision: da216fd53b7a5386c136e93bdfe5efaff20682b7
|
||||||
|
specs:
|
||||||
|
stripe (1.16.0)
|
||||||
|
json (~> 1.8.1)
|
||||||
|
mime-types (>= 1.25, < 3.0)
|
||||||
|
rest-client (~> 1.4)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
@@ -131,6 +140,7 @@ GEM
|
|||||||
net-ssh (2.8.0)
|
net-ssh (2.8.0)
|
||||||
net-ssh-gateway (1.2.0)
|
net-ssh-gateway (1.2.0)
|
||||||
net-ssh (>= 2.6.5)
|
net-ssh (>= 2.6.5)
|
||||||
|
netrc (0.8.0)
|
||||||
newrelic_rpm (3.9.6.257)
|
newrelic_rpm (3.9.6.257)
|
||||||
nokogiri (1.6.1)
|
nokogiri (1.6.1)
|
||||||
mini_portile (~> 0.5.0)
|
mini_portile (~> 0.5.0)
|
||||||
@@ -168,6 +178,9 @@ GEM
|
|||||||
raindrops (0.13.0)
|
raindrops (0.13.0)
|
||||||
rake (10.3.2)
|
rake (10.3.2)
|
||||||
ref (1.0.5)
|
ref (1.0.5)
|
||||||
|
rest-client (1.7.2)
|
||||||
|
mime-types (>= 1.16, < 3.0)
|
||||||
|
netrc (~> 0.7)
|
||||||
rmagick (2.13.3)
|
rmagick (2.13.3)
|
||||||
ruby-prof (0.14.2)
|
ruby-prof (0.14.2)
|
||||||
rubyzip (1.1.6)
|
rubyzip (1.1.6)
|
||||||
@@ -284,6 +297,7 @@ DEPENDENCIES
|
|||||||
sprockets-rails
|
sprockets-rails
|
||||||
statistics2
|
statistics2
|
||||||
streamio-ffmpeg
|
streamio-ffmpeg
|
||||||
|
stripe!
|
||||||
term-ansicolor
|
term-ansicolor
|
||||||
therubyracer
|
therubyracer
|
||||||
timecop
|
timecop
|
||||||
|
|||||||
@@ -87,6 +87,10 @@ div#c-users {
|
|||||||
max-width: 40em;
|
max-width: 40em;
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
|
|
||||||
|
form.stripe {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
div#feature-comparison {
|
div#feature-comparison {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
|
|||||||
49
app/controllers/user_upgrades_controller.rb
Normal file
49
app/controllers/user_upgrades_controller.rb
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
class UserUpgradesController < ApplicationController
|
||||||
|
before_filter :member_only
|
||||||
|
|
||||||
|
def create
|
||||||
|
if params[:desc] == "Upgrade to Gold"
|
||||||
|
level = User::Levels::GOLD
|
||||||
|
cost = 2000
|
||||||
|
|
||||||
|
elsif params[:desc] == "Upgrade to Platinum"
|
||||||
|
level = User::Levels::PLATINUM
|
||||||
|
cost = 4000
|
||||||
|
|
||||||
|
elsif params[:desc] == "Upgrade Gold to Platinum" && CurrentUser.user.level == User::Levels::GOLD
|
||||||
|
level = User::Levels::PLATINUM
|
||||||
|
cost = 2000
|
||||||
|
|
||||||
|
else
|
||||||
|
raise "Invalid desc"
|
||||||
|
end
|
||||||
|
|
||||||
|
@user = CurrentUser.user
|
||||||
|
stripe_token = params[:stripeToken]
|
||||||
|
|
||||||
|
begin
|
||||||
|
charge = Stripe::Charge.create(
|
||||||
|
:amount => cost,
|
||||||
|
:currency => "usd",
|
||||||
|
:card => params[:stripeToken],
|
||||||
|
:description => params[:desc]
|
||||||
|
)
|
||||||
|
@user.promote_to!(level, :skip_feedback => true)
|
||||||
|
UserMailer.upgrade(@user, params[:email]).deliver
|
||||||
|
flash[:success] = true
|
||||||
|
rescue Stripe::CardError => e
|
||||||
|
flash[:error] = e.message
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to user_upgrade_path
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
unless CurrentUser.user.is_anonymous?
|
||||||
|
TransactionLogItem.record_account_upgrade_view(CurrentUser.user, request.referer)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -59,24 +59,6 @@ class UsersController < ApplicationController
|
|||||||
respond_with(@user)
|
respond_with(@user)
|
||||||
end
|
end
|
||||||
|
|
||||||
def upgrade_information
|
|
||||||
unless CurrentUser.user.is_anonymous?
|
|
||||||
TransactionLogItem.record_account_upgrade_view(CurrentUser.user, request.referer)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def upgrade
|
|
||||||
@user = User.find(params[:id])
|
|
||||||
|
|
||||||
if params[:email] =~ /paypal/
|
|
||||||
UserMailer.upgrade_fail(params[:email]).deliver
|
|
||||||
else
|
|
||||||
UserMailer.upgrade(@user, params[:email]).deliver
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_to user_path(@user), :notice => "Email was sent"
|
|
||||||
end
|
|
||||||
|
|
||||||
def cache
|
def cache
|
||||||
@user = User.find(params[:id])
|
@user = User.find(params[:id])
|
||||||
@user.update_cache
|
@user.update_cache
|
||||||
|
|||||||
20
app/helpers/user_upgrades_helper.rb
Normal file
20
app/helpers/user_upgrades_helper.rb
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
module UserUpgradesHelper
|
||||||
|
def stripe_button(desc, cost)
|
||||||
|
html = %{
|
||||||
|
<form action="#{user_upgrade_path}" method="POST" class="stripe">
|
||||||
|
<input type="hidden" name="authenticity_token" value="#{form_authenticity_token}">
|
||||||
|
#{hidden_field_tag(:desc, desc)}
|
||||||
|
<script
|
||||||
|
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
|
||||||
|
data-key="#{Danbooru.config.stripe_publishable_key}"
|
||||||
|
data-name="#{Danbooru.config.app_name}"
|
||||||
|
data-description="#{desc}"
|
||||||
|
data-label="#{desc}"
|
||||||
|
data-amount="#{cost}">
|
||||||
|
</script>
|
||||||
|
</form>
|
||||||
|
}
|
||||||
|
|
||||||
|
raw(html)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -74,7 +74,7 @@ class CurrentUser
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.set_safe_mode(req)
|
def self.set_safe_mode(req)
|
||||||
if req.host =~ /safe/
|
if req.host =~ /safe/ || req.params[:safe_mode]
|
||||||
Thread.current[:safe_mode] = true
|
Thread.current[:safe_mode] = true
|
||||||
else
|
else
|
||||||
Thread.current[:safe_mode] = false
|
Thread.current[:safe_mode] = false
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
class UserPromotion
|
class UserPromotion
|
||||||
attr_reader :user, :promoter, :new_level
|
attr_reader :user, :promoter, :new_level, :options
|
||||||
|
|
||||||
def initialize(user, promoter, new_level)
|
def initialize(user, promoter, new_level, options = {})
|
||||||
@user = user
|
@user = user
|
||||||
@promoter = promoter
|
@promoter = promoter
|
||||||
@new_level = new_level
|
@new_level = new_level
|
||||||
|
@options = options
|
||||||
end
|
end
|
||||||
|
|
||||||
def promote!
|
def promote!
|
||||||
@@ -14,7 +15,7 @@ class UserPromotion
|
|||||||
user.inviter_id = promoter.id
|
user.inviter_id = promoter.id
|
||||||
|
|
||||||
create_transaction_log_item
|
create_transaction_log_item
|
||||||
create_user_feedback
|
create_user_feedback unless options[:skip_feedback]
|
||||||
create_dmail
|
create_dmail
|
||||||
|
|
||||||
user.save
|
user.save
|
||||||
|
|||||||
@@ -271,8 +271,8 @@ class User < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def promote_to!(new_level)
|
def promote_to!(new_level, options = {})
|
||||||
UserPromotion.new(self, CurrentUser.user, new_level).promote!
|
UserPromotion.new(self, CurrentUser.user, new_level, options).promote!
|
||||||
end
|
end
|
||||||
|
|
||||||
def promote_to_admin_if_first_user
|
def promote_to_admin_if_first_user
|
||||||
|
|||||||
8
app/views/user_upgrades/_stripe_payment.html.erb
Normal file
8
app/views/user_upgrades/_stripe_payment.html.erb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<p><strong>Upgrading from Gold to Platinum will only cost $20.</strong> If you have any further questions or concerns, feel free to contact me at <%= mail_to Danbooru.config.contact_email, nil, :encode => :javascript %>.</p>
|
||||||
|
|
||||||
|
<% if CurrentUser.user.level < User::Levels::GOLD %>
|
||||||
|
<%= stripe_button("Upgrade to Gold", 2000) %>
|
||||||
|
<%= stripe_button("Upgrade to Platinum", 4000) %>
|
||||||
|
<% elsif CurrentUser.user.level < User::Levels::PLATINUM %>
|
||||||
|
<%= stripe_button("Upgrade Gold to Platinum", 2000) %>
|
||||||
|
<% end %>
|
||||||
1
app/views/user_upgrades/_unavailable_payment.html.erb
Normal file
1
app/views/user_upgrades/_unavailable_payment.html.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<p>You can upgrade your account at <%= link_to "Safebooru", new_user_upgrade_path(:protocol => "https", :host => "safebooru.donmai.us", :only_path => false) %>.</p>
|
||||||
98
app/views/user_upgrades/new.html.erb
Normal file
98
app/views/user_upgrades/new.html.erb
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
<div id="c-users">
|
||||||
|
<div id="a-upgrade-information">
|
||||||
|
<h1>Upgrade Your Account</h1>
|
||||||
|
|
||||||
|
<p class="copy">Annoyed by ads? Want more searching power? Upgrade your account and become a power user of the best database of anime artwork on the internet.</p>
|
||||||
|
|
||||||
|
<div id="feature-comparison">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>Basic</th>
|
||||||
|
<th>Gold</th>
|
||||||
|
<th>Platinum</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<colgroup id="labels"></colgroup>
|
||||||
|
<colgroup id="basic"></colgroup>
|
||||||
|
<colgroup id="gold"></colgroup>
|
||||||
|
<colgroup id="platinum"></colgroup>
|
||||||
|
<tr>
|
||||||
|
<td>Cost</td>
|
||||||
|
<td>Free</td>
|
||||||
|
<td>$20<p class="cost-footnote">One time fee</p></td>
|
||||||
|
<td>$40<p class="cost-footnote">One time fee</p></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Tag Limit</td>
|
||||||
|
<td>2</td>
|
||||||
|
<td>6</td>
|
||||||
|
<td>12</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Favorite Limit</td>
|
||||||
|
<td>10,000</td>
|
||||||
|
<td>20,000</td>
|
||||||
|
<td>Unlimited</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Page Limit</td>
|
||||||
|
<td>1,000</td>
|
||||||
|
<td>2,000</td>
|
||||||
|
<td>5,000</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Tag Subscriptions</td>
|
||||||
|
<td>No</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>See Censored Tags</td>
|
||||||
|
<td>No</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>API Hourly Limit</td>
|
||||||
|
<td>3,000</td>
|
||||||
|
<td>10,000</td>
|
||||||
|
<td>20,000</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Database Timeout</td>
|
||||||
|
<td>3 sec</td>
|
||||||
|
<td>6 sec</td>
|
||||||
|
<td>9 sec</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Variable Posts Per Page</td>
|
||||||
|
<td>No</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Name Changes</td>
|
||||||
|
<td>No</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% if CurrentUser.safe_mode? %>
|
||||||
|
<%= render "stripe_payment" %>
|
||||||
|
<% else %>
|
||||||
|
<%= render "unavailable_payment" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= render "users/secondary_links" %>
|
||||||
|
|
||||||
|
<% content_for(:page_title) do %>
|
||||||
|
Upgrade - <%= Danbooru.config.app_name %>
|
||||||
|
<% end %>
|
||||||
22
app/views/user_upgrades/show.html.erb
Normal file
22
app/views/user_upgrades/show.html.erb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<div id="c-users">
|
||||||
|
<div id="a-upgrade-result">
|
||||||
|
<% if flash[:disable] %>
|
||||||
|
<p>You can upgrade your account at <%= link_to "Safebooru", new_user_upgrade_path(:protocol => "https", :host => "safebooru.donmai.us", :only_path => false) %>.</p>
|
||||||
|
<% elsif flash[:success] %>
|
||||||
|
<h1>Congradulations!</h1>
|
||||||
|
|
||||||
|
<p>You are now a <%= CurrentUser.user.level_string %> level account. Thanks for supporting the site!</p>
|
||||||
|
<p><%= link_to "Return to posts", posts_path %> </p>
|
||||||
|
<% elsif flash[:error] %>
|
||||||
|
<h1>An error occurred!</h1>
|
||||||
|
<p><%= flash[:error] %></p>
|
||||||
|
<p><%= link_to "Try again", new_user_upgrade_path %></p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= render "users/secondary_links" %>
|
||||||
|
|
||||||
|
<% content_for(:page_title) do %>
|
||||||
|
Upgrade - <%= Danbooru.config.app_name %>
|
||||||
|
<% end %>
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
<li><%= link_to "Send message", new_dmail_path(:dmail => {:to_id => @user.id}) %></li>
|
<li><%= link_to "Send message", new_dmail_path(:dmail => {:to_id => @user.id}) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if !CurrentUser.is_gold? %>
|
<% if CurrentUser.is_member? || CurrentUser.is_gold? %>
|
||||||
<li><%= link_to "Upgrade", upgrade_information_users_path %></li>
|
<li><%= link_to "Upgrade", new_user_upgrade_path %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if CurrentUser.is_moderator? %>
|
<% if CurrentUser.is_moderator? %>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="ui-corner-all ui-state-highlight" id="upgrade-account-notice">
|
<div class="ui-corner-all ui-state-highlight" id="upgrade-account-notice">
|
||||||
<h1><%= link_to "Upgrade your account for only $20!", upgrade_information_users_path %></h1>
|
<h1><%= link_to "Upgrade your account for only $20!", new_user_upgrade_path %></h1>
|
||||||
<p><%= link_to "No thanks", "#", :id => "hide-upgrade-account-notice" %></p>
|
<p><%= link_to "No thanks", "#", :id => "hide-upgrade-account-notice" %></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,94 @@
|
|||||||
<div id="a-upgrade-information">
|
<div id="a-upgrade-information">
|
||||||
<h1>Upgrade Your Account</h1>
|
<h1>Upgrade Your Account</h1>
|
||||||
|
|
||||||
<p>Upgrades are currently not available.</p>
|
<p class="copy">Annoyed by ads? Want more searching power? Upgrade your account and become a power user of the best database of anime artwork on the internet.</p>
|
||||||
|
|
||||||
|
<div id="feature-comparison">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>Basic</th>
|
||||||
|
<th>Gold</th>
|
||||||
|
<th>Platinum</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<colgroup id="labels"></colgroup>
|
||||||
|
<colgroup id="basic"></colgroup>
|
||||||
|
<colgroup id="gold"></colgroup>
|
||||||
|
<colgroup id="platinum"></colgroup>
|
||||||
|
<tr>
|
||||||
|
<td>Cost</td>
|
||||||
|
<td>Free</td>
|
||||||
|
<td>$20<p class="cost-footnote">One time fee</p></td>
|
||||||
|
<td>$40<p class="cost-footnote">One time fee</p></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Tag Limit</td>
|
||||||
|
<td>2</td>
|
||||||
|
<td>6</td>
|
||||||
|
<td>12</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Favorite Limit</td>
|
||||||
|
<td>10,000</td>
|
||||||
|
<td>20,000</td>
|
||||||
|
<td>Unlimited</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Page Limit</td>
|
||||||
|
<td>1,000</td>
|
||||||
|
<td>2,000</td>
|
||||||
|
<td>5,000</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Tag Subscriptions</td>
|
||||||
|
<td>No</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>See Censored Tags</td>
|
||||||
|
<td>No</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>API Hourly Limit</td>
|
||||||
|
<td>3,000</td>
|
||||||
|
<td>10,000</td>
|
||||||
|
<td>20,000</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Database Timeout</td>
|
||||||
|
<td>3 sec</td>
|
||||||
|
<td>6 sec</td>
|
||||||
|
<td>9 sec</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Variable Posts Per Page</td>
|
||||||
|
<td>No</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Name Changes</td>
|
||||||
|
<td>No</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<p><strong>Upgrading from Gold to Platinum will only cost $20.</strong> If you have any further questions or concerns, feel free to contact me at <%= mail_to Danbooru.config.contact_email, nil, :encode => :javascript %>.</p>
|
||||||
|
|
||||||
|
<% if true || CurrentUser.user.level < User::Levels::GOLD %>
|
||||||
|
<%= stripe_button("Upgrade to Gold", 2000) %>
|
||||||
|
<%= stripe_button("Upgrade to Platinum", 4000) %>
|
||||||
|
<% elsif CurrentUser.user.level < User::Levels::PLATINUM %>
|
||||||
|
<%= stripe_button("Upgrade Gold to Platinum", 2000) %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,11 @@ module Danbooru
|
|||||||
|
|
||||||
# The name of this Danbooru.
|
# The name of this Danbooru.
|
||||||
def app_name
|
def app_name
|
||||||
"Danbooru"
|
if CurrentUser.safe_mode?
|
||||||
|
"Safebooru"
|
||||||
|
else
|
||||||
|
"Danbooru"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# The hostname of the server.
|
# The hostname of the server.
|
||||||
@@ -322,5 +326,13 @@ module Danbooru
|
|||||||
def shared_dir_path
|
def shared_dir_path
|
||||||
"/var/www/danbooru2/shared"
|
"/var/www/danbooru2/shared"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def stripe_secret_key
|
||||||
|
"sk_test_kHviyCxbt9kBxeu46TeefJQH"
|
||||||
|
end
|
||||||
|
|
||||||
|
def stripe_publishable_key
|
||||||
|
"pk_test_5lKN65jYpUw8EActq8RMkQxH"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
1
config/initializers/stripe.rb
Normal file
1
config/initializers/stripe.rb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Stripe.api_key = Danbooru.config.stripe_secret_key
|
||||||
@@ -234,16 +234,15 @@ Rails.application.routes.draw do
|
|||||||
resources :uploads
|
resources :uploads
|
||||||
resources :users do
|
resources :users do
|
||||||
collection do
|
collection do
|
||||||
get :upgrade_information
|
|
||||||
get :search
|
get :search
|
||||||
get :custom_style
|
get :custom_style
|
||||||
end
|
end
|
||||||
|
|
||||||
member do
|
member do
|
||||||
delete :cache
|
delete :cache
|
||||||
post :upgrade
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
resource :user_upgrade, :only => [:new, :create, :show]
|
||||||
resources :user_feedbacks do
|
resources :user_feedbacks do
|
||||||
collection do
|
collection do
|
||||||
get :search
|
get :search
|
||||||
|
|||||||
7
test/controllers/user_upgrades_controller_test.rb
Normal file
7
test/controllers/user_upgrades_controller_test.rb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class UserUpgradesControllerTest < ActionController::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user