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/app/policies/settings/main/user_policy.rb | app/policies/settings/main/user_policy.rb | # frozen_string_literal: true
class Settings::Main::UserPolicy < ApplicationPolicy
def show?
user.role_admin_for?(seller)
end
def update?
user.role_owner_for?(seller)
end
def resend_confirmation_email?
update?
end
def invalidate_active_sessions?
update?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/settings/third_party_analytics/user_policy.rb | app/policies/settings/third_party_analytics/user_policy.rb | # frozen_string_literal: true
class Settings::ThirdPartyAnalytics::UserPolicy < ApplicationPolicy
def show?
user.role_admin_for?(seller)
end
def update?
show?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/settings/authorized_applications/oauth_application_policy.rb | app/policies/settings/authorized_applications/oauth_application_policy.rb | # frozen_string_literal: true
class Settings::AuthorizedApplications::OauthApplicationPolicy < ApplicationPolicy
def index?
user.role_admin_for?(seller)
end
def create?
index?
end
def edit?
index?
end
def update?
index?
end
def destroy?
index?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/admin/impersonators/user_policy.rb | app/policies/admin/impersonators/user_policy.rb | # frozen_string_literal: true
class Admin::Impersonators::UserPolicy < ApplicationPolicy
def create?
return false if record.is_team_member? || record.deleted?
true
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/admin/charges/charge_policy.rb | app/policies/admin/charges/charge_policy.rb | # frozen_string_literal: true
class Admin::Charges::ChargePolicy < ApplicationPolicy
def sync_status_with_charge_processor?
record.purchases.where(purchase_state: %w(in_progress failed)).exists?
end
def refund?
record.successful_purchases.non_free.not_fully_refunded.exists?
end
def refund_for_fraud... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/admin/products/staff_picked/link_policy.rb | app/policies/admin/products/staff_picked/link_policy.rb | # frozen_string_literal: true
class Admin::Products::StaffPicked::LinkPolicy < ApplicationPolicy
def create?
return false if record.staff_picked_product&.not_deleted?
record.recommendable?
end
def destroy?
record.staff_picked_product&.not_deleted? || false
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/checkout/offer_code_policy.rb | app/policies/checkout/offer_code_policy.rb | # frozen_string_literal: true
class Checkout::OfferCodePolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
def paged?
index?
end
def statistics?
index?
end... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/checkout/form_policy.rb | app/policies/checkout/form_policy.rb | # frozen_string_literal: true
class Checkout::FormPolicy < ApplicationPolicy
def show?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
def update?
user.role_admin_for?(seller) ||
user.role_marketi... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/checkout/upsell_policy.rb | app/policies/checkout/upsell_policy.rb | # frozen_string_literal: true
class Checkout::UpsellPolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
def paged?
index?
end
def cart_item?
index?
end
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/product_duplicates/link_policy.rb | app/policies/product_duplicates/link_policy.rb | # frozen_string_literal: true
# Products section
#
class ProductDuplicates::LinkPolicy < ApplicationPolicy
def create?
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller)
end
def show?
create?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/products/collabs_policy.rb | app/policies/products/collabs_policy.rb | # frozen_string_literal: true
class Products::CollabsPolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
def products_paged?
index?
end
def memberships_pag... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/products/affiliated_policy.rb | app/policies/products/affiliated_policy.rb | # frozen_string_literal: true
class Products::AffiliatedPolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/products/variants/link_policy.rb | app/policies/products/variants/link_policy.rb | # frozen_string_literal: true
# Products
# Audience > Customers
#
class Products::Variants::LinkPolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/products/archived/link_policy.rb | app/policies/products/archived/link_policy.rb | # frozen_string_literal: true
class Products::Archived::LinkPolicy < ApplicationPolicy
def index?
Pundit.policy!(@context, Link).index?
end
def create?
Pundit.policy!(@context, Link).new? &&
record.not_archived?
end
def destroy?
Pundit.policy!(@context, Link).new? &&
record.archived?
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/gumroad_blog/posts_policy.rb | app/policies/gumroad_blog/posts_policy.rb | # frozen_string_literal: true
class GumroadBlog::PostsPolicy < ApplicationPolicy
allow_anonymous_user_access!
def index?
true
end
def show?
return false unless record.alive?
return false unless record.shown_on_profile?
return false if record.workflow_id.present?
return false unless record... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/validators/isbn_validator.rb | app/validators/isbn_validator.rb | # frozen_string_literal: true
class IsbnValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
return if value.nil? && options[:allow_nil]
return if value.blank? && options[:allow_blank]
isbn_digits = value.delete("-")
valid =
if isbn_digits.length == 10
va... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/validators/json_validator.rb | app/validators/json_validator.rb | # frozen_string_literal: true
class JsonValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
unless JSON::Validator.validate(options[:schema], value)
record.errors.add(attribute, options[:message] || "invalid.")
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/validators/not_reserved_email_domain_validator.rb | app/validators/not_reserved_email_domain_validator.rb | # frozen_string_literal: true
class NotReservedEmailDomainValidator < ActiveModel::EachValidator
RESERVED_EMAIL_DOMAINS = %w[gumroad.com gumroad.org gumroad.dev].freeze
class << self
def domain_reserved?(email)
return false if email.blank?
domain = Mail::Address.new(email).domain
domain&.do... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/validators/email_format_validator.rb | app/validators/email_format_validator.rb | # frozen_string_literal: true
class EmailFormatValidator < ActiveModel::EachValidator
# To reduce invalid email address errors, we enforcing the same email regex as the front end
EMAIL_REGEX = /\A(?=.{3,255}$)( # between 3 and 255 characters
([^@\s()\[\],.<>;... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/product_duplicates_controller.rb | app/controllers/product_duplicates_controller.rb | # frozen_string_literal: true
class ProductDuplicatesController < Sellers::BaseController
before_action :fetch_product_and_enforce_ownership
def create
authorize [:product_duplicates, @product]
if @product.is_duplicating
render(json: { success: false, error_message: "Duplication in progress..." }) ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/utm_links_controller.rb | app/controllers/utm_links_controller.rb | # frozen_string_literal: true
class UtmLinksController < Sellers::BaseController
before_action :set_body_id_as_app
def index
authorize UtmLink
end
private
def set_title
@title = "UTM Links"
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/licenses_controller.rb | app/controllers/licenses_controller.rb | # frozen_string_literal: true
class LicensesController < Sellers::BaseController
def update
license = License.find_by_external_id!(params[:id])
authorize [:audience, license.purchase], :manage_license?
if ActiveModel::Type::Boolean.new.cast(params[:enabled])
license.enable!
else
license.... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/media_locations_controller.rb | app/controllers/media_locations_controller.rb | # frozen_string_literal: true
class MediaLocationsController < ApplicationController
include RecordMediaLocation
skip_before_action :check_suspended
def create
render json: { success: record_media_location(params) }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/utm_link_tracking_controller.rb | app/controllers/utm_link_tracking_controller.rb | # frozen_string_literal: true
class UtmLinkTrackingController < ApplicationController
def show
utm_link = UtmLink.active.find_by!(permalink: params[:permalink])
e404 unless Feature.active?(:utm_links, utm_link.seller)
redirect_to utm_link.utm_url, allow_other_host: true
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/thumbnails_controller.rb | app/controllers/thumbnails_controller.rb | # frozen_string_literal: true
class ThumbnailsController < Sellers::BaseController
before_action :find_product
def create
authorize Thumbnail
thumbnail = @product.thumbnail || @product.build_thumbnail
if permitted_params[:signed_blob_id].present?
thumbnail.file.attach(permitted_params[:signed_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/test_controller.rb | app/controllers/test_controller.rb | # frozen_string_literal: true
# Controller containing actions for endpoints that are used by Pingdom and alike to check that
# certain functionality is working and alive.
class TestController < ApplicationController
# Public: Action that tests that outgoing traffic is possible.
# Tests outgoing traffic by attempti... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/bundles_controller.rb | app/controllers/bundles_controller.rb | # frozen_string_literal: true
class BundlesController < Sellers::BaseController
include SearchProducts, Product::BundlesMarketing
PER_PAGE = 10
def show
bundle = Link.can_be_bundle.find_by_external_id!(params[:id])
authorize bundle
@title = bundle.name
@props = BundlePresenter.new(bundle:).b... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/product_files_utility_controller.rb | app/controllers/product_files_utility_controller.rb | # frozen_string_literal: true
class ProductFilesUtilityController < ApplicationController
include SignedUrlHelper
before_action :authenticate_user!
before_action :set_product, only: %i[download_product_files download_folder_archive]
def external_link_title
response = SsrfFilter.get(params.require(:url))... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/posts_controller.rb | app/controllers/posts_controller.rb | # frozen_string_literal: true
class PostsController < ApplicationController
include CustomDomainConfig
before_action :authenticate_user!, only: %i[send_for_purchase]
after_action :verify_authorized, only: %i[send_for_purchase]
before_action :fetch_post, only: %i[send_for_purchase]
before_action :ensure_sell... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/subscriptions_controller.rb | app/controllers/subscriptions_controller.rb | # frozen_string_literal: true
class SubscriptionsController < ApplicationController
PUBLIC_ACTIONS = %i[manage unsubscribe_by_user magic_link send_magic_link].freeze
before_action :authenticate_user!, except: PUBLIC_ACTIONS
after_action :verify_authorized, except: PUBLIC_ACTIONS
before_action :fetch_subscript... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/paypal_controller.rb | app/controllers/paypal_controller.rb | # frozen_string_literal: true
class PaypalController < ApplicationController
before_action :authenticate_user!, only: [:connect, :disconnect]
before_action :validate_paypal_connect_allowed, only: %i[connect]
before_action :validate_paypal_disconnect_allowed, only: %i[disconnect]
after_action :verify_authorized... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/github_stars_controller.rb | app/controllers/github_stars_controller.rb | # frozen_string_literal: true
class GithubStarsController < ApplicationController
def show
expires_in 1.hour, public: true
render json: { stars: fetch_cached_stars }
end
private
def fetch_cached_stars
Rails.cache.fetch(
"github_stars_antiwork/gumroad",
expires_in: 1.hour,
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/affiliate_requests_controller.rb | app/controllers/affiliate_requests_controller.rb | # frozen_string_literal: true
class AffiliateRequestsController < ApplicationController
include CustomDomainConfig
PUBLIC_ACTIONS = %i[new create]
before_action :authenticate_user!, except: PUBLIC_ACTIONS
before_action :set_user_and_custom_domain_config, only: %i[new create]
before_action :check_if_needs_r... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/asset_previews_controller.rb | app/controllers/asset_previews_controller.rb | # frozen_string_literal: true
class AssetPreviewsController < ApplicationController
before_action :find_product
after_action :verify_authorized
def create
authorize AssetPreview
asset_preview = @product.asset_previews.build
if permitted_params[:signed_blob_id].present?
asset_preview.file.att... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/emails_controller.rb | app/controllers/emails_controller.rb | # frozen_string_literal: true
class EmailsController < Sellers::BaseController
layout "inertia"
before_action :set_installment, only: %i[edit update destroy]
def index
authorize Installment
if current_seller.installments.alive.not_workflow_installment.scheduled.exists?
redirect_to scheduled_emai... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/two_factor_authentication_controller.rb | app/controllers/two_factor_authentication_controller.rb | # frozen_string_literal: true
class TwoFactorAuthenticationController < ApplicationController
before_action :redirect_to_signed_in_path, if: -> { user_signed_in? && skip_two_factor_authentication?(logged_in_user) }
before_action :fetch_user
before_action :check_presence_of_user, except: :verify
before_action :... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/purchase_custom_fields_controller.rb | app/controllers/purchase_custom_fields_controller.rb | # frozen_string_literal: true
class PurchaseCustomFieldsController < ApplicationController
def create
purchase = Purchase.find_by_external_id!(permitted_params.require(:purchase_id))
custom_field = purchase.link.custom_fields.is_post_purchase.where(type: CustomField::FIELD_TYPE_TO_NODE_TYPE_MAPPING.keys).fin... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/test_pings_controller.rb | app/controllers/test_pings_controller.rb | # frozen_string_literal: true
class TestPingsController < Sellers::BaseController
def create
authorize([:settings, :advanced, current_seller], :test_ping?)
unless /\A#{URI::DEFAULT_PARSER.make_regexp}\z/.match?(params[:url])
render json: { success: false, error_message: "That URL seems to be invalid."... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/home_controller.rb | app/controllers/home_controller.rb | # frozen_string_literal: true
class HomeController < ApplicationController
layout "home"
before_action :set_meta_data
before_action :set_layout_and_title
private
def set_layout_and_title
@hide_layouts = true
@title = @meta_data[action_name]&.fetch(:title) || "Gumroad"
end
def set_met... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/product_reviews_controller.rb | app/controllers/product_reviews_controller.rb | # frozen_string_literal: true
class ProductReviewsController < ApplicationController
include Pagy::Backend
PER_PAGE = 10
before_action :fetch_product, only: [:set]
def index
product = Link.find_by_external_id(permitted_params[:product_id])
return head :not_found unless product.present?
return he... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/support_controller.rb | app/controllers/support_controller.rb | # frozen_string_literal: true
class SupportController < ApplicationController
include ValidateRecaptcha
include HelperWidget
layout "inertia"
def index
return redirect_to help_center_root_path(params.permit(:new_ticket)) unless user_signed_in?
e404 if helper_widget_host.blank?
render inertia: "... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/links_controller.rb | app/controllers/links_controller.rb | # frozen_string_literal: true
class LinksController < ApplicationController
include ProductsHelper, SearchProducts, PreorderHelper, ActionView::Helpers::TextHelper,
ActionView::Helpers::AssetUrlHelper, CustomDomainConfig, AffiliateCookie,
CreateDiscoverSearch, DiscoverCuratedProducts, FetchProduc... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | true |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/tags_controller.rb | app/controllers/tags_controller.rb | # frozen_string_literal: true
class TagsController < ApplicationController
def index
render json: params[:text] ? Tag.by_text(text: params[:text]) : { success: false }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/instant_payouts_controller.rb | app/controllers/instant_payouts_controller.rb | # frozen_string_literal: true
class InstantPayoutsController < Sellers::BaseController
def create
authorize :instant_payout
result = InstantPayoutsService.new(current_seller, date: Date.parse(params.require(:date))).perform
if result[:success]
redirect_to balance_path, notice: "Instant payout ini... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/secure_redirect_controller.rb | app/controllers/secure_redirect_controller.rb | # frozen_string_literal: true
class SecureRedirectController < ApplicationController
before_action :validate_params, only: [:new, :create]
before_action :set_encrypted_params, only: [:new, :create]
before_action :set_react_component_props, only: [:new, :create]
def new
end
def create
confirmation_tex... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/braintree_controller.rb | app/controllers/braintree_controller.rb | # frozen_string_literal: true
# Braintree controller contains any stateless backend API calls we need to make for the frontend when tokenizing
# with Braintree. No other Braintree specific logic should ever live here, but instead can be found in the Charging
# module and in the BraintreeChargeProcessor implementation.... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/signup_controller.rb | app/controllers/signup_controller.rb | # frozen_string_literal: true
class SignupController < Devise::RegistrationsController
include OauthApplicationConfig, ValidateRecaptcha, InertiaRendering
before_action :verify_captcha_and_handle_existing_users, only: :create
before_action :set_noindex_header, only: :new, if: -> { params[:next]&.start_with?("/o... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/purchases_controller.rb | app/controllers/purchases_controller.rb | # frozen_string_literal: true
class PurchasesController < ApplicationController
include CurrencyHelper, PreorderHelper, RecommendationType, ValidateRecaptcha, ProcessRefund
include Order::ResponseHelpers
SEARCH_RESULTS_PER_PAGE = 100
PARAM_TO_ATTRIBUTE_MAPPINGS = {
friend: :friend_actions,
plugins: :p... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/affiliate_redirect_controller.rb | app/controllers/affiliate_redirect_controller.rb | # frozen_string_literal: true
class AffiliateRedirectController < ApplicationController
include AffiliateCookie
def set_cookie_and_redirect
affiliate = Affiliate.find_by_external_id_numeric(params[:affiliate_id].to_i)
if affiliate.nil?
Rails.logger.info("No affiliate found for id #{params[:affiliate... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/reviews_controller.rb | app/controllers/reviews_controller.rb | # frozen_string_literal: true
class ReviewsController < ApplicationController
layout "inertia"
before_action :authenticate_user!
after_action :verify_authorized
def index
authorize ProductReview
presenter = ReviewsPresenter.new(current_seller)
render inertia: "Reviews/Index", props: presenter.re... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/dashboard_controller.rb | app/controllers/dashboard_controller.rb | # frozen_string_literal: true
class DashboardController < Sellers::BaseController
include ActionView::Helpers::NumberHelper, CurrencyHelper
skip_before_action :check_suspended
before_action :check_payment_details, only: :index
layout "inertia", only: :index
def index
authorize :dashboard
if curren... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/product_review_responses_controller.rb | app/controllers/product_review_responses_controller.rb | # frozen_string_literal: true
class ProductReviewResponsesController < ApplicationController
before_action :authenticate_user!
before_action :set_purchase
before_action :set_product_review!
before_action :set_or_build_review_response
after_action :verify_authorized
def update
authorize @review_respon... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/consumption_analytics_controller.rb | app/controllers/consumption_analytics_controller.rb | # frozen_string_literal: true
class ConsumptionAnalyticsController < ApplicationController
include CreateConsumptionEvent
skip_before_action :check_suspended
def create
render json: { success: create_consumption_event!(params) }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/library_controller.rb | app/controllers/library_controller.rb | # frozen_string_literal: true
class LibraryController < Sellers::BaseController
layout "inertia"
skip_before_action :check_suspended
before_action :check_user_confirmed, only: [:index]
before_action :set_purchase, only: [:archive, :unarchive, :delete]
RESEND_CONFIRMATION_EMAIL_TIME_LIMIT = 24.hours
priv... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/discover_controller.rb | app/controllers/discover_controller.rb | # frozen_string_literal: true
class DiscoverController < ApplicationController
RECOMMENDED_PRODUCTS_COUNT = 8
INITIAL_PRODUCTS_COUNT = 36
include ActionView::Helpers::NumberHelper, RecommendationType, CreateDiscoverSearch,
DiscoverCuratedProducts, SearchProducts, AffiliateCookie
before_action :set_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/customers_controller.rb | app/controllers/customers_controller.rb | # frozen_string_literal: true
class CustomersController < Sellers::BaseController
include CurrencyHelper
before_action :authorize
before_action :set_on_page_type
CUSTOMERS_PER_PAGE = 20
layout "inertia", only: [:index]
def index
product = Link.fetch(params[:link_id]) if params[:link_id].present?
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/followers_controller.rb | app/controllers/followers_controller.rb | # frozen_string_literal: true
class FollowersController < ApplicationController
layout "inertia"
include CustomDomainConfig
PUBLIC_ACTIONS = %i[new create from_embed_form confirm cancel].freeze
before_action :authenticate_user!, except: PUBLIC_ACTIONS
after_action :verify_authorized, except: PUBLIC_ACTIONS
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/affiliates_controller.rb | app/controllers/affiliates_controller.rb | # frozen_string_literal: true
class AffiliatesController < Sellers::BaseController
include Pagy::Backend
PUBLIC_ACTIONS = %i[subscribe_posts unsubscribe_posts].freeze
skip_before_action :authenticate_user!, only: PUBLIC_ACTIONS
after_action :verify_authorized, except: PUBLIC_ACTIONS
before_action :set_dire... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/checkout_controller.rb | app/controllers/checkout_controller.rb | # frozen_string_literal: true
class CheckoutController < ApplicationController
before_action :process_cart_id_param, only: %i[index]
def index
@hide_layouts = true
@on_checkout_page = true
@checkout_presenter = CheckoutPresenter.new(logged_in_user:, ip: request.remote_ip)
end
private
def proc... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/embedded_javascripts_controller.rb | app/controllers/embedded_javascripts_controller.rb | # frozen_string_literal: true
class EmbeddedJavascriptsController < ApplicationController
skip_before_action :verify_authenticity_token, only: %i[overlay embed]
def overlay
@script_path = Shakapacker.manifest.lookup!("overlay.js")
@global_stylesheet_path = Shakapacker.manifest.lookup!("design.css")
@s... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/stripe_account_sessions_controller.rb | app/controllers/stripe_account_sessions_controller.rb | # frozen_string_literal: true
class StripeAccountSessionsController < Sellers::BaseController
before_action :authorize
def create
connected_account_id = current_seller.stripe_account&.charge_processor_merchant_id
if connected_account_id.blank?
return render json: { success: false, error_message: "Us... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/users_controller.rb | app/controllers/users_controller.rb | # frozen_string_literal: true
class UsersController < ApplicationController
include ProductsHelper, SearchProducts, CustomDomainConfig, SocialShareUrlHelper, ActionView::Helpers::SanitizeHelper,
AffiliateCookie
before_action :authenticate_user!, except: %i[show coffee subscribe subscribe_preview email_u... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/events_controller.rb | app/controllers/events_controller.rb | # frozen_string_literal: true
class EventsController < ApplicationController
def create
create_user_event(params[:event_name])
render json: {
success: true
}
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/recommended_products_controller.rb | app/controllers/recommended_products_controller.rb | # frozen_string_literal: true
class RecommendedProductsController < ApplicationController
def index
product_infos = fetch_recommended_product_infos
results = product_infos.map do |product_info|
ProductPresenter.card_for_web(
product: product_info.product,
request:,
recommended_b... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/profile_sections_controller.rb | app/controllers/profile_sections_controller.rb | # frozen_string_literal: true
class ProfileSectionsController < ApplicationController
before_action :authorize
def create
attributes = permitted_params
if attributes[:text].present? && attributes[:type] == "SellerProfileRichTextSection"
processed_content = process_text(attributes[:text][:content])
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/connections_controller.rb | app/controllers/connections_controller.rb | # frozen_string_literal: true
class ConnectionsController < Sellers::BaseController
before_action :authorize
def unlink_twitter
User::SocialTwitter::TWITTER_PROPERTIES.each do |property|
current_seller.send("#{property}=", nil)
end
current_seller.save!
render json: { success: true }
rescu... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/orders_controller.rb | app/controllers/orders_controller.rb | # frozen_string_literal: true
class OrdersController < ApplicationController
include ValidateRecaptcha, Events, Order::ResponseHelpers
before_action :validate_order_request, only: :create
before_action :fetch_affiliates, only: :create
def create
order_params = permitted_order_params.merge!(
{
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/oauth_completions_controller.rb | app/controllers/oauth_completions_controller.rb | # frozen_string_literal: true
class OauthCompletionsController < ApplicationController
before_action :authenticate_user!
def stripe
stripe_connect_data = session[:stripe_connect_data] || {}
auth_uid = stripe_connect_data["auth_uid"]
referer = stripe_connect_data["referer"]
signing_in = stripe_conn... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/url_redirects_controller.rb | app/controllers/url_redirects_controller.rb | # frozen_string_literal: true
class UrlRedirectsController < ApplicationController
include SignedUrlHelper
include ProductsHelper
before_action :fetch_url_redirect, except: %i[
show stream download_subtitle_file read download_archive latest_media_locations download_product_files
audio_durations
]
be... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/comments_controller.rb | app/controllers/comments_controller.rb | # frozen_string_literal: true
class CommentsController < ApplicationController
before_action :set_post, only: %i[index create update destroy]
before_action :set_comment, only: %i[update destroy]
before_action :set_purchase, only: %i[index create update destroy]
before_action :build_post_comment, only: %i[creat... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/commissions_controller.rb | app/controllers/commissions_controller.rb | # frozen_string_literal: true
class CommissionsController < ApplicationController
def update
commission = Commission.find_by_external_id!(params[:id])
authorize commission
file_signed_ids = permitted_params[:file_signed_ids]
commission.files.each do |file|
file.purge unless file_signed_ids.de... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/robots_controller.rb | app/controllers/robots_controller.rb | # frozen_string_literal: true
class RobotsController < ApplicationController
def index
robots_service = RobotsService.new
@sitemap_configs = robots_service.sitemap_configs
@user_agent_rules = robots_service.user_agent_rules
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/s3_utility_controller.rb | app/controllers/s3_utility_controller.rb | # frozen_string_literal: true
class S3UtilityController < Sellers::BaseController
include CdnUrlHelper
before_action :authorize
def generate_multipart_signature
# Prevent attackers from using newlines to split the request body and bypass the seller check
params["to_sign"].split(/[\n\r\s]/).grep(/\A\//)... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/logins_controller.rb | app/controllers/logins_controller.rb | # frozen_string_literal: true
class LoginsController < Devise::SessionsController
include OauthApplicationConfig, ValidateRecaptcha, InertiaRendering
skip_before_action :check_suspended, only: %i[create destroy]
before_action :block_json_request, only: :new
after_action :clear_dashboard_preference, only: :des... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/collaborators_controller.rb | app/controllers/collaborators_controller.rb | # frozen_string_literal: true
class CollaboratorsController < Sellers::BaseController
layout "inertia", only: [:index]
def index
authorize Collaborator
@title = "Collaborators"
render inertia: "Collaborators/Index"
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/tax_center_controller.rb | app/controllers/tax_center_controller.rb | # frozen_string_literal: true
class TaxCenterController < Sellers::BaseController
layout "inertia", only: [:index]
before_action :ensure_tax_center_enabled
def index
authorize :balance
@title = "Payouts"
year = params[:year]&.to_i || Time.current.year - 1
tax_center_presenter = TaxCenterPresen... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/healthcheck_controller.rb | app/controllers/healthcheck_controller.rb | # frozen_string_literal: true
class HealthcheckController < ApplicationController
def index
render plain: "healthcheck"
end
def sidekiq
enqueued_jobs_above_limit = SIDEKIQ_QUEUE_LIMITS.any? do |queue, limit|
Sidekiq::Queue.new(queue).size > limit
end
enqueued_jobs_above_limit ||= Sidekiq:... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/shipments_controller.rb | app/controllers/shipments_controller.rb | # frozen_string_literal: true
class ShipmentsController < ApplicationController
before_action :authenticate_user!, only: [:mark_as_shipped]
before_action :set_purchase, only: [:mark_as_shipped]
after_action :verify_authorized, only: [:mark_as_shipped]
EASYPOST_ERROR_FIELD_MAPPING = {
"street1" => "street"... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/public_controller.rb | app/controllers/public_controller.rb | # frozen_string_literal: true
class PublicController < ApplicationController
include ActionView::Helpers::NumberHelper
before_action { opt_out_of_header(:csp) } # for the use of external JS on public pages
before_action :hide_layouts, only: [:thank_you]
before_action :set_on_public_page
layout "inertia", ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/calls_controller.rb | app/controllers/calls_controller.rb | # frozen_string_literal: true
class CallsController < ApplicationController
before_action :authenticate_user!
def update
@call = Call.find_by_external_id!(params[:id])
authorize @call
@call.update!(params.permit(policy(@call).permitted_attributes))
head :no_content
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/dropbox_files_controller.rb | app/controllers/dropbox_files_controller.rb | # frozen_string_literal: true
class DropboxFilesController < Sellers::BaseController
before_action :authorize
def create
dropbox_file = DropboxFile.create_with_file_info(permitted_params)
dropbox_file.user = current_seller
if permitted_params[:link_id]
fetch_product_and_enforce_ownership
d... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/imported_customers_controller.rb | app/controllers/imported_customers_controller.rb | # frozen_string_literal: true
class ImportedCustomersController < ApplicationController
PUBLIC_ACTIONS = %i[unsubscribe].freeze
before_action :authenticate_user!, except: PUBLIC_ACTIONS
after_action :verify_authorized, except: PUBLIC_ACTIONS
def destroy
imported_customer = current_seller.imported_customer... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/analytics_controller.rb | app/controllers/analytics_controller.rb | # frozen_string_literal: true
class AnalyticsController < Sellers::BaseController
before_action :set_time_range, only: %i[data_by_date data_by_state data_by_referral]
after_action :set_dashboard_preference_to_sales, only: :index
before_action :check_payment_details, only: :index
layout "inertia", only: [:ind... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/third_party_analytics_controller.rb | app/controllers/third_party_analytics_controller.rb | # frozen_string_literal: true
class ThirdPartyAnalyticsController < ApplicationController
before_action { opt_out_of_header(:csp) } # Turn off CSP for this controller
before_action :fetch_product
OVERRIDE_WINDOW_ACTIONS_CODE = "<script type=\"text/javascript\">
try { window.alert = function() {}; } catch(error)... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/balance_controller.rb | app/controllers/balance_controller.rb | # frozen_string_literal: true
class BalanceController < Sellers::BaseController
layout "inertia", only: [:index]
def index
authorize :balance
@title = "Payouts"
payouts_presenter = PayoutsPresenter.new(seller: current_seller, params:)
render inertia: "Payouts/Index",
props: {
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/customer_surcharge_controller.rb | app/controllers/customer_surcharge_controller.rb | # frozen_string_literal: true
class CustomerSurchargeController < ApplicationController
include CurrencyHelper
def calculate_all
products = params.require(:products)
vat_id_valid = false
has_vat_id_input = false
shipping_rate = 0
tax_rate = 0
tax_included_rate = 0
subtotal = 0
prod... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/communities_controller.rb | app/controllers/communities_controller.rb | # frozen_string_literal: true
class CommunitiesController < ApplicationController
before_action :authenticate_user!
after_action :verify_authorized
before_action :set_body_id_as_app
def index
@hide_layouts = true
authorize Community
end
private
def set_title
@title = "Communities"
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/wishlists_controller.rb | app/controllers/wishlists_controller.rb | # frozen_string_literal: true
class WishlistsController < ApplicationController
include CustomDomainConfig, DiscoverCuratedProducts
before_action :authenticate_user!, except: :show
after_action :verify_authorized, except: :show
layout "inertia", only: [:index, :show]
def index
authorize Wishlist
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/confirmations_controller.rb | app/controllers/confirmations_controller.rb | # frozen_string_literal: true
class ConfirmationsController < Devise::ConfirmationsController
def show
@user = User.find_or_initialize_with_error_by(:confirmation_token, params[:confirmation_token])
if @user.errors.present?
flash[:alert] = "You have already been confirmed."
return redirect_to ro... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/audience_controller.rb | app/controllers/audience_controller.rb | # frozen_string_literal: true
class AudienceController < Sellers::BaseController
before_action :set_time_range, only: :index
after_action :set_dashboard_preference_to_audience, only: :index
before_action :check_payment_details, only: :index
layout "inertia", only: :index
def index
authorize :audience
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/application_controller.rb | app/controllers/application_controller.rb | # frozen_string_literal: true
class ApplicationController < ActionController::Base
protect_from_forgery
include LoggedInUser
include PunditAuthorization
include AffiliateQueryParams
include Events
include LogrageHelper
include DashboardPreference
include CustomDomainRouteBuilder
include CsrfTokenInj... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/offer_codes_controller.rb | app/controllers/offer_codes_controller.rb | # frozen_string_literal: true
class OfferCodesController < ApplicationController
def compute_discount
response = OfferCodeDiscountComputingService.new(params[:code], params[:products]).process
response = if response[:error_code].present?
error_message = case response.fetch(:error_code)
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/workflows_controller.rb | app/controllers/workflows_controller.rb | # frozen_string_literal: true
class WorkflowsController < Sellers::BaseController
before_action :set_workflow, only: %i[edit update destroy]
before_action :authorize_workflow, only: %i[edit update destroy]
before_action :fetch_product_and_enforce_ownership, only: %i[create update], if: :product_or_variant_workfl... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/acme_challenges_controller.rb | app/controllers/acme_challenges_controller.rb | # frozen_string_literal: true
class AcmeChallengesController < ApplicationController
MAX_TOKEN_LENGTH = 64
VALID_TOKEN_PATTERN = /\A[A-Za-z0-9_-]+\z/
def show
token = params[:token]
Rails.logger.info "[ACME Challenge] Verification request received for token: #{mask_token(token)}, host: #{request.host}"
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/foreign_webhooks_controller.rb | app/controllers/foreign_webhooks_controller.rb | # frozen_string_literal: true
class ForeignWebhooksController < ApplicationController
skip_before_action :verify_authenticity_token
before_action :validate_sns_webhook, only: [:mediaconvert]
before_action only: [:stripe] do
endpoint_secret = GlobalConfig.dig(:stripe, :endpoint_secret)
validate_stripe_we... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/events.rb | app/controllers/concerns/events.rb | # frozen_string_literal: true
module Events
def create_user_event(name, seller_id: nil, on_custom_domain: false)
return if name.nil?
create_event(
event_name: name,
on_custom_domain:,
user_id: logged_in_user&.id
)
end
def create_post_event(installment)
@product = installment.t... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/current_api_user.rb | app/controllers/concerns/current_api_user.rb | # frozen_string_literal: true
# Equivalent of current_user for API
#
module CurrentApiUser
extend ActiveSupport::Concern
included do
helper_method :current_api_user
end
def current_api_user
return unless defined?(doorkeeper_token) && doorkeeper_token.present?
@_current_api_user ||= User.find(doo... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/fetch_product_by_unique_permalink.rb | app/controllers/concerns/fetch_product_by_unique_permalink.rb | # frozen_string_literal: true
module FetchProductByUniquePermalink
# Fetches a product by unique permalink (only!) identified via `id` or `link_id` params.
# Requires the product's owner or an admin user to be logged in.
#
# This method shouldn't be used to fetch a product by custom_permalink because they are ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/impersonate.rb | app/controllers/concerns/impersonate.rb | # frozen_string_literal: true
# Handles impersonation for both web and mobile API
module Impersonate
extend ActiveSupport::Concern
include CurrentApiUser
include LoggedInUser
included do
helper_method :impersonating_user, :impersonated_user, :impersonating?
end
def impersonate_user(user)
reset_im... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/create_consumption_event.rb | app/controllers/concerns/create_consumption_event.rb | # frozen_string_literal: true
module CreateConsumptionEvent
private
def create_consumption_event!(params)
return false if params[:url_redirect_id].blank? || ConsumptionEvent::EVENT_TYPES.exclude?(params[:event_type])
url_redirect_id = ObfuscateIds.decrypt(params[:url_redirect_id])
product_file... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.