repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/credit_card_utility.rb
lib/utilities/credit_card_utility.rb
# frozen_string_literal: true class CreditCardUtility CARD_TYPE_NAMES = { "Visa" => CardType::VISA, "American Express" => CardType::AMERICAN_EXPRESS, "MasterCard" => CardType::MASTERCARD, "Discover" => CardType::DISCOVER, "JCB" => CardType::JCB, "Diners Club" => CardType::DINERS_CLUB }.freeze CARD_TYPE_DEFAULT_LENGTHS = { CardType::UNKNOWN => 16, CardType::VISA => 16, CardType::AMERICAN_EXPRESS => 15, CardType::MASTERCARD => 16, CardType::DISCOVER => 16, CardType::JCB => 16, CardType::DINERS_CLUB => 14, CardType::UNION_PAY => 16, }.freeze class << self def card_types_for_react CARD_TYPE_NAMES.map { |name, id| { id:, name: } } end def extract_month_and_year(date) date = date.delete(" ") if date.split("/").length == 2 month = date.split("/")[0] year = date.split("/")[1] elsif date.length == 4 month = date[0..1] year = date[2..3] elsif date.length == 5 month = date[0..1] year = date[3..4] end [month, year] end end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/card_type.rb
lib/utilities/card_type.rb
# frozen_string_literal: true class CardType UNKNOWN = "generic_card" VISA = "visa" AMERICAN_EXPRESS = "amex" MASTERCARD = "mastercard" DISCOVER = "discover" JCB = "jcb" DINERS_CLUB = "diners" PAYPAL = "paypal" UNION_PAY = "unionpay" end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/utilities/with_max_execution_time.rb
lib/utilities/with_max_execution_time.rb
# frozen_string_literal: true module WithMaxExecutionTime # NOTE: Rails >= 6.0.0.rc1 supports Optimizer hints. Consider using them instead if available. class QueryTimeoutError < Timeout::Error; end def self.timeout_queries(seconds:) connection = ActiveRecord::Base.connection previous_max_execution_time = connection.execute("select @@max_execution_time").to_a[0][0] max_execution_time = (seconds * 1000).to_i connection.execute("set max_execution_time = #{max_execution_time}") yield rescue ActiveRecord::StatementInvalid => e if e.message.include?("maximum statement execution time exceeded") raise QueryTimeoutError.new(e.message) else raise end ensure connection.execute("set max_execution_time = #{previous_max_execution_time}") end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/extras/bugsnag_handle_sidekiq_retries_callback.rb
lib/extras/bugsnag_handle_sidekiq_retries_callback.rb
# frozen_string_literal: true BugsnagHandleSidekiqRetriesCallback = proc do |report| sidekiq_data = report.meta_data[:sidekiq] next if sidekiq_data.nil? msg = sidekiq_data[:msg] # When a worker does not have an explicit "retry" option configured, configured_retries => `true`. # We can't use this to determine whether this is the last attempt or not. configured_retries = msg["retry"] next unless configured_retries.is_a?(Integer) # retry_count is nil for the first attempt, then 0, 1, etc. retry_count = msg["retry_count"] # if retry_count is nil (first attempt) and retry is 0, this is the last attempt. last_attempt = retry_count.nil? && configured_retries == 0 # if retry is equal to (zero indexed) retry_count, this is the last attempt. last_attempt |= retry_count.present? && configured_retries == retry_count + 1 report.ignore! unless last_attempt end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/extras/sidekiq_makara_reset_context_middleware.rb
lib/extras/sidekiq_makara_reset_context_middleware.rb
# frozen_string_literal: true # There are places in the codebase sticking the DB connection to master instead of replicas. # Makara, via an included Rack middleware, resets those contexts before each web request (after master_ttl). # This automatic reset doesn't exist for Sidekiq, so a thread executing many jobs may be stuck on master forever. # This Sidekiq Middleware ensures that the context is reset before executing each job. # https://github.com/taskrabbit/makara/blob/dac6be2e01e0511db6715b2b4da65a5490e01cba/README.md#releasing-stuck-connections-clearing-context class SidekiqMakaraResetContextMiddleware def call(worker, job, queue) Makara::Context.release_all yield end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/extras/mongoer.rb
lib/extras/mongoer.rb
# frozen_string_literal: true class Mongoer def self.substitute_keys(hash) hash.keys.each do |key| if hash[key].is_a? Hash substitute_keys(hash[key]) elsif hash[key].is_a? Array hash[key].each do |element| substitute_keys(element) if element.is_a? Hash end end if key.to_s.index(/\.|\$/).present? hash[key.to_s.gsub(".", "U+FFOE").gsub("$", "U+FF04")] = hash[key] hash.delete(key) end end end def self.safe_write(collection, doc) substitute_keys(doc) MONGO_DATABASE[collection].insert_one(doc) end def self.safe_update(collection, conditions, doc) substitute_keys(doc) MONGO_DATABASE[collection].find(conditions).update_one("$set" => doc) end def self.async_write(collection, doc) SaveToMongoWorker.perform_async(collection, doc) rescue Encoding::UndefinedConversionError => e Rails.logger.error("Encoding::UndefinedConversionError queueing SaveToMongo for collection #{collection}\nwith error:\n#{e.inspect}\nwith doc:\n#{doc}") end def self.async_update(collection, conditions, doc) UpdateInMongoWorker.perform_async(collection, conditions, doc) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/post_resend_api_preview.rb
lib/mailer_previews/post_resend_api_preview.rb
# frozen_string_literal: true class PostResendApiPreview < ActionMailer::Preview def post_with_attachment post = Installment.joins(:product_files).find_each(order: :desc).find(&:has_files?) post ||= begin record = create_generic_post record.product_files.create!(url: "#{AWS_S3_ENDPOINT}/gumroad_dev/test", filetype: "pdf", filegroup: "document") record end build_mail(post:, recipient: { url_redirect: UrlRedirect.find_or_create_by!(installment: post, purchase: nil) }) end def post_not_shown_on_profile post = Installment.not_shown_on_profile.left_joins(:product_files).where(product_files: { id: nil }).last post ||= create_generic_post(shown_on_profile: false) build_mail(post:) end def commentable_post post = Installment.shown_on_profile.allow_comments.left_joins(:product_files).where(product_files: { id: nil }).last post ||= create_generic_post(shown_on_profile: true, allow_comments: true) build_mail(post:) end def product_post post = Installment.joins(seller: { sales: :url_redirect }).where(installment_type: Installment::PRODUCT_TYPE).last post ||= begin user = User.first! product = user.products.create!(name: "some product", price_cents: 0) purchase = Purchase.new(email: "foo@example.com", link: product, seller: user) purchase.prepare_for_charge! purchase.save! purchase.create_url_redirect! create_generic_post(installment_type: Installment::PRODUCT_TYPE, link: product, bought_products: [product.unique_permalink]) end purchase = post.seller&.sales&.last url_redirect = purchase&.url_redirect build_mail(post:, recipient: { purchase:, url_redirect: }) end def for_customer post = Installment.joins(seller: { sales: :url_redirect }).where(installment_type: Installment::SELLER_TYPE).last post ||= begin user = User.first! product = user.products.create!(name: "some product", price_cents: 0) purchase = Purchase.new(email: "foo@example.com", link: product, seller: user) purchase.prepare_for_charge! purchase.save! purchase.create_url_redirect! create_generic_post(installment_type: Installment::SELLER_TYPE) end purchase = post.seller&.sales&.last url_redirect = purchase&.url_redirect build_mail(post:, recipient: { purchase:, url_redirect: }) end def for_follower post = Installment.where(installment_type: Installment::FOLLOWER_TYPE).left_joins(:product_files).where(product_files: { id: nil }).joins(seller: :followers).last post ||= begin user = User.first! user.followers.active.last || user.followers.create!(email: "foo@example.com", confirmed_at: Time.current) create_generic_post(installment_type: Installment::FOLLOWER_TYPE) end follower = post.seller&.followers&.last build_mail(post:, recipient: { follower: }) end def for_affiliate post = Installment.where(installment_type: Installment::AFFILIATE_TYPE).left_joins(:product_files).where(product_files: { id: nil }).joins(seller: :direct_affiliates).last post ||= begin user = User.first! user.direct_affiliates.last || user.direct_affiliates.create!(affiliate_user: User.second!, affiliate_basis_points: 1000) create_generic_post(installment_type: Installment::AFFILIATE_TYPE) end affiliate = post.seller&.direct_affiliates&.last build_mail(post:, recipient: { affiliate: }) end private def build_mail(post:, recipient: {}) recipients = [{ email: "foo@example.com" }.merge(recipient)] PostResendApi.new(post:, recipients:, preview: true).send_emails email_address = recipients.first[:email] details = PostResendApi.mails.fetch(email_address) mail = Mail.new mail.subject = details[:subject] mail.from = details[:from] mail.reply_to = details[:reply_to] mail.to = email_address mail.headers({ skip_premailer: true }) mail.part content_type: "multipart/alternative", content_disposition: "inline" do |multipart| multipart.part content_type: "text/html", body: details[:content] end mail end def create_generic_post(extra_attributes = {}) Installment.create!({ seller: User.first!, name: "Generic post", message: "Some post content<br>Some <i>more</i> content", installment_type: Installment::AUDIENCE_TYPE, send_emails: true, shown_on_profile: true, }.merge(extra_attributes)) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/admin_mailer_preview.rb
lib/mailer_previews/admin_mailer_preview.rb
# frozen_string_literal: true class AdminMailerPreview < ActionMailer::Preview def chargeback_notify AdminMailer.chargeback_notify(Purchase.last.id) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/customer_low_priority_mailer_preview.rb
lib/mailer_previews/customer_low_priority_mailer_preview.rb
# frozen_string_literal: true class CustomerLowPriorityMailerPreview < ActionMailer::Preview def credit_card_expiring_membership CustomerLowPriorityMailer.credit_card_expiring_membership(Subscription.last&.id) end def deposit CustomerLowPriorityMailer.deposit(Payment.last&.id) end def preorder_cancelled CustomerLowPriorityMailer.preorder_cancelled(Preorder.authorization_successful.last&.id) end def preorder_card_declined CustomerLowPriorityMailer.preorder_card_declined(Preorder.authorization_successful.last&.id) end def subscription_autocancelled CustomerLowPriorityMailer.subscription_autocancelled(Subscription.last&.id) end def subscription_cancelled Subscription.last&.link&.update_attribute(:subscription_duration, :monthly) CustomerLowPriorityMailer.subscription_cancelled(Subscription.last&.id) end def subscription_cancelled_by_seller CustomerLowPriorityMailer.subscription_cancelled_by_seller(Subscription.last&.id) end def subscription_ended CustomerLowPriorityMailer.subscription_ended(Subscription.last&.id) end def subscription_card_declined CustomerLowPriorityMailer.subscription_card_declined(Subscription.last&.id) end def subscription_card_declined_warning CustomerLowPriorityMailer.subscription_card_declined_warning(Subscription.last&.id) end def subscription_charge_failed CustomerLowPriorityMailer.subscription_charge_failed(Subscription.last&.id) end def subscription_product_deleted CustomerLowPriorityMailer.subscription_product_deleted(Subscription.last&.id) end def subscription_renewal_reminder CustomerLowPriorityMailer.subscription_renewal_reminder(Subscription.last&.id) end def subscription_price_change_notification CustomerLowPriorityMailer.subscription_price_change_notification(subscription_id: Subscription.last&.id, new_price: 15_99) end def subscription_early_fraud_warning_notification CustomerLowPriorityMailer.subscription_early_fraud_warning_notification(Subscription.last&.purchases&.last&.id) end def subscription_giftee_added_card purchase = Purchase.successful.is_gift_sender_purchase.where.not(subscription_id: nil).last subscription = purchase&.subscription CustomerLowPriorityMailer.subscription_giftee_added_card(subscription&.id) end def rental_expiring_soon purchase = Purchase.joins(:url_redirect).last CustomerLowPriorityMailer.rental_expiring_soon(purchase&.id, 60 * 60 * 24) end def order_shipped_with_tracking purchase = Link.first&.sales&.last shipment = Shipment.create(purchase:, tracking_url: "https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=1234567890", carrier: "USPS") shipment.mark_shipped CustomerLowPriorityMailer.order_shipped(shipment.id) end def order_shipped purchase = Link.first&.sales&.last shipment = Shipment.create(purchase:) shipment.mark_shipped CustomerLowPriorityMailer.order_shipped(shipment.id) end def chargeback_notice_to_customer CustomerLowPriorityMailer.chargeback_notice_to_customer(Purchase.last&.id) end def free_trial_expiring_soon sub = Subscription.where.not(free_trial_ends_at: nil).take CustomerLowPriorityMailer.free_trial_expiring_soon(sub&.id) end def purchase_review_reminder purchase = Purchase.where.missing(:product_review).last CustomerLowPriorityMailer.purchase_review_reminder(purchase&.id) end def order_review_reminder purchase = Purchase.where.missing(:product_review).last CustomerLowPriorityMailer.order_review_reminder(purchase&.order&.id) end def bundle_content_updated purchase = Purchase.is_bundle_purchase.last CustomerLowPriorityMailer.bundle_content_updated(purchase&.id) end def wishlist_updated wishlist_follower = WishlistFollower.alive.last CustomerLowPriorityMailer.wishlist_updated(wishlist_follower&.id, wishlist_follower&.wishlist&.wishlist_products&.alive&.count || 0) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/accounting_mailer_preview.rb
lib/mailer_previews/accounting_mailer_preview.rb
# frozen_string_literal: true class AccountingMailerPreview < ActionMailer::Preview def email_outstanding_balances_csv AccountingMailer.email_outstanding_balances_csv end def funds_received_report last_month = Time.current.last_month AccountingMailer.funds_received_report(last_month.month, last_month.year) end def deferred_refunds_report last_month = Time.current.last_month AccountingMailer.deferred_refunds_report(last_month.month, last_month.year) end def gst_report AccountingMailer.gst_report("AU", 3, 2015, "http://www.gumroad.com") end def payable_report AccountingMailer.payable_report("http://www.gumroad.com", 2019) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/affiliate_request_mailer_preview.rb
lib/mailer_previews/affiliate_request_mailer_preview.rb
# frozen_string_literal: true class AffiliateRequestMailerPreview < ActionMailer::Preview def notify_requester_of_request_submission AffiliateRequestMailer.notify_requester_of_request_submission(AffiliateRequest.last&.id) end def notify_seller_of_new_request AffiliateRequestMailer.notify_seller_of_new_request(AffiliateRequest.last&.id) end def notify_requester_of_request_approval AffiliateRequestMailer.notify_requester_of_request_approval(AffiliateRequest.last&.id) end def notify_unregistered_requester_of_request_approval AffiliateRequestMailer.notify_unregistered_requester_of_request_approval(AffiliateRequest.last&.id) end def notify_requester_of_ignored_request AffiliateRequestMailer.notify_requester_of_ignored_request(AffiliateRequest.last&.id) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/comment_mailer_preview.rb
lib/mailer_previews/comment_mailer_preview.rb
# frozen_string_literal: true class CommentMailerPreview < ActionMailer::Preview def notify_seller_of_new_comment CommentMailer.notify_seller_of_new_comment(Comment.roots.last&.id) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/two_factor_authentication_mailer_preview.rb
lib/mailer_previews/two_factor_authentication_mailer_preview.rb
# frozen_string_literal: true class TwoFactorAuthenticationMailerPreview < ActionMailer::Preview def authentication_token TwoFactorAuthenticationMailer.authentication_token(User.where.not(email: nil).last&.id) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/merchant_registration_mailer_preview.rb
lib/mailer_previews/merchant_registration_mailer_preview.rb
# frozen_string_literal: true class MerchantRegistrationMailerPreview < ActionMailer::Preview def stripe_charges_disabled MerchantRegistrationMailer.stripe_charges_disabled(User.last&.id) end def account_needs_registration_to_user MerchantRegistrationMailer.account_needs_registration_to_user(Affiliate.last&.id, StripeChargeProcessor.charge_processor_id) end def stripe_payouts_disabled MerchantRegistrationMailer.stripe_payouts_disabled(User.last&.id) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/user_signup_mailer_preview.rb
lib/mailer_previews/user_signup_mailer_preview.rb
# frozen_string_literal: true class UserSignupMailerPreview < ActionMailer::Preview def confirmation_instructions UserSignupMailer.confirmation_instructions(User.last, {}) end def reset_password_instructions User.last&.mark_compliant!(author_name: "Gullible Admin") UserSignupMailer.reset_password_instructions(User.last, {}) end def reset_password_instructions_for_suspended_user User.last&.mark_compliant! User.last&.flag_for_fraud!(author_name: "Suspicious Admin") User.last&.suspend_for_fraud!(author_name: "Suspicious Admin") UserSignupMailer.reset_password_instructions(User.first, {}) end def email_changed User.last&.update_attribute(:unconfirmed_email, "new+email@example.com") UserSignupMailer.email_changed(User.last, {}) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/affiliate_mailer_preview.rb
lib/mailer_previews/affiliate_mailer_preview.rb
# frozen_string_literal: true class AffiliateMailerPreview < ActionMailer::Preview def direct_affiliate_invitation AffiliateMailer.direct_affiliate_invitation(DirectAffiliate.last&.id) end def notify_direct_affiliate_of_sale purchase = Purchase.where(affiliate_id: DirectAffiliate.pluck(:id)).last AffiliateMailer.notify_affiliate_of_sale(purchase&.id) end def notify_global_affiliate_of_sale purchase = Purchase.where(affiliate_id: GlobalAffiliate.pluck(:id)).last AffiliateMailer.notify_affiliate_of_sale(purchase&.id) end def notify_collaborator_of_sale purchase = Purchase.where(affiliate_id: Collaborator.pluck(:id)).last AffiliateMailer.notify_affiliate_of_sale(purchase&.id) end def notify_affiliate_of_original_subscription_sale AffiliateMailer.notify_affiliate_of_sale(Subscription.last&.original_purchase&.id) end def notify_affiliate_of_free_trial_sale AffiliateMailer.notify_affiliate_of_sale(Purchase.is_free_trial_purchase.where.not(affiliate_id: nil).last&.id) end def notify_direct_affiliate_of_updated_products AffiliateMailer.notify_direct_affiliate_of_updated_products(DirectAffiliate.last&.id) end def notify_direct_affiliate_of_new_product AffiliateMailer.notify_direct_affiliate_of_new_product(DirectAffiliate.last&.id, DirectAffiliate.last&.products&.last&.id) end def collaborator_creation AffiliateMailer.collaborator_creation(Collaborator.last&.id) end def collaborator_update AffiliateMailer.collaborator_update(Collaborator.last&.id) end def collaboration_ended_by_seller AffiliateMailer.collaboration_ended_by_seller(Collaborator.last&.id) end def collaborator_invited AffiliateMailer.collaborator_invited(Collaborator.last&.id) end def collaborator_invitation_accepted AffiliateMailer.collaborator_invitation_accepted(Collaborator.last&.id) end def collaborator_invitation_declined AffiliateMailer.collaborator_invitation_declined(Collaborator.last&.id) end def collaboration_ended_by_affiliate_user AffiliateMailer.collaboration_ended_by_affiliate_user(Collaborator.last&.id) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/customer_mailer_preview.rb
lib/mailer_previews/customer_mailer_preview.rb
# frozen_string_literal: true class CustomerMailerPreview < ActionMailer::Preview def grouped_receipt purchase_ids = Purchase.successful.order(id: :desc).limit(3).ids CustomerMailer.grouped_receipt(purchase_ids) end def giftee_receipt purchase = Gift.last&.giftee_purchase CustomerMailer.receipt(purchase&.id) end def giftee_subscription_receipt purchase = Purchase.where(purchase_state: :gift_receiver_purchase_successful).where.not(subscription_id: nil).last CustomerMailer.receipt(purchase&.id) end def giftee_shipping_receipt purchase = Purchase.where("purchase_state = ?", :gift_receiver_purchase_successful).where("city IS NOT NULL").first CustomerMailer.receipt(purchase&.id) end def gifter_receipt purchase = Gift.first&.gifter_purchase CustomerMailer.receipt(purchase&.id) end def gifter_subscription_receipt purchase = Purchase.successful.is_gift_sender_purchase.where.not(subscription_id: nil).last CustomerMailer.receipt(purchase&.id) end def physical_receipt CustomerMailer.receipt(Link.is_physical.last&.sales&.last&.id) end def physical_refund CustomerMailer.refund("sahil@gumroad.com", Link.is_physical.last&.id, Link.is_physical.last&.sales&.last&.id) end def preorder_receipt CustomerMailer.preorder_receipt(Preorder.find_by(state: "authorization_successful")&.id, Link.is_in_preorder_state.last&.id, "hi@gumroad.com") end def receipt purchase = Purchase.not_recurring_charge.not_is_gift_sender_purchase.last CustomerMailer.receipt(purchase&.id) end def receipt_custom purchase = Purchase.joins(:link).where("links.custom_receipt != ''").last CustomerMailer.receipt(purchase&.id) end def refund CustomerMailer.refund("sahil@gumroad.com", Link.last&.id, Purchase.last&.id) end def receipt_subscription_original_charge CustomerMailer.receipt(Purchase.is_original_subscription_purchase.last&.id) end def receipt_subscription_recurring_charge CustomerMailer.receipt(Purchase.recurring_charge.last&.id) end def paypal_purchase_failed CustomerMailer.paypal_purchase_failed(Purchase.last&.id) end def subscription_magic_link @subscription = Subscription.last @subscription&.refresh_token CustomerMailer.subscription_magic_link(@subscription&.id, "test@gumroad.com") end def subscription_restarted CustomerMailer.subscription_restarted(Subscription.last&.id) end def subscription_restarted_for_payment_issue CustomerMailer.subscription_restarted(Subscription.last&.id, Subscription::ResubscriptionReason::PAYMENT_ISSUE_RESOLVED) end def abandoned_cart_preview CustomerMailer.abandoned_cart_preview(User.last&.id, Installment.alive.where(installment_type: Installment::ABANDONED_CART_TYPE).last&.id) end def abandoned_cart_single_workflow cart = Cart.abandoned.last workflow = Workflow.abandoned_cart_type.published.last CustomerMailer.abandoned_cart(cart&.id, { workflow&.id => workflow&.abandoned_cart_products(only_product_and_variant_ids: true).to_h.keys }.stringify_keys, true) end def abandoned_cart_multiple_workflows cart = Cart.abandoned.last workflows = Workflow.abandoned_cart_type.published.limit(2) workflow_ids_with_product_ids = workflows.to_h { |workflow| [workflow.id, workflow.abandoned_cart_products(only_product_and_variant_ids: true).to_h.keys] }.stringify_keys CustomerMailer.abandoned_cart(cart&.id, workflow_ids_with_product_ids, true) end def review_response CustomerMailer.review_response(ProductReviewResponse.last) end def upcoming_call_reminder CustomerMailer.upcoming_call_reminder(Call.last&.id) end def files_ready_for_download purchase = Purchase.joins(:url_redirect).last CustomerMailer.files_ready_for_download(purchase&.id) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/follower_mailer_preview.rb
lib/mailer_previews/follower_mailer_preview.rb
# frozen_string_literal: true class FollowerMailerPreview < ActionMailer::Preview def confirm_follower if Follower.count.zero? follower_user = User.last User.first&.add_follower( follower_user&.email, follower_user_id: follower_user&.id, source: Follower::From::FOLLOW_PAGE, logged_in_user: follower_user ) end follower = Follower.last FollowerMailer.confirm_follower(follower&.followed_id, follower&.id) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/service_mailer_preview.rb
lib/mailer_previews/service_mailer_preview.rb
# frozen_string_literal: true class ServiceMailerPreview < ActionMailer::Preview def service_charge_receipt ServiceMailer.service_charge_receipt(ServiceCharge.last&.id) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/contacting_creator_mailer_preview.rb
lib/mailer_previews/contacting_creator_mailer_preview.rb
# frozen_string_literal: true class ContactingCreatorMailerPreview < ActionMailer::Preview def cannot_pay ContactingCreatorMailer.cannot_pay(Payment.last&.id) end def preorder_release_reminder ContactingCreatorMailer.preorder_release_reminder(PreorderLink.last&.link&.id) end def preorder_summary ContactingCreatorMailer.preorder_summary(PreorderLink.last&.id) end def preorder_cancelled ContactingCreatorMailer.preorder_cancelled(Preorder.last&.id) end def debit_card_limit_reached ContactingCreatorMailer.debit_card_limit_reached(Payment.last&.id) end def invalid_bank_account ContactingCreatorMailer.invalid_bank_account(User.last&.id) end def chargeback_lost_no_refund_policy ContactingCreatorMailer.chargeback_lost_no_refund_policy(Purchase.last&.id) end def chargeback_notice ContactingCreatorMailer.chargeback_notice(Purchase.last&.id) end def chargeback_notice_with_dispute dispute_evidence = DisputeEvidence.seller_contacted.last ContactingCreatorMailer.chargeback_notice(dispute_evidence&.purchase&.id) end def chargeback_won ContactingCreatorMailer.chargeback_won(Purchase.last&.id) end def subscription_product_deleted ContactingCreatorMailer.subscription_product_deleted(Link.last&.id) end def subscription_cancelled ContactingCreatorMailer.subscription_cancelled(Subscription.last&.id) end def subscription_ended ContactingCreatorMailer.subscription_ended(Subscription.last&.id) end def subscription_downgraded subscription = Subscription.last ContactingCreatorMailer.subscription_downgraded(subscription&.id, subscription&.subscription_plan_changes&.last&.id) end def credit_notification ContactingCreatorMailer.credit_notification(User.last&.id, 1000) end def gumroad_day_credit_notification ContactingCreatorMailer.gumroad_day_credit_notification(User.last&.id, 1000) end def notify ContactingCreatorMailer.notify(Purchase.last&.id) end def negative_revenue_sale_failure ContactingCreatorMailer.negative_revenue_sale_failure(Purchase.last&.id) end def purchase_refunded_for_fraud ContactingCreatorMailer.purchase_refunded_for_fraud(Purchase.last&.id) end def purchase_refunded ContactingCreatorMailer.purchase_refunded(Purchase.last&.id) end def payment_returned ContactingCreatorMailer.payment_returned(Payment.completed.last&.id) end def remind ContactingCreatorMailer.remind(User.last&.id) end def seller_update ContactingCreatorMailer.seller_update(User.first&.id) end def subscription_cancelled_by_customer ContactingCreatorMailer.subscription_cancelled_by_customer(Subscription.last&.id) end def subscription_cancelled_to_seller ContactingCreatorMailer.subscription_cancelled(Subscription.last&.id) end def subscription_restarted ContactingCreatorMailer.subscription_restarted(Subscription.last&.id) end def subscription_ended_to_seller ContactingCreatorMailer.subscription_ended(Subscription.last&.id) end def unremovable_discord_member ContactingCreatorMailer.unremovable_discord_member("000000000000000000", "Server Name", Purchase.last&.id) end def unstampable_pdf_notification ContactingCreatorMailer.unstampable_pdf_notification(Link.last&.id) end def video_preview_conversion_error ContactingCreatorMailer.video_preview_conversion_error(Link.last&.id) end def payouts_may_be_blocked ContactingCreatorMailer.payouts_may_be_blocked(User.last&.id) end def more_kyc_needed ContactingCreatorMailer.more_kyc_needed(User.last&.id, %i[individual_tax_id birthday]) end def stripe_document_verification_failed ContactingCreatorMailer.stripe_document_verification_failed(User.last&.id, "Some account information mismatches with one another. For example, some banks might require that the business profile name must match the account holder name.") end def stripe_identity_verification_failed ContactingCreatorMailer.stripe_document_verification_failed(User.last&.id, "The country of the business address provided does not match the country of the account. Businesses must be located in the same country as the account.") end def singapore_identity_verification_reminder ContactingCreatorMailer.singapore_identity_verification_reminder(User.last&.id, 30.days.from_now) end def video_transcode_failed ContactingCreatorMailer.video_transcode_failed(ProductFile.last&.id) end def subscription_autocancelled ContactingCreatorMailer.subscription_autocancelled(Subscription.where.not(failed_at: nil).last&.id) end def annual_payout_summary user = User.last if user&.financial_annual_report_url_for(year: 2022).nil? user&.annual_reports&.attach( io: Rack::Test::UploadedFile.new("#{Rails.root}/spec/support/fixtures/financial-annual-summary-2022.csv"), filename: "Financial summary for 2022.csv", content_type: "text/csv", metadata: { year: 2022 } ) end ContactingCreatorMailer.annual_payout_summary(user&.id, 2022, 10_000) end def user_sales_data ContactingCreatorMailer.user_sales_data(User.last&.id, sample_csv_file) end def affiliates_data ContactingCreatorMailer.affiliates_data(recipient: User.last, tempfile: sample_csv_file, filename: "file") end def subscribers_data ContactingCreatorMailer.subscribers_data(recipient: User.last, tempfile: sample_csv_file, filename: "file") end def tax_form_1099k ContactingCreatorMailer.tax_form_1099k(User.last&.id, Time.current.year.pred, "https://www.gumroad.com") end def tax_form_1099misc ContactingCreatorMailer.tax_form_1099misc(User.last&.id, Time.current.year.pred, "https://www.gumroad.com") end def review_submitted ContactingCreatorMailer.review_submitted(ProductReview.last&.id) end def flagged_for_explicit_nsfw_tos_violation ContactingCreatorMailer.flagged_for_explicit_nsfw_tos_violation(User.last&.id) end def upcoming_call_reminder ContactingCreatorMailer.upcoming_call_reminder(Call.last&.id) end def refund_policy_enabled_email ContactingCreatorMailer.refund_policy_enabled_email(SellerRefundPolicy.where(product_id: nil).last&.seller_id) end def product_level_refund_policies_reverted ContactingCreatorMailer.product_level_refund_policies_reverted(User.last&.id) end def upcoming_refund_policy_change ContactingCreatorMailer.upcoming_refund_policy_change(User.last&.id) end def paypal_suspension_notification ContactingCreatorMailer.paypal_suspension_notification(User.last&.id) end def ping_endpoint_failure ContactingCreatorMailer.ping_endpoint_failure(User.last&.id, "https://example.com/webhook", 500) end private def sample_csv_file tempfile = Tempfile.new CSV.open(tempfile, "wb") { |csv| 100.times { csv << ["Some", "CSV", "Data"] } } tempfile.rewind tempfile end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/post_sendgrid_api_preview.rb
lib/mailer_previews/post_sendgrid_api_preview.rb
# frozen_string_literal: true class PostSendgridApiPreview < ActionMailer::Preview def post_with_attachment post = Installment.joins(:product_files).find_each(order: :desc).find(&:has_files?) post ||= begin record = create_generic_post record.product_files.create!(url: "#{AWS_S3_ENDPOINT}/gumroad_dev/test", filetype: "pdf", filegroup: "document") record end build_mail(post:, recipient: { url_redirect: UrlRedirect.find_or_create_by!(installment: post, purchase: nil) }) end def post_not_shown_on_profile post = Installment.not_shown_on_profile.left_joins(:product_files).where(product_files: { id: nil }).last post ||= create_generic_post(shown_on_profile: false) build_mail(post:) end def commentable_post post = Installment.shown_on_profile.allow_comments.left_joins(:product_files).where(product_files: { id: nil }).last post ||= create_generic_post(shown_on_profile: true, allow_comments: true) build_mail(post:) end def product_post post = Installment.joins(seller: { sales: :url_redirect }).where(installment_type: Installment::PRODUCT_TYPE).last post ||= begin user = User.first! product = user.products.create!(name: "some product", price_cents: 0) purchase = Purchase.new(email: "foo@example.com", link: product, seller: user) purchase.prepare_for_charge! purchase.save! purchase.create_url_redirect! create_generic_post(installment_type: Installment::PRODUCT_TYPE, link: product, bought_products: [product.unique_permalink]) end purchase = post.seller&.sales&.last url_redirect = purchase&.url_redirect build_mail(post:, recipient: { purchase:, url_redirect: }) end def for_customer post = Installment.joins(seller: { sales: :url_redirect }).where(installment_type: Installment::SELLER_TYPE).last post ||= begin user = User.first! product = user.products.create!(name: "some product", price_cents: 0) purchase = Purchase.new(email: "foo@example.com", link: product, seller: user) purchase.prepare_for_charge! purchase.save! purchase.create_url_redirect! create_generic_post(installment_type: Installment::SELLER_TYPE) end purchase = post.seller&.sales&.last url_redirect = purchase&.url_redirect build_mail(post:, recipient: { purchase:, url_redirect: }) end def for_follower post = Installment.where(installment_type: Installment::FOLLOWER_TYPE).left_joins(:product_files).where(product_files: { id: nil }).joins(seller: :followers).last post ||= begin user = User.first! user.followers.active.last || user.followers.create!(email: "foo@example.com", confirmed_at: Time.current) create_generic_post(installment_type: Installment::FOLLOWER_TYPE) end follower = post.seller&.followers&.last build_mail(post:, recipient: { follower: }) end def for_affiliate post = Installment.where(installment_type: Installment::AFFILIATE_TYPE).left_joins(:product_files).where(product_files: { id: nil }).joins(seller: :direct_affiliates).last post ||= begin user = User.first! user.direct_affiliates.last || user.direct_affiliates.create!(affiliate_user: User.second!, affiliate_basis_points: 1000) create_generic_post(installment_type: Installment::AFFILIATE_TYPE) end affiliate = post.seller&.direct_affiliates&.last build_mail(post:, recipient: { affiliate: }) end private def build_mail(post:, recipient: {}) recipients = [{ email: "foo@example.com" }.merge(recipient)] PostSendgridApi.new(post:, recipients:, preview: true).build_mail email_address = recipients.first[:email] details = PostSendgridApi.mails.fetch(email_address) # Tip: if this fails, you may have POST_SENDGRID_API_SKIP_DEBUG=1 mail = Mail.new mail.subject = details[:subject] mail.from = details[:from] mail.reply_to = details[:reply_to] mail.to = email_address mail.headers({ skip_premailer: true }) mail.part content_type: "multipart/alternative", content_disposition: "inline" do |multipart| multipart.part content_type: "text/html", body: details[:content] end mail end def create_generic_post(extra_attributes = {}) Installment.create!({ seller: User.first!, name: "Generic post", message: "Some post content<br>Some <i>more</i> content", installment_type: Installment::AUDIENCE_TYPE, send_emails: true, shown_on_profile: true, }.merge(extra_attributes)) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/one_off_mailer_preview.rb
lib/mailer_previews/one_off_mailer_preview.rb
# frozen_string_literal: true class OneOffMailerPreview < ActionMailer::Preview def email subject = "Try our premium features, for free!" body = <<~BODY You can now try out our premium features with a 14-day free trial. They make Gumroad a lot more powerful. It also comes with cheaper per-charge pricing. You can cancel your account at any time and won't be charged anything. <a class="button accent" href="https://gumroad.com/settings/upgrade">Learn more</a> Best, Sahil and the Gumroad Team. BODY OneOffMailer.email(user_id: User.last&.id, subject:, body:) end def email_using_installment OneOffMailer.email_using_installment(user_id: User.last&.id, installment_external_id: Installment.last&.external_id) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/creator_mailer_preview.rb
lib/mailer_previews/creator_mailer_preview.rb
# frozen_string_literal: true class CreatorMailerPreview < ActionMailer::Preview include CdnUrlHelper def gumroad_day_fee_saved CreatorMailer.gumroad_day_fee_saved(seller_id: seller&.id) end def year_in_review CreatorMailer.year_in_review(seller:, year:, analytics_data:) end def year_in_review_with_financial_report if seller&.financial_annual_report_url_for(year:).nil? seller&.annual_reports&.attach( io: Rack::Test::UploadedFile.new("#{Rails.root}/spec/support/fixtures/financial-annual-summary-2022.csv"), filename: "Financial summary for 2022.csv", content_type: "text/csv", metadata: { year: } ) end CreatorMailer.year_in_review( seller:, year:, analytics_data:, payout_csv_url: seller&.financial_annual_report_url_for(year:) ) end def bundles_marketing CreatorMailer.bundles_marketing( seller_id: seller&.id, bundles: [ { type: "best_selling", price: 199_99, discounted_price: 99_99, products: [ { id: 1, url: "https://example.com/product1", name: "Best Seller 1" }, { id: 2, url: "https://example.com/product2", name: "Best Seller 2" } ] }, { type: "year", price: 299_99, discounted_price: 149_99, products: [ { id: 3, url: "https://example.com/product3", name: "Year Highlight 1" }, { id: 4, url: "https://example.com/product4", name: "Year Highlight 2" } ] }, { type: "everything", price: 499_99, discounted_price: 249_99, products: [ { id: 5, url: "https://example.com/product5", name: "Everything Product 1" }, { id: 6, url: "https://example.com/product6", name: "Everything Product 2" } ] } ] ) end private def seller @_seller ||= User.first end def year @_year ||= Time.current.year.pred end def analytics_data { total_views_count: 144, total_sales_count: 12, top_selling_products: seller&.products&.last(5)&.map do |product| ProductPresenter.card_for_email(product:).merge( { stats: [ rand(1000..5000), rand(10000..50000), rand(100000..500000000), ] } ) end, total_products_sold_count: 5, total_amount_cents: 4000, by_country: ["🇪🇸 Spain", "🇷🇴 Romania", "🇦🇪 United Arab Emirates", "🇺🇸 United States", "🌎 Elsewhere"].index_with do [ rand(1000..5000), rand(10000..50000), rand(10000..50000), ] end.sort_by { |_, (_, _, total)| -total }, total_countries_with_sales_count: 4, total_unique_customers_count: 8 } end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/team_mailer_preview.rb
lib/mailer_previews/team_mailer_preview.rb
# frozen_string_literal: true class TeamMailerPreview < ActionMailer::Preview def invite TeamMailer.invite(TeamInvitation.last) end def invitation_accepted TeamMailer.invitation_accepted(TeamMembership.last) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/lib/mailer_previews/community_chat_recap_mailer_preview.rb
lib/mailer_previews/community_chat_recap_mailer_preview.rb
# frozen_string_literal: true class CommunityChatRecapMailerPreview < ActionMailer::Preview def community_chat_recap_notification CommunityChatRecapMailer.community_chat_recap_notification(User.first.id, User.last.id, CommunityChatRecap.status_finished.where(community_chat_recap_run_id: CommunityChatRecapRun.recap_frequency_daily.finished.pluck(:id)).last(3).pluck(:id)) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/application.rb
config/application.rb
# frozen_string_literal: true require_relative "boot" require "rails/all" require "action_cable/engine" require "socket" require_relative "../lib/catch_bad_request_errors" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) if Rails.env.development? || Rails.env.test? Dotenv::Railtie.load end require_relative "domain" require_relative "redis" require_relative "../lib/utilities/global_config" module Gumroad class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 7.0 config.active_support.cache_format_version = 7.1 config.active_storage.variant_processor = :mini_magick # Please, add to the `ignore` list any other `lib` subdirectories that do # not contain `.rb` files, or that should not be reloaded or eager loaded. # Common ones are `templates`, `generators`, or `middleware`, for example. # config.autoload_lib(ignore: %w(assets currency json_schema tasks)) config.to_prepare do Devise::Mailer.helper MailerHelper Devise::Mailer.layout "email" DeviseController.respond_to :html, :json Doorkeeper::ApplicationsController.layout "application" Doorkeeper::AuthorizationsController.layout "application" end # Configuration for the application, engines, and railties goes here. # # These settings can be overridden in specific environments using the files # in config/environments, which are processed later. # # config.time_zone = "Central Time (US & Canada)" # config.eager_load_paths << Rails.root.join("extras") config.eager_load_paths += %w[./lib/utilities] config.eager_load_paths += %w[./lib/validators] config.eager_load_paths += %w[./lib/errors] config.eager_load_paths += Dir[Rails.root.join("app", "business", "**/")] config.middleware.insert_before(ActionDispatch::Cookies, Rack::SSL, exclude: ->(env) { env["HTTP_HOST"] != DOMAIN || Rails.env.test? || Rails.env.development? }) config.action_view.sanitized_allowed_tags = ["div", "p", "a", "u", "strong", "b", "em", "i", "br"] config.action_view.sanitized_allowed_attributes = ["href", "class", "target"] # Configure the default encoding used in templates for Ruby 1.9. config.encoding = "utf-8" if Rails.env.development? || Rails.env.test? logger = ActiveSupport::Logger.new("log/#{Rails.env}.log", "weekly") logger.formatter = config.log_formatter else logger = Logger.new(STDOUT) config.lograge.enabled = true end config.logger = ActiveSupport::TaggedLogging.new(logger) config.middleware.insert 0, Rack::UTF8Sanitizer initializer "catch_bad_request_errors.middleware" do config.middleware.insert_after Rack::Attack, ::CatchBadRequestErrors end config.generators do |g| g.helper_specs false g.stylesheets false g.test_framework :rspec, fixture: true, views: false g.fixture_replacement :factory_bot, dir: "spec/support/factories" g.orm :active_record end config.active_job.queue_adapter = :sidekiq config.hosts = nil config.active_storage.queues.purge = :low config.flipper.strict = false config.flipper.test_help = false end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/redis.rb
config/redis.rb
# frozen_string_literal: true $redis = Redis.new(url: "redis://#{ENV["REDIS_HOST"]}")
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/environment.rb
config/environment.rb
# frozen_string_literal: true # Load the Rails application. require_relative "application" # Initialize the Rails application. Rails.application.initialize!
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/puma.rb
config/puma.rb
# frozen_string_literal: true # Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum, this matches the default thread size of Active Record. # # See unicorn migration guide: https://github.com/puma/puma/blob/master/docs/deployment.md#migrating-from-unicorn threads_count = ENV.fetch("RAILS_MAX_THREADS") { 2 }.to_i threads threads_count, threads_count # Specifies the `worker_timeout` threshold that Puma will use to wait before # terminating a worker in development environments. # worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" # Specifies the `port` that Puma will listen on to receive requests, default is 3000. # port ENV.fetch("PORT") { 3000 } # Specifies the `environment` that Puma will run in. # env = ENV.fetch("RAILS_ENV") { "development" } environment env if env != "development" # Specifies the number of `workers` to boot in clustered mode. # Workers are forked webserver processes. If using threads and workers together # the concurrency of the application would be max `threads` * `workers`. # Workers do not work on JRuby or Windows (both of which do not support # processes). # # workers ENV.fetch("WEB_CONCURRENCY") { 2 } workers ENV.fetch("PUMA_WORKER_PROCESSES") { 1 } # Use the `preload_app!` method when specifying a `workers` number. # This directive tells Puma to first boot the application and load code # before forking the application. This takes advantage of Copy On Write # process behavior so workers use less memory. If you use this option # you need to make sure to reconnect any threads in the `on_worker_boot` # block. # preload_app! # The code in the `on_worker_boot` will be called if you are using # clustered mode by specifying a number of `workers`. After each worker # process is booted this block will be run, if you are using `preload_app!` # option you will want to use this block to reconnect to any threads # or connections that may have been created at application boot, Ruby # cannot share connections between processes. # on_worker_boot do if defined?(ActiveRecord::Base) ActiveRecord::Base.establish_connection Makara::Context.release_all end end end pidfile "tmp/pids/puma.pid" # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart # # Custom Config # root_config = { development: File.expand_path("."), staging: "/app/", production: "/app/" } root_dir = ENV["PUMA_ROOT"] || root_config[env.to_sym] directory root_dir
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/domain.rb
config/domain.rb
# frozen_string_literal: true configuration_by_env = { production: { protocol: "https", domain: "gumroad.com", asset_domain: "assets.gumroad.com", root_domain: "gumroad.com", short_domain: "gum.co", discover_domain: "gumroad.com", api_domain: "api.gumroad.com", third_party_analytics_domain: "gumroad-analytics.com", valid_request_hosts: ["gumroad.com", "app.gumroad.com"], valid_api_request_hosts: ["api.gumroad.com"], valid_discover_host: "gumroad.com", valid_cors_origins: ["gumroad.com"], internal_gumroad_domain: "gumroad.net", default_email_domain: "gumroad.com", anycable_host: "cable.gumroad.com", }, staging: { protocol: "https", domain: "staging.gumroad.com", asset_domain: "staging-assets.gumroad.com", root_domain: "staging.gumroad.com", short_domain: "staging.gum.co", discover_domain: "staging.gumroad.com", api_domain: "api.staging.gumroad.com", third_party_analytics_domain: "staging.gumroad-analytics.com", valid_request_hosts: ["staging.gumroad.com", "app.staging.gumroad.com"], valid_api_request_hosts: ["api.staging.gumroad.com"], valid_discover_host: "staging.gumroad.com", valid_cors_origins: ["staging.gumroad.com"], internal_gumroad_domain: "gumroad.net", default_email_domain: "staging.gumroad.com", anycable_host: "cable.staging.gumroad.com", }, test: { protocol: "http", domain: "app.test.gumroad.com:31337", asset_domain: "test.gumroad.com:31337", root_domain: "test.gumroad.com:31337", short_domain: "short-domain.test.gumroad.com:31337", discover_domain: "test.gumroad.com:31337", api_domain: "api.test.gumroad.com:31337", third_party_analytics_domain: "analytics.test.gumroad.com", valid_request_hosts: ["127.0.0.1", "app.test.gumroad.com", "test.gumroad.com"], valid_api_request_hosts: ["api.test.gumroad.com"], valid_discover_host: "test.gumroad.com", valid_cors_origins: ["help.test.gumroad.com", "customers.test.gumroad.com"], internal_gumroad_domain: "test.gumroad.net", default_email_domain: "test.gumroad.com", # unused anycable_host: "cable.test.gumroad.com", }, development: { protocol: "https", domain: "gumroad.dev", asset_domain: "app.gumroad.dev", root_domain: "gumroad.dev", short_domain: "short-domain.gumroad.dev", discover_domain: "gumroad.dev", api_domain: "api.gumroad.dev", third_party_analytics_domain: "analytics.gumroad.dev", valid_request_hosts: ["app.gumroad.dev", "gumroad.dev"], valid_api_request_hosts: ["api.gumroad.dev"], valid_discover_host: "gumroad.dev", valid_cors_origins: [], internal_gumroad_domain: "internal.gumroad.dev", default_email_domain: "staging.gumroad.com", anycable_host: "cable.gumroad.dev", } } custom_domain = ENV["CUSTOM_DOMAIN"] custom_short_domain = ENV["CUSTOM_SHORT_DOMAIN"] environment = ENV["RAILS_ENV"]&.to_sym || :development config = configuration_by_env[environment] PROTOCOL = config[:protocol] DOMAIN = custom_domain || config[:domain] ASSET_DOMAIN = config[:asset_domain] ROOT_DOMAIN = custom_domain || config[:root_domain] SHORT_DOMAIN = custom_short_domain || config[:short_domain] API_DOMAIN = config[:api_domain] THIRD_PARTY_ANALYTICS_DOMAIN = config[:third_party_analytics_domain] VALID_REQUEST_HOSTS = config[:valid_request_hosts] VALID_API_REQUEST_HOSTS = config[:valid_api_request_hosts] VALID_CORS_ORIGINS = config[:valid_cors_origins] INTERNAL_GUMROAD_DOMAIN = config[:internal_gumroad_domain] DEFAULT_EMAIL_DOMAIN = config[:default_email_domain] ANYCABLE_HOST = config[:anycable_host] if custom_domain VALID_REQUEST_HOSTS << custom_domain VALID_API_REQUEST_HOSTS << "api.#{custom_domain}" VALID_API_REQUEST_HOSTS << custom_domain if ENV["BRANCH_DEPLOYMENT"].present? # Allow CORS to branch-apps's root domain DISCOVER_DOMAIN = custom_domain VALID_DISCOVER_REQUEST_HOST = custom_domain else DISCOVER_DOMAIN = config[:discover_domain] VALID_DISCOVER_REQUEST_HOST = config[:valid_discover_host] end if environment == :development && !ENV["LOCAL_PROXY_DOMAIN"].nil? VALID_REQUEST_HOSTS << ENV["LOCAL_PROXY_DOMAIN"].sub(/https?:\/\//, "") end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/routes.rb
config/routes.rb
# frozen_string_literal: true require "api_domain_constraint" require "product_custom_domain_constraint" require "user_custom_domain_constraint" require "gumroad_domain_constraint" require "discover_domain_constraint" require "discover_taxonomy_constraint" require "sidekiq/cron/web" require "sidekiq_unique_jobs/web" if defined?(Sidekiq::Pro) require "sidekiq/pro/web" else require "sidekiq/web" end Rails.application.routes.draw do get "/healthcheck" => "healthcheck#index" get "/healthcheck/sidekiq" => "healthcheck#sidekiq" use_doorkeeper do controllers applications: "oauth/applications" controllers authorized_applications: "oauth/authorized_applications" controllers authorizations: "oauth/authorizations" controllers tokens: "oauth/tokens" end # third party analytics (near the top to matches constraint first) constraints(host: /#{THIRD_PARTY_ANALYTICS_DOMAIN}/o) do get "/:link_id", to: "third_party_analytics#index", as: :third_party_analytics get "/(*path)", to: "application#e404_page" end # API routes used in both api.gumroad.com and gumroad.com/api def api_routes scope "v2", module: "v2", as: "v2" do resources :licenses, only: [] do collection do post :verify put :enable put :disable put :decrement_uses_count put :rotate end end get "/user", to: "users#show" resources :links, path: "products", only: [:index, :show, :update, :create, :destroy] do resources :custom_fields, only: [:index, :create, :update, :destroy] resources :offer_codes, only: [:index, :create, :show, :update, :destroy] resources :variant_categories, only: [:index, :create, :show, :update, :destroy] do resources :variants, only: [:index, :create, :show, :update, :destroy] end resources :skus, only: [:index] resources :subscribers, only: [:index] member do put "disable" put "enable" end end resources :sales, only: [:index, :show] do member do put :mark_as_shipped put :refund post :resend_receipt end end resources :payouts, only: [:index, :show] resources :subscribers, only: [:show] put "/resource_subscriptions", to: "resource_subscriptions#create" delete "/resource_subscriptions/:id", to: "resource_subscriptions#destroy" get "/resource_subscriptions", to: "resource_subscriptions#index" end end def product_tracking_routes(named_routes: true) resources :links, only: :create do member do # Conditionally defining named routed since we can define it only once. # Defining it again leads to an error. if named_routes post :track_user_action, as: :track_user_action post :increment_views, as: :increment_views else post :track_user_action post :increment_views end end end end def product_info_and_purchase_routes(named_routes: true) product_tracking_routes(named_routes:) get "/offer_codes/compute_discount", to: "offer_codes#compute_discount" get "/products/search", to: "links#search" if named_routes get "/braintree/client_token", to: "braintree#client_token", as: :braintree_client_token get "/purchases/:id/generate_invoice", to: "purchases#generate_invoice", as: :generate_invoice_by_buyer get "/purchases/:id/generate_invoice/confirm", to: "purchases#confirm_generate_invoice", as: :confirm_generate_invoice post "/purchases/:id/send_invoice", to: "purchases#send_invoice", as: :send_invoice else get "/braintree/client_token", to: "braintree#client_token" get "/purchases/:id/generate_invoice/confirm", to: "purchases#confirm_generate_invoice" get "/purchases/:id/generate_invoice", to: "purchases#generate_invoice" post "/purchases/:id/send_invoice", to: "purchases#send_invoice" end post "/braintree/generate_transient_customer_token", to: "braintree#generate_transient_customer_token" resource :paypal, controller: :paypal, only: [] do collection do post :billing_agreement_token post :billing_agreement post :order get :fetch_order post :update_order end end post "/events/track_user_action", to: "events#create" resources :purchases, only: [] do member do post :confirm end end resources :orders, only: [:create] do member do post :confirm end end namespace :stripe do resources :setup_intents, only: :create end post "/shipments/verify_shipping_address", to: "shipments#verify_shipping_address" # discover/autocomplete_search get "/discover_search_autocomplete", to: "discover/search_autocomplete#search" delete "/discover_search_autocomplete", to: "discover/search_autocomplete#delete_search_suggestion" put "/links/:id/sections", to: "links#update_sections" end constraints DiscoverDomainConstraint do get "/", to: "home#about" get "/discover", to: "discover#index" get "/discover/recommended_products", to: "discover#recommended_products", as: :discover_recommended_products namespace :discover do resources :recommended_wishlists, only: [:index] end product_info_and_purchase_routes constraints DiscoverTaxonomyConstraint do get "/*taxonomy", to: "discover#index", as: :discover_taxonomy end get "/animation(*path)", to: redirect { |_, req| req.fullpath.sub("animation", "3d") } end # embeddable js scope "js" do get "/gumroad", to: "embedded_javascripts#overlay" get "/gumroad-overlay", to: "embedded_javascripts#overlay" get "/gumroad-embed", to: "embedded_javascripts#embed" get "/gumroad-multioverlay", to: "embedded_javascripts#overlay" end # UTM link tracking get "/u/:permalink", to: "utm_link_tracking#show" # Configure redirections in development environment if Rails.env.development? || Rails.env.test? # redirect SHORT_DOMAIN to DOMAIN constraints(host_with_port: SHORT_DOMAIN) do match "/(*path)" => redirect { |_params, request| "#{UrlService.domain_with_protocol}/l#{request.fullpath}" }, via: [:get, :post] end end constraints ApiDomainConstraint do scope module: "api", as: "api" do api_routes scope "mobile", module: "mobile", as: "mobile" do devise_scope :user do post "forgot_password", to: "/user/passwords#create" end get "/purchases/index", to: "purchases#index" get "/purchases/search", to: "purchases#search" get "/purchases/purchase_attributes/:id", to: "purchases#purchase_attributes" post "/purchases/:id/archive", to: "purchases#archive" post "/purchases/:id/unarchive", to: "purchases#unarchive" get "/url_redirects/get_url_redirect_attributes/:id", to: "url_redirects#url_redirect_attributes" get "/url_redirects/fetch_placeholder_products", to: "url_redirects#fetch_placeholder_products" get "/url_redirects/stream/:token/:product_file_id", to: "url_redirects#stream", as: :stream_video get "/url_redirects/hls_playlist/:token/:product_file_id/index.m3u8", to: "url_redirects#hls_playlist", as: :hls_playlist get "/url_redirects/download/:token/:product_file_id", to: "url_redirects#download", as: :download_product_file get "/subscriptions/subscription_attributes/:id", to: "subscriptions#subscription_attributes", as: :subscription_attributes get "/preorders/preorder_attributes/:id", to: "preorders#preorder_attributes", as: :preorder_attributes resources :sales, only: [:show] do member do patch :refund end end resources :analytics, only: [] do collection do get :data_by_date get :revenue_totals get :by_date get :by_state get :by_referral get :products end end resources :devices, only: :create resources :installments, only: :show resources :consumption_analytics, only: [:create], format: :json resources :media_locations, only: [:create], format: :json resources :sessions, only: [:create], format: :json resources :feature_flags, only: [:show], format: :json end namespace :internal do resources :home_page_numbers, only: :index namespace :helper do post :webhook, to: "webhook#handle" resources :users, only: [] do collection do get :user_info post :create_appeal post :user_suspension_info post :send_reset_password_instructions post :update_email post :update_two_factor_authentication_enabled end end resources :purchases, only: [] do collection do post :refund_last_purchase post :resend_last_receipt post :resend_all_receipts post :resend_receipt_by_number post :search post :reassign_purchases post :auto_refund_purchase post :refund_taxes_only end end resources :payouts, only: [:index, :create] resources :instant_payouts, only: [:index, :create] resources :openapi, only: :index end namespace :iffy do post :webhook, to: "webhook#handle" end namespace :grmc do post :webhook, to: "webhook#handle" end end end end get "/s3_utility/cdn_url_for_blob", to: "s3_utility#cdn_url_for_blob" get "/s3_utility/current_utc_time_string", to: "s3_utility#current_utc_time_string" get "/s3_utility/generate_multipart_signature", to: "s3_utility#generate_multipart_signature" constraints GumroadDomainConstraint do get "/about", to: "home#about" get "/features", to: "home#features" get "/pricing", to: "home#pricing" get "/terms", to: "home#terms" get "/prohibited", to: "home#prohibited" get "/privacy", to: "home#privacy" get "/taxes", to: redirect("/pricing", status: 301) get "/hackathon", to: "home#hackathon" get "/small-bets", to: "home#small_bets" resource :github_stars, only: [:show] namespace :gumroad_blog, path: "blog" do root to: "posts#index" resources :posts, only: [:index, :show], param: :slug, path: "p" end namespace :help_center, path: "help" do root to: "articles#index" # Custom singular `path` name for backwards compatibility with old routes # for SEO. resources :articles, only: [:index, :show], param: :slug, path: "article" resources :categories, only: [:show], param: :slug, path: "category" end get "/ifttt/v1/status" => "api/v2/users#ifttt_status" get "/ifttt/v1/oauth2/authorize/:code(.:format)" => "oauth/authorizations#show" get "/ifttt/v1/oauth2/authorize(.:format)" => "oauth/authorizations#new" post "/ifttt/v1/oauth2/token(.:format)" => "oauth/tokens#create" get "/ifttt/v1/user/info" => "api/v2/users#show", is_ifttt: true post "/ifttt/v1/triggers/sale" => "api/v2/users#ifttt_sale_trigger" get "/notion/oauth2/authorize(.:format)" => "oauth/notion/authorizations#new" post "/notion/oauth2/token(.:format)" => "oauth/tokens#create" post "/notion/unfurl" => "api/v2/notion_unfurl_urls#create" delete "/notion/unfurl" => "api/v2/notion_unfurl_urls#destroy" # legacy routes get "users/password/new" => redirect("/login") # /robots.txt get "/robots.:format" => "robots#index" # users (logins/signups and other goodies) devise_for(:users, controllers: { sessions: "logins", registrations: "signup", confirmations: "confirmations", omniauth_callbacks: "user/omniauth_callbacks", passwords: "user/passwords" }) devise_scope :user do get "signup", to: "signup#new", as: :signup post "signup", to: "signup#create" post "save_to_library", to: "signup#save_to_library", as: :save_to_library post "add_purchase_to_library", to: "users#add_purchase_to_library", as: :add_purchase_to_library get "login", to: "logins#new" get "/oauth/login" => "logins#new" post "login", to: "logins#create" get "logout", to: "logins#destroy" # TODO: change the method to DELETE to conform to REST post "forgot_password", to: "user/passwords#create" scope "/users" do get "/check_twitter_link", to: "users/oauth#check_twitter_link" get "/unsubscribe/:id", to: "users#email_unsubscribe", as: :user_unsubscribe get "/unsubscribe_review_reminders", to: "users#unsubscribe_review_reminders", as: :user_unsubscribe_review_reminders get "/subscribe_review_reminders", to: "users#subscribe_review_reminders", as: :user_subscribe_review_reminders end end namespace :sellers do resource "switch", only: :create, controller: "switch" end resources :test_pings, only: [:create] # followers resources :followers, only: [:index, :destroy], format: :json do collection do get "search" end end post "/follow_from_embed_form", to: "followers#from_embed_form", as: :follow_user_from_embed_form post "/follow", to: "followers#create", as: :follow_user get "/follow/:id/cancel", to: "followers#cancel", as: :cancel_follow get "/follow/:id/confirm", to: "followers#confirm", as: :confirm_follow namespace :affiliate_requests do resource :onboarding_form, only: [:update], controller: :onboarding_form do get :show, to: redirect("/affiliates/onboarding") end end resources :affiliate_requests, only: [:update] do member do get :approve get :ignore end collection do post :approve_all end end resources :affiliates, only: [:index, :new, :edit, :create, :update, :destroy] do member do get :subscribe_posts get :unsubscribe_posts get :statistics end collection do get :onboarding get :export end end resources :collaborators, only: [:index] # Routes handled by react-router. Non-catch-all routes are declared to # generate URL helpers. get "/collaborators/incomings", to: "collaborators#index" get "/collaborators/*other", to: "collaborators#index" get "/dashboard/utm_links/*other", to: "utm_links#index" # route handled by react-router get "/communities/*other", to: "communities#index" # route handled by react-router get "/a/:affiliate_id", to: "affiliate_redirect#set_cookie_and_redirect", as: :affiliate_redirect get "/a/:affiliate_id/:unique_permalink", to: "affiliate_redirect#set_cookie_and_redirect", as: :affiliate_product post "/links/:id/send_sample_price_change_email", to: "links#send_sample_price_change_email", as: :sample_membership_price_change_email namespace :global_affiliates do resources :product_eligibility, only: [:show], param: :url, constraints: { url: /.*/ } end resources :tags, only: [:index] draw(:admin) post "/settings/store_facebook_token", to: "users/oauth#async_facebook_store_token", as: :ajax_facebook_access_token get "/settings/async_twitter_complete", to: "users/oauth#async_twitter_complete", as: :async_twitter_complete # user account settings stuff resource :settings, only: [] do resources :applications, only: [] do resources :access_tokens, only: :create, controller: "oauth/access_tokens" end get :profiles, to: redirect("/settings") resource :connections, only: [] do member do post :unlink_twitter end end end namespace :settings do resource :main, only: %i[show update], path: "", controller: "main" do post :resend_confirmation_email end resource :password, only: %i[show update], controller: "password" resource :profile, only: %i[show update], controller: "profile" resource :third_party_analytics, only: %i[show update], controller: "third_party_analytics" resource :advanced, only: %i[show update], controller: "advanced" resources :authorized_applications, only: :index resource :payments, only: %i[show update] do resource :verify_document, only: :create, controller: "payments/verify_document" resource :verify_identity, only: %i[show create], controller: "payments/verify_identity" get :remediation get :verify_stripe_remediation post :set_country post :opt_in_to_au_backtax_collection get :paypal_connect post :remove_credit_card end resource :stripe, controller: :stripe, only: [] do collection do post :disconnect end end resource :team, only: %i[show], controller: "team" namespace :team do scope format: true, constraints: { format: :json } do resources :invitations, only: %i[create update destroy] do get :accept, on: :member, format: nil put :resend_invitation, on: :member put :restore, on: :member end resources :members, only: %i[index update destroy] do put :restore, on: :member end end end resource :dismiss_ai_product_generation_promo, only: [:create] end resources :stripe_account_sessions, only: :create namespace :checkout do resources :discounts, only: %i[index create update destroy] do get :paged, on: :collection get :statistics, on: :member end resources :upsells, only: %i[index create update destroy] do get :paged, on: :collection get :cart_item, on: :collection get :statistics, on: :member scope module: :upsells do resource :pause, only: [:create, :destroy] end end namespace :upsells do resources :products, only: [:index, :show] end resource :form, only: %i[show update], controller: :form end resources :recommended_products, only: :index # purchases resources :purchases, only: [:update] do member do get :receipt get :confirm_receipt_email get :subscribe get :unsubscribe post :confirm post :change_can_contact post :resend_receipt post :send_invoice put :refund put :revoke_access put :undo_revoke_access end get :export, on: :collection # TODO: Remove when `:react_customers_page` is enabled post :export, on: :collection resources :pings, controller: "purchases/pings", only: [:create] resource :product, controller: "purchases/product", only: [:show] resources :variants, controller: "purchases/variants", param: :variant_id, only: [:update] resource :dispute_evidence, controller: "purchases/dispute_evidence", only: %i[show update] end resources :orders, only: [:create] do member do post :confirm end end # service charges resources :service_charges, only: :create do member do post :confirm get :generate_service_charge_invoice post :resend_receipt post :send_invoice end end # Two-Factor Authentication get "/two-factor", to: "two_factor_authentication#new", as: :two_factor_authentication # Enforce stricter formats to restrict people from bypassing Rack::Attack by using different formats in URL. scope format: true, constraints: { format: :json } do post "/two-factor", to: "two_factor_authentication#create" post "/two-factor/resend_authentication_token", to: "two_factor_authentication#resend_authentication_token", as: :resend_authentication_token end scope format: true, constraints: { format: :html } do get "/two-factor/verify", to: "two_factor_authentication#verify", as: :verify_two_factor_authentication end # library get "/library", to: "library#index", as: :library get "/library/purchase/:id", to: "library#index", as: :library_purchase get "/library/purchase/:purchase_id/update/:id", to: "posts#redirect_from_purchase_id", as: :redirect_from_purchase_id patch "/library/purchase/:id/archive", to: "library#archive", as: :library_archive patch "/library/purchase/:id/unarchive", to: "library#unarchive", as: :library_unarchive patch "/library/purchase/:id/delete", to: "library#delete", as: :library_delete # customers get "/customers/sales", controller: "customers", action: "customers_paged", format: "json", as: :sales_paged get "/customers", controller: "customers", action: "index", format: "html", as: :customers get "/customers/paged", controller: "customers", action: "paged", format: "json" get "/customers/:link_id", controller: "customers", action: "index", format: "html", as: :customers_link_id post "/customers/import", to: "customers#customers_import", as: :customers_import post "/customers/import_manually_entered_emails", to: "customers#customers_import_manually_entered_emails", as: :customers_import_manually_entered_emails get "/customers/charges/:purchase_id", to: "customers#customer_charges", as: :customer_charges get "/customers/customer_emails/:purchase_id", to: "customers#customer_emails", as: :customer_emails get "/customers/missed_posts/:purchase_id", to: "customers#missed_posts", as: :missed_posts get "/customers/product_purchases/:purchase_id", to: "customers#product_purchases", as: :product_purchases # imported customers get "/imported_customers", to: "imported_customers#index", as: :imported_customers delete "/imported_customers/:id", to: "imported_customers#destroy", as: :destroy_imported_customer get "/imported_customers/unsubscribe/:id", to: "imported_customers#unsubscribe", as: :unsubscribe_imported_customer # dropbox files get "/dropbox_files", to: "dropbox_files#index", as: "dropbox_files" post "/dropbox_files/create", to: "dropbox_files#create", as: "create_dropbox_file" post "/dropbox_files/cancel_upload/:id", to: "dropbox_files#cancel_upload", as: "cancel_dropbox_file_upload" get "/purchases" => redirect("/library") get "/purchases/search", to: "purchases#search" resources :checkout, only: [:index] resources :licenses, only: [:update] post "/preorders/:id/charge_preorder", to: "purchases#charge_preorder", as: "charge_preorder" resources :attachments, only: [:create] # users get "/users/current_user_data", to: "users#current_user_data", as: :current_user_data post "/users/deactivate", to: "users#deactivate", as: :deactivate_account # Used in Webflow site to change Login button to Dashboard button for signed in users get "/users/session_info", to: "users#session_info", as: :user_session_info post "/customer_surcharge/", to: "customer_surcharge#calculate_all", as: :customer_surcharges # links get "/l/product-name/offer-code" => redirect("/guide/basics/reach-your-audience#offers") get "/oauth_completions/stripe", to: "oauth_completions#stripe" resource :offer_codes, only: [] do get :compute_discount end resources :bundles, only: [:show, :update] do member do get "*other", to: "bundles#show" post :update_purchases_content end collection do get :products get :create_from_email end end resources :links, except: [:edit, :show, :update, :new] do resources :asset_previews, only: [:create, :destroy] resources :thumbnails, only: [:create, :destroy] resources :variants, only: [:index], controller: "products/variants" resource :mobile_tracking, only: [:show], path: "in_app", controller: "products/mobile_tracking" member do post :update post :publish post :unpublish post :increment_views post :track_user_action put :sections, action: :update_sections end end resources :product_duplicates, only: [:create, :show], format: :json put "/product_reviews/set", to: "product_reviews#set", format: :json resources :product_reviews, only: [:index, :show] resources :product_review_responses, only: [:update, :destroy], format: :json resources :product_review_videos, only: [] do scope module: :product_review_videos do resource :stream, only: [:show] resources :streaming_urls, only: [:index] end end namespace :product_review_videos do resource :upload_context, only: [:show] end resources :calls, only: [:update] resources :purchase_custom_fields, only: [:create] resources :commissions, only: [:update] do member do post :complete end end namespace :user do resource :invalidate_active_sessions, only: :update end get "/memberships/paged", to: "links#memberships_paged", as: :memberships_paged namespace :products do resources :affiliated, only: [:index] resources :collabs, only: [:index] do collection do get :products_paged get :memberships_paged end end resources :archived, only: %i[index create destroy] do collection do get :products_paged get :memberships_paged end end end resources :products, only: [:new], controller: "links" do scope module: :products, format: true, constraints: { format: :json } do resources :other_refund_policies, only: :index resources :remaining_call_availabilities, only: :index end end # TODO: move these within resources :products block above get "/products/paged", to: "links#products_paged", as: :products_paged get "/products/:id/edit", to: "links#edit", as: :edit_link get "/products/:id/edit/*other", to: "links#edit" get "/products/:id/card", to: "links#card", as: :product_card get "/products/search", to: "links#search" namespace :integrations do resources :circle, only: [], format: :json do collection do get :communities, as: :communities get :space_groups, as: :space_groups get :communities_and_space_groups, as: :communities_and_space_groups end end resources :discord, only: [], format: :json do collection do get :oauth_redirect get :server_info get :join_server get :leave_server end end resources :zoom, only: [] do collection do get :account_info get :oauth_redirect end end resources :google_calendar, only: [] do collection do get :account_info get :calendar_list get :oauth_redirect end end end get "/links/:id/edit" => redirect("/products/%{id}/edit") post "/products/:id/release_preorder", to: "links#release_preorder", as: :release_preorder get "/dashboard" => "dashboard#index", as: :dashboard get "/dashboard/customers_count" => "dashboard#customers_count", as: :dashboard_customers_count get "/dashboard/total_revenue" => "dashboard#total_revenue", as: :dashboard_total_revenue get "/dashboard/active_members_count" => "dashboard#active_members_count", as: :dashboard_active_members_count get "/dashboard/monthly_recurring_revenue" => "dashboard#monthly_recurring_revenue", as: :dashboard_monthly_recurring_revenue get "/dashboard/download_tax_form" => "dashboard#download_tax_form", as: :dashboard_download_tax_form get "/products", to: "links#index", as: :products get "/l/:id", to: "links#show", defaults: { format: "html" }, as: :short_link get "/l/:id/:code", to: "links#show", defaults: { format: "html" }, as: :short_link_offer_code get "/cart_items_count", to: "links#cart_items_count" get "/products/:id" => redirect("/l/%{id}") get "/product/:id" => redirect("/l/%{id}") get "/products/:id/:code" => redirect("/l/%{id}/%{code}") get "/product/:id/:code" => redirect("/l/%{id}/%{code}") # events post "/events/track_user_action", to: "events#create" # product files utility get "/product_files_utility/external_link_title", to: "product_files_utility#external_link_title", as: :external_link_title get "/product_files_utility/product_files/:product_id", to: "product_files_utility#download_product_files", as: :download_product_files get "/product_files_utility/folder_archive/:folder_id", to: "product_files_utility#download_folder_archive", as: :download_folder_archive # analytics get "/analytics" => redirect("/dashboard/sales") get "/dashboard/sales", to: "analytics#index", as: :sales_dashboard get "/analytics/data/by_date", to: "analytics#data_by_date", as: "analytics_data_by_date" get "/analytics/data/by_state", to: "analytics#data_by_state", as: "analytics_data_by_state" get "/analytics/data/by_referral", to: "analytics#data_by_referral", as: "analytics_data_by_referral" # audience get "/audience" => redirect("/dashboard/audience") get "/dashboard/audience", to: "audience#index", as: :audience_dashboard post "/audience/export", to: "audience#export", as: :audience_export get "/dashboard/consumption" => redirect("/dashboard/audience") # invoices get "/purchases/:id/generate_invoice/confirm", to: "purchases#confirm_generate_invoice" get "/purchases/:id/generate_invoice", to: "purchases#generate_invoice" # preorder post "/purchases/:id/cancel_preorder_by_seller", to: "purchases#cancel_preorder_by_seller", as: :cancel_preorder_by_seller # subscriptions get "/subscriptions/cancel_subscription/:id", to: redirect(path: "/subscriptions/%{id}/manage") get "/subscriptions/:id/cancel_subscription", to: redirect(path: "/subscriptions/%{id}/manage") get "/subscriptions/:id/edit_card", to: redirect(path: "/subscriptions/%{id}/manage") resources :subscriptions, only: [] do member do get :manage get :magic_link post :send_magic_link post :unsubscribe_by_user post :unsubscribe_by_seller put :update, to: "purchases#update_subscription" end end # posts post "/posts/:id/increment_post_views", to: "posts#increment_post_views", as: :increment_post_views post "/posts/:id/send_for_purchase/:purchase_id", to: "posts#send_for_purchase", as: :send_for_purchase # communities get "/communities(/:seller_id/:community_id)", to: "communities#index", as: :community # emails resources :emails, only: [:index, :new, :create, :edit, :update, :destroy] do collection do get :published get :scheduled get :drafts end end get "/posts", to: redirect("/emails") # workflows resources :workflows, only: [:index, :new, :create, :edit, :update, :destroy] do scope module: "workflows" do resources :emails, only: [:index] do patch :update, on: :collection end end end # utm links get "/utm_links" => redirect("/dashboard/utm_links") get "/dashboard/utm_links", to: "utm_links#index", as: :utm_links_dashboard # shipments post "/shipments/verify_shipping_address", to: "shipments#verify_shipping_address", as: :verify_shipping_address post "/shipments/:purchase_id/mark_as_shipped", to: "shipments#mark_as_shipped", as: :mark_as_shipped # balances get "/payouts", to: "balance#index", as: :balance resources :instant_payouts, only: [:create] namespace :payouts do resources :exportables, only: [:index] resources :exports, only: [:create] end # tax center get "/payouts/taxes", to: "tax_center#index", as: :tax_center get "/payouts/taxes/:year/:form_type/download", to: "tax_center#download", as: :download_tax_form # wishlists namespace :wishlists do resources :following, only: [:index] end resources :wishlists, only: [:index, :create, :update, :destroy] do resources :products, only: [:create], controller: "wishlists/products" resource :followers, only: [:destroy], controller: "wishlists/followers" do get :unsubscribe end end resources :reviews, only: [:index]
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/spring.rb
config/spring.rb
# frozen_string_literal: true %w[ .ruby-version .rbenv-vars tmp/restart.txt tmp/caching-dev.txt ].each { |path| Spring.watch(path) }
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/boot.rb
config/boot.rb
# frozen_string_literal: true # Chromedriver crashes when spawned with jemalloc in LD_PRELOAD. # By the time Rails is booted, jemalloc is already linked and keeping it in ENV is not necessary. ENV["LD_PRELOAD"] = "" ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. require "bootsnap/setup" # Speed up boot time by caching expensive operations. require "dotenv/load" # silence warning "You can remove `require ‘dalli/cas/client’` as this code has been rolled into the standard ‘dalli/client’." # TODO remove this when `suo` is updated module Kernel alias_method :original_require, :require def require(name) original_require name if name != "dalli/cas/client" end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/mailer.rb
config/initializers/mailer.rb
# frozen_string_literal: true require_relative "../../app/models/mailer_info" require_relative "../../app/models/mailer_info/delivery_method" if Rails.env.production? FOLLOWER_CONFIRMATION_MAIL_DOMAIN = GlobalConfig.get("FOLLOWER_CONFIRMATION_MAIL_DOMAIN_PROD", "followers.gumroad.com") CREATOR_CONTACTING_CUSTOMERS_MAIL_DOMAIN = GlobalConfig.get("CREATOR_CONTACTING_CUSTOMERS_MAIL_DOMAIN_PROD", "creators.gumroad.com") CUSTOMERS_MAIL_DOMAIN = GlobalConfig.get("CUSTOMERS_MAIL_DOMAIN_PROD", "customers.gumroad.com") else FOLLOWER_CONFIRMATION_MAIL_DOMAIN = GlobalConfig.get("FOLLOWER_CONFIRMATION_MAIL_DOMAIN_DEV", "staging.followers.gumroad.com") CREATOR_CONTACTING_CUSTOMERS_MAIL_DOMAIN = GlobalConfig.get("CREATOR_CONTACTING_CUSTOMERS_MAIL_DOMAIN_DEV", "staging.creators.gumroad.com") CUSTOMERS_MAIL_DOMAIN = GlobalConfig.get("CUSTOMERS_MAIL_DOMAIN_DEV", "staging.customers.gumroad.com") end SENDGRID_SMTP_ADDRESS = GlobalConfig.get("SENDGRID_SMTP_ADDRESS", "smtp.sendgrid.net") RESEND_SMTP_ADDRESS = GlobalConfig.get("RESEND_SMTP_ADDRESS", "smtp.resend.com") EMAIL_CREDENTIALS = { MailerInfo::EMAIL_PROVIDER_SENDGRID => { gumroad: { # For emails that are sent as Gumroad (e.g. password reset) address: SENDGRID_SMTP_ADDRESS, username: "apikey", password: GlobalConfig.get("SENDGRID_GUMROAD_TRANSACTIONS_API_KEY"), domain: DEFAULT_EMAIL_DOMAIN, }, followers: { # For follower confirmation emails address: SENDGRID_SMTP_ADDRESS, username: "apikey", password: GlobalConfig.get("SENDGRID_GUMROAD_FOLLOWER_CONFIRMATION_API_KEY"), domain: FOLLOWER_CONFIRMATION_MAIL_DOMAIN, }, creators: { # For emails that are sent on behalf of creators (e.g. product updates, subscription installments) address: SENDGRID_SMTP_ADDRESS, username: "apikey", password: GlobalConfig.get("SENDGRID_GR_CREATORS_API_KEY"), domain: CREATOR_CONTACTING_CUSTOMERS_MAIL_DOMAIN, }, customers: { # For customer / customer_low_priority emails address: SENDGRID_SMTP_ADDRESS, username: "apikey", password: GlobalConfig.get("SENDGRID_GR_CUSTOMERS_API_KEY"), domain: CUSTOMERS_MAIL_DOMAIN, levels: { level_1: { username: "apikey", password: GlobalConfig.get("SENDGRID_GR_CUSTOMERS_API_KEY"), domain: CUSTOMERS_MAIL_DOMAIN, }, level_2: { username: "apikey", password: GlobalConfig.get("SENDGRID_GR_CUSTOMERS_LEVEL_2_API_KEY"), domain: CUSTOMERS_MAIL_DOMAIN, } } }, }, MailerInfo::EMAIL_PROVIDER_RESEND => { gumroad: { # For emails that are sent as Gumroad (e.g. password reset) address: RESEND_SMTP_ADDRESS, username: "resend", password: GlobalConfig.get("RESEND_DEFAULT_API_KEY"), domain: DEFAULT_EMAIL_DOMAIN }, followers: { # For follower confirmation emails address: RESEND_SMTP_ADDRESS, username: "resend", password: GlobalConfig.get("RESEND_FOLLOWERS_API_KEY"), domain: FOLLOWER_CONFIRMATION_MAIL_DOMAIN, }, creators: { # For emails that are sent on behalf of creators (e.g. product updates, subscription installments) address: RESEND_SMTP_ADDRESS, username: "resend", password: GlobalConfig.get("RESEND_CREATORS_API_KEY"), domain: CREATOR_CONTACTING_CUSTOMERS_MAIL_DOMAIN, }, customers: { # For customer / customer_low_priority emails address: RESEND_SMTP_ADDRESS, username: "resend", password: GlobalConfig.get("RESEND_CUSTOMERS_API_KEY"), domain: CUSTOMERS_MAIL_DOMAIN, levels: { level_1: { username: "resend", password: GlobalConfig.get("RESEND_CUSTOMERS_API_KEY"), domain: CUSTOMERS_MAIL_DOMAIN, }, level_2: { username: "resend", password: GlobalConfig.get("RESEND_CUSTOMERS_LEVEL_2_API_KEY"), domain: CUSTOMERS_MAIL_DOMAIN, } } }, } }.freeze default_smtp_settings = MailerInfo.default_delivery_method_options(domain: :gumroad).merge( port: 587, authentication: :plain, enable_starttls_auto: true ) case Rails.env when "production", "staging" Rails.application.config.action_mailer.delivery_method = :smtp Rails.application.config.action_mailer.smtp_settings = default_smtp_settings when "test" Rails.application.config.action_mailer.delivery_method = :test when "development" Rails.application.config.action_mailer.delivery_method = :smtp Rails.application.config.action_mailer.smtp_settings = default_smtp_settings Rails.application.config.action_mailer.perform_deliveries = (ENV["ACTION_MAILER_SKIP_DELIVERIES"] != "1") end Rails.application.config.action_mailer.default_url_options = { host: DOMAIN, protocol: PROTOCOL } Rails.application.config.action_mailer.deliver_later_queue_name = :default SendGridApiResponseError = Class.new(StandardError) ResendApiResponseError = Class.new(StandardError)
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/content_security_policy.rb
config/initializers/content_security_policy.rb
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Define an application-wide content security policy. # See the Securing Rails Applications Guide for more information: # https://guides.rubyonrails.org/security.html#content-security-policy-header # Rails.application.configure do # config.content_security_policy do |policy| # policy.default_src :self, :https # policy.font_src :self, :https, :data # policy.img_src :self, :https, :data # policy.object_src :none # policy.script_src :self, :https # policy.style_src :self, :https # # Specify URI for violation reports # # policy.report_uri "/csp-violation-report-endpoint" # end # # # Generate session nonces for permitted importmap, inline scripts, and inline styles. # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } # config.content_security_policy_nonce_directives = %w(script-src style-src) # # # Report violations without enforcing the policy. # # config.content_security_policy_report_only = true # end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/filter_parameter_logging.rb
config/initializers/filter_parameter_logging.rb
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. # Use this to limit dissemination of sensitive information. # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. Rails.application.config.filter_parameters += %i[password cc_number number expiry_date cc_expiry cvc account_number account_number_repeated passphrase chargeable tax_id individual_tax_id business_tax_id ssn_first_three ssn_middle_two ssn_last_four]
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/security_headers.rb
config/initializers/security_headers.rb
# frozen_string_literal: true
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/chat_rooms.rb
config/initializers/chat_rooms.rb
# frozen_string_literal: true CHAT_ROOMS = { accounting: { slack: { channel: "accounting" } }, announcements: { slack: { channel: "gumroad-" } }, awards: { slack: { channel: "gumroad-awards" } }, internals_log: { slack: { channel: "gumroad-" } }, migrations: { slack: { channel: "gumroad-" } }, payouts: { slack: { channel: "gumroad-" } }, payments: { slack: { channel: "accounting" } }, risk: { slack: { channel: "gumroad-" } }, test: { slack: { channel: "test" } }, iffy_log: { slack: { channel: "gumroad-iffy-log" } }, }.freeze
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/application_controller_renderer.rb
config/initializers/application_controller_renderer.rb
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # ActiveSupport::Reloader.to_prepare do # ApplicationController.renderer.defaults.merge!( # http_host: 'example.org', # https: false # ) # end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/mail_encodings.rb
config/initializers/mail_encodings.rb
# frozen_string_literal: true # TODO (vishal): Remove this initializer when we start relying on a Rails # version that includes this change https://github.com/rails/rails/pull/46650. # # Following code overrides the Mail::Encodings::QuoatedPritable class # as per https://github.com/mikel/mail/pull/1210. # See https://github.com/gumroad/web/pull/24988 for more information. module Mail module Encodings class QuotedPrintable < SevenBit def self.decode(str) ::Mail::Utilities.to_lf ::Mail::Utilities.to_crlf(str).gsub(/(?:=0D=0A|=0D|=0A)\r\n/, "\r\n").unpack("M*").first end def self.encode(str) ::Mail::Utilities.to_crlf [::Mail::Utilities.to_lf(str)].pack("M") end end end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/alterity.rb
config/initializers/alterity.rb
# frozen_string_literal: true Alterity.configure do |config| config.command = -> (altered_table, alter_argument) { password_argument = "--password='#{config.password}'" if config.password.present? <<~SHELL.squish pt-online-schema-change -h #{config.host} -P #{config.port} -u #{config.username} #{password_argument} --nocheck-replication-filters --critical-load Threads_running=1000 --max-load Threads_running=200 --set-vars lock_wait_timeout=1 --recursion-method 'dsn=D=#{config.replicas_dsns_database},t=#{config.replicas_dsns_table}' --execute --no-check-alter D=#{config.database},t=#{altered_table} --alter #{alter_argument} SHELL } config.replicas( database: "percona", table: "replicas_dsns", dsns: REPLICAS_HOSTS ) # Notify team of migrations running, on a best-effort basis, synchronously. # Only for production and main staging environments. send_slack_message = Rails.env.production? || (Rails.env.staging? && ENV["BRANCH_DEPLOYMENT"].blank?) config.before_command = lambda do |command| next unless send_slack_message command_clean = command.gsub(/.* (D=.*)/, "\\1").gsub("\\`", "") SlackMessageWorker.new.perform("migrations", "Web", "*[#{Rails.env}] Will execute migration:* #{command_clean}") rescue => _ end config.on_command_output = lambda do |output| next unless send_slack_message output.strip! next if output.blank? next if output.in?([ # needless log of configuration from PT-OSC "Operation, tries, wait:", "analyze_table, 10, 1", "copy_rows, 10, 0.25", "create_triggers, 10, 1", "drop_triggers, 10, 1", "swap_tables, 10, 1", "update_foreign_keys, 10, 1", ]) SlackMessageWorker.new.perform("migrations", "Web", output) rescue => _ end config.after_command = lambda do |exit_status| next unless send_slack_message color = exit_status == 0 ? "green" : "red" SlackMessageWorker.new.perform("migrations", "Web", "Command exited with status #{exit_status}", color) rescue => _ end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/vatstack.rb
config/initializers/vatstack.rb
# frozen_string_literal: true # Vatstack gives us two API keys — one for Development, and one for Production. # We're using the Production key in production, and the Development key everywhere else. VATSTACK_API_KEY = GlobalConfig.get("VATSTACK_API_KEY")
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/state_machine.rb
config/initializers/state_machine.rb
# frozen_string_literal: true module StateMachines::Integrations::ActiveModel alias around_validation_protected around_validation def around_validation(*args, &block) around_validation_protected(*args, &block) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/iras.rb
config/initializers/iras.rb
# frozen_string_literal: true # IRAS gives us two sets of credentials — one for Sandbox, and one for Production. # We're using the Production set in production, and the Sandbox set everywhere else. IRAS_API_ID = GlobalConfig.get("IRAS_API_ID") IRAS_API_SECRET = GlobalConfig.get("IRAS_API_SECRET") if Rails.env.production? IRAS_ENDPOINT = "https://apiservices.iras.gov.sg/iras/prod/GSTListing/SearchGSTRegistered" else IRAS_ENDPOINT = "https://apisandbox.iras.gov.sg/iras/sb/GSTListing/SearchGSTRegistered" end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/js-routes.rb
config/initializers/js-routes.rb
# frozen_string_literal: true JsRoutes.setup do |config| config.url_links = true # Don't determine protocol from window.location (prerendering) config.default_url_options = { protocol: PROTOCOL, host: DOMAIN } config.exclude = [/^api_/] end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/time_formats.rb
config/initializers/time_formats.rb
# frozen_string_literal: true Time::DATE_FORMATS[:long_formatted_datetime] = "%e %b %Y %l:%M %p" Time::DATE_FORMATS[:formatted_date_full_month] = "%B %-d, %Y" Time::DATE_FORMATS[:formatted_date_abbrev_month] = "%b %-d, %Y" Time::DATE_FORMATS[:slashed] = "%-m/%-d/%Y"
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/sidekiq.rb
config/initializers/sidekiq.rb
# frozen_string_literal: true # `sidekiq-pro` is now only autoloaded in staging/production due to the Gemfile # group. This ensures `sidekiq-pro` is correctly loaded in all environments # when available. begin require "sidekiq-pro" rescue LoadError warn "sidekiq-pro is not installed" end require Rails.root.join("lib", "extras", "sidekiq_makara_reset_context_middleware") Sidekiq.configure_server do |config| config.redis = { url: "redis://#{ENV["SIDEKIQ_REDIS_HOST"]}" } if defined?(Sidekiq::Pro) # https://github.com/mperham/sidekiq/wiki/Reliability#using-super_fetch config.super_fetch! # https://github.com/mperham/sidekiq/wiki/Reliability#scheduler config.reliable_scheduler! end # Cleanup Dead Locks # https://github.com/mhenrixon/sidekiq-unique-jobs/tree/ec69ac93afccd56cd424e2a9738e5ed478d941b2#cleanup-dead-locks config.death_handlers << ->(job, _ex) do SidekiqUniqueJobs::Digests.delete_by_digest(job["unique_digest"]) if job["unique_digest"] end config.client_middleware do |chain| chain.add SidekiqUniqueJobs::Middleware::Client end config.server_middleware do |chain| chain.add SidekiqMakaraResetContextMiddleware chain.add SidekiqUniqueJobs::Middleware::Server end # The number of jobs that are stored after retries are exhausted. config[:dead_max_jobs] = 20_000_000 SidekiqUniqueJobs::Server.configure(config) end Sidekiq.configure_client do |config| config.redis = { url: "redis://#{ENV["SIDEKIQ_REDIS_HOST"]}" } config.client_middleware do |chain| chain.add SidekiqUniqueJobs::Middleware::Client end end SidekiqUniqueJobs.configure do |config| config.enabled = !Rails.env.test? end # https://github.com/mperham/sidekiq/wiki/Pro-Reliability-Client Sidekiq::Client.reliable_push! if defined?(Sidekiq::Pro) && !Rails.env.test? # Store exception backtrace # https://github.com/mperham/sidekiq/wiki/Error-Handling#backtrace-logging Sidekiq.default_job_options = { "backtrace" => true, "retry" => 25 }
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/lograge.rb
config/initializers/lograge.rb
# frozen_string_literal: true Rails.application.config.lograge.custom_options = lambda do |event| params = { remote_ip: event.payload[:remote_ip] } headers = event.payload[:headers] uuid = event.payload[:uuid] payload_params = event.payload[:params] if payload_params.present? if payload_params["controller"] == "logins" && payload_params["action"] == "create" if payload_params["user"] params[:login_identifier] = payload_params["user"]["login_identifier"] params[:login] = payload_params["user"]["login"] end end if payload_params["controller"] == "signup" && payload_params["action"] == "create" if payload_params["user"] params[:email] = payload_params.dig("user", "email") params[:buyer_signup] = payload_params.dig("user", "buyer_signup") params["g-recaptcha-response"] = payload_params["g-recaptcha-response"] end end end { "params" => params, "headers" => headers, "uuid" => uuid } end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/geoip.rb
config/initializers/geoip.rb
# frozen_string_literal: true require "maxmind/geoip2" database_path = "#{Rails.root}/lib/GeoIP2-City.mmdb" GEOIP = File.exist?(database_path) ? MaxMind::GeoIP2::Reader.new(database: database_path) : nil
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/secure_headers.rb
config/initializers/secure_headers.rb
# frozen_string_literal: true cookie_config = if PROTOCOL == "https" { httponly: true, secure: true, samesite: { none: true } } else { httponly: true, secure: SecureHeaders::OPT_OUT, samesite: { lax: true } } end SecureHeaders::Configuration.default do |config| config.cookies = cookie_config config.hsts = SecureHeaders::OPT_OUT config.x_frame_options = SecureHeaders::OPT_OUT config.x_content_type_options = "nosniff" config.x_xss_protection = "1; mode=block" config.csp = { default_src: ["https", "'self'"], frame_src: ["*", "data:", "blob:"], worker_src: ["*", "data:", "blob:"], object_src: ["*", "data:", "blob:"], child_src: ["*", "data:", "blob:"], img_src: ["*", "data:", "blob:"], font_src: ["*", "data:", "blob:"], media_src: ["*", "data:", "blob:"], connect_src: [ "'self'", "blob:", # dropbox "www.dropbox.com", "api.dropboxapi.com", # direct file uploads to s3/minio "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}", "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/", # direct file uploads to aws s3/minio "#{AWS_S3_ENDPOINT}/#{PUBLIC_STORAGE_S3_BUCKET}", "#{AWS_S3_ENDPOINT}/#{PUBLIC_STORAGE_S3_BUCKET}/", # direct file uploads to aws s3 "#{PUBLIC_STORAGE_S3_BUCKET}.s3.amazonaws.com", "#{PUBLIC_STORAGE_S3_BUCKET}.s3.amazonaws.com/", # direct file uploads to aws s3 "s3.amazonaws.com/#{PUBLIC_STORAGE_S3_BUCKET}", "s3.amazonaws.com/#{PUBLIC_STORAGE_S3_BUCKET}/", # recaptcha "www.google.com", "www.gstatic.com", # facebook "*.facebook.com", "*.facebook.net", # google analytics "*.google-analytics.com", "*.g.doubleclick.net", "*.googletagmanager.com", "analytics.google.com", "*.analytics.google.com", # cloudfront FILE_DOWNLOAD_DISTRIBUTION_URL, HLS_DISTRIBUTION_URL, # paypal "*.braintreegateway.com", "www.paypalobjects.com", "*.paypal.com", "*.braintree-api.com", # oembeds - rich text editor "iframe.ly", # helper widget "help.gumroad.com", ], script_src: [ "'self'", "'unsafe-eval'", # Cloudflare - Rocket Loader "ajax.cloudflare.com", # Cloudflare - Browser Insights "static.cloudflareinsights.com", # stripe frontend tokenization "js.stripe.com", "api.stripe.com", "connect-js.stripe.com", # braintree "*.braintreegateway.com", "*.braintree-api.com", # paypal "www.paypalobjects.com", "*.paypal.com", # google analytics "*.google-analytics.com", "*.googletagmanager.com", # google optimize "optimize.google.com", # google ads "www.googleadservices.com", # recaptcha "www.google.com", "www.gstatic.com", # facebook login and other uses "*.facebook.net", "*.facebook.com", # send to dropbox "www.dropbox.com", # oembeds - youtube "s.ytimg.com", "www.google.com", # oembeds - rich text editor "cdn.iframe.ly", "platform.twitter.com", # jw player "cdn.jwplayer.com", "*.jwpcdn.com", # mailchimp "gumroad.us3.list-manage.com", # twitter "analytics.twitter.com", # helper widget "help.gumroad.com", # lottie - homepage "unpkg.com/@lottiefiles/lottie-player@latest/" ], style_src: [ "'self'", # custom css is in inline tags "'unsafe-inline'", # oembeds - youtube "s.ytimg.com", # google optimize "optimize.google.com", # google fonts "fonts.googleapis.com" ] } config.csp[:connect_src] << "#{DOMAIN}" config.csp[:script_src] << "#{DOMAIN}" # Required by AnyCable config.csp[:connect_src] << "wss://#{ANYCABLE_HOST}" # Required for realtime events in Helper widget config.csp[:connect_src] << "wss://#{ENV["HELPER_SUPABASE_DOMAIN"]}" if ENV["HELPER_SUPABASE_DOMAIN"].present? if Rails.application.config.asset_host.present? config.csp[:connect_src] << Rails.application.config.asset_host config.csp[:script_src] << Rails.application.config.asset_host config.csp[:style_src] << Rails.application.config.asset_host end if Rails.env.test? config.csp[:default_src] = ["'self'"] config.csp[:style_src] << "blob:" # Required by Shakapacker to serve CSS config.csp[:script_src] << "test-custom-domain.gumroad.com:#{URI("#{PROTOCOL}://#{DOMAIN}").port}" # To allow loading widget scripts from the custom domain config.csp[:script_src] << ROOT_DOMAIN # Required to load gumroad.js for overlay/embed. config.csp[:connect_src] << "ws://#{ANYCABLE_HOST}:8080" # Required by AnyCable config.csp[:connect_src] << "wss://#{ANYCABLE_HOST}:8080" # Required by AnyCable elsif Rails.env.development? config.csp[:default_src] = ["'self'"] config.csp[:style_src] << "blob:" # Required by Shakapacker to serve CSS config.csp[:script_src] << "gumroad.dev:3035" # Required by webpack-dev-server config.csp[:script_src] << "'unsafe-inline'" # Allow react-on-rails to inject server-rendering logs into the browser config.csp[:connect_src] << "gumroad.dev:3035" # Required by webpack-dev-server config.csp[:connect_src] << "wss://gumroad.dev:3035" # Required by webpack-dev-server config.csp[:connect_src] << "wss://#{ANYCABLE_HOST}:8081" # Required by AnyCable config.csp[:connect_src] << "helperai.dev" # Required by Helper widget config.csp[:connect_src] << "wss://supabase.helperai.dev" # Required by Helper widget config.csp[:connect_src] << "http:" config.csp[:script_src] << "http:" # Required by Helper widget config.csp[:script_src] << "helperai.dev" # Required by Helper widget end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/rack_timeout.rb
config/initializers/rack_timeout.rb
# frozen_string_literal: true unless ENV["DISABLE_RACK_TIMEOUT"] == "1" Rails.application.config.middleware.insert_before( Rack::Runtime, Rack::Timeout, service_timeout: 120, wait_overtime: 24.hours.to_i, wait_timeout: false ) Rack::Timeout::Logger.disable unless ENV["ENABLE_RACK_TIMEOUT_LOGS"] == "1" end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/active_support_cache_notifications.rb
config/initializers/active_support_cache_notifications.rb
# frozen_string_literal: true Rails.application.config.after_initialize do cache_to_metric_keys = { ProfileSectionsPresenter::CACHE_KEY_PREFIX => "#{ProfileSectionsPresenter::CACHE_KEY_PREFIX}-metrics", ProductPresenter::ProductProps::SALES_COUNT_CACHE_KEY_REFIX => ProductPresenter::ProductProps::SALES_COUNT_CACHE_METRICS_KEY, } ActiveSupport::Notifications.subscribe "cache_read.active_support" do |event| cache_to_metric_keys.each do |key_prefix, metrics_key| if event.payload[:key].starts_with?(key_prefix) $redis.hincrby(metrics_key, event.payload[:hit] ? "hits" : "misses", 1) break end end end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/session_store.rb
config/initializers/session_store.rb
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Use tld_length 3 in staging to support subdomains like username.staging.gumroad.com tld_length = Rails.env.staging? ? 3 : 2 expire_after = Rails.env.test? ? 10.years : 1.month domain = :all base_cookie_name = "_gumroad_app_session" session_cookie_name = case Rails.env.to_sym when :production base_cookie_name when :staging if ENV["BRANCH_DEPLOYMENT"].present? domain = ".#{DOMAIN}" "#{base_cookie_name}_#{Digest::SHA256.hexdigest(DOMAIN)[0..31]}" else "#{base_cookie_name}_staging" end else "#{base_cookie_name}_#{Rails.env}" end Rails.application.config.session_store :cookie_store, key: session_cookie_name, secure: Rails.env.production?, domain:, expire_after:, tld_length:
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/friendly_id.rb
config/initializers/friendly_id.rb
# frozen_string_literal: true # FriendlyId Global Configuration # # Use this to set up shared configuration options for your entire application. # Any of the configuration options shown here can also be applied to single # models by passing arguments to the `friendly_id` class method or defining # methods in your model. # # To learn more, check out the guide: # # http://norman.github.io/friendly_id/file.Guide.html FriendlyId.defaults do |config| # ## Reserved Words # # Some words could conflict with Rails's routes when used as slugs, or are # undesirable to allow as slugs. Edit this list as needed for your app. config.use :reserved config.reserved_words = %w(new edit index session login logout users admin stylesheets assets javascripts images) # This adds an option to treat reserved words as conflicts rather than exceptions. # When there is no good candidate, a UUID will be appended, matching the existing # conflict behavior. # config.treat_reserved_as_conflict = true # ## Friendly Finders # # Uncomment this to use friendly finders in all models. By default, if # you wish to find a record by its friendly id, you must do: # # MyModel.friendly.find('foo') # # If you uncomment this, you can do: # # MyModel.find('foo') # # This is significantly more convenient but may not be appropriate for # all applications, so you must explicity opt-in to this behavior. You can # always also configure it on a per-model basis if you prefer. # # Something else to consider is that using the :finders addon boosts # performance because it will avoid Rails-internal code that makes runtime # calls to `Module.extend`. # # config.use :finders # # ## Slugs # # Most applications will use the :slugged module everywhere. If you wish # to do so, uncomment the following line. # # config.use :slugged # # By default, FriendlyId's :slugged addon expects the slug column to be named # 'slug', but you can change it if you wish. # # config.slug_column = 'slug' # # By default, slug has no size limit, but you can change it if you wish. # # config.slug_limit = 255 # # When FriendlyId can not generate a unique ID from your base method, it appends # a UUID, separated by a single dash. You can configure the character used as the # separator. If you're upgrading from FriendlyId 4, you may wish to replace this # with two dashes. # # config.sequence_separator = '-' # # Note that you must use the :slugged addon **prior** to the line which # configures the sequence separator, or else FriendlyId will raise an undefined # method error. # # ## Tips and Tricks # # ### Controlling when slugs are generated # # As of FriendlyId 5.0, new slugs are generated only when the slug field is # nil, but if you're using a column as your base method can change this # behavior by overriding the `should_generate_new_friendly_id?` method that # FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave # more like 4.0. # Note: Use(include) Slugged module in the config if using the anonymous module. # If you have `friendly_id :name, use: slugged` in the model, Slugged module # is included after the anonymous module defined in the initializer, so it # overrides the `should_generate_new_friendly_id?` method from the anonymous module. # # config.use :slugged # config.use Module.new { # def should_generate_new_friendly_id? # slug.blank? || <your_column_name_here>_changed? # end # } # # FriendlyId uses Rails's `parameterize` method to generate slugs, but for # languages that don't use the Roman alphabet, that's not usually sufficient. # Here we use the Babosa library to transliterate Russian Cyrillic slugs to # ASCII. If you use this, don't forget to add "babosa" to your Gemfile. # # config.use Module.new { # def normalize_friendly_id(text) # text.to_slug.normalize! :transliterations => [:russian, :latin] # end # } end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/prefix_for_branch_apps_es_index.rb
config/initializers/prefix_for_branch_apps_es_index.rb
# frozen_string_literal: true if Rails.env.staging? && ENV["BRANCH_DEPLOYMENT"] == "true" Rails.application.config.after_initialize do [Link, Balance, Purchase, Installment, ConfirmedFollowerEvent, ProductPageView].each do |model| model.index_name("branch-app-#{ENV['DATABASE_NAME']}__#{model.name.parameterize}") model.__elasticsearch__.create_index! end end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/feature_toggle.rb
config/initializers/feature_toggle.rb
# frozen_string_literal: true Flipper.configure do |config| config.adapter { Flipper::Adapters::Redis.new($redis) } end Rails.application.config.flipper.preload = false Flipper::UI.configuration.application_breadcrumb_href = "/admin" Flipper::UI.configuration.cloud_recommendation = false Flipper::UI.configuration.fun = false # Flipper UI uses <script> tags to load external JS and CSS. # FlipperCSP adds domains to existing Content Security Policy for a single route class FlipperCSP def initialize(app) @app = app end def call(env) SecureHeaders.append_content_security_policy_directives( Rack::Request.new(env), { script_src: %w(code.jquery.com cdnjs.cloudflare.com cdn.jsdelivr.net), style_src: %w(cdn.jsdelivr.net) } ) @app.call(env) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/gumroad.rb
config/initializers/gumroad.rb
# frozen_string_literal: true GUMROAD_VAT_REGISTRATION_NUMBER = GlobalConfig.get("VAT_REGISTRATION_NUMBER", "EU826410924") GUMROAD_AUSTRALIAN_BUSINESS_NUMBER = GlobalConfig.get("AUSTRALIAN_BUSINESS_NUMBER", "11 374 928 117") GUMROAD_CANADA_GST_REGISTRATION_NUMBER = GlobalConfig.get("CANADA_GST_REGISTRATION_NUMBER", "701850612 RT9999") GUMROAD_QST_REGISTRATION_NUMBER = GlobalConfig.get("QST_REGISTRATION_NUMBER", "NR00086053") GUMROAD_NORWAY_VAT_REGISTRATION = GlobalConfig.get("NORWAY_VAT_REGISTRATION", "VOEC NO. 2082039") # TODO: This is a placeholder for other tax registration numbers. # As we activate "collect_tax_*" features, we'll need to add the appropriate # tax registration number here for each country. (curtiseinsmann) GUMROAD_OTHER_TAX_REGISTRATION = GlobalConfig.get("OTHER_TAX_REGISTRATION", "OTHER") REPORTING_S3_BUCKET = if Rails.env.production? GlobalConfig.get("REPORTING_S3_BUCKET_PROD", "gumroad-reporting") else GlobalConfig.get("REPORTING_S3_BUCKET_DEV", "gumroad-reporting-dev") end GUMROAD_MERCHANT_DESCRIPTOR_PHONE_NUMBER = GlobalConfig.get("MERCHANT_DESCRIPTOR_PHONE", "(650)742-3913") # Must be 10-14 GUMROAD_MERCHANT_DESCRIPTOR_URL = GlobalConfig.get("MERCHANT_DESCRIPTOR_URL", "gumroad.com/c") # Must be 0-13 GUMROAD_LOGO_URL = GlobalConfig.get("LOGO_URL", "https://gumroad.com/button/button_logo.png") module GumroadAddress STREET = GlobalConfig.get("ADDRESS_STREET", "548 Market St") CITY = GlobalConfig.get("ADDRESS_CITY", "San Francisco") STATE = GlobalConfig.get("ADDRESS_STATE", "CA") ZIP = GlobalConfig.get("ADDRESS_ZIP", "94104") ZIP_PLUS_FOUR = "#{ZIP}-#{GlobalConfig.get("ADDRESS_ZIP_PLUS_FOUR", "5401")}" COUNTRY = ISO3166::Country[GlobalConfig.get("ADDRESS_COUNTRY", "US")] def self.full "#{STREET}, #{CITY}, #{STATE} #{ZIP_PLUS_FOUR}, #{COUNTRY.alpha3}" end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/devise.rb
config/initializers/devise.rb
# frozen_string_literal: true require "omniauth-facebook" require "omniauth-twitter" require "omniauth-google-oauth2" # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render invalid all existing # confirmation, reset password and unlock tokens in the database. # Devise will use the `secret_key_base` as its `secret_key` # by default. You can change it below and use your own secret key. config.secret_key = ENV.fetch("DEVISE_SECRET_KEY") # ==> Controller configuration # Configure the parent class to the devise controllers. # config.parent_controller = 'DeviseController' # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class # with default "from" parameter. config.mailer_sender = ->(_devise_mapping) { ApplicationMailer::NOREPLY_EMAIL_WITH_NAME } # Configure the class responsible to send e-mails. config.mailer = "UserSignupMailer" # Configure the parent class responsible to send e-mails. # config.parent_mailer = "ActionMailer::Base" # ==> ORM configuration # Load and configure the ORM. Supports :active_record (default) and # :mongoid (bson_ext recommended) by default. Other ORMs may be # available as additional gems. require "devise/orm/active_record" # ==> Configuration for any authentication mechanism # Configure which keys are used when authenticating a user. The default is # just :email. You can configure it to use [:username, :subdomain], so for # authenticating a user, both parameters are required. Remember that those # parameters are used only when authenticating and not when retrieving from # session. If you need permissions, you should implement that in a before filter. # You can also supply a hash where the value is a boolean determining whether # or not authentication should be aborted when the value is not present. config.authentication_keys = [:login] # Configure parameters from the request object used for authentication. Each entry # given should be a request method and it will automatically be passed to the # find_for_authentication method and considered in your model lookup. For instance, # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. # The same considerations mentioned for authentication_keys also apply to request_keys. # config.request_keys = [] # Configure which authentication keys should be case-insensitive. # These keys will be downcased upon creating or modifying a user and when used # to authenticate or find a user. Default is :email. config.case_insensitive_keys = [:login] # Configure which authentication keys should have whitespace stripped. # These keys will have whitespace before and after removed upon creating or # modifying a user and when used to authenticate or find a user. Default is :email. config.strip_whitespace_keys = [:login] # Tell if authentication through request.params is enabled. True by default. # It can be set to an array that will enable params authentication only for the # given strategies, for example, `config.params_authenticatable = [:database]` will # enable it only for database (email + password) authentication. # config.params_authenticatable = true # Tell if authentication through HTTP Auth is enabled. False by default. # It can be set to an array that will enable http authentication only for the # given strategies, for example, `config.http_authenticatable = [:database]` will # enable it only for database authentication. The supported strategies are: # :database = Support basic authentication with authentication key + password # config.http_authenticatable = false # If 401 status code should be returned for AJAX requests. True by default. # config.http_authenticatable_on_xhr = true # The realm used in Http Basic Authentication. 'Application' by default. # config.http_authentication_realm = 'Application' # It will change confirmation, password recovery and other workflows # to behave the same regardless if the e-mail provided was right or wrong. # Does not affect registerable. # config.paranoid = true # By default Devise will store the user in session. You can skip storage for # particular strategies by setting this option. # Notice that if you are skipping storage for all authentication paths, you # may want to disable generating routes to Devise's sessions controller by # passing skip: :sessions to `devise_for` in your config/routes.rb # config.skip_session_storage = [:http_auth] # By default, Devise cleans up the CSRF token on authentication to # avoid CSRF token fixation attacks. This means that, when using AJAX # requests for sign in and sign up, you need to get a new CSRF token # from the server. You can disable this option at your own risk. # config.clean_up_csrf_token_on_authentication = true # When false, Devise will not attempt to reload routes on eager load. # This can reduce the time taken to boot the app but if your application # requires the Devise mappings to be loaded during boot time the application # won't boot properly. # config.reload_routes = true # ==> Configuration for :database_authenticatable # For bcrypt, this is the cost for hashing the password and defaults to 11. If # using other algorithms, it sets how many times you want the password to be hashed. # # Limiting the stretches to just one in testing will increase the performance of # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use # a value less than 10 in other environments. Note that, for bcrypt (the default # algorithm), the cost increases exponentially with the number of stretches (e.g. # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). config.stretches = Rails.env.test? ? 1 : 11 # Set up a pepper to generate the hashed password. config.pepper = GlobalConfig.get("DEVISE_PEPPER") # Send a notification to the original email when the user's email is changed. config.send_email_changed_notification = true # Send a notification email when the user's password is changed. # config.send_password_change_notification = false # ==> Configuration for :confirmable # A period that the user is allowed to access the website even without # confirming their account. For instance, if set to 2.days, the user will be # able to access the website for two days without confirming their account, # access will be blocked just in the third day. # You can also set it to nil, which will allow the user to access the website # without confirming their account. # Default is 0.days, meaning the user cannot access the website without # confirming their account. # config.allow_unconfirmed_access_for = 2.days # A period that the user is allowed to confirm their account before their # token becomes invalid. For example, if set to 3.days, the user can confirm # their account within 3 days after the mail was sent, but on the fourth day # their account can't be confirmed with the token any more. # Default is nil, meaning there is no restriction on how long a user can take # before confirming their account. # config.confirm_within = 3.days # If true, requires any email changes to be confirmed (exactly the same way as # initial account confirmation) to be applied. Requires additional unconfirmed_email # db field (see migrations). Until confirmed, new email is stored in # unconfirmed_email column, and copied to email column on successful confirmation. config.reconfirmable = true # Defines which key will be used when confirming an account # config.confirmation_keys = [:email] # ==> Configuration for :rememberable # The time the user will be remembered without asking for credentials again. config.remember_for = 1.month # Invalidates all the remember me tokens when the user signs out. # config.expire_all_remember_me_on_sign_out = true # If true, extends the user's remember period when remembered via cookie. # config.extend_remember_period = false # Options to be passed to the created cookie. For instance, you can set # secure: true in order to force SSL only cookies. # config.rememberable_options = {} # ==> Configuration for :validatable # Range for password length. config.password_length = 6..128 # Email regex used to validate email formats. It simply asserts that # one (and only one) @ exists in the given string. This is mainly # to give user feedback and not to assert the e-mail validity. # config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ # ==> Configuration for :timeoutable # The time you want to timeout the user session without activity. After this # time the user will be asked for credentials again. Default is 30 minutes. # config.timeout_in = 30.minutes # ==> Configuration for :lockable # Defines which strategy will be used to lock an account. # :failed_attempts = Locks an account after a number of failed attempts to sign in. # :none = No lock strategy. You should handle locking by yourself. # config.lock_strategy = :failed_attempts # Defines which key will be used when locking and unlocking an account # config.unlock_keys = [:email] # Defines which strategy will be used to unlock an account. # :email = Sends an unlock link to the user email # :time = Re-enables login after a certain amount of time (see :unlock_in below) # :both = Enables both strategies # :none = No unlock strategy. You should handle unlocking by yourself. # config.unlock_strategy = :both # Number of authentication tries before locking an account if lock_strategy # is failed attempts. # config.maximum_attempts = 20 # Time interval to unlock the account if :time is enabled as unlock_strategy. # config.unlock_in = 1.hour # Warn on the last attempt before the account is locked. # config.last_attempt_warning = true # ==> Configuration for :recoverable # # Defines which key will be used when recovering the password for an account # config.reset_password_keys = [:email] # Time interval you can reset your password with a reset password key. # Don't put a too small interval or your users won't have the time to # change their passwords. config.reset_password_within = 24.hours # When set to false, does not sign a user in automatically after their password is # reset. Defaults to true, so a user is signed in automatically after a reset. # config.sign_in_after_reset_password = true # ==> Configuration for :encryptable # Allow you to use another hashing or encryption algorithm besides bcrypt (default). # You can use :sha1, :sha512 or algorithms from others authentication tools as # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 # for default behavior) and :restful_authentication_sha1 (then you should set # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). # # Require the `devise-encryptable` gem when using anything other than bcrypt # config.encryptor = :sha512 # ==> Scopes configuration # Turn scoped views on. Before rendering "sessions/new", it will first check for # "users/sessions/new". It's turned off by default because it's slower if you # are using only default views. # config.scoped_views = false # Configure the default scope given to Warden. By default it's the first # devise role declared in your routes (usually :user). # config.default_scope = :user # Set this configuration to false if you want /users/sign_out to sign out # only the current scope. By default, Devise signs out all scopes. # config.sign_out_all_scopes = true # ==> Navigation configuration # Lists the formats that should be treated as navigational. Formats like # :html, should redirect to the sign in page when the user does not have # access, but formats like :xml or :json, should return 401. # # If you have any extra navigational formats, like :iphone or :mobile, you # should add them to the navigational formats lists. # # The "*/*" below is required to match Internet Explorer requests. # config.navigational_formats = ['*/*', :html] # The default HTTP method used to sign out a resource. Default is :delete. config.sign_out_via = :delete # ==> OmniAuth # Add a new OmniAuth provider. Check the wiki for more information on setting # up on your models and hooks. # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' config.omniauth :facebook, FACEBOOK_APP_ID, FACEBOOK_APP_SECRET, scope: "email,pages_manage_ads,pages_manage_metadata,pages_read_engagement,pages_read_user_content", info_fields: "name,email,verified,gender,link", client_options: { site: "https://graph.facebook.com/#{FACEBOOK_API_VERSION}", authorize_url: "https://www.facebook.com/#{FACEBOOK_API_VERSION}/dialog/oauth" }, token_params: { parse: :json } config.omniauth :twitter, TWITTER_APP_ID, TWITTER_APP_SECRET config.omniauth :stripe_connect, STRIPE_CONNECT_CLIENT_ID, STRIPE_SECRET, scope: "read_write" config.omniauth :google_oauth2, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, scope: "email,profile" # ==> Warden configuration # If you want to use other strategies, that are not supported by Devise, or # change the failure app, you can configure them inside the config.warden block. # # config.warden do |manager| # manager.intercept_401 = false # manager.default_strategies(scope: :user).unshift :some_external_strategy # end # ==> Mountable engine configurations # When using Devise inside an engine, let's call it `MyEngine`, and this engine # is mountable, there are some extra configurations to be taken into account. # The following options are available, assuming the engine is mounted as: # # mount MyEngine, at: '/my_engine' # # The router that invoked `devise_for`, in the example above, would be: config.router_name = :main_app # # When using OmniAuth, Devise cannot automatically set OmniAuth path, # so you need to do it manually. For the users scope, it would be: # config.omniauth_path_prefix = '/my_engine/users/auth' # ==> Turbolinks configuration # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly: # # ActiveSupport.on_load(:devise_failure_app) do # include Turbolinks::Controller # end # ==> Configuration for :registerable # When set to false, does not sign a user in automatically after their password is # changed. Defaults to true, so a user is signed in automatically after changing a password. # config.sign_in_after_change_password = true end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/spec_api_credentials.rb
config/initializers/spec_api_credentials.rb
# frozen_string_literal: true SPEC_API_USERNAME = GlobalConfig.get("SPEC_API_USERNAME") SPEC_API_PASSWORD = GlobalConfig.get("SPEC_API_PASSWORD")
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/dropbox.rb
config/initializers/dropbox.rb
# frozen_string_literal: true DROPBOX_PICKER_API_KEY = GlobalConfig.get("DROPBOX_PICKER_API_KEY")
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/doorkeeper.rb
config/initializers/doorkeeper.rb
# frozen_string_literal: true require "cgi" module VisibleScopes # Public Method: public_scopes # These are the scopes that the public should be aware of. Update this list when adding scopes to Doorkeeper. # Mobile Api scope is not included because we don't want the public to have knowledge of that scope. def public_scopes %i[edit_products view_sales mark_sales_as_shipped edit_sales revenue_share ifttt view_profile view_payouts] end end Doorkeeper.configure do base_controller "ApplicationController" orm :active_record # This block will be called to check whether the resource owner is # authenticated or not. resource_owner_authenticator do current_user.presence || redirect_to("/oauth/login?next=#{CGI.escape request.fullpath}") end admin_authenticator do |_routes| current_user.presence || redirect_to("/oauth/login?next=#{CGI.escape request.fullpath}") end # From https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Resource-Owner-Password-Credentials-flow resource_owner_from_credentials do |_routes| if params.key?(:facebookToken) profile = User.fb_object("me", token: params[:facebookToken]) user = User.find_by(facebook_uid: profile["id"]) elsif params.key?(:twitterToken) user = User.where(twitter_oauth_token: params[:twitterToken]).first elsif params.key?(:appleAuthorizationCode) && params.key?(:appleAppType) user = User.find_for_apple_auth(authorization_code: params[:appleAuthorizationCode], app_type: params[:appleAppType]) elsif params.key?(:googleIdToken) user = User.find_for_google_mobile_auth(google_id_token: params[:googleIdToken]) else next if params[:username].blank? user = User.where("username = ? OR email = ?", params[:username], params[:username]).first || User.where("unconfirmed_email = ?", params[:username]).first next unless user&.valid_password?(params[:password]) end user if user&.alive? end authorization_code_expires_in 10.minutes access_token_expires_in nil force_ssl_in_redirect_uri false # Each application needs an owner enable_application_owner confirmation: true # access token scopes for providers default_scopes :view_public optional_scopes :edit_products, :view_sales, :view_payouts, :mark_sales_as_shipped, :refund_sales, :edit_sales, :revenue_share, :ifttt, :mobile_api, :creator_api, :view_profile, :unfurl, :helper_api use_refresh_token grant_flows %w[authorization_code client_credentials password] end Doorkeeper.configuration.extend(VisibleScopes)
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/money.rb
config/initializers/money.rb
# frozen_string_literal: true Money.locale_backend = :i18n Money.rounding_mode = BigDecimal::ROUND_HALF_UP Money.default_currency = "USD" # technically KRW does have subunits but they are not used anymore # our currencies.yml assumes KRW to have 100 subunits and that's how we store them in the database # the gem 'money' however treats KRW as a single unit currency by default # https://github.com/RubyMoney/money/blob/master/config/currency_iso.json # so we're performing this override here to have Money treat KRW amounts as 1/100th cents instead of units # the alternative to this fix would be to update currencies.yml to list KRW as single-unit AND to update the database to divide all KRW prices by 100 Money::Currency.inherit :krw, subunit_to_unit: 100 # The gem 'money' treats HUF as a single unit currency by default # so we're performing this override here to have Money treat HUF amounts as 1/100th cents instead of units # because that is what ISO 4217 says and what PayPal expects. # They're trying to do this migration in the gem too: https://github.com/RubyMoney/money/pull/742 Money::Currency.inherit :huf, subunit_to_unit: 100
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/paypal.rb
config/initializers/paypal.rb
# frozen_string_literal: true # Gumroad's PayPal merchant account details PAYPAL_CLIENT_ID = GlobalConfig.get("PAYPAL_CLIENT_ID") PAYPAL_CLIENT_SECRET = GlobalConfig.get("PAYPAL_CLIENT_SECRET") PAYPAL_MERCHANT_EMAIL = GlobalConfig.get("PAYPAL_MERCHANT_EMAIL") # Gumroad's PayPal partner account details PAYPAL_BN_CODE = GlobalConfig.get("PAYPAL_BN_CODE") PAYPAL_PARTNER_ID = GlobalConfig.get("PAYPAL_PARTNER_MERCHANT_ID") PAYPAL_PARTNER_CLIENT_ID = GlobalConfig.get("PAYPAL_PARTNER_CLIENT_ID") PAYPAL_PARTNER_CLIENT_SECRET = GlobalConfig.get("PAYPAL_PARTNER_CLIENT_SECRET") PAYPAL_PARTNER_EMAIL = GlobalConfig.get("PAYPAL_PARTNER_MERCHANT_EMAIL") # PayPal URLs if Rails.env.production? PAYPAL_ENDPOINT = "https://api-3t.paypal.com/nvp" PAYPAL_REST_ENDPOINT = "https://api.paypal.com" PAYPAL_URL = "https://www.paypal.com" PAYPAL_IPN_VERIFICATION_URL = "https://ipnpb.paypal.com/cgi-bin/webscr" else PAYPAL_ENDPOINT = "https://api-3t.sandbox.paypal.com/nvp" PAYPAL_REST_ENDPOINT = "https://api.sandbox.paypal.com" PAYPAL_URL = "https://www.sandbox.paypal.com" PAYPAL_IPN_VERIFICATION_URL = "https://ipnpb.sandbox.paypal.com/cgi-bin/webscr" end # PayPal credentials used in legacy NVP/SOAP API calls PAYPAL_USER = GlobalConfig.get("PAYPAL_USERNAME") PAYPAL_PASS = GlobalConfig.get("PAYPAL_PASSWORD") PAYPAL_SIGNATURE = GlobalConfig.get("PAYPAL_SIGNATURE") PayPal::SDK.configure( mode: (Rails.env.production? ? "live" : "sandbox"), client_id: PAYPAL_CLIENT_ID, client_secret: PAYPAL_CLIENT_SECRET, username: PAYPAL_USER, password: PAYPAL_PASS, signature: PAYPAL_SIGNATURE, ssl_options: { ca_file: nil } ) PayPal::SDK.logger = Logger.new(STDERR)
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/app_store_info.rb
config/initializers/app_store_info.rb
# frozen_string_literal: true IOS_APP_ID = GlobalConfig.get("IOS_APP_ID", "916819108") IOS_APP_STORE_URL = "https://itunes.apple.com/app/id#{IOS_APP_ID}" ANDROID_BUNDLE_ID = GlobalConfig.get("ANDROID_BUNDLE_ID", "com.gumroad.app") ANDROID_APP_STORE_URL = "https://play.google.com/store/apps/details?id=#{ANDROID_BUNDLE_ID}"
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/kaminari.rb
config/initializers/kaminari.rb
# frozen_string_literal: true # `will_paginate` is known to cause problems when used with `kaminari` # This configuration file enables using `page_with_kaminari()` instead of `page()` when pagination via `kaminari` is desired # Ref: https://github.com/kaminari/kaminari/issues/162#issuecomment-28673272 Kaminari.configure do |config| config.page_method_name = :page_with_kaminari end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/pagy.rb
config/initializers/pagy.rb
# frozen_string_literal: true require "pagy/extras/limit" require "pagy/extras/countless" require "pagy/extras/array" require "pagy/extras/overflow" Pagy::DEFAULT[:overflow] = :exception
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/inertia_rails.rb
config/initializers/inertia_rails.rb
# frozen_string_literal: true InertiaRails.configure do |config| config.deep_merge_shared_data = true end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/premailer_rails.rb
config/initializers/premailer_rails.rb
# frozen_string_literal: true Premailer::Rails.config[:remove_ids] = false Premailer::Rails.config[:preserve_style_attribute] = true
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/currency.rb
config/initializers/currency.rb
# frozen_string_literal: true OPEN_EXCHANGE_RATES_API_BASE_URL = "http://openexchangerates.org/api" OPEN_EXCHANGE_RATE_KEY = GlobalConfig.get("OPEN_EXCHANGE_RATES_APP_ID") CURRENCY_SOURCE = if Rails.env.development? || Rails.env.test? "#{Rails.root}/lib/currency/backup_rates.json" else "#{OPEN_EXCHANGE_RATES_API_BASE_URL}/latest.json?app_id=#{OPEN_EXCHANGE_RATE_KEY}" end CURRENCY_CHOICES = HashWithIndifferentAccess.new(JSON.load_file("#{Rails.root}/config/currencies.json")["currencies"])
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/bots.rb
config/initializers/bots.rb
# frozen_string_literal: true BOT_MAP = { "Mozilla/5.0 (Windows; U; cs-CZ) AppleWebKit/526.9+ (KHTML, like Gecko) AdobeAIR/1.5.1" => "Adobe AIR runtime", "BinGet/1.00.A (http://www.bin-co.com/php/scripts/load/)" => "BinGet", "Chilkat/1.0.0 (+http://www.chilkatsoft.com/ChilkatHttpUA.asp)" => "Chilkat HTTP .NET", "curl/7.15.1 (x86_64-suse-linux) libcurl/7.15.1 OpenSSL/0.9.8a zlib/1.2.3 libidn/0.6.0" => "cURL", "curl 7.16.1 (i386-portbld-freebsd6.2) libcurl/7.16.1 OpenSSL/0.9.7m zlib/1.2.3" => "cURL", "EventMachine HttpClient" => "EventMachine", "CamelHttpStream/1.0 Evolution/2.28.1" => "Evolution/Camel.Stream", "CamelHttpStream/1.0 Evolution/3.0.2" => "Evolution/Camel.Stream", "CamelHttpStream/1.0" => "Evolution/Camel.Stream", "Feed::Find/0.06" => "Feed::Find", "UniversalFeedParser/4.1 +http://feedparser.org/" => "FeedParser", "UniversalFeedParser/3.3 +http://feedparser.org/" => "FeedParser", "GStreamer souphttpsrc libsoup/2.26.2" => "GStreamer", "GStreamer souphttpsrc libsoup/2.27.4" => "GStreamer", "HTTP_Request2/0.5.2 (http://pear.php.net/package/http_request2) PHP/5.2.10-2ubuntu6.4" => "HTTP_Request2", "HTTP_Request2/0.5.1_(http://pear.php.net/package/http_request2) PHP/5.3.2-0.dotdeb.2 20100430220945" => "HTTP_Request2", "Mozilla/3.0 (compatible; Indy Library)" => "Indy Library", "The Incutio XML-RPC PHP Library" => "IXR lib", "The Incutio XML-RPC PHP Library (multicall client)" => "IXR lib", "The Incutio XML-RPC PHP Library for SSL" => "IXR lib", "Jakarta Commons-HttpClient/2.0" => "Jakarta Commons-HttpClient", "Jakarta Commons-HttpClient/3.0-rc3" => "Jakarta Commons-HttpClient", "Java/1.4.2_08" => "Java", "Java1.3.1_06" => "Java", "Java/1.6.0_03" => "Java", "libsoup/2.26.1" => "LibSoup", "libsoup/2.26.2" => "LibSoup", "libwww-perl/5.53" => "libwww-perl", "libwww-perl/5.812" => "libwww-perl", "LWP::Simple/5.812" => "LWP::Simple", "lwp-trivial/1.41" => "LWP::Simple", "lwp-trivial/1.35" => "LWP::Simple", "MagpieRSS/0.72 (+http://magpierss.sf.net; No cache)" => "MagpieRSS", "php-openid/2.1.1 (php/5.2.5.fb4) curl/7.15.5" => "PHP OpenID library", "PHPCrawl" => "PHPcrawl", "Poe-Component-Client-HTTP/0.88" => "POE-Component-Client-HTTP", "PycURL/7.13.2" => "PycURL", "PycURL/7.19.0" => "PycURL", "Python-urllib" => "Python-urllib", "Python-urllib/2.1" => "Python-urllib", "Python-urllib/2.4" => "Python-urllib", "Python-webchecker/50851" => "Python-webchecker", "Rome Client (http://tinyurl.com/64t5n) Ver: 0.9" => "ROME library", "Rome Client (http://tinyurl.com/64t5n) Ver: 0.7" => "ROME library", "SimplePie/1.1.2 (Feed Parser; http://simplepie.org; Allow like Gecko) Build/20081109150825 " => "SimplePie", "SimplePie/1.0 b3.2 (Feed Parser; http://simplepie.org/; Allow like Gecko) Build/20061124" => "SimplePie", "Snoopy v1.2.1" => "Snoopy", "libsummer/0.2.0 libsoup/2.24.3" => "Summer", "Typhoeus - http://github.com/dbalatero/typhoeus/tree/master" => "Typhoeus", "Typhoeus - http://github.com/pauldix/typhoeus/tree/master" => "Typhoeus", "urlgrabber/3.1.0" => "urlgrabber", "WinHttp" => "WinHTTP", "WWW-Mechanize/0.7.6 (http://rubyforge.org/projects/mechanize/)" => "WWW::Mechanize", "WWW-Mechanize/1.54" => "WWW::Mechanize", "xine/1.1.14.1" => "xine", "xine/1.1.16.3" => "xine", "XML-RPC for PHP 2.2.1" => "XML-RPC for PHP", "Zend_Http_Client" => "Zend_Http_Client", "Klondike/1.50 (HTTP Win32)" => "Klondike", "WapTiger/5.0 (http://www.waptiger.com/ ()" => "WapTiger", "WinWAP-SPBE/1.3 (1.3.0.2;Win32)" => "WinWap", "WinWAP/4.1 (Win32) WinWAP-X/4.1.0.192" => "WinWap", "2Bone_LinkChecker/1.0 libwww-perl/5.803" => "2Bone LinkChecker", "topSUBMIT.de HTMLChecker/1.1" => "anw HTMLChecker", "anw webtool LoadControl/1.3" => "anw LoadControl", "Checkbot/1.76" => "Checkbot", "Checkbot/1.80 LWP/5.80" => "Checkbot", "CSE HTML Validator Lite Online (http://online.htmlvalidator.com/php/onlinevallite.php)" => "CSE HTML Validator", "Cynthia 1.0" => "Cynthia", "FeedValidator/1.3" => "FeedValidator", "HTMLParser/1.6" => "HTMLParser", "LinkChecker/4.9 ( http://linkchecker.sourceforge.net/)" => "LinkChecker", "LinkChecker/5.1 ( http://linkchecker.sourceforge.net/)" => "LinkChecker", "LinkChecker/7.4 (+http://linkchecker.sourceforge.net/)" => "LinkChecker", "LinkExaminer/1.01 (Windows)" => "LinkExaminer", "LinkExaminer/1.00 (Windows)" => "LinkExaminer", "LinkWalker/2.0 - www.seventwentyfour.com/" => "LinkWalker", "W3C_Multipage_Validator/2.0 (+http://www.validator.ca/)" => "Multipage Validator", "P3P Validator" => "P3P Validator", "FPLinkChecker/1.2" => "PHP link checker", "REL Link Checker Lite 1.0" => "REL Link Checker Lite", "Validator.nu/3" => "Validator.nu", "W3C-checklink/4.2.1 [4.21] libwww-perl/5.803" => "W3C Checklink", "W3C-checklink/3.6.2.3 libwww-perl/5.64" => "W3C Checklink", "Jigsaw/2.2.5 W3C_CSS_Validator_JFouffa/2.0" => "W3C CSS Validator", "W3C-mobileOK/DDC-1.0 (see http://www.w3.org/2006/07/mobileok-ddc)" => "W3C mobileOK Checker", "W3C_Validator/1.432.2.22" => "W3C Validator", "W3C_Validator/1.654" => "W3C Validator", "CSSCheck/1.2.2" => "WDG CSSCheck", "Page Valet/4.1pre5" => "WDG Page Valet", "WDG_Validator/1.6.4" => "WDG Validator", "WDG_Validator/1.1" => "WDG Validator", "Xenu Link Sleuth/1.3.8" => "Xenu", "Xenu Link Sleuth 1.2d" => "Xenu", "Abilon" => "Abilon", "Akregator/1.2.9; librss/remnants" => "Akregator", "Akregator/1.2.2; librss/remnants" => "Akregator", "Akregator/1.2.5; librss/remnants" => "Akregator", "Apple-PubSub/65.1.1" => "Apple-PubSub", "Apple-PubSub/65.12.1" => "Apple-PubSub", "Apple-PubSub/65.6" => "Apple-PubSub", "Awasu/2.4PE" => "Awasu", "BlogBridge 6.6.2 Discoverer (http://www.blogbridge.com/) 1.6.0_10" => "BlogBridge", "BlogBridge 6.6.2 (http://www.blogbridge.com/) 1.6.0_07" => "BlogBridge", "Bloglines/3.1 (http://www.bloglines.com)" => "Bloglines", "CPG RSS Module File Reader" => "CPG Dragonfly RSS Module", "Dragonfly File Reader" => "CPG Dragonfly RSS Module", "CPG Dragonfly RSS Module Feed Viewer" => "CPG Dragonfly RSS Module", "Fastladder FeedFetcher/0.01 (http://fastladder.com/; 1 subscriber)" => "Fastladder FeedFetcher", "Feed Viewer 3.9.3843.18128" => "Feed Viewer", "Feedfetcher-Google; (+http://www.google.com/feedfetcher.html; 1 subscribers; feed-id=6098063775789346370)" => "Feedfetcher-Google", "GreatNews/1.0" => "GreatNews", "Gregarius/0.5.2 (+http://devlog.gregarius.net/docs/ua)" => "Gregarius", "Gregarius/0.6.0 (+http://devlog.gregarius.net/docs/ua)" => "Gregarius", "iCatcher! 1.7 (iPad; iPhone OS 5.0.1; zh_CN)" => "iCatcher!", "iCatcher! 1.4 (iPod touch; iPhone OS 5.0; en_GB)" => "iCatcher!", "iCatcher! 1.7.1 (iPhone; iPhone OS 4.3.5; en_US)" => "iCatcher!", "iCatcher! 1.6 (iPhone; iPhone OS 5.1; en_US)" => "iCatcher!", "Windows-RSS-Platform/2.0 (MSIE 8.0; Windows NT 6.1)" => "IE RSS reader", "Windows-RSS-Platform/1.0 (MSIE 7.0; Windows NT 5.1)" => "IE RSS reader", "Windows-RSS-Platform/2.0 (MSIE 8.0; Windows NT 5.1)" => "IE RSS reader", "Liferea/1.4.14 (Linux; en_US.UTF8; http://liferea.sf.net/)" => "Liferea", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) NetNewsWire/2.1.1" => "NetNewsWire", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; en-us) AppleWebKit/525.18 (KHTML, like Gecko) NetNewsWire/3.1.7" => "NetNewsWire", "NetNewsWire/3.2d7 (Mac OS X; http://www.newsgator.com/Individuals/NetNewsWire/)" => "NetNewsWire", "Netvibes (http://www.netvibes.com/; 5 subscribers; feedId: 5404723)" => "Netvibes feed reader", "Netvibes (http://www.netvibes.com/; subscribers; feedID: 11764808)" => "Netvibes feed reader", "Netvibes (http://www.netvibes.com/; 2 subscribers)" => "Netvibes feed reader", "newsbeuter/1.2 (Linux 2.6.18-xen-r12-xm-217; x86_64; http://www.newsbeuter.org/) libcurl/7.19.4 GnuTLS/2.6.6 zlib/1.2.3" => "Newsbeuter", "Ilium Software NewsBreak http://www.iliumsoft.com" => "NewsBreak", "Mozilla/5.0 NewsFox/1.0.4.1" => "NewsFox", "Mozilla/5.0 NewsFox/1.0.5" => "NewsFox", "NewsGatorOnline/2.0 (http://www.newsgator.com; 1 subscribers)" => "NewsGatorOnline", "NFReader/1.4.1.0 (http://www.gaijin.at/)" => "NFReader", "NFReader/1.3.9.0 (http://www.gaijin.at/)" => "NFReader", "JetBrains Omea Reader 2.2 (http://www.jetbrains.com/omea/reader/)" => "Omea Reader", "RssBandit/1.2.0.114 (.NET CLR 1.1.4322.573; WinNT 5.1.2600.0; http://www.rssbandit.org)" => "Rss Bandit", "RssBandit/1.9.0.972" => "Rss Bandit", "RSS Menu/1.11.6 (Mac OS X; http://www.edot-studios.com)" => "RSS Menu", "Mozilla/4.0 (compatible; RSS Popper)" => "RSS Popper", "RSSOwl/2.0.0.200804242342" => "RSSOwl", "RSSOwl/2.0.0.200903042053 (Windows; U; en)" => "RSSOwl", "AppleSyndication/56.1" => "Safari RSS reader", "Mozilla/5.0 (Sage)" => "Sage", "HomePage Rss Reader 1.0; (1 subscribers; feed-id=82385)" => "Seznam RSS reader", "SharpReader/0.9.4.1 (.NET CLR 1.1.4322.573; WinNT 5.1.2600.0)" => "SharpReader", "SharpReader/0.9.6.0 (.NET CLR 1.1.4322.2032; WinNT 5.1.2600.0)" => "SharpReader", "Trileet NewsRoom (+ http://feedmonger.blogspot.com)" => "Trileet NewsRoom", "YahooFeedSeeker/2.0 (compatible; Mozilla 4.0; MSIE 5.5; http://publisher.yahoo.com/rssguide; users 0; views 0)" => "YahooFeedSeeker", "YeahReader [http://www.yeahreader.com/]" => "YeahReader", "Banshee 1.5.1 (http://banshee-project.org/)" => "Banshee", "boxee (alpha/Windows build 7077 - 0.9.7.4825)" => "Boxxe", "boxee (alpha/Darwin 8.7.1 i386 - 0.9.11.5591)" => "Boxxe", "boxee (alpha/Linux 2.6.28-11-generic #40-Ubuntu SMP Fri Apr 3 17:39:41 UTC 2009 x86_64 - 0.9.7.4826M)" => "Boxxe", "boxee (alpha/Darwin 9.5.2 i386 - 0.9.11.5591)" => "Boxxe", "boxee (alpha/Windows XP Professional Service Pack 3, v.5755 build 2600 - 0.9.9.5324)" => "Boxxe", "CorePlayer/1.0 (Series 60 3rd ; ARM; de) CorePlayer/1.3.2_6909" => "CorePlayer", "CorePlayer/1.0 (Palm OS 5.4.9; ARM Intel PXA27x; en) CorePlayer/1.3.2_6909" => "CorePlayer", "CorePlayer/1.0 (Windows 5.01; x86 Intel; hu) CorePlayer/2.0.0_6873" => "CorePlayer", "CorePlayer/1.0 (PocketPC 5.02; ARM 1136J; en) CorePlayer/1.3.2_6909" => "CorePlayer", "FlyCast/1.34 (BlackBerry; 8330/4.5.0.131 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/-1)" => "FlyCast", "FlyCast/1.35 (BlackBerry; 9530/4.7.0.99 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/-1)" => "FlyCast", "FlyCast/1.32 (BlackBerry; 8330/4.3.0.124 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/-1)" => "FlyCast", "foobar2000/0.9.6.5_beta_2" => "foobar2000", "foobar2000/0.9.6.8" => "foobar2000", "foobar2000/0.9.5.2" => "foobar2000", "GomPlayer 2, 1, 17, 4710 (ENG)" => "GOM Player", "GomPlayer 2, 1, 9, 3753 (ENG)" => "GOM Player", "iTunes/8.1.1 (Windows; N)" => "iTunes", "iTunes/10.2.1 (Macintosh; Intel Mac OS X 10.7) AppleWebKit/534.20.8" => "iTunes", "itunes/9.0.2 (Macintosh; Intel Mac OS X 10.4.11) AppleWebKit/531.21.8" => "iTunes", "iTunes/4.2 (Macintosh; U; PPC Mac OS X 10.2)" => "iTunes", "iTunes/10.2.1 (Windows; Microsoft Windows 7 Enterprise Edition Service Pack 1 (Build 7601)) AppleWebKit/533.20.25" => "iTunes", "Miro/2.0.4 (http://www.getmiro.com/; Windows XP )" => "Miro", "Miro/2.0 (http://www.getmiro.com/; Darwin 9.4.0 Power Macintosh)" => "Miro", "Democracy/0.8.1 (http://www.participatoryculture.org)" => "Miro", "Miro/2.1-svn (http://www.getmiro.com/; Windows 2000 )" => "Miro", "Miro/2.0.3 (http://www.getmiro.com/; Linux 2.6.24-1-686 i686)" => "Miro", "Miro/3.0.1 (http://www.getmiro.com/; Darwin 8.11.1 i386)" => "Miro", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko Miro/2.0.4 (http://www.getmiro.com/)" => "Miro", "MPlayer/SVN-r29189-snapshot-4.3.2" => "MPlayer", "MPlayer/29040-4.3.3" => "MPlayer", "MPlayer 2.0" => "MPlayer2", "Plex/10.1 Git:33d6d28 (Mac OS X; 10.0.0 i386; http://www.plexapp.com)" => "Plex Media Center", "Plex/2.0.3.3 Android/3.2 Sony/sony/NSZGT1/Internet TV Box" => "Plex Media Center", "PocketTunes/5.5.2" => "Pocket Tunes", "PublicRadioPlayer/2.1 CFNetwork/459 Darwin/9.8.0" => "Public Radio Player", "PublicRadioApp/1.3 CFNetwork/459 Darwin/10.0.0d3" => "Public Radio Player", "QuickTime/7.6.2 (verqt=7.6.2;cpu=IA32;so=Mac 10.5.8)" => "QuickTime", "QuickTime/7.6 (qtver=7.6;cpu=IA32;os=Mac 10,5,7)" => "QuickTime", "QuickTime (qtver=7.0.2a26;os=Windows NT 6.0)" => "QuickTime", "QuickTime/7.6.2 (qtver=7.6.2;os=Windows NT 5.1Service Pack 3)" => "QuickTime", "QuickTime.7.6 (qtver=7.6;os=Windows NT 6.0Service Pack 2)" => "QuickTime", "RSS_Radio 1.493" => "RSS Radio", "Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.0.5) Gecko/2009021916 Songbird/1.1.2 (20090331142126)" => "Songbird", "Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.0.5) Gecko/2009021916 Songbird/1.1.2 (20090331141709)" => "Songbird", "VLC media player - version 0.9.8a Grishenko - (c) 1996-2008 the VideoLAN team" => "VLC media player", "VLC media player - version 0.9.8 Grishenko - (c) 1996-2009 the VideoLAN team" => "VLC media player", "VLC media player - version 0.8.6g Janus - (c) 1996-2008 the VideoLAN team" => "VLC media player", "VLC media player - version 1.1.0-git Yellow Bastard - (c) 1996-2009 the VideoLAN team" => "VLC media player", "VLC media player - version 0.9.9 Grishenko - (c) 1996-2009 the VideoLAN team" => "VLC media player", "WAFA/1.2.1 (Linux; Android 2.1; Winamp) Replicant/1.0" => "Winamp for Android", "WAFA/1.2.10 (Linux; Android 4.1; Winamp) Replicant/1.0" => "Winamp for Android", "WAFA/1.2.10 (Linux; Android 2.2-update1; Winamp) Replicant/1.0" => "Winamp for Android", "Windows-Media-Player/11.0.6001.7000" => "Windows Media Player", "Windows-Media-Player/9.00.00.3086" => "Windows Media Player", "XBMC/9.04 r19840 (Mac OS X; Darwin 9.6.0; http://www.xbmc.org)" => "XBMC", "XBMC/9.04-beta1 r19616 (Linux; Ubuntu 9.04; Linux 2.6.28-11-generic; http://www.xbmc.org)" => "XBMC", "XBMC/9.04-beta1 r19639 (Windows; Windows XP Professional Service Pack 2 build 2600; http://www.xbmc.org)" => "XBMC", "XMPlay/3.5" => "XMPlay", "ApacheBench/2.0.40-dev" => "AB (Apache Bench)", "ApacheBench/2.3" => "AB (Apache Bench)", "Mozilla/4.0 (compatible; Win32; ActiveXperts.Http.3.1)" => "ActiveXperts Network Monitor", "Apache/2.2.15 (CentOS) (internal dummy connection)" => "Apache internal dummy connection", "Apache/2.2.21 (Fedora) (internal dummy connection)" => "Apache internal dummy connection", "Mozilla/4.0 (compatible; Synapse)" => "Apache Synapse", "Atomic_Email_Hunter/4.0" => "Atomic Email Hunter", "Bookdog/5.2" => "Bookdog", "Bookdog/5.1.44" => "Bookdog", "ColdFusion (BookmarkTracker.com)" => "BookmarkTracker", "BrownReclusePro v1.59 (The Programmable Spider by http://SoftByteLabs.com/)" => "BrownRecluse", "BrownReclusePro v1.62 (The Programmable Spider by http://SoftByteLabs.com/)" => "BrownRecluse", "Claws Mail GtkHtml2 plugin 0.24 (http://www.claws-mail.org/plugins.php)" => "Claws Mail GtkHtml2 plugin", "Cyberduck/3.3 (5552)" => "Cyberduck", "DownloadStudio/4.0" => "DownloadStudio", "Funambol Mozilla Sync Client v0.9.1" => "Funambol Mozilla Sync Client", "Funambol Outlook Plug-in v. 7.0.7" => "Funambol Outlook Sync Client", "gvfs/1.0.3" => "GnomeVFS", "gvfs/1.3.1" => "GnomeVFS", "gvfs/0.2.3" => "GnomeVFS", "GoldenPod 0.8.1 (podcatcher) libwwwperl" => "GoldenPod", "Mozilla/5.0 AppEngine-Google; (+http://code.google.com/appengine; appid: canisano)" => "Google App Engine", "AppEngine-Google; ( http://code.google.com/appengine)" => "Google App Engine", "AppEngine-Google; (+http://code.google.com/appengine)" => "Google App Engine", "Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/532.4 (KHTML, like Gecko) Google Earth/5.2.1.1329 Safari/532.4" => "Google Earth", "GoogleFriendConnect/1.0" => "Google Friend Connect", "Google-Listen/1.0.3.1 (sapphire COC10)" => "Google Listen", "Google-Listen/1.0.3.1 (hero CUPCAKE)" => "Google Listen", "Googlebot-richsnippets" => "Google Rich Snippets Testing Tool", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0;Google Wireless Transcoder;)" => "Google Wireless Transcoder", "Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Wireless Transcoder) Version/3.1 Safari/525.13,Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Wireless Transcoder) Version/3.1 Safari/525.13" => "Google Wireless Transcoder", "gPodder/0.15.2 (+http://gpodder.org/)" => "gPodder", "GSiteCrawler/v1.23 rev. 286 (http://gsitecrawler.com/)" => "GSiteCrawler", "GSiteCrawler/v1.12 rev. 260 (http://gsitecrawler.com/)" => "GSiteCrawler", "holmes/3.9 (xiantravelguide.com)" => "Holmes", "holmes/3.9 (flashigri7.wordpress.com)" => "Holmes", "holmes/3.9 (http://brightkite.com/people/freshcontent)" => "Holmes", "holmes/3.9 (evro.chasi24.com)" => "Holmes", "HTML2JPG Enterprise, http://www.html2jpg.com" => "HTML2JPG", "HTML2JPG Personal Edition, http://www.html2jpg.com" => "HTML2JPG", "check_http/v2053 (nagios-plugins 1.4.13)" => "HTTP nagios plugin", "iGetter/2 (Macintosh; U; PPC Mac OS X; en) " => "iGetter", "iGetter/2.3 (Macintosh;G;PPC)" => "iGetter", "iGetter/1.x (Macintosh;G;PPC) " => "iGetter", "iGooMap/2.x +(http://www.pointworks.de/)" => "iGooMap", "iVideo Lite 1.2 (iPhone; iPhone OS 3.1.2; de_AT)" => "iVideo", "Windows NT/5.1, UPnP/1.0, Jamcast/1.0" => "Jamcast", "Jamcast 0.9.8.33" => "Jamcast", "Windows NT/5.1, UPnP/1.0, Jamcast/0.9" => "Jamcast", "JS-Kit URL Resolver, http://js-kit.com/" => "JS-Kit/Echo", "LeechCraft (X11; U; Linux; ru_RU) (LeechCraft/Poshuku 0.3.55-324-g9365f23; WebKit 4.5.2/4.5.2)" => "LeechCraft", "LeechCraft (X11; U; Linux; ru_RU) (LeechCraft/Poshuku 0.3.55-383-g7446455; WebKit 4.5.2/4.5.2)" => "LeechCraft", "lftp/3.7.4" => "LFTP", "lftp/3.7.3" => "LFTP", "LinkbackPlugin/0.1 Laconica/0.8.0" => "LinkbackPlugin for Laconica", "LinkbackPlugin/0.1 Laconica/0.7.3" => "LinkbackPlugin for Laconica", "LinkbackPlugin/0.1 Laconica/0.8.0dev" => "LinkbackPlugin for Laconica", "Microsoft Office Existence Discovery" => "Microsoft Office Existence Discovery", "Microsoft Data Access Internet Publishing Provider DAV 1.1 " => "Microsoft WebDAV client", "Microsoft Data Access Internet Publishing Provider DAV" => "Microsoft WebDAV client", "muCommander-file-API (Java 11.3-b02; Windows XP 5.1 x86)" => "muCommander", "muCommander v0.8.3 (Java 1.6.0_0-b11; Linux 2.6.24-19-generic i386)" => "muCommander", "muCommander v0.8.3 (Java 1.4.2_03-b02; Windows XP 5.1 x86)" => "muCommander", "Mozilla/4.08 (Windows; Mobile Content Viewer/1.0) NetFront/3.2" => "NetFront Mobile Content Viewer", "Nokia SyncML HTTP Client" => "Nokia SyncML Client", "Mozilla/4.0 (compatible; BorderManager 3.0)" => "Novell BorderManager", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; fr-fr) AppleWebKit/525.28.3 (KHTML, like Gecko) Paparazzi!/0.5b5 (like Safari)" => "Paparazzi!", "PHP/5.2.6" => "PHP", "PHP/5.2.8" => "PHP", "PHP/5.2.8-pl2-gentoo" => "PHP", "Podkicker/1.0.3 Android/4.0.4" => "Podkicker", "Podkicker Pro/1.0.3 Android/4.0.4" => "Podkicker", "Podkicker/1.1.1 Android/2.3.2" => "Podkicker", "Podkicker Pro/1.0.7 Android/4.0.3" => "Podkicker", "Mozilla/4.0 (compatible; Powermarks/3.5; Windows 95/98/2000/NT)" => "Powermarks", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11pre) Gecko/2009042918 Prism/1.0b1" => "Prism", "Mozilla/5.0 (compatible; PRTG Network Monitor (www.paessler.com); Windows)" => "PRTG Network Monitor", "Radio Downloader 0.8.0.0" => "Radio Downloader", "Radio Downloader 0.8.2.0" => "Radio Downloader", "SZN-Image-Resizer" => "Seznam WAP Proxy", "Nokia6230/2.0 (03.15) Profile/MIDP-2.0 Configuration/CLDC-1.1/szn-mobile-transcoder" => "Seznam WAP Proxy", "Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14/szn-mobile-transcoder" => "Seznam WAP Proxy", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322)/szn-mobile-transcoder" => "Seznam WAP Proxy", "JoeDog/1.00 [en] (X11; I; Siege 2.66)" => "Siege", "JoeDog/1.00 [en] (X11; I; Siege 2.68)" => "Siege", "TulipChain/6.03 (http://ostermiller.org/tulipchain/) Java/1.6.0_0 (http://java.sun.com/) Linux/2.6.27.25-170.2.72_1.cubbi_tuxonice.fc10.x86_64 RPT-HTTPClient/0.3-3" => "Tulip Chain", "TulipChain/6.03 (http://ostermiller.org/tulipchain/) Java/1.6.0_07 (http://java.sun.com/) Windows_XP/5.1 RPT-HTTPClient/0.3-3" => "Tulip Chain", "Azureus 4.3.0.4;Windows 7;Java 1.6.0_18-ea" => "Vuze", "Azureus 4.3.0.4" => "Vuze", "Azureus 4.3.0.4;Windows XP;Java 1.7.0-ea" => "Vuze", "Web-sniffer/1.0.36 (+http://web-sniffer.net/)" => "Web-sniffer", "Web-sniffer/1.0.35 (+http://web-sniffer.net/)" => "Web-sniffer", "Web-sniffer/1.0.32 (+http://web-sniffer.net/)" => "Web-sniffer", "webcollage1/1.129" => "WebCollage", "webcollage/1.127" => "WebCollage", "webcollage-noporn/1.127" => "WebCollage", "webcollage.pl/1.133" => "WebCollage", "webcollage.modified/1.148" => "WebCollage", "webcollage.perl/1.107" => "WebCollage", "webfs/2.0 (plan 9)" => "webfs", "WinPodder (http://winpodder.com)" => "WinPodder", "http://Anonymouse.org/ (Unix)" => "Anonymouse.org", "Mozilla/5.0 (compatible; WASALive-Bot ; http://blog.wasalive.com/wasalive-bots/)" => " WASALive-Bot", "192.comAgent" => "192.comAgent", "50.nu/0.01 ( +http://50.nu/bot.html )" => "50.nu", "Mozilla/5.0 (compatible; 80bot/0.71; http://www.80legs.com/spider.html;) Gecko/2008032620" => "80legs", "Mozilla/5.0 (compatible; 008/0.83; http://www.80legs.com/spider.html;) Gecko/2008032620" => "80legs", "Mozilla/5.0 (compatible; 008/0.83; http://www.80legs.com/webcrawler.html;) Gecko/2008032620" => "80legs", "Mozilla/5.0 (compatible; abby/1.0; +http://www.ellerdale.com/crawler.html)" => "abby", "Aboundex/0.2 (http://www.aboundex.com/crawler/)" => "Aboundexbot", "AboutUsBot" => "AboutUsBot", "Mozilla/5.0 (compatible; AboutUsBot/0.9; +http://www.aboutus.org/AboutUsBot)" => "AboutUsBot", "Mozilla/5.0 (compatible; AboutUsBot Johnny5/2.0; +http://www.AboutUs.org/)" => "AboutUsBot", "Abrave Spider v4 Robot 1 (http://robot.abrave.co.uk)" => "Abrave Spider", "Abrave Spider v4 Robot 2 (http://robot.abrave.co.uk)" => "Abrave Spider", "Mozilla/5.0 (compatible; heritrix/1.12.0 +http://www.accelobot.com)" => "Accelobot", "Accelobot" => "Accelobot", "Mozilla/5.0 (compatible; heritrix/1.14.3 +http://www.accelobot.com)" => "Accelobot", "Accoona-AI-Agent/1.1.1 (crawler at accoona dot com)" => "Accoona-AI-Agent", "Accoona-AI-Agent/1.1.2 (aicrawler at accoonabot dot com)" => "Accoona-AI-Agent", "Acoon-Robot 4.0.0RC2 (http://www.acoon.de)" => "Acoon-Robot", "Acoon-Robot 4.0.1 (http://www.acoon.de)" => "Acoon-Robot", "Acoon-Robot 4.0.2 (http://www.acoon.de)" => "Acoon-Robot", "Acoon-Robot 4.0.2.17 (http://www.acoon.de)" => "Acoon-Robot", "OpenAcoon v4.1.0 (www.openacoon.de)" => "Acoon-Robot", "Acoon v4.1.0 (www.acoon.de)" => "Acoon-Robot", "Acoon v4.9.5 (www.acoon.de)" => "Acoon-Robot", "Acoon v4.10.1 (www.acoon.de)" => "Acoon-Robot", "Acoon v4.10.3 (www.acoon.de)" => "Acoon-Robot", "Acoon v4.10.4 (www.acoon.de)" => "Acoon-Robot", "Acoon v4.10.5 (www.acoon.de)" => "Acoon-Robot", "OpenAcoon v4.10.5 (www.openacoon.de)" => "Acoon-Robot", "AcoonBot/4.10.5 (+http://www.acoon.de)" => "Acoon-Robot", "Mozilla/5.0 (compatible; AcoonBot/4.10.6; +http://www.acoon.de/robot.asp)" => "Acoon-Robot", "Acorn/Nutch-0.9 (Non-Profit Search Engine; acorn.isara.org; acorn at isara dot org)" => "Acorn", "AddThis.com robot tech.support@clearspring.com" => "AddThis.com", "www.adressendeutschland.de" => "adressendeutschland.de", "AdsBot-Google (+http://www.google.com/adsbot.html)" => "AdsBot-Google", "AdsBot-Google" => "AdsBot-Google", "Mozilla/5.0 (compatible; AhrefsBot/1.0; +http://ahrefs.com/robot/)" => "AhrefsBot", "Mozilla/5.0 (compatible; AhrefsBot/2.0; +http://ahrefs.com/robot/)" => "AhrefsBot", "Mozilla/5.0 (compatible; AhrefsBot/3.0; +http://ahrefs.com/robot/)" => "AhrefsBot", "Mozilla/5.0 (compatible; aiHitBot-DM/2.0.2 +http://www.aihit.com)" => "aiHitBot", "Mozilla/5.0 (compatible; aiHitBot/1.0-DS; +http://www.aihit.com/)" => "aiHitBot", "Mozilla/5.0 (compatible; aiHitBot/1.0; +http://www.aihit.com/)" => "aiHitBot", "Mozilla/5.0 (compatible; aiHitBot/1.1; +http://www.aihit.com/)" => "aiHitBot", "appie 1.1 (www.walhello.com)" => "aippie", "Mozilla/5.0 (compatible; akula/k311; +http://k311.fd.cvut.cz/)" => "akula", "Mozilla/5.0 (compatible; akula/12.0rc-2; +http://k311.fd.cvut.cz/)" => "akula", "http://www.almaden.ibm.com/cs/crawler [bc22]" => "Almaden", "http://www.almaden.ibm.com/cs/crawler [hc4]" => "Almaden", "http://www.almaden.ibm.com/cs/crawler [bc14]" => "Almaden", "http://www.almaden.ibm.com/cs/crawler [bc5]" => "Almaden", "http://www.almaden.ibm.com/cs/crawler [fc13]" => "Almaden", "http://www.almaden.ibm.com/cs/crawler [bc6]" => "Almaden", "http://www.almaden.ibm.com/cs/crawler [bc12]" => "Almaden", "http://www.almaden.ibm.com/cs/crawler" => "Almaden", "http://www.amagit.com/" => "Amagit.COM", "Amfibibot/0.07 (Amfibi Robot; http://www.amfibi.com; agent@amfibi.com)" => "Amfibibot", "amibot - http://www.amidalla.de - tech@amidalla.com libwww-perl/5.831" => "amibot", "Mozilla/5.0 (compatible; AntBot/1.0; +http://www.ant.com/)" => "AntBot", "Mozilla/5.0 (compatible; Apercite; +http://www.apercite.fr/robot/index.html)" => "Apercite", "Mozilla/5.0 (compatible; AportWorm/3.2; +http://www.aport.ru/help)" => "AportWorm", "http://arachnode.net 1.2" => "arachnode.net", "http://arachnode.net 2.5" => "arachnode.net", "Mozilla/5.0 (compatible; archive.org_bot +http://www.archive.org/details/archive.org_bot)" => "archive.org_bot", "ASAHA Search Engine Turkey V.001 (http://www.asaha.com/)" => "ASAHA Search Engine Turkey", "Mozilla/2.0 (compatible; Ask Jeeves/Teoma; +http://sp.ask.com/docs/about/tech_crawling.html)" => "Ask Jeeves/Teoma", "Mozilla/2.0 (compatible; Ask Jeeves/Teoma)" => "Ask Jeeves/Teoma", "Mozilla/2.0 (compatible; Ask Jeeves/Teoma; +http://about.ask.com/en/docs/about/webmasters.shtml)" => "Ask Jeeves/Teoma", "Mozilla/5.0 (compatible; Ask Jeeves/Teoma; +http://about.ask.com/en/docs/about/webmasters.shtml)" => "Ask Jeeves/Teoma", "Mozilla/2.0 (compatible; Ask Jeeves/Teoma; http://about.ask.com/en/docs/about/webmasters.shtml)" => "Ask Jeeves/Teoma", "BabalooSpider/1.3 (BabalooSpider; http://www.babaloo.si; spider@babaloo.si)" => "BabalooSpider", "BacklinkCrawler (http://www.backlinktest.com/crawler.html)" => "BacklinkCrawler", "Baiduspider+(+http://www.baidu.com/search/spider.htm)" => "Baiduspider", "Baiduspider+(+http://www.baidu.jp/spider/)" => "Baiduspider", "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" => "Baiduspider", "baypup/colbert (Baypup; http://sf.baypup.com/webmasters; jason@baypup.com)" => "baypup", "baypup/1.1 (Baypup; http://www.baypup.com/; jason@baypup.com)" => "baypup", "baypup/colbert (Baypup; http://www.baypup.com/webmasters; jason@baypup.com)" => "baypup", "BDFetch" => "BDFetch", "Mozilla/5.0 (compatible; BecomeBot/2.3; MSIE 6.0 compatible; +http://www.become.com/site_owners.html)" => "BecomeBot", "Mozilla/5.0 (compatible; BecomeBot/3.0; MSIE 6.0 compatible; +http://www.become.com/site_owners.html)" => "BecomeBot", "Mozilla/5.0 (compatible; BecomeBot/3.0; +http://www.become.com/site_owners.html)" => "BecomeBot", "Mozilla/5.0 (compatible; BecomeJPBot/2.3; MSIE 6.0 compatible; +http://www.become.co.jp/site_owners.html)" => "BecomeBot", "Bigsearch.ca/Nutch-0.9-dev (Bigsearch.ca Internet Spider; http://www.bigsearch.ca/; info@enhancededge.com)" => "Bigsearch.ca", "Bigsearch.ca/Nutch-1.0-dev (Bigsearch.ca Internet Spider; http://www.bigsearch.ca/; info@enhancededge.com)" => "Bigsearch.ca", "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" => "bingbot", "bitlybot" => "bitlybot", "Mozilla/5.0 (compatible; socketcrawler; http://nlp.fi.muni.cz/projects/biwec/)" => "biwec", "Mozilla/5.0 (compatible; bixolabs/1.0; +http://bixolabs.com/crawler/general; crawler@bixolabs.com)" => "bixolabs", "Mozilla/5.0 (compatible; bixolabs/1.0; +http://bixolabs.com/crawler/general; crawler@mail.bixolabs.com)" => "bixolabs", "Blaiz-Bee/2.00.5622 (+http://www.blaiz.net)" => "Blaiz-Bee", "Blaiz-Bee/2.00.5655 (+http://www.blaiz.net)" => "Blaiz-Bee", "Blaiz-Bee/2.00.6082 (+http://www.blaiz.net)" => "Blaiz-Bee", "Blaiz-Bee/2.00.8315 (BE Internet Search Engine http://www.rawgrunt.com)" => "Blaiz-Bee", "Mozilla/5.0 (compatible; Blekkobot; ScoutJet; +http://blekko.com/about/blekkobot)" => "Blekkobot", "Mozilla/5.0 (compatible; BlinkaCrawler/1.0; +http://www.blinka.jp/crawler/)" => "BlinkaCrawler", "Bloggsi/1.0 (http://bloggsi.com/)" => "Bloggsi", "BlogPulseLive (support@blogpulse.com)" => "BlogPulse", "BlogPulse (ISSpider-3.0)" => "BlogPulse", "boitho.com-dc/0.83 ( http://www.boitho.com/dcbot.html )" => "boitho.com-dc", "boitho.com-dc/0.79 ( http://www.boitho.com/dcbot.html )" => "boitho.com-dc", "boitho.com-dc/0.85 ( http://www.boitho.com/dcbot.html )" => "boitho.com-dc", "boitho.com-dc/0.86 ( http://www.boitho.com/dcbot.html )" => "boitho.com-dc", "boitho.com-dc/0.82 ( http://www.boitho.com/dcbot.html )" => "boitho.com-dc", "Nokia6680/1.0 (4.04.07) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1 (botmobi find.mobi/bot.html find@mtld.mobi)" => "botmobi", "BotOnParade, http://www.bots-on-para.de/bot.html" => "BotOnParade", "Browsershots" => "Browsershots", "btbot/0.4 (+http://www.btbot.com/btbot.html)" => "btbot", "Mozilla/5.0 (compatible; Butterfly/1.0; +http://labs.topsy.com/butterfly.html) Gecko/2009032608 Firefox/3.0.8" => "Butterfly", "Mozilla/5.0 (compatible; Butterfly/1.0; +http://labs.topsy.com/butterfly/) Gecko/2009032608 Firefox/3.0.8" => "Butterfly", "Mozilla/5.0 (compatible; BuzzRankingBot/1.0; +http://www.buzzrankingbot.com/)" => "BuzzRankingBot", "CamontSpider/1.0 +http://epweb2.ph.bham.ac.uk/user/slater/camont/info.html" => "CamontSpider", "Mozilla/5.0 (compatible; CareerBot/1.1; +http://www.career-x.de/bot.html)" => "CareerBot", "Castabot/0.1 (+http://topixtream.com/)" => "Castabot", "CatchBot/1.0; +http://www.catchbot.com" => "CatchBot", "CatchBot/3.0; +http://www.catchbot.com" => "CatchBot", "CatchBot/2.0; +http://www.catchbot.com" => "CatchBot", "Cazoodle/Nutch-0.9-dev (Cazoodle Nutch Crawler; http://www.cazoodle.com; mqbot@cazoodle.com)" => "CazoodleBot", "CazoodleBot/Nutch-0.9-dev (CazoodleBot Crawler; http://www.cazoodle.com; mqbot@cazoodle.com)" => "CazoodleBot", "CazoodleBot/0.1 (CazoodleBot Crawler; http://www.cazoodle.com; mqbot@cazoodle.com)" => "CazoodleBot", "CazoodleBot/Nutch-0.9-dev (CazoodleBot Crawler; http://www.cazoodle.com/cazoodlebot; cazoodlebot@cazoodle.com)" => "CazoodleBot", "CazoodleBot/CazoodleBot-0.1 (CazoodleBot Crawler; http://www.cazoodle.com/cazoodlebot; cazoodlebot@cazoodle.com)" => "CazoodleBot", "CazoodleBot/0.0.2 (http://www.cazoodle.com/contact.php; cbot@cazoodle.com)" => "CazoodleBot", "CCBot/1.0 (+http://www.commoncrawl.org/bot.html)" => "CCBot", "ccubee/3.2" => "ccubee", "ccubee/3.3" => "ccubee", "ccubee/3.5" => "ccubee", "ccubee/3.7" => "ccubee", "ccubee/4.0" => "ccubee", "ccubee/9.0" => "ccubee", "ccubee/10.0" => "ccubee", "ccubee/2008" => "ccubee", "mozilla/4.0 (compatible; changedetection/1.0 (admin@changedetection.com))" => "changedetection", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; http://www.changedetection.com/bot.html )" => "ChangeDetection", "Mozilla/5.0 (compatible; Charlotte/1.1; http://www.searchme.com/support/)" => "Charlotte", "City4you/1.3 Cesky (+http://www.city4you.pl)" => "City4you", "Cityreview Robot (+http://www.cityreview.org/crawler/)" => "cityreview", "CJB.NET Proxy" => "CJB.NET Proxy", "Mozilla/5.0 (compatible; CligooRobot/2.0; +http://www.cligoo.de/wk/technik.php)" => "CligooRobot", "Combine/3 http://combine.it.lth.se/" => "Combine", "ConveraMultiMediaCrawler/0.1 (+http://www.authoritativeweb.com/crawl)" => "ConveraCrawler", "ConveraCrawler/0.9d (+http://www.authoritativeweb.com/crawl)" => "ConveraCrawler", "ConveraCrawler/0.9e (+http://www.authoritativeweb.com/crawl)" => "ConveraCrawler", "copyright sheriff (+http://www.copyrightsheriff.com/)" => "copyright sheriff",
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/mysql_missing_table_handler.rb
config/initializers/mysql_missing_table_handler.rb
# frozen_string_literal: true module Mysql2 class Client MISSING_TABLE_GRACE_PERIOD = 5.seconds alias original_query query def query(sql, options = {}) original_query(sql, options) rescue Mysql2::Error => e raise unless /Table .* doesn't exist/.match?(e.message) warn "Error: missing table, retrying in #{MISSING_TABLE_GRACE_PERIOD} seconds..." sleep MISSING_TABLE_GRACE_PERIOD original_query(sql, options) end end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/openai.rb
config/initializers/openai.rb
# frozen_string_literal: true request_timeout_in_seconds = 3 OpenAI.configure do |config| config.access_token = GlobalConfig.get("OPENAI_ACCESS_TOKEN") config.request_timeout = request_timeout_in_seconds end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/json_time_precision.rb
config/initializers/json_time_precision.rb
# frozen_string_literal: true ActiveSupport::JSON::Encoding.time_precision = 0
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/sidekiq_web_csp.rb
config/initializers/sidekiq_web_csp.rb
# frozen_string_literal: true class SidekiqWebCSP def initialize(app) @app = app end def call(env) SecureHeaders.append_content_security_policy_directives( Rack::Request.new(env), { script_src: %w('unsafe-inline') } ) @app.call(env) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/paper_trail.rb
config/initializers/paper_trail.rb
# frozen_string_literal: true PaperTrail.serializer = PaperTrail::Serializers::JSON
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/cloudflare.rb
config/initializers/cloudflare.rb
# frozen_string_literal: true CLOUDFLARE_CACHE_LIMIT = GlobalConfig.get("CLOUDFLARE_CACHE_LIMIT", 8_000_000_000).to_i # 8GB
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/notification_purchase.rb
config/initializers/notification_purchase.rb
# frozen_string_literal: true Rails.application.config.after_initialize do ActiveSupport::Notifications.subscribe(ChargeProcessor::NOTIFICATION_CHARGE_EVENT) do |_, _, _, _, payload| Purchase.handle_charge_event(payload[:charge_event]) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/tax_id_pro.rb
config/initializers/tax_id_pro.rb
# frozen_string_literal: true # Tax ID Pro allows us to create multiple API keys. # We're using two — one for Development, and one for Production. # We're using the Production key in production, and the Development key everywhere else. TAX_ID_PRO_API_KEY = GlobalConfig.get("TAX_ID_PRO_API_KEY")
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/braintree.rb
config/initializers/braintree.rb
# frozen_string_literal: true Braintree::Configuration.environment = Rails.env.production? ? :production : :sandbox Braintree::Configuration.merchant_id = GlobalConfig.get("BRAINTREE_MERCHANT_ID") Braintree::Configuration.public_key = GlobalConfig.get("BRAINTREE_PUBLIC_KEY") Braintree::Configuration.private_key = GlobalConfig.get("BRAINTREE_API_PRIVATE_KEY") Braintree::Configuration.http_open_timeout = 20 Braintree::Configuration.http_read_timeout = 20 BRAINTREE_MERCHANT_ACCOUNT_ID_FOR_SUPPLIERS = GlobalConfig.get("BRAINTREE_MERCHANT_ACCOUNT_ID_FOR_SUPPLIERS")
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/wrap_parameters.rb
config/initializers/wrap_parameters.rb
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do wrap_parameters format: [:json] end # Disable root element in JSON by default. ActiveSupport.on_load(:active_record) do self.include_root_in_json = false end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/aws.rb
config/initializers/aws.rb
# frozen_string_literal: true # aws credentials for the web app are stored in the secrets AWS_ACCESS_KEY = GlobalConfig.get("AWS_ACCESS_KEY_ID") AWS_SECRET_KEY = GlobalConfig.get("AWS_SECRET_ACCESS_KEY") AWS_S3_ENDPOINT = GlobalConfig.get("AWS_S3_ENDPOINT", "https://s3.amazonaws.com") AWS_DEFAULT_REGION = GlobalConfig.get("AWS_DEFAULT_REGION", "us-east-1") USING_MINIO = AWS_S3_ENDPOINT.present? && !AWS_S3_ENDPOINT.include?("amazonaws.com") aws_config = { region: AWS_DEFAULT_REGION, credentials: Aws::Credentials.new(AWS_ACCESS_KEY, AWS_SECRET_KEY) } # Support for MinIO in development and test environments if Rails.env.development? || Rails.env.test? aws_config[:endpoint] = AWS_S3_ENDPOINT if AWS_S3_ENDPOINT.present? Aws.config[:s3] = { force_path_style: true } end Aws.config.update(aws_config) INVOICES_S3_BUCKET = GlobalConfig.get("INVOICES_S3_BUCKET", "gumroad-invoices") S3_CREDENTIALS = { access_key_id: AWS_ACCESS_KEY, secret_access_key: AWS_SECRET_KEY, s3_region: AWS_DEFAULT_REGION }.freeze CLOUDFRONT_KEYPAIR_ID = GlobalConfig.get("CLOUDFRONT_KEYPAIR_ID") CLOUDFRONT_PRIVATE_KEY = GlobalConfig.get("CLOUDFRONT_PRIVATE_KEY").then do |key| OpenSSL::PKey::RSA.new(key) if key.present? end SECURITY_LOG_BUCKETS = { production: "gumroad-logs-security", staging: "gumroad-logs-security-staging" }.freeze KINDLE_EMAIL_REGEX = /\A(?=.{3,255}$)( # between 3 and 255 characters ([^@\s()\[\],.<>;:\\"]+(\.[^@\s()\[\],.<>;:\\"]+)*)) # cannot start with or have consecutive dots @kindle\.com\z/xi S3_BUCKET = { development: "gumroad-dev", staging: "gumroad_dev", test: "gumroad-specs", production: "gumroad" }[Rails.env.to_sym] S3_BASE_URL = GlobalConfig.get("S3_BASE_URL_TEMPLATE", "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/") PUBLIC_STORAGE_S3_BUCKET = { development: "gumroad-dev-public-storage", staging: "gumroad-dev-public-storage", test: "gumroad-specs", production: "gumroad-public-storage" }[Rails.env.to_sym] if Rails.env.production? # Streaming HLS_DISTRIBUTION_URL = GlobalConfig.get("HLS_DISTRIBUTION_URL_PROD", "https://d1bdh6c3ceakz5.cloudfront.net/") HLS_PIPELINE_ID = GlobalConfig.get("HLS_PIPELINE_ID_PROD", "1390492023700-rfbrn0") # File Download FILE_DOWNLOAD_DISTRIBUTION_URL = GlobalConfig.get("FILE_DOWNLOAD_DISTRIBUTION_URL_PROD", "https://files.gumroad.com/") CLOUDFRONT_DOWNLOAD_DISTRIBUTION_URL = GlobalConfig.get("CLOUDFRONT_DOWNLOAD_DISTRIBUTION_URL_PROD", "https://d2dw6lv4z9w0e2.cloudfront.net/") else # Streaming HLS_DISTRIBUTION_URL = GlobalConfig.get("HLS_DISTRIBUTION_URL_DEV", "https://d1jmbc8d0c0hid.cloudfront.net/") HLS_PIPELINE_ID = GlobalConfig.get("HLS_PIPELINE_ID_DEV", "1390090734092-rg9pq5") # File Download - use MinIO if AWS_S3_ENDPOINT is set (local dev with MinIO) if USING_MINIO # Using MinIO for local development FILE_DOWNLOAD_DISTRIBUTION_URL = "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/" CLOUDFRONT_DOWNLOAD_DISTRIBUTION_URL = "#{AWS_S3_ENDPOINT}/#{S3_BUCKET}/" else # Using AWS Cloudflare / CloudFront for staging FILE_DOWNLOAD_DISTRIBUTION_URL = GlobalConfig.get("FILE_DOWNLOAD_DISTRIBUTION_URL_DEV", "https://staging-files.gumroad.com/") CLOUDFRONT_DOWNLOAD_DISTRIBUTION_URL = GlobalConfig.get("CLOUDFRONT_DOWNLOAD_DISTRIBUTION_URL_DEV", "https://d3t5lixau6dhwk.cloudfront.net/") end end HLS_PRESETS = { "hls_1080p" => "1591945283540-xff1kg", "hls_720p" => "1591945673240-8jq7vk", "hls_480p" => "1591945700851-ma7v1l" } AWS_ACCOUNT_ID = GlobalConfig.get("AWS_ACCOUNT_ID") mediaconvert_queue_name = Rails.env.production? ? "production" : "staging" MEDIACONVERT_QUEUE = GlobalConfig.get("MEDIACONVERT_QUEUE_TEMPLATE", "arn:aws:mediaconvert:us-east-1:#{AWS_ACCOUNT_ID}:queues/#{mediaconvert_queue_name}") MEDIACONVERT_ROLE = GlobalConfig.get("MEDIACONVERT_ROLE", "arn:aws:iam::#{AWS_ACCOUNT_ID}:role/service-role/MediaConvert_Default_Role") MEDIACONVERT_ENDPOINT = GlobalConfig.get("MEDIACONVERT_ENDPOINT", "https://lxlxpswfb.mediaconvert.us-east-1.amazonaws.com")
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/countries.rb
config/initializers/countries.rb
# frozen_string_literal: true # Historically, we've gotten country names from a variety of sources: # the `iso_country_codes` gem, `maxmind/geoip2`, and most recently the `countries` gem. # # With the modifications here, a call to `ISO3166::Country.find_country_by_any_name` # will return the correct country from the `countries` gem, # provided a country name from any of the above sources. # # Out of the box, all country names from `iso_country_codes` can be found in `countries` # # Added here are country names from `maxmind/geoip2` which can't be found in `countries` ISO3166::Country["CG"].data["unofficial_names"] << "Congo Republic" ISO3166::Country["FM"].data["unofficial_names"] << "Federated States of Micronesia" ISO3166::Country["UM"].data["unofficial_names"] << "U.S. Outlying Islands" ISO3166::Country["VC"].data["unofficial_names"] << "St Vincent and Grenadines" # Similarly, there are times when we want to query by multiple country names, # e.g., `WHERE purchases.country IN ()` # # For performance reasons, we don't want such queries to use all names known by the `countries` gem. # So, we include historical names here. ISO3166::Country["AX"].data["gumroad_historical_names"] = ["Åland"] ISO3166::Country["BN"].data["gumroad_historical_names"] = ["Brunei"] ISO3166::Country["BO"].data["gumroad_historical_names"] = ["Bolivia, Plurinational State of"] ISO3166::Country["BQ"].data["gumroad_historical_names"] = ["Bonaire, Sint Eustatius, and Saba"] ISO3166::Country["CG"].data["gumroad_historical_names"] = ["Congo Republic"] ISO3166::Country["CZ"].data["gumroad_historical_names"] = ["Czech Republic"] ISO3166::Country["FK"].data["gumroad_historical_names"] = ["Falkland Islands"] ISO3166::Country["FM"].data["gumroad_historical_names"] = ["Federated States of Micronesia"] ISO3166::Country["HM"].data["gumroad_historical_names"] = ["Heard and McDonald Islands"] ISO3166::Country["KN"].data["gumroad_historical_names"] = ["St Kitts and Nevis"] ISO3166::Country["KR"].data["gumroad_historical_names"] = ["Korea, Republic of"] ISO3166::Country["LA"].data["gumroad_historical_names"] = ["Laos"] ISO3166::Country["MD"].data["gumroad_historical_names"] = ["Moldova, Republic of"] ISO3166::Country["MF"].data["gumroad_historical_names"] = ["Saint Martin"] ISO3166::Country["MK"].data["gumroad_historical_names"] = ["Macedonia, the former Yugoslav Republic of"] ISO3166::Country["PN"].data["gumroad_historical_names"] = ["Pitcairn Islands"] ISO3166::Country["PS"].data["gumroad_historical_names"] = ["Palestine"] ISO3166::Country["RU"].data["gumroad_historical_names"] = ["Russia"] ISO3166::Country["SH"].data["gumroad_historical_names"] = ["Saint Helena"] ISO3166::Country["ST"].data["gumroad_historical_names"] = ["São Tomé and Príncipe"] ISO3166::Country["SX"].data["gumroad_historical_names"] = ["Sint Maarten"] ISO3166::Country["SZ"].data["gumroad_historical_names"] = ["Swaziland"] ISO3166::Country["TR"].data["gumroad_historical_names"] = ["Turkey"] ISO3166::Country["TW"].data["gumroad_historical_names"] = ["Taiwan, Province of China"] ISO3166::Country["TZ"].data["gumroad_historical_names"] = ["Tanzania, United Republic of"] ISO3166::Country["UM"].data["gumroad_historical_names"] = ["U.S. Outlying Islands"] ISO3166::Country["VA"].data["gumroad_historical_names"] = ["Vatican City"] ISO3166::Country["VC"].data["gumroad_historical_names"] = ["St Vincent and Grenadines"] ISO3166::Country["VE"].data["gumroad_historical_names"] = ["Venezuela, Bolivarian Republic of"] ISO3166::Country["VG"].data["gumroad_historical_names"] = ["British Virgin Islands"] ISO3166::Country["VI"].data["gumroad_historical_names"] = ["U.S. Virgin Islands"] # We have to manually register Kosovo since it doesn't have an official ISO3166 code currently. # XK & XXK are widely used for Kosovo currently. Although when Kosovo does get their own- # ISO3166 code it will not be XK/XXK. https://en.wikipedia.org/wiki/XK_(user_assigned_code) ISO3166::Data.register( alpha3: "XXK", alpha2: "XK", translations: { "en": "Kosovo" }, continent: "Europe" )
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/pry.rb
config/initializers/pry.rb
# frozen_string_literal: true if defined?(PryByebug) Pry.commands.alias_command "c", "continue" Pry.commands.alias_command "s", "step" Pry.commands.alias_command "n", "next" Pry.commands.alias_command "f", "finish" Pry.commands.alias_command "bt", "pry-backtrace" Pry.config.editor = "vim" Pry.config.pager = false end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/omniauth.rb
config/initializers/omniauth.rb
# frozen_string_literal: true OmniAuth.config.full_host = "#{PROTOCOL}://#{DOMAIN}"
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/cdn_url_map.rb
config/initializers/cdn_url_map.rb
# frozen_string_literal: true # Map of origin prefixes to determine if a url is hosted at a location fronted by a CDN. # Use cdn_url_for in ProductsHelper to get the CDN url for a url on an origin contained in the map. # Should not be used to replace the use of asset_host. Should only be used for converting URLs persisted # and referencing files stored at an origin, that are fronted by a CDN. CDN_URL_MAP = { # regex/string of origin url => replacement text } # We use several S3 buckets to host user uploaded content. That content is proxied by the hosts below. public_assets_cdn_hosts = { development: { s3_proxy_host: "https://staging-static-2.gumroad.com", public_storage_host: AWS_S3_ENDPOINT }, test: { s3_proxy_host: "https://test-static-2.gumroad.com", public_storage_host: "https://test-public-files.gumroad.com" }, staging: { s3_proxy_host: "https://staging-static-2.gumroad.com", public_storage_host: "https://staging-public-files.gumroad.com" }, production: { s3_proxy_host: "https://static-2.gumroad.com", public_storage_host: "https://public-files.gumroad.com" } } CDN_S3_PROXY_HOST = public_assets_cdn_hosts.dig(Rails.env.to_sym, :s3_proxy_host) PUBLIC_STORAGE_CDN_S3_PROXY_HOST = public_assets_cdn_hosts.dig(Rails.env.to_sym, :public_storage_host) if CDN_S3_PROXY_HOST && PUBLIC_STORAGE_CDN_S3_PROXY_HOST if Rails.env.production? # Optimize CDN_URL_MAP for production to reduce the number of string look ups. CDN_URL_MAP["#{AWS_S3_ENDPOINT}/gumroad/"] = "#{CDN_S3_PROXY_HOST}/res/gumroad/" CDN_URL_MAP["https://gumroad-public-storage.s3.amazonaws.com/"] = "#{PUBLIC_STORAGE_CDN_S3_PROXY_HOST}/" else CDN_URL_MAP.merge!("#{AWS_S3_ENDPOINT}/gumroad/" => "#{CDN_S3_PROXY_HOST}/res/gumroad/", "#{AWS_S3_ENDPOINT}/gumroad-staging/" => "#{CDN_S3_PROXY_HOST}/res/gumroad-staging/", "#{AWS_S3_ENDPOINT}/gumroad_dev/" => "#{CDN_S3_PROXY_HOST}/res/gumroad_dev/", "https://gumroad-dev-public-storage.s3.amazonaws.com/" => "#{PUBLIC_STORAGE_CDN_S3_PROXY_HOST}/") end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/inflections.rb
config/initializers/inflections.rb
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.irregular "has", "have" end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.acronym "RESTful" # end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/cookie_rotator.rb
config/initializers/cookie_rotator.rb
# frozen_string_literal: true Rails.application.config.after_initialize do Rails.application.config.action_dispatch.cookies_rotations.tap do |cookies| authenticated_encrypted_cookie_salt = Rails.application.config.action_dispatch.authenticated_encrypted_cookie_salt signed_cookie_salt = Rails.application.config.action_dispatch.signed_cookie_salt secret_key_base = Rails.application.secret_key_base key_generator = ActiveSupport::KeyGenerator.new( secret_key_base, iterations: 1000, hash_digest_class: OpenSSL::Digest::SHA1 ) key_len = ActiveSupport::MessageEncryptor.key_len old_encrypted_secret = key_generator.generate_key(authenticated_encrypted_cookie_salt, key_len) old_signed_secret = key_generator.generate_key(signed_cookie_salt) cookies.rotate :encrypted, old_encrypted_secret cookies.rotate :signed, old_signed_secret end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/mail_observers.rb
config/initializers/mail_observers.rb
# frozen_string_literal: true Rails.application.configure do config.action_mailer.observers = %w[EmailDeliveryObserver] end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/devise_hooks.rb
config/initializers/devise_hooks.rb
# frozen_string_literal: true Warden::Manager.after_set_user except: :fetch do |user, warden, options| warden.session[:last_sign_in_at] = DateTime.current.to_i end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/makara.rb
config/initializers/makara.rb
# frozen_string_literal: true module Makara class ConnectionWrapper # Rails 7.0 compatibility, from: https://github.com/instacart/makara/pull/358 # TODO: Remove this file after the makara gem is updated, including this PR. def execute(*args, **kwargs) SQL_REPLACE.each do |find, replace| if args[0] == find args[0] = replace end end _makara_connection.execute(*args, **kwargs) end end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/001_twitter.rb
config/initializers/001_twitter.rb
# frozen_string_literal: true # We're using an ancient omniauth-twitter gem that relies on this removed behavior # See https://github.com/rack/rack/pull/2183/files#diff-7ce97931f18a63a4d028696a6f4ba81991644dbc2d70eaa664285264e9a5cd64L612 # TODO (sharang): Change the gem or approach to twitter signup/connection and remove this patch module Rack class Request # shortcut for <tt>request.params[key]</tt> def [](key) warn("Request#[] is deprecated and will be removed in a future version of Rack. Please use request.params[] instead", uplevel: 1) params[key.to_s] end end end TWITTER_APP_ID = GlobalConfig.get("TWITTER_APP_ID") TWITTER_APP_SECRET = GlobalConfig.get("TWITTER_APP_SECRET") $twitter = Twitter::REST::Client.new do |config| config.consumer_key = TWITTER_APP_ID config.consumer_secret = TWITTER_APP_SECRET end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/koala.rb
config/initializers/koala.rb
# frozen_string_literal: true Koala.config.api_version = FACEBOOK_API_VERSION
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/bugsnag.rb
config/initializers/bugsnag.rb
# frozen_string_literal: true require Rails.root.join("lib", "extras", "bugsnag_handle_sidekiq_retries_callback") unless Rails.env.test? Rails.application.config.after_initialize do Bugsnag.configure do |config| config.api_key = GlobalConfig.get("BUGSNAG_API_KEY") config.notify_release_stages = %w[production staging] custom_ignored_classes = Set.new([ ActionController::RoutingError, ActionController::InvalidAuthenticityToken, AbstractController::ActionNotFound, Mongoid::Errors::DocumentNotFound, ActionController::UnknownFormat, ActionController::UnknownHttpMethod, ActionController::BadRequest, Mime::Type::InvalidMimeType, ActionController::ParameterMissing, ]) config.ignore_classes.merge(custom_ignored_classes) config.add_on_error BugsnagHandleSidekiqRetriesCallback end end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/rack_profiler.rb
config/initializers/rack_profiler.rb
# frozen_string_literal: true require "rack-mini-profiler" Rack::MiniProfilerRails.initialize!(Rails.application) Rack::MiniProfiler.config.authorization_mode = :allow_authorized Rack::MiniProfiler.config.skip_paths = [ /#{ASSET_DOMAIN}/o, ] Rack::MiniProfiler.config.start_hidden = true Rack::MiniProfiler.config.storage_instance = Rack::MiniProfiler::RedisStore.new( connection: $redis, expires_in: 1.hour.in_seconds, ) Rack::MiniProfiler.config.user_provider = ->(env) do request = ActionDispatch::Request.new(env) id = request.cookies["_gumroad_guid"] || request.remote_ip || "unknown" Digest::SHA256.hexdigest(id.to_s) end # Rack::Headers makes accessing the headers case-insensitive, so # headers["Content-Type"] is the same as headers["content-type"]. MiniProfiler # specifically looks for "Content-Type" and would skip injecting the profiler # if the header is actually "content-type". class EnsureHeadersIsRackHeadersObject def initialize(app) @app = app end def call(env) status, headers, body = @app.call(env) response = Rack::Response[status, headers, body] # Debug why the original headers object is sometimes a Hash and sometimes a # Rack::Headers object. response.add_header("X-Original-Headers-Class", headers.class.name) response.finish end end Rails.application.config.middleware.insert_after( Rack::MiniProfiler, EnsureHeadersIsRackHeadersObject )
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/mongo.rb
config/initializers/mongo.rb
# frozen_string_literal: true require File.join(Rails.root, "lib", "extras", "mongoer") Mongoid.load!(Rails.root.join("config", "mongoid.yml")) MONGO_DATABASE = Mongoid::Clients.default
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/permissions_policy.rb
config/initializers/permissions_policy.rb
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Define an application-wide HTTP permissions policy. For further # information see: https://developers.google.com/web/updates/2018/06/feature-policy # Rails.application.config.permissions_policy do |policy| # policy.camera :none # policy.gyroscope :none # policy.microphone :none # policy.usb :none # policy.fullscreen :self # policy.payment :self, "https://secure.example.com" # end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/api_v2_methods.rb
config/initializers/api_v2_methods.rb
# frozen_string_literal: true GUMROAD_API_V2_METHODS = [ { name: "Products", methods: [ { type: :get, path: "/products", description: "Retrieve all of the existing products for the authenticated user.", response_layout: :products, curl_layout: :get_products }, { type: :get, path: "/products/:id", description: "Retrieve the details of a product.", response_layout: :product, curl_layout: :get_product }, { type: :delete, path: "/products/:id", description: "Permanently delete a product.", response_layout: :product_deleted, curl_layout: :delete_product }, # product enable / disable { type: :put, path: "/products/:id/enable", description: "Enable an existing product.", response_layout: :product, curl_layout: :enable_product }, { type: :put, path: "/products/:id/disable", description: "Disable an existing product.", response_layout: :disabled_product, curl_layout: :disable_product } ] }, { name: "Variant categories", methods: [ { type: :post, path: "/products/:product_id/variant_categories", description: "Create a new variant category on a product.", response_layout: :variant_category, curl_layout: :create_variant_category, parameters_layout: :create_variant_category }, { type: :get, path: "/products/:product_id/variant_categories/:id", description: "Retrieve the details of a variant category of a product.", response_layout: :variant_category, curl_layout: :get_variant_category }, { type: :put, path: "/products/:product_id/variant_categories/:id", description: "Edit a variant category of an existing product.", response_layout: :variant_category, curl_layout: :update_variant_category, parameters_layout: :create_variant_category }, { type: :delete, path: "/products/:product_id/variant_categories/:id", description: "Permanently delete a variant category of a product.", response_layout: :variant_category_deleted, curl_layout: :delete_variant_category }, { type: :get, path: "/products/:product_id/variant_categories", description: "Retrieve all of the existing variant categories of a product.", response_layout: :variant_categories, curl_layout: :get_variant_categories }, { type: :post, path: "/products/:product_id/variant_categories/:variant_category_id/variants", description: "Create a new variant of a product.", response_layout: :variant, curl_layout: :create_variant, parameters_layout: :create_variant }, { type: :get, path: "/products/:product_id/variant_categories/:variant_category_id/variants/:id", description: "Retrieve the details of a variant of a product.", response_layout: :variant, curl_layout: :get_variant }, { type: :put, path: "/products/:product_id/variant_categories/:variant_category_id/variants/:id", description: "Edit a variant of an existing product.", response_layout: :variant, curl_layout: :update_variant, parameters_layout: :create_variant }, { type: :delete, path: "/products/:product_id/variant_categories/:variant_category_id/variants/:id", description: "Permanently delete a variant of a product.", response_layout: :variant_deleted, curl_layout: :delete_variant }, { type: :get, path: "/products/:product_id/variant_categories/:variant_category_id/variants", description: "Retrieve all of the existing variants in a variant category.", response_layout: :variants, curl_layout: :get_variants } ] }, { name: "Offer codes", methods: [ { type: :get, path: "/products/:product_id/offer_codes", description: "Retrieve all of the existing offer codes for a product. Either amount_cents or percent_off " \ "will be returned depending if the offer code is a fixed amount off or a percentage off. " \ "A universal offer code is one that applies to all products.", response_layout: :offer_codes, curl_layout: :get_offer_codes }, { type: :get, path: "/products/:product_id/offer_codes/:id", description: "Retrieve the details of a specific offer code of a product", response_layout: :offer_code, curl_layout: :get_offer_code }, { type: :post, path: "/products/:product_id/offer_codes", description: "Create a new offer code for a product. Default offer code is in cents. A universal offer code is one that applies to all products.", response_layout: :offer_code, curl_layout: :create_offer_code, parameters_layout: :create_offer_code }, { type: :put, path: "/products/:product_id/offer_codes/:id", description: "Edit an existing product's offer code.", response_layout: :update_offer_code, curl_layout: :update_offer_code, parameters_layout: :update_offer_code }, { type: :delete, path: "/products/:product_id/offer_codes/:id", description: "Permanently delete a product's offer code.", response_layout: :offer_code_deleted, curl_layout: :delete_offer_code } ] }, { name: "Custom fields", methods: [ { type: :get, path: "/products/:product_id/custom_fields", description: "Retrieve all of the existing custom fields for a product.", response_layout: :custom_fields, curl_layout: :get_custom_fields }, { type: :post, path: "/products/:product_id/custom_fields", description: "Create a new custom field for a product.", response_layout: :custom_field, curl_layout: :create_custom_field, parameters_layout: :create_custom_field }, { type: :put, path: "/products/:product_id/custom_fields/:name", description: "Edit an existing product's custom field.", response_layout: :custom_field, curl_layout: :update_custom_field, parameters_layout: :update_custom_field }, { type: :delete, path: "/products/:product_id/custom_fields/:name", description: "Permanently delete a product's custom field.", response_layout: :custom_field_deleted, curl_layout: :delete_custom_field } ] }, { name: "User", methods: [ { type: :get, path: "/user", description: "Retrieve the user's data.", response_layout: :user, curl_layout: :get_user } ] }, { name: "Resource subscriptions", methods: [ { type: :put, path: "/resource_subscriptions", description: "Subscribe to a resource. Currently there are 8 supported resource names - \"sale\", \"refund\", \"dispute\", \"dispute_won\", \"cancellation\", \"subscription_updated\", \"subscription_ended\", and \"subscription_restarted\".</p>" \ "<p><strong>sale</strong>" \ " - When subscribed to this resource, you will be notified of the user's sales with an HTTP POST to your post_url. The format of the POST is described on the <a href='/ping'>Gumroad Ping</a> page.</p>" \ "<p><strong>refund</strong>" \ " - When subscribed to this resource, you will be notified of refunds to the user's sales with an HTTP POST to your post_url. The format of the POST is same as described on the <a href='/ping'>Gumroad Ping</a> page.</p>" \ "<p><strong>dispute</strong>" \ " - When subscribed to this resource, you will be notified of the disputes raised against user's sales with an HTTP POST to your post_url. The format of the POST is described on the <a href='/ping'>Gumroad Ping</a> page.</p>" \ "<p><strong>dispute_won</strong>" \ " - When subscribed to this resource, you will be notified of the sale disputes won by the user with an HTTP POST to your post_url. The format of the POST is described on the <a href='/ping'>Gumroad Ping</a> page.</p>" \ "<p><strong>cancellation</strong>" \ " - When subscribed to this resource, you will be notified of cancellations of the user's subscribers with an HTTP POST to your post_url.</p>" \ "<p><strong>subscription_updated</strong>" \ " - When subscribed to this resource, you will be notified when subscriptions to the user's products have been upgraded or downgraded with an HTTP POST to your post_url. A subscription is \"upgraded\" when the subscriber switches to an equally or more expensive tier and/or subscription duration. It is \"downgraded\" when the subscriber switches to a less expensive tier and/or subscription duration. In the case of a downgrade, this change will take effect at the end of the current billing period. (Note: This currently applies only to tiered membership products, not to all subscription products.)</p>"\ "<p><strong>subscription_ended</strong>" \ " - When subscribed to this resource, you will be notified when subscriptions to the user's products have ended with an HTTP POST to your post_url. These events include termination of a subscription due to: failed payment(s); cancellation; or a subscription of fixed duration ending. Notifications are sent at the time the subscription has officially ended, not, for example, at the time cancellation is requested.</p>" \ "<p><strong>subscription_restarted</strong>" \ " - When subscribed to this resource, you will be notified when subscriptions to the user's products have been restarted with an HTTP POST to your post_url. A subscription is \"restarted\" when the subscriber restarts their subscription after previously terminating it.</p>" \ "<p> <span>In each POST request, Gumroad sends these parameters:</span><br> <strong>subscription_id</strong>: id of the subscription<br> <strong>product_id</strong>: id of the product<br> <strong>product_name</strong>: name of the product<br> <strong>user_id</strong>: user id of the subscriber<br> <strong>user_email</strong>: email address of the subscriber<br> <strong>purchase_ids</strong>: array of charge ids belonging to this subscription<br> <strong>created_at</strong>: timestamp when subscription was created<br> <strong>charge_occurrence_count</strong>: number of charges made for this subscription<br> <strong>recurrence</strong>: subscription duration - monthly/quarterly/biannually/yearly/every_two_years<br> <strong>free_trial_ends_at</strong>: timestamp when free trial ends, if free trial is enabled for the membership<br> <strong>custom_fields</strong>: custom fields from the original purchase<br> <strong>license_key</strong>: license key from the original purchase </p> <p> <em>For \"cancellation\" resource:</em><br> <strong>cancelled</strong>: true if subscription has been cancelled, otherwise false<br> <strong>cancelled_at</strong>: timestamp at which subscription will be cancelled<br> <strong>cancelled_by_admin</strong>: true if subscription was been cancelled by admin, otherwise not present<br> <strong>cancelled_by_buyer</strong>: true if subscription was been cancelled by buyer, otherwise not present<br> <strong>cancelled_by_seller</strong>: true if subscription was been cancelled by seller, otherwise not present<br> <strong>cancelled_due_to_payment_failures</strong>: true if subscription was been cancelled automatically because of payment failure, otherwise not present </p> <p> <em>For \"subscription_updated\" resource:</em><br> <strong>type</strong>: \"upgrade\" or \"downgrade\"<br> <strong>effective_as_of</strong>: timestamp at which the change went or will go into effect<br> <strong>old_plan</strong>: tier, subscription duration, price, and quantity of the subscription before the change<br> <strong>new_plan</strong>: tier, subscription duration, price, and quantity of the subscription after the change </p> <figure class=\"code\"> <figcaption>Example</figcaption><pre tabindex=\"0\">{ ... type: \"upgrade\", effective_as_of: \"2021-02-23T16:31:44Z\", old_plan: { tier: { id: \"G_-mnBf9b1j9A7a4ub4nFQ==\", name: \"Basic tier\" }, recurrence: \"monthly\", price_cents: \"1000\", quantity: 1 }, new_plan: { tier: { id: \"G_-mnBf9b1j9A7a4ub4nFQ==\", name: \"Basic tier\" }, recurrence: \"yearly\", price_cents: \"12000\", quantity: 2 } }</pre></figure><p></p> <p> <em>For \"subscription_ended\" resource:</em><br> <strong>ended_at</strong>: timestamp at which the subscription ended<br> <strong>ended_reason</strong>: the reason for the subscription ending (\"cancelled\", \"failed_payment\", or \"fixed_subscription_period_ended\") </p> <p> <em>For \"subscription_restarted\" resource:</em><br> <strong>restarted_at</strong>: timestamp at which the subscription was restarted<br> ", response_layout: :resource_subscription, curl_layout: :create_resource_subscription }, { type: :get, path: "/resource_subscriptions", description: "Show all active subscriptions of user for the input resource.", response_layout: :resource_subscriptions, curl_layout: :get_resource_subscriptions, parameters_layout: :get_resource_subscriptions }, { type: :delete, path: "/resource_subscriptions/:resource_subscription_id", description: "Unsubscribe from a resource.", response_layout: :resource_subscription_deleted, curl_layout: :delete_resource_subscription } ] }, { name: "Sales", methods: [ { type: :get, path: "/sales", description: "Retrieves all of the successful sales by the authenticated user. Available with the 'view_sales' scope.", response_layout: :sales, curl_layout: :get_sales, parameters_layout: :get_sales }, { type: :get, path: "/sales/:id", description: "Retrieves the details of a sale by this user. Available with the 'view_sales' scope.", response_layout: :sale, curl_layout: :get_sale }, { type: :put, path: "/sales/:id/mark_as_shipped", description: "Marks a sale as shipped. Available with the 'mark_sales_as_shipped' scope.", response_layout: :sale_shipped, curl_layout: :mark_sale_as_shipped, parameters_layout: :mark_sale_as_shipped }, { type: :put, path: "/sales/:id/refund", description: "Refunds a sale. Available with the 'edit_sales' scope.", response_layout: :sale_refunded, curl_layout: :refund_sale, parameters_layout: :refund_sale }, { type: :post, path: "/sales/:id/resend_receipt", description: "Resend the purchase receipt to the customer's email. Available with the 'edit_sales' scope.", response_layout: :receipt_resent, curl_layout: :resend_receipt } ] }, { name: "Subscribers", methods: [ { type: :get, path: "/products/:product_id/subscribers", description: "Retrieves all of the active subscribers for one of the authenticated user's products. Available with the 'view_sales' scope" \ "<p>A subscription is terminated if any of <strong>failed_at</strong>, <strong>ended_at</strong>, or <strong>cancelled_at</strong> timestamps are populated and are in the past.</p>" \ "<p>A subscription's <strong>status</strong> can be one of: <strong>alive</strong>, <strong>pending_cancellation</strong>, <strong>pending_failure</strong>, <strong>failed_payment</strong>, <strong>fixed_subscription_period_ended</strong>, <strong>cancelled</strong>.</p>", response_layout: :subscribers, curl_layout: :get_subscribers, parameters_layout: :get_subscribers }, { type: :get, path: "/subscribers/:id", description: "Retrieves the details of a subscriber to this user's product. Available with the 'view_sales' scope.", response_layout: :subscriber, curl_layout: :get_subscriber } ] }, { name: "Licenses", methods: [ { type: :post, path: "/licenses/verify", description: "Verify a license", response_layout: :license, curl_layout: :verify_license, parameters_layout: :verify_license }, { type: :put, path: "/licenses/enable", description: "Enable a license", response_layout: :license, curl_layout: :enable_license, parameters_layout: :enable_disable_license }, { type: :put, path: "/licenses/disable", description: "Disable a license", response_layout: :license, curl_layout: :disable_license, parameters_layout: :enable_disable_license }, { type: :put, path: "/licenses/decrement_uses_count", description: "Decrement the uses count of a license", response_layout: :license, curl_layout: :decrement_uses_count, parameters_layout: :decrement_uses_count }, { type: :put, path: "/licenses/rotate", description: "Rotate a license key. The old license key will no longer be valid.", response_layout: :license, curl_layout: :rotate_license, parameters_layout: :enable_disable_license } ] }, { name: "Payouts", methods: [ { type: :get, path: "/payouts", description: "Retrieves all of the payouts for the authenticated user. Available with the 'view_payouts' scope.", response_layout: :payouts, curl_layout: :get_payouts, parameters_layout: :get_payouts }, { type: :get, path: "/payouts/:id", description: "Retrieves the details of a specific payout by this user. Available with the 'view_payouts' scope.", response_layout: :payout, curl_layout: :get_payout } ] } ].freeze
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/active_record_query_trace.rb
config/initializers/active_record_query_trace.rb
# frozen_string_literal: true if Rails.env.development? ActiveRecordQueryTrace.enabled = (ENV["QUERY_TRACE"] == "1") end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/002_google.rb
config/initializers/002_google.rb
# frozen_string_literal: true GOOGLE_CLIENT_ID = GlobalConfig.get("GOOGLE_CLIENT_ID") GOOGLE_CLIENT_SECRET = GlobalConfig.get("GOOGLE_CLIENT_SECRET")
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/blocked_object_types.rb
config/initializers/blocked_object_types.rb
# frozen_string_literal: true BLOCKED_OBJECT_TYPES = { ip_address: "ip_address", browser_guid: "browser_guid", email: "email", email_domain: "email_domain", charge_processor_fingerprint: "charge_processor_fingerprint", product: "product" }.freeze
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false