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
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/controllers/api/v2/feeds_entries_controller.rb
app/controllers/api/v2/feeds_entries_controller.rb
module Api module V2 class FeedsEntriesController < ApiController respond_to :json before_action :correct_user def index @user = current_user @page_query = Entry.where(feed_id: params[:feed_id]).order(created_at: :desc).page(params[:page]) entries_response "api_v2_feed_e...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/controllers/api/v2/feeds_controller.rb
app/controllers/api/v2/feeds_controller.rb
module Api module V2 class FeedsController < ApiController before_action :correct_user respond_to :json def show @feed = Feed.find(params[:id]) fresh_when(@feed) end private def correct_user unless current_user.can_read_feed?(params[:id]) r...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/controllers/api/v2/icons_controller.rb
app/controllers/api/v2/icons_controller.rb
module Api module V2 class IconsController < ApiController respond_to :json def index @user = current_user feed_ids = @user.subscriptions.pluck(:feed_id) hosts = Feed.where(id: feed_ids).pluck(:host) @favicons = Favicon.where(host: hosts) end end end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/controllers/api/v2/entries_controller.rb
app/controllers/api/v2/entries_controller.rb
module Api module V2 class EntriesController < ApiController respond_to :json before_action :correct_user, only: [:show] before_action :limit_ids, only: [:index] skip_before_action :authorize, only: [:text] def index @user = current_user if params.key?(:ids) ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/controllers/api/v2/pages_controller.rb
app/controllers/api/v2/pages_controller.rb
module Api module V2 class PagesController < ApiController respond_to :json def create status_too_many_requests and return if rate_limited?(100, 1.day) if params[:url] @entry = SavePage.new.perform(current_user.id, params[:url], params[:title]) render status: :crea...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/controllers/api/v2/authentication_controller.rb
app/controllers/api/v2/authentication_controller.rb
module Api module V2 class AuthenticationController < ApiController respond_to :json def index expires_now head :ok end def valid_user if current_user.plan.restricted? status_forbidden end end end end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/controllers/api/v2/in_app_purchases_controller.rb
app/controllers/api/v2/in_app_purchases_controller.rb
module Api module V2 class InAppPurchasesController < ApiController respond_to :json before_action :validate_content_type, only: [:create] skip_before_action :valid_user def create @user = current_user receipt_data = params[:in_app_purchase][:receipt_data] respons...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/controllers/api/v2/updated_entries_controller.rb
app/controllers/api/v2/updated_entries_controller.rb
module Api module V2 class UpdatedEntriesController < ApiController respond_to :json def index @user = current_user entries = @user.updated_entries.order(updated_at: :desc) if params[:since] time = Time.iso8601(params[:since]) entries = entries.where("updat...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/controllers/api/v2/unread_entries_controller.rb
app/controllers/api/v2/unread_entries_controller.rb
module Api module V2 class UnreadEntriesController < ApiController respond_to :json before_action :validate_content_type, only: [:create] before_action :validate_create, only: [:create] def index @user = current_user render json: @user.unread_entries.pluck(:entry_id).comp...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/controllers/api/v2/starred_entries_controller.rb
app/controllers/api/v2/starred_entries_controller.rb
module Api module V2 class StarredEntriesController < ApiController respond_to :json before_action :validate_content_type, only: [:create] before_action :validate_create, only: [:create] def index @user = current_user render json: @user.starred_entries.pluck(:entry_id).co...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/feed.rb
app/models/feed.rb
class Feed < ApplicationRecord has_many :subscriptions has_many :podcast_subscriptions has_many :entries has_many :users, through: :subscriptions has_many :unread_entries has_many :starred_entries has_many :feed_stats has_many :discovered_feeds, -> (feed) { where.not(feed_url: feed.feed_url) }, foreign_...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/sourceable.rb
app/models/sourceable.rb
class Sourceable ATTRIBUTES = %i[title type id section jumpable] attr_accessor *ATTRIBUTES def initialize(type:, id:, title:, section: nil, jumpable: false) @title = title @type = type.downcase @id = id @section = section @jumpable = jumpable end def to_h {}.tap do |hash| ATTR...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/favicon.rb
app/models/favicon.rb
class Favicon < ApplicationRecord default_scope { select(*(Favicon.column_names - ["favicon"])) } validates :url, presence: true after_commit :touch_owners def touch_owners TouchFeeds.perform_in(rand(1..10).seconds, host) if saved_change_to_attribute?(:url) end def data self[:data] || {} end ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/tag.rb
app/models/tag.rb
class Tag < ApplicationRecord attr_accessor :count, :user_feeds has_many :taggings has_many :feeds, through: :taggings def self.rename(user, old_tag, new_name) new_name = new_name.strip.delete(",") new_tag = Tag.where(name: new_name).first_or_create user.taggings.where(tag: old_tag).update_all(ta...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/feed_option.rb
app/models/feed_option.rb
class FeedOption attr_reader :source def initialize(base_url, href, title = nil, source = "unspecified") @base_url = base_url @href = href @title = title @source = source end def href @href_result ||= begin result = @href.strip result = result.gsub(/^feed:/, "http:") unle...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/subscription.rb
app/models/subscription.rb
class Subscription < ApplicationRecord attr_accessor :entries_count, :post_volume, :sort_data, :tag_names belongs_to :user belongs_to :feed, counter_cache: true after_commit :mark_as_unread, on: [:create] before_create :expire_stat_cache after_create :add_feed_to_action after_commit :remove_feed_from_...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/entry.rb
app/models/entry.rb
class Entry < ApplicationRecord include Searchable attr_accessor :fully_qualified_url, :read, :starred, :skip_mark_as_unread, :skip_recent_post_check store :settings, accessors: [:archived_images, :media_image, :newsletter, :newsletter_from, :embed_duration, :newsletter_to, :newsletter_token], coder: JSON en...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/search_data.rb
app/models/search_data.rb
class SearchData def initialize(entry) @entry = entry end def to_h {}.tap do |hash| hash[:id] = @entry.id hash[:feed_id] = @entry.feed_id hash[:title] = title hash[:url] = url hash[:author] = @entry.author hash[:content] ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/download.rb
app/models/download.rb
class Download attr_reader :url, :response def initialize(url, directory = nil) @url = url @directory = directory || Dir.tmpdir end def filename @filename ||= key + extension end def path @path ||= "#{key[0..2]}/#{filename}" end def file_path @file_path ||= Pathname.new(File.join...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/action_name.rb
app/models/action_name.rb
class ActionName attr_accessor :label, :value def initialize(attributes) attributes.each do |key, value| instance_variable_set("@#{key}", value) unless value.nil? end end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/source.rb
app/models/source.rb
class Source attr_accessor :response, :feeds def initialize(response) @response = response @feeds = [] end def self.find(*args) source = new(*args) source.find source.feeds end def self.options(*args) source = new(*args) source.options end def document @document ||= b...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/playlist.rb
app/models/playlist.rb
class Playlist < ApplicationRecord include TrackableAttributes track :title, :sort_order belongs_to :user enum :sort_order, {custom: 0, newest_first: 1, oldest_first: 2} has_many :podcast_subscriptions, dependent: :nullify has_many :queued_entries, dependent: :nullify end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/recently_played_entry.rb
app/models/recently_played_entry.rb
class RecentlyPlayedEntry < ApplicationRecord belongs_to :user belongs_to :entry, counter_cache: true end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/tag_editor.rb
app/models/tag_editor.rb
class TagEditor attr_reader :user, :feed, :taggings def initialize(taggings:, user:, feed:) @taggings = taggings[feed&.id] || [] @user = user @feed = feed end def tags @tags ||= user.feed_tags end def checked?(tag) taggings.include? tag.id end def self.taggings(user) user.tag...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/suggested_feed.rb
app/models/suggested_feed.rb
class SuggestedFeed < ApplicationRecord belongs_to :suggested_category belongs_to :feed end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/expires.rb
app/models/expires.rb
class Expires def self.expires_in(time) (Time.now + time).to_i end def self.expired?(time) !!(time && time < Time.now.to_i) end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/content_formatter.rb
app/models/content_formatter.rb
class ContentFormatter ALLOWLIST_BASE = {}.tap do |hash| hash[:elements] = %w[ h1 h2 h3 h4 h5 h6 h7 h8 br b i strong em a pre code img tt div ins del sup sub p ol ul table thead tbody tfoot blockquote dl dt dd kbd q samp var hr ruby rt rp li tr td th s strike summary details figure figcaption au...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/starred_entry.rb
app/models/starred_entry.rb
class StarredEntry < ApplicationRecord belongs_to :user belongs_to :feed belongs_to :entry, counter_cache: true before_create :expire_caches before_destroy :expire_caches validates_uniqueness_of :user_id, scope: :entry_id def self.new_from_owners(user, entry, source = nil) new(user_id: user.id, feed...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/oauth_server.rb
app/models/oauth_server.rb
class OauthServer < ApplicationRecord end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/tweet_page.rb
app/models/tweet_page.rb
class TweetPage def initialize(url, user) @url = url @user = user end def self.tweet(*args) instance = new(*args) data = instance.from_entry {tweet: data} unless data.nil? end def from_entry return nil unless tweet? Entry.where(main_tweet_id: tweet_id).take&.tweet&.main_tweet&.to...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/tweet.rb
app/models/tweet.rb
class Tweet attr_accessor :tweet, :data def initialize(data, image) @image = image @data = data @tweet = Twitter::Tweet.new(data["tweet"].deep_symbolize_keys) end def main_tweet @main_tweet ||= tweet.retweeted_status? ? tweet.retweeted_status : tweet end def twitter_media? media = fal...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/jws_verifier.rb
app/models/jws_verifier.rb
class JwsVerifier ROOT_CERT = OpenSSL::X509::Certificate.new(File.read(File.join(Rails.root, "config", "AppleRootCA-G3.cer"))) def initialize(token) @token = token end def self.valid?(token) new(token).verify end def verify [root_ends_chain?, chain_valid?, jwt_valid?].all? end private ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/crawl_data_type.rb
app/models/crawl_data_type.rb
class CrawlDataType < ActiveModel::Type::Value def type :jsonb end def cast(value) if CrawlData === value value else CrawlData.new(value) end end def deserialize(value) if String === value decoded = ::ActiveSupport::JSON.decode(value) rescue nil CrawlData.new(deco...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/customer.rb
app/models/customer.rb
# wraps a Stripe::Customer instance class Customer attr_reader :customer delegate :id, to: :customer delegate :sources, to: :customer def self.create(email, plan, trial_end) new_customer = new(Stripe::Customer.create({email: email})) Stripe::Subscription.create( customer: new_customer.id, ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/json_converter.rb
app/models/json_converter.rb
class JsonConverter def self.dump(value) value.is_a?(String) ? JSON.load(value) : value end def self.load(value) value.is_a?(String) ? JSON.load(value) : value end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/attribute_change.rb
app/models/attribute_change.rb
class AttributeChange < ApplicationRecord end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/feedbin_utils.rb
app/models/feedbin_utils.rb
class FeedbinUtils FEED_ENTRIES_PUBLISHED_KEY = "feed:%d:entry_ids:published" FEED_ENTRIES_CREATED_AT_KEY = "feed:%d:entry_ids:created_at" def self.update_public_id_cache(public_id, content, public_id_alt = nil) content_length = content.present? ? content.length : 0 $redis[:refresher].with do |redis| ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/theme.rb
app/models/theme.rb
class Theme attr_accessor :name, :slug def initialize(name, slug) @name = name @slug = slug end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/recently_read_entry.rb
app/models/recently_read_entry.rb
class RecentlyReadEntry < ApplicationRecord belongs_to :user belongs_to :entry validates_uniqueness_of :user_id, scope: :entry_id end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/font.rb
app/models/font.rb
class Font attr_accessor :name, :slug def initialize(name, slug) @name = name @slug = slug end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/saved_search.rb
app/models/saved_search.rb
class SavedSearch < ApplicationRecord belongs_to :user def first_letter letter = "default" if name.present? letter = name[0].downcase end letter end def sourceable Sourceable.new( type: self.class.name, id: id, title: name ) end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/account_migration.rb
app/models/account_migration.rb
class AccountMigration < ApplicationRecord belongs_to :user has_many :account_migration_items enum :status, [:pending, :started, :processing, :complete, :failed] store :data, accessors: [:fw_streams], coder: JSON def percentage_complete all = account_migration_items.count return 0 if all == 0 pe...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/app_store_notification.rb
app/models/app_store_notification.rb
class AppStoreNotification < ApplicationRecord belongs_to :user def receipt_amount if plan == "monthly_pro_v1" 5.99 elsif plan == "yearly_pro_v1" 59.9 end end def receipt_date ms_to_date(data.safe_dig("data", "signedTransactionInfo", "purchaseDate")).to_formatted_s(:date) end ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/supported_sharing_service.rb
app/models/supported_sharing_service.rb
class SupportedSharingService < ApplicationRecord SERVICES = [ OpenStruct.new({ service_id: "pocket", label: "Pocket", requires_auth: true, service_type: "oauth", klass: "Share::Pocket", active: false }), OpenStruct.new({ service_id: "readability", label: "R...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/newsletter.rb
app/models/newsletter.rb
class Newsletter attr_reader :data def initialize(params) @data = params end def valid? data["X-Mailgun-Incoming"] == "Yes" && signature_valid? end def token @token ||= begin full_token.split("+").first end end def full_token @full_token ||= begin to_email.sub("@newsl...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/queued_entry.rb
app/models/queued_entry.rb
class QueuedEntry < ApplicationRecord include TrackableAttributes track :progress, :order, :playlist_id belongs_to :user belongs_to :entry, counter_cache: true belongs_to :feed belongs_to :playlist end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/plan.rb
app/models/plan.rb
class Plan < ApplicationRecord has_many :users def period name.gsub(/ly$/, "").downcase end def price_in_cents price.to_i * 100 end def restricted? ["podcast-subscription"].include?(stripe_id) end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/micropost.rb
app/models/micropost.rb
class Micropost attr_reader :data def initialize(data, title = nil, feed: nil) @data = data unless @data&.safe_dig("json_feed").nil? @data = @data.safe_dig("json_feed") end @title = title @feed = feed end def valid? @data&.respond_to?(:dig) && author_profile? && !title? end ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/redis_lock.rb
app/models/redis_lock.rb
class RedisLock def self.acquire(lock_name, expiration_in_seconds = 55) !!Sidekiq.redis { _1.set(lock_name, "locked", "nx", "ex", expiration_in_seconds) } end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/suggested_category.rb
app/models/suggested_category.rb
class SuggestedCategory < ApplicationRecord has_many :suggested_feeds, dependent: :delete_all end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/account_migration_item.rb
app/models/account_migration_item.rb
class AccountMigrationItem < ApplicationRecord belongs_to :account_migration after_commit :process, on: :create enum :status, [:pending, :complete, :failed] store :data, accessors: [:fw_feed], coder: JSON def process AccountMigrator::ImportFeed.perform_async(id) end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/import_item.rb
app/models/import_item.rb
class ImportItem < ApplicationRecord serialize :details, type: Hash belongs_to :import enum :status, [:pending, :complete, :failed, :fixable] store_accessor :error, :class, :message, prefix: true has_many :discovered_feeds, foreign_key: :site_url, primary_key: :site_url has_one :favicon, foreign_key: :host,...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/mercury_parser.rb
app/models/mercury_parser.rb
class MercuryParser attr_reader :url def initialize(url, data: nil, html: nil) @url = url @html = html load_data(data) if data end def self.parse(...) Librato.increment "readability.first_parse" instance = new(...) instance.result instance end def self.parse_with_html(...) ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/unread_entry.rb
app/models/unread_entry.rb
class UnreadEntry < ApplicationRecord belongs_to :user belongs_to :feed belongs_to :entry self.table_name = "unreads" validates_uniqueness_of :user_id, scope: :entry_id def self.new_from_owners(user, entry) new(user_id: user.id, feed_id: entry.feed_id, entry_id: entry.id, published: entry.published, ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/text_to_chapters.rb
app/models/text_to_chapters.rb
class TextToChapters TIMESTAMP_PATTERN = /((?:\d+:)?\d{1,2}:\d{2})/ CHAPTER_LINE = /^#{TIMESTAMP_PATTERN}\s+(.+)$/ CHAPTER_BLOCK = /(?:^#{TIMESTAMP_PATTERN}\s+.+$\n?){2,}/m def self.call(text, total_duration) chapter_block = text[CHAPTER_BLOCK] return [] unless chapter_block chapters = ch...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/coupon.rb
app/models/coupon.rb
class Coupon < ApplicationRecord belongs_to :user, optional: true before_create :generate_coupon def generate_coupon begin self.coupon_code = SecureRandom.urlsafe_base64 end while Coupon.exists?(coupon_code: coupon_code) end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/sharing_service.rb
app/models/sharing_service.rb
class SharingService < ApplicationRecord belongs_to :user default_scope { order(Arel.sql("lower(label)")) } def share_link target = url.start_with?("http") ? "_blank" : "_self" {url: url, label: label, html_options: {target: target, rel: "noopener noreferrer"}} end def active? true end def ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/feed_search.rb
app/models/feed_search.rb
class FeedSearch def initialize(query) @query = query end def search query = { query: { function_score: { query: { simple_query_string: { query: @query, fields: ["title^2", "site_url", "feed_url", "description", "meta_title", "author"], ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/newsletter_sender.rb
app/models/newsletter_sender.rb
class NewsletterSender < ApplicationRecord belongs_to :feed def search_data [token, full_token, email, name].join.downcase.gsub(/\s+/, "") end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/updated_entry.rb
app/models/updated_entry.rb
class UpdatedEntry < ApplicationRecord belongs_to :user belongs_to :entry belongs_to :feed def self.new_from_owners(user_id, entry) new(user_id: user_id, feed_id: entry.feed_id, entry_id: entry.id, published: entry.published, updated: entry.updated) end def self.create_from_owners(user_id, entry) ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/application_record.rb
app/models/application_record.rb
class ApplicationRecord < ActiveRecord::Base self.abstract_class = true self.attributes_for_inspect = :all # data should look like [{model_id => "value"}] def self.update_multiple(column:, data:) return if data.empty? ids = data.keys type = columns_hash[column.to_s].sql_type condition = Arel:...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/app_store_notification_data.rb
app/models/app_store_notification_data.rb
class AppStoreNotificationData attr_reader :notification def initialize(notification) @notification = notification end def self.from_notification_history(start_date: nil, end_date: nil) body = {} start_date = start_date || most_recent_possible_start body[:startDate] = format_date(start_date)...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/email_newsletter.rb
app/models/email_newsletter.rb
class EmailNewsletter attr_reader :full_token def initialize(email, full_token) @email = email @full_token = full_token end def self.token(full_token) full_token.sub("subscribe+", "").split("+").first end def valid? true end def token self.class.token(full_token) end def fr...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/conditional_http.rb
app/models/conditional_http.rb
class ConditionalHttp attr_reader :etag, :last_modified def initialize(etag, last_modified) @etag = etag @last_modified = last_modified end def to_h headers = {} headers["If-None-Match"] = if_none_match if if_none_match headers["If-Modified-Since"] = if_modified_since if if_modified_since ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/component_form_builder.rb
app/models/component_form_builder.rb
class ComponentFormBuilder < ActionView::Helpers::FormBuilder def radio_button(method, tag_value, options = {}) super(method, tag_value, merge_defaults(options)) end private def merge_defaults(options) options[:class] ||= "" options[:class] = [options[:class], "peer"].join(" ") return options ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/feed_stat.rb
app/models/feed_stat.rb
class FeedStat < ApplicationRecord belongs_to :feed def self.daily_counts(feed_ids:, interval: "29 days") return {} if feed_ids.empty? sql = <<-SQL WITH dates AS ( SELECT generate_series( CURRENT_DATE - INTERVAL :interval, CURRENT_DATE, '1 day' )::date AS day ) ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/billing_event.rb
app/models/billing_event.rb
class BillingEvent < ApplicationRecord attr_accessor :details belongs_to :billable, polymorphic: true validates_uniqueness_of :event_id before_validation :build_event after_commit :process_event, on: :create def build_event self.event_type = info["type"] self.event_id = info["id"] customer ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/push.rb
app/models/push.rb
class Push def self.hub_secret(feed_id) Digest::SHA1.hexdigest([feed_id, Rails.application.secret_key_base].join("-")) end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/tagging.rb
app/models/tagging.rb
class Tagging < ApplicationRecord belongs_to :tag belongs_to :feed belongs_to :user after_commit :update_actions, on: [:create, :destroy] def update_actions actions = user.actions.where("? = ANY (tag_ids)", tag_id).pluck(:id) Search::TouchActions.perform_async(actions) end def self.build_tag_ma...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/auth_constraint.rb
app/models/auth_constraint.rb
class AuthConstraint def self.admin?(request) auth_token = request.cookie_jar.signed[:auth_token] return false unless auth_token user = User.find_by_auth_token(auth_token) user&.admin? end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/feed_finder.rb
app/models/feed_finder.rb
class FeedFinder attr_reader :url, :response, :import_mode def initialize(url, import_mode: false, username: nil, password: nil) @url = url @import_mode = import_mode @username = username @password = password end def self.feeds(url, **args) options = new(url, **args).fin...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/feed_search_data.rb
app/models/feed_search_data.rb
class FeedSearchData EXCLUDE = ["", "http:", "https:", "com", "net", "co", "index", "rss", "xml", "www", "org", "de", "me"] def initialize(feed) @feed = feed end def to_h {}.tap do |hash| hash[:id] = @feed.id hash[:title] = @feed.title&.to_plain_text has...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/iframe_embed.rb
app/models/iframe_embed.rb
class IframeEmbed SUPPORTED_URLS = [] attr_reader :embed_url, :data def initialize(embed_url) @embed_url = URI(embed_url) @embed_url.scheme = "https" end def title data && data["title"] end def subtitle data && data["provider_name"] end def canonical_url data && data["url"] ||...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/image_fallback.rb
app/models/image_fallback.rb
class ImageFallback attr_accessor :document def initialize(document) @document = document end def add_fallbacks document.search("img").each do |image| src = image["data-canonical-src"] next unless src.respond_to?(:start_with?) && src.start_with?("http") image["onerror"] = "this.onerr...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/import.rb
app/models/import.rb
class Import < ApplicationRecord belongs_to :user has_many :import_items, dependent: :delete_all before_validation :parse validate do |import| import.errors.add(:base, "No feeds found") if import.import_items.empty? end attr_accessor :xml def parse feeds = Opml::Parser.parse(xml) create_tag...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/colors.rb
app/models/colors.rb
class Colors OPTIONS = ActiveSupport::HashWithIndifferentAccess.new({ day: "#FFFFFF", sunset: "#f5f2eb", dusk: "#262626", midnight: "#000000" }) def self.fetch(theme) new().fetch(theme) end def fetch(theme) OPTIONS.fetch(theme, OPTIONS[:day]) end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/remote_file.rb
app/models/remote_file.rb
class RemoteFile < ApplicationRecord BUCKET = ENV["AWS_S3_BUCKET_ICONS"] REGION = ENV["AWS_S3_BUCKET_ICONS_REGION"] HOST = ENV["FILES_HOST"] store_accessor :settings, :width, :height def self.fingerprint(data) Digest::MD5.hexdigest(data) end def self.signed_url(url) url = url.to_s signature...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/authentication_token.rb
app/models/authentication_token.rb
class AuthenticationToken < ApplicationRecord belongs_to :user attr_accessor :length, :skip_generate enum :purpose, {cookies: 0, feeds: 1, newsletters: 2, pages: 3, app: 4, icloud: 5} store_accessor :data, :description, :newsletter_tag scope :active, -> { where(active: true) } before_create :generate_t...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/sparkline.rb
app/models/sparkline.rb
class Sparkline attr_reader :width, :height, :percentages, :stroke def initialize(width:, height:, stroke:, percentages:) @width = width.to_f @height = height.to_f @percentages = percentages || [] @stroke = stroke end def fill to_attr([ [0, height], *fill_points, [width, height] ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/twitter_user.rb
app/models/twitter_user.rb
class TwitterUser < ApplicationRecord def user @user ||= Twitter::User.new(data.deep_symbolize_keys) end def profile_image user.profile_image_uri_https(:original).to_s end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/api_client.rb
app/models/api_client.rb
class ApiClient class Error < StandardError end def initialize(access_token) @access_token = access_token end def feed_items_list(params:, limit: nil) paged_feed_items( path: "/api/v2/feed_items/list", params: params, limit: limit ) end def subscriptions_list request(p...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/throttle.rb
app/models/throttle.rb
class Throttle def self.throttle!(key, limit, period, &block) key = "#{key}:throttle" count, expiration = Sidekiq.redis do |client| client.multi do |transaction| transaction.incr key transaction.ttl key end end Sidekiq.redis { _1.expire(key, period.to_i) } if expiration =...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/embed.rb
app/models/embed.rb
class Embed < ApplicationRecord belongs_to :parent, class_name: "Embed", foreign_key: :parent_id, primary_key: :provider_id enum :source, {youtube_video: 0, youtube_channel: 1} def channel youtube_video? && self.class.youtube_channel.find_by_provider_id(parent_id) end def duration_in_seconds return ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/device.rb
app/models/device.rb
class Device < ApplicationRecord belongs_to :user enum :device_type, {notifier: 0, safari: 1, podcast: 2, browser: 3} end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/image.rb
app/models/image.rb
# t.bigint :provider, null: false # t.text :provider_id, null: false # t.text :url, null: false # t.uuid :url_fingerprint, null: false # t.text :storage_url, null: false # t.uuid :image_fingerprint, null: false # t.bigint :width, null: false # t.bigint :height,...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/podcast_subscription.rb
app/models/podcast_subscription.rb
class PodcastSubscription < ApplicationRecord include TrackableAttributes track :status, :playlist_id, :title, :chapter_filter, :chapter_filter_type, :download_filter, :download_filter_type belongs_to :user belongs_to :feed, counter_cache: :subscriptions_count belongs_to :playlist has_many :queued...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/crawl_data.rb
app/models/crawl_data.rb
class CrawlData delegate :last_modified, :etag, :download_fingerprint, to: :@data delegate :redirected_to, :last_error, to: :@data attr_reader :data def initialize(data = {}) @data = OpenStruct.new(data) end def error_count @data.error_count.to_i end def failed_at @data.failed_at.to_i ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/url_cache.rb
app/models/url_cache.rb
class UrlCache attr_reader :url, :options def initialize(url, options = {}) @url = url @options = options end def cache_key "url_cache_#{Digest::SHA1.hexdigest("#{url}#{options}")}" end def body result && @body end def headers result && @headers end private def result ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/in_app_purchase.rb
app/models/in_app_purchase.rb
class InAppPurchase < ApplicationRecord belongs_to :user validates :transaction_id, uniqueness: true after_commit :extend_subscription, on: :create def self.create_from_receipt_json(user, receipt_json, response) create({ transaction_id: receipt_json["transaction_id"], purchase_date: Time.at(r...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/action.rb
app/models/action.rb
class Action < ApplicationRecord attr_accessor :automatic_modification, :apply_action belongs_to :user enum :action_type, {standard: 0, notifier: 1, mute: 2} enum :status, {active: 0, suspended: 1, broken: 2} validate do |action| if computed_feed_ids.empty? && automatic_modification.blank? action....
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/crawling_error.rb
app/models/crawling_error.rb
class CrawlingError ERRORS = { "Addressable::URI::InvalidURIError" => "Invalid URL", "Feedkit::ClientError" => "Connection error", "Feedkit::ConnectionError" => "Connection error", "Feedkit::InvalidUrl" => "Invalid URL", "Feedkit::NotFound" => "N...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/discovered_feed.rb
app/models/discovered_feed.rb
class DiscoveredFeed < ApplicationRecord before_create :set_host private def set_host self.host = Addressable::URI.heuristic_parse(site_url)&.host&.downcase end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/deleted_user.rb
app/models/deleted_user.rb
class DeletedUser < ApplicationRecord def self.search(query) where("email like ?", "%#{query}%") end def stripe_url "https://manage.stripe.com/customers/#{customer_id}" end def deleted? true end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/user.rb
app/models/user.rb
class User < ApplicationRecord attr_accessor :stripe_token, :old_password_valid, :update_auth_token, :password_reset, :coupon_code, :is_trialing, :coupon_valid, :deleted has_secure_password store_accessor :settings, :entry_sort, :previous_read_count, :starred_feed_enabled, :precache_images, ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/opml/outline.rb
app/models/opml/outline.rb
module Opml class Outline def initialize(node, tag) @node = node @tag = tag end def to_h Hash.new.tap do |hash| @node.attributes.each do |name, attribute| hash[name.underscore.to_sym] = attribute.value end hash[:tag] = @tag end end end end
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/opml/parser.rb
app/models/opml/parser.rb
module Opml class Parser attr_reader :feeds def self.parse(*args) instance = new(*args) instance.parse instance.feeds end def initialize(xml) @xml = xml @feeds = [] end def outlines @outlines ||= Nokogiri::XML.parse(@xml).css("body").children end ...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/concerns/trackable_attributes.rb
app/models/concerns/trackable_attributes.rb
module TrackableAttributes extend ActiveSupport::Concern included do class_attribute :tracked_attributes, instance_writer: false, default: [] before_update :touch_attributes has_many :attribute_changes, as: :trackable, dependent: :delete_all attribute_method_suffix "_updated_at" end class_meth...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/concerns/searchable.rb
app/models/concerns/searchable.rb
module Searchable extend ActiveSupport::Concern included do UNREAD_REGEX = /(?<=\s|^)(?:(?<boolean>AND|OR|NOT)\s+)?is:\s*unread(?=\s|$)/ READ_REGEX = /(?<=\s|^)is:\s*read(?=\s|$)/ STARRED_REGEX = /(?<=\s|^)(?:(?<boolean>AND|OR|NOT)\s+)?is:\s*starred(?=\s|$)/ UNSTARRED_REGEX = /(?<=\s|^)is:\s*unstar...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/share/facebook.rb
app/models/share/facebook.rb
class Share::Facebook < Share::Service URL = "https://www.facebook.com/sharer/sharer.php" def initialize(klass = nil) @klass = klass end def share(params, entry = nil) if entry.blank? entry = Entry.find(params[:entry_id]) end uri = URI.parse(URL) uri.query = {"u" => entry.fully_quali...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false
feedbin/feedbin
https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/models/share/raindrop.rb
app/models/share/raindrop.rb
class Share::Raindrop < Share::Service API_URL = "https://api.raindrop.io" # 1. raindrop = Raindrop.new # 2. redirect_to raindrop.authorize_redirect # 3. raindrop.request_access() # 4. save result database def initialize(klass = nil) @klass = klass if @klass.present? @client = OAuth2::Access...
ruby
MIT
02911157804301424ec3b1a17e1a9583c09b9e9b
2026-01-04T15:49:01.344805Z
false