├── .nvmrc ├── log └── .keep ├── lib ├── assets │ └── .keep └── templates │ └── haml │ └── scaffold │ └── _form.html.haml ├── .ruby-version ├── public ├── sw.js ├── 500.html ├── badge.png ├── oops.gif ├── favicon.ico ├── qiitan-cry.png ├── emoji │ └── sheet.png ├── favicon-dev.ico ├── sounds │ ├── boop.mp3 │ └── boop.ogg ├── mstile-150x150.png ├── apple-touch-icon.png ├── web-push-icon_expand.png ├── web-push-icon_reblog.png ├── android-chrome-192x192.png ├── web-push-icon_favourite.png ├── avatars │ └── original │ │ └── missing.png ├── headers │ └── original │ │ └── missing.png ├── robots.txt └── browserconfig.xml ├── app ├── javascript │ ├── mastodon │ │ ├── .gitkeep │ │ ├── locales │ │ │ ├── whitelist_ar.json │ │ │ ├── whitelist_bg.json │ │ │ ├── whitelist_ca.json │ │ │ ├── whitelist_de.json │ │ │ ├── whitelist_en.json │ │ │ ├── whitelist_eo.json │ │ │ ├── whitelist_es.json │ │ │ ├── whitelist_fa.json │ │ │ ├── whitelist_fi.json │ │ │ ├── whitelist_fr.json │ │ │ ├── whitelist_gl.json │ │ │ ├── whitelist_he.json │ │ │ ├── whitelist_hr.json │ │ │ ├── whitelist_hu.json │ │ │ ├── whitelist_hy.json │ │ │ ├── whitelist_id.json │ │ │ ├── whitelist_io.json │ │ │ ├── whitelist_it.json │ │ │ ├── whitelist_ja.json │ │ │ ├── whitelist_ko.json │ │ │ ├── whitelist_nl.json │ │ │ ├── whitelist_no.json │ │ │ ├── whitelist_oc.json │ │ │ ├── whitelist_pl.json │ │ │ ├── whitelist_pt.json │ │ │ ├── whitelist_ru.json │ │ │ ├── whitelist_sk.json │ │ │ ├── whitelist_sr.json │ │ │ ├── whitelist_sv.json │ │ │ ├── whitelist_th.json │ │ │ ├── whitelist_tr.json │ │ │ ├── whitelist_uk.json │ │ │ ├── whitelist_pt-BR.json │ │ │ ├── whitelist_sr-Latn.json │ │ │ ├── whitelist_zh-CN.json │ │ │ ├── whitelist_zh-HK.json │ │ │ ├── whitelist_zh-TW.json │ │ │ └── index.js │ │ ├── extra_polyfills.js │ │ ├── test_setup.js │ │ ├── uuid.js │ │ ├── features │ │ │ ├── emoji │ │ │ │ └── emoji_picker.js │ │ │ ├── ui │ │ │ │ ├── util │ │ │ │ │ └── optional_motion.js │ │ │ │ ├── components │ │ │ │ │ ├── drawer_loading.js │ │ │ │ │ └── column_subheading.js │ │ │ │ └── containers │ │ │ │ │ ├── alert_bar_container.js │ │ │ │ │ ├── loading_bar_container.js │ │ │ │ │ └── columns_area_container.js │ │ │ ├── status │ │ │ │ └── containers │ │ │ │ │ └── card_container.js │ │ │ ├── compose │ │ │ │ ├── containers │ │ │ │ │ ├── search_results_container.js │ │ │ │ │ ├── upload_form_container.js │ │ │ │ │ ├── upload_progress_container.js │ │ │ │ │ └── navigation_container.js │ │ │ │ └── util │ │ │ │ │ └── counter.js │ │ │ └── generic_not_found │ │ │ │ └── index.js │ │ ├── ready.js │ │ ├── actions │ │ │ ├── emojis.js │ │ │ ├── dropdown_menu.js │ │ │ ├── modal.js │ │ │ └── height_cache.js │ │ ├── components │ │ │ └── loading_indicator.js │ │ └── reducers │ │ │ └── cards.js │ ├── packs │ │ ├── mailer.js │ │ ├── common.js │ │ └── application.js │ ├── images │ │ ├── void.png │ │ ├── preview.jpg │ │ ├── qiitan.png │ │ ├── reticle.png │ │ ├── qiita-icon.png │ │ ├── qiitan-cry.png │ │ ├── elephant-fren.png │ │ ├── qiitan-gray.png │ │ ├── mailer │ │ │ ├── icon_cached.png │ │ │ ├── icon_done.png │ │ │ ├── icon_email.png │ │ │ ├── icon_grade.png │ │ │ ├── icon_reply.png │ │ │ ├── logo_full.png │ │ │ ├── icon_lock_open.png │ │ │ ├── icon_person_add.png │ │ │ ├── logo_transparent.png │ │ │ └── icon_file_download.png │ │ ├── qiitan_gettingstarted.png │ │ ├── qiitadon-getting-started.png │ │ ├── icon_done.svg │ │ ├── icon_file_download.svg │ │ ├── icon_reply.svg │ │ ├── icon_grade.svg │ │ ├── icon_email.svg │ │ ├── icon_person_add.svg │ │ └── icon_lock_open.svg │ ├── styles │ │ ├── custom │ │ │ ├── variables.scss │ │ │ ├── wide_screen.scss │ │ │ ├── alert.scss │ │ │ └── code.scss │ │ ├── theme-base.scss │ │ ├── custom.scss │ │ ├── themes.scss │ │ ├── mastodon │ │ │ ├── _mixins.scss │ │ │ └── lists.scss │ │ └── theme-base │ │ │ └── accounts.scss │ └── fonts │ │ ├── roboto │ │ ├── roboto-bold-webfont.ttf │ │ ├── roboto-bold-webfont.woff │ │ ├── roboto-bold-webfont.woff2 │ │ ├── roboto-italic-webfont.ttf │ │ ├── roboto-italic-webfont.woff │ │ ├── roboto-medium-webfont.ttf │ │ ├── roboto-medium-webfont.woff │ │ ├── roboto-regular-webfont.ttf │ │ ├── roboto-italic-webfont.woff2 │ │ ├── roboto-medium-webfont.woff2 │ │ ├── roboto-regular-webfont.woff │ │ └── roboto-regular-webfont.woff2 │ │ ├── montserrat │ │ ├── Montserrat-Medium.ttf │ │ ├── Montserrat-Regular.ttf │ │ ├── Montserrat-Regular.woff │ │ └── Montserrat-Regular.woff2 │ │ └── roboto-mono │ │ ├── robotomono-regular-webfont.ttf │ │ ├── robotomono-regular-webfont.woff │ │ └── robotomono-regular-webfont.woff2 ├── views │ ├── layouts │ │ ├── plain_mailer.html.haml │ │ └── mailer.text.erb │ ├── about │ │ ├── _registration.html.haml │ │ └── terms.html.haml │ ├── accounts │ │ ├── _nothing_here.html.haml │ │ └── _follow_grid.html.haml │ ├── stream_entries │ │ ├── _og_description.html.haml │ │ ├── embed.html.haml │ │ ├── _content_spoiler.html.haml │ │ └── _media.html.haml │ ├── authorize_follows │ │ ├── error.html.haml │ │ └── show.html.haml │ ├── application │ │ └── _flashes.html.haml │ ├── errors │ │ ├── 403.html.haml │ │ ├── 404.html.haml │ │ ├── 410.html.haml │ │ ├── 422.html.haml │ │ └── 500.html.haml │ ├── shared │ │ ├── _qiita_authentication.html.haml │ │ ├── _error_messages.html.haml │ │ └── _landing_strip.html.haml │ ├── oauth │ │ └── authorizations │ │ │ ├── error.html.haml │ │ │ └── show.html.haml │ ├── admin │ │ ├── action_logs │ │ │ └── index.html.haml │ │ ├── email_domain_blocks │ │ │ ├── _email_domain_block.html.haml │ │ │ ├── new.html.haml │ │ │ └── index.html.haml │ │ ├── instances │ │ │ └── _instance.html.haml │ │ └── domain_blocks │ │ │ └── _domain_block.html.haml │ ├── user_mailer │ │ ├── backup_ready.text.erb │ │ ├── password_change.text.erb │ │ ├── email_changed.text.erb │ │ ├── reconfirmation_instructions.text.erb │ │ └── reset_password_instructions.text.erb │ ├── notification_mailer │ │ ├── reblog.text.erb │ │ ├── favourite.text.erb │ │ ├── mention.text.erb │ │ ├── _status.text.erb │ │ ├── follow.text.erb │ │ └── follow_request.text.erb │ ├── well_known │ │ └── host_meta │ │ │ └── show.xml.ruby │ ├── shares │ │ └── show.html.haml │ ├── admin_mailer │ │ └── new_report.text.erb │ ├── settings │ │ ├── applications │ │ │ └── new.html.haml │ │ ├── two_factor_authentication │ │ │ └── recovery_codes │ │ │ │ └── index.html.haml │ │ └── qiita_authorizations │ │ │ └── show.html.haml │ ├── tags │ │ └── _og.html.haml │ ├── invites │ │ └── index.html.haml │ └── media │ │ └── player.html.haml ├── helpers │ ├── mailer_helper.rb │ ├── admin │ │ └── account_moderation_notes_helper.rb │ ├── home_helper.rb │ ├── flashes_helper.rb │ └── instance_helper.rb ├── models │ ├── web.rb │ ├── admin.rb │ ├── application_record.rb │ ├── context.rb │ ├── search.rb │ ├── form │ │ ├── delete_confirmation.rb │ │ └── two_factor_confirmation.rb │ ├── list_feed.rb │ ├── instance.rb │ ├── conversation_mute.rb │ ├── concerns │ │ ├── cacheable.rb │ │ └── relationship_cacheable.rb │ └── qiita_authorization.rb ├── policies │ ├── subscription_policy.rb │ ├── settings_policy.rb │ ├── instance_policy.rb │ ├── report_policy.rb │ ├── backup_policy.rb │ ├── email_domain_block_policy.rb │ ├── domain_block_policy.rb │ └── account_moderation_note_policy.rb ├── lib │ ├── settings │ │ └── extend.rb │ ├── application_extension.rb │ ├── hash_object.rb │ ├── themes.rb │ ├── sidekiq_error_handler.rb │ ├── fast_geometry_parser.rb │ ├── ostatus │ │ └── activity │ │ │ └── remote.rb │ └── activitypub │ │ └── activity │ │ └── update.rb ├── services │ ├── base_service.rb │ ├── concerns │ │ └── stream_entry_renderer.rb │ ├── precompute_feed_service.rb │ ├── block_domain_from_account_service.rb │ ├── unmute_service.rb │ └── mute_service.rb ├── serializers │ ├── rest │ │ ├── list_serializer.rb │ │ ├── report_serializer.rb │ │ ├── context_serializer.rb │ │ ├── search_serializer.rb │ │ ├── credential_account_serializer.rb │ │ └── custom_emoji_serializer.rb │ └── activitypub │ │ └── outbox_serializer.rb ├── controllers │ ├── manifests_controller.rb │ ├── admin │ │ ├── action_logs_controller.rb │ │ └── base_controller.rb │ ├── api │ │ └── v1 │ │ │ ├── instances_controller.rb │ │ │ ├── custom_emojis_controller.rb │ │ │ └── apps │ │ │ └── credentials_controller.rb │ ├── concerns │ │ ├── signature_authentication.rb │ │ ├── accountable_concern.rb │ │ └── obfuscate_filename.rb │ ├── account_follow_controller.rb │ ├── account_unfollow_controller.rb │ ├── settings │ │ ├── qiita_authorizations_controller.rb │ │ └── exports │ │ │ ├── muted_accounts_controller.rb │ │ │ ├── blocked_accounts_controller.rb │ │ │ └── following_accounts_controller.rb │ └── oauth │ │ └── authorizations_controller.rb ├── presenters │ ├── activitypub │ │ └── collection_presenter.rb │ └── initial_state_presenter.rb ├── workers │ ├── bootstrap_timeline_worker.rb │ ├── block_worker.rb │ ├── removal_worker.rb │ ├── resolve_account_worker.rb │ ├── distribution_worker.rb │ ├── scheduler │ │ ├── subscriptions_cleanup_scheduler.rb │ │ ├── backup_cleanup_scheduler.rb │ │ ├── ip_cleanup_scheduler.rb │ │ ├── media_cleanup_scheduler.rb │ │ ├── doorkeeper_cleanup_scheduler.rb │ │ ├── subscriptions_scheduler.rb │ │ └── user_cleanup_scheduler.rb │ ├── domain_block_worker.rb │ ├── processing_worker.rb │ ├── unfavourite_worker.rb │ ├── merge_worker.rb │ ├── admin │ │ └── suspension_worker.rb │ ├── link_crawl_worker.rb │ ├── unmerge_worker.rb │ ├── activitypub │ │ ├── processing_worker.rb │ │ ├── synchronize_featured_collection_worker.rb │ │ └── post_upgrade_worker.rb │ ├── notification_worker.rb │ ├── salmon_worker.rb │ ├── regeneration_worker.rb │ ├── remote_profile_update_worker.rb │ └── authorize_follow_worker.rb └── mailers │ └── application_mailer.rb ├── config ├── initializers │ ├── pagination.rb │ ├── oj.rb │ ├── strong_migrations.rb │ ├── active_model_serializers.rb │ ├── suppress_csrf_warnings.rb │ ├── fast_blank.rb │ ├── httplog.rb │ ├── oembed.rb │ ├── single_user_mode.rb │ ├── timeout.rb │ ├── session_activations.rb │ ├── kaminari_config.rb │ ├── json_ld.rb │ ├── application_controller_renderer.rb │ ├── session_store.rb │ ├── blacklists.rb │ ├── filter_parameter_logging.rb │ ├── cookies_serializer.rb │ ├── open_uri_redirection.rb │ ├── premailer_rails.rb │ ├── raven.rb │ ├── trusted_proxies.rb │ ├── mime_types.rb │ ├── redis.rb │ └── backtrace_silencers.rb ├── themes.yml ├── webpack │ ├── loaders │ │ ├── mark.js │ │ ├── assets.js │ │ └── babel.js │ └── test.js ├── environment.rb └── locales │ ├── activerecord.zh-CN.yml │ ├── activerecord.fa.yml │ ├── activerecord.ar.yml │ ├── activerecord.gl.yml │ ├── activerecord.he.yml │ ├── activerecord.sr.yml │ ├── activerecord.ca.yml │ ├── activerecord.es.yml │ ├── activerecord.pt.yml │ ├── activerecord.sk.yml │ ├── activerecord.en.yml │ ├── activerecord.id.yml │ ├── activerecord.it.yml │ ├── activerecord.nl.yml │ ├── activerecord.oc.yml │ ├── activerecord.pt-BR.yml │ ├── activerecord.ru.yml │ ├── activerecord.sr-Latn.yml │ ├── activerecord.th.yml │ ├── activerecord.uk.yml │ ├── activerecord.de.yml │ ├── activerecord.no.yml │ ├── activerecord.fr.yml │ ├── activerecord.ja.yml │ └── activerecord.pl.yml ├── vendor └── assets │ ├── javascripts │ └── .keep │ └── stylesheets │ └── .keep ├── .foreman ├── .env.vagrant ├── .slugignore ├── .rspec ├── spec ├── fabricators │ ├── import_fabricator.rb │ ├── backup_fabricator.rb │ ├── conversation_fabricator.rb │ ├── site_upload_fabricator.rb │ ├── web_setting_fabricator.rb │ ├── conversation_mute_fabricator.rb │ ├── mention_fabricator.rb │ ├── favourite_fabricator.rb │ ├── list_fabricator.rb │ ├── status_pin_fabricator.rb │ ├── setting_fabricator.rb │ ├── access_token_fabricator.rb │ ├── mute_fabricator.rb │ ├── block_fabricator.rb │ ├── follow_fabricator.rb │ ├── list_account_fabricator.rb │ ├── notification_fabricator.rb │ ├── session_activation_fabricator.rb │ ├── tag_fabricator.rb │ ├── account_domain_block_fabricator.rb │ ├── account_moderation_note_fabricator.rb │ ├── identity_fabricator.rb │ ├── invite_fabricator.rb │ ├── admin_action_log_fabricator.rb │ ├── follow_request_fabricator.rb │ ├── domain_block_fabricator.rb │ ├── accessible_access_token_fabricator.rb │ ├── email_domain_block_fabricator.rb │ ├── stream_entry_fabricator.rb │ ├── report_fabricator.rb │ ├── qiita_authorization_fabricator.rb │ ├── account_fabricator.rb │ ├── custom_emoji_fabricator.rb │ ├── web_push_subscription_fabricator.rb │ ├── user_fabricator.rb │ ├── application_fabricator.rb │ ├── subscription_fabricator.rb │ └── status_fabricator.rb ├── fixtures │ ├── files │ │ ├── imports.txt │ │ ├── emojo.png │ │ ├── avatar.gif │ │ ├── attachment.gif │ │ ├── attachment.jpg │ │ ├── attachment.webm │ │ └── mini-static.gif │ └── requests │ │ ├── sjis.txt │ │ ├── avatar.txt │ │ ├── koi8-r.txt │ │ ├── attachment1.txt │ │ ├── attachment2.txt │ │ ├── oembed_undiscoverable.html │ │ ├── sjis_with_wrong_charset.txt │ │ ├── oembed_invalid_xml.html │ │ ├── oembed_json.html │ │ └── oembed_xml.html ├── models │ ├── list_spec.rb │ ├── mute_spec.rb │ ├── backup_spec.rb │ ├── list_account_spec.rb │ ├── preview_card_spec.rb │ ├── web │ │ └── setting_spec.rb │ ├── admin │ │ └── action_log_spec.rb │ ├── conversation_mute_spec.rb │ ├── account_moderation_note_spec.rb │ ├── identity_spec.rb │ ├── oauth_authorization_spec.rb │ ├── site_upload_spec.rb │ └── conversation_spec.rb ├── services │ ├── unmute_service_spec.rb │ ├── activitypub │ │ └── process_account_service_spec.rb │ └── send_interaction_service_spec.rb ├── controllers │ ├── admin │ │ └── account_moderation_notes_controller_spec.rb │ ├── activitypub │ │ └── inboxes_controller_spec.rb │ └── manifests_controller_spec.rb ├── lib │ ├── hash_object_spec.rb │ └── settings │ │ └── extend_spec.rb ├── helpers │ └── home_helper_spec.rb ├── support │ ├── examples │ │ └── lib │ │ │ └── settings │ │ │ └── settings_extended.rb │ └── matchers │ │ └── model │ │ └── model_have_error_on_field.rb └── requests │ └── host_meta_request_spec.rb ├── .env.test ├── Procfile ├── bin ├── rake ├── bundle └── rails ├── Procfile.dev.docker ├── docs ├── README.md ├── Extensions.md ├── Using-the-API │ ├── API.md │ ├── OAuth-details.md │ ├── Streaming-API.md │ ├── Push-notifications.md │ ├── Testing-with-cURL.md │ └── Tips-for-app-developers.md ├── Specs-and-RFCs-used.md ├── Using-Mastodon │ ├── 2FA.md │ ├── Apps.md │ ├── FAQ.md │ ├── User-guide.md │ └── List-of-Mastodon-instances.md ├── Running-Mastodon │ ├── Tuning.md │ ├── Heroku-guide.md │ ├── Scalingo-guide.md │ ├── Vagrant-guide.md │ ├── Development-guide.md │ ├── Production-guide.md │ └── Administration-guide.md └── Contributing-to-Mastodon │ ├── Sponsors.md │ └── Translating.md ├── .buildpacks ├── .profile ├── db └── migrate │ ├── 20170205175257_remove_devices.rb │ ├── 20161116162355_add_locale_to_users.rb │ ├── 20170516072309_add_index_accounts_on_uri.rb │ ├── 20160325130944_add_admin_to_users.rb │ ├── 20170405112956_add_index_on_mentions_status_id.rb │ ├── 20160223165723_add_url_to_statuses.rb │ ├── 20160223165855_add_url_to_accounts.rb │ ├── 20170114194937_add_application_to_statuses.rb │ ├── 20170425131920_add_media_attachment_meta.rb │ ├── 20170714184731_add_domain_to_subscriptions.rb │ ├── 20170424112722_add_status_id_index_to_statuses_tags.rb │ ├── 20170905165803_add_local_to_statuses.rb │ ├── 20161123093447_add_sensitive_to_statuses.rb │ ├── 20180109143959_add_remember_token_to_users.rb │ ├── 20161222201034_add_locked_to_accounts.rb │ ├── 20170114203041_add_website_to_oauth_application.rb │ ├── 20170123162658_add_severity_to_domain_blocks.rb │ ├── 20170123203248_add_reject_media_to_domain_blocks.rb │ ├── 20170414132105_add_language_to_statuses.rb │ ├── 20161027172456_add_silenced_to_accounts.rb │ ├── 20161130185319_add_visibility_to_statuses.rb │ ├── 20161205214545_add_suspended_to_accounts.rb │ ├── 20170409170753_add_last_webfingered_at_to_accounts.rb │ ├── 20170601210557_add_index_on_media_attachments_account_id.rb │ ├── 20170927215609_add_description_to_media_attachments.rb │ ├── 20160223164502_make_uris_nullable_in_statuses.rb │ ├── 20170125145934_add_spoiler_text_to_statuses.rb │ ├── 20170303212857_add_last_emailed_at_to_users.rb │ ├── 20161221152630_add_hidden_to_stream_entries.rb │ ├── 20180304013859_add_featured_collection_url_to_accounts.rb │ ├── 20170403172249_add_action_taken_by_account_id_to_reports.rb │ ├── 20170824103029_add_timestamps_to_status_pins.rb │ ├── 20171010023049_add_foreign_key_to_account_moderation_notes.rb │ ├── 20160322193748_add_avatar_remote_url_to_accounts.rb │ ├── 20160920003904_remove_verify_token_from_accounts.rb │ ├── 20170318214217_add_header_remote_url_to_accounts.rb │ ├── 20170414080609_add_devise_two_factor_backupable_to_users.rb │ ├── 20170517123337_add_dummy_password_flag_to_user.rb │ ├── 20170418160728_add_indexes_to_reports_for_accounts.rb │ ├── 20170609145826_remove_default_language_from_statuses.rb │ ├── 20160826155805_add_superapp_to_oauth_applications.rb │ ├── 20170829215220_remove_status_pins_account_index.rb │ ├── 20171006142024_add_uri_to_custom_emojis.rb │ ├── 20171125031751_add_invite_id_to_users.rb │ ├── 20170217012631_add_reblog_of_id_foreign_key_to_statuses.rb │ ├── 20180206000000_change_user_id_nonnullable.rb │ ├── 20160919221059_add_subscription_expires_at_to_accounts.rb │ ├── 20170713190709_add_web_push_subscription_to_session_activations.rb │ ├── 20170924022025_ids_to_bigints2.rb │ ├── 20160223162837_add_metadata_to_statuses.rb │ ├── 20170507000211_add_conversation_id_to_statuses.rb │ ├── 20161130142058_add_last_successful_delivery_at_to_subscriptions.rb │ ├── 20170720000000_add_index_favourites_on_account_id_and_id.rb │ ├── 20170905044538_add_index_id_account_id_activity_type_on_notifications.rb │ ├── 20170928082043_create_email_domain_blocks.rb │ ├── 20170901142658_create_join_table_preview_cards_statuses.rb │ ├── 20171020084748_add_visible_in_picker_to_custom_emoji.rb │ ├── 20161105130633_create_statuses_tags_join_table.rb │ ├── 20171201000000_change_account_id_nonnullable_in_lists.rb │ ├── 20170423005413_add_allowed_languages_to_user.rb │ ├── 20171125185353_add_index_reblog_of_id_and_account_to_statuses.rb │ ├── 20161104173623_create_tags.rb │ ├── 20170406215816_add_notifications_and_favourites_indices.rb │ ├── 20171212195226_remove_duplicate_indexes_in_lists.rb │ ├── 20170330164118_add_attachment_data_to_imports.rb │ ├── 20170330163835_create_imports.rb │ ├── 20171114231651_create_lists.rb │ ├── 20160227230233_add_attachment_avatar_to_accounts.rb │ ├── 20160312193225_add_attachment_header_to_accounts.rb │ ├── 20161009120834_create_domain_blocks.rb │ ├── 20160222122600_create_stream_entries.rb │ ├── 20170109120109_create_web_settings.rb │ ├── 20170322162804_add_search_index_to_tags.rb │ ├── 20171118012443_add_moved_to_account_id_to_accounts.rb │ ├── 20160314164231_add_owner_to_application.rb │ ├── 20170506235850_create_conversations.rb │ ├── 20170913000752_create_site_uploads.rb │ ├── 20170209184350_add_reply_to_statuses.rb │ ├── 20171010025614_change_accounts_nonnullable_in_account_moderation_notes.rb │ ├── 20170625140443_add_access_token_id_to_session_activations.rb │ ├── 20171129172043_add_index_on_stream_entries.rb │ ├── 20160221003140_create_users.rb │ ├── 20160224223247_create_mentions.rb │ ├── 20180211015820_create_backups.rb │ ├── 20160222143943_add_profile_fields_to_accounts.rb │ ├── 20160926213048_remove_owner_from_application.rb │ ├── 20171114080328_add_index_domain_to_email_domain_blocks.rb │ ├── 20161122163057_remove_unneeded_indexes.rb │ ├── 20170624134742_add_description_to_session_activations.rb │ ├── 20170504103736_create_qiita_authorizations.rb │ ├── 20170301222600_create_mutes.rb │ ├── 20180204034416_create_identities.rb │ ├── 20170322021028_add_lowercase_index_to_accounts.rb │ ├── 20170424003227_create_account_domain_blocks.rb │ ├── 20160221003621_create_follows.rb │ ├── 20160223171800_create_favourites.rb │ ├── 20161003145426_create_blocks.rb │ ├── 20170508230434_create_conversation_mutes.rb │ ├── 20171226094803_more_faster_index_on_notifications.rb │ ├── 20170713175513_create_web_push_subscriptions.rb │ ├── 20170129000348_create_devices.rb │ ├── 20160316103650_add_missing_indices.rb │ ├── 20170520145338_change_language_filter_to_opt_out.rb │ ├── 20170917153509_create_custom_emojis.rb │ ├── 20160220211917_create_statuses.rb │ ├── 20161003142332_add_confirmable_to_users.rb │ ├── 20161222204147_create_follow_requests.rb │ ├── 20170823162448_create_status_pins.rb │ ├── 20170427011934_re_add_owner_to_application.rb │ ├── 20170623152212_create_session_activations.rb │ ├── 20170127165745_add_devise_two_factor_to_users.rb │ ├── 20171005102658_create_account_moderation_notes.rb │ ├── 20171107143624_add_disabled_to_users.rb │ ├── 20160905150353_create_media_attachments.rb │ ├── 20170507141759_optimize_index_subscriptions.rb │ ├── 20171107143332_add_memorial_to_accounts.rb │ ├── 20171109012327_add_moderator_to_accounts.rb │ └── 20171119172437_create_admin_action_logs.rb ├── Aptfile ├── .dockerignore ├── config.ru ├── Procfile.dev ├── .postcssrc.yml ├── Rakefile ├── .nanoignore ├── .editorconfig ├── .github └── ISSUE_TEMPLATE.md └── Capfile /.nvmrc: -------------------------------------------------------------------------------- 1 | 6 2 | -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.5.0 2 | -------------------------------------------------------------------------------- /public/sw.js: -------------------------------------------------------------------------------- 1 | assets/sw.js -------------------------------------------------------------------------------- /app/javascript/mastodon/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config/initializers/pagination.rb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | assets/500.html -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.foreman: -------------------------------------------------------------------------------- 1 | procfile: Procfile.dev 2 | -------------------------------------------------------------------------------- /app/views/layouts/plain_mailer.html.haml: -------------------------------------------------------------------------------- 1 | = yield 2 | -------------------------------------------------------------------------------- /.env.vagrant: -------------------------------------------------------------------------------- 1 | VAGRANT=true 2 | LOCAL_DOMAIN=mastodon.dev -------------------------------------------------------------------------------- /.slugignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .cache/ 3 | docs/ 4 | spec/ 5 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_ar.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_bg.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_ca.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_de.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_en.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_eo.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_es.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_fa.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_fi.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_fr.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_gl.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_he.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_hr.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_hu.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_hy.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_id.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_io.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_it.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_ja.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_ko.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_nl.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_no.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_oc.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_pl.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_pt.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_ru.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_sk.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_sr.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_sv.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_th.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_tr.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_uk.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | --format Fuubar 4 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_pt-BR.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_sr-Latn.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_zh-CN.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_zh-HK.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/whitelist_zh-TW.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /app/javascript/packs/mailer.js: -------------------------------------------------------------------------------- 1 | require('../styles/mailer.scss'); 2 | -------------------------------------------------------------------------------- /spec/fabricators/import_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:import) do 2 | end 3 | -------------------------------------------------------------------------------- /app/views/about/_registration.html.haml: -------------------------------------------------------------------------------- 1 | = render 'qiitadon_registration' 2 | -------------------------------------------------------------------------------- /spec/fixtures/files/imports.txt: -------------------------------------------------------------------------------- 1 | user@example.com 2 | 3 | user@test.com 4 | -------------------------------------------------------------------------------- /.env.test: -------------------------------------------------------------------------------- 1 | # Federation 2 | LOCAL_DOMAIN=cb6e6126.ngrok.io 3 | LOCAL_HTTPS=true 4 | -------------------------------------------------------------------------------- /spec/fabricators/backup_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:backup) do 2 | user 3 | end 4 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec puma -C config/puma.rb 2 | worker: bundle exec sidekiq 3 | -------------------------------------------------------------------------------- /public/badge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/badge.png -------------------------------------------------------------------------------- /public/oops.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/oops.gif -------------------------------------------------------------------------------- /spec/fabricators/conversation_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:conversation) do 2 | end 3 | -------------------------------------------------------------------------------- /spec/fabricators/site_upload_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:site_upload) do 2 | 3 | end 4 | -------------------------------------------------------------------------------- /app/views/accounts/_nothing_here.html.haml: -------------------------------------------------------------------------------- 1 | %p.nothing-here= t('accounts.nothing_here') 2 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /spec/fabricators/web_setting_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator('Web::Setting') do 2 | 3 | end 4 | -------------------------------------------------------------------------------- /config/themes.yml: -------------------------------------------------------------------------------- 1 | qiita-light: styles/qiita-light.scss 2 | qiita-dark: styles/qiita-dark.scss 3 | -------------------------------------------------------------------------------- /public/qiitan-cry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/qiitan-cry.png -------------------------------------------------------------------------------- /spec/fabricators/conversation_mute_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:conversation_mute) do 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/mailer_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module MailerHelper 4 | end 5 | -------------------------------------------------------------------------------- /public/emoji/sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/emoji/sheet.png -------------------------------------------------------------------------------- /public/favicon-dev.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/favicon-dev.ico -------------------------------------------------------------------------------- /public/sounds/boop.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/sounds/boop.mp3 -------------------------------------------------------------------------------- /public/sounds/boop.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/sounds/boop.ogg -------------------------------------------------------------------------------- /spec/fabricators/mention_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:mention) do 2 | account 3 | status 4 | end 5 | -------------------------------------------------------------------------------- /config/initializers/oj.rb: -------------------------------------------------------------------------------- 1 | Oj.default_options = { mode: :compat, time_format: :ruby, use_to_json: true } 2 | -------------------------------------------------------------------------------- /public/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/mstile-150x150.png -------------------------------------------------------------------------------- /spec/fabricators/favourite_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:favourite) do 2 | account 3 | status 4 | end 5 | -------------------------------------------------------------------------------- /spec/fabricators/list_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:list) do 2 | account 3 | title "MyString" 4 | end 5 | -------------------------------------------------------------------------------- /spec/fabricators/status_pin_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:status_pin) do 2 | account 3 | status 4 | end 5 | -------------------------------------------------------------------------------- /app/views/stream_entries/_og_description.html.haml: -------------------------------------------------------------------------------- 1 | = opengraph 'og:description', status_description(activity) 2 | -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/apple-touch-icon.png -------------------------------------------------------------------------------- /spec/fabricators/setting_fabricator.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Fabricator(:setting) do 4 | end 5 | -------------------------------------------------------------------------------- /spec/fixtures/files/emojo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/spec/fixtures/files/emojo.png -------------------------------------------------------------------------------- /spec/models/list_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe List, type: :model do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/mute_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Mute, type: :model do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /app/javascript/images/void.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/void.png -------------------------------------------------------------------------------- /app/javascript/styles/custom/variables.scss: -------------------------------------------------------------------------------- 1 | // branding colors 2 | $qiita: #59bb0c; 3 | $qiita-border: #4ea30a; 4 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /public/web-push-icon_expand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/web-push-icon_expand.png -------------------------------------------------------------------------------- /public/web-push-icon_reblog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/web-push-icon_reblog.png -------------------------------------------------------------------------------- /spec/fabricators/access_token_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator :access_token, from: 'Doorkeeper::AccessToken' do 2 | end 3 | -------------------------------------------------------------------------------- /spec/fixtures/files/avatar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/spec/fixtures/files/avatar.gif -------------------------------------------------------------------------------- /spec/fixtures/requests/sjis.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/spec/fixtures/requests/sjis.txt -------------------------------------------------------------------------------- /spec/models/backup_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Backup, type: :model do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /app/javascript/images/preview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/preview.jpg -------------------------------------------------------------------------------- /app/javascript/images/qiitan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/qiitan.png -------------------------------------------------------------------------------- /app/javascript/images/reticle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/reticle.png -------------------------------------------------------------------------------- /public/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/android-chrome-192x192.png -------------------------------------------------------------------------------- /public/web-push-icon_favourite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/web-push-icon_favourite.png -------------------------------------------------------------------------------- /spec/fixtures/files/attachment.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/spec/fixtures/files/attachment.gif -------------------------------------------------------------------------------- /spec/fixtures/files/attachment.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/spec/fixtures/files/attachment.jpg -------------------------------------------------------------------------------- /spec/fixtures/requests/avatar.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/spec/fixtures/requests/avatar.txt -------------------------------------------------------------------------------- /spec/fixtures/requests/koi8-r.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/spec/fixtures/requests/koi8-r.txt -------------------------------------------------------------------------------- /app/javascript/images/qiita-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/qiita-icon.png -------------------------------------------------------------------------------- /app/javascript/images/qiitan-cry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/qiitan-cry.png -------------------------------------------------------------------------------- /public/avatars/original/missing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/avatars/original/missing.png -------------------------------------------------------------------------------- /public/headers/original/missing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/public/headers/original/missing.png -------------------------------------------------------------------------------- /spec/fabricators/mute_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:mute) do 2 | account 3 | target_account { Fabricate(:account) } 4 | end 5 | -------------------------------------------------------------------------------- /spec/fixtures/files/attachment.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/spec/fixtures/files/attachment.webm -------------------------------------------------------------------------------- /spec/fixtures/files/mini-static.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/spec/fixtures/files/mini-static.gif -------------------------------------------------------------------------------- /spec/models/list_account_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe ListAccount, type: :model do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/preview_card_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe PreviewCard, type: :model do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/web/setting_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Web::Setting, type: :model do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /Procfile.dev.docker: -------------------------------------------------------------------------------- 1 | web: bundle exec puma -C config/puma.rb -p 3001 2 | webpack: ./bin/webpack-dev-server --listen-host 0.0.0.0 3 | -------------------------------------------------------------------------------- /app/javascript/images/elephant-fren.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/elephant-fren.png -------------------------------------------------------------------------------- /app/javascript/images/qiitan-gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/qiitan-gray.png -------------------------------------------------------------------------------- /config/initializers/strong_migrations.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | StrongMigrations.start_after = 20170924022025 4 | -------------------------------------------------------------------------------- /spec/fabricators/block_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:block) do 2 | account 3 | target_account { Fabricate(:account) } 4 | end 5 | -------------------------------------------------------------------------------- /spec/fabricators/follow_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:follow) do 2 | account 3 | target_account { Fabricate(:account) } 4 | end 5 | -------------------------------------------------------------------------------- /spec/fixtures/requests/attachment1.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/spec/fixtures/requests/attachment1.txt -------------------------------------------------------------------------------- /spec/fixtures/requests/attachment2.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/spec/fixtures/requests/attachment2.txt -------------------------------------------------------------------------------- /spec/fixtures/requests/oembed_undiscoverable.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/models/web.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Web 4 | def self.table_name_prefix 5 | 'web_' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/README.md) 2 | -------------------------------------------------------------------------------- /spec/fabricators/list_account_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:list_account) do 2 | list nil 3 | account nil 4 | follow nil 5 | end 6 | -------------------------------------------------------------------------------- /spec/fabricators/notification_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:notification) do 2 | activity_id 1 3 | activity_type 'Favourite' 4 | end 5 | -------------------------------------------------------------------------------- /spec/fabricators/session_activation_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:session_activation) do 2 | user 3 | session_id "MyString" 4 | end 5 | -------------------------------------------------------------------------------- /spec/fabricators/tag_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:tag) do 2 | name { sequence(:hashtag) { |i| "#{Faker::Lorem.word}#{i}" } } 3 | end 4 | -------------------------------------------------------------------------------- /spec/models/admin/action_log_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Admin::ActionLog, type: :model do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/conversation_mute_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe ConversationMute, type: :model do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /app/javascript/images/mailer/icon_cached.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/mailer/icon_cached.png -------------------------------------------------------------------------------- /app/javascript/images/mailer/icon_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/mailer/icon_done.png -------------------------------------------------------------------------------- /app/javascript/images/mailer/icon_email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/mailer/icon_email.png -------------------------------------------------------------------------------- /app/javascript/images/mailer/icon_grade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/mailer/icon_grade.png -------------------------------------------------------------------------------- /app/javascript/images/mailer/icon_reply.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/mailer/icon_reply.png -------------------------------------------------------------------------------- /app/javascript/images/mailer/logo_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/mailer/logo_full.png -------------------------------------------------------------------------------- /app/models/admin.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Admin 4 | def self.table_name_prefix 5 | 'admin_' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/views/authorize_follows/error.html.haml: -------------------------------------------------------------------------------- 1 | .form-container 2 | .flash-message#error_explanation 3 | = t('authorize_follow.error') 4 | -------------------------------------------------------------------------------- /config/initializers/active_model_serializers.rb: -------------------------------------------------------------------------------- 1 | ActiveModelSerializers.config.tap do |config| 2 | config.default_includes = '**' 3 | end 4 | -------------------------------------------------------------------------------- /spec/fabricators/account_domain_block_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:account_domain_block) do 2 | account 3 | domain 'example.com' 4 | end 5 | -------------------------------------------------------------------------------- /app/helpers/admin/account_moderation_notes_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Admin::AccountModerationNotesHelper 4 | end 5 | -------------------------------------------------------------------------------- /app/views/application/_flashes.html.haml: -------------------------------------------------------------------------------- 1 | - user_facing_flashes.each do |key, value| 2 | .flash-message{ class: key } 3 | %strong= value 4 | -------------------------------------------------------------------------------- /app/views/errors/403.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :page_title do 2 | = t('errors.403') 3 | 4 | - content_for :content do 5 | = t('errors.403') 6 | -------------------------------------------------------------------------------- /app/views/errors/404.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :page_title do 2 | = t('errors.404') 3 | 4 | - content_for :content do 5 | = t('errors.404') 6 | -------------------------------------------------------------------------------- /app/views/errors/410.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :page_title do 2 | = t('errors.410') 3 | 4 | - content_for :content do 5 | = t('errors.410') 6 | -------------------------------------------------------------------------------- /config/initializers/suppress_csrf_warnings.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ActionController::Base.log_warning_on_csrf_failure = false 4 | -------------------------------------------------------------------------------- /docs/Extensions.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Extensions.md) 2 | -------------------------------------------------------------------------------- /spec/fabricators/account_moderation_note_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:account_moderation_note) do 2 | content "MyText" 3 | account nil 4 | end 5 | -------------------------------------------------------------------------------- /spec/fabricators/identity_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:identity) do 2 | user nil 3 | provider "MyString" 4 | uid "MyString" 5 | end 6 | -------------------------------------------------------------------------------- /spec/fabricators/invite_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:invite) do 2 | user 3 | expires_at nil 4 | max_uses nil 5 | uses 0 6 | end 7 | -------------------------------------------------------------------------------- /spec/models/account_moderation_note_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe AccountModerationNote, type: :model do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/services/unmute_service_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe UnmuteService do 4 | subject { UnmuteService.new } 5 | end 6 | -------------------------------------------------------------------------------- /app/javascript/images/mailer/icon_lock_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/mailer/icon_lock_open.png -------------------------------------------------------------------------------- /app/javascript/images/mailer/icon_person_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/mailer/icon_person_add.png -------------------------------------------------------------------------------- /app/javascript/images/mailer/logo_transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/mailer/logo_transparent.png -------------------------------------------------------------------------------- /app/javascript/images/qiitan_gettingstarted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/qiitan_gettingstarted.png -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /config/initializers/fast_blank.rb: -------------------------------------------------------------------------------- 1 | if String.method_defined?(:blank_as?) 2 | class String 3 | alias_method :blank?, :blank_as? 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /.buildpacks: -------------------------------------------------------------------------------- 1 | https://github.com/heroku/heroku-buildpack-apt 2 | https://github.com/Scalingo/nodejs-buildpack 3 | https://github.com/Scalingo/ruby-buildpack 4 | -------------------------------------------------------------------------------- /app/javascript/fonts/roboto/roboto-bold-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto/roboto-bold-webfont.ttf -------------------------------------------------------------------------------- /app/javascript/images/mailer/icon_file_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/mailer/icon_file_download.png -------------------------------------------------------------------------------- /app/javascript/images/qiitadon-getting-started.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/images/qiitadon-getting-started.png -------------------------------------------------------------------------------- /app/views/shared/_qiita_authentication.html.haml: -------------------------------------------------------------------------------- 1 | .qiita 2 | = link_to 'Qiitaアカウントで参加', '/auth/auth/qiita', class: 'button button-primary registration' 3 | -------------------------------------------------------------------------------- /docs/Using-the-API/API.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md) 2 | -------------------------------------------------------------------------------- /spec/fabricators/admin_action_log_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator('Admin::ActionLog') do 2 | account nil 3 | action "MyString" 4 | target nil 5 | end 6 | -------------------------------------------------------------------------------- /spec/fixtures/requests/sjis_with_wrong_charset.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/spec/fixtures/requests/sjis_with_wrong_charset.txt -------------------------------------------------------------------------------- /.profile: -------------------------------------------------------------------------------- 1 | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/app/.apt/lib/x86_64-linux-gnu:/app/.apt/usr/lib/x86_64-linux-gnu/mesa:/app/.apt/usr/lib/x86_64-linux-gnu/pulseaudio 2 | -------------------------------------------------------------------------------- /app/javascript/fonts/montserrat/Montserrat-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/montserrat/Montserrat-Medium.ttf -------------------------------------------------------------------------------- /app/javascript/fonts/montserrat/Montserrat-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/montserrat/Montserrat-Regular.ttf -------------------------------------------------------------------------------- /app/javascript/fonts/roboto/roboto-bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto/roboto-bold-webfont.woff -------------------------------------------------------------------------------- /app/javascript/fonts/roboto/roboto-bold-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto/roboto-bold-webfont.woff2 -------------------------------------------------------------------------------- /app/javascript/fonts/roboto/roboto-italic-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto/roboto-italic-webfont.ttf -------------------------------------------------------------------------------- /app/javascript/fonts/roboto/roboto-italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto/roboto-italic-webfont.woff -------------------------------------------------------------------------------- /app/javascript/fonts/roboto/roboto-medium-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto/roboto-medium-webfont.ttf -------------------------------------------------------------------------------- /app/javascript/fonts/roboto/roboto-medium-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto/roboto-medium-webfont.woff -------------------------------------------------------------------------------- /app/javascript/fonts/roboto/roboto-regular-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto/roboto-regular-webfont.ttf -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationRecord < ActiveRecord::Base 4 | self.abstract_class = true 5 | end 6 | -------------------------------------------------------------------------------- /app/models/context.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Context < ActiveModelSerializers::Model 4 | attributes :ancestors, :descendants 5 | end 6 | -------------------------------------------------------------------------------- /app/views/errors/422.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :page_title do 2 | = t('errors.422.title') 3 | 4 | - content_for :content do 5 | = t('errors.422.content') 6 | -------------------------------------------------------------------------------- /app/views/errors/500.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :page_title do 2 | = t('errors.500.title') 3 | 4 | - content_for :content do 5 | = t('errors.500.content') 6 | -------------------------------------------------------------------------------- /db/migrate/20170205175257_remove_devices.rb: -------------------------------------------------------------------------------- 1 | class RemoveDevices < ActiveRecord::Migration[5.0] 2 | def change 3 | drop_table :devices 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /docs/Specs-and-RFCs-used.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Specs-and-RFCs-used.md) 2 | -------------------------------------------------------------------------------- /docs/Using-Mastodon/2FA.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/2FA.md) 2 | -------------------------------------------------------------------------------- /docs/Using-Mastodon/Apps.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md) 2 | -------------------------------------------------------------------------------- /docs/Using-Mastodon/FAQ.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/FAQ.md) 2 | -------------------------------------------------------------------------------- /spec/fabricators/follow_request_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:follow_request) do 2 | account 3 | target_account { Fabricate(:account, locked: true) } 4 | end 5 | -------------------------------------------------------------------------------- /app/javascript/fonts/montserrat/Montserrat-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/montserrat/Montserrat-Regular.woff -------------------------------------------------------------------------------- /app/javascript/fonts/montserrat/Montserrat-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/montserrat/Montserrat-Regular.woff2 -------------------------------------------------------------------------------- /app/javascript/fonts/roboto/roboto-italic-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto/roboto-italic-webfont.woff2 -------------------------------------------------------------------------------- /app/javascript/fonts/roboto/roboto-medium-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto/roboto-medium-webfont.woff2 -------------------------------------------------------------------------------- /app/javascript/fonts/roboto/roboto-regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto/roboto-regular-webfont.woff -------------------------------------------------------------------------------- /app/javascript/fonts/roboto/roboto-regular-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto/roboto-regular-webfont.woff2 -------------------------------------------------------------------------------- /app/models/search.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Search < ActiveModelSerializers::Model 4 | attributes :accounts, :statuses, :hashtags 5 | end 6 | -------------------------------------------------------------------------------- /app/views/oauth/authorizations/error.html.haml: -------------------------------------------------------------------------------- 1 | .form-container 2 | .flash-message#error_explanation 3 | = @pre_auth.error_response.body[:error_description] 4 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../config/application', __dir__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /spec/fabricators/domain_block_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:domain_block) do 2 | domain { sequence(:domain) { |i| "#{i}#{Faker::Internet.domain_name}" } } 3 | end 4 | -------------------------------------------------------------------------------- /spec/services/activitypub/process_account_service_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe ActivityPub::ProcessAccountService do 4 | pending 5 | end 6 | -------------------------------------------------------------------------------- /app/policies/subscription_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class SubscriptionPolicy < ApplicationPolicy 4 | def index? 5 | admin? 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /docs/Running-Mastodon/Tuning.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md) 2 | -------------------------------------------------------------------------------- /docs/Using-Mastodon/User-guide.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/User-guide.md) 2 | -------------------------------------------------------------------------------- /docs/Using-the-API/OAuth-details.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-the-API/OAuth-details.md) 2 | -------------------------------------------------------------------------------- /docs/Using-the-API/Streaming-API.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-the-API/Streaming-API.md) 2 | -------------------------------------------------------------------------------- /spec/fabricators/accessible_access_token_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator :accessible_access_token, from: :access_token do 2 | expires_in { nil } 3 | revoked_at { nil } 4 | end 5 | -------------------------------------------------------------------------------- /spec/fabricators/email_domain_block_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:email_domain_block) do 2 | domain { sequence(:domain) { |i| "#{i}#{Faker::Internet.domain_name}" } } 3 | end 4 | -------------------------------------------------------------------------------- /spec/fabricators/stream_entry_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:stream_entry) do 2 | account 3 | activity { Fabricate(:status) } 4 | hidden { [true, false].sample } 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/identity_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Identity, type: :model do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /Aptfile: -------------------------------------------------------------------------------- 1 | ffmpeg 2 | libicu[0-9][0-9] 3 | libicu-dev 4 | libidn11 5 | libidn11-dev 6 | libpq-dev 7 | libprotobuf-dev 8 | libxdamage1 9 | libxfixes3 10 | protobuf-compiler 11 | -------------------------------------------------------------------------------- /app/javascript/fonts/roboto-mono/robotomono-regular-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto-mono/robotomono-regular-webfont.ttf -------------------------------------------------------------------------------- /app/javascript/fonts/roboto-mono/robotomono-regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto-mono/robotomono-regular-webfont.woff -------------------------------------------------------------------------------- /app/javascript/packs/common.js: -------------------------------------------------------------------------------- 1 | import { start } from 'rails-ujs'; 2 | import 'font-awesome/css/font-awesome.css'; 3 | 4 | require.context('../images/', true); 5 | 6 | start(); 7 | -------------------------------------------------------------------------------- /config/initializers/httplog.rb: -------------------------------------------------------------------------------- 1 | HttpLog.configure do |config| 2 | config.logger = Rails.logger 3 | config.color = { color: :yellow } 4 | config.compact_log = true 5 | end 6 | -------------------------------------------------------------------------------- /config/initializers/oembed.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative '../../app/lib/provider_discovery' 4 | OEmbed::Providers.register_fallback(ProviderDiscovery) 5 | -------------------------------------------------------------------------------- /docs/Running-Mastodon/Heroku-guide.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Heroku-guide.md) 2 | -------------------------------------------------------------------------------- /app/javascript/fonts/roboto-mono/robotomono-regular-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increments/mastodon/HEAD/app/javascript/fonts/roboto-mono/robotomono-regular-webfont.woff2 -------------------------------------------------------------------------------- /app/models/form/delete_confirmation.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Form::DeleteConfirmation 4 | include ActiveModel::Model 5 | 6 | attr_accessor :password 7 | end 8 | -------------------------------------------------------------------------------- /app/models/list_feed.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ListFeed < Feed 4 | def initialize(list) 5 | @type = :list 6 | @id = list.id 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/views/admin/action_logs/index.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :page_title do 2 | = t('admin.action_logs.title') 3 | 4 | %ul 5 | = render @action_logs 6 | 7 | = paginate @action_logs 8 | -------------------------------------------------------------------------------- /app/views/shared/_error_messages.html.haml: -------------------------------------------------------------------------------- 1 | - if object.errors.any? 2 | .flash-message#error_explanation 3 | %strong= t('generic.validation_errors', count: object.errors.count) 4 | -------------------------------------------------------------------------------- /db/migrate/20161116162355_add_locale_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddLocaleToUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :users, :locale, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170516072309_add_index_accounts_on_uri.rb: -------------------------------------------------------------------------------- 1 | class AddIndexAccountsOnUri < ActiveRecord::Migration[5.0] 2 | def change 3 | add_index :accounts, :uri 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /docs/Running-Mastodon/Scalingo-guide.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Scalingo-guide.md) 2 | -------------------------------------------------------------------------------- /docs/Running-Mastodon/Vagrant-guide.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Vagrant-guide.md) 2 | -------------------------------------------------------------------------------- /docs/Using-the-API/Push-notifications.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-the-API/Push-notifications.md) 2 | -------------------------------------------------------------------------------- /docs/Using-the-API/Testing-with-cURL.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-the-API/Testing-with-cURL.md) 2 | -------------------------------------------------------------------------------- /spec/controllers/admin/account_moderation_notes_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Admin::AccountModerationNotesController, type: :controller do 4 | end 5 | -------------------------------------------------------------------------------- /spec/fabricators/report_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:report) do 2 | account 3 | target_account { Fabricate(:account) } 4 | comment "You nasty" 5 | action_taken false 6 | end 7 | -------------------------------------------------------------------------------- /app/helpers/home_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module HomeHelper 4 | def default_props 5 | { 6 | locale: I18n.locale, 7 | } 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/javascript/styles/custom/wide_screen.scss: -------------------------------------------------------------------------------- 1 | @media screen and (min-width: 1025px) { 2 | .columns-area>div:last-child { 3 | flex: 1 0 auto; 4 | max-width: 640px; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /app/models/form/two_factor_confirmation.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Form::TwoFactorConfirmation 4 | include ActiveModel::Model 5 | 6 | attr_accessor :code 7 | end 8 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | --- 3 | 4 | <%= t 'about.hosted_on', domain: site_hostname %> 5 | <%= t('application_mailer.settings', link: settings_preferences_url) %> 6 | -------------------------------------------------------------------------------- /config/initializers/single_user_mode.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.configure do 4 | config.x.single_user_mode = ENV['SINGLE_USER_MODE'] == 'true' 5 | end 6 | -------------------------------------------------------------------------------- /config/initializers/timeout.rb: -------------------------------------------------------------------------------- 1 | Rack::Timeout::Logger.disable 2 | Rack::Timeout.service_timeout = false 3 | 4 | if Rails.env.production? 5 | Rack::Timeout.service_timeout = 90 6 | end 7 | -------------------------------------------------------------------------------- /docs/Contributing-to-Mastodon/Sponsors.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Contributing-to-Mastodon/Sponsors.md) 2 | -------------------------------------------------------------------------------- /docs/Running-Mastodon/Development-guide.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Development-guide.md) 2 | -------------------------------------------------------------------------------- /docs/Running-Mastodon/Production-guide.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md) 2 | -------------------------------------------------------------------------------- /spec/fabricators/qiita_authorization_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:qiita_authorization) do 2 | user nil 3 | uid "qiitan" 4 | token "token" 5 | end 6 | -------------------------------------------------------------------------------- /app/javascript/mastodon/extra_polyfills.js: -------------------------------------------------------------------------------- 1 | import 'intersection-observer'; 2 | import 'requestidlecallback'; 3 | import objectFitImages from 'object-fit-images'; 4 | 5 | objectFitImages(); 6 | -------------------------------------------------------------------------------- /app/javascript/mastodon/test_setup.js: -------------------------------------------------------------------------------- 1 | import { configure } from 'enzyme'; 2 | import Adapter from 'enzyme-adapter-react-16'; 3 | 4 | const adapter = new Adapter(); 5 | configure({ adapter }); 6 | -------------------------------------------------------------------------------- /app/javascript/mastodon/uuid.js: -------------------------------------------------------------------------------- 1 | export default function uuid(a) { 2 | return a ? (a^Math.random() * 16 >> a / 4).toString(16) : ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, uuid); 3 | }; 4 | -------------------------------------------------------------------------------- /docs/Contributing-to-Mastodon/Translating.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Contributing-to-Mastodon/Translating.md) 2 | -------------------------------------------------------------------------------- /docs/Running-Mastodon/Administration-guide.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Administration-guide.md) 2 | -------------------------------------------------------------------------------- /docs/Using-the-API/Tips-for-app-developers.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-the-API/Tips-for-app-developers.md) 2 | -------------------------------------------------------------------------------- /spec/models/oauth_authorization_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe QiitaAuthorization, type: :model do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .env 2 | .env.* 3 | public/system 4 | public/assets 5 | public/packs 6 | node_modules 7 | neo4j 8 | vendor/bundle 9 | .DS_Store 10 | *.swp 11 | *~ 12 | postgres 13 | redis 14 | -------------------------------------------------------------------------------- /config/initializers/session_activations.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.configure do 4 | config.x.max_session_activations = ENV['MAX_SESSION_ACTIVATIONS'] || 10 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160325130944_add_admin_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddAdminToUsers < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :users, :admin, :boolean, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170405112956_add_index_on_mentions_status_id.rb: -------------------------------------------------------------------------------- 1 | class AddIndexOnMentionsStatusId < ActiveRecord::Migration[5.0] 2 | def change 3 | add_index :mentions, :status_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/helpers/flashes_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module FlashesHelper 4 | def user_facing_flashes 5 | flash.to_hash.slice('alert', 'error', 'notice', 'success') 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /docs/Using-Mastodon/List-of-Mastodon-instances.md: -------------------------------------------------------------------------------- 1 | [The documentation has moved to its own repository](https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/List-of-Mastodon-instances.md) 2 | -------------------------------------------------------------------------------- /spec/fixtures/requests/oembed_invalid_xml.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/views/user_mailer/backup_ready.text.erb: -------------------------------------------------------------------------------- 1 | <%= t 'user_mailer.backup_ready.title' %> 2 | 3 | === 4 | 5 | <%= t 'user_mailer.backup_ready.explanation' %> 6 | 7 | => <%= full_asset_url(@backup.dump.url) %> 8 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # This file is used by Rack-based servers to start the application. 3 | 4 | require ::File.expand_path('../config/environment', __FILE__) 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /config/initializers/kaminari_config.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Kaminari.configure do |config| 4 | config.default_per_page = 40 5 | config.window = 1 6 | config.outer_window = 1 7 | end 8 | -------------------------------------------------------------------------------- /config/webpack/loaders/mark.js: -------------------------------------------------------------------------------- 1 | if (process.env.NODE_ENV === 'production') { 2 | module.exports = {}; 3 | } else { 4 | module.exports = { 5 | test: /\.js$/, 6 | loader: 'mark-loader', 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /db/migrate/20160223165723_add_url_to_statuses.rb: -------------------------------------------------------------------------------- 1 | class AddUrlToStatuses < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :statuses, :url, :string, null: true, default: nil 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160223165855_add_url_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddUrlToAccounts < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :accounts, :url, :string, null: true, default: nil 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170114194937_add_application_to_statuses.rb: -------------------------------------------------------------------------------- 1 | class AddApplicationToStatuses < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :statuses, :application_id, :int 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170425131920_add_media_attachment_meta.rb: -------------------------------------------------------------------------------- 1 | class AddMediaAttachmentMeta < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :media_attachments, :file_meta, :json 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170714184731_add_domain_to_subscriptions.rb: -------------------------------------------------------------------------------- 1 | class AddDomainToSubscriptions < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :subscriptions, :domain, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/fabricators/account_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:account) do 2 | username { sequence(:username) { |i| "#{Faker::Internet.user_name(nil, %w(_))}#{i}" } } 3 | last_webfingered_at { Time.now.utc } 4 | end 5 | -------------------------------------------------------------------------------- /Procfile.dev: -------------------------------------------------------------------------------- 1 | web: env PORT=3000 bundle exec puma -C config/puma.rb 2 | sidekiq: env PORT=3000 bundle exec sidekiq 3 | stream: env PORT=4000 yarn run start 4 | webpack: ./bin/webpack-dev-server --listen-host 0.0.0.0 5 | -------------------------------------------------------------------------------- /app/javascript/mastodon/locales/index.js: -------------------------------------------------------------------------------- 1 | let theLocale; 2 | 3 | export function setLocale(locale) { 4 | theLocale = locale; 5 | } 6 | 7 | export function getLocale() { 8 | return theLocale; 9 | } 10 | -------------------------------------------------------------------------------- /app/lib/settings/extend.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Settings 4 | module Extend 5 | def settings 6 | @settings ||= ScopedSettings.new(self) 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20170424112722_add_status_id_index_to_statuses_tags.rb: -------------------------------------------------------------------------------- 1 | class AddStatusIdIndexToStatusesTags < ActiveRecord::Migration[5.0] 2 | def change 3 | add_index :statuses_tags, :status_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170905165803_add_local_to_statuses.rb: -------------------------------------------------------------------------------- 1 | class AddLocalToStatuses < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :statuses, :local, :boolean, null: true, default: nil 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20161123093447_add_sensitive_to_statuses.rb: -------------------------------------------------------------------------------- 1 | class AddSensitiveToStatuses < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :statuses, :sensitive, :boolean, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180109143959_add_remember_token_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddRememberTokenToUsers < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :users, :remember_token, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/fabricators/custom_emoji_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:custom_emoji) do 2 | shortcode 'coolcat' 3 | domain nil 4 | image { File.open(Rails.root.join('spec', 'fixtures', 'files', 'emojo.png')) } 5 | end 6 | -------------------------------------------------------------------------------- /spec/fabricators/web_push_subscription_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:web_push_subscription) do 2 | endpoint Faker::Internet.url 3 | key_p256dh Faker::Internet.password 4 | key_auth Faker::Internet.password 5 | end 6 | -------------------------------------------------------------------------------- /app/policies/settings_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class SettingsPolicy < ApplicationPolicy 4 | def update? 5 | admin? 6 | end 7 | 8 | def show? 9 | admin? 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/services/base_service.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class BaseService 4 | include ActionView::Helpers::TextHelper 5 | include ActionView::Helpers::SanitizeHelper 6 | 7 | include RoutingHelper 8 | end 9 | -------------------------------------------------------------------------------- /app/views/stream_entries/embed.html.haml: -------------------------------------------------------------------------------- 1 | - cache @stream_entry.activity do 2 | .activity-stream.activity-stream-headless 3 | = render "stream_entries/#{@type}", @type.to_sym => @stream_entry.activity, centered: true 4 | -------------------------------------------------------------------------------- /app/views/user_mailer/password_change.text.erb: -------------------------------------------------------------------------------- 1 | <%= t 'devise.mailer.password_change.title' %> 2 | 3 | === 4 | 5 | <%= t 'devise.mailer.password_change.explanation' %> 6 | 7 | <%= t 'devise.mailer.password_change.extra' %> 8 | -------------------------------------------------------------------------------- /config/initializers/json_ld.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative '../../lib/json_ld/identity' 4 | require_relative '../../lib/json_ld/security' 5 | require_relative '../../lib/json_ld/activitystreams' 6 | -------------------------------------------------------------------------------- /db/migrate/20161222201034_add_locked_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddLockedToAccounts < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :accounts, :locked, :boolean, null: false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170114203041_add_website_to_oauth_application.rb: -------------------------------------------------------------------------------- 1 | class AddWebsiteToOauthApplication < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :oauth_applications, :website, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170123162658_add_severity_to_domain_blocks.rb: -------------------------------------------------------------------------------- 1 | class AddSeverityToDomainBlocks < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :domain_blocks, :severity, :integer, default: 0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170123203248_add_reject_media_to_domain_blocks.rb: -------------------------------------------------------------------------------- 1 | class AddRejectMediaToDomainBlocks < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :domain_blocks, :reject_media, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170414132105_add_language_to_statuses.rb: -------------------------------------------------------------------------------- 1 | class AddLanguageToStatuses < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :statuses, :language, :string, null: false, default: 'en' 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/controllers/activitypub/inboxes_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe ActivityPub::InboxesController, type: :controller do 4 | describe 'POST #create' do 5 | pending 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/fabricators/user_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:user) do 2 | account 3 | email { sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } } 4 | password "123456789" 5 | confirmed_at { Time.now } 6 | end 7 | -------------------------------------------------------------------------------- /spec/fixtures/requests/oembed_json.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.postcssrc.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | postcss-smart-import: {} 3 | precss: {} 4 | autoprefixer: 5 | browsers: 6 | - last 2 versions 7 | - IE >= 11 8 | - iOS >= 9 9 | postcss-object-fit-images: {} 10 | -------------------------------------------------------------------------------- /app/javascript/mastodon/features/emoji/emoji_picker.js: -------------------------------------------------------------------------------- 1 | import Picker from 'emoji-mart/dist-es/components/picker'; 2 | import Emoji from 'emoji-mart/dist-es/components/emoji'; 3 | 4 | export { 5 | Picker, 6 | Emoji, 7 | }; 8 | -------------------------------------------------------------------------------- /app/javascript/packs/application.js: -------------------------------------------------------------------------------- 1 | import loadPolyfills from '../mastodon/load_polyfills'; 2 | 3 | loadPolyfills().then(() => { 4 | require('../mastodon/main').default(); 5 | }).catch(e => { 6 | console.error(e); 7 | }); 8 | -------------------------------------------------------------------------------- /app/policies/instance_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class InstancePolicy < ApplicationPolicy 4 | def index? 5 | admin? 6 | end 7 | 8 | def resubscribe? 9 | admin? 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/serializers/rest/list_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class REST::ListSerializer < ActiveModel::Serializer 4 | attributes :id, :title 5 | 6 | def id 7 | object.id.to_s 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20161027172456_add_silenced_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddSilencedToAccounts < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :accounts, :silenced, :boolean, null: false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20161130185319_add_visibility_to_statuses.rb: -------------------------------------------------------------------------------- 1 | class AddVisibilityToStatuses < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :statuses, :visibility, :integer, null: false, default: 0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20161205214545_add_suspended_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddSuspendedToAccounts < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :accounts, :suspended, :boolean, null: false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170409170753_add_last_webfingered_at_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddLastWebfingeredAtToAccounts < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :accounts, :last_webfingered_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170601210557_add_index_on_media_attachments_account_id.rb: -------------------------------------------------------------------------------- 1 | class AddIndexOnMediaAttachmentsAccountId < ActiveRecord::Migration[5.1] 2 | def change 3 | add_index :media_attachments, :account_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170927215609_add_description_to_media_attachments.rb: -------------------------------------------------------------------------------- 1 | class AddDescriptionToMediaAttachments < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :media_attachments, :description, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/fabricators/application_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:application, from: Doorkeeper::Application) do 2 | name 'Example' 3 | website 'http://example.com' 4 | redirect_uri 'http://example.com/callback' 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160223164502_make_uris_nullable_in_statuses.rb: -------------------------------------------------------------------------------- 1 | class MakeUrisNullableInStatuses < ActiveRecord::Migration[4.2] 2 | def change 3 | change_column :statuses, :uri, :string, null: true, default: nil 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170125145934_add_spoiler_text_to_statuses.rb: -------------------------------------------------------------------------------- 1 | class AddSpoilerTextToStatuses < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :statuses, :spoiler_text, :text, default: "", null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170303212857_add_last_emailed_at_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddLastEmailedAtToUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :users, :last_emailed_at, :datetime, null: true, default: nil 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/controllers/manifests_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ManifestsController < ApplicationController 4 | def show 5 | render json: InstancePresenter.new, serializer: ManifestSerializer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/lib/application_extension.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ApplicationExtension 4 | extend ActiveSupport::Concern 5 | 6 | included do 7 | validates :website, url: true, if: :website? 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ApplicationController.renderer.defaults.merge!( 4 | # http_host: 'example.org', 5 | # https: false 6 | # ) 7 | -------------------------------------------------------------------------------- /db/migrate/20161221152630_add_hidden_to_stream_entries.rb: -------------------------------------------------------------------------------- 1 | class AddHiddenToStreamEntries < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :stream_entries, :hidden, :boolean, null: false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180304013859_add_featured_collection_url_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddFeaturedCollectionUrlToAccounts < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :accounts, :featured_collection_url, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /spec/fabricators/subscription_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:subscription) do 2 | account 3 | callback_url "http://example.com/callback" 4 | secret "foobar" 5 | expires_at "2016-11-28 11:30:07" 6 | confirmed false 7 | end 8 | -------------------------------------------------------------------------------- /app/presenters/activitypub/collection_presenter.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ActivityPub::CollectionPresenter < ActiveModelSerializers::Model 4 | attributes :id, :type, :size, :items, :part_of, :first, :next, :prev 5 | end 6 | -------------------------------------------------------------------------------- /app/serializers/rest/report_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class REST::ReportSerializer < ActiveModel::Serializer 4 | attributes :id, :action_taken 5 | 6 | def id 7 | object.id.to_s 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/views/notification_mailer/reblog.text.erb: -------------------------------------------------------------------------------- 1 | <%= raw t('application_mailer.salutation', name: display_name(@me)) %> 2 | 3 | <%= raw t('notification_mailer.reblog.body', name: @account.acct) %> 4 | 5 | <%= render 'status', status: @status %> 6 | -------------------------------------------------------------------------------- /db/migrate/20170403172249_add_action_taken_by_account_id_to_reports.rb: -------------------------------------------------------------------------------- 1 | class AddActionTakenByAccountIdToReports < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :reports, :action_taken_by_account_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170824103029_add_timestamps_to_status_pins.rb: -------------------------------------------------------------------------------- 1 | class AddTimestampsToStatusPins < ActiveRecord::Migration[5.1] 2 | def change 3 | add_timestamps :status_pins, null: false, default: -> { 'CURRENT_TIMESTAMP' } 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20171010023049_add_foreign_key_to_account_moderation_notes.rb: -------------------------------------------------------------------------------- 1 | class AddForeignKeyToAccountModerationNotes < ActiveRecord::Migration[5.1] 2 | def change 3 | add_foreign_key :account_moderation_notes, :accounts 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/views/notification_mailer/favourite.text.erb: -------------------------------------------------------------------------------- 1 | <%= raw t('application_mailer.salutation', name: display_name(@me)) %> 2 | 3 | <%= raw t('notification_mailer.favourite.body', name: @account.acct) %> 4 | 5 | <%= render 'status', status: @status %> 6 | -------------------------------------------------------------------------------- /app/views/oauth/authorizations/show.html.haml: -------------------------------------------------------------------------------- 1 | .form-container 2 | .flash-message 3 | %p= t('doorkeeper.authorizations.show.title') 4 | %input{ type: 'text', class: 'oauth-code', readonly: true, value: params[:code], onClick: 'select()' } 5 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | 7 | ActiveRecord::SchemaDumper.ignore_tables = ['deprecated_preview_cards'] 8 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_mastodon_session', secure: (Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true') 4 | -------------------------------------------------------------------------------- /config/webpack/test.js: -------------------------------------------------------------------------------- 1 | // Note: You must restart bin/webpack-dev-server for changes to take effect 2 | 3 | const merge = require('webpack-merge'); 4 | const sharedConfig = require('./shared.js'); 5 | 6 | module.exports = merge(sharedConfig, {}); 7 | -------------------------------------------------------------------------------- /db/migrate/20160322193748_add_avatar_remote_url_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddAvatarRemoteUrlToAccounts < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :accounts, :avatar_remote_url, :string, null: true, default: nil 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160920003904_remove_verify_token_from_accounts.rb: -------------------------------------------------------------------------------- 1 | class RemoveVerifyTokenFromAccounts < ActiveRecord::Migration[5.0] 2 | def change 3 | remove_column :accounts, :verify_token, :string, null: false, default: '' 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170318214217_add_header_remote_url_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddHeaderRemoteUrlToAccounts < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :accounts, :header_remote_url, :string, null: false, default: '' 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170414080609_add_devise_two_factor_backupable_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddDeviseTwoFactorBackupableToUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :users, :otp_backup_codes, :string, array: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170517123337_add_dummy_password_flag_to_user.rb: -------------------------------------------------------------------------------- 1 | class AddDummyPasswordFlagToUser < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :users, :dummy_password_flag, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/services/send_interaction_service_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe SendInteractionService do 4 | subject { SendInteractionService.new } 5 | 6 | it 'sends an XML envelope to the Salmon end point of remote user' 7 | end 8 | -------------------------------------------------------------------------------- /app/javascript/mastodon/ready.js: -------------------------------------------------------------------------------- 1 | export default function ready(loaded) { 2 | if (['interactive', 'complete'].includes(document.readyState)) { 3 | loaded(); 4 | } else { 5 | document.addEventListener('DOMContentLoaded', loaded); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /app/javascript/styles/theme-base.scss: -------------------------------------------------------------------------------- 1 | @import 'theme-base/variables'; 2 | @import 'theme-base/styles'; 3 | 4 | @import 'theme-base/about'; 5 | @import 'theme-base/accounts'; 6 | @import 'theme-base/components'; 7 | @import 'theme-base/stream_entries'; 8 | -------------------------------------------------------------------------------- /app/presenters/initial_state_presenter.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class InitialStatePresenter < ActiveModelSerializers::Model 4 | attributes :settings, :push_subscription, :token, 5 | :current_account, :admin, :text 6 | end 7 | -------------------------------------------------------------------------------- /app/views/notification_mailer/mention.text.erb: -------------------------------------------------------------------------------- 1 | <%= raw t('application_mailer.salutation', name: display_name(@me)) %> 2 | 3 | <%= raw t('notification_mailer.mention.body', name: @status.account.acct) %> 4 | 5 | <%= render 'status', status: @status %> 6 | -------------------------------------------------------------------------------- /db/migrate/20170418160728_add_indexes_to_reports_for_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddIndexesToReportsForAccounts < ActiveRecord::Migration[5.0] 2 | def change 3 | add_index :reports, :account_id 4 | add_index :reports, :target_account_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20170609145826_remove_default_language_from_statuses.rb: -------------------------------------------------------------------------------- 1 | class RemoveDefaultLanguageFromStatuses < ActiveRecord::Migration[5.1] 2 | def change 3 | change_column :statuses, :language, :string, default: nil, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/javascript/images/icon_done.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/javascript/images/icon_file_download.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /db/migrate/20160826155805_add_superapp_to_oauth_applications.rb: -------------------------------------------------------------------------------- 1 | class AddSuperappToOauthApplications < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :oauth_applications, :superapp, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170829215220_remove_status_pins_account_index.rb: -------------------------------------------------------------------------------- 1 | class RemoveStatusPinsAccountIndex < ActiveRecord::Migration[5.1] 2 | def change 3 | remove_index :status_pins, :account_id 4 | remove_index :status_pins, :status_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20171006142024_add_uri_to_custom_emojis.rb: -------------------------------------------------------------------------------- 1 | class AddUriToCustomEmojis < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :custom_emojis, :uri, :string 4 | add_column :custom_emojis, :image_remote_url, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20171125031751_add_invite_id_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddInviteIdToUsers < ActiveRecord::Migration[5.1] 2 | def change 3 | add_reference :users, :invite, null: true, default: nil, foreign_key: { on_delete: :nullify }, index: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/javascript/images/icon_reply.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/views/well_known/host_meta/show.xml.ruby: -------------------------------------------------------------------------------- 1 | Nokogiri::XML::Builder.new do |xml| 2 | xml.XRD(xmlns: 'http://docs.oasis-open.org/ns/xri/xrd-1.0') do 3 | xml.Link(rel: 'lrdd', type: 'application/xrd+xml', template: @webfinger_template) 4 | end 5 | end.to_xml 6 | -------------------------------------------------------------------------------- /db/migrate/20170217012631_add_reblog_of_id_foreign_key_to_statuses.rb: -------------------------------------------------------------------------------- 1 | class AddReblogOfIdForeignKeyToStatuses < ActiveRecord::Migration[5.0] 2 | def change 3 | add_foreign_key :statuses, :statuses, column: :reblog_of_id, on_delete: :cascade 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180206000000_change_user_id_nonnullable.rb: -------------------------------------------------------------------------------- 1 | class ChangeUserIdNonnullable < ActiveRecord::Migration[5.1] 2 | def change 3 | change_column_null :invites, :user_id, false 4 | change_column_null :web_settings, :user_id, false 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/fabricators/status_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:status) do 2 | account 3 | text "Lorem ipsum dolor sit amet" 4 | 5 | after_build do |status| 6 | status.uri = Faker::Internet.device_token if !status.account.local? && status.uri.nil? 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/controllers/admin/action_logs_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Admin 4 | class ActionLogsController < BaseController 5 | def index 6 | @action_logs = Admin::ActionLog.page(params[:page]) 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/policies/report_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ReportPolicy < ApplicationPolicy 4 | def update? 5 | staff? 6 | end 7 | 8 | def index? 9 | staff? 10 | end 11 | 12 | def show? 13 | staff? 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/services/concerns/stream_entry_renderer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module StreamEntryRenderer 4 | def stream_entry_to_xml(stream_entry) 5 | OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.entry(stream_entry, true)) 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160919221059_add_subscription_expires_at_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddSubscriptionExpiresAtToAccounts < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :accounts, :subscription_expires_at, :datetime, null: true, default: nil 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170713190709_add_web_push_subscription_to_session_activations.rb: -------------------------------------------------------------------------------- 1 | class AddWebPushSubscriptionToSessionActivations < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :session_activations, :web_push_subscription_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/serializers/rest/context_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class REST::ContextSerializer < ActiveModel::Serializer 4 | has_many :ancestors, serializer: REST::StatusSerializer 5 | has_many :descendants, serializer: REST::StatusSerializer 6 | end 7 | -------------------------------------------------------------------------------- /app/views/accounts/_follow_grid.html.haml: -------------------------------------------------------------------------------- 1 | .accounts-grid 2 | - if accounts.empty? 3 | = render partial: 'accounts/nothing_here' 4 | - else 5 | = render partial: 'accounts/grid_card', collection: accounts, as: :account, cached: true 6 | 7 | = paginate follows 8 | -------------------------------------------------------------------------------- /app/workers/bootstrap_timeline_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class BootstrapTimelineWorker 4 | include Sidekiq::Worker 5 | 6 | def perform(account_id) 7 | BootstrapTimelineService.new.call(Account.find(account_id)) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/lib/hash_object_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | describe HashObject do 6 | it 'has methods corresponding to hash properties' do 7 | expect(HashObject.new(key: 'value').key).to eq 'value' 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/controllers/api/v1/instances_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Api::V1::InstancesController < Api::BaseController 4 | respond_to :json 5 | 6 | def show 7 | render json: {}, serializer: REST::InstanceSerializer 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/javascript/mastodon/features/ui/util/optional_motion.js: -------------------------------------------------------------------------------- 1 | import { reduceMotion } from '../../../initial_state'; 2 | import ReducedMotion from './reduced_motion'; 3 | import Motion from 'react-motion/lib/Motion'; 4 | 5 | export default reduceMotion ? ReducedMotion : Motion; 6 | -------------------------------------------------------------------------------- /app/policies/backup_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class BackupPolicy < ApplicationPolicy 4 | MIN_AGE = 1.week 5 | 6 | def create? 7 | user_signed_in? && current_user.backups.where('created_at >= ?', MIN_AGE.ago).count.zero? 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/services/precompute_feed_service.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class PrecomputeFeedService < BaseService 4 | def call(account) 5 | FeedManager.instance.populate_feed(account) 6 | Redis.current.del("account:#{account.id}:regeneration") 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/views/admin/email_domain_blocks/_email_domain_block.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td.domain 3 | %samp= email_domain_block.domain 4 | %td 5 | = table_link_to 'trash', t('admin.email_domain_blocks.delete'), admin_email_domain_block_path(email_domain_block), method: :delete 6 | -------------------------------------------------------------------------------- /app/views/notification_mailer/_status.text.erb: -------------------------------------------------------------------------------- 1 | <% if status.spoiler_text? %> 2 | <%= raw status.spoiler_text %> 3 | ---- 4 | 5 | <% end %> 6 | <%= raw Formatter.instance.plaintext(status) %> 7 | 8 | <%= raw t('application_mailer.view')%> <%= web_url("statuses/#{status.id}") %> 9 | -------------------------------------------------------------------------------- /db/migrate/20170924022025_ids_to_bigints2.rb: -------------------------------------------------------------------------------- 1 | class IdsToBigints2 < ActiveRecord::Migration[5.1] 2 | def up 3 | change_column :statuses_tags, :tag_id, :bigint 4 | end 5 | 6 | def down 7 | change_column :statuses_tags, :tag_id, :integer 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /.nanoignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .git/ 3 | .gitignore 4 | 5 | .bundle/ 6 | .cache/ 7 | config/deploy/* 8 | coverage 9 | docs/ 10 | .env 11 | log/*.log 12 | neo4j/ 13 | node_modules/ 14 | public/assets/ 15 | public/system/ 16 | spec/ 17 | tmp/ 18 | .vagrant/ 19 | vendor/bundle/ 20 | -------------------------------------------------------------------------------- /app/javascript/styles/custom/alert.scss: -------------------------------------------------------------------------------- 1 | .alert-bar { 2 | .alert { 3 | border: 1px solid transparent; 4 | border-radius: 4px; 5 | padding: 12px; 6 | 7 | color: DarkGoldenrod; 8 | background-color: Beige; 9 | border-color: Goldenrod; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /app/views/notification_mailer/follow.text.erb: -------------------------------------------------------------------------------- 1 | <%= raw t('application_mailer.salutation', name: display_name(@me)) %> 2 | 3 | <%= raw t('notification_mailer.follow.body', name: @account.acct) %> 4 | 5 | <%= raw t('application_mailer.view')%> <%= web_url("accounts/#{@account.id}") %> 6 | -------------------------------------------------------------------------------- /db/migrate/20160223162837_add_metadata_to_statuses.rb: -------------------------------------------------------------------------------- 1 | class AddMetadataToStatuses < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :statuses, :in_reply_to_id, :integer, null: true 4 | add_column :statuses, :reblog_of_id, :integer, null: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/javascript/styles/custom.scss: -------------------------------------------------------------------------------- 1 | @import 'custom/variables'; 2 | @import 'custom/components'; 3 | 4 | @import 'custom/accounts'; 5 | @import 'custom/alert'; 6 | @import 'custom/boost'; 7 | @import 'custom/code'; 8 | @import 'custom/qiita'; 9 | @import 'custom/wide_screen'; 10 | -------------------------------------------------------------------------------- /config/initializers/blacklists.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.configure do 4 | config.x.email_domains_blacklist = ENV.fetch('EMAIL_DOMAIN_BLACKLIST') { 'mvrht.com' } 5 | config.x.email_domains_whitelist = ENV.fetch('EMAIL_DOMAIN_WHITELIST') { '' } 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20170507000211_add_conversation_id_to_statuses.rb: -------------------------------------------------------------------------------- 1 | class AddConversationIdToStatuses < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :statuses, :conversation_id, :bigint, null: true, default: nil 4 | add_index :statuses, :conversation_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /public/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #282c37 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/policies/email_domain_block_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class EmailDomainBlockPolicy < ApplicationPolicy 4 | def index? 5 | admin? 6 | end 7 | 8 | def create? 9 | admin? 10 | end 11 | 12 | def destroy? 13 | admin? 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/views/notification_mailer/follow_request.text.erb: -------------------------------------------------------------------------------- 1 | <%= raw t('application_mailer.salutation', name: display_name(@me)) %> 2 | 3 | <%= raw t('notification_mailer.follow_request.body', name: @account.acct) %> 4 | 5 | <%= raw t('application_mailer.view')%> <%= web_url("follow_requests") %> 6 | -------------------------------------------------------------------------------- /app/workers/block_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class BlockWorker 4 | include Sidekiq::Worker 5 | 6 | def perform(account_id, target_account_id) 7 | AfterBlockService.new.call(Account.find(account_id), Account.find(target_account_id)) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password, :private_key, :public_key, :otp_attempt] 5 | -------------------------------------------------------------------------------- /db/migrate/20161130142058_add_last_successful_delivery_at_to_subscriptions.rb: -------------------------------------------------------------------------------- 1 | class AddLastSuccessfulDeliveryAtToSubscriptions < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :subscriptions, :last_successful_delivery_at, :datetime, null: true, default: nil 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170720000000_add_index_favourites_on_account_id_and_id.rb: -------------------------------------------------------------------------------- 1 | class AddIndexFavouritesOnAccountIdAndId < ActiveRecord::Migration[5.1] 2 | def change 3 | # Used to query favourites of an account ordered by id. 4 | add_index :favourites, [:account_id, :id] 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20170905044538_add_index_id_account_id_activity_type_on_notifications.rb: -------------------------------------------------------------------------------- 1 | class AddIndexIdAccountIdActivityTypeOnNotifications < ActiveRecord::Migration[5.1] 2 | def change 3 | add_index :notifications, [:id, :account_id, :activity_type], order: { id: :desc } 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170928082043_create_email_domain_blocks.rb: -------------------------------------------------------------------------------- 1 | class CreateEmailDomainBlocks < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :email_domain_blocks do |t| 4 | t.string :domain, null: false 5 | 6 | t.timestamps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/javascript/images/icon_grade.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/workers/removal_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemovalWorker 4 | include Sidekiq::Worker 5 | 6 | def perform(status_id) 7 | RemoveStatusService.new.call(Status.find(status_id)) 8 | rescue ActiveRecord::RecordNotFound 9 | true 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20170901142658_create_join_table_preview_cards_statuses.rb: -------------------------------------------------------------------------------- 1 | class CreateJoinTablePreviewCardsStatuses < ActiveRecord::Migration[5.1] 2 | def change 3 | create_join_table :preview_cards, :statuses do |t| 4 | t.index [:status_id, :preview_card_id] 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20171020084748_add_visible_in_picker_to_custom_emoji.rb: -------------------------------------------------------------------------------- 1 | class AddVisibleInPickerToCustomEmoji < ActiveRecord::Migration[5.1] 2 | def change 3 | safety_assured { 4 | add_column :custom_emojis, :visible_in_picker, :boolean, default: true, null: false 5 | } 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/controllers/concerns/signature_authentication.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module SignatureAuthentication 4 | extend ActiveSupport::Concern 5 | 6 | include SignatureVerification 7 | 8 | def current_account 9 | super || signed_request_account 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/lib/hash_object.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class HashObject 4 | def initialize(hash) 5 | hash.each do |k, v| 6 | instance_variable_set("@#{k}", v) 7 | self.class.send(:define_method, k, proc { instance_variable_get("@#{k}") }) 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/views/shares/show.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :header_tags do 2 | %script#initial-state{ type: 'application/json' }!= json_escape(@initial_state_json) 3 | = javascript_pack_tag 'share', integrity: true, crossorigin: 'anonymous' 4 | 5 | #mastodon-compose{ data: { props: Oj.dump(default_props) } } 6 | -------------------------------------------------------------------------------- /app/workers/resolve_account_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ResolveAccountWorker 4 | include Sidekiq::Worker 5 | 6 | sidekiq_options queue: 'pull', unique: :until_executed 7 | 8 | def perform(uri) 9 | ResolveAccountService.new.call(uri) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /db/migrate/20161105130633_create_statuses_tags_join_table.rb: -------------------------------------------------------------------------------- 1 | class CreateStatusesTagsJoinTable < ActiveRecord::Migration[5.0] 2 | def change 3 | create_join_table :statuses, :tags do |t| 4 | t.index :tag_id 5 | t.index [:tag_id, :status_id], unique: true 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20171201000000_change_account_id_nonnullable_in_lists.rb: -------------------------------------------------------------------------------- 1 | require Rails.root.join('lib', 'mastodon', 'migration_helpers') 2 | 3 | class ChangeAccountIdNonnullableInLists < ActiveRecord::Migration[5.1] 4 | def change 5 | change_column_null :lists, :account_id, false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/controllers/concerns/accountable_concern.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module AccountableConcern 4 | extend ActiveSupport::Concern 5 | 6 | def log_action(action, target) 7 | Admin::ActionLog.create(account: current_account, action: action, target: target) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/models/instance.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Instance 4 | include ActiveModel::Model 5 | 6 | attr_accessor :domain, :accounts_count 7 | 8 | def initialize(account) 9 | @domain = account.domain 10 | @accounts_count = account.accounts_count 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/serializers/activitypub/outbox_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ActivityPub::OutboxSerializer < ActivityPub::CollectionSerializer 4 | def self.serializer_for(model, options) 5 | return ActivityPub::ActivitySerializer if model.is_a?(Status) 6 | super 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/workers/distribution_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class DistributionWorker 4 | include Sidekiq::Worker 5 | 6 | def perform(status_id) 7 | FanOutOnWriteService.new.call(Status.find(status_id)) 8 | rescue ActiveRecord::RecordNotFound 9 | true 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20170423005413_add_allowed_languages_to_user.rb: -------------------------------------------------------------------------------- 1 | class AddAllowedLanguagesToUser < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :users, :allowed_languages, :string, array: true, default: [], null: false 4 | add_index :users, :allowed_languages, using: :gin 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20171125185353_add_index_reblog_of_id_and_account_to_statuses.rb: -------------------------------------------------------------------------------- 1 | class AddIndexReblogOfIdAndAccountToStatuses < ActiveRecord::Migration[5.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :statuses, [:reblog_of_id, :account_id], algorithm: :concurrently 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/controllers/admin/base_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Admin 4 | class BaseController < ApplicationController 5 | include Authorization 6 | include AccountableConcern 7 | 8 | before_action :require_staff! 9 | 10 | layout 'admin' 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/javascript/styles/themes.scss: -------------------------------------------------------------------------------- 1 | body.theme-light { 2 | @import 'theme-light'; 3 | } 4 | 5 | body.theme-dark { 6 | @import 'theme-dark'; 7 | } 8 | 9 | @media screen and (min-width: 1025px) { 10 | .columns-area>div:last-child { 11 | flex: 1 0 auto; 12 | max-width: 640px; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/workers/scheduler/subscriptions_cleanup_scheduler.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'sidekiq-scheduler' 4 | 5 | class Scheduler::SubscriptionsCleanupScheduler 6 | include Sidekiq::Worker 7 | 8 | def perform 9 | Subscription.expired.in_batches.delete_all 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /config/initializers/open_uri_redirection.rb: -------------------------------------------------------------------------------- 1 | require 'open-uri' 2 | 3 | module OpenURI 4 | def OpenURI.redirectable?(uri1, uri2) # :nodoc: 5 | uri1.scheme.downcase == uri2.scheme.downcase || 6 | (/\A(?:http|https|ftp)\z/i =~ uri1.scheme && /\A(?:http|https|ftp)\z/i =~ uri2.scheme) 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20161104173623_create_tags.rb: -------------------------------------------------------------------------------- 1 | class CreateTags < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :tags do |t| 4 | t.string :name, null: false, default: '' 5 | 6 | t.timestamps 7 | end 8 | 9 | add_index :tags, :name, unique: true 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/helpers/instance_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module InstanceHelper 4 | def site_title 5 | Setting.site_title 6 | end 7 | 8 | def site_hostname 9 | @site_hostname ||= Addressable::URI.parse("//#{Rails.configuration.x.local_domain}").display_uri.host 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/javascript/images/icon_email.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/views/admin_mailer/new_report.text.erb: -------------------------------------------------------------------------------- 1 | <%= raw t('application_mailer.salutation', name: display_name(@me)) %> 2 | 3 | <%= raw t('admin_mailer.new_report.body', target: @report.target_account.acct, reporter: @report.account.acct) %> 4 | 5 | <%= raw t('application_mailer.view')%> <%= admin_report_url(@report) %> 6 | -------------------------------------------------------------------------------- /db/migrate/20170406215816_add_notifications_and_favourites_indices.rb: -------------------------------------------------------------------------------- 1 | class AddNotificationsAndFavouritesIndices < ActiveRecord::Migration[5.0] 2 | def change 3 | add_index :notifications, [:activity_id, :activity_type] 4 | add_index :accounts, :url 5 | add_index :favourites, :status_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20171212195226_remove_duplicate_indexes_in_lists.rb: -------------------------------------------------------------------------------- 1 | class RemoveDuplicateIndexesInLists < ActiveRecord::Migration[5.1] 2 | def change 3 | remove_index :list_accounts, name: "index_list_accounts_on_account_id" 4 | remove_index :list_accounts, name: "index_list_accounts_on_list_id" 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/helpers/home_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe HomeHelper, type: :helper do 4 | describe 'default_props' do 5 | it 'returns default properties according to the context' do 6 | expect(helper.default_props).to eq locale: I18n.locale 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | charset = utf-8 11 | indent_style = space 12 | indent_size = 2 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | [Issue text goes here]. 2 | 3 | * * * * 4 | 5 | - [ ] I searched or browsed the repo’s other issues to ensure this is not a duplicate. 6 | - [ ] This bug happens on a [tagged release](https://github.com/tootsuite/mastodon/releases) and not on `master` (If you're a user, don't worry about this). 7 | -------------------------------------------------------------------------------- /app/lib/themes.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'singleton' 4 | require 'yaml' 5 | 6 | class Themes 7 | include Singleton 8 | 9 | def initialize 10 | @conf = YAML.load_file(Rails.root.join('config', 'themes.yml')) 11 | end 12 | 13 | def names 14 | @conf.keys 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/services/block_domain_from_account_service.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class BlockDomainFromAccountService < BaseService 4 | def call(account, domain) 5 | account.block_domain!(domain) 6 | account.passive_relationships.where(account: Account.where(domain: domain)).delete_all 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/views/user_mailer/email_changed.text.erb: -------------------------------------------------------------------------------- 1 | <%= t 'devise.mailer.email_changed.title' %> 2 | 3 | === 4 | 5 | <%= t 'devise.mailer.email_changed.explanation' %> 6 | 7 | <%= @resource.try(:unconfirmed_email) ? @resource.unconfirmed_email : @resource.email %> 8 | 9 | <%= t 'devise.mailer.email_changed.extra' %> 10 | -------------------------------------------------------------------------------- /app/workers/domain_block_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class DomainBlockWorker 4 | include Sidekiq::Worker 5 | 6 | def perform(domain_block_id) 7 | BlockDomainService.new.call(DomainBlock.find(domain_block_id)) 8 | rescue ActiveRecord::RecordNotFound 9 | true 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/controllers/api/v1/custom_emojis_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Api::V1::CustomEmojisController < Api::BaseController 4 | respond_to :json 5 | 6 | def index 7 | render json: CustomEmoji.local.where(disabled: false), each_serializer: REST::CustomEmojiSerializer 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/javascript/mastodon/features/status/containers/card_container.js: -------------------------------------------------------------------------------- 1 | import { connect } from 'react-redux'; 2 | import Card from '../components/card'; 3 | 4 | const mapStateToProps = (state, { statusId }) => ({ 5 | card: state.getIn(['cards', statusId], null), 6 | }); 7 | 8 | export default connect(mapStateToProps)(Card); 9 | -------------------------------------------------------------------------------- /db/migrate/20170330164118_add_attachment_data_to_imports.rb: -------------------------------------------------------------------------------- 1 | class AddAttachmentDataToImports < ActiveRecord::Migration[4.2] 2 | def self.up 3 | change_table :imports do |t| 4 | t.attachment :data 5 | end 6 | end 7 | 8 | def self.down 9 | remove_attachment :imports, :data 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/javascript/mastodon/features/ui/components/drawer_loading.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const DrawerLoading = () => ( 4 |
5 |
6 |
7 |
8 |
9 | ); 10 | 11 | export default DrawerLoading; 12 | -------------------------------------------------------------------------------- /app/lib/sidekiq_error_handler.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class SidekiqErrorHandler 4 | def call(*) 5 | yield 6 | rescue Mastodon::HostValidationError => e 7 | Rails.logger.error "#{e.class}: #{e.message}" 8 | Rails.logger.error e.backtrace.join("\n") 9 | # Do not retry 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/policies/domain_block_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class DomainBlockPolicy < ApplicationPolicy 4 | def index? 5 | admin? 6 | end 7 | 8 | def show? 9 | admin? 10 | end 11 | 12 | def create? 13 | admin? 14 | end 15 | 16 | def destroy? 17 | admin? 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/workers/processing_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ProcessingWorker 4 | include Sidekiq::Worker 5 | 6 | sidekiq_options backtrace: true 7 | 8 | def perform(account_id, body) 9 | ProcessFeedService.new.call(body, Account.find(account_id), override_timestamps: true) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20170330163835_create_imports.rb: -------------------------------------------------------------------------------- 1 | class CreateImports < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :imports do |t| 4 | t.integer :account_id, null: false 5 | t.integer :type, null: false 6 | t.boolean :approved 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20171114231651_create_lists.rb: -------------------------------------------------------------------------------- 1 | class CreateLists < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :lists do |t| 4 | t.references :account, foreign_key: { on_delete: :cascade } 5 | t.string :title, null: false, default: '' 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/views/settings/applications/new.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :page_title do 2 | = t('doorkeeper.applications.new.title') 3 | 4 | = simple_form_for @application, url: settings_applications_path do |f| 5 | = render 'fields', f: f 6 | 7 | .actions 8 | = f.button :button, t('doorkeeper.applications.buttons.submit'), type: :submit 9 | -------------------------------------------------------------------------------- /config/locales/activerecord.zh-CN.yml: -------------------------------------------------------------------------------- 1 | --- 2 | zh-CN: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: 只能使用字母、数字和下划线 10 | status: 11 | attributes: 12 | reblog: 13 | taken: 已经被转嘟过 14 | -------------------------------------------------------------------------------- /db/migrate/20160227230233_add_attachment_avatar_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddAttachmentAvatarToAccounts < ActiveRecord::Migration[4.2] 2 | def self.up 3 | change_table :accounts do |t| 4 | t.attachment :avatar 5 | end 6 | end 7 | 8 | def self.down 9 | remove_attachment :accounts, :avatar 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20160312193225_add_attachment_header_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddAttachmentHeaderToAccounts < ActiveRecord::Migration[4.2] 2 | def self.up 3 | change_table :accounts do |t| 4 | t.attachment :header 5 | end 6 | end 7 | 8 | def self.down 9 | remove_attachment :accounts, :header 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/javascript/mastodon/features/ui/containers/alert_bar_container.js: -------------------------------------------------------------------------------- 1 | import { connect } from 'react-redux'; 2 | import AlertBar from '../components/alert_bar'; 3 | 4 | const mapStateToProps = state => ({ 5 | isEmailConfirmed: state.getIn(['meta', 'is_email_confirmed']), 6 | }); 7 | 8 | export default connect(mapStateToProps)(AlertBar); 9 | -------------------------------------------------------------------------------- /app/javascript/mastodon/features/ui/containers/loading_bar_container.js: -------------------------------------------------------------------------------- 1 | import { connect } from 'react-redux'; 2 | import LoadingBar from 'react-redux-loading-bar'; 3 | 4 | const mapStateToProps = (state) => ({ 5 | loading: state.get('loadingBar'), 6 | }); 7 | 8 | export default connect(mapStateToProps)(LoadingBar.WrappedComponent); 9 | -------------------------------------------------------------------------------- /app/lib/fast_geometry_parser.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class FastGeometryParser 4 | def self.from_file(file) 5 | width, height = FastImage.size(file.path) 6 | 7 | raise Paperclip::Errors::NotIdentifiedByImageMagickError if width.nil? 8 | 9 | Paperclip::Geometry.new(width, height) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/views/settings/two_factor_authentication/recovery_codes/index.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :page_title do 2 | = t('settings.two_factor_authentication') 3 | 4 | %p.hint= t('two_factor_authentication.recovery_instructions_html') 5 | 6 | %ol.recovery-codes 7 | - @recovery_codes.each do |code| 8 | %li< 9 | %samp= code 10 | -------------------------------------------------------------------------------- /app/views/stream_entries/_content_spoiler.html.haml: -------------------------------------------------------------------------------- 1 | .media-spoiler-wrapper{ class: sensitive == false && 'media-spoiler-wrapper__visible' } 2 | .spoiler-button 3 | .icon-button.overlayed 4 | %i.fa.fa-fw.fa-eye 5 | .media-spoiler 6 | %span= t('stream_entries.sensitive_content') 7 | %span= t('stream_entries.click_to_show') 8 | -------------------------------------------------------------------------------- /app/workers/unfavourite_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class UnfavouriteWorker 4 | include Sidekiq::Worker 5 | 6 | def perform(account_id, status_id) 7 | UnfavouriteService.new.call(Account.find(account_id), Status.find(status_id)) 8 | rescue ActiveRecord::RecordNotFound 9 | true 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20161009120834_create_domain_blocks.rb: -------------------------------------------------------------------------------- 1 | class CreateDomainBlocks < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :domain_blocks do |t| 4 | t.string :domain, null: false, default: '' 5 | t.timestamps 6 | end 7 | 8 | add_index :domain_blocks, :domain, unique: true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/javascript/mastodon/actions/emojis.js: -------------------------------------------------------------------------------- 1 | import { saveSettings } from './settings'; 2 | 3 | export const EMOJI_USE = 'EMOJI_USE'; 4 | 5 | export function useEmoji(emoji) { 6 | return dispatch => { 7 | dispatch({ 8 | type: EMOJI_USE, 9 | emoji, 10 | }); 11 | 12 | dispatch(saveSettings()); 13 | }; 14 | }; 15 | -------------------------------------------------------------------------------- /app/javascript/mastodon/features/compose/containers/search_results_container.js: -------------------------------------------------------------------------------- 1 | import { connect } from 'react-redux'; 2 | import SearchResults from '../components/search_results'; 3 | 4 | const mapStateToProps = state => ({ 5 | results: state.getIn(['search', 'results']), 6 | }); 7 | 8 | export default connect(mapStateToProps)(SearchResults); 9 | -------------------------------------------------------------------------------- /app/javascript/styles/mastodon/_mixins.scss: -------------------------------------------------------------------------------- 1 | @mixin avatar-radius() { 2 | border-radius: 4px; 3 | background: transparent no-repeat; 4 | background-position: 50%; 5 | background-clip: padding-box; 6 | } 7 | 8 | @mixin avatar-size($size:48px) { 9 | width: $size; 10 | height: $size; 11 | background-size: $size $size; 12 | } 13 | -------------------------------------------------------------------------------- /app/views/tags/_og.html.haml: -------------------------------------------------------------------------------- 1 | = opengraph 'og:site_name', t('about.hosted_on', domain: site_hostname) 2 | = opengraph 'og:url', tag_url(@tag) 3 | = opengraph 'og:type', 'website' 4 | = opengraph 'og:title', "##{@tag.name}" 5 | = opengraph 'og:description', t('about.about_hashtag_html', hashtag: @tag.name) 6 | = opengraph 'twitter:card', 'summary' 7 | -------------------------------------------------------------------------------- /db/migrate/20160222122600_create_stream_entries.rb: -------------------------------------------------------------------------------- 1 | class CreateStreamEntries < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :stream_entries do |t| 4 | t.integer :account_id 5 | t.integer :activity_id 6 | t.string :activity_type 7 | 8 | t.timestamps null: false 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20170109120109_create_web_settings.rb: -------------------------------------------------------------------------------- 1 | class CreateWebSettings < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :web_settings do |t| 4 | t.integer :user_id 5 | t.json :data 6 | 7 | t.timestamps 8 | end 9 | 10 | add_index :web_settings, :user_id, unique: true 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20170322162804_add_search_index_to_tags.rb: -------------------------------------------------------------------------------- 1 | class AddSearchIndexToTags < ActiveRecord::Migration[5.0] 2 | def up 3 | execute 'CREATE INDEX hashtag_search_index ON tags USING gin(to_tsvector(\'simple\', tags.name));' 4 | end 5 | 6 | def down 7 | remove_index :tags, name: :hashtag_search_index 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20171118012443_add_moved_to_account_id_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddMovedToAccountIdToAccounts < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :accounts, :moved_to_account_id, :bigint, null: true, default: nil 4 | add_foreign_key :accounts, :accounts, column: :moved_to_account_id, on_delete: :nullify 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/javascript/images/icon_person_add.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/javascript/styles/custom/code.scss: -------------------------------------------------------------------------------- 1 | code.hljs { 2 | margin: 10px 0; 3 | padding: 8px; 4 | border-radius: 2px; 5 | font-size: 12px; 6 | line-height: 1.2; 7 | white-space: pre; 8 | 9 | &.inline { 10 | display: inline; 11 | padding: 1px 6px; 12 | white-space: pre-wrap; 13 | word-break: break-all; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/workers/merge_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class MergeWorker 4 | include Sidekiq::Worker 5 | 6 | sidekiq_options queue: 'pull' 7 | 8 | def perform(from_account_id, into_account_id) 9 | FeedManager.instance.merge_into_timeline(Account.find(from_account_id), Account.find(into_account_id)) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /config/initializers/premailer_rails.rb: -------------------------------------------------------------------------------- 1 | require_relative '../../lib/mastodon/premailer_webpack_strategy' 2 | 3 | Premailer::Rails.config.merge!(remove_ids: true, 4 | adapter: :nokogiri, 5 | generate_text_part: false, 6 | strategies: [PremailerWebpackStrategy]) 7 | -------------------------------------------------------------------------------- /config/initializers/raven.rb: -------------------------------------------------------------------------------- 1 | Raven.configure do |config| 2 | config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s) 3 | config.environments = %w(staging production) 4 | config.excluded_exceptions += ['OpenSSL::SSL::SSLError', 'Mastodon::UnexpectedResponseError', 'HTTP::TimeoutError', 'HTTP::ConnectionError'] 5 | end 6 | 7 | -------------------------------------------------------------------------------- /db/migrate/20160314164231_add_owner_to_application.rb: -------------------------------------------------------------------------------- 1 | class AddOwnerToApplication < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :oauth_applications, :owner_id, :integer, null: true 4 | add_column :oauth_applications, :owner_type, :string, null: true 5 | add_index :oauth_applications, [:owner_id, :owner_type] 6 | end 7 | end -------------------------------------------------------------------------------- /db/migrate/20170506235850_create_conversations.rb: -------------------------------------------------------------------------------- 1 | class CreateConversations < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :conversations, id: :bigserial do |t| 4 | t.string :uri, null: true, default: nil 5 | t.timestamps 6 | end 7 | 8 | add_index :conversations, :uri, unique: true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20170913000752_create_site_uploads.rb: -------------------------------------------------------------------------------- 1 | class CreateSiteUploads < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :site_uploads do |t| 4 | t.string :var, default: '', null: false, index: { unique: true } 5 | t.attachment :file 6 | t.json :meta 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/views/user_mailer/reconfirmation_instructions.text.erb: -------------------------------------------------------------------------------- 1 | <%= t 'devise.mailer.reconfirmation_instructions.title' %> 2 | 3 | === 4 | 5 | <%= t 'devise.mailer.reconfirmation_instructions.explanation' %> 6 | 7 | => <%= confirmation_url(@resource, confirmation_token: @token) %> 8 | 9 | <%= t 'devise.mailer.reconfirmation_instructions.extra' %> 10 | -------------------------------------------------------------------------------- /app/workers/admin/suspension_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Admin::SuspensionWorker 4 | include Sidekiq::Worker 5 | 6 | sidekiq_options queue: 'pull' 7 | 8 | def perform(account_id, remove_user = false) 9 | SuspendAccountService.new.call(Account.find(account_id), remove_user: remove_user) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/workers/link_crawl_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class LinkCrawlWorker 4 | include Sidekiq::Worker 5 | 6 | sidekiq_options queue: 'pull', retry: 0 7 | 8 | def perform(status_id) 9 | FetchLinkCardService.new.call(Status.find(status_id)) 10 | rescue ActiveRecord::RecordNotFound 11 | true 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/workers/unmerge_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class UnmergeWorker 4 | include Sidekiq::Worker 5 | 6 | sidekiq_options queue: 'pull' 7 | 8 | def perform(from_account_id, into_account_id) 9 | FeedManager.instance.unmerge_from_timeline(Account.find(from_account_id), Account.find(into_account_id)) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /config/locales/activerecord.fa.yml: -------------------------------------------------------------------------------- 1 | --- 2 | fa: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: تنها حروف، اعداد، و زیرخط 10 | status: 11 | attributes: 12 | reblog: 13 | taken: نوشته‌ها وجود دارند 14 | -------------------------------------------------------------------------------- /db/migrate/20170209184350_add_reply_to_statuses.rb: -------------------------------------------------------------------------------- 1 | class AddReplyToStatuses < ActiveRecord::Migration[5.0] 2 | def up 3 | add_column :statuses, :reply, :boolean, nil: false, default: false 4 | Status.update_all('reply = (in_reply_to_id IS NOT NULL)') 5 | end 6 | 7 | def down 8 | remove_column :statuses, :reply 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20171010025614_change_accounts_nonnullable_in_account_moderation_notes.rb: -------------------------------------------------------------------------------- 1 | class ChangeAccountsNonnullableInAccountModerationNotes < ActiveRecord::Migration[5.1] 2 | def change 3 | change_column_null :account_moderation_notes, :account_id, false 4 | change_column_null :account_moderation_notes, :target_account_id, false 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/javascript/styles/mastodon/lists.scss: -------------------------------------------------------------------------------- 1 | .no-list { 2 | list-style: none; 3 | 4 | li { 5 | display: inline-block; 6 | margin: 0 5px; 7 | } 8 | } 9 | 10 | .recovery-codes { 11 | list-style: none; 12 | margin: 0 auto; 13 | 14 | li { 15 | font-size: 125%; 16 | line-height: 1.5; 17 | letter-spacing: 1px; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/views/about/terms.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :page_title do 2 | = t('terms.title', instance: site_hostname) 3 | 4 | .landing-page 5 | .header-wrapper.compact 6 | .header 7 | = render 'links' 8 | 9 | .extended-description 10 | .container-alt 11 | = @instance_presenter.site_terms.html_safe.presence || t('terms.body_html') 12 | -------------------------------------------------------------------------------- /app/views/user_mailer/reset_password_instructions.text.erb: -------------------------------------------------------------------------------- 1 | <%= t 'devise.mailer.reset_password_instructions.title' %> 2 | 3 | === 4 | 5 | <%= t 'devise.mailer.reset_password_instructions.explanation' %> 6 | 7 | => <%= edit_password_url(@resource, reset_password_token: @token) %> 8 | 9 | <%= t 'devise.mailer.reset_password_instructions.extra' %> 10 | -------------------------------------------------------------------------------- /config/initializers/trusted_proxies.rb: -------------------------------------------------------------------------------- 1 | module Rack 2 | class Request 3 | def trusted_proxy?(ip) 4 | if Rails.application.config.action_dispatch.trusted_proxies.nil? 5 | super 6 | else 7 | Rails.application.config.action_dispatch.trusted_proxies.any? { |proxy| proxy === ip } 8 | end 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /config/locales/activerecord.ar.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ar: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: فقط حروف و أرقام و سطور سفلية 10 | status: 11 | attributes: 12 | reblog: 13 | taken: المنشور موجود مِن قبل 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.gl.yml: -------------------------------------------------------------------------------- 1 | --- 2 | gl: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: só letras, números e liñas baixas 10 | status: 11 | attributes: 12 | reblog: 13 | taken: do estado xa existe 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.he.yml: -------------------------------------------------------------------------------- 1 | --- 2 | he: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: ספרות, אותיות לטיניות וקו תחתי בלבד 10 | status: 11 | attributes: 12 | reblog: 13 | taken: של החצרוץ כבר קיים 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.sr.yml: -------------------------------------------------------------------------------- 1 | --- 2 | sr: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: само слова, бројеви и доње црте 10 | status: 11 | attributes: 12 | reblog: 13 | taken: статуса већ постоји 14 | -------------------------------------------------------------------------------- /db/migrate/20170625140443_add_access_token_id_to_session_activations.rb: -------------------------------------------------------------------------------- 1 | class AddAccessTokenIdToSessionActivations < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :session_activations, :access_token_id, :integer 4 | add_foreign_key :session_activations, :oauth_access_tokens, column: :access_token_id, on_delete: :cascade 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20171129172043_add_index_on_stream_entries.rb: -------------------------------------------------------------------------------- 1 | class AddIndexOnStreamEntries < ActiveRecord::Migration[5.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :stream_entries, [:account_id, :activity_type, :id], algorithm: :concurrently 6 | remove_index :stream_entries, name: :index_stream_entries_on_account_id 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /lib/templates/haml/scaffold/_form.html.haml: -------------------------------------------------------------------------------- 1 | = simple_form_for(@<%= singular_table_name %>) do |f| 2 | = f.error_notification 3 | 4 | .form-inputs 5 | <%- attributes.each do |attribute| -%> 6 | = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> 7 | <%- end -%> 8 | 9 | .form-actions 10 | = f.button :submit 11 | -------------------------------------------------------------------------------- /spec/support/examples/lib/settings/settings_extended.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | shared_examples 'Settings-extended' do 4 | describe 'settings' do 5 | def fabricate 6 | super.settings 7 | end 8 | 9 | def create! 10 | super.settings 11 | end 12 | 13 | it_behaves_like 'ScopedSettings' 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/javascript/mastodon/features/generic_not_found/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Column from '../ui/components/column'; 3 | import MissingIndicator from '../../components/missing_indicator'; 4 | 5 | const GenericNotFound = () => ( 6 | 7 | 8 | 9 | ); 10 | 11 | export default GenericNotFound; 12 | -------------------------------------------------------------------------------- /app/policies/account_moderation_note_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AccountModerationNotePolicy < ApplicationPolicy 4 | def create? 5 | staff? 6 | end 7 | 8 | def destroy? 9 | admin? || owner? 10 | end 11 | 12 | private 13 | 14 | def owner? 15 | record.account_id == current_account&.id 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/views/settings/qiita_authorizations/show.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :page_title do 2 | = t('qiitadon.qiita_authorizations') 3 | 4 | %table.table 5 | %tbody 6 | %tr 7 | %th User ID 8 | %th Status 9 | %tr 10 | %td= @qiita_authorization.try(:uid) 11 | %td= @qiita_authorization ? '連携中' : link_to('連携する', '/auth/auth/qiita') 12 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Mime::Type.register 'application/json', :json, %w(text/x-json application/jsonrequest application/jrd+json application/activity+json application/ld+json) 4 | Mime::Type.register 'text/xml', :xml, %w(application/xml application/atom+xml application/xrd+xml) 5 | -------------------------------------------------------------------------------- /config/locales/activerecord.ca.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ca: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: només lletres, números i subratllats 10 | status: 11 | attributes: 12 | reblog: 13 | taken: de l'estat ja existeix 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.es.yml: -------------------------------------------------------------------------------- 1 | --- 2 | es: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: solo letras, números y guiones bajos 10 | status: 11 | attributes: 12 | reblog: 13 | taken: del estado ya existe 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.pt.yml: -------------------------------------------------------------------------------- 1 | --- 2 | pt: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: apenas letras, números e underscores 10 | status: 11 | attributes: 12 | reblog: 13 | taken: do status já existe 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.sk.yml: -------------------------------------------------------------------------------- 1 | --- 2 | sk: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: iba písmená, číslice a podčiarkovníky 10 | status: 11 | attributes: 12 | reblog: 13 | taken: status už existuje 14 | -------------------------------------------------------------------------------- /app/javascript/mastodon/features/compose/util/counter.js: -------------------------------------------------------------------------------- 1 | import { urlRegex } from './url_regex'; 2 | 3 | const urlPlaceholder = 'xxxxxxxxxxxxxxxxxxxxxxx'; 4 | 5 | export function countableText(inputText) { 6 | return inputText 7 | .replace(urlRegex, urlPlaceholder) 8 | .replace(/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/ig, '$1@$3'); 9 | }; 10 | -------------------------------------------------------------------------------- /config/locales/activerecord.en.yml: -------------------------------------------------------------------------------- 1 | --- 2 | en: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: only letters, numbers and underscores 10 | status: 11 | attributes: 12 | reblog: 13 | taken: of status already exists 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.id.yml: -------------------------------------------------------------------------------- 1 | --- 2 | id: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: hanya boleh berisi huruf, angka, dan underscore 10 | status: 11 | attributes: 12 | reblog: 13 | taken: status sudah ada 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.it.yml: -------------------------------------------------------------------------------- 1 | --- 2 | it: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: solo lettere, numeri e trattino basso 10 | status: 11 | attributes: 12 | reblog: 13 | taken: dello stato esiste già 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.nl.yml: -------------------------------------------------------------------------------- 1 | --- 2 | nl: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: alleen letters, nummers en laag streepje 10 | status: 11 | attributes: 12 | reblog: 13 | taken: van toot bestaat al 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.oc.yml: -------------------------------------------------------------------------------- 1 | --- 2 | oc: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: solament letras, nombres e tirets bas 10 | status: 11 | attributes: 12 | reblog: 13 | taken: de l’estatut existís ja 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.pt-BR.yml: -------------------------------------------------------------------------------- 1 | --- 2 | pt-BR: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: apenas letras, números e underscores 10 | status: 11 | attributes: 12 | reblog: 13 | taken: do status já existe 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.ru.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ru: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: только буквы, цифры и символ подеркивания 10 | status: 11 | attributes: 12 | reblog: 13 | taken: статуса уже существует 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.sr-Latn.yml: -------------------------------------------------------------------------------- 1 | --- 2 | sr-Latn: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: samo slova, brojevi i donje crte 10 | status: 11 | attributes: 12 | reblog: 13 | taken: statusa već postoji 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.th.yml: -------------------------------------------------------------------------------- 1 | --- 2 | th: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: only letters, numbers and underscores 10 | status: 11 | attributes: 12 | reblog: 13 | taken: of status already exists 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.uk.yml: -------------------------------------------------------------------------------- 1 | --- 2 | uk: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: тільки букви, цифри та нижні підкреслювання 10 | status: 11 | attributes: 12 | reblog: 13 | taken: статусу вже існує 14 | -------------------------------------------------------------------------------- /db/migrate/20160221003140_create_users.rb: -------------------------------------------------------------------------------- 1 | class CreateUsers < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :users do |t| 4 | t.string :email, null: false, default: '' 5 | t.integer :account_id, null: false 6 | 7 | t.timestamps null: false 8 | end 9 | 10 | add_index :users, :email, unique: true 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20160224223247_create_mentions.rb: -------------------------------------------------------------------------------- 1 | class CreateMentions < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :mentions do |t| 4 | t.integer :account_id 5 | t.integer :status_id 6 | 7 | t.timestamps null: false 8 | end 9 | 10 | add_index :mentions, [:account_id, :status_id], unique: true 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20180211015820_create_backups.rb: -------------------------------------------------------------------------------- 1 | class CreateBackups < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :backups do |t| 4 | t.references :user, foreign_key: { on_delete: :nullify } 5 | t.attachment :dump 6 | t.boolean :processed, null: false, default: false 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/controllers/manifests_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe ManifestsController do 4 | render_views 5 | 6 | describe 'GET #show' do 7 | before do 8 | get :show, format: :json 9 | end 10 | 11 | it 'returns http success' do 12 | expect(response).to have_http_status(:success) 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/javascript/mastodon/features/compose/containers/upload_form_container.js: -------------------------------------------------------------------------------- 1 | import { connect } from 'react-redux'; 2 | import UploadForm from '../components/upload_form'; 3 | 4 | const mapStateToProps = state => ({ 5 | mediaIds: state.getIn(['compose', 'media_attachments']).map(item => item.get('id')), 6 | }); 7 | 8 | export default connect(mapStateToProps)(UploadForm); 9 | -------------------------------------------------------------------------------- /app/workers/activitypub/processing_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ActivityPub::ProcessingWorker 4 | include Sidekiq::Worker 5 | 6 | sidekiq_options backtrace: true 7 | 8 | def perform(account_id, body) 9 | ActivityPub::ProcessCollectionService.new.call(body, Account.find(account_id), override_timestamps: true) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /config/locales/activerecord.de.yml: -------------------------------------------------------------------------------- 1 | --- 2 | de: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: nur Buchstaben, Ziffern und Unterstriche 10 | status: 11 | attributes: 12 | reblog: 13 | taken: des Status existiert schon 14 | -------------------------------------------------------------------------------- /config/locales/activerecord.no.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 'no': 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: bare bokstaver, tall og understreker 10 | status: 11 | attributes: 12 | reblog: 13 | taken: av status eksisterer allerede 14 | -------------------------------------------------------------------------------- /db/migrate/20160222143943_add_profile_fields_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddProfileFieldsToAccounts < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :accounts, :note, :text, null: false, default: '' 4 | add_column :accounts, :display_name, :string, null: false, default: '' 5 | add_column :accounts, :uri, :string, null: false, default: '' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160926213048_remove_owner_from_application.rb: -------------------------------------------------------------------------------- 1 | class RemoveOwnerFromApplication < ActiveRecord::Migration[5.0] 2 | def change 3 | remove_index :oauth_applications, [:owner_id, :owner_type] 4 | remove_column :oauth_applications, :owner_id, :integer, null: true 5 | remove_column :oauth_applications, :owner_type, :string, null: true 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20171114080328_add_index_domain_to_email_domain_blocks.rb: -------------------------------------------------------------------------------- 1 | class AddIndexDomainToEmailDomainBlocks < ActiveRecord::Migration[5.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :email_domain_blocks, :domain, algorithm: :concurrently, unique: true 6 | change_column_default :email_domain_blocks, :domain, from: nil, to: '' 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/lib/ostatus/activity/remote.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class OStatus::Activity::Remote < OStatus::Activity::Base 4 | def perform 5 | if activitypub_uri? 6 | find_status(activitypub_uri) || FetchRemoteStatusService.new.call(url) 7 | else 8 | find_status(id) || FetchRemoteStatusService.new.call(url) 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/serializers/rest/search_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class REST::SearchSerializer < ActiveModel::Serializer 4 | attributes :hashtags 5 | 6 | has_many :accounts, serializer: REST::AccountSerializer 7 | has_many :statuses, serializer: REST::StatusSerializer 8 | 9 | def hashtags 10 | object.hashtags.map(&:name) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/services/unmute_service.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class UnmuteService < BaseService 4 | def call(account, target_account) 5 | return unless account.muting?(target_account) 6 | 7 | account.unmute!(target_account) 8 | 9 | MergeWorker.perform_async(target_account.id, account.id) if account.following?(target_account) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /config/locales/activerecord.fr.yml: -------------------------------------------------------------------------------- 1 | --- 2 | fr: 3 | activerecord: 4 | errors: 5 | models: 6 | account: 7 | attributes: 8 | username: 9 | invalid: seulement des lettres, des nombres et des tirets bas 10 | status: 11 | attributes: 12 | reblog: 13 | taken: du statut existe déjà 14 | -------------------------------------------------------------------------------- /db/migrate/20161122163057_remove_unneeded_indexes.rb: -------------------------------------------------------------------------------- 1 | class RemoveUnneededIndexes < ActiveRecord::Migration[5.0] 2 | def change 3 | remove_index :notifications, name: "index_notifications_on_account_id" 4 | remove_index :settings, name: "index_settings_on_target_type_and_target_id" 5 | remove_index :statuses_tags, name: "index_statuses_tags_on_tag_id" 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/models/site_upload_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe SiteUpload, type: :model do 6 | describe '#cache_key' do 7 | let(:site_upload) { SiteUpload.new(var: 'var') } 8 | 9 | it 'returns cache_key' do 10 | expect(site_upload.cache_key).to eq 'site_uploads/var' 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/controllers/account_follow_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AccountFollowController < ApplicationController 4 | include AccountControllerConcern 5 | 6 | before_action :authenticate_user! 7 | 8 | def create 9 | FollowService.new.call(current_user.account, @account.acct) 10 | redirect_to account_path(@account) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/controllers/account_unfollow_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AccountUnfollowController < ApplicationController 4 | include AccountControllerConcern 5 | 6 | before_action :authenticate_user! 7 | 8 | def create 9 | UnfollowService.new.call(current_user.account, @account) 10 | redirect_to account_path(@account) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/workers/notification_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class NotificationWorker 4 | include Sidekiq::Worker 5 | 6 | sidekiq_options queue: 'push', retry: 5 7 | 8 | def perform(xml, source_account_id, target_account_id) 9 | SendInteractionService.new.call(xml, Account.find(source_account_id), Account.find(target_account_id)) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /config/initializers/redis.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | redis_connection = Redis.new( 4 | url: ENV['REDIS_URL'], 5 | driver: :hiredis 6 | ) 7 | 8 | namespace = ENV.fetch('REDIS_NAMESPACE') { nil } 9 | 10 | if namespace 11 | Redis.current = Redis::Namespace.new(namespace, redis: redis_connection) 12 | else 13 | Redis.current = redis_connection 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20170624134742_add_description_to_session_activations.rb: -------------------------------------------------------------------------------- 1 | class AddDescriptionToSessionActivations < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :session_activations, :user_agent, :string, null: false, default: '' 4 | add_column :session_activations, :ip, :inet 5 | add_foreign_key :session_activations, :users, on_delete: :cascade 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/controllers/settings/qiita_authorizations_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Settings::QiitaAuthorizationsController < ApplicationController 4 | layout 'admin' 5 | 6 | before_action :authenticate_user! 7 | 8 | def show 9 | @account = current_account 10 | @qiita_authorization = current_account.user.qiita_authorization 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/javascript/styles/theme-base/accounts.scss: -------------------------------------------------------------------------------- 1 | @import 'styles'; 2 | 3 | .activity-stream-tabs { 4 | @extend %box-styles; 5 | 6 | a { 7 | color: $ui-highlight-color; 8 | 9 | &:hover, 10 | &:active, 11 | &:focus { 12 | color: lighten($ui-highlight-color, 8%); 13 | } 14 | 15 | &.active { 16 | color: $text-color; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /db/migrate/20170504103736_create_qiita_authorizations.rb: -------------------------------------------------------------------------------- 1 | class CreateQiitaAuthorizations < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :qiita_authorizations do |t| 4 | t.belongs_to :user, foreign_key: true 5 | t.string :uid 6 | t.string :token 7 | 8 | t.index :uid, unique: true 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/controllers/api/v1/apps/credentials_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Api::V1::Apps::CredentialsController < Api::BaseController 4 | before_action -> { doorkeeper_authorize! :read } 5 | 6 | respond_to :json 7 | 8 | def show 9 | render json: doorkeeper_token.application, serializer: REST::StatusSerializer::ApplicationSerializer 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/workers/salmon_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class SalmonWorker 4 | include Sidekiq::Worker 5 | 6 | sidekiq_options backtrace: true 7 | 8 | def perform(account_id, body) 9 | ProcessInteractionService.new.call(body, Account.find(account_id)) 10 | rescue Nokogiri::XML::XPath::SyntaxError, ActiveRecord::RecordNotFound 11 | true 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/workers/scheduler/backup_cleanup_scheduler.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | require 'sidekiq-scheduler' 3 | 4 | class Scheduler::BackupCleanupScheduler 5 | include Sidekiq::Worker 6 | 7 | def perform 8 | old_backups.find_each(&:destroy!) 9 | end 10 | 11 | private 12 | 13 | def old_backups 14 | Backup.where('created_at < ?', 7.days.ago) 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /config/webpack/loaders/assets.js: -------------------------------------------------------------------------------- 1 | const { env, publicPath } = require('../configuration.js'); 2 | 3 | module.exports = { 4 | test: /\.(jpg|jpeg|png|gif|svg|eot|ttf|woff|woff2)$/i, 5 | use: [{ 6 | loader: 'file-loader', 7 | options: { 8 | publicPath, 9 | name: env.NODE_ENV === 'production' ? '[name]-[hash].[ext]' : '[name].[ext]', 10 | }, 11 | }], 12 | }; 13 | -------------------------------------------------------------------------------- /db/migrate/20170301222600_create_mutes.rb: -------------------------------------------------------------------------------- 1 | class CreateMutes < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :mutes do |t| 4 | t.integer :account_id, null: false 5 | t.integer :target_account_id, null: false 6 | t.timestamps null: false 7 | end 8 | 9 | add_index :mutes, [:account_id, :target_account_id], unique: true 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20180204034416_create_identities.rb: -------------------------------------------------------------------------------- 1 | class CreateIdentities < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :identities do |t| 4 | t.references :user, foreign_key: { on_delete: :cascade } 5 | t.string :provider, null: false, default: '' 6 | t.string :uid, null: false, default: '' 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/javascript/mastodon/actions/dropdown_menu.js: -------------------------------------------------------------------------------- 1 | export const DROPDOWN_MENU_OPEN = 'DROPDOWN_MENU_OPEN'; 2 | export const DROPDOWN_MENU_CLOSE = 'DROPDOWN_MENU_CLOSE'; 3 | 4 | export function openDropdownMenu(id, placement) { 5 | return { type: DROPDOWN_MENU_OPEN, id, placement }; 6 | } 7 | 8 | export function closeDropdownMenu(id) { 9 | return { type: DROPDOWN_MENU_CLOSE, id }; 10 | } 11 | -------------------------------------------------------------------------------- /app/javascript/mastodon/actions/modal.js: -------------------------------------------------------------------------------- 1 | export const MODAL_OPEN = 'MODAL_OPEN'; 2 | export const MODAL_CLOSE = 'MODAL_CLOSE'; 3 | 4 | export function openModal(type, props) { 5 | return { 6 | type: MODAL_OPEN, 7 | modalType: type, 8 | modalProps: props, 9 | }; 10 | }; 11 | 12 | export function closeModal() { 13 | return { 14 | type: MODAL_CLOSE, 15 | }; 16 | }; 17 | -------------------------------------------------------------------------------- /app/workers/regeneration_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RegenerationWorker 4 | include Sidekiq::Worker 5 | 6 | sidekiq_options unique: :until_executed 7 | 8 | def perform(account_id, _ = :home) 9 | account = Account.find(account_id) 10 | PrecomputeFeedService.new.call(account) 11 | rescue ActiveRecord::RecordNotFound 12 | true 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20170322021028_add_lowercase_index_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddLowercaseIndexToAccounts < ActiveRecord::Migration[5.0] 2 | def up 3 | execute 'CREATE INDEX index_accounts_on_username_and_domain_lower ON accounts (lower(username), lower(domain))' 4 | end 5 | 6 | def down 7 | remove_index :accounts, name: 'index_accounts_on_username_and_domain_lower' 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20170424003227_create_account_domain_blocks.rb: -------------------------------------------------------------------------------- 1 | class CreateAccountDomainBlocks < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :account_domain_blocks do |t| 4 | t.integer :account_id 5 | t.string :domain 6 | 7 | t.timestamps 8 | end 9 | 10 | add_index :account_domain_blocks, [:account_id, :domain], unique: true 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /spec/requests/host_meta_request_spec.rb: -------------------------------------------------------------------------------- 1 | require "rails_helper" 2 | 3 | describe "The host_meta route" do 4 | describe "requested without accepts headers" do 5 | it "returns an xml response" do 6 | get host_meta_url 7 | 8 | expect(response).to have_http_status(:success) 9 | expect(response.content_type).to eq "application/xrd+xml" 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20160221003621_create_follows.rb: -------------------------------------------------------------------------------- 1 | class CreateFollows < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :follows do |t| 4 | t.integer :account_id, null: false 5 | t.integer :target_account_id, null: false 6 | 7 | t.timestamps null: false 8 | end 9 | 10 | add_index :follows, [:account_id, :target_account_id], unique: true 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20160223171800_create_favourites.rb: -------------------------------------------------------------------------------- 1 | class CreateFavourites < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :favourites do |t| 4 | t.integer :account_id, null: false 5 | t.integer :status_id, null: false 6 | 7 | t.timestamps null: false 8 | end 9 | 10 | add_index :favourites, [:account_id, :status_id], unique: true 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20161003145426_create_blocks.rb: -------------------------------------------------------------------------------- 1 | class CreateBlocks < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :blocks do |t| 4 | t.integer :account_id, null: false 5 | t.integer :target_account_id, null: false 6 | 7 | t.timestamps null: false 8 | end 9 | 10 | add_index :blocks, [:account_id, :target_account_id], unique: true 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20170508230434_create_conversation_mutes.rb: -------------------------------------------------------------------------------- 1 | class CreateConversationMutes < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :conversation_mutes do |t| 4 | t.integer :account_id, null: false 5 | t.bigint :conversation_id, null: false 6 | end 7 | 8 | add_index :conversation_mutes, [:account_id, :conversation_id], unique: true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20171226094803_more_faster_index_on_notifications.rb: -------------------------------------------------------------------------------- 1 | class MoreFasterIndexOnNotifications < ActiveRecord::Migration[5.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :notifications, [:account_id, :id], order: { id: :desc }, algorithm: :concurrently 6 | remove_index :notifications, name: :index_notifications_on_id_and_account_id_and_activity_type 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationMailer < ActionMailer::Base 4 | layout 'mailer' 5 | 6 | helper :application 7 | helper :instance 8 | helper :mailer 9 | 10 | protected 11 | 12 | def locale_for_account(account) 13 | I18n.with_locale(account.user_locale || I18n.default_locale) do 14 | yield 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/views/admin/instances/_instance.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td.domain 3 | = link_to instance.domain, admin_accounts_path(by_domain: instance.domain) 4 | %td.count 5 | = instance.accounts_count 6 | %td 7 | = table_link_to 'paper-plane-o', t('admin.accounts.resubscribe'), resubscribe_admin_instances_url(by_domain: instance.domain), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } 8 | -------------------------------------------------------------------------------- /db/migrate/20170713175513_create_web_push_subscriptions.rb: -------------------------------------------------------------------------------- 1 | class CreateWebPushSubscriptions < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :web_push_subscriptions do |t| 4 | t.string :endpoint, null: false 5 | t.string :key_p256dh, null: false 6 | t.string :key_auth, null: false 7 | t.json :data 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/serializers/rest/credential_account_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class REST::CredentialAccountSerializer < REST::AccountSerializer 4 | attributes :source 5 | 6 | def source 7 | user = object.user 8 | { 9 | privacy: user.setting_default_privacy, 10 | sensitive: user.setting_default_sensitive, 11 | note: object.note, 12 | } 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/views/invites/index.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :page_title do 2 | = t('invites.title') 3 | 4 | - if policy(:invite).create? 5 | %p= t('invites.prompt') 6 | 7 | = render 'form' 8 | 9 | %hr/ 10 | 11 | %table.table 12 | %thead 13 | %tr 14 | %th= t('invites.table.uses') 15 | %th= t('invites.table.expires_at') 16 | %th 17 | %th 18 | %tbody 19 | = render @invites 20 | -------------------------------------------------------------------------------- /app/workers/remote_profile_update_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoteProfileUpdateWorker 4 | include Sidekiq::Worker 5 | 6 | sidekiq_options queue: 'pull' 7 | 8 | def perform(account_id, body, resubscribe) 9 | UpdateRemoteProfileService.new.call(body, Account.find(account_id), resubscribe) 10 | rescue ActiveRecord::RecordNotFound 11 | true 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20170129000348_create_devices.rb: -------------------------------------------------------------------------------- 1 | class CreateDevices < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :devices do |t| 4 | t.integer :account_id, null: false 5 | t.string :registration_id, null: false, default: '' 6 | 7 | t.timestamps 8 | end 9 | 10 | add_index :devices, :registration_id 11 | add_index :devices, :account_id 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/javascript/mastodon/features/compose/containers/upload_progress_container.js: -------------------------------------------------------------------------------- 1 | import { connect } from 'react-redux'; 2 | import UploadProgress from '../components/upload_progress'; 3 | 4 | const mapStateToProps = state => ({ 5 | active: state.getIn(['compose', 'is_uploading']), 6 | progress: state.getIn(['compose', 'progress']), 7 | }); 8 | 9 | export default connect(mapStateToProps)(UploadProgress); 10 | -------------------------------------------------------------------------------- /app/views/media/player.html.haml: -------------------------------------------------------------------------------- 1 | %video{ poster: @media_attachment.file.url(:small), preload: 'auto', autoplay: 'autoplay', muted: 'muted', loop: 'loop', controls: 'controls', style: "width: #{@media_attachment.file.meta.dig('original', 'width')}px; height: #{@media_attachment.file.meta.dig('original', 'height')}px" } 2 | %source{ src: @media_attachment.file.url(:original), type: @media_attachment.file_content_type } 3 | -------------------------------------------------------------------------------- /app/workers/scheduler/ip_cleanup_scheduler.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | require 'sidekiq-scheduler' 3 | 4 | class Scheduler::IpCleanupScheduler 5 | include Sidekiq::Worker 6 | 7 | def perform 8 | time_ago = 5.years.ago 9 | SessionActivation.where('updated_at < ?', time_ago).destroy_all 10 | User.where('last_sign_in_at < ?', time_ago).update_all(last_sign_in_ip: nil) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /config/locales/activerecord.ja.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ja: 3 | activerecord: 4 | attributes: 5 | user: 6 | email: メールアドレス 7 | errors: 8 | models: 9 | account: 10 | attributes: 11 | username: 12 | invalid: アルファベット・数値・アンダーバー(_)で入力してください 13 | status: 14 | attributes: 15 | reblog: 16 | taken: のブーストはすでに存在します 17 | -------------------------------------------------------------------------------- /app/javascript/mastodon/features/compose/containers/navigation_container.js: -------------------------------------------------------------------------------- 1 | import { connect } from 'react-redux'; 2 | import NavigationBar from '../components/navigation_bar'; 3 | import { me } from '../../../initial_state'; 4 | 5 | const mapStateToProps = state => { 6 | return { 7 | account: state.getIn(['accounts', me]), 8 | }; 9 | }; 10 | 11 | export default connect(mapStateToProps)(NavigationBar); 12 | -------------------------------------------------------------------------------- /app/serializers/rest/custom_emoji_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class REST::CustomEmojiSerializer < ActiveModel::Serializer 4 | include RoutingHelper 5 | 6 | attributes :shortcode, :url, :static_url, :visible_in_picker 7 | 8 | def url 9 | full_asset_url(object.image.url) 10 | end 11 | 12 | def static_url 13 | full_asset_url(object.image.url(:static)) 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/views/admin/email_domain_blocks/new.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :page_title do 2 | = t('.title') 3 | 4 | = simple_form_for @email_domain_block, url: admin_email_domain_blocks_path do |f| 5 | = render 'shared/error_messages', object: @email_domain_block 6 | 7 | = f.input :domain, placeholder: t('admin.email_domain_blocks.domain') 8 | 9 | .actions 10 | = f.button :button, t('.create'), type: :submit 11 | -------------------------------------------------------------------------------- /db/migrate/20160316103650_add_missing_indices.rb: -------------------------------------------------------------------------------- 1 | class AddMissingIndices < ActiveRecord::Migration[4.2] 2 | def change 3 | add_index :users, :account_id 4 | add_index :statuses, :account_id 5 | add_index :statuses, :in_reply_to_id 6 | add_index :statuses, :reblog_of_id 7 | add_index :stream_entries, :account_id 8 | add_index :stream_entries, [:activity_id, :activity_type] 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20170520145338_change_language_filter_to_opt_out.rb: -------------------------------------------------------------------------------- 1 | class ChangeLanguageFilterToOptOut < ActiveRecord::Migration[5.0] 2 | def change 3 | remove_index :users, :allowed_languages 4 | remove_column :users, :allowed_languages 5 | 6 | add_column :users, :filtered_languages, :string, array: true, default: [], null: false 7 | add_index :users, :filtered_languages, using: :gin 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20170917153509_create_custom_emojis.rb: -------------------------------------------------------------------------------- 1 | class CreateCustomEmojis < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :custom_emojis do |t| 4 | t.string :shortcode, null: false, default: '' 5 | t.string :domain 6 | t.attachment :image 7 | 8 | t.timestamps 9 | end 10 | 11 | add_index :custom_emojis, [:shortcode, :domain], unique: true 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/models/conversation_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Conversation, type: :model do 4 | describe '#local?' do 5 | it 'returns true when URI is nil' do 6 | expect(Fabricate(:conversation).local?).to be true 7 | end 8 | 9 | it 'returns false when URI is not nil' do 10 | expect(Fabricate(:conversation, uri: 'abc').local?).to be false 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/javascript/mastodon/components/loading_indicator.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { FormattedMessage } from 'react-intl'; 3 | 4 | const LoadingIndicator = () => ( 5 |
6 |
7 | 8 |
9 | ); 10 | 11 | export default LoadingIndicator; 12 | -------------------------------------------------------------------------------- /app/javascript/mastodon/features/ui/containers/columns_area_container.js: -------------------------------------------------------------------------------- 1 | import { connect } from 'react-redux'; 2 | import ColumnsArea from '../components/columns_area'; 3 | 4 | const mapStateToProps = state => ({ 5 | columns: state.getIn(['settings', 'columns']), 6 | isModalOpen: !!state.get('modal').modalType, 7 | }); 8 | 9 | export default connect(mapStateToProps, null, null, { withRef: true })(ColumnsArea); 10 | -------------------------------------------------------------------------------- /app/views/admin/domain_blocks/_domain_block.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td.domain 3 | %samp= domain_block.domain 4 | %td.severity 5 | = t("admin.domain_blocks.severities.#{domain_block.severity}") 6 | %td.reject_media 7 | - if domain_block.reject_media? || domain_block.suspend? 8 | %i.fa.fa-check 9 | %td 10 | = table_link_to 'undo', t('admin.domain_blocks.undo'), admin_domain_block_path(domain_block) 11 | -------------------------------------------------------------------------------- /app/views/shared/_landing_strip.html.haml: -------------------------------------------------------------------------------- 1 | .landing-strip 2 | = image_tag asset_pack_path('logo.svg'), class: 'logo' 3 | 4 | %div 5 | = t('landing_strip_html', name: content_tag(:span, display_name(account), class: :emojify), link_to_root_path: link_to(content_tag(:strong, site_hostname), root_path)) 6 | 7 | - if open_registrations? 8 | = t('landing_strip_signup_html', sign_up_path: new_user_registration_path) 9 | -------------------------------------------------------------------------------- /app/views/stream_entries/_media.html.haml: -------------------------------------------------------------------------------- 1 | .media-item 2 | = link_to media.remote_url.blank? ? media.file.url(:original) : media.remote_url, style: media.image? ? "background-image: url(#{media.file.url(:original)})" : '', target: '_blank', rel: 'noopener', class: "u-#{media.video? || media.gifv? ? 'video' : 'photo'}" do 3 | - unless media.image? 4 | %video{ src: media.file.url(:original), autoplay: true, loop: true }/ 5 | -------------------------------------------------------------------------------- /config/webpack/loaders/babel.js: -------------------------------------------------------------------------------- 1 | const { resolve } = require('path'); 2 | 3 | const env = process.env.NODE_ENV || 'development'; 4 | 5 | module.exports = { 6 | test: /\.js$/, 7 | exclude: /node_modules/, 8 | loader: 'babel-loader', 9 | options: { 10 | forceEnv: env, 11 | cacheDirectory: env === 'development' ? false : resolve(__dirname, '..', '..', '..', 'tmp', 'cache', 'babel-loader'), 12 | }, 13 | }; 14 | -------------------------------------------------------------------------------- /db/migrate/20160220211917_create_statuses.rb: -------------------------------------------------------------------------------- 1 | class CreateStatuses < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :statuses do |t| 4 | t.string :uri, null: false, default: '' 5 | t.integer :account_id, null: false 6 | t.text :text, null: false, default: '' 7 | 8 | t.timestamps null: false 9 | end 10 | 11 | add_index :statuses, :uri, unique: true 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/fixtures/requests/oembed_xml.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/javascript/mastodon/features/ui/components/column_subheading.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | 4 | const ColumnSubheading = ({ text }) => { 5 | return ( 6 |
7 | {text} 8 |
9 | ); 10 | }; 11 | 12 | ColumnSubheading.propTypes = { 13 | text: PropTypes.string.isRequired, 14 | }; 15 | 16 | export default ColumnSubheading; 17 | -------------------------------------------------------------------------------- /app/models/conversation_mute.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # == Schema Information 3 | # 4 | # Table name: conversation_mutes 5 | # 6 | # id :integer not null, primary key 7 | # conversation_id :integer not null 8 | # account_id :integer not null 9 | # 10 | 11 | class ConversationMute < ApplicationRecord 12 | belongs_to :account 13 | belongs_to :conversation 14 | end 15 | -------------------------------------------------------------------------------- /app/workers/scheduler/media_cleanup_scheduler.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | require 'sidekiq-scheduler' 3 | 4 | class Scheduler::MediaCleanupScheduler 5 | include Sidekiq::Worker 6 | 7 | def perform 8 | unattached_media.find_each(&:destroy) 9 | end 10 | 11 | private 12 | 13 | def unattached_media 14 | MediaAttachment.reorder(nil).unattached.where('created_at < ?', 1.day.ago) 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /Capfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | require 'capistrano/setup' 3 | require 'capistrano/deploy' 4 | require 'capistrano/scm/git' 5 | 6 | install_plugin Capistrano::SCM::Git 7 | 8 | require 'capistrano/rbenv' 9 | require 'capistrano/bundler' 10 | require 'capistrano/yarn' 11 | require 'capistrano/rails/assets' 12 | require 'capistrano/rails/migrations' 13 | 14 | Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } 15 | -------------------------------------------------------------------------------- /app/javascript/images/icon_lock_open.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/javascript/mastodon/actions/height_cache.js: -------------------------------------------------------------------------------- 1 | export const HEIGHT_CACHE_SET = 'HEIGHT_CACHE_SET'; 2 | export const HEIGHT_CACHE_CLEAR = 'HEIGHT_CACHE_CLEAR'; 3 | 4 | export function setHeight (key, id, height) { 5 | return { 6 | type: HEIGHT_CACHE_SET, 7 | key, 8 | id, 9 | height, 10 | }; 11 | }; 12 | 13 | export function clearHeight () { 14 | return { 15 | type: HEIGHT_CACHE_CLEAR, 16 | }; 17 | }; 18 | -------------------------------------------------------------------------------- /app/models/concerns/cacheable.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Cacheable 4 | extend ActiveSupport::Concern 5 | 6 | class_methods do 7 | def cache_associated(*associations) 8 | @cache_associated = associations 9 | end 10 | end 11 | 12 | included do 13 | scope :with_includes, -> { includes(@cache_associated) } 14 | scope :cache_ids, -> { select(:id, :updated_at) } 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20161003142332_add_confirmable_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddConfirmableToUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :users, :confirmation_token, :string 4 | add_column :users, :confirmed_at, :datetime 5 | add_column :users, :confirmation_sent_at, :datetime 6 | add_column :users, :unconfirmed_email, :string 7 | add_index :users, :confirmation_token, unique: true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20161222204147_create_follow_requests.rb: -------------------------------------------------------------------------------- 1 | class CreateFollowRequests < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :follow_requests do |t| 4 | t.integer :account_id, null: false 5 | t.integer :target_account_id, null: false 6 | 7 | t.timestamps null: false 8 | end 9 | 10 | add_index :follow_requests, [:account_id, :target_account_id], unique: true 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20170823162448_create_status_pins.rb: -------------------------------------------------------------------------------- 1 | class CreateStatusPins < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :status_pins do |t| 4 | t.belongs_to :account, foreign_key: { on_delete: :cascade }, null: false 5 | t.belongs_to :status, foreign_key: { on_delete: :cascade }, null: false 6 | end 7 | 8 | add_index :status_pins, [:account_id, :status_id], unique: true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /spec/support/matchers/model/model_have_error_on_field.rb: -------------------------------------------------------------------------------- 1 | RSpec::Matchers.define :model_have_error_on_field do |expected| 2 | match do |record| 3 | if record.errors.empty? 4 | record.valid? 5 | end 6 | 7 | record.errors.has_key?(expected) 8 | end 9 | 10 | failure_message do |record| 11 | keys = record.errors.keys 12 | 13 | "expect record.errors(#{keys}) to include #{expected}" 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /config/locales/activerecord.pl.yml: -------------------------------------------------------------------------------- 1 | --- 2 | pl: 3 | activerecord: 4 | attributes: 5 | user: 6 | email: adres e-mail 7 | errors: 8 | models: 9 | account: 10 | attributes: 11 | username: 12 | invalid: może składać się tylko z liter, cyfr i podkreślników 13 | status: 14 | attributes: 15 | reblog: 16 | taken: status już istnieje 17 | -------------------------------------------------------------------------------- /db/migrate/20170427011934_re_add_owner_to_application.rb: -------------------------------------------------------------------------------- 1 | class ReAddOwnerToApplication < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :oauth_applications, :owner_id, :integer, null: true 4 | add_column :oauth_applications, :owner_type, :string, null: true 5 | add_index :oauth_applications, [:owner_id, :owner_type] 6 | add_foreign_key :oauth_applications, :users, column: :owner_id, on_delete: :cascade 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/workers/scheduler/doorkeeper_cleanup_scheduler.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | require 'sidekiq-scheduler' 3 | 4 | class Scheduler::DoorkeeperCleanupScheduler 5 | include Sidekiq::Worker 6 | 7 | def perform 8 | Doorkeeper::AccessToken.where('revoked_at IS NOT NULL').where('revoked_at < NOW()').delete_all 9 | Doorkeeper::AccessGrant.where('revoked_at IS NOT NULL').where('revoked_at < NOW()').delete_all 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/lib/settings/extend_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe Settings::Extend do 6 | class User 7 | include Settings::Extend 8 | end 9 | 10 | describe '#settings' do 11 | it 'sets @settings as an instance of Settings::ScopedSettings' do 12 | user = Fabricate(:user) 13 | expect(user.settings).to be_kind_of Settings::ScopedSettings 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/workers/activitypub/synchronize_featured_collection_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ActivityPub::SynchronizeFeaturedCollectionWorker 4 | include Sidekiq::Worker 5 | 6 | sidekiq_options queue: 'pull', unique: :until_executed 7 | 8 | def perform(account_id) 9 | ActivityPub::FetchFeaturedCollectionService.new.call(Account.find(account_id)) 10 | rescue ActiveRecord::RecordNotFound 11 | true 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20170623152212_create_session_activations.rb: -------------------------------------------------------------------------------- 1 | class CreateSessionActivations < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :session_activations do |t| 4 | t.integer :user_id, null: false 5 | t.string :session_id, null: false 6 | 7 | t.timestamps 8 | end 9 | 10 | add_index :session_activations, :user_id 11 | add_index :session_activations, :session_id, unique: true 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/controllers/concerns/obfuscate_filename.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ObfuscateFilename 4 | extend ActiveSupport::Concern 5 | 6 | class_methods do 7 | def obfuscate_filename(path) 8 | before_action do 9 | file = params.dig(*path) 10 | next if file.nil? 11 | 12 | file.original_filename = SecureRandom.hex(8) + File.extname(file.original_filename) 13 | end 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/controllers/settings/exports/muted_accounts_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Settings 4 | module Exports 5 | class MutedAccountsController < ApplicationController 6 | include ExportControllerConcern 7 | 8 | def index 9 | send_export_file 10 | end 11 | 12 | private 13 | 14 | def export_data 15 | @export.to_muted_accounts_csv 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/services/mute_service.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class MuteService < BaseService 4 | def call(account, target_account, notifications: nil) 5 | return if account.id == target_account.id 6 | FeedManager.instance.clear_from_timeline(account, target_account) 7 | mute = account.mute!(target_account, notifications: notifications) 8 | BlockWorker.perform_async(account.id, target_account.id) 9 | mute 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20170127165745_add_devise_two_factor_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddDeviseTwoFactorToUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :users, :encrypted_otp_secret, :string 4 | add_column :users, :encrypted_otp_secret_iv, :string 5 | add_column :users, :encrypted_otp_secret_salt, :string 6 | add_column :users, :consumed_timestep, :integer 7 | add_column :users, :otp_required_for_login, :boolean 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20171005102658_create_account_moderation_notes.rb: -------------------------------------------------------------------------------- 1 | class CreateAccountModerationNotes < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :account_moderation_notes do |t| 4 | t.text :content, null: false 5 | t.references :account 6 | t.references :target_account 7 | 8 | t.timestamps 9 | end 10 | add_foreign_key :account_moderation_notes, :accounts, column: :target_account_id 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/workers/activitypub/post_upgrade_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ActivityPub::PostUpgradeWorker 4 | include Sidekiq::Worker 5 | 6 | sidekiq_options queue: 'pull' 7 | 8 | def perform(domain) 9 | Account.where(domain: domain) 10 | .where(protocol: :ostatus) 11 | .where.not(last_webfingered_at: nil) 12 | .in_batches 13 | .update_all(last_webfingered_at: nil) 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/workers/scheduler/subscriptions_scheduler.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'sidekiq-scheduler' 4 | require 'sidekiq-bulk' 5 | 6 | class Scheduler::SubscriptionsScheduler 7 | include Sidekiq::Worker 8 | 9 | def perform 10 | Pubsubhubbub::SubscribeWorker.push_bulk(expiring_accounts.pluck(:id)) 11 | end 12 | 13 | private 14 | 15 | def expiring_accounts 16 | Account.expiring(1.day.from_now).partitioned 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /db/migrate/20171107143624_add_disabled_to_users.rb: -------------------------------------------------------------------------------- 1 | require Rails.root.join('lib', 'mastodon', 'migration_helpers') 2 | 3 | class AddDisabledToUsers < ActiveRecord::Migration[5.1] 4 | include Mastodon::MigrationHelpers 5 | 6 | disable_ddl_transaction! 7 | 8 | def up 9 | safety_assured { add_column_with_default :users, :disabled, :bool, default: false } 10 | end 11 | 12 | def down 13 | remove_column :users, :disabled 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/controllers/settings/exports/blocked_accounts_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Settings 4 | module Exports 5 | class BlockedAccountsController < ApplicationController 6 | include ExportControllerConcern 7 | 8 | def index 9 | send_export_file 10 | end 11 | 12 | private 13 | 14 | def export_data 15 | @export.to_blocked_accounts_csv 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/javascript/mastodon/reducers/cards.js: -------------------------------------------------------------------------------- 1 | import { STATUS_CARD_FETCH_SUCCESS } from '../actions/cards'; 2 | 3 | import { Map as ImmutableMap, fromJS } from 'immutable'; 4 | 5 | const initialState = ImmutableMap(); 6 | 7 | export default function cards(state = initialState, action) { 8 | switch(action.type) { 9 | case STATUS_CARD_FETCH_SUCCESS: 10 | return state.set(action.id, fromJS(action.card)); 11 | default: 12 | return state; 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /app/models/qiita_authorization.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: qiita_authorizations 4 | # 5 | # id :integer not null, primary key 6 | # user_id :integer 7 | # uid :string 8 | # token :string 9 | # created_at :datetime not null 10 | # updated_at :datetime not null 11 | # 12 | 13 | class QiitaAuthorization < ApplicationRecord 14 | belongs_to :user, inverse_of: :qiita_authorization 15 | end 16 | -------------------------------------------------------------------------------- /app/workers/authorize_follow_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AuthorizeFollowWorker 4 | include Sidekiq::Worker 5 | 6 | def perform(source_account_id, target_account_id) 7 | source_account = Account.find(source_account_id) 8 | target_account = Account.find(target_account_id) 9 | 10 | AuthorizeFollowService.new.call(source_account, target_account) 11 | rescue ActiveRecord::RecordNotFound 12 | true 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20160905150353_create_media_attachments.rb: -------------------------------------------------------------------------------- 1 | class CreateMediaAttachments < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :media_attachments do |t| 4 | t.integer :status_id, null: true, default: nil 5 | t.attachment :file 6 | t.string :remote_url, null: false, default: '' 7 | t.integer :account_id 8 | 9 | t.timestamps 10 | end 11 | 12 | add_index :media_attachments, :status_id 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/controllers/settings/exports/following_accounts_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Settings 4 | module Exports 5 | class FollowingAccountsController < ApplicationController 6 | include ExportControllerConcern 7 | 8 | def index 9 | send_export_file 10 | end 11 | 12 | private 13 | 14 | def export_data 15 | @export.to_following_accounts_csv 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/lib/activitypub/activity/update.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ActivityPub::Activity::Update < ActivityPub::Activity 4 | def perform 5 | case @object['type'] 6 | when 'Person' 7 | update_account 8 | end 9 | end 10 | 11 | private 12 | 13 | def update_account 14 | return if @account.uri != object_uri 15 | ActivityPub::ProcessAccountService.new.call(@account.username, @account.domain, @object) 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/models/concerns/relationship_cacheable.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module RelationshipCacheable 4 | extend ActiveSupport::Concern 5 | 6 | included do 7 | after_commit :remove_relationship_cache 8 | end 9 | 10 | private 11 | 12 | def remove_relationship_cache 13 | Rails.cache.delete("relationship:#{account_id}:#{target_account_id}") 14 | Rails.cache.delete("relationship:#{target_account_id}:#{account_id}") 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/views/admin/email_domain_blocks/index.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :page_title do 2 | = t('admin.email_domain_blocks.title') 3 | 4 | .table-wrapper 5 | %table.table 6 | %thead 7 | %tr 8 | %th= t('admin.email_domain_blocks.domain') 9 | %th 10 | %tbody 11 | = render @email_domain_blocks 12 | 13 | = paginate @email_domain_blocks 14 | = link_to t('admin.email_domain_blocks.add_new'), new_admin_email_domain_block_path, class: 'button' 15 | -------------------------------------------------------------------------------- /app/views/authorize_follows/show.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :page_title do 2 | = t('authorize_follow.title', acct: @account.acct) 3 | 4 | .form-container 5 | .follow-prompt 6 | = render 'card', account: @account 7 | 8 | - unless current_account.following?(@account) 9 | = form_tag authorize_follow_path, method: :post, class: 'simple_form' do 10 | = hidden_field_tag :acct, @account.acct 11 | = button_tag t('authorize_follow.follow'), type: :submit 12 | -------------------------------------------------------------------------------- /app/workers/scheduler/user_cleanup_scheduler.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | require 'sidekiq-scheduler' 3 | 4 | class Scheduler::UserCleanupScheduler 5 | include Sidekiq::Worker 6 | 7 | def perform 8 | User.where('confirmed_at is NULL AND confirmation_sent_at <= ?', 2.days.ago).find_in_batches do |batch| 9 | Account.where(id: batch.map(&:account_id)).delete_all 10 | User.where(id: batch.map(&:id)).delete_all 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20170507141759_optimize_index_subscriptions.rb: -------------------------------------------------------------------------------- 1 | class OptimizeIndexSubscriptions < ActiveRecord::Migration[5.0] 2 | def up 3 | add_index :subscriptions, [:account_id, :callback_url], unique: true 4 | remove_index :subscriptions, [:callback_url, :account_id] 5 | end 6 | 7 | def down 8 | add_index :subscriptions, [:callback_url, :account_id], unique: true 9 | remove_index :subscriptions, [:account_id, :callback_url] 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20171107143332_add_memorial_to_accounts.rb: -------------------------------------------------------------------------------- 1 | require Rails.root.join('lib', 'mastodon', 'migration_helpers') 2 | 3 | class AddMemorialToAccounts < ActiveRecord::Migration[5.1] 4 | include Mastodon::MigrationHelpers 5 | 6 | disable_ddl_transaction! 7 | 8 | def up 9 | safety_assured { add_column_with_default :accounts, :memorial, :bool, default: false } 10 | end 11 | 12 | def down 13 | remove_column :accounts, :memorial 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20171109012327_add_moderator_to_accounts.rb: -------------------------------------------------------------------------------- 1 | require Rails.root.join('lib', 'mastodon', 'migration_helpers') 2 | 3 | class AddModeratorToAccounts < ActiveRecord::Migration[5.1] 4 | include Mastodon::MigrationHelpers 5 | 6 | disable_ddl_transaction! 7 | 8 | def up 9 | safety_assured { add_column_with_default :users, :moderator, :bool, default: false } 10 | end 11 | 12 | def down 13 | remove_column :users, :moderator 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20171119172437_create_admin_action_logs.rb: -------------------------------------------------------------------------------- 1 | class CreateAdminActionLogs < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :admin_action_logs do |t| 4 | t.belongs_to :account, foreign_key: { on_delete: :cascade } 5 | t.string :action, null: false, default: '' 6 | t.references :target, polymorphic: true 7 | t.text :recorded_changes, null: false, default: '' 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/controllers/oauth/authorizations_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController 4 | skip_before_action :authenticate_resource_owner! 5 | 6 | before_action :store_current_location 7 | before_action :authenticate_resource_owner! 8 | 9 | include Localized 10 | 11 | private 12 | 13 | def store_current_location 14 | store_location_for(:user, request.url) 15 | end 16 | end 17 | --------------------------------------------------------------------------------