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 |
|---|---|---|---|---|---|---|---|---|
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/fever_api/sync_unread_item_ids.rb | app/commands/fever_api/sync_unread_item_ids.rb | # frozen_string_literal: true
module FeverAPI::SyncUnreadItemIds
class << self
def call(authorization:, **params)
if params.key?(:unread_item_ids)
{ unread_item_ids: unread_item_ids(authorization) }
else
{}
end
end
private
def unread_item_ids(authorization)
a... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/fever_api/read_groups.rb | app/commands/fever_api/read_groups.rb | # frozen_string_literal: true
module FeverAPI::ReadGroups
class << self
def call(authorization:, **params)
if params.key?(:groups)
{ groups: groups(authorization) }
else
{}
end
end
private
def groups(authorization)
[Group::UNGROUPED, *authorization.scope(Grou... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/fever_api/response.rb | app/commands/fever_api/response.rb | # frozen_string_literal: true
module FeverAPI::Response
ACTIONS = [
FeverAPI::Authentication,
FeverAPI::ReadFeeds,
FeverAPI::ReadGroups,
FeverAPI::ReadFeedsGroups,
FeverAPI::ReadFavicons,
FeverAPI::ReadItems,
FeverAPI::ReadLinks,
FeverAPI::SyncUnreadItemIds,
FeverAPI::SyncSavedIte... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/fever_api/read_feeds.rb | app/commands/fever_api/read_feeds.rb | # frozen_string_literal: true
module FeverAPI::ReadFeeds
class << self
def call(authorization:, **params)
if params.key?(:feeds)
{ feeds: feeds(authorization) }
else
{}
end
end
private
def feeds(authorization)
authorization.scope(FeedRepository.list).map(&:as... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/fever_api/read_favicons.rb | app/commands/fever_api/read_favicons.rb | # frozen_string_literal: true
class FeverAPI::ReadFavicons
ICON = "R0lGODlhAQABAIAAAObm5gAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="
class << self
def call(params)
if params.key?(:favicons)
{ favicons: }
else
{}
end
end
private
def favicons
[
{
... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/fever_api/read_items.rb | app/commands/fever_api/read_items.rb | # frozen_string_literal: true
module FeverAPI::ReadItems
class << self
def call(authorization:, **params)
return {} unless params.key?(:items)
item_ids = params[:with_ids].split(",") if params.key?(:with_ids)
{
items: items(item_ids, params[:since_id], authorization),
total_it... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/fever_api/read_feeds_groups.rb | app/commands/fever_api/read_feeds_groups.rb | # frozen_string_literal: true
class FeverAPI::ReadFeedsGroups
class << self
def call(authorization:, **params)
if params.key?(:feeds) || params.key?(:groups)
{ feeds_groups: feeds_groups(authorization) }
else
{}
end
end
private
def feeds_groups(authorization)
... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/fever_api/sync_saved_item_ids.rb | app/commands/fever_api/sync_saved_item_ids.rb | # frozen_string_literal: true
module FeverAPI::SyncSavedItemIds
class << self
def call(authorization:, **params)
if params.key?(:saved_item_ids)
{ saved_item_ids: saved_item_ids(authorization) }
else
{}
end
end
private
def saved_item_ids(authorization)
all_st... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/fever_api/write_mark_feed.rb | app/commands/fever_api/write_mark_feed.rb | # frozen_string_literal: true
module FeverAPI::WriteMarkFeed
def self.call(authorization:, **params)
if params[:mark] == "feed"
authorization.check(Feed.find(params[:id]))
MarkFeedAsRead.call(params[:id], params[:before])
end
{}
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/fever_api/write_mark_item.rb | app/commands/fever_api/write_mark_item.rb | # frozen_string_literal: true
module FeverAPI::WriteMarkItem
class << self
def call(authorization:, **params)
if params[:mark] == "item"
authorization.check(Story.find(params[:id])) if params.key?(:id)
mark_item_as(params[:id], params[:as])
end
{}
end
private
def ... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/fever_api/write_mark_group.rb | app/commands/fever_api/write_mark_group.rb | # frozen_string_literal: true
module FeverAPI::WriteMarkGroup
def self.call(authorization:, **params)
if params[:mark] == "group"
authorization.check(Group.find(params[:id]))
MarkGroupAsRead.call(params[:id], params[:before])
end
{}
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/story/mark_group_as_read.rb | app/commands/story/mark_group_as_read.rb | # frozen_string_literal: true
module MarkGroupAsRead
KINDLING_GROUP_ID = 0
SPARKS_GROUP_ID = -1
def self.call(group_id, timestamp)
return unless group_id
if [KINDLING_GROUP_ID, SPARKS_GROUP_ID].include?(group_id.to_i)
StoryRepository
.fetch_unread_by_timestamp(timestamp).update_all(is_r... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/story/mark_as_unstarred.rb | app/commands/story/mark_as_unstarred.rb | # frozen_string_literal: true
module MarkAsUnstarred
def self.call(story_id)
StoryRepository.fetch(story_id).update!(is_starred: false)
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/story/mark_all_as_read.rb | app/commands/story/mark_all_as_read.rb | # frozen_string_literal: true
module MarkAllAsRead
def self.call(story_ids)
StoryRepository.fetch_by_ids(story_ids).update_all(is_read: true)
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/story/mark_as_read.rb | app/commands/story/mark_as_read.rb | # frozen_string_literal: true
module MarkAsRead
def self.call(story_id)
StoryRepository.fetch(story_id).update!(is_read: true)
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/story/mark_feed_as_read.rb | app/commands/story/mark_feed_as_read.rb | # frozen_string_literal: true
module MarkFeedAsRead
def self.call(feed_id, timestamp)
StoryRepository
.fetch_unread_for_feed_by_timestamp(feed_id, timestamp)
.update_all(is_read: true)
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/story/mark_as_unread.rb | app/commands/story/mark_as_unread.rb | # frozen_string_literal: true
module MarkAsUnread
def self.call(story_id)
StoryRepository.fetch(story_id).update!(is_read: false)
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/story/mark_as_starred.rb | app/commands/story/mark_as_starred.rb | # frozen_string_literal: true
module MarkAsStarred
def self.call(story_id)
StoryRepository.fetch(story_id).update!(is_starred: true)
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/feed/export_to_opml.rb | app/commands/feed/export_to_opml.rb | # frozen_string_literal: true
module Feed::ExportToOpml
class << self
def call(feeds)
builder =
Nokogiri::XML::Builder.new do |xml|
xml.opml(version: "1.0") do
xml.head { xml.title("Feeds from Stringer") }
xml.body { feeds.each { |feed| feed_outline(xml, feed) } }
... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/feed/import_from_opml.rb | app/commands/feed/import_from_opml.rb | # frozen_string_literal: true
module Feed::ImportFromOpml
class << self
def call(opml_contents, user:)
feeds_with_groups = OpmlParser.call(opml_contents)
# It considers a situation when feeds are already imported without
# groups, so it's possible to re-import the same subscriptions.xml just
... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/feed/fetch_one.rb | app/commands/feed/fetch_one.rb | # frozen_string_literal: true
module Feed::FetchOne
class << self
def call(feed)
raw_feed = fetch_raw_feed(feed)
new_entries_from(feed, raw_feed).each do |entry|
StoryRepository.add(entry, feed)
end
FeedRepository.update_last_fetched(feed, raw_feed.last_modified)
FeedRepo... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/feed/create.rb | app/commands/feed/create.rb | # frozen_string_literal: true
module Feed::Create
def self.call(url, user:)
result = FeedDiscovery.call(url)
return false unless result
name = ContentSanitizer.call(result.title.presence || result.feed_url)
Feed.create(name:, user:, url: result.feed_url, last_fetched: 1.day.ago)
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/feed/fetch_all_for_user.rb | app/commands/feed/fetch_all_for_user.rb | # frozen_string_literal: true
require "thread/pool"
module Feed::FetchAllForUser
def self.call(user)
pool = Thread.pool(10)
user.feeds.find_each { |feed| pool.process { Feed::FetchOne.call(feed) } }
pool.shutdown
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/feed/find_new_stories.rb | app/commands/feed/find_new_stories.rb | # frozen_string_literal: true
module Feed::FindNewStories
STORY_AGE_THRESHOLD_DAYS = 3
def self.call(raw_feed, feed_id, latest_entry_id = nil)
stories = []
raw_feed.entries.each do |story|
break if latest_entry_id && story.id == latest_entry_id
next if story_age_exceeds_threshold?(story) || S... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/commands/feed/fetch_all.rb | app/commands/feed/fetch_all.rb | # frozen_string_literal: true
require "thread/pool"
module Feed::FetchAll
def self.call
pool = Thread.pool(10)
Feed.find_each { |feed| pool.process { Feed::FetchOne.call(feed) } }
pool.shutdown
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/controllers/settings_controller.rb | app/controllers/settings_controller.rb | # frozen_string_literal: true
class SettingsController < ApplicationController
def index
authorization.skip
end
def update
authorization.skip
setting = Setting.find(params[:id])
setting.update!(setting_params)
redirect_to(settings_path)
end
private
def setting_params
params.exp... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/controllers/profiles_controller.rb | app/controllers/profiles_controller.rb | # frozen_string_literal: true
class ProfilesController < ApplicationController
def edit
authorization.skip
render(locals: { user: current_user })
end
def update
authorization.skip
if current_user.update(user_params)
redirect_to(news_path, flash: { success: t(".success") })
else
... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/controllers/imports_controller.rb | app/controllers/imports_controller.rb | # frozen_string_literal: true
class ImportsController < ApplicationController
def new
authorization.skip
end
def create
authorization.skip
Feed::ImportFromOpml.call(params["opml_file"].read, user: current_user)
redirect_to("/setup/tutorial")
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/controllers/fever_controller.rb | app/controllers/fever_controller.rb | # frozen_string_literal: true
class FeverController < ApplicationController
skip_before_action :complete_setup, only: [:index, :update]
protect_from_forgery with: :null_session, only: [:update]
def index
authorization.skip
render(json: FeverAPI::Response.call(fever_params))
end
def update
autho... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/controllers/debug_controller.rb | app/controllers/debug_controller.rb | # frozen_string_literal: true
class DebugController < ApplicationController
skip_before_action :complete_setup, only: [:heroku]
skip_before_action :authenticate_user, only: [:heroku]
def index
authorization.skip
render(
locals: {
queued_jobs_count: GoodJob::Job.queued.count,
pendin... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/controllers/tutorials_controller.rb | app/controllers/tutorials_controller.rb | # frozen_string_literal: true
class TutorialsController < ApplicationController
def index
authorization.skip
CallableJob.perform_later(Feed::FetchAllForUser, current_user)
@sample_stories = StoryRepository.samples
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/controllers/passwords_controller.rb | app/controllers/passwords_controller.rb | # frozen_string_literal: true
class PasswordsController < ApplicationController
skip_before_action :complete_setup, only: [:new, :create]
skip_before_action :authenticate_user, only: [:new, :create]
before_action :check_signups_enabled, only: [:new, :create]
def new
authorization.skip
end
def create
... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/controllers/stories_controller.rb | app/controllers/stories_controller.rb | # frozen_string_literal: true
class StoriesController < ApplicationController
def index
order = current_user.stories_order
@unread_stories = authorization.scope(StoryRepository.unread(order:))
end
def update
json_params = JSON.parse(request.body.read, symbolize_names: true)
story = authorizatio... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/controllers/feeds_controller.rb | app/controllers/feeds_controller.rb | # frozen_string_literal: true
class FeedsController < ApplicationController
def index
@feeds = authorization.scope(FeedRepository.list.with_unread_stories_counts)
end
def show
@feed = FeedRepository.fetch(params[:feed_id])
authorization.check(@feed)
@stories = StoryRepository.feed(params[:feed_... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/controllers/exports_controller.rb | app/controllers/exports_controller.rb | # frozen_string_literal: true
class ExportsController < ApplicationController
def index
xml = Feed::ExportToOpml.call(authorization.scope(Feed.all))
send_data(
xml,
type: "application/xml",
disposition: "attachment",
filename: "stringer.opml"
)
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/controllers/sessions_controller.rb | app/controllers/sessions_controller.rb | # frozen_string_literal: true
class SessionsController < ApplicationController
skip_before_action :authenticate_user, only: [:new, :create]
def new
authorization.skip
end
def create
authorization.skip
user = SignInUser.call(params[:username], params[:password])
if user
session[:user_id]... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/controllers/application_controller.rb | app/controllers/application_controller.rb | # frozen_string_literal: true
class ApplicationController < ActionController::Base
before_action :complete_setup
before_action :authenticate_user
after_action -> { authorization.verify }
private
def authorization
@authorization ||= Authorization.new(current_user)
end
def complete_setup
redirec... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/models/feed.rb | app/models/feed.rb | # frozen_string_literal: true
class Feed < ApplicationRecord
has_many :stories, -> { order(published: :desc) }, dependent: :delete_all
has_many :unread_stories, -> { unread }, class_name: "Story"
belongs_to :group
belongs_to :user
delegate :name, to: :group, prefix: true, allow_nil: true
validates :url, ... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/models/subscription.rb | app/models/subscription.rb | # frozen_string_literal: true
class Subscription < ApplicationRecord
belongs_to :user
STATUSES = ["active", "past_due", "unpaid", "canceled"].freeze
validates :user_id, presence: true, uniqueness: true
validates :stripe_customer_id, presence: true, uniqueness: true
validates :stripe_subscription_id, presen... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/models/story.rb | app/models/story.rb | # frozen_string_literal: true
class Story < ApplicationRecord
belongs_to :feed
has_one :user, through: :feed
validates_uniqueness_of :entry_id, scope: :feed_id
delegate :group_id, :user_id, to: :feed
scope :unread, -> { where(is_read: false) }
UNTITLED = "[untitled]"
def headline
title.nil? ? UN... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/models/group.rb | app/models/group.rb | # frozen_string_literal: true
class Group < ApplicationRecord
UNGROUPED = Group.new(id: 0, name: "Ungrouped")
belongs_to :user
has_many :feeds
validates :name, presence: true, uniqueness: { scope: :user_id }
validates :user_id, presence: true
def as_fever_json
{ id:, title: name }
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/models/application_record.rb | app/models/application_record.rb | # frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
def self.boolean_accessor(attribute, key, default: false)
store_accessor(attribute, key)
define_method(key) do
value = super()
value.nil? ? default : CastBoolean.call(value)
end
alias_met... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/models/migration_status.rb | app/models/migration_status.rb | # frozen_string_literal: true
module MigrationStatus
def self.call
migrator = ActiveRecord::Base.connection.pool.migration_context.open
migrator.pending_migrations.map do |migration|
"#{migration.name} - #{migration.version}"
end
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/models/setting.rb | app/models/setting.rb | # frozen_string_literal: true
class Setting < ApplicationRecord
validates :type, presence: true, uniqueness: true
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/models/user.rb | app/models/user.rb | # frozen_string_literal: true
class User < ApplicationRecord
has_secure_password
encrypts :api_key, deterministic: true
has_many :feeds, dependent: :delete_all
has_many :groups, dependent: :delete_all
validates :username, presence: true, uniqueness: { case_sensitive: false }
validate :password_challenge... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/models/setting/user_signup.rb | app/models/setting/user_signup.rb | # frozen_string_literal: true
class Setting::UserSignup < Setting
boolean_accessor :data, :enabled, default: false
validates :enabled, inclusion: { in: [true, false] }
def self.first
first_or_create!
end
def self.enabled?
first_or_create!.enabled? || User.none?
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/utils/feed_discovery.rb | app/utils/feed_discovery.rb | # frozen_string_literal: true
module FeedDiscovery
class << self
def call(url)
get_feed_for_url(url) do
urls = Feedbag.find(url)
return false if urls.empty?
get_feed_for_url(urls.first) { return false }
end
end
private
def get_feed_for_url(url)
response = ... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/utils/sample_story.rb | app/utils/sample_story.rb | # frozen_string_literal: true
SAMPLE_BODY = <<~HTML
<p>Tofu shoreditch intelligentsia <a href="#">umami</a>, fashion axe photo booth
try-hard terry richardson quinoa actually fingerstache meggings fixie. Aesthetic
salvia vinyl raw denim, keffiyeh master cleanse tonx selfies mlkshk occupy twee
street art gentri... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/utils/content_sanitizer.rb | app/utils/content_sanitizer.rb | # frozen_string_literal: true
module ContentSanitizer
def self.call(content)
Loofah.fragment(content.gsub(/<wbr\s*>/i, ""))
.scrub!(:prune)
.scrub!(:unprintable)
.to_s
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/utils/opml_parser.rb | app/utils/opml_parser.rb | # frozen_string_literal: true
require "nokogiri"
module OpmlParser
class << self
def call(contents)
feeds_with_groups = Hash.new { |h, k| h[k] = [] }
outlines_in(contents).each do |outline|
if outline_is_group?(outline)
group_name = extract_name(outline.attributes).value
... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/utils/authorization.rb | app/utils/authorization.rb | # frozen_string_literal: true
class Authorization
attr_accessor :user, :authorized
class NotAuthorizedError < StandardError; end
def initialize(user)
self.user = user
self.authorized = false
end
alias authorized? authorized
def check(record)
raise(NotAuthorizedError) unless record.user_id =... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/repositories/story_repository.rb | app/repositories/story_repository.rb | # frozen_string_literal: true
class StoryRepository
extend UrlHelpers
def self.add(entry, feed)
enclosure_url = entry.enclosure_url if entry.respond_to?(:enclosure_url)
Story.create(
feed:,
title: extract_title(entry),
permalink: extract_url(entry, feed),
enclosure_url:,
body... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/repositories/user_repository.rb | app/repositories/user_repository.rb | # frozen_string_literal: true
class UserRepository
def self.fetch(id)
return nil unless id
User.find(id)
end
def self.setup_complete?
User.any?
end
def self.save(user)
user.save
user
end
def self.first
User.first
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/repositories/feed_repository.rb | app/repositories/feed_repository.rb | # frozen_string_literal: true
class FeedRepository
MIN_YEAR = 1970
def self.fetch(id)
Feed.find(id)
end
def self.fetch_by_ids(ids)
Feed.where(id: ids)
end
def self.update_feed(feed, name, url, group_id = nil)
feed.name = name
feed.url = url
feed.group_id = group_id
feed.save
en... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/app/repositories/group_repository.rb | app/repositories/group_repository.rb | # frozen_string_literal: true
class GroupRepository
def self.list
Group.order(Group.arel_table[:name].lower)
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/docker/init_or_update_env.rb | docker/init_or_update_env.rb | # frozen_string_literal: true
module Secrets
def self.generate_secret(length)
`openssl rand -hex #{length}`.strip
end
end
pg_user = ENV.fetch("POSTGRES_USER", "stringer")
pg_password = ENV.fetch("POSTGRES_PASSWORD", Secrets.generate_secret(32))
pg_host = ENV.fetch("POSTGRES_HOSTNAME", "stringer-postgres")
pg_... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/seeds.rb | db/seeds.rb | # frozen_string_literal: true
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/schema.rb | db/schema.rb | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20230801025234_create_good_jobs_error_event.rb | db/migrate/20230801025234_create_good_jobs_error_event.rb | # frozen_string_literal: true
class CreateGoodJobsErrorEvent < ActiveRecord::Migration[7.0]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.column_exists?(:good_jobs, :error_e... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20230312193113_drop_delayed_job.rb | db/migrate/20230312193113_drop_delayed_job.rb | # frozen_string_literal: true
class DropDelayedJob < ActiveRecord::Migration[7.0]
def up
drop_table :delayed_jobs
end
def down
raise ActiveRecord::IrreversibleMigration
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20230223231930_add_username_to_users.rb | db/migrate/20230223231930_add_username_to_users.rb | # frozen_string_literal: true
class AddUsernameToUsers < ActiveRecord::Migration[7.0]
def change
add_column :users, :username, :string
add_index :users, :username, unique: true
set_default_username
change_column_null :users, :username, false
end
private
def set_default_username
first_us... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20130509131045_add_unique_constraints.rb | db/migrate/20130509131045_add_unique_constraints.rb | # frozen_string_literal: true
class AddUniqueConstraints < ActiveRecord::Migration[4.2]
def change
add_index :stories, [:permalink, :feed_id], unique: true
add_index :feeds, :url, unique: true
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20140413100725_add_groups_table_and_foreign_keys_to_feeds.rb | db/migrate/20140413100725_add_groups_table_and_foreign_keys_to_feeds.rb | # frozen_string_literal: true
class AddGroupsTableAndForeignKeysToFeeds < ActiveRecord::Migration[4.2]
def up
create_table :groups do |t|
t.string :name, null: false
t.timestamps null: false
end
add_column :feeds, :group_id, :integer
end
def down
drop_table :groups
remove_column ... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20240709172406_create_good_job_process_lock_ids.rb | db/migrate/20240709172406_create_good_job_process_lock_ids.rb | # frozen_string_literal: true
class CreateGoodJobProcessLockIds < ActiveRecord::Migration[7.1]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.column_exists?(:good_jobs, :lock... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20240709172408_create_good_job_execution_duration.rb | db/migrate/20240709172408_create_good_job_execution_duration.rb | # frozen_string_literal: true
class CreateGoodJobExecutionDuration < ActiveRecord::Migration[7.1]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.column_exists?(:good_job_exec... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20130418221144_add_user_model.rb | db/migrate/20130418221144_add_user_model.rb | # frozen_string_literal: true
class AddUserModel < ActiveRecord::Migration[4.2]
def change
create_table :users do |t|
t.string :email
t.string :password_digest
t.timestamps null: false
end
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20130425211008_add_setup_complete_to_user.rb | db/migrate/20130425211008_add_setup_complete_to_user.rb | # frozen_string_literal: true
class AddSetupCompleteToUser < ActiveRecord::Migration[4.2]
def change
add_column :users, :setup_complete, :boolean
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20130409010826_create_stories.rb | db/migrate/20130409010826_create_stories.rb | # frozen_string_literal: true
class CreateStories < ActiveRecord::Migration[4.2]
def change
create_table :stories do |t|
t.string :title
t.string :permalink
t.text :body
t.references :feed
t.timestamps null: false
end
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20240314031220_create_good_job_labels.rb | db/migrate/20240314031220_create_good_job_labels.rb | # frozen_string_literal: true
class CreateGoodJobLabels < ActiveRecord::Migration[7.1]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.column_exists?(:good_jobs, :labels)
... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20230801025233_create_good_job_executions.rb | db/migrate/20230801025233_create_good_job_executions.rb | # frozen_string_literal: true
class CreateGoodJobExecutions < ActiveRecord::Migration[7.0]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.table_exists?(:good_job_executions)
... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20230221233057_add_user_id_to_tables.rb | db/migrate/20230221233057_add_user_id_to_tables.rb | # frozen_string_literal: true
class AddUserIdToTables < ActiveRecord::Migration[7.0]
def change
add_reference :feeds, :user, index: true, foreign_key: true
add_reference :groups, :user, index: true, foreign_key: true
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20240314031223_create_index_good_job_jobs_for_candidate_lookup.rb | db/migrate/20240314031223_create_index_good_job_jobs_for_candidate_lookup.rb | # frozen_string_literal: true
class CreateIndexGoodJobJobsForCandidateLookup < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if co... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20230223045525_add_null_false_to_associations.rb | db/migrate/20230223045525_add_null_false_to_associations.rb | # frozen_string_literal: true
class AddNullFalseToAssociations < ActiveRecord::Migration[7.0]
def change
update_null_foreign_keys
change_column_null :feeds, :user_id, false
change_column_null :groups, :user_id, false
change_column_null :stories, :feed_id, false
end
private
def update_null_fo... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20230120222742_drop_setup_complete.rb | db/migrate/20230120222742_drop_setup_complete.rb | # frozen_string_literal: true
class DropSetupComplete < ActiveRecord::Migration[7.0]
def change
remove_column :users, :setup_complete, :boolean
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20230721160939_create_settings.rb | db/migrate/20230721160939_create_settings.rb | # frozen_string_literal: true
class CreateSettings < ActiveRecord::Migration[7.0]
def change
create_table :settings do |t|
t.string :type, null: false, index: { unique: true }
t.jsonb :data, null: false, default: {}
t.timestamps
end
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20130423180446_remove_author_from_stories.rb | db/migrate/20130423180446_remove_author_from_stories.rb | # frozen_string_literal: true
class RemoveAuthorFromStories < ActiveRecord::Migration[4.2]
def up
remove_column :stories, :author
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20230305010750_create_good_jobs.rb | db/migrate/20230305010750_create_good_jobs.rb | # frozen_string_literal: true
class CreateGoodJobs < ActiveRecord::Migration[7.0]
def change
enable_extension "pgcrypto"
create_table :good_jobs, id: :uuid do |t|
t.text :queue_name
t.integer :priority
t.jsonb :serialized_params
t.datetime :scheduled_at
t.datetime :performed_at... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20230313034938_add_admin_to_users.rb | db/migrate/20230313034938_add_admin_to_users.rb | # frozen_string_literal: true
class AddAdminToUsers < ActiveRecord::Migration[7.0]
def change
add_column :users, :admin, :boolean, default: false
set_first_user_as_admin
change_column_null :users, :admin, false
end
private
def set_first_user_as_admin
first_user_id = connection.select_value(... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20230224042638_update_unique_indexes.rb | db/migrate/20230224042638_update_unique_indexes.rb | # frozen_string_literal: true
class UpdateUniqueIndexes < ActiveRecord::Migration[7.0]
def change
remove_index :feeds, :url
add_index :feeds, [:url, :user_id], unique: true
add_index :groups, [:name, :user_id], unique: true
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20140421224454_fix_invalid_unicode.rb | db/migrate/20140421224454_fix_invalid_unicode.rb | # frozen_string_literal: true
class FixInvalidUnicode < ActiveRecord::Migration[4.2]
def up
Story.find_each do |story|
valid_body = story.body.delete("\u2028").delete("\u2029")
story.update_attribute(:body, valid_body)
end
end
def down
# skip
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20130730120312_add_entry_id_to_stories.rb | db/migrate/20130730120312_add_entry_id_to_stories.rb | # frozen_string_literal: true
class AddEntryIdToStories < ActiveRecord::Migration[4.2]
def change
add_column :stories, :entry_id, :string
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20130905204142_use_text_datatype_for_title_and_entry_id.rb | db/migrate/20130905204142_use_text_datatype_for_title_and_entry_id.rb | # frozen_string_literal: true
class UseTextDatatypeForTitleAndEntryId < ActiveRecord::Migration[4.2]
def up
change_column :stories, :title, :text
change_column :stories, :entry_id, :text
end
def down
change_column :stories, :title, :string
change_column :stories, :entry_id, :string
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20130412185253_add_new_fields_to_stories.rb | db/migrate/20130412185253_add_new_fields_to_stories.rb | # frozen_string_literal: true
class AddNewFieldsToStories < ActiveRecord::Migration[4.2]
def change
add_column :stories, :published, :timestamp
add_column :stories, :is_read, :boolean
add_column :stories, :author, :string
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20230801025230_create_good_job_settings.rb | db/migrate/20230801025230_create_good_job_settings.rb | # frozen_string_literal: true
class CreateGoodJobSettings < ActiveRecord::Migration[7.0]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.table_exists?(:good_job_settings)
... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20130513044029_add_is_starred_status_for_stories.rb | db/migrate/20130513044029_add_is_starred_status_for_stories.rb | # frozen_string_literal: true
class AddIsStarredStatusForStories < ActiveRecord::Migration[4.2]
def change
add_column :stories, :is_starred, :boolean, default: false
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20240709172405_create_good_job_execution_error_backtrace.rb | db/migrate/20240709172405_create_good_job_execution_error_backtrace.rb | # frozen_string_literal: true
class CreateGoodJobExecutionErrorBacktrace < ActiveRecord::Migration[7.1]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
if connection.column_exists?(:good_job_execu... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20240226201050_add_precision_to_timestamps.rb | db/migrate/20240226201050_add_precision_to_timestamps.rb | # frozen_string_literal: true
class AddPrecisionToTimestamps < ActiveRecord::Migration[7.1]
SKIP_TABLES = [:schema_migrations, :ar_internal_metadata].freeze
def up
migrate_precision(precision: 6)
end
def down
migrate_precision(precision: nil)
end
def migrate_precision(precision:)
table_names... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20240313195404_add_default_to_stories.rb | db/migrate/20240313195404_add_default_to_stories.rb | # frozen_string_literal: true
class AddDefaultToStories < ActiveRecord::Migration[7.1]
def change
change_column_default :stories, :is_read, from: nil, to: false
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20230801025231_create_index_good_jobs_jobs_on_priority_created_at_when_unfinished.rb | db/migrate/20230801025231_create_index_good_jobs_jobs_on_priority_created_at_when_unfinished.rb | # frozen_string_literal: true
class CreateIndexGoodJobsJobsOnPriorityCreatedAtWhenUnfinished < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20240314031222_remove_good_job_active_id_index.rb | db/migrate/20240314031222_remove_good_job_active_id_index.rb | # frozen_string_literal: true
class RemoveGoodJobActiveIdIndex < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_active_job_id)
remove_index :good_jobs, name: :index_good_job... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20130522014405_add_api_key_to_user.rb | db/migrate/20130522014405_add_api_key_to_user.rb | # frozen_string_literal: true
class AddAPIKeyToUser < ActiveRecord::Migration[4.2]
def change
add_column :users, :api_key, :string
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20130513025939_add_keep_unread_to_stories.rb | db/migrate/20130513025939_add_keep_unread_to_stories.rb | # frozen_string_literal: true
class AddKeepUnreadToStories < ActiveRecord::Migration[4.2]
def change
add_column :stories, :keep_unread, :boolean, default: false
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20230330215830_create_subscriptions.rb | db/migrate/20230330215830_create_subscriptions.rb | # frozen_string_literal: true
class CreateSubscriptions < ActiveRecord::Migration[7.0]
def change
create_table :subscriptions do |t|
t.references :user,
foreign_key: true,
null: false,
index: { unique: true }
t.text :stripe_customer_id, null: f... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20130429232127_add_status_to_feeds.rb | db/migrate/20130429232127_add_status_to_feeds.rb | # frozen_string_literal: true
class AddStatusToFeeds < ActiveRecord::Migration[4.2]
def change
add_column :feeds, :status, :int
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20141102103617_fix_invalid_titles_with_unicode_line_endings.rb | db/migrate/20141102103617_fix_invalid_titles_with_unicode_line_endings.rb | # frozen_string_literal: true
class FixInvalidTitlesWithUnicodeLineEndings < ActiveRecord::Migration[4.2]
def up
Story.find_each do |story|
unless story.title.nil?
valid_title = story.title.delete("\u2028").delete("\u2029")
story.update_attribute(:title, valid_title)
end
end
end... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20130423001740_drop_email_from_user.rb | db/migrate/20130423001740_drop_email_from_user.rb | # frozen_string_literal: true
class DropEmailFromUser < ActiveRecord::Migration[4.2]
def up
remove_column :users, :email
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20240709172407_create_good_job_process_lock_indexes.rb | db/migrate/20240709172407_create_good_job_process_lock_indexes.rb | # frozen_string_literal: true
class CreateGoodJobProcessLockIndexes < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked)
add_index... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20130821020313_update_nil_entry_ids.rb | db/migrate/20130821020313_update_nil_entry_ids.rb | # frozen_string_literal: true
class UpdateNilEntryIds < ActiveRecord::Migration[4.2]
def up
Story.where(entry_id: nil).find_each do |story|
story.entry_id = story.permalink || story.id
story.save
end
end
def down
# skip
end
end
| ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20240314031221_create_good_job_labels_index.rb | db/migrate/20240314031221_create_good_job_labels_index.rb | # frozen_string_literal: true
class CreateGoodJobLabelsIndex < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_labels)
add_index :good_jobs, :labels, using: :gin, where: ... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
stringer-rss/stringer | https://github.com/stringer-rss/stringer/blob/9b7a95c9c5b8aaec6ab87359583e3ee49279422c/db/migrate/20240314031219_recreate_good_job_cron_indexes_with_conditional.rb | db/migrate/20240314031219_recreate_good_job_cron_indexes_with_conditional.rb | # frozen_string_literal: true
class RecreateGoodJobCronIndexesWithConditional < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_created_at_cond)
add_index :g... | ruby | MIT | 9b7a95c9c5b8aaec6ab87359583e3ee49279422c | 2026-01-04T15:47:22.789280Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.