source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/asset_previews_controller.rb | Ruby | mit | 8,966 | main | 1,605 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/support_controller.rb | Ruby | mit | 8,966 | main | 4,280 | # 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: "... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/analytics_controller.rb | Ruby | mit | 8,966 | main | 2,510 | # frozen_string_literal: true
class AnalyticsController < Sellers::BaseController
MAX_BY_STATE_DATE_RANGE_DAYS = 365
before_action :set_time_range, only: %i[data_by_date data_by_state data_by_referral]
before_action :clamp_date_range_for_by_state, only: :data_by_state
after_action :set_dashboard_preference_t... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/instant_payouts_controller.rb | Ruby | mit | 8,966 | main | 422 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/robots_controller.rb | Ruby | mit | 8,966 | main | 249 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/affiliates_controller.rb | Ruby | mit | 8,966 | main | 9,382 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/oauth_completions_controller.rb | Ruby | mit | 8,966 | main | 2,451 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/customer_surcharge_controller.rb | Ruby | mit | 8,966 | main | 3,118 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/careers_controller.rb | Ruby | mit | 8,966 | main | 857 | # frozen_string_literal: true
class CareersController < ApplicationController
layout "home"
before_action { e404 if Feature.inactive?(:career_pages) }
before_action :set_body_class
before_action :set_meta_data
def index
@jobs = JOBS
end
def show
@job = JOBS.find { |j| j[:slug] == params[:slug]... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/commissions_controller.rb | Ruby | mit | 8,966 | main | 947 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/acme_challenges_controller.rb | Ruby | mit | 8,966 | main | 849 | # 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}"
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/orders_controller.rb | Ruby | mit | 8,966 | main | 7,063 | # frozen_string_literal: true
class OrdersController < ApplicationController
include ValidateRecaptcha, Events, Order::ResponseHelpers
before_action :normalize_line_items, only: :create
before_action :validate_order_request, only: :create
before_action :fetch_affiliates, only: :create
def create
order_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/thumbnails_controller.rb | Ruby | mit | 8,966 | main | 1,808 | # frozen_string_literal: true
class ThumbnailsController < Sellers::BaseController
before_action :find_product
def create
authorize Thumbnail
if !params[:thumbnail].respond_to?(:permit)
return render(json: { success: false, error: "Invalid thumbnail parameter. Expected signed_blob_id." }, status: :... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/home_controller.rb | Ruby | mit | 8,966 | main | 5,846 | # frozen_string_literal: true
class HomeController < ApplicationController
layout "home"
before_action :hide_layouts
def about
set_meta_tag(title: "Earn your first dollar online with Gumroad")
set_meta_tag(name: "description", content: "Start selling what you know, see what sticks, and get paid. Simple... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/purchase_custom_fields_controller.rb | Ruby | mit | 8,966 | main | 1,101 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/tax_center_controller.rb | Ruby | mit | 8,966 | main | 1,951 | # frozen_string_literal: true
class TaxCenterController < Sellers::BaseController
layout "inertia", only: [:index]
before_action :ensure_tax_center_enabled
def index
authorize :balance
set_meta_tag(title: "Payouts")
year = params[:year]&.to_i || Time.current.year - 1
tax_center_presenter = Ta... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/wishlists_controller.rb | Ruby | mit | 8,966 | main | 3,134 | # frozen_string_literal: true
class WishlistsController < ApplicationController
include CustomDomainConfig, DiscoverCuratedProducts
include PageMeta::Favicon
before_action :authenticate_user!, except: :show
after_action :verify_authorized, except: :show
layout "inertia", only: [:index, :show]
def index
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/comments_controller.rb | Ruby | mit | 8,966 | main | 3,963 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/affiliate_redirect_controller.rb | Ruby | mit | 8,966 | main | 1,102 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/foreign_webhooks_controller.rb | Ruby | mit | 8,966 | main | 5,439 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/recommended_products_controller.rb | Ruby | mit | 8,966 | main | 1,087 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/s3_utility_controller.rb | Ruby | mit | 8,966 | main | 1,010 | # 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\//)... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/checkout_controller.rb | Ruby | mit | 8,966 | main | 6,808 | # frozen_string_literal: true
class CheckoutController < ApplicationController
layout "inertia"
before_action :process_cart_id_param, only: [:show]
def show
render inertia: "Checkout/Show", props: {
cart: -> { CartPresenter.new(logged_in_user:, ip: request.remote_ip, browser_guid: cookies[:_gumroad_g... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/customers_controller.rb | Ruby | mit | 8,966 | main | 9,877 | # frozen_string_literal: true
class CustomersController < Sellers::BaseController
include CurrencyHelper
rescue_from Faraday::TimeoutError, with: :handle_search_timeout
before_action :authorize
before_action :set_on_page_type
CUSTOMERS_PER_PAGE = 20
layout "inertia", only: [:index, :show]
def index... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/github_stars_controller.rb | Ruby | mit | 8,966 | main | 840 | # 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,
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/dashboard_controller.rb | Ruby | mit | 8,966 | main | 1,876 | # frozen_string_literal: true
class DashboardController < Sellers::BaseController
include ActionView::Helpers::NumberHelper, CurrencyHelper
before_action :check_payment_details, only: :index
layout "inertia", only: :index
def index
authorize :dashboard
if current_seller.suspended_for_tos_violation?... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/posts_controller.rb | Ruby | mit | 8,966 | main | 3,907 | # frozen_string_literal: true
class PostsController < ApplicationController
include CustomDomainConfig
include PageMeta::Favicon
include PageMeta::Post
layout "inertia", only: [:show]
before_action :authenticate_user!, only: %i[send_for_purchase]
after_action :verify_authorized, only: %i[send_for_purcha... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/paypal_controller.rb | Ruby | mit | 8,966 | main | 3,882 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/balance_controller.rb | Ruby | mit | 8,966 | main | 1,634 | # frozen_string_literal: true
class BalanceController < Sellers::BaseController
layout "inertia", only: [:index]
def index
authorize :balance
set_meta_tag(title: "Payouts")
payouts_presenter = PayoutsPresenter.new(seller: current_seller, params:)
render inertia: "Payouts/Index",
pro... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/product_reviews_controller.rb | Ruby | mit | 8,966 | main | 2,893 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/public_controller.rb | Ruby | mit | 8,966 | main | 2,118 | # 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 :set_on_public_page
layout "inertia", only: [:widgets, :ping, :api, :charge, :license_ke... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/communities_controller.rb | Ruby | mit | 8,966 | main | 2,866 | # frozen_string_literal: true
class CommunitiesController < ApplicationController
before_action :authenticate_user!
before_action :set_default_page_title
before_action :set_community, only: [:show]
after_action :verify_authorized
layout "inertia"
def index
authorize Community
first_community = c... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/secure_redirect_controller.rb | Ruby | mit | 8,966 | main | 2,967 | # frozen_string_literal: true
class SecureRedirectController < ApplicationController
layout "inertia"
before_action :validate_params, only: [:new, :create]
before_action :set_encrypted_params, only: [:new, :create]
def new
render inertia: "SecureRedirect/New", props: {
message: @message,
fiel... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/shipments_controller.rb | Ruby | mit | 8,966 | main | 4,671 | # 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"... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/test_controller.rb | Ruby | mit | 8,966 | main | 585 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/confirmations_controller.rb | Ruby | mit | 8,966 | main | 927 | # frozen_string_literal: true
class ConfirmationsController < Devise::ConfirmationsController
include PageMeta::Base
before_action :set_default_page_title
before_action :set_csrf_meta_tags
before_action :set_default_meta_tags
helper_method :erb_meta_tags
def show
@user = User.find_or_initialize_with_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/profile_sections_controller.rb | Ruby | mit | 8,966 | main | 2,456 | # 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])
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/imported_customers_controller.rb | Ruby | mit | 8,966 | main | 1,543 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/audience_controller.rb | Ruby | mit | 8,966 | main | 1,609 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/licenses_controller.rb | Ruby | mit | 8,966 | main | 369 | # 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.... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/consumption_analytics_controller.rb | Ruby | mit | 8,966 | main | 251 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/utm_links_controller.rb | Ruby | mit | 8,966 | main | 4,211 | # frozen_string_literal: true
class UtmLinksController < Sellers::BaseController
include Pagy::Backend
before_action :set_utm_link, only: [:edit, :update, :destroy]
layout "inertia"
def index
authorize UtmLink
render inertia: "UtmLinks/Index", props: {
utm_links: -> { paginated_utm_links_pres... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/links_controller.rb | Ruby | mit | 8,966 | main | 35,301 | # frozen_string_literal: true
class LinksController < ApplicationController
include ProductsHelper, SearchProducts, PreorderHelper, ActionView::Helpers::TextHelper,
ActionView::Helpers::AssetUrlHelper, CustomDomainConfig, AffiliateCookie,
CreateDiscoverSearch, DiscoverCuratedProducts, FetchProduc... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/discover_controller.rb | Ruby | mit | 8,966 | main | 8,026 | # frozen_string_literal: true
class DiscoverController < ApplicationController
RECOMMENDED_PRODUCTS_COUNT = 8
INITIAL_PRODUCTS_COUNT = 36
include ActionView::Helpers::NumberHelper, RecommendationType, CreateDiscoverSearch,
DiscoverCuratedProducts, SearchProducts, AffiliateCookie
layout "inertia", o... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/two_factor_authentication_controller.rb | Ruby | mit | 8,966 | main | 3,739 | # frozen_string_literal: true
class TwoFactorAuthenticationController < ApplicationController
skip_before_action :check_suspended
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_u... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/offer_codes_controller.rb | Ruby | mit | 8,966 | main | 1,219 | # 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)
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/affiliate_requests_controller.rb | Ruby | mit | 8,966 | main | 5,635 | # frozen_string_literal: true
class AffiliateRequestsController < ApplicationController
include CustomDomainConfig
layout "inertia", only: [:new]
PUBLIC_ACTIONS = %i[new create]
before_action :authenticate_user!, except: PUBLIC_ACTIONS
before_action :set_user_and_custom_domain_config, only: %i[new create]
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/braintree_controller.rb | Ruby | mit | 8,966 | main | 1,974 | # 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.... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/test_pings_controller.rb | Ruby | mit | 8,966 | main | 873 | # 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."... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/reviews_controller.rb | Ruby | mit | 8,966 | main | 441 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/users_controller.rb | Ruby | mit | 8,966 | main | 6,986 | # frozen_string_literal: true
class UsersController < ApplicationController
include ProductsHelper, SearchProducts, CustomDomainConfig, SocialShareUrlHelper, ActionView::Helpers::SanitizeHelper,
AffiliateCookie
include PageMeta::Favicon, PageMeta::User
before_action :authenticate_user!, except: %i[sh... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/followers_controller.rb | Ruby | mit | 8,966 | main | 4,768 | # frozen_string_literal: true
class FollowersController < ApplicationController
layout "inertia"
include CustomDomainConfig
include Pagy::Backend
include PageMeta::Post
PUBLIC_ACTIONS = %i[new create from_embed_form confirm cancel].freeze
before_action :authenticate_user!, except: PUBLIC_ACTIONS
after_a... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/logins_controller.rb | Ruby | mit | 8,966 | main | 2,812 | # frozen_string_literal: true
class LoginsController < Devise::SessionsController
include OauthApplicationConfig, ValidateRecaptcha, InertiaRendering
include PageMeta::Base
skip_before_action :check_suspended
before_action :block_json_request, only: :new
after_action :clear_dashboard_preference, only: :des... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/utm_link_tracking_controller.rb | Ruby | mit | 8,966 | main | 298 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/third_party_analytics_controller.rb | Ruby | mit | 8,966 | main | 2,204 | # 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)... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/product_review_responses_controller.rb | Ruby | mit | 8,966 | main | 1,159 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/media_locations_controller.rb | Ruby | mit | 8,966 | main | 238 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/dropbox_files_controller.rb | Ruby | mit | 8,966 | main | 1,226 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/healthcheck_controller.rb | Ruby | mit | 8,966 | main | 946 | # 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:... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/calls_controller.rb | Ruby | mit | 8,966 | main | 300 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/workflows_controller.rb | Ruby | mit | 8,966 | main | 3,975 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/url_redirects_controller.rb | Ruby | mit | 8,966 | main | 21,866 | # frozen_string_literal: true
class UrlRedirectsController < ApplicationController
include SignedUrlHelper
include ProductsHelper
include PageMeta::Favicon
layout "inertia", only: [:expired, :rental_expired_page, :membership_inactive_page, :confirm_page, :read, :stream, :download_page]
before_action :fetch... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/product_duplicates_controller.rb | Ruby | mit | 8,966 | main | 1,695 | # 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..." }) ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/signup_controller.rb | Ruby | mit | 8,966 | main | 6,595 | # frozen_string_literal: true
class SignupController < Devise::RegistrationsController
include OauthApplicationConfig, ValidateRecaptcha, InertiaRendering
include PageMeta::Base
before_action :verify_captcha_and_handle_existing_users, only: :create
before_action :set_noindex_header, only: :new, if: -> { para... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/application_controller.rb | Ruby | mit | 8,966 | main | 13,893 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/workflows/emails_controller.rb | Ruby | mit | 8,966 | main | 2,640 | # frozen_string_literal: true
class Workflows::EmailsController < Sellers::BaseController
before_action :set_workflow
before_action :authorize_workflow
layout "inertia"
FLASH_CHANGES_SAVED = "Changes saved!"
FLASH_PREVIEW_EMAIL_SENT = "A preview has been sent to your email."
FLASH_WORKFLOW_PUBLISHED = "W... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/sellers/switch_controller.rb | Ruby | mit | 8,966 | main | 629 | # frozen_string_literal: true
class Sellers::SwitchController < Sellers::BaseController
before_action :skip_authorization
def create
team_membership = find_team_membership!(external_team_membership_id)
switch_seller_account(team_membership)
head :no_content
rescue ActiveRecord::RecordNotFound
h... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/action_call_dashboard_controller.rb | Ruby | mit | 8,966 | main | 505 | # frozen_string_literal: true
class Admin::ActionCallDashboardController < Admin::BaseController
def index
set_meta_tag(title: "Action Call Dashboard")
@admin_action_call_infos = AdminActionCallInfo.order(call_count: :desc, controller_name: :asc, action_name: :asc)
render inertia: "Admin/ActionCallDashb... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/comments_controller.rb | Ruby | mit | 8,966 | main | 501 | # frozen_string_literal: true
class Admin::CommentsController < Admin::BaseController
def create
Comment.create!(comment_params)
render json: { success: true }
end
private
def comment_params
permitted_params = params.require(:comment).permit(:commentable_id, :commentable_type, :author_id,
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/payouts_controller.rb | Ruby | mit | 8,966 | main | 2,854 | # frozen_string_literal: true
class Admin::PayoutsController < Admin::BaseController
before_action :fetch_payment, only: %i[show retry cancel fail sync]
def show
set_meta_tag(title: "Payout")
render inertia: "Admin/Payouts/Show",
props: { payout: Admin::PaymentPresenter.new(payment: @payment).... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/search_controller.rb | Ruby | mit | 8,966 | main | 1,315 | # frozen_string_literal: true
class Admin::SearchController < Admin::BaseController
before_action :clean_search_query
RECORDS_PER_PAGE = 25
private_constant :RECORDS_PER_PAGE
def users
set_meta_tag(title: "User results")
@users = User.where(email: @raw_query).order(created_at: :desc).limit(25) if Em... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/helper_actions_controller.rb | Ruby | mit | 8,966 | main | 762 | # frozen_string_literal: true
module Admin
class HelperActionsController < BaseController
before_action :load_user
def impersonate
redirect_to admin_impersonate_path(user_identifier: @user.external_id)
end
def stripe_dashboard
merchant_account = @user.merchant_accounts.alive.stripe.firs... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/users_controller.rb | Ruby | mit | 8,966 | main | 7,875 | # frozen_string_literal: true
class Admin::UsersController < Admin::BaseController
include Admin::FetchUser
include MassTransferPurchases
before_action :fetch_user, except: %i[block_ip_address]
def show
set_meta_tag(title: "#{@user.display_name} on Gumroad")
respond_to do |format|
format.html ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/block_email_domains_controller.rb | Ruby | mit | 8,966 | main | 584 | # frozen_string_literal: true
class Admin::BlockEmailDomainsController < Admin::BaseController
include MassBlocker
def show
set_meta_tag(title: "Mass-block email domains")
render inertia: "Admin/BlockEmailDomains/Show"
end
def update
schedule_mass_block(identifiers: email_domains_params[:identifi... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/sales_reports_controller.rb | Ruby | mit | 8,966 | main | 1,002 | # frozen_string_literal: true
class Admin::SalesReportsController < Admin::BaseController
def index
set_meta_tag(title: "Sales reports")
render inertia: "Admin/SalesReports/Index", props: {
countries: Compliance::Countries.for_select.map { |alpha2, name| [name, alpha2] },
sales_types: GenerateSa... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/purchases_controller.rb | Ruby | mit | 8,966 | main | 5,605 | # frozen_string_literal: true
class Admin::PurchasesController < Admin::BaseController
before_action :fetch_purchase, only: %i[cancel_subscription refund refund_for_fraud refund_taxes_only resend_receipt
show sync_status_with_charge_processor block_buyer unblock_buyer undele... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/merchant_accounts_controller.rb | Ruby | mit | 8,966 | main | 744 | # frozen_string_literal: true
class Admin::MerchantAccountsController < Admin::BaseController
def show
if !MerchantAccount.external_id?(params[:external_id]) && merchant_account = MerchantAccount.find_by(id: params[:external_id])
return redirect_to admin_merchant_account_path(merchant_account.external_id)
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/scheduled_payouts_controller.rb | Ruby | mit | 8,966 | main | 1,934 | # frozen_string_literal: true
class Admin::ScheduledPayoutsController < Admin::BaseController
include Pagy::Backend
RECORDS_PER_PAGE = 20
private_constant :RECORDS_PER_PAGE
def index
set_meta_tag(title: "Scheduled Payouts")
scope = ScheduledPayout.includes(:user, :created_by).order(id: :desc)
sc... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/guids_controller.rb | Ruby | mit | 8,966 | main | 382 | # frozen_string_literal: true
class Admin::GuidsController < Admin::BaseController
include Admin::ListPaginatedUsers
def show
guid = params[:id]
set_meta_tag(title: guid)
@users = User.where(id: Event.by_browser_guid(guid).distinct.pluck(:user_id))
list_paginated_users users: @users,
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/base_controller.rb | Ruby | mit | 8,966 | main | 2,653 | # frozen_string_literal: true
class Admin::BaseController < ApplicationController
include ActionView::Helpers::DateHelper, ActionView::Helpers::NumberHelper, AdminActionTracker, Impersonate
layout "admin"
inertia_share do
{
card_types: CreditCardUtility.card_types_for_react,
compliance: {
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/paydays_controller.rb | Ruby | mit | 8,966 | main | 1,407 | # frozen_string_literal: true
class Admin::PaydaysController < Admin::BaseController
# Pay the seller for all their balances up to and including `params[:payout_period_end_date]`.
def pay_user
user = User.find_by_external_id!(params[:id])
date = Date.parse(payday_params[:payout_period_end_date])
payou... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/affiliates_controller.rb | Ruby | mit | 8,966 | main | 2,014 | # frozen_string_literal: true
class Admin::AffiliatesController < Admin::BaseController
include Pagy::Backend
include Admin::ListPaginatedUsers
before_action :fetch_affiliate, only: [:show]
before_action :clean_search_query, only: [:index]
before_action :fetch_users_from_query, only: [:index]
helper Pagy... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/links_controller.rb | Ruby | mit | 8,966 | main | 6,672 | # frozen_string_literal: true
class Admin::LinksController < Admin::BaseController
before_action :fetch_product!, except: :show
def show
if !Link.external_id?(params[:external_id]) && product = Link.find_by(id: params[:external_id])
return redirect_to admin_product_path(product.external_id)
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/suspend_users_controller.rb | Ruby | mit | 8,966 | main | 1,447 | # frozen_string_literal: true
class Admin::SuspendUsersController < Admin::BaseController
# IDs can be separated by whitespaces or commas
ID_DELIMITER_REGEX = /\s|,/
SUSPEND_REASONS = [
"Violating our terms of service",
"Creating products that violate our ToS",
"Using Gumroad to commit fraud",
"U... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/unblock_email_domains_controller.rb | Ruby | mit | 8,966 | main | 569 | # frozen_string_literal: true
class Admin::UnblockEmailDomainsController < Admin::BaseController
include MassUnblocker
def show
set_meta_tag(title: "Mass-unblock email domains")
render inertia: "Admin/UnblockEmailDomains/Show"
end
def update
schedule_mass_unblock(identifiers: email_domains_params... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/unreviewed_users_controller.rb | Ruby | mit | 8,966 | main | 1,054 | # frozen_string_literal: true
class Admin::UnreviewedUsersController < Admin::BaseController
def index
set_meta_tag(title: "Unreviewed users")
cached_data = Admin::UnreviewedUsersService.cached_users_data
if cached_data.blank?
render inertia: "Admin/UnreviewedUsers/Index",
props: {
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/search/users_controller.rb | Ruby | mit | 8,966 | main | 477 | # frozen_string_literal: true
class Admin::Search::UsersController < Admin::BaseController
include Admin::ListPaginatedUsers
def index
set_meta_tag(title: "Search for #{params[:query].present? ? params[:query].strip : "users"}")
@users = User.admin_search(params[:query]).order(created_at: :desc)
list... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/search/purchases_controller.rb | Ruby | mit | 8,966 | main | 1,564 | # frozen_string_literal: true
class Admin::Search::PurchasesController < Admin::BaseController
include Pagy::Backend
RECORDS_PER_PAGE = 25
def index
set_meta_tag(title: "Purchase results")
search_params = params.permit(:transaction_date, :last_4, :card_type, :price, :expiry_date, :purchase_status).to_h... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/purchases/comments_controller.rb | Ruby | mit | 8,966 | main | 237 | # frozen_string_literal: true
class Admin::Purchases::CommentsController < Admin::BaseController
include Admin::Commentable
private
def commentable
Purchase.find_by_external_id!(params[:purchase_external_id])
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/users/guids_controller.rb | Ruby | mit | 8,966 | main | 651 | # frozen_string_literal: true
class Admin::Users::GuidsController < Admin::Users::BaseController
def index
user = User.find_by_external_id(user_param) || e404
guids = Event.where(user_id: user.id).distinct.pluck(:browser_guid)
guids_to_users = Event.select(:user_id, :browser_guid).by_browser_guid(guids)... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/users/products_controller.rb | Ruby | mit | 8,966 | main | 439 | # frozen_string_literal: true
class Admin::Users::ProductsController < Admin::Users::BaseController
include Admin::Users::ListPaginatedProducts
before_action :fetch_user
def index
set_meta_tag(title: "#{@user.display_name} products on Gumroad")
list_paginated_products user: @user,
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/users/comments_controller.rb | Ruby | mit | 8,966 | main | 213 | # frozen_string_literal: true
class Admin::Users::CommentsController < Admin::Users::BaseController
include Admin::Commentable
before_action :fetch_user
private
def commentable
@user
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/users/stats_controller.rb | Ruby | mit | 8,966 | main | 416 | # frozen_string_literal: true
class Admin::Users::StatsController < Admin::Users::BaseController
include CurrencyHelper
before_action :fetch_user
def index
render json: {
total: formatted_dollar_amount(@user.sales_cents_total),
balance: @user.balance_formatted,
chargeback_volume: @user.lo... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/users/payouts_controller.rb | Ruby | mit | 8,966 | main | 1,671 | # frozen_string_literal: true
class Admin::Users::PayoutsController < Admin::BaseController
include Pagy::Backend
before_action :fetch_user, only: [:index, :pause, :resume]
RECORDS_PER_PAGE = 20
private_constant :RECORDS_PER_PAGE
def index
set_meta_tag(title: "Payouts")
pagination, @payouts = pag... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/users/merchant_accounts_controller.rb | Ruby | mit | 8,966 | main | 420 | # frozen_string_literal: true
class Admin::Users::MerchantAccountsController < Admin::Users::BaseController
before_action :fetch_user
def index
render json: {
merchant_accounts: @user.merchant_accounts.as_json(only: %i[charge_processor_id], methods: %i[external_id alive charge_processor_alive]),
h... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/users/email_changes_controller.rb | Ruby | mit | 8,966 | main | 288 | # frozen_string_literal: true
class Admin::Users::EmailChangesController < Admin::Users::BaseController
before_action :fetch_user
def index
render json: {
email_changes: @user.versions_for(:email, :payment_address),
fields: %w(email payment_address)
}
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/users/products/tos_violation_flags_controller.rb | Ruby | mit | 8,966 | main | 1,412 | # frozen_string_literal: true
class Admin::Users::Products::TosViolationFlagsController < Admin::Users::Products::BaseController
def index
if @user.flagged_for_tos_violation?
render json: {
tos_violation_flags: @product.comments.with_type_flagged.as_json(
only: %i[id content]
)
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/users/products/base_controller.rb | Ruby | mit | 8,966 | main | 279 | # frozen_string_literal: true
class Admin::Users::Products::BaseController < Admin::Users::BaseController
before_action :fetch_user
before_action :set_product
private
def set_product
@product = Link.find_by_external_id(params[:product_external_id])
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/compliance/cards_controller.rb | Ruby | mit | 8,966 | main | 674 | # frozen_string_literal: true
class Admin::Compliance::CardsController < Admin::BaseController
FRAUD_REFUND_LOOKBACK_PERIOD = 6.months
def refund
if params[:stripe_fingerprint].blank?
render json: { success: false }
else
purchase_ids = Purchase
.not_chargedback_or_chargedback_reversed
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/controllers/admin/affiliates/products_controller.rb | Ruby | mit | 8,966 | main | 572 | # frozen_string_literal: true
class Admin::Affiliates::ProductsController < Admin::Affiliates::BaseController
include Admin::Users::ListPaginatedProducts
def index
set_meta_tag(title: "#{@affiliate_user.display_name} products on Gumroad")
list_paginated_products user: @affiliate_user,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.