├── .browserslistrc ├── .circleci ├── application.yml ├── config.yml └── database.yml ├── .erb-lint.yml ├── .gitignore ├── .rubocop.yml ├── .tx └── config ├── COPYING ├── Capfile ├── Gemfile ├── Gemfile.lock ├── Procfile.dev ├── README.md ├── Rakefile ├── app ├── controllers │ ├── admin │ │ ├── ads_controller.rb │ │ ├── allowed_requires_controller.rb │ │ ├── base_controller.rb │ │ ├── blocked_script_codes_controller.rb │ │ ├── blocked_script_texts_controller.rb │ │ ├── blocked_script_urls_controller.rb │ │ ├── blocked_users_controller.rb │ │ ├── home_controller.rb │ │ ├── redirect_service_domains_controller.rb │ │ ├── script_similarities_controller.rb │ │ └── spammy_email_domains_controller.rb │ ├── application_controller.rb │ ├── comments_controller.rb │ ├── concerns │ │ ├── .keep │ │ ├── announcement.rb │ │ ├── api.rb │ │ ├── banned_user.rb │ │ ├── discussion_restrictions.rb │ │ ├── file_caching.rb │ │ ├── localized_request.rb │ │ ├── login_methods.rb │ │ ├── notification_display.rb │ │ ├── page_cache.rb │ │ ├── request_debugging.rb │ │ ├── script_and_versions.rb │ │ ├── script_listings.rb │ │ ├── shows_ads.rb │ │ ├── site_switches.rb │ │ └── webhooks.rb │ ├── conversations_controller.rb │ ├── discussions_controller.rb │ ├── help_controller.rb │ ├── home_controller.rb │ ├── import_controller.rb │ ├── messages_controller.rb │ ├── moderator_actions_controller.rb │ ├── notifications_controller.rb │ ├── opensearch_controller.rb │ ├── qr_controller.rb │ ├── registrations_controller.rb │ ├── reports_controller.rb │ ├── script_lock_appeals_controller.rb │ ├── script_sets_controller.rb │ ├── script_versions_controller.rb │ ├── scripts_controller.rb │ ├── sessions_controller.rb │ ├── unsubscribe_controller.rb │ └── users_controller.rb ├── helpers │ ├── application_helper.rb │ ├── discussion_helper.rb │ ├── login_helper.rb │ ├── report_helper.rb │ ├── scripts_helper.rb │ ├── user_text_helper.rb │ └── users_helper.rb ├── javascript │ ├── additional-info.js │ ├── announcements.js │ ├── attachments.js │ ├── code.js │ ├── entrypoints │ │ └── application.js │ ├── ethical-ads.js │ ├── expandable-text.js │ ├── forum.js │ ├── header.js │ ├── highlight.js │ ├── home.js │ ├── images │ │ ├── blacklogo128.png │ │ ├── blacklogo16.png │ │ ├── blacklogo32.png │ │ ├── blacklogo512.png │ │ ├── blacklogo96.png │ │ ├── browsericons │ │ │ ├── chrome.svg │ │ │ ├── edge.svg │ │ │ ├── firefox.svg │ │ │ ├── opera.svg │ │ │ └── safari.svg │ │ ├── github-32.png │ │ ├── gitlab-32.png │ │ ├── google-32.png │ │ ├── install-button-example.webp │ │ ├── tampermonkey-manage.webp │ │ └── x.svg │ ├── install.js │ ├── lightbox.js │ ├── locale-switcher.js │ ├── login.js │ ├── managers.js │ ├── markup-preview.js │ ├── onload.js │ ├── recaptcha.js │ ├── reports.js │ ├── sidebar.js │ ├── source-editor.js │ ├── stats.js │ ├── stylesheets │ │ ├── admin.css │ │ ├── ads.css │ │ ├── after_radio_chosen.css │ │ ├── announcement.css │ │ ├── application.css │ │ ├── badges.css │ │ ├── code.css │ │ ├── colors.css │ │ ├── diff.css │ │ ├── ethical_ads.css │ │ ├── expandable-text.css │ │ ├── forum.css │ │ ├── header.css │ │ ├── help.css │ │ ├── highlight.css │ │ ├── home.css │ │ ├── install.css │ │ ├── layout.css │ │ ├── list_options.css │ │ ├── log_table.css │ │ ├── modal.css │ │ ├── notification.css │ │ ├── post_install.css │ │ ├── preview.css │ │ ├── report.css │ │ ├── rtl.css │ │ ├── script.css │ │ ├── script_admin.css │ │ ├── script_in_page_stats.css │ │ ├── script_lock_appeal.css │ │ ├── script_sets.css │ │ ├── script_versions.css │ │ ├── sidebar.css │ │ ├── tabs.css │ │ └── user_content.css │ ├── submit-anchor.js │ └── versioncheck.js ├── jobs │ ├── akismet_ham_job.rb │ ├── akismet_script_checking_job.rb │ ├── akismet_submission_delete_job.rb │ ├── application_job.rb │ ├── banned_user_delete_job.rb │ ├── cleaned_code_job.rb │ ├── comment_notification_job.rb │ ├── comment_spam_check_job.rb │ ├── consecutive_bad_ratings_job.rb │ ├── delete_old_notifications_job.rb │ ├── discussion_read_cleanup_job.rb │ ├── message_notification_job.rb │ ├── script_checker_ban_and_delete_job.rb │ ├── script_delete_job.rb │ ├── script_duplicate_checker_job.rb │ ├── script_duplicate_checker_queueing_job.rb │ ├── script_page_view_update_job.rb │ ├── script_previously_deleted_checker.rb │ ├── script_sync_job.rb │ ├── script_sync_queueing_job.rb │ ├── stat_ban_checking_job.rb │ ├── subresource_check_job.rb │ ├── subresource_check_queueing_job.rb │ ├── user_ban_and_delete_job.rb │ └── user_checking_job.rb ├── mailers │ ├── .keep │ ├── admin_mailer.rb │ ├── application_mailer.rb │ ├── consecutive_bad_ratings_mailer.rb │ ├── conversation_mailer.rb │ ├── devise_mailer.rb │ ├── forum_mailer.rb │ ├── script_invitation_mailer.rb │ ├── script_lock_appeal_mailer.rb │ ├── script_report_mailer.rb │ └── user_mailer.rb ├── models │ ├── .keep │ ├── akismet_submission.rb │ ├── allowed_require.rb │ ├── antifeature.rb │ ├── application_record.rb │ ├── author.rb │ ├── banned_email_hash.rb │ ├── blocked_script_code.rb │ ├── blocked_script_text.rb │ ├── blocked_script_url.rb │ ├── blocked_user.rb │ ├── browser.rb │ ├── cleaned_code.rb │ ├── comment.rb │ ├── compatibility.rb │ ├── concerns │ │ ├── .keep │ │ ├── browser_caching.rb │ │ ├── comment_indexing.rb │ │ ├── detects_locale.rb │ │ ├── has_attachments.rb │ │ ├── mentions_users.rb │ │ ├── script_indexing.rb │ │ ├── script_version_js.rb │ │ ├── soft_deletable.rb │ │ └── user_indexing.rb │ ├── conversation.rb │ ├── conversation_subscription.rb │ ├── daily_update_check_count.rb │ ├── discussion.rb │ ├── discussion_category.rb │ ├── discussion_read.rb │ ├── discussion_subscription.rb │ ├── forum_comment.rb │ ├── forum_discussion.rb │ ├── identity.rb │ ├── license.rb │ ├── locale.rb │ ├── locale_contributor.rb │ ├── localized_script_attribute.rb │ ├── localized_script_version_attribute.rb │ ├── mention.rb │ ├── message.rb │ ├── moderator_action.rb │ ├── notification.rb │ ├── redirect_service_domain.rb │ ├── report.rb │ ├── role.rb │ ├── script.rb │ ├── script_applies_to.rb │ ├── script_code.rb │ ├── script_invitation.rb │ ├── script_lock_appeal.rb │ ├── script_observer.rb │ ├── script_set.rb │ ├── script_set_automatic_set_inclusion.rb │ ├── script_set_automatic_type.rb │ ├── script_set_script_inclusion.rb │ ├── script_set_set_inclusion.rb │ ├── script_similarity.rb │ ├── script_subresource_usage.rb │ ├── script_version.rb │ ├── sensitive_site.rb │ ├── site_application.rb │ ├── spammy_email_domain.rb │ ├── stat_ban.rb │ ├── subresource.rb │ ├── subresource_integrity_hash.rb │ ├── user.rb │ └── user_notification_setting.rb ├── services │ ├── accept_invitation_service.rb │ ├── ad_method.rb │ ├── code_similarity_scorer.rb │ ├── comment_checking │ │ ├── akismet_checker.rb │ │ ├── custom_checker.rb │ │ ├── deleted_repeated_link_checker.rb │ │ ├── deleted_repeated_text_checker.rb │ │ ├── link_count_checker.rb │ │ ├── only_link_checker.rb │ │ ├── repeated_text_checker.rb │ │ └── result.rb │ ├── comment_checking_service.rb │ ├── email_checking_service.rb │ ├── ping_request_checking │ │ ├── locale.rb │ │ ├── params.rb │ │ ├── session_install_key.rb │ │ └── user_agent.rb │ ├── ping_request_checking_service.rb │ ├── script_checking │ │ ├── code_checker.rb │ │ ├── link_checker.rb │ │ ├── result.rb │ │ └── text_checker.rb │ ├── script_checking_service.rb │ ├── script_code_search.rb │ ├── top_sites_service.rb │ ├── user_notification_service.rb │ └── user_restriction_service.rb └── views │ ├── admin │ ├── ads │ │ └── pending.html.erb │ ├── allowed_requires │ │ └── new.html.erb │ ├── blocked_script_codes │ │ ├── index.html.erb │ │ └── new.html.erb │ ├── blocked_script_texts │ │ ├── index.html.erb │ │ └── new.html.erb │ ├── blocked_script_urls │ │ ├── index.html.erb │ │ └── new.html.erb │ ├── blocked_users │ │ ├── index.html.erb │ │ └── new.html.erb │ ├── home │ │ ├── index.html.erb │ │ └── rule_interpretations.html.erb │ ├── redirect_service_domains │ │ ├── index.html.erb │ │ └── new.html.erb │ ├── script_similarities │ │ └── index.html.erb │ └── spammy_email_domains │ │ ├── index.html.erb │ │ └── new.html.erb │ ├── conversation_mailer │ └── new_message.html.erb │ ├── conversations │ ├── _message_entry.html.erb │ ├── index.html.erb │ ├── new.html.erb │ └── show.html.erb │ ├── devise │ ├── registrations │ │ ├── edit.html.erb │ │ └── new.html.erb │ ├── sessions │ │ ├── new.html.erb │ │ ├── omniauth_callback_no_email.html.erb │ │ ├── omniauth_callback_same_email.html.erb │ │ ├── omniauth_callback_same_name.html.erb │ │ └── two_fa_entry.erb │ └── shared │ │ └── _links.html.erb │ ├── discussions │ ├── _category_entry.html.erb │ ├── _comment_entry.html.erb │ ├── _discussion.html.erb │ ├── _rating_entry.html.erb │ ├── _subscribe.html.erb │ ├── index.html.erb │ ├── new.html.erb │ ├── post_blocked.html.erb │ └── show.html.erb │ ├── forum_mailer │ ├── comment_on_mentioned.html.erb │ ├── comment_on_script.html.erb │ └── comment_on_subscribed.html.erb │ ├── help │ ├── _allowed_require_list.html.erb │ ├── _installing.html.erb │ ├── allowed_markup.html.erb │ ├── antifeatures.html.erb │ ├── cdns.html.erb │ ├── code_rules.html.erb │ ├── contact.html.erb │ ├── credits.html.erb │ ├── external_scripts.html.erb │ ├── index.html.erb │ ├── installing_user_scripts.html.erb │ ├── installing_user_styles.html.erb │ ├── meta_keys.html.erb │ ├── privacy.html.erb │ ├── rewriting.html.erb │ ├── user_js_conversions.html.erb │ └── writing_user_scripts.html.erb │ ├── home │ ├── error.html.erb │ ├── index.html.erb │ ├── relative_date_test.html.erb │ ├── routing_error.html.erb │ └── search.html.erb │ ├── import │ ├── add.html.erb │ └── index.html.erb │ ├── layouts │ ├── _moderator_notices.html.erb │ ├── application.html.erb │ ├── base.html.erb │ ├── discussions.html.erb │ ├── list.html.erb │ ├── mailer.html.erb │ └── scripts.html.erb │ ├── moderator_actions │ └── index.html.erb │ ├── notifications │ └── index.html.erb │ ├── opensearch │ └── description.xml.erb │ ├── reports │ ├── _moderator_controls.html.erb │ ├── _report.html.erb │ ├── _reporter_stats.html.erb │ ├── index.html.erb │ ├── new.html.erb │ └── show.html.erb │ ├── screenshots │ ├── _entry.html.erb │ └── _show.html.erb │ ├── script_lock_appeal_mailer │ ├── dismiss.html.erb │ └── unlock.html.erb │ ├── script_lock_appeals │ ├── _script_lock_appeal.html.erb │ ├── index.html.erb │ ├── new.html.erb │ └── show.html.erb │ ├── script_report_mailer │ ├── report_created.html.erb │ ├── report_dismissed_offender.html.erb │ ├── report_dismissed_reporter.html.erb │ ├── report_fixed_offender.html.erb │ ├── report_fixed_reporter.html.erb │ ├── report_rebutted.html.erb │ ├── report_script_deleted_reporter.html.erb │ ├── report_upheld_offender.html.erb │ └── report_upheld_reporter.html.erb │ ├── script_sets │ ├── _form.html.erb │ ├── edit.html.erb │ └── new.html.erb │ ├── script_versions │ ├── _additional_info.html.erb │ ├── _form.html.erb │ ├── delayed.html.erb │ ├── delete.html.erb │ ├── disposable_email.html.erb │ ├── index.html.erb │ ├── must_confirm.html.erb │ ├── needs_secure_login.html.erb │ ├── new.html.erb │ ├── new_script_notice.html.erb │ └── rate_limited.html.erb │ ├── scripts │ ├── _authors.html.erb │ ├── _checkup.html.erb │ ├── _compare.html.erb │ ├── _default_locale_selector.html.erb │ ├── _diff_options.html.erb │ ├── _feedback_suggestion.html.erb │ ├── _install.html.erb │ ├── _install_button.html.erb │ ├── _list_options.html.erb │ ├── _mark_adult.html.erb │ ├── _moderator_log.html.erb │ ├── _permanently_delete.html.erb │ ├── _ratings.html.erb │ ├── _script.html.erb │ ├── _set_locale.html.erb │ ├── _set_promoted.html.erb │ ├── _sync.html.erb │ ├── _sync_additional_info.html.erb │ ├── admin.html.erb │ ├── by_site.html.erb │ ├── delete.html.erb │ ├── derivatives.html.erb │ ├── diff.html.erb │ ├── feedback.html.erb │ ├── index.atom.builder │ ├── index.html.erb │ ├── libraries.html.erb │ ├── show.html.erb │ ├── show_code.html.erb │ └── stats.html.erb │ ├── shared │ ├── _errors.html.erb │ ├── _in_page_ad.html.erb │ └── _locale_override_field.html.erb │ └── users │ ├── _add_external_sign_in.html.erb │ ├── _list_options.html.erb │ ├── _notification_setting_checkboxes.html.erb │ ├── _user.html.erb │ ├── ban.html.erb │ ├── delete_confirm.html.erb │ ├── delete_info.html.erb │ ├── edit_sign_in.html.erb │ ├── enable_2fa.html.erb │ ├── index.html.erb │ ├── notification_settings.html.erb │ ├── show.html.erb │ ├── unban.html.erb │ └── webhook_info.html.erb ├── bin ├── bundle ├── dev ├── rails ├── rake ├── rubocop ├── setup ├── tx_pull ├── update ├── vite ├── webpack ├── webpack-dev-server └── yarn ├── config.ru ├── config ├── .gitignore ├── application.rb ├── boot.rb ├── cable.yml ├── credentials │ ├── development.yml.enc │ ├── production.yml.enc │ └── test.yml.enc ├── deploy.rb ├── deploy │ └── production.rb ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── active_record.rb │ ├── akismet.rb │ ├── application_controller_renderer.rb │ ├── backtrace_silencers.rb │ ├── content_security_policy.rb │ ├── cookie_rotator.rb │ ├── cookies_serializer.rb │ ├── devise.rb │ ├── devise_safe_store_location.rb │ ├── elasticsearch.rb │ ├── enable_yjit.rb │ ├── filter_parameter_logging.rb │ ├── form_builder.rb │ ├── i18n.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── permissions_policy.rb │ ├── queues.rb │ ├── rack_attack.rb │ ├── readonly.rb │ ├── recaptcha.rb │ ├── remote_forms.rb │ ├── request_cleaner.rb │ ├── screenshots.rb │ ├── script_page_cache.rb │ ├── searchkick.rb │ ├── sentry.rb │ ├── session_store.rb │ ├── sidekiq.rb │ ├── syntax_highlighting.rb │ └── wrap_parameters.rb ├── locales │ ├── ar.yml │ ├── bg.yml │ ├── ckb.yml │ ├── cs.yml │ ├── da.yml │ ├── de.yml │ ├── el.yml │ ├── en.yml │ ├── eo.yml │ ├── es.yml │ ├── es_419.yml │ ├── fi.yml │ ├── fr-CA.yml │ ├── fr.yml │ ├── he.yml │ ├── hr.yml │ ├── hu.yml │ ├── id.yml │ ├── it.yml │ ├── ja.yml │ ├── ka.yml │ ├── ko.yml │ ├── mr.yml │ ├── nb.yml │ ├── nl.yml │ ├── pl.yml │ ├── pt-BR.yml │ ├── pt.yml │ ├── ro.yml │ ├── ru.yml │ ├── sk.yml │ ├── sr.yml │ ├── sv.yml │ ├── th.yml │ ├── tr.yml │ ├── ug.yml │ ├── uk.yml │ ├── vi.yml │ ├── zh-CN.yml │ └── zh-TW.yml ├── routes.rb ├── sidekiq.yml ├── spring.rb ├── storage.yml ├── vite.json ├── webpack │ ├── development.js │ ├── environment.js │ ├── production.js │ └── test.js └── webpacker.yml ├── db ├── .gitignore ├── migrate │ ├── 20140210194333_devise_create_users.rb │ ├── 20140210201355_create_scripts.rb │ ├── 20140210210818_create_script_versions.rb │ ├── 20140212200545_add_name_to_user.rb │ ├── 20140213030915_script_userscripts_id.rb │ ├── 20140213154328_add_daily_install_count.rb │ ├── 20140218015725_install_counts.rb │ ├── 20140218035558_create_allowed_requires.rb │ ├── 20140218044928_create_disallowed_codes.rb │ ├── 20140222031705_create_script_applies_tos.rb │ ├── 20140223211028_add_url_to_allowed_requires.rb │ ├── 20140223211251_add_greasy_fork_libraries_to_allowed_requires.rb │ ├── 20140224024436_add_user_profile.rb │ ├── 20140224190926_add_markup_type.rb │ ├── 20140228202404_add_script_id_to_discussions.rb │ ├── 20140301023544_add_assessments.rb │ ├── 20140303205828_add_code_updated_at.rb │ ├── 20140309034738_add_script_type.rb │ ├── 20140312161418_add_script_sync.rb │ ├── 20140403164807_create_delayed_jobs.rb │ ├── 20140403165132_add_delta_to_scripts.rb │ ├── 20140427175448_create_roles.rb │ ├── 20140427181626_create_moderator_actions.rb │ ├── 20140427190525_add_moderator_deleted.rb │ ├── 20140516191703_add_pattern_to_script_applies_to.rb │ ├── 20140517030310_add_license_to_scripts.rb │ ├── 20140517030415_create_licenses.rb │ ├── 20140517032450_insert_initial_licenses.rb │ ├── 20140527020017_add_short_name_to_script_types.rb │ ├── 20140527025707_update_deleted_and_locked.rb │ ├── 20140603174709_add_banned_user.rb │ ├── 20140603181415_add_user_to_moderator_actions.rb │ ├── 20140603201729_create_script_codes.rb │ ├── 20140606195925_add_uses_disallowed_external.rb │ ├── 20140607025106_refactor_script_applies_tos.rb │ ├── 20140607211930_add_webhook_secret_to_user.rb │ ├── 20140609024421_insert_webhook_sync_type.rb │ ├── 20140630020229_add_support_url_to_scripts.rb │ ├── 20140630170345_create_author_email_notification_types.rb │ ├── 20140701173021_create_identity.rb │ ├── 20140708163921_create_script_sets.rb │ ├── 20140713032842_add_locale_to_scripts.rb │ ├── 20140714161558_add_locale_to_script_set_automatic_types.rb │ ├── 20140730161636_add_favorites_flag.rb │ ├── 20140730210516_add_fan_score.rb │ ├── 20140804220508_add_namespace.rb │ ├── 20140805184624_four_byte_unicode.rb │ ├── 20140806021501_add_delete_reason_to_scripts.rb │ ├── 20140812164821_add_contribution_to_scripts.rb │ ├── 20140813034638_create_cpd_duplication.rb │ ├── 20140902024802_create_locale_contributors.rb │ ├── 20140902025842_update_locales_to_match_transifex.rb │ ├── 20140903045757_fix_flagging_table.rb │ ├── 20140915144425_mark_ptbr_available.rb │ ├── 20140919234605_create_localized_script_attribute.rb │ ├── 20140923191610_delete_blank_localized_attributes.rb │ ├── 20140929194450_add_remember_token_to_users.rb │ ├── 20140930020648_add_sync_url_to_localized_script_attributes.rb │ ├── 20141009170654_create_syntax_highlighted_code.rb │ ├── 20141010195747_add_locale_to_user.rb │ ├── 20141022153200_modify_fan_score.rb │ ├── 20141022182214_add_daily_update_check_count.rb │ ├── 20141023152338_update_bulgarian_ui_available.rb │ ├── 20141027032358_add_percent_complete_to_locale.rb │ ├── 20141028182853_script_codes_to_compressed_format.rb │ ├── 20141029230333_add_show_ads_to_user.rb │ ├── 20141104035027_add_it_and_frca.rb │ ├── 20141105153539_vi_available.rb │ ├── 20141110212050_add_default_sort_to_script_sets.rb │ ├── 20141111001158_add_up_down_rating_counts.rb │ ├── 20141124211518_tr_available.rb │ ├── 20141130174613_add_arabic_ukrainian.rb │ ├── 20141212034724_add_czech.rb │ ├── 20141228021319_add_markup_preference.rb │ ├── 20141229190455_add_index_on_script_type.rb │ ├── 20141231195332_add_greek.rb │ ├── 20141231212718_add_script_attachments.rb │ ├── 20150119041433_add_ad_code_to_script.rb │ ├── 20150127001642_add_replaced_by_script_id.rb │ ├── 20150131052722_add_caption_to_screenshots.rb │ ├── 20150211170950_add_version_to_script.rb │ ├── 20150221013413_add_flattr_username.rb │ ├── 20150307234007_add_bokmal_suomi.rb │ ├── 20150316170754_add_compatibility.rb │ ├── 20150422175935_add_script_version_f_ks.rb │ ├── 20150506143413_add_safari_as_browser.rb │ ├── 20150517190053_add_redistribute_opt_in.rb │ ├── 20150518042510_add_tld_flag_to_script_applies_tos.rb │ ├── 20150609015435_add_sv_ro_locales.rb │ ├── 20150729023212_add_sensitive_sites.rb │ ├── 20150805015952_add_sensitive_flag_to_users.rb │ ├── 20150810231014_add_report_not_sensitive.rb │ ├── 20150906031141_add_permanent_deletion_request_date.rb │ ├── 20150910005124_make_show_sensitive_false_by_default.rb │ ├── 20150929023046_drop_assessments.rb │ ├── 20161106004629_longer_sync_identifer.rb │ ├── 20161218203329_longer_sync_error.rb │ ├── 20170109030916_add_deletion_confirm_to_users.rb │ ├── 20170109233217_add_fks_to_users.rb │ ├── 20170317235450_thai_locale.rb │ ├── 20171014004054_add_domains.rb │ ├── 20171209214548_recreate_licenses.rb │ ├── 20171223173317_add_markup_to_changelog.rb │ ├── 20180203220802_add_script_promoted.rb │ ├── 20180222031153_add_promoted_script.rb │ ├── 20180506054543_add_index_to_promoted.rb │ ├── 20180506151937_create_disallowed_attributes.rb │ ├── 20180519011340_add_confirmable_to_devise.rb │ ├── 20180531002815_create_spammy_email_domains.rb │ ├── 20180603023711_add_index_to_discussion_script_id.rb │ ├── 20180622231059_create_script_reports.rb │ ├── 20181110222109_reported_script_f_ks.rb │ ├── 20190131020341_create_authors.rb │ ├── 20190131022248_script_user_id_not_required.rb │ ├── 20190302205639_add_adsense_approved_to_scripts.rb │ ├── 20190302205715_fill_adsense_approved.rb │ ├── 20190303012524_add_page_views_to_scripts.rb │ ├── 20190316005137_add_complete_block_to_spammy_domains.rb │ ├── 20190317022326_add_originating_script_to_disallowed_codes.rb │ ├── 20190323211921_reconfirmable.rb │ ├── 20190330015535_create_script_invitations.rb │ ├── 20190331213941_add_disposable_email_to_users.rb │ ├── 20190519231037_add_object_type_to_disallowed_attributes.rb │ ├── 20190520005220_add_slow_ban_to_disallowed_codes.rb │ ├── 20190706015520_add_type_to_script_reports.rb │ ├── 20190706020932_script_report_reference_script_optional.rb │ ├── 20190706021911_script_report_additional_info_optional.rb │ ├── 20190706022139_rename_script_report_copy_details.rb │ ├── 20190714021359_add_reporter_to_script_report.rb │ ├── 20190714234716_add_blocked_to_site_applications.rb │ ├── 20190902205455_remove_ignored_script_columns.rb │ ├── 20190910235346_add_has_syntax_error_to_scripts.rb │ ├── 20191002004430_esperanto_available.rb │ ├── 20191002005748_serbian_available.rb │ ├── 20191013004547_add_language_to_script.rb │ ├── 20191118025439_add_script_report_result.rb │ ├── 20191118031654_add_trusted_report_to_users.rb │ ├── 20191207032221_add_announcements_seen_to_users.rb │ ├── 20191220163134_add_css_convertible_to_scripts.rb │ ├── 20191225180112_add_canonical_email_to_users.rb │ ├── 20191225180515_populate_user_canonical_email.rb │ ├── 20191226213624_drop_cpd_tables.rb │ ├── 20191226220007_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb │ ├── 20191228011034_add_not_js_convertible_override.rb │ ├── 20200101005408_create_blocked_script_urls.rb │ ├── 20200101013842_add_private_reason_to_moderator_log.rb │ ├── 20200101030644_drpo_approve_redistribution.rb │ ├── 20200101203938_users_canonical_email_not_null.rb │ ├── 20200103021449_create_blocked_script_codes.rb │ ├── 20200104202749_add_originating_script_id_to_blocked_script_codes.rb │ ├── 20200106011534_create_redirect_service_domains.rb │ ├── 20200112155750_create_blocked_script_texts.rb │ ├── 20200112162130_add_requires_review_to_scripts.rb │ ├── 20200122030130_index_users_name.rb │ ├── 20200216204021_add_moderator_note_to_script_reports.rb │ ├── 20200222033044_create_script_similarities.rb │ ├── 20200308010644_add_hash_to_script_codes.rb │ ├── 20200308024143_backfill_code_hash.rb │ ├── 20200308042042_add_script_code_hash_index.rb │ ├── 20200308042133_script_code_hash_not_null.rb │ ├── 20200310225042_add_indexes_to_script_version_code.rb │ ├── 20200314010547_add_index_to_user_canonical_email.rb │ ├── 20200315221243_add_deleted_at_to_scripts.rb │ ├── 20200315221318_script_deleted_at_backfill.rb │ ├── 20200316000339_drop_script_userscript_id.rb │ ├── 20200404022305_add_consecutive_bad_ratings_at_to_scripts.rb │ ├── 20200412164034_add_block_type_to_spammy_email_domain.rb │ ├── 20200501203543_create_discussions.rb │ ├── 20200501204556_create_comments.rb │ ├── 20200502005533_create_reports.rb │ ├── 20200504010752_discussion_rating_not_null.rb │ ├── 20200510183902_comment_edit_date.rb │ ├── 20200512022035_add_stats_to_discussions.rb │ ├── 20200514004501_add_index_to_last_reply_date.rb │ ├── 20200601021359_add_use_new_discussions_to_script.rb │ ├── 20200604020122_add_first_comment_to_comments.rb │ ├── 20200605225727_create_active_storage_tables.active_storage.rb │ ├── 20200606184728_add_migrated_from_to_discussions.rb │ ├── 20200607012451_create_discussion_subscription.rb │ ├── 20200630024246_drop_script_use_new_discussions.rb │ ├── 20200630025057_create_discussion_category.rb │ ├── 20200630025140_populate_discussion_category.rb │ ├── 20200630025619_add_discussion_category_to_discussions.rb │ ├── 20200630025650_backfill_discussion_category.rb │ ├── 20200630025853_discussion_category_not_null.rb │ ├── 20200701171225_add_title_to_discussions.rb │ ├── 20200701175829_rating_nil.rb │ ├── 20200706015413_create_conversations.rb │ ├── 20200706015446_create_messages.rb │ ├── 20200706015815_create_conversation_users.rb │ ├── 20200715013441_add_conversation_stats.rb │ ├── 20200730003009_create_discussion_reads.rb │ ├── 20200804032917_add_discussions_read_since_to_users.rb │ ├── 20200806021345_add_more_notification_settings.rb │ ├── 20200812003620_add_deleted_at_to_comments.rb │ ├── 20200812232744_soft_delete_discussions.rb │ ├── 20200814215855_add_akismet_results_to_discussions.rb │ ├── 20200815014738_create_conversation_subscriptions.rb │ ├── 20200815014922_conversation_subscription_backfill.rb │ ├── 20200815020841_add_conversation_notification_settings.rb │ ├── 20200818014737_add_review_reason_to_discussions.rb │ ├── 20200818021213_akismet_reporter.rb │ ├── 20200823013703_create_akismet_submissions.rb │ ├── 20200824013239_add_auto_reporter_to_script_reports.rb │ ├── 20200828200844_add_index_to_comments_poster_id.rb │ ├── 20200907200035_user_banned_at.rb │ ├── 20200907200130_user_banned_at_backfill.rb │ ├── 20200910021353_add_email_domain_to_users.rb │ ├── 20200910021433_backfill_email_domain.rb │ ├── 20200910023621_backfill_email_domain_again.rb │ ├── 20200912211814_add_index_to_email_domain_and_ip.rb │ ├── 20200918221428_add_session_token_to_users.rb │ ├── 20200919012810_create_banned_email_hashes.rb │ ├── 20201019005046_add_filter_locale_default_to_users.rb │ ├── 20201021010617_add_result_to_blocked_script_texts.rb │ ├── 20201026003811_dedupe_usernames.rb │ ├── 20201026004235_add_unique_index_user_name.rb │ ├── 20201027010717_add_mark_adult_by_user_to_scripts.rb │ ├── 20201031192108_create_user_references.rb │ ├── 20201105015427_drop_unused_user_columns.rb │ ├── 20201108022746_add_notify_on_mention_to_users.rb │ ├── 20201108034727_add_domain_to_blocked_urls.rb │ ├── 20201108041036_blocked_script_url_prefix_default_false.rb │ ├── 20201124014943_drop_dj_table.rb │ ├── 20201129210520_create_antifeatures.rb │ ├── 20201212204837_add_service_name_to_active_storage_blobs.active_storage.rb │ ├── 20201212204838_create_active_storage_variant_records.active_storage.rb │ ├── 20201220200700_add_index_to_discussions_migrated_from.rb │ ├── 20201220204528_add_index_to_user_remember_token.rb │ ├── 20201228020920_moderation_action_relations.rb │ ├── 20201230012028_add_index_to_moderator_action_user_id.rb │ ├── 20210109202918_add_edge.rb │ ├── 20210123022226_add_stat_first_comment_to_discussions.rb │ ├── 20210123022257_stat_first_comment_backfill.rb │ ├── 20210213213755_add_locale_id_to_discussions.rb │ ├── 20210213222917_add_index_to_discussion_locale_id.rb │ ├── 20210214165054_enable_uyghur.rb │ ├── 20210214193805_add_explanation_markup_to_reports.rb │ ├── 20210216014727_add_script_url_to_reports.rb │ ├── 20210221225945_add_self_deleted_to_scripts.rb │ ├── 20210221233018_add_rebuttal_to_reports.rb │ ├── 20210222030536_change_report_reason_length.rb │ ├── 20210223233743_add_moderator_notes_to_reports.rb │ ├── 20210228215935_add_created_at_to_reports.rb │ ├── 20210301011817_migrate_script_reports.rb │ ├── 20210303004355_add_moderator_category.rb │ ├── 20210425201410_add_sync_failure_count.rb │ ├── 20210506145933_drop_userscripts_org_identifiers.rb │ ├── 20210506151411_drop_script_sync_source_type.rb │ ├── 20210520013942_add_report_id_to_discussions.rb │ ├── 20210606234319_add_user_script_stats.rb │ ├── 20210716011206_add_script_delete_type_to_scripts.rb │ ├── 20210718002238_add_indexto_delete_type.rb │ ├── 20210720001120_remove_unused_script_columns.rb │ ├── 20210720001211_remove_unused_localized_script_attribute.rb │ ├── 20210720001400_remove_unused_discussion_attributes.rb │ ├── 20210722011850_add_comment_to_allowed_requires.rb │ ├── 20210814011208_create_script_lock_appeals.rb │ ├── 20210814162649_add_appeal_to_moderator_log.rb │ ├── 20210814211458_add_edited_at_to_messages.rb │ ├── 20210828002422_moderator_notes_on_appeal.rb │ ├── 20210927005947_add_discussion_category_id_to_reports.rb │ ├── 20211031001041_add_no_stats_to_scripts.rb │ ├── 20211102012556_create_cleaned_codes.rb │ ├── 20211102022030_add_unique_index_to_cleaned_codes.rb │ ├── 20211104000300_moderator_actions_text.rb │ ├── 20211104021132_cleaned_code_longtext.rb │ ├── 20211109015133_add_tersed_to_script_similarities.rb │ ├── 20211110192948_add_pure404_to_scripts.rb │ ├── 20211111005455_add_missing_license_warned_to_scripts.rb │ ├── 20211227002934_add_resolver_to_reports.rb │ ├── 20211227014433_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb │ ├── 20220425234023_add_report_notifications_to_users.rb │ ├── 20220913010242_create_subresources.rb │ ├── 20220914015921_create_subresource_integrity_hashes.rb │ ├── 20220915003006_add_check_times_to_subresources.rb │ ├── 20220917003952_add_encoding_to_script_subresource_usage.rb │ ├── 20221218174116_add_georgian_locale.rb │ ├── 20230227004731_add_review_reason_to_comments.rb │ ├── 20230422004659_add_self_uphold_to_report.rb │ ├── 20230617011356_expand_subresources_url.rb │ ├── 20230717184116_update_uighur_name.rb │ ├── 20230906005826_add_central_kurdish_locale.rb │ ├── 20230922233518_add_croatian.rb │ ├── 20230922235219_enum_script_type.rb │ ├── 20230923204228_drop_script_types.rb │ ├── 20231112225004_daily_install_counts_ipv6.rb │ ├── 20231124201937_drop_most_vanilla_tables.rb │ ├── 20240122003921_add_plain_text_to_comments.rb │ ├── 20240122005613_backfill_comment_plain_text.rb │ ├── 20240122162848_add_delete_report_id_to_scripts.rb │ ├── 20240225041012_add_deletion_message_to_scripts.rb │ ├── 20240305015134_dropscript_applies_tos_bak.rb │ ├── 20240524155931_add_moderator_reason_override_to_reports.rb │ ├── 20240605140532_rename_script_sync_type.rb │ ├── 20240605152157_drop_script_sync_types.rb │ ├── 20240612160951_add_case_insensitive_to_blocked_script_codes.rb │ ├── 20240614200415_deleted_unused_script_applications.rb │ ├── 20240614204602_drop_duplicate_site_applications.rb │ ├── 20240614205858_add_unique_site_application.rb │ ├── 20240618193437_add_domain_text_to_site_applications.rb │ ├── 20240618193513_backfill_site_applications_domain_text.rb │ ├── 20240618194344_adjust_site_application_index.rb │ ├── 20240618194529_site_applications_domain_nil.rb │ ├── 20240628174038_add_publicly_visible_to_discussions.rb │ ├── 20240628174100_backfill_discussion_publicly_visisble.rb │ ├── 20240628174604_index_publicly_visible.rb │ ├── 20240628185320_add_index_to_discussions_report_id.rb │ ├── 20240628185847_remove_ignored_site_application_domain.rb │ ├── 20240628230432_daily_install_counts_big_int.rb │ ├── 20240628230757_install_counts_big_int.rb │ ├── 20240628230841_update_check_counts_big_int.rb │ ├── 20240815234051_add_summary_url_to_licenses.rb │ ├── 20240815234121_fill_summary_urls.rb │ ├── 20240904201648_user_id_big_int.rb │ ├── 20240905201334_create_notifications.rb │ ├── 20240905201335_create_user_notification_settings.rb │ ├── 20240912145341_migrate_user_notify_as_reporter.rb │ ├── 20240912150839_migrate_user_notify_as_reported.rb │ ├── 20240916144947_add_notify_admin_to_blocked_script_code.rb │ ├── 20240916150622_add_es419.rb │ ├── 20240916153301_notification_fk_cascase.rb │ ├── 20240923202914_drop_ignored_notify_columns.rb │ ├── 20240923204104_add_subscribe_on_script_discussion_to_users.rb │ ├── 20240923204158_subscribe_on_script_discussion_backfill.rb │ ├── 20240923212204_backfill_script_discussion_subscriptions.rb │ ├── 20240923231550_backfill_user_mention_setting.rb │ ├── 20241022160755_add_created_at_to_akismet_submissions.rb │ ├── 20241022160816_backfill_created_at_akismet_submissions.rb │ ├── 20241022160849_not_null_default_created_at_akismet_submissions.rb │ ├── 20241022172039_allowed_require_bigint.rb │ ├── 20241022172508_remove_unused_user_columns.rb │ ├── 20241022173046_drop_author_email_notification_types.rb │ ├── 20241022173429_browsers_bigint.rb │ ├── 20241022174031_compatiblities_bigint.rb │ ├── 20241022175231_disallowed_codes_bigint.rb │ ├── 20241022175341_identities_bigint.rb │ ├── 20241022175916_locale_contributors_bigint.rb │ ├── 20241022180155_locale_bigint.rb │ ├── 20241022180716_localized_attributes_bigint.rb │ ├── 20241022181445_moderator_actions_bigint.rb │ ├── 20241022181543_roles_bigint.rb │ ├── 20241022181918_drop_screenshots.rb │ ├── 20241022182214_script_applies_to_bigint.rb │ ├── 20241022182612_script_codes_bigint.rb │ ├── 20241022201401_drop_script_delete_types.rb │ ├── 20241022201807_script_set_bigint.rb │ ├── 20241022202445_script_versions_bigint.rb │ ├── 20241022203127_sensitive_sites_bigint.rb │ ├── 20241022203555_syntax_highlighted_codes_bigint.rb │ ├── 20241022203932_drop_test_update_counts.rb │ ├── 20241022205323_scripts_bigint.rb │ ├── 20241024020842_drop_unused_disallowed_tables.rb │ ├── 20241025160414_comments_user_bigint.rb │ ├── 20241025160732_conversations_user_bigint.rb │ ├── 20241025161335_discussions_user_bigint.rb │ ├── 20241026203409_locale_id_bigint.rb │ ├── 20241026204531_user_foreign_key_bigints.rb │ ├── 20241026205203_script_lock_appeal_id_bigint.rb │ ├── 20241026205306_role_id_bigint.rb │ ├── 20241026205747_site_application_id_bigint.rb │ ├── 20241027154233_script_set_automatic_set_inclusion_bigint.rb │ ├── 20241027154556_add_fk_script_subresource_usages.rb │ ├── 20241027215209_script_set_script_inclusion_bigint.rb │ ├── 20241027215557_script_set_script_inclusions_bigint.rb │ ├── 20241027220118_script_versions_script_code_bigint.rb │ ├── 20241027220836_scripts_misc_bigint.rb │ ├── 20241101004022_drop_script_report_fk.rb │ ├── 20241109012359_remove_scripts_promoted.rb │ ├── 20241109191808_add_index_discussion_script_publicly_visible.rb │ ├── 20241115154508_add_discussion_and_comment_to_moderator_actions.rb │ ├── 20241115164257_add_blatant_to_reports.rb │ ├── 20241116204100_add_registration_email_domain_to_users.rb │ ├── 20241117160929_add_notify_admin_to_blocked_script_text.rb │ ├── 20241120160804_add_devise_two_factor_to_users.rb │ ├── 20241122160246_script_delete_notification.rb │ ├── 20241122185627_clear_notification_nil_item.rb │ ├── 20241129152927_create_stat_bans.rb │ ├── 20250103213614_add_code_size_to_scripts.rb │ ├── 20250103213743_backfill_script_code_size.rb │ ├── 20250108162648_add_category_to_blocked_script_code.rb │ ├── 20250121004654_add_created_at_to_script_lock_appeals.rb │ ├── 20250121004757_backfill_script_lock_appeal_created_at.rb │ ├── 20250121005544_script_lock_appeal_created_at_not_null.rb │ ├── 20250122165121_remove_ignored_disable_stats.rb │ ├── 20250205223931_add_require_secure_login_for_author_to_usres.rb │ ├── 20250205224005_require_secure_login_for_author_backfill.rb │ ├── 20250205224138_require_secure_login_for_author_default.rb │ ├── 20250205225150_require_secure_login_for_no_scripts.rb │ ├── 20250206002942_change_blocked_script_codes_result.rb │ ├── 20250224231045_marathi_available.rb │ ├── 20250227002159_create_blocked_users.rb │ ├── 20250227002546_backfill_blocked_users.rb │ ├── 20250228220422_add_index_to_comments_deleted_at.rb │ ├── 20250307155204_add_private_explanation_to_reports.rb │ ├── 20250312210702_moderator_actions_auto_mod.rb │ ├── 20250312212656_add_report_automod_resolved.rb │ ├── 20250409220424_add_action_taken_to_moderator_action.rb │ ├── 20250409220543_backfill_moderator_action_action_taken.rb │ └── 20250409221815_moderator_action_action_taken_not_null.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep ├── bitbucket.rb ├── capistrano │ └── tasks │ │ └── invoke.rake ├── css_parser.rb ├── css_to_js_converter.rb ├── data_centre_ips.rb ├── git.rb ├── github.rb ├── gitlab.rb ├── google_analytics.rb ├── google_safe_browsing.rb ├── js_checker.rb ├── js_cleanup.rb ├── js_executor.rb ├── js_parser.rb ├── localizing_model.rb ├── match_uri.rb ├── script_importer │ ├── base_script_importer.rb │ ├── script_syncer.rb │ ├── test_importer.rb │ └── url_importer.rb ├── searchkick_disable_middleware.rb ├── sidekiq │ ├── max_concurrency_exception.rb │ └── queue_checking.rb ├── tasks │ ├── .keep │ ├── code_search.rake │ ├── script_stats.rake │ ├── spdx.rake │ ├── transifex.rake │ └── user_stats.rake ├── url_regexp.rb └── will_paginate │ └── action_view │ └── link_renderer_with_no_follow.rb ├── misc └── logos │ ├── logo16.xcf │ ├── logo32.xcf │ ├── logo512.xcf │ └── logo96.xcf ├── package.json ├── public ├── 400.html ├── 404.html ├── 406-unsupported-browser.html ├── 422.html ├── 500.html ├── 503.html ├── ads.txt ├── assets │ └── .sprockets-manifest-271ae10b4b379e08540efa63ed1aaa5f.json ├── favicon.ico ├── icon.png ├── icon.svg ├── images │ ├── blacklogo128.png │ ├── blacklogo16.png │ ├── blacklogo32.png │ ├── blacklogo512.png │ └── blacklogo96.png ├── libraries │ ├── GM_config │ │ └── 20131122 │ │ │ └── GM_config.js │ ├── GM_setStyle │ │ └── 0.0.15 │ │ │ ├── GM_setStyle.js │ │ │ └── license.txt │ └── jscolor │ │ └── 1.4.2 │ │ ├── arrow.gif │ │ ├── cross.gif │ │ ├── demo.html │ │ ├── hs.png │ │ ├── hv.png │ │ └── jscolor.js └── robots.txt ├── runnerscripts ├── applies_to_stats.rb ├── detect_locale.rb ├── refresh_script_version_codes.rb ├── refresh_scripts.rb └── sanitize_blocked_content.rb ├── shellscripts ├── clear_cached_code.sh ├── clear_cached_pages.sh ├── update_counts_aggregate.sh ├── update_counts_aggregate.sql ├── update_counts_from_log.sh ├── update_fan_counts.sh ├── update_fan_counts.sql ├── update_install_counts.sh └── update_install_counts.sql ├── test ├── application_system_test_case.rb ├── controllers │ ├── .keep │ ├── api_domain_test.rb │ ├── localized_request_test.rb │ ├── scripts_controller_test.rb │ ├── scripts_update_controller_test.rb │ ├── unsubscribe_controller_test.rb │ └── users_controller_test.rb ├── dependencies_test.rb ├── fixtures │ ├── .keep │ ├── allowed_requires.yml │ ├── antifeatures.yml │ ├── authors.yml │ ├── blocked_script_codes.yml │ ├── blocked_script_texts.yml │ ├── blocked_script_urls.yml │ ├── browsers.yml │ ├── comments.yml │ ├── conversations.yml │ ├── discussion_categories.yml │ ├── discussions.yml │ ├── files │ │ ├── blacklogo16.png │ │ └── hamlet.txt │ ├── locales.yml │ ├── localized_script_attributes.yml │ ├── localized_script_version_attributes.yml │ ├── messages.yml │ ├── redirect_service_domains.yml │ ├── reports.yml │ ├── roles.yml │ ├── roles_users.yml │ ├── script_applies_tos.yml │ ├── script_codes.yml │ ├── script_sets.yml │ ├── script_similarities.yml │ ├── script_versions.yml │ ├── scripts.yml │ ├── sensitive_sites.yml │ ├── site_applications.yml │ ├── spammy_email_domains.yml │ └── users.yml ├── helpers │ ├── .keep │ └── user_text_helper_test.rb ├── integration │ ├── .keep │ ├── base_script_importer_test.rb │ ├── bitbucket_webhook_test.rb │ ├── github_webhook_test.rb │ ├── gitlab_webhook_test.rb │ ├── script_syncer_test.rb │ └── url_importer_test.rb ├── jobs │ ├── akismet_submission_delete_job_test.rb │ ├── comment_spam_check_job_test.rb │ ├── consecutive_bad_ratings_job_test.rb │ ├── delete_old_notifications_job_test.rb │ ├── script_duplicate_checker_job_test.rb │ ├── script_previously_deleted_checker_test.rb │ ├── stat_ban_checking_job_test.rb │ ├── subresource_check_queueing_job_test.rb │ └── user_checking_job_test.rb ├── lib │ ├── css_parser_applies_to_test.rb │ ├── css_parser_test.rb │ ├── css_to_js_converter_test.rb │ ├── js_checker_test.rb │ ├── js_cleanup_test.rb │ ├── js_executor_test.rb │ ├── js_parser_applies_to_test.rb │ └── js_parser_test.rb ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── comment_test.rb │ ├── concerns │ │ └── mentions_users_test.rb │ ├── discussion_test.rb │ ├── locale_test.rb │ ├── report_test.rb │ ├── script_antifeature_test.rb │ ├── script_applies_to_test.rb │ ├── script_compatibility_test.rb │ ├── script_localization_test.rb │ ├── script_set_test.rb │ ├── script_subresource_test.rb │ ├── script_test.rb │ ├── script_validation_test.rb │ ├── script_version_allowed_requires_test.rb │ ├── script_version_allowed_resources_test.rb │ ├── script_version_compare_numbers_test.rb │ ├── script_version_invalid_match_test.rb │ ├── script_version_missing_license_test.rb │ ├── script_version_previously_posted_test.rb │ ├── script_version_test.rb │ ├── subresource_test.rb │ └── user_test.rb ├── services │ ├── comment_checking │ │ ├── akismet_checker_test.rb │ │ ├── custom_checker_test.rb │ │ ├── deleted_repeated_link_checker_test.rb │ │ ├── deleted_repeated_text_checker_test.rb │ │ ├── link_count_checker_test.rb │ │ ├── only_link_checker_test.rb │ │ └── repeated_text_checker_test.rb │ ├── comment_checking_service_test.rb │ ├── i18n_test.rb │ ├── script_checking │ │ ├── code_checker_test.rb │ │ ├── link_checker_test.rb │ │ └── text_checker_test.rb │ ├── script_checking_service_test.rb │ └── top_sites_service_test.rb ├── system │ ├── admin │ │ └── ads_test.rb │ ├── announcements_test.rb │ ├── conversations │ │ ├── conversations_test.rb │ │ ├── notifications_test.rb │ │ └── preview_test.rb │ ├── discussions │ │ ├── blocked_test.rb │ │ ├── discussions_test.rb │ │ ├── listing_test.rb │ │ ├── mark_as_read_test.rb │ │ ├── notifications_test.rb │ │ ├── review_state_test.rb │ │ └── script_discussions_test.rb │ ├── helps_test.rb │ ├── import_test.rb │ ├── locales_test.rb │ ├── notifications_test.rb │ ├── registration_test.rb │ ├── reports │ │ ├── blocked_test.rb │ │ ├── filing_test.rb │ │ └── resolving_test.rb │ ├── script_lock_appeals_test.rb │ ├── scripts │ │ ├── accept_invitation_test.rb │ │ ├── additional_info_test.rb │ │ ├── admin_test.rb │ │ ├── attachments_test.rb │ │ ├── block_test.rb │ │ ├── create_test.rb │ │ ├── delete_test.rb │ │ ├── derivatives_test.rb │ │ ├── feedback_test.rb │ │ ├── install_test.rb │ │ ├── invite_test.rb │ │ ├── list_test.rb │ │ ├── remove_author_test.rb │ │ ├── show_test.rb │ │ ├── stats_test.rb │ │ ├── subresource_test.rb │ │ ├── update_test.rb │ │ ├── versions_test.rb │ │ └── warnings_test.rb │ ├── two_factor_authentication_test.rb │ └── users │ │ ├── admin_test.rb │ │ ├── list_test.rb │ │ ├── login_test.rb │ │ ├── notification_settings_test.rb │ │ ├── show_test.rb │ │ └── update_test.rb └── test_helper.rb ├── vite.config.ts └── yarn.lock /.browserslistrc: -------------------------------------------------------------------------------- 1 | defaults 2 | -------------------------------------------------------------------------------- /.circleci/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/.circleci/application.yml -------------------------------------------------------------------------------- /.circleci/database.yml: -------------------------------------------------------------------------------- 1 | test: 2 | adapter: mysql2 3 | encoding: utf8mb4 4 | database: <%= ENV['MYSQL_DATABASE'] %> 5 | pool: 5 6 | timeout: 5000 7 | username: <%= ENV['MYSQL_USER'] %> 8 | password: <%= ENV['MYSQL_PASSWORD'] %> 9 | host: <%= ENV['MYSQL_HOST'] %> 10 | port: <%= ENV['MYSQL_PORT'] %> 11 | -------------------------------------------------------------------------------- /.tx/config: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://www.transifex.com 3 | 4 | [o:greasy-fork:p:greasy-fork:r:enyml-19] 5 | file_filter = config/locales/.yml 6 | source_file = config/locales/en.yml 7 | type = YML 8 | minimum_perc = 0 9 | resource_name = greasyfork.yml 10 | lang_map = fr_CA: fr-CA, pt_BR: pt-BR, zh_CN: zh-CN, zh_TW: zh-TW 11 | -------------------------------------------------------------------------------- /Procfile.dev: -------------------------------------------------------------------------------- 1 | 2 | vite: bin/vite dev 3 | web: bin/rails s 4 | -------------------------------------------------------------------------------- /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', __dir__) 5 | 6 | Greasyfork::Application.load_tasks 7 | -------------------------------------------------------------------------------- /app/controllers/admin/base_controller.rb: -------------------------------------------------------------------------------- 1 | module Admin 2 | class BaseController < ApplicationController 3 | before_action :moderators_only 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/controllers/admin/home_controller.rb: -------------------------------------------------------------------------------- 1 | module Admin 2 | class HomeController < BaseController 3 | def index; end 4 | 5 | def rule_interpretations; end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/concerns/discussion_restrictions.rb: -------------------------------------------------------------------------------- 1 | module DiscussionRestrictions 2 | def check_user_restrictions 3 | discussion_restriction = UserRestrictionService.new(current_user).discussion_restriction 4 | case discussion_restriction 5 | when nil 6 | # OK 7 | when UserRestrictionService::BLOCKED 8 | render 'discussions/post_blocked' 9 | else 10 | raise "Unknown restriction #{discussion_restriction}" 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/controllers/concerns/request_debugging.rb: -------------------------------------------------------------------------------- 1 | module RequestDebugging 2 | extend ActiveSupport::Concern 3 | 4 | def log_headers 5 | Rails.root.join('log/debug_headers.txt').write("#{request.url}\n#{DateTime.now}\n#{request.headers.select { |key, _val| key.starts_with?('HTTP_') }.map { |key, val| "#{key}: #{val}" }.join("\n")}\n\n", mode: 'a+') 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/controllers/help_controller.rb: -------------------------------------------------------------------------------- 1 | class HelpController < ApplicationController 2 | def installing_user_scripts 3 | @ad_method = choose_ad_method 4 | # All this content is on the home page. 5 | @bots = 'noindex' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/controllers/moderator_actions_controller.rb: -------------------------------------------------------------------------------- 1 | class ModeratorActionsController < ApplicationController 2 | def index 3 | respond_to do |format| 4 | format.html do 5 | @actions = ModeratorAction.includes(:script, :moderator, :user, :report).order(id: :desc).paginate(page: page_number, per_page: per_page(default: 100)) 6 | @bots = 'noindex' 7 | @canonical_params = [:page] 8 | render layout: 'base' 9 | end 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/controllers/opensearch_controller.rb: -------------------------------------------------------------------------------- 1 | class OpensearchController < ApplicationController 2 | def description 3 | render 'description', formats: :xml 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/controllers/qr_controller.rb: -------------------------------------------------------------------------------- 1 | require 'rqrcode' 2 | 3 | class QrController < ApplicationController 4 | skip_before_action :set_locale 5 | 6 | def show 7 | unless params[:url] 8 | head :not_found, content_type: 'text/plain' 9 | return 10 | end 11 | 12 | qrcode = RQRCode::QRCode.new(params[:url]) 13 | render body: qrcode.as_svg, content_type: 'image/svg+xml' 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/controllers/unsubscribe_controller.rb: -------------------------------------------------------------------------------- 1 | class UnsubscribeController < ActionController::Base # rubocop:disable Rails/ApplicationController 2 | skip_forgery_protection 3 | 4 | def process_one_click 5 | user = User.find_by_token_for(:one_click_unsubscribe, params[:token]) 6 | unless user 7 | head :ok 8 | return 9 | end 10 | 11 | user.unsubscribe_email! 12 | head :ok 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/helpers/login_helper.rb: -------------------------------------------------------------------------------- 1 | module LoginHelper 2 | def available_auths 3 | auths = Rails.application.config.available_auths 4 | 5 | # GitHub does not support multiple allowed callback URLs. 6 | return auths.except('github') unless greasy? 7 | 8 | auths 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/javascript/announcements.js: -------------------------------------------------------------------------------- 1 | import onload from '~/onload' 2 | 3 | function init() { 4 | var form = document.getElementById("announcement-dismiss"); 5 | if (form) { 6 | form.addEventListener("ajax:success", function() { 7 | var container = form.parentNode; 8 | container.parentNode.removeChild(container); 9 | }); 10 | } 11 | } 12 | 13 | onload(init) -------------------------------------------------------------------------------- /app/javascript/header.js: -------------------------------------------------------------------------------- 1 | import onload from '~/onload' 2 | 3 | let toggleMobileNav = () => { document.querySelector("#mobile-nav nav").classList.toggle("collapsed") } 4 | 5 | onload(() => document.querySelector(".mobile-nav-opener")?.addEventListener("click", toggleMobileNav)) 6 | -------------------------------------------------------------------------------- /app/javascript/highlight.js: -------------------------------------------------------------------------------- 1 | export default function highlight(element) { 2 | element.style.transition = "background-color 3s" 3 | element.classList.add('highlight') 4 | setTimeout(() => element.classList.remove('highlight'), 3000) 5 | } 6 | -------------------------------------------------------------------------------- /app/javascript/images/blacklogo128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/app/javascript/images/blacklogo128.png -------------------------------------------------------------------------------- /app/javascript/images/blacklogo16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/app/javascript/images/blacklogo16.png -------------------------------------------------------------------------------- /app/javascript/images/blacklogo32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/app/javascript/images/blacklogo32.png -------------------------------------------------------------------------------- /app/javascript/images/blacklogo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/app/javascript/images/blacklogo512.png -------------------------------------------------------------------------------- /app/javascript/images/blacklogo96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/app/javascript/images/blacklogo96.png -------------------------------------------------------------------------------- /app/javascript/images/github-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/app/javascript/images/github-32.png -------------------------------------------------------------------------------- /app/javascript/images/gitlab-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/app/javascript/images/gitlab-32.png -------------------------------------------------------------------------------- /app/javascript/images/google-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/app/javascript/images/google-32.png -------------------------------------------------------------------------------- /app/javascript/images/install-button-example.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/app/javascript/images/install-button-example.webp -------------------------------------------------------------------------------- /app/javascript/images/tampermonkey-manage.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/app/javascript/images/tampermonkey-manage.webp -------------------------------------------------------------------------------- /app/javascript/images/x.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/javascript/login.js: -------------------------------------------------------------------------------- 1 | import onload from "~/onload"; 2 | 3 | // For some reason, the CSRF token generated in the form doesn't work. Maybe something to do with rendering through 4 | // devise? 5 | onload(() => { 6 | let form_csrf = document.querySelector('.external-login-form [name="authenticity_token"]') 7 | if (!form_csrf) { 8 | return 9 | } 10 | form_csrf.value = document.querySelector('meta[name="csrf-token"]').getAttribute('content') 11 | }) 12 | -------------------------------------------------------------------------------- /app/javascript/onload.js: -------------------------------------------------------------------------------- 1 | export default function onload(func) { 2 | document.documentElement.addEventListener("turbo:load", func) 3 | } -------------------------------------------------------------------------------- /app/javascript/stylesheets/admin.css: -------------------------------------------------------------------------------- 1 | .blocked-script-codes { 2 | font-size: smaller; 3 | border-collapse: collapse; 4 | width: 100%; 5 | text-align: left; 6 | } 7 | .blocked-script-codes .pattern-row code { 8 | font-size: medium; 9 | } 10 | .blocked-script-codes .pattern-row { 11 | border-top: 1px solid gray; 12 | } 13 | .blocked-script-codes .info-row td:first-child { 14 | width: 2em; 15 | } 16 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/after_radio_chosen.css: -------------------------------------------------------------------------------- 1 | .after-radio-chosen { 2 | display: none; 3 | margin-left: 29px; 4 | } 5 | input[type=radio]:checked ~ .after-radio-chosen { 6 | display: block; 7 | } -------------------------------------------------------------------------------- /app/javascript/stylesheets/announcement.css: -------------------------------------------------------------------------------- 1 | .announcement { 2 | margin: 14px 0; 3 | text-align: center; 4 | font-size: smaller; 5 | } 6 | .announcement form { 7 | display: inline; 8 | } 9 | .announcement input { 10 | appearance: none; 11 | -moz-appearance: none; 12 | -webkit-appearance: none; 13 | border: 0; 14 | background: none; 15 | margin: 0 0 0 4px; 16 | padding: 0; 17 | cursor: pointer; 18 | } 19 | .announcement, .announcement input { 20 | font-size: 12px; 21 | } -------------------------------------------------------------------------------- /app/javascript/stylesheets/expandable-text.css: -------------------------------------------------------------------------------- 1 | .expander { 2 | cursor: pointer; 3 | display: block; 4 | color: #670000; 5 | border-radius: 3px; 6 | background-color: #F2E5E5; 7 | position: absolute; 8 | width: 20px; 9 | height: 20px; 10 | text-align: center; 11 | inset-inline-end: -22px; 12 | bottom: 0; 13 | } 14 | .expanded { 15 | overflow: auto; 16 | } 17 | .collapsed { 18 | overflow: hidden; 19 | } -------------------------------------------------------------------------------- /app/javascript/stylesheets/help.css: -------------------------------------------------------------------------------- 1 | #test-require-result-ok, #test-require-result-not-ok { 2 | display: none; 3 | font-weight: bold; 4 | } 5 | #test-require-result-ok { 6 | color: green; 7 | } 8 | #test-require-result-not-ok { 9 | color: red; 10 | } 11 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/highlight.css: -------------------------------------------------------------------------------- 1 | .highlight { 2 | background-color: yellow; 3 | 4 | } -------------------------------------------------------------------------------- /app/javascript/stylesheets/log_table.css: -------------------------------------------------------------------------------- 1 | .log-table { 2 | width: 100%; 3 | } 4 | .log-table th { 5 | text-align: left; 6 | } 7 | .log-table td, .log-table th { 8 | padding: 0 5px; 9 | } 10 | /* overflow-wrap doesn't work on table cells, so this is in its own div */ 11 | .log-table td .possibly-long-text { 12 | max-width: 500px; 13 | overflow-wrap: break-word; 14 | } 15 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/notification.css: -------------------------------------------------------------------------------- 1 | .notification-widget { 2 | display: inline-block; 3 | width: 1em; 4 | height: 1em; 5 | text-align: center; 6 | line-height: 1em; 7 | padding: 2px; 8 | 9 | background-color: #31708F; 10 | border-radius: 50%; 11 | color: white; 12 | 13 | text-decoration: none; 14 | } 15 | .notification-type-consecutive_bad_ratings a { 16 | white-space: normal; 17 | } -------------------------------------------------------------------------------- /app/javascript/stylesheets/preview.css: -------------------------------------------------------------------------------- 1 | .preview-results { 2 | border: 1px solid gray; 3 | overflow: auto; 4 | box-sizing: border-box; 5 | margin: 0; 6 | padding: 16px; 7 | } 8 | .preview-results > p:first-child { 9 | margin-top: 0; 10 | } 11 | .preview-results > p:last-child { 12 | margin-bottom: 0; 13 | } 14 | .previewable textarea { 15 | margin: 0; 16 | } 17 | .previewable .tabs { 18 | margin-top: 10px; 19 | margin-bottom: -4px; 20 | } 21 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/script_admin.css: -------------------------------------------------------------------------------- 1 | .checkup-list { 2 | padding-inline-start: 1em; 3 | } 4 | .checkup-list li { 5 | list-style-type: "✗"; 6 | padding-inline-start: 0.5em; 7 | } 8 | .checkup-list li::marker { 9 | color: red; 10 | } 11 | .checkup-list li.good-check { 12 | list-style-type: "✓"; 13 | } 14 | .checkup-list li.good-check::marker { 15 | color: green; 16 | } 17 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/script_lock_appeal.css: -------------------------------------------------------------------------------- 1 | .script-lock-appeal-actions form { 2 | display: inline-block; 3 | margin-top: 1em; 4 | } -------------------------------------------------------------------------------- /app/jobs/akismet_ham_job.rb: -------------------------------------------------------------------------------- 1 | class AkismetHamJob < ApplicationJob 2 | queue_as :low 3 | 4 | def perform(akismet_submission) 5 | return unless Akismet.api_key 6 | 7 | Akismet.ham(*akismet_submission.akismet_params) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/jobs/akismet_submission_delete_job.rb: -------------------------------------------------------------------------------- 1 | class AkismetSubmissionDeleteJob 2 | include Sidekiq::Job 3 | 4 | sidekiq_options queue: 'background', lock: :until_executed, on_conflict: :log, lock_ttl: 1.hour.to_i 5 | 6 | KEEP_AGE = 1.year 7 | 8 | def perform 9 | AkismetSubmission.where(created_at: ...KEEP_AGE.ago).in_batches.delete_all 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/jobs/banned_user_delete_job.rb: -------------------------------------------------------------------------------- 1 | class BannedUserDeleteJob 2 | include Sidekiq::Job 3 | 4 | sidekiq_options queue: 'background', lock: :until_executed, on_conflict: :log, lock_ttl: 1.hour.to_i 5 | 6 | BANNED_AGE = 6.months 7 | 8 | def perform 9 | User.where(banned_at: ...BANNED_AGE.ago).destroy_all 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/jobs/cleaned_code_job.rb: -------------------------------------------------------------------------------- 1 | require 'js_cleanup' 2 | 3 | class CleanedCodeJob < ApplicationJob 4 | queue_as :background 5 | 6 | def perform(script) 7 | return unless script.js? 8 | 9 | clean_code = JsCleanup.cleanup(script.current_code) 10 | rescue JsCleanup::UncleanableException 11 | CleanedCode.where(script_id: script.id).delete_all 12 | else 13 | CleanedCode.upsert({ script_id: script.id, code: clean_code }) 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/jobs/comment_notification_job.rb: -------------------------------------------------------------------------------- 1 | class CommentNotificationJob < ApplicationJob 2 | def perform(comment) 3 | return if comment.nil? || comment.soft_deleted? || comment.review_reason.present? || comment.discussion.review_reason.present? 4 | 5 | comment.send_notifications! 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/jobs/comment_spam_check_job.rb: -------------------------------------------------------------------------------- 1 | class CommentSpamCheckJob < ApplicationJob 2 | queue_as :low 3 | 4 | def perform(comment, ip, user_agent, referrer) 5 | return if comment.soft_deleted? 6 | 7 | CommentCheckingService.check(comment, ip:, user_agent:, referrer:) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/jobs/delete_old_notifications_job.rb: -------------------------------------------------------------------------------- 1 | class DeleteOldNotificationsJob 2 | include Sidekiq::Job 3 | 4 | sidekiq_options queue: 'background', lock: :until_executed, on_conflict: :log, lock_ttl: 15.minutes.to_i 5 | 6 | def perform 7 | Notification.where(created_at: ..1.year.ago).delete_all 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/jobs/discussion_read_cleanup_job.rb: -------------------------------------------------------------------------------- 1 | class DiscussionReadCleanupJob 2 | include Sidekiq::Job 3 | 4 | sidekiq_options queue: 'low', lock: :until_executed, on_conflict: :log, lock_ttl: 15.minutes.to_i 5 | 6 | def perform 7 | DiscussionRead 8 | .joins(:user) 9 | .where.not(users: { discussions_read_since: nil }) 10 | .where('discussion_reads.read_at <= users.discussions_read_since') 11 | .delete_all 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/jobs/message_notification_job.rb: -------------------------------------------------------------------------------- 1 | class MessageNotificationJob < ApplicationJob 2 | def perform(message) 3 | message.send_notifications! 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/jobs/subresource_check_job.rb: -------------------------------------------------------------------------------- 1 | class SubresourceCheckJob < ApplicationJob 2 | queue_as :low 3 | 4 | def perform(subresource) 5 | subresource.calculate_hashes! 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/app/mailers/.keep -------------------------------------------------------------------------------- /app/mailers/devise_mailer.rb: -------------------------------------------------------------------------------- 1 | class DeviseMailer < Devise::Mailer 2 | default from: 'Greasy Fork ' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /app/mailers/user_mailer.rb: -------------------------------------------------------------------------------- 1 | class UserMailer < ApplicationMailer 2 | def delete_confirm(user, site_name) 3 | set_locale_for_user(user) 4 | mail(to: user.email, subject: t('users.delete.confirmation_email.subject', site_name:)) do |format| 5 | format.text do 6 | render plain: t('users.delete.confirmation_email.body', site_name:, user_name: user.name, url: user_delete_confirm_url(key: user.delete_confirmation_key)) 7 | end 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/app/models/.keep -------------------------------------------------------------------------------- /app/models/akismet_submission.rb: -------------------------------------------------------------------------------- 1 | class AkismetSubmission < ApplicationRecord 2 | belongs_to :item, polymorphic: true 3 | 4 | serialize :akismet_params, type: Array, coder: YAML 5 | 6 | def self.mark_as_ham(item) 7 | akismet_submission = find_by(item:, result_spam: true) 8 | AkismetHamJob.perform_later(akismet_submission) if akismet_submission 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/models/allowed_require.rb: -------------------------------------------------------------------------------- 1 | class AllowedRequire < ApplicationRecord 2 | strip_attributes 3 | end 4 | -------------------------------------------------------------------------------- /app/models/antifeature.rb: -------------------------------------------------------------------------------- 1 | class Antifeature < ApplicationRecord 2 | belongs_to :script 3 | belongs_to :locale, optional: true 4 | 5 | enum :antifeature_type, { 'ads' => 0, 'tracking' => 1, 'miner' => 2, 'referral-link' => 3, 'membership' => 4, 'payment' => 5 } 6 | end 7 | -------------------------------------------------------------------------------- /app/models/author.rb: -------------------------------------------------------------------------------- 1 | class Author < ApplicationRecord 2 | belongs_to :script 3 | belongs_to :user 4 | end 5 | -------------------------------------------------------------------------------- /app/models/banned_email_hash.rb: -------------------------------------------------------------------------------- 1 | class BannedEmailHash < ApplicationRecord 2 | end 3 | -------------------------------------------------------------------------------- /app/models/blocked_script_text.rb: -------------------------------------------------------------------------------- 1 | class BlockedScriptText < ApplicationRecord 2 | RESULT_CODE_REVIEW = 'review'.freeze 3 | RESULT_CODE_BAN = 'ban'.freeze 4 | 5 | scope :bannable, -> { where(result: RESULT_CODE_BAN) } 6 | 7 | def review? 8 | result == RESULT_CODE_REVIEW 9 | end 10 | 11 | def ban? 12 | result == RESULT_CODE_BAN 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/models/blocked_script_url.rb: -------------------------------------------------------------------------------- 1 | class BlockedScriptUrl < ApplicationRecord 2 | end 3 | -------------------------------------------------------------------------------- /app/models/blocked_user.rb: -------------------------------------------------------------------------------- 1 | class BlockedUser < ApplicationRecord 2 | end 3 | -------------------------------------------------------------------------------- /app/models/browser.rb: -------------------------------------------------------------------------------- 1 | class Browser < ApplicationRecord 2 | end 3 | -------------------------------------------------------------------------------- /app/models/cleaned_code.rb: -------------------------------------------------------------------------------- 1 | class CleanedCode < ApplicationRecord 2 | belongs_to :script 3 | end 4 | -------------------------------------------------------------------------------- /app/models/compatibility.rb: -------------------------------------------------------------------------------- 1 | class Compatibility < ApplicationRecord 2 | belongs_to :script 3 | belongs_to :browser 4 | end 5 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/conversation_subscription.rb: -------------------------------------------------------------------------------- 1 | class ConversationSubscription < ApplicationRecord 2 | belongs_to :conversation 3 | belongs_to :user 4 | end 5 | -------------------------------------------------------------------------------- /app/models/daily_update_check_count.rb: -------------------------------------------------------------------------------- 1 | class DailyUpdateCheckCount < ApplicationRecord 2 | end 3 | -------------------------------------------------------------------------------- /app/models/discussion_subscription.rb: -------------------------------------------------------------------------------- 1 | class DiscussionSubscription < ApplicationRecord 2 | belongs_to :discussion 3 | belongs_to :user 4 | end 5 | -------------------------------------------------------------------------------- /app/models/forum_comment.rb: -------------------------------------------------------------------------------- 1 | class ForumComment < ApplicationRecord 2 | self.table_name = 'GDN_Comment' 3 | self.primary_key = 'CommentID' 4 | 5 | belongs_to :forum_discussion, foreign_key: 'DiscussionID', inverse_of: :forum_comments 6 | 7 | scope :not_deleted, -> { where(DateDeleted: nil) } 8 | end 9 | -------------------------------------------------------------------------------- /app/models/identity.rb: -------------------------------------------------------------------------------- 1 | class Identity < ApplicationRecord 2 | belongs_to :user 3 | 4 | def pretty_provider 5 | Identity.pretty_provider(provider) 6 | end 7 | 8 | def self.pretty_provider(provider) 9 | Rails.application.config.available_auths[provider] || "#{provider} (non-functional)" 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/models/license.rb: -------------------------------------------------------------------------------- 1 | class License < ApplicationRecord 2 | def explanation_url 3 | summary_url || self.class.tldr_search_url(code) 4 | end 5 | 6 | def self.tldr_search_url(text) 7 | "https://tldrlegal.com/search?query=#{URI.encode_www_form_component(text)}" 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/models/locale_contributor.rb: -------------------------------------------------------------------------------- 1 | class LocaleContributor < ApplicationRecord 2 | belongs_to :locale 3 | end 4 | -------------------------------------------------------------------------------- /app/models/localized_script_version_attribute.rb: -------------------------------------------------------------------------------- 1 | class LocalizedScriptVersionAttribute < ApplicationRecord 2 | include MentionsUsers 3 | 4 | belongs_to :script_version 5 | belongs_to :locale 6 | 7 | delegate :script, to: :script_version 8 | 9 | strip_attributes only: [:attribute_key, :attribute_value] 10 | 11 | validates :attribute_key, :attribute_value, :value_markup, presence: true 12 | end 13 | -------------------------------------------------------------------------------- /app/models/mention.rb: -------------------------------------------------------------------------------- 1 | class Mention < ApplicationRecord 2 | belongs_to :mentioning_item, polymorphic: true 3 | belongs_to :user, inverse_of: 'mentions_as_target' 4 | end 5 | -------------------------------------------------------------------------------- /app/models/redirect_service_domain.rb: -------------------------------------------------------------------------------- 1 | class RedirectServiceDomain < ApplicationRecord 2 | end 3 | -------------------------------------------------------------------------------- /app/models/role.rb: -------------------------------------------------------------------------------- 1 | class Role < ApplicationRecord 2 | has_and_belongs_to_many :users 3 | end 4 | -------------------------------------------------------------------------------- /app/models/script_code.rb: -------------------------------------------------------------------------------- 1 | require 'digest' 2 | 3 | class ScriptCode < ApplicationRecord 4 | before_save do 5 | self.code_hash = calculate_hash 6 | end 7 | 8 | def calculate_hash 9 | self.code_hash = Digest::SHA1.hexdigest code 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/models/script_invitation.rb: -------------------------------------------------------------------------------- 1 | class ScriptInvitation < ApplicationRecord 2 | VALIDITY_PERIOD = 3.days 3 | 4 | belongs_to :script 5 | belongs_to :invited_user, class_name: 'User' 6 | 7 | def expired? 8 | expires_at.past? 9 | end 10 | 11 | def accept! 12 | self.class.transaction do 13 | script.authors.create!(user: invited_user) 14 | destroy! 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/models/script_set_automatic_type.rb: -------------------------------------------------------------------------------- 1 | class ScriptSetAutomaticType < ApplicationRecord 2 | end 3 | -------------------------------------------------------------------------------- /app/models/script_set_script_inclusion.rb: -------------------------------------------------------------------------------- 1 | class ScriptSetScriptInclusion < ApplicationRecord 2 | belongs_to :parent, class_name: 'ScriptSet', touch: true 3 | belongs_to :child, class_name: 'Script' 4 | end 5 | -------------------------------------------------------------------------------- /app/models/script_set_set_inclusion.rb: -------------------------------------------------------------------------------- 1 | class ScriptSetSetInclusion < ApplicationRecord 2 | belongs_to :parent, class_name: 'ScriptSet', touch: true 3 | belongs_to :child, class_name: 'ScriptSet' 4 | end 5 | -------------------------------------------------------------------------------- /app/models/script_similarity.rb: -------------------------------------------------------------------------------- 1 | class ScriptSimilarity < ApplicationRecord 2 | belongs_to :script 3 | belongs_to :other_script, class_name: 'Script' 4 | end 5 | -------------------------------------------------------------------------------- /app/models/script_subresource_usage.rb: -------------------------------------------------------------------------------- 1 | class ScriptSubresourceUsage < ApplicationRecord 2 | belongs_to :script 3 | belongs_to :subresource 4 | end 5 | -------------------------------------------------------------------------------- /app/models/sensitive_site.rb: -------------------------------------------------------------------------------- 1 | class SensitiveSite < ApplicationRecord 2 | end 3 | -------------------------------------------------------------------------------- /app/models/site_application.rb: -------------------------------------------------------------------------------- 1 | # domain_text exists to provide a shorter, indexable column. It only has a value if the SiteApplication is for a domain. 2 | class SiteApplication < ApplicationRecord 3 | has_many :script_applies_tos, dependent: :destroy 4 | has_many :scripts, through: :script_applies_tos 5 | 6 | scope :domain, -> { where.not(domain_text: nil) } 7 | 8 | def domain? 9 | domain_text.present? 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/models/stat_ban.rb: -------------------------------------------------------------------------------- 1 | class StatBan < ApplicationRecord 2 | belongs_to :script 3 | 4 | scope :active, -> { where('expires_at > NOW()') } 5 | 6 | def self.add_next_ban!(script_id) 7 | previous_bans = StatBan.where(script_id:).count 8 | ban_length_days = 2**(previous_bans + 1) 9 | Rails.logger.info("Banning script #{script_id} for #{ban_length_days} days") 10 | StatBan.create!(script_id:, expires_at: ban_length_days.days.from_now) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/models/subresource_integrity_hash.rb: -------------------------------------------------------------------------------- 1 | class SubresourceIntegrityHash < ApplicationRecord 2 | belongs_to :subresource 3 | end 4 | -------------------------------------------------------------------------------- /app/services/comment_checking/link_count_checker.rb: -------------------------------------------------------------------------------- 1 | module CommentChecking 2 | class LinkCountChecker 3 | def self.check(comment, ip:, user_agent:, referrer:) 4 | links = comment.external_links 5 | 6 | return CommentChecking::Result.not_spam if links.count < 5 7 | 8 | CommentChecking::Result.new(true, text: "Post contains #{links.count} off-site links.") 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/services/comment_checking/result.rb: -------------------------------------------------------------------------------- 1 | module CommentChecking 2 | class Result 3 | attr_accessor :spam, :text, :reports 4 | 5 | def initialize(spam, text: nil, reports: []) 6 | @spam = spam 7 | @text = text 8 | @reports = reports 9 | end 10 | 11 | def spam? 12 | @spam 13 | end 14 | 15 | def self.not_spam 16 | new(false) 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/services/ping_request_checking/locale.rb: -------------------------------------------------------------------------------- 1 | require 'user_agent_parser' 2 | 3 | module PingRequestChecking 4 | class Locale 5 | def self.check(request) 6 | request.params['locale'].nil? 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/services/ping_request_checking/session_install_key.rb: -------------------------------------------------------------------------------- 1 | require 'user_agent_parser' 2 | 3 | module PingRequestChecking 4 | class SessionInstallKey 5 | SESSION_KEY = :install_keys 6 | 7 | def self.check(request) 8 | request.session[SESSION_KEY]&.include?(request.params[:id].to_i) 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/services/ping_request_checking_service.rb: -------------------------------------------------------------------------------- 1 | class PingRequestCheckingService 2 | STRATEGIES = [ 3 | PingRequestChecking::Locale, 4 | PingRequestChecking::UserAgent, 5 | PingRequestChecking::Params, 6 | PingRequestChecking::SessionInstallKey, 7 | ].freeze 8 | 9 | def self.check(request) 10 | STRATEGIES.select { |s| s.check(request) }.map(&:to_s) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/views/admin/blocked_users/new.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_with(model: [:admin, @blocked_user]) do |f| %> 2 |
3 | <%= f.label :pattern %> 4 | <%= f.text_field :pattern, required: true %> 5 |
6 | 7 | <%= f.submit %> 8 | <% end %> 9 | -------------------------------------------------------------------------------- /app/views/admin/redirect_service_domains/new.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_with(model: [:admin, @redirect_service_domain]) do |f| %> 2 |
3 | <%= f.label :domain %> 4 | <%= f.text_field :domain, required: true %> 5 |
6 | 7 | <%= f.submit %> 8 | <% end %> 9 | -------------------------------------------------------------------------------- /app/views/admin/spammy_email_domains/new.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_with(model: [:admin, @spammy_email_domain]) do |f| %> 2 |
3 | <%= f.label :domain %> 4 | <%= f.text_field :domain, required: true %> 5 |
6 | 7 |
8 | <%= f.label :block_type %> 9 | <%= f.select :block_type, SpammyEmailDomain::BLOCK_TYPE_DESCRIPTIONS.invert.to_a %> 10 |
11 | 12 | <%= f.submit %> 13 | <% end %> 14 | -------------------------------------------------------------------------------- /app/views/conversation_mailer/new_message.html.erb: -------------------------------------------------------------------------------- 1 |

<%= it('mailers.new_message.intro', site_name: @site_name, user_link: user_url(@message.poster, locale: @locale), user_name: @message.poster.name) %>

2 | 3 |
4 | 5 | <%= format_user_text(@message.content, @message.content_markup) %> 6 | 7 |
8 | 9 |

<%= it('mailers.new_message.outro', notification_preferences_link: @unsubscribe_url, conversation_link: @conversation_url) %>

10 | -------------------------------------------------------------------------------- /app/views/devise/sessions/omniauth_callback_no_email.html.erb: -------------------------------------------------------------------------------- 1 |

<%= t('users.sign_in_email_missing', provider: @provider, site_name: site_name) %>

2 | -------------------------------------------------------------------------------- /app/views/devise/sessions/omniauth_callback_same_name.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_with(url: "/auth/#{@provider}", method: :post) do |f| %> 2 | 3 |

4 | <%= t('users.sign_in_name_used', name: @name) %> 5 |

6 | 7 |

8 | 9 |

10 | <% end %> 11 | -------------------------------------------------------------------------------- /app/views/discussions/_subscribe.html.erb: -------------------------------------------------------------------------------- 1 | <%# locals: (subscribe:) %> 2 | 3 |
4 | <%# Need to disambiguate between unchecked (unsubscribe) and the case where we don't show this at all (do nothing). %> 5 | <%= hidden_field_tag :subscribe, '0', id: nil %> 6 | <%= check_box_tag :subscribe, '1', subscribe %> 7 | <%= label_tag :subscribe, t('discussions.notify'), class: 'radio-label' %> 8 |
9 | -------------------------------------------------------------------------------- /app/views/discussions/post_blocked.html.erb: -------------------------------------------------------------------------------- 1 |

2 | <%= t('discussions.blocked_pending_review') %> 3 |

4 | -------------------------------------------------------------------------------- /app/views/forum_mailer/comment_on_mentioned.html.erb: -------------------------------------------------------------------------------- 1 |

<%= it('mailers.comment_mentioned.intro', site_name: @site_name, **localization_params_for_comment(@comment, @locale)) %>

2 | 3 |
4 | 5 | <%= format_user_text(@comment.text, @comment.text_markup) %> 6 | 7 |
8 | 9 |

<%= it('mailers.comment_mentioned.outro', notification_preferences_link: @unsubscribe_url, **localization_params_for_comment(@comment, @locale)) %>

10 | -------------------------------------------------------------------------------- /app/views/forum_mailer/comment_on_subscribed.html.erb: -------------------------------------------------------------------------------- 1 |

<%= it('mailers.subscribed_discussion.intro', site_name: @site_name, **localization_params_for_comment(@comment, @locale)) %>

2 | 3 |
4 | 5 | <%= format_user_text(@comment.text, @comment.text_markup) %> 6 | 7 |
8 | 9 |

<%= it('mailers.subscribed_discussion.outro', notification_preferences_link: @unsubscribe_url, **localization_params_for_comment(@comment, @locale)) %>

10 | -------------------------------------------------------------------------------- /app/views/help/cdns.html.erb: -------------------------------------------------------------------------------- 1 | <% title t('help.cdns.title') %> 2 | 3 | <%= it('help.cdns.content_html', allowed_require_list: controller.render_to_string(partial: 'allowed_require_list'), site_name: site_name, cdnjs_link: 'https://cdnjs.com/', jsdelivr_link: 'https://www.jsdelivr.com/', external_code_link: help_external_scripts_path, github_link: 'https://github.com/greasyfork-org/greasyfork') %> 4 | -------------------------------------------------------------------------------- /app/views/help/contact.html.erb: -------------------------------------------------------------------------------- 1 | <%- title t('help.contact.title') %> 2 | <%- description "How to contact someone about #{site_name}." %> 3 | 4 | <%= it('help.contact.content_html', site_name: site_name, forum_link: discussions_path, github_link: 'https://github.com/greasyfork-org/greasyfork', admin_email_link: 'mailto:jason.barnabe@gmail.com') %> 5 | -------------------------------------------------------------------------------- /app/views/help/installing_user_scripts.html.erb: -------------------------------------------------------------------------------- 1 | <%- title t('help.installing_user_scripts.title') %> 2 | <%- description 'Describes how to install user scripts from Greasy Fork.' %> 3 | 4 | <%= render partial: 'installing' %> 5 | -------------------------------------------------------------------------------- /app/views/help/privacy.html.erb: -------------------------------------------------------------------------------- 1 | <%- title t('help.privacy_policy.title') %> 2 | 3 | <%= it('help.privacy_policy.content_html', admin_email_link: 'mailto:jason.barnabe@gmail.com', site_name: site_name) %> 4 | -------------------------------------------------------------------------------- /app/views/help/rewriting.html.erb: -------------------------------------------------------------------------------- 1 | <%- title t('help.script_rewriting.title', site_name: site_name) %> 2 | <%- description "A list of ways #{site_name} will rewrite scripts." %> 3 | 4 | <%= t('help.script_rewriting.content_html', site_name: site_name) %> 5 | -------------------------------------------------------------------------------- /app/views/help/user_js_conversions.html.erb: -------------------------------------------------------------------------------- 1 | <%- title t('help.user_css_to_user_js.title') %> 2 | <%- description "Describes how #{site_name} converts user CSS to user JS." %> 3 | 4 |

<%= t('help.user_css_to_user_js.title') %>

5 | 6 | <%= t('help.user_css_to_user_js.content_html', site_name: site_name) %> 7 | -------------------------------------------------------------------------------- /app/views/home/error.html.erb: -------------------------------------------------------------------------------- 1 | <% if @ad_method&.ea? %> 2 |
3 | <% end %> 4 | 5 |

<%= @text %>

6 | -------------------------------------------------------------------------------- /app/views/home/relative_date_test.html.erb: -------------------------------------------------------------------------------- 1 | <% (0..48).each do |h| %> 2 | <%= h %> hours ago - 3 | <% time = h.hours.ago %> 4 | <%= time %> - 5 | relative time: <%= tag.relative_time(datetime: time.to_datetime.rfc3339, prefix: '') { I18n.l(time.to_date) } %> 6 |
7 | <% end %> -------------------------------------------------------------------------------- /app/views/home/routing_error.html.erb: -------------------------------------------------------------------------------- 1 | <%- title t('common.not_found_title') %> 2 | 3 | <% if @ad_method&.ea? %> 4 |
5 | <% end %> 6 | 7 |

<%= t('common.not_found_text') %>

8 | 9 |

<%= link_to(t('common.not_found_link_home'), root_path) %>

10 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :content do %> 2 |
3 | <%= yield %> 4 |
5 | <% end %> 6 | <%= render template: 'layouts/base' %> 7 | -------------------------------------------------------------------------------- /app/views/layouts/discussions.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :content do %> 2 | <%= yield %> 3 | <% end %> 4 | <%= render template: 'layouts/base' %> 5 | -------------------------------------------------------------------------------- /app/views/layouts/list.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :content do %> 2 | <%= yield %> 3 | <% end %> 4 | <%= render template: 'layouts/base' %> 5 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= yield %> 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/views/reports/show.html.erb: -------------------------------------------------------------------------------- 1 | <%= render @report %> 2 | -------------------------------------------------------------------------------- /app/views/script_lock_appeals/index.html.erb: -------------------------------------------------------------------------------- 1 | <%= render @script_lock_appeals %> 2 | -------------------------------------------------------------------------------- /app/views/script_lock_appeals/show.html.erb: -------------------------------------------------------------------------------- 1 | <%= render partial: 'script_lock_appeal', locals: { script_lock_appeal: @script_lock_appeal } %> 2 | -------------------------------------------------------------------------------- /app/views/script_sets/edit.html.erb: -------------------------------------------------------------------------------- 1 | <%= render 'form' %> 2 | 3 | <%= form_tag([@set.user, @set], method: :DELETE, data: { turbo: true, turbo_confirm: t('script_sets.delete_confirmation') }) do %> 4 |

5 | 6 |

7 | <% end %> 8 | -------------------------------------------------------------------------------- /app/views/script_sets/new.html.erb: -------------------------------------------------------------------------------- 1 | <%= render 'form' %> 2 | -------------------------------------------------------------------------------- /app/views/script_versions/delayed.html.erb: -------------------------------------------------------------------------------- 1 |

2 | <%= t('scripts.delayed') %> 3 |

4 | -------------------------------------------------------------------------------- /app/views/script_versions/disposable_email.html.erb: -------------------------------------------------------------------------------- 1 |

2 | <%= t('scripts.no_disposable_email') %> 3 |

4 | -------------------------------------------------------------------------------- /app/views/script_versions/must_confirm.html.erb: -------------------------------------------------------------------------------- 1 |

2 | <%= t('scripts.must_confirm') %> 3 |

4 | 5 | <%= render partial: 'users/add_external_sign_in', locals: { return_to: request.path } %> 6 | 7 | <%= form_tag(controller: 'users', action: 'send_confirmation_email', method: :post) do %> 8 |

9 | 10 |

11 | <% end %> 12 | 13 | -------------------------------------------------------------------------------- /app/views/script_versions/new.html.erb: -------------------------------------------------------------------------------- 1 | <% 2 | if @script.nil? || @script.new_record? 3 | if @script.css? 4 | title t('scripts.new_title.css') 5 | else 6 | title t('scripts.new_title.js') 7 | end 8 | else 9 | title t('scripts.update_title', script: @script.name) 10 | end 11 | %> 12 | 13 | <%= render partial: 'script_versions/form', locals: {script_version: @script_version} %> 14 | -------------------------------------------------------------------------------- /app/views/script_versions/new_script_notice.html.erb: -------------------------------------------------------------------------------- 1 |

<%= t('scripts.new_script_notice.title') %>

2 | 3 |

4 | <%= link_to t('scripts.new_script_notice.install_link_html'), help_installing_user_scripts_path %> 5 |

6 | 7 |

8 | <%= link_to t('scripts.new_script_notice.share_link_html'), script_version_confirm_new_author_path(language: params[:language]) %> 9 |

10 | -------------------------------------------------------------------------------- /app/views/script_versions/rate_limited.html.erb: -------------------------------------------------------------------------------- 1 |

2 | <%= t('scripts.rate_limited') %> 3 |

4 | -------------------------------------------------------------------------------- /app/views/scripts/_ratings.html.erb: -------------------------------------------------------------------------------- 1 | <%# locals: (script:) %> 2 | 3 | <%= script.good_ratings %> 4 | <%= script.ok_ratings %> 5 | <%= script.bad_ratings %> 6 | -------------------------------------------------------------------------------- /app/views/shared/_errors.html.erb: -------------------------------------------------------------------------------- 1 | <%# locals: (resource:) %> 2 | 3 | <% unless resource.errors.empty? %> 4 |
5 |

6 | <%= t('common.error_preamble') %> 7 |

8 | <% resource.errors.full_messages.each do |msg| %> 9 |

<%= msg %>

10 | <% end %> 11 |
12 | <% end %> 13 | -------------------------------------------------------------------------------- /app/views/shared/_locale_override_field.html.erb: -------------------------------------------------------------------------------- 1 | <%# locals: () %> 2 | 3 | <% if overriding_locale? %><% end %> -------------------------------------------------------------------------------- /app/views/users/_user.html.erb: -------------------------------------------------------------------------------- 1 | <%# locals: (user:, script_counts:) %> 2 | 3 |
  • 4 | <%= t('users.list_display_html', user_link: render_user(user, user.id, force_author: script_counts[user.id].present?), count: script_counts[user.id] || 0) %> 5 |
  • 6 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/dev: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | exec "./bin/rails", "server", *ARGV 3 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative "../config/boot" 3 | require "rake" 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /bin/rubocop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require "rubygems" 3 | require "bundler/setup" 4 | 5 | # explicit rubocop config increases performance slightly while avoiding config confusion. 6 | ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__)) 7 | 8 | load Gem.bin_path("rubocop", "rubocop") 9 | -------------------------------------------------------------------------------- /bin/tx_pull: -------------------------------------------------------------------------------- 1 | ../tx pull -a --minimum-perc=1 --use-git-timestamps 2 | sed -i '1!b;s/_/-/' config/locales/*-*.yml 3 | git status -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | Rails.application.load_server 7 | -------------------------------------------------------------------------------- /config/.gitignore: -------------------------------------------------------------------------------- 1 | database.yml 2 | puma.rb -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | require 'bootsnap/setup' # Speed up boot time by caching expensive operations. 5 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: test 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: greasyfork_production 11 | -------------------------------------------------------------------------------- /config/deploy/production.rb: -------------------------------------------------------------------------------- 1 | server 'sisko', user: 'deploy', roles: %w[app db web] 2 | server 'janeway', user: 'deploy', roles: %w[app web] 3 | server 'archer', user: 'deploy', roles: %w[app web] 4 | server 'riker', user: 'deploy', roles: %w[worker] 5 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/initializers/active_record.rb: -------------------------------------------------------------------------------- 1 | Greasyfork::Application.config.active_record.yaml_column_permitted_classes = [Symbol, ActiveSupport::TimeWithZone, Time, ActiveSupport::TimeZone] 2 | -------------------------------------------------------------------------------- /config/initializers/akismet.rb: -------------------------------------------------------------------------------- 1 | if Rails.application.credentials.akismet 2 | Akismet.api_key = Rails.application.credentials.akismet[:api_key] 3 | Akismet.app_url = Rails.application.credentials.akismet[:app_url] 4 | end 5 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ActiveSupport::Reloader.to_prepare do 4 | # ApplicationController.renderer.defaults.merge!( 5 | # http_host: 'example.org', 6 | # https: false 7 | # ) 8 | # end 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /config/initializers/elasticsearch.rb: -------------------------------------------------------------------------------- 1 | ENV['ELASTICSEARCH_URL'] = Rails.application.credentials.elasticsearch_url 2 | -------------------------------------------------------------------------------- /config/initializers/enable_yjit.rb: -------------------------------------------------------------------------------- 1 | # Automatically enable YJIT as of Ruby 3.3, as it brings very 2 | # sizeable performance improvements. 3 | 4 | # If you are deploying to a memory constrained environment 5 | # you may want to delete this file, but otherwise it's free 6 | # performance. 7 | if defined? RubyVM::YJIT.enable 8 | Rails.application.config.after_initialize do 9 | RubyVM::YJIT.enable 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /config/initializers/form_builder.rb: -------------------------------------------------------------------------------- 1 | module FormName 2 | def name_for(object_name, _options = {}) 3 | hidden_field(object_name).match(/name="(.+?)"/)[1] 4 | end 5 | end 6 | 7 | ActionView::Helpers::FormBuilder.include FormName 8 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | 6 | Mime::Type.register 'application/javascript', :jsonp 7 | Mime::Type.register 'text/x-userscript-meta', :user_script_meta 8 | -------------------------------------------------------------------------------- /config/initializers/queues.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.active_storage.queues.analysis = :active_storage_analysis 2 | Rails.application.config.active_storage.queues.purge = :active_storage_purge 3 | Rails.application.config.action_mailer.deliver_later_queue_name = :mailers 4 | -------------------------------------------------------------------------------- /config/initializers/readonly.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.read_only_mode = false 2 | -------------------------------------------------------------------------------- /config/initializers/recaptcha.rb: -------------------------------------------------------------------------------- 1 | Recaptcha.configure do |config| 2 | config.site_key = Rails.application.credentials.recaptcha_site_key 3 | config.secret_key = Rails.application.credentials.recaptcha_secret_key 4 | end 5 | -------------------------------------------------------------------------------- /config/initializers/remote_forms.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.action_view.form_with_generates_remote_forms = false 2 | -------------------------------------------------------------------------------- /config/initializers/screenshots.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.screenshot_max_count = 5 2 | Rails.application.config.screenshot_max_size = 400.kilobytes 3 | -------------------------------------------------------------------------------- /config/initializers/script_page_cache.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.script_page_cache_directory = Rails.root.join('tmp/cached_pages') 2 | Rails.application.config.script_page_cache_expiry = 15.minutes 3 | Rails.application.config.cached_code_path = Rails.root.join('tmp/cached_code') 4 | -------------------------------------------------------------------------------- /config/initializers/searchkick.rb: -------------------------------------------------------------------------------- 1 | # Disable SSL verification 2 | if defined?(Searchkick) 3 | Searchkick.client_options = { 4 | transport_options: { 5 | ssl: { 6 | verify: false, 7 | }, 8 | }, 9 | } 10 | end 11 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Greasyfork::Application.config.session_store :cookie_store, key: '_greasyfork_session', secure: Rails.env.production? 4 | -------------------------------------------------------------------------------- /config/initializers/syntax_highlighting.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.syntax_highlighting_limit = 500.kilobytes 2 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | %w[ 2 | .ruby-version 3 | .rbenv-vars 4 | tmp/restart.txt 5 | tmp/caching-dev.txt 6 | ].each { |path| Spring.watch(path) } 7 | -------------------------------------------------------------------------------- /config/storage.yml: -------------------------------------------------------------------------------- 1 | aws: 2 | service: S3 3 | access_key_id: <%= Rails.application.credentials.aws&.[](:access_key_id) %> 4 | secret_access_key: <%= Rails.application.credentials.aws&.[](:secret_access_key) %> 5 | bucket: <%= Rails.application.credentials.aws&.[](:bucket) %> 6 | region: <%= Rails.application.credentials.aws&.[](:region) %> 7 | public: true 8 | 9 | test: 10 | service: Disk 11 | root: <%= Rails.root.join("tmp/storage") %> 12 | -------------------------------------------------------------------------------- /config/vite.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": { 3 | "sourceCodeDir": "app/javascript", 4 | "watchAdditionalPaths": [], 5 | "additionalEntrypoints": ["~/images/**/*"] 6 | }, 7 | "development": { 8 | "autoBuild": true, 9 | "publicOutputDir": "vite-dev", 10 | "port": 3036 11 | }, 12 | "test": { 13 | "autoBuild": true, 14 | "publicOutputDir": "vite-test", 15 | "port": 3037 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /config/webpack/development.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | 3 | module.exports = environment 4 | -------------------------------------------------------------------------------- /config/webpack/production.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/test.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /db/.gitignore: -------------------------------------------------------------------------------- 1 | test.sqlite3 2 | -------------------------------------------------------------------------------- /db/migrate/20140212200545_add_name_to_user.rb: -------------------------------------------------------------------------------- 1 | class AddNameToUser < ActiveRecord::Migration 2 | def change 3 | add_column :users, :name, :string, :limit => 50, :null => false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140213030915_script_userscripts_id.rb: -------------------------------------------------------------------------------- 1 | class ScriptUserscriptsId < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :userscripts_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140213154328_add_daily_install_count.rb: -------------------------------------------------------------------------------- 1 | class AddDailyInstallCount < ActiveRecord::Migration 2 | def change 3 | create_table :daily_install_counts do |t| 4 | t.integer :script_id, :null => false 5 | t.string :ip, :limit => 15, :null => false 6 | end 7 | add_index :daily_install_counts, [:script_id, :ip], :unique => true 8 | execute 'alter table daily_install_counts add column install_date timestamp not null default CURRENT_TIMESTAMP' 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20140223211028_add_url_to_allowed_requires.rb: -------------------------------------------------------------------------------- 1 | class AddUrlToAllowedRequires < ActiveRecord::Migration 2 | def change 3 | add_column :allowed_requires, :url, :string, :limit => 500 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140223211251_add_greasy_fork_libraries_to_allowed_requires.rb: -------------------------------------------------------------------------------- 1 | class AddGreasyForkLibrariesToAllowedRequires < ActiveRecord::Migration 2 | def change 3 | execute "INSERT INTO allowed_requires (pattern, name, url) VALUES ('^https:\\\\/\\\\/greasyfork\\\\.org\\\\/libraries\\\\/.*', 'Greasy-Fork-hosted libraries on https://greasyfork.org/libraries/', 'https://github.com/JasonBarnabe/greasyfork/tree/master/public/libraries')" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140224024436_add_user_profile.rb: -------------------------------------------------------------------------------- 1 | class AddUserProfile < ActiveRecord::Migration 2 | def change 3 | add_column :users, :profile, :string, :limit => 10000 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140224190926_add_markup_type.rb: -------------------------------------------------------------------------------- 1 | class AddMarkupType < ActiveRecord::Migration 2 | def change 3 | add_column :users, :profile_markup, :string, :limit => 10, :default => 'html', :null => false 4 | add_column :scripts, :additional_info_markup, :string, :limit => 10, :default => 'html', :null => false 5 | add_column :script_versions, :additional_info_markup, :string, :limit => 10, :default => 'html', :null => false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20140228202404_add_script_id_to_discussions.rb: -------------------------------------------------------------------------------- 1 | class AddScriptIdToDiscussions < ActiveRecord::Migration 2 | def change 3 | execute 'ALTER TABLE GDN_Discussion ADD COLUMN ScriptID int NULL' 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140303205828_add_code_updated_at.rb: -------------------------------------------------------------------------------- 1 | class AddCodeUpdatedAt < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :code_updated_at, :datetime, :null => false 4 | reversible do |dir| 5 | dir.up do 6 | execute <<-EOF 7 | update scripts set code_updated_at = updated_at 8 | EOF 9 | end 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20140403165132_add_delta_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddDeltaToScripts < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :delta, :boolean, :default => true, :null => false 4 | add_index :scripts, :delta 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140427181626_create_moderator_actions.rb: -------------------------------------------------------------------------------- 1 | class CreateModeratorActions < ActiveRecord::Migration 2 | def change 3 | create_table :moderator_actions do |t| 4 | t.datetime :created_at, :null => false 5 | t.belongs_to :script 6 | t.references :moderator, :null => false 7 | t.string :action, :length => 50, :null => false 8 | t.string :reason, :length => 500, :null => false 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20140427190525_add_moderator_deleted.rb: -------------------------------------------------------------------------------- 1 | class AddModeratorDeleted < ActiveRecord::Migration 2 | def change 3 | change_table :scripts do |t| 4 | t.boolean :moderator_deleted, :null => false, :default => false, :index => true 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20140516191703_add_pattern_to_script_applies_to.rb: -------------------------------------------------------------------------------- 1 | class AddPatternToScriptAppliesTo < ActiveRecord::Migration 2 | def change 3 | add_column :script_applies_tos, :pattern, :string, :limit => 1000, :null => false 4 | change_column :script_applies_tos, :display_text, :text, :limit => 500, :null => true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140517030310_add_license_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddLicenseToScripts < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :license_text, :string, :limit => 500 4 | add_column :scripts, :license_id, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140517030415_create_licenses.rb: -------------------------------------------------------------------------------- 1 | class CreateLicenses < ActiveRecord::Migration 2 | def change 3 | create_table :licenses do |t| 4 | t.string :name, :limit => 100, :null => false 5 | t.string :pattern, :limit => 1000, :null => false 6 | t.string :html, :limit => 1000, :null => false 7 | t.integer :priority, :null => false, :index => true 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20140603174709_add_banned_user.rb: -------------------------------------------------------------------------------- 1 | class AddBannedUser < ActiveRecord::Migration 2 | def change 3 | add_column :users, :banned, :boolean, :null => false, :default => false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140603181415_add_user_to_moderator_actions.rb: -------------------------------------------------------------------------------- 1 | class AddUserToModeratorActions < ActiveRecord::Migration 2 | def change 3 | add_column :moderator_actions, :user_id, :integer, :index => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140606195925_add_uses_disallowed_external.rb: -------------------------------------------------------------------------------- 1 | class AddUsesDisallowedExternal < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :uses_disallowed_external, :boolean, :null => false, :default => true, :index => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140607025106_refactor_script_applies_tos.rb: -------------------------------------------------------------------------------- 1 | class RefactorScriptAppliesTos < ActiveRecord::Migration 2 | def change 3 | change_table(:script_applies_tos) do |t| 4 | t.remove :pattern 5 | t.remove :display_text 6 | t.remove :created_at 7 | t.remove :updated_at 8 | t.text :text, :limit => 500, :null => false, :index => true 9 | t.boolean :domain, :null => false, :index => true 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20140607211930_add_webhook_secret_to_user.rb: -------------------------------------------------------------------------------- 1 | class AddWebhookSecretToUser < ActiveRecord::Migration 2 | def change 3 | change_table :users do |t| 4 | t.string :webhook_secret, :limit => 128 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20140609024421_insert_webhook_sync_type.rb: -------------------------------------------------------------------------------- 1 | class InsertWebhookSyncType < ActiveRecord::Migration 2 | def change 3 | reversible do |dir| 4 | dir.up do 5 | execute <<-EOF 6 | INSERT INTO script_sync_types (name, description) VALUES ('Webhook', 'Update when the file on GitHub is pushed to.') 7 | EOF 8 | end 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20140630020229_add_support_url_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddSupportUrlToScripts < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :support_url, :string, :limit => 500 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140714161558_add_locale_to_script_set_automatic_types.rb: -------------------------------------------------------------------------------- 1 | class AddLocaleToScriptSetAutomaticTypes < ActiveRecord::Migration 2 | def change 3 | reversible do |dir| 4 | dir.up do 5 | execute <<-EOF 6 | insert into script_set_automatic_types (name) 7 | values ('Scripts by language') 8 | EOF 9 | end 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20140730161636_add_favorites_flag.rb: -------------------------------------------------------------------------------- 1 | class AddFavoritesFlag < ActiveRecord::Migration 2 | def change 3 | add_column :script_sets, :favorite, :boolean, :null => false, :default => false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140730210516_add_fan_score.rb: -------------------------------------------------------------------------------- 1 | class AddFanScore < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :fan_score, :integer, :null => false, :default => 0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140804220508_add_namespace.rb: -------------------------------------------------------------------------------- 1 | class AddNamespace < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :namespace, :string, :null => true, :limit => 500 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140806021501_add_delete_reason_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddDeleteReasonToScripts < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :delete_reason, :string, :length => 500, :null => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140812164821_add_contribution_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddContributionToScripts < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :contribution_url, :string, :length => 500, :null => true 4 | add_column :scripts, :contribution_amount, :string, :length => 50, :null => true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20140813034638_create_cpd_duplication.rb: -------------------------------------------------------------------------------- 1 | class CreateCpdDuplication < ActiveRecord::Migration 2 | def change 3 | create_table :cpd_duplications do |t| 4 | t.integer :lines, :null => false 5 | t.timestamps 6 | end 7 | create_table :cpd_duplication_scripts do |t| 8 | t.references :cpd_duplication, :null => false, :index => true 9 | t.references :script, :null => false, :index => true 10 | t.integer :line, :null => false 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20140902024802_create_locale_contributors.rb: -------------------------------------------------------------------------------- 1 | class CreateLocaleContributors < ActiveRecord::Migration 2 | def change 3 | create_table :locale_contributors do |t| 4 | t.belongs_to :locale, :null => false, :index => true 5 | t.string :transifex_user_name, :limit => 50, :null => false 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20140903045757_fix_flagging_table.rb: -------------------------------------------------------------------------------- 1 | class FixFlaggingTable < ActiveRecord::Migration 2 | def change 3 | execute <<-EOF 4 | ALTER TABLE GDN_Flag CHANGE ForeignUrl ForeignURL VARCHAR(150) 5 | EOF 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20140915144425_mark_ptbr_available.rb: -------------------------------------------------------------------------------- 1 | class MarkPtbrAvailable < ActiveRecord::Migration 2 | def change 3 | execute <<-EOF 4 | update locales set native_name = 'Português do Brasil', ui_available = true where code = 'pt-BR' 5 | EOF 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20140923191610_delete_blank_localized_attributes.rb: -------------------------------------------------------------------------------- 1 | class DeleteBlankLocalizedAttributes < ActiveRecord::Migration 2 | def change 3 | execute <<-EOF 4 | delete from localized_script_version_attributes where attribute_value = '' 5 | EOF 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20140929194450_add_remember_token_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddRememberTokenToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :remember_token, :string, :limit => 150, :index => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20140930020648_add_sync_url_to_localized_script_attributes.rb: -------------------------------------------------------------------------------- 1 | class AddSyncUrlToLocalizedScriptAttributes < ActiveRecord::Migration 2 | def change 3 | add_column :localized_script_attributes, :sync_identifier, :string, :limit => 255 4 | add_column :localized_script_attributes, :sync_source_id, :int 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20141009170654_create_syntax_highlighted_code.rb: -------------------------------------------------------------------------------- 1 | class CreateSyntaxHighlightedCode < ActiveRecord::Migration 2 | def change 3 | create_table :syntax_highlighted_codes do |t| 4 | t.references :script, :null => false, :index => true, :unique => true 5 | t.text :html, :limit => 10000000, :null => false 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20141010195747_add_locale_to_user.rb: -------------------------------------------------------------------------------- 1 | class AddLocaleToUser < ActiveRecord::Migration 2 | def change 3 | add_column :users, :locale_id, :int 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20141022153200_modify_fan_score.rb: -------------------------------------------------------------------------------- 1 | class ModifyFanScore < ActiveRecord::Migration 2 | def change 3 | change_column :scripts, :fan_score, :decimal, :precision => 3, :scale => 1 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20141023152338_update_bulgarian_ui_available.rb: -------------------------------------------------------------------------------- 1 | class UpdateBulgarianUiAvailable < ActiveRecord::Migration 2 | def change 3 | execute <<-EOF 4 | update locales set ui_available = true where code = 'bg' 5 | EOF 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20141027032358_add_percent_complete_to_locale.rb: -------------------------------------------------------------------------------- 1 | class AddPercentCompleteToLocale < ActiveRecord::Migration 2 | def change 3 | add_column :locales, :percent_complete, :int, :nil => false, :default => 0 4 | execute 'update locales set percent_complete = 100 where code = "en"' 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20141028182853_script_codes_to_compressed_format.rb: -------------------------------------------------------------------------------- 1 | class ScriptCodesToCompressedFormat < ActiveRecord::Migration 2 | def change 3 | execute <<-EOF 4 | ALTER TABLE script_codes ROW_FORMAT=COMPRESSED 5 | EOF 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20141029230333_add_show_ads_to_user.rb: -------------------------------------------------------------------------------- 1 | class AddShowAdsToUser < ActiveRecord::Migration 2 | def change 3 | add_column :users, :show_ads, :boolean, :null => false, :default => true 4 | execute 'update users join scripts on scripts.user_id = users.id set show_ads = false' 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20141104035027_add_it_and_frca.rb: -------------------------------------------------------------------------------- 1 | class AddItAndFrca < ActiveRecord::Migration 2 | def change 3 | execute <<-EOF 4 | update locales set ui_available = true where code in ('it', 'fr-CA') 5 | EOF 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20141105153539_vi_available.rb: -------------------------------------------------------------------------------- 1 | class ViAvailable < ActiveRecord::Migration 2 | def change 3 | execute <<-EOF 4 | update locales set ui_available = true where code in ('vi') 5 | EOF 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20141110212050_add_default_sort_to_script_sets.rb: -------------------------------------------------------------------------------- 1 | class AddDefaultSortToScriptSets < ActiveRecord::Migration 2 | def change 3 | add_column :script_sets, :default_sort, :string, :limit => 20 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20141111001158_add_up_down_rating_counts.rb: -------------------------------------------------------------------------------- 1 | class AddUpDownRatingCounts < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :good_ratings, :int, :nil => false, :default => 0 4 | add_column :scripts, :ok_ratings, :int, :nil => false, :default => 0 5 | add_column :scripts, :bad_ratings, :int, :nil => false, :default => 0 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20141124211518_tr_available.rb: -------------------------------------------------------------------------------- 1 | class TrAvailable < ActiveRecord::Migration 2 | def change 3 | execute <<-EOF 4 | update locales set ui_available = true where code in ('tr') 5 | EOF 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20141130174613_add_arabic_ukrainian.rb: -------------------------------------------------------------------------------- 1 | class AddArabicUkrainian < ActiveRecord::Migration 2 | def change 3 | execute <<-EOF 4 | update locales set ui_available = true where code in ('ar', 'uk') 5 | EOF 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20141212034724_add_czech.rb: -------------------------------------------------------------------------------- 1 | class AddCzech < ActiveRecord::Migration 2 | def change 3 | execute <<-EOF 4 | update locales set ui_available = true where code in ('cs') 5 | EOF 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20141228021319_add_markup_preference.rb: -------------------------------------------------------------------------------- 1 | class AddMarkupPreference < ActiveRecord::Migration 2 | def change 3 | add_column :users, :preferred_markup, :string, :limit => 10, :default => 'html', :null => false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20141229190455_add_index_on_script_type.rb: -------------------------------------------------------------------------------- 1 | class AddIndexOnScriptType < ActiveRecord::Migration 2 | def change 3 | add_index :scripts, :script_type_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20141231195332_add_greek.rb: -------------------------------------------------------------------------------- 1 | class AddGreek < ActiveRecord::Migration 2 | def change 3 | execute <<-EOF 4 | update locales set ui_available = true where code in ('el') 5 | EOF 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20141231212718_add_script_attachments.rb: -------------------------------------------------------------------------------- 1 | class AddScriptAttachments < ActiveRecord::Migration 2 | def change 3 | create_table :screenshots 4 | add_attachment :screenshots, :screenshot 5 | create_table :screenshots_script_versions do |t| 6 | t.belongs_to :screenshot, :nil => false, :index => true 7 | t.belongs_to :script_version, :nil => false, :index => true 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20150119041433_add_ad_code_to_script.rb: -------------------------------------------------------------------------------- 1 | class AddAdCodeToScript < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :ad_method, :string, :limit => 2 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150127001642_add_replaced_by_script_id.rb: -------------------------------------------------------------------------------- 1 | class AddReplacedByScriptId < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :replaced_by_script_id, :int 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150131052722_add_caption_to_screenshots.rb: -------------------------------------------------------------------------------- 1 | class AddCaptionToScreenshots < ActiveRecord::Migration 2 | def change 3 | add_column :screenshots, :caption, :string, :limit => 500 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150221013413_add_flattr_username.rb: -------------------------------------------------------------------------------- 1 | class AddFlattrUsername < ActiveRecord::Migration 2 | def change 3 | add_column :users, :flattr_username, :string, :limit => 50 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150307234007_add_bokmal_suomi.rb: -------------------------------------------------------------------------------- 1 | class AddBokmalSuomi < ActiveRecord::Migration 2 | def change 3 | execute <<-EOF 4 | update locales set ui_available = true where code in ('fi', 'nb') 5 | EOF 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20150422175935_add_script_version_f_ks.rb: -------------------------------------------------------------------------------- 1 | class AddScriptVersionFKs < ActiveRecord::Migration 2 | def change 3 | add_foreign_key :localized_script_version_attributes, :script_versions, on_delete: :cascade 4 | add_foreign_key :screenshots_script_versions, :script_versions, on_delete: :cascade 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20150506143413_add_safari_as_browser.rb: -------------------------------------------------------------------------------- 1 | class AddSafariAsBrowser < ActiveRecord::Migration 2 | def change 3 | reversible do |dir| 4 | dir.up do 5 | execute <<-EOF 6 | insert into browsers (code, name) values ('safari', 'Safari'); 7 | EOF 8 | end 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20150517190053_add_redistribute_opt_in.rb: -------------------------------------------------------------------------------- 1 | class AddRedistributeOptIn < ActiveRecord::Migration 2 | def change 3 | add_column :users, :approve_redistribution, :boolean, index: true 4 | add_column :scripts, :approve_redistribution, :boolean, index: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20150518042510_add_tld_flag_to_script_applies_tos.rb: -------------------------------------------------------------------------------- 1 | class AddTldFlagToScriptAppliesTos < ActiveRecord::Migration 2 | def change 3 | add_column :script_applies_tos, :tld_extra, :boolean, null: false, default: false, index: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150609015435_add_sv_ro_locales.rb: -------------------------------------------------------------------------------- 1 | class AddSvRoLocales < ActiveRecord::Migration 2 | def change 3 | execute <<-EOF 4 | update locales set ui_available = true where code in ('ro', 'sv') 5 | EOF 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20150729023212_add_sensitive_sites.rb: -------------------------------------------------------------------------------- 1 | class AddSensitiveSites < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :sensitive, :boolean, null: false, default: false 4 | create_table :sensitive_sites do |t| 5 | t.string :domain, limit: 150, null: false 6 | end 7 | add_index :sensitive_sites, :domain, unique: true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20150805015952_add_sensitive_flag_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddSensitiveFlagToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :show_sensitive, :boolean, null: false, default: true, index: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150810231014_add_report_not_sensitive.rb: -------------------------------------------------------------------------------- 1 | class AddReportNotSensitive < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :not_adult_content_self_report_date, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150906031141_add_permanent_deletion_request_date.rb: -------------------------------------------------------------------------------- 1 | class AddPermanentDeletionRequestDate < ActiveRecord::Migration 2 | def change 3 | add_column :scripts, :permanent_deletion_request_date, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150910005124_make_show_sensitive_false_by_default.rb: -------------------------------------------------------------------------------- 1 | class MakeShowSensitiveFalseByDefault < ActiveRecord::Migration 2 | def change 3 | change_column :users, :show_sensitive, :boolean, null: :false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150929023046_drop_assessments.rb: -------------------------------------------------------------------------------- 1 | class DropAssessments < ActiveRecord::Migration 2 | def up 3 | drop_table :assessments 4 | drop_table :assessment_reasons 5 | execute 'update scripts set script_delete_type_id = 1, locked = true where uses_disallowed_external;' 6 | remove_column :scripts, :uses_disallowed_external 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20161106004629_longer_sync_identifer.rb: -------------------------------------------------------------------------------- 1 | class LongerSyncIdentifer < ActiveRecord::Migration[5.0] 2 | def change 3 | change_column :scripts, :sync_identifier, :string, limit: 500 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20161218203329_longer_sync_error.rb: -------------------------------------------------------------------------------- 1 | class LongerSyncError < ActiveRecord::Migration[5.0] 2 | def change 3 | change_column :scripts, :sync_error, :string, limit: 1000 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170109030916_add_deletion_confirm_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddDeletionConfirmToUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | change_table :users do |t| 4 | t.column :delete_confirmation_key, :string, length: 32 5 | t.column :delete_confirmation_expiry, :datetime 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20170109233217_add_fks_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddFksToUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | remove_foreign_key :scripts, :users 4 | add_foreign_key :scripts, :users, on_delete: :cascade 5 | add_foreign_key :identities, :users, on_delete: :cascade 6 | add_foreign_key :script_sets, :users, on_delete: :cascade 7 | add_foreign_key :roles_users, :users, on_delete: :cascade 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20170317235450_thai_locale.rb: -------------------------------------------------------------------------------- 1 | class ThaiLocale < ActiveRecord::Migration[5.0] 2 | def change 3 | Locale.where(code: 'th').update_all(ui_available: true) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20171209214548_recreate_licenses.rb: -------------------------------------------------------------------------------- 1 | class RecreateLicenses < ActiveRecord::Migration[5.1] 2 | def change 3 | execute 'update scripts set license_id = null' 4 | drop_table :licenses 5 | create_table :licenses do |t| 6 | t.string :code, limit: 100, null: false, unique: true 7 | t.string :name, limit: 250, null: false 8 | t.string :url, limit: 250 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20171223173317_add_markup_to_changelog.rb: -------------------------------------------------------------------------------- 1 | class AddMarkupToChangelog < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :script_versions, :changelog_markup, :string, limit: 10, null: false, default: 'text', after: 'changelog' 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180203220802_add_script_promoted.rb: -------------------------------------------------------------------------------- 1 | class AddScriptPromoted < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :scripts, :promoted, :boolean, null: false, default: false, index: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180222031153_add_promoted_script.rb: -------------------------------------------------------------------------------- 1 | class AddPromotedScript < ActiveRecord::Migration[5.1] 2 | def change 3 | add_column :scripts, :promoted_script_id, :int 4 | add_foreign_key :scripts, :scripts, column: :promoted_script_id, on_delete: :nullify 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20180506054543_add_index_to_promoted.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToPromoted < ActiveRecord::Migration[5.1] 2 | def change 3 | add_index :scripts, :promoted 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180506151937_create_disallowed_attributes.rb: -------------------------------------------------------------------------------- 1 | class CreateDisallowedAttributes < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :disallowed_attributes do |t| 4 | t.string :attribute_name, null: false, limit: 50 5 | t.string :pattern, null: false 6 | t.string :reason, null: false 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20180531002815_create_spammy_email_domains.rb: -------------------------------------------------------------------------------- 1 | class CreateSpammyEmailDomains < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :spammy_email_domains do |t| 4 | t.string :domain, null: false, limit: 20, index: true 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20180603023711_add_index_to_discussion_script_id.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToDiscussionScriptId < ActiveRecord::Migration[5.2] 2 | def change 3 | add_index :GDN_Discussion, :ScriptID 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20181110222109_reported_script_f_ks.rb: -------------------------------------------------------------------------------- 1 | class ReportedScriptFKs < ActiveRecord::Migration[5.2] 2 | def change 3 | change_column :script_reports, :script_id, :integer, null: false 4 | change_column :script_reports, :reference_script_id, :integer, null: false 5 | add_foreign_key :script_reports, :scripts, on_delete: :cascade 6 | add_foreign_key :script_reports, :scripts, column: :reference_script_id, on_delete: :cascade 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20190131022248_script_user_id_not_required.rb: -------------------------------------------------------------------------------- 1 | class ScriptUserIdNotRequired < ActiveRecord::Migration[5.2] 2 | def change 3 | change_column_null :scripts, :user_id, true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190302205639_add_adsense_approved_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddAdsenseApprovedToScripts < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :scripts, :adsense_approved, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190302205715_fill_adsense_approved.rb: -------------------------------------------------------------------------------- 1 | class FillAdsenseApproved < ActiveRecord::Migration[5.2] 2 | def up 3 | execute 'update scripts set adsense_approved = true where ad_method = "ga"' 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190303012524_add_page_views_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddPageViewsToScripts < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :scripts, :page_views, :integer, null: false, default: 0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190316005137_add_complete_block_to_spammy_domains.rb: -------------------------------------------------------------------------------- 1 | class AddCompleteBlockToSpammyDomains < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :spammy_email_domains, :complete_block, :boolean, null: false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190317022326_add_originating_script_to_disallowed_codes.rb: -------------------------------------------------------------------------------- 1 | class AddOriginatingScriptToDisallowedCodes < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :disallowed_codes, :originating_script_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190323211921_reconfirmable.rb: -------------------------------------------------------------------------------- 1 | class Reconfirmable < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :users, :unconfirmed_email, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190331213941_add_disposable_email_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddDisposableEmailToUsers < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :users, :disposable_email, :boolean 4 | execute 'update users set disposable_email = false' 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20190519231037_add_object_type_to_disallowed_attributes.rb: -------------------------------------------------------------------------------- 1 | class AddObjectTypeToDisallowedAttributes < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :disallowed_attributes, :object_type, :string 4 | DisallowedAttribute.update_all(object_type: 'script') 5 | change_column_null :disallowed_attributes, :object_type, false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20190520005220_add_slow_ban_to_disallowed_codes.rb: -------------------------------------------------------------------------------- 1 | class AddSlowBanToDisallowedCodes < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :disallowed_codes, :slow_ban, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190706015520_add_type_to_script_reports.rb: -------------------------------------------------------------------------------- 1 | class AddTypeToScriptReports < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :script_reports, :report_type, :string, limit: 20 4 | execute 'update script_reports set report_type = "unauthorized_code" where report_type is null' 5 | change_column_null :script_reports, :report_type, false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20190706020932_script_report_reference_script_optional.rb: -------------------------------------------------------------------------------- 1 | class ScriptReportReferenceScriptOptional < ActiveRecord::Migration[5.2] 2 | def change 3 | change_column_null :script_reports, :reference_script_id, true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190706021911_script_report_additional_info_optional.rb: -------------------------------------------------------------------------------- 1 | class ScriptReportAdditionalInfoOptional < ActiveRecord::Migration[5.2] 2 | def change 3 | change_column_null :script_reports, :additional_info, true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190706022139_rename_script_report_copy_details.rb: -------------------------------------------------------------------------------- 1 | class RenameScriptReportCopyDetails < ActiveRecord::Migration[5.2] 2 | def change 3 | rename_column :script_reports, :copy_details, :details 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20190714021359_add_reporter_to_script_report.rb: -------------------------------------------------------------------------------- 1 | class AddReporterToScriptReport < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :script_reports, :reporter_id, :integer 4 | add_foreign_key :script_reports, :users, column: :reporter_id, on_delete: :nullify 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20190714234716_add_blocked_to_site_applications.rb: -------------------------------------------------------------------------------- 1 | class AddBlockedToSiteApplications < ActiveRecord::Migration[5.2] 2 | def change 3 | change_table :site_applications do |t| 4 | t.boolean :blocked, null: false, default: false 5 | t.string :blocked_message 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20190902205455_remove_ignored_script_columns.rb: -------------------------------------------------------------------------------- 1 | class RemoveIgnoredScriptColumns < ActiveRecord::Migration[5.2] 2 | def change 3 | change_table :scripts do |t| 4 | t.remove :user_id 5 | t.remove :ad_method 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20190910235346_add_has_syntax_error_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddHasSyntaxErrorToScripts < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :scripts, :has_syntax_error, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20191002004430_esperanto_available.rb: -------------------------------------------------------------------------------- 1 | class EsperantoAvailable < ActiveRecord::Migration[5.2] 2 | def up 3 | Locale.find_by(code: 'eo').update(ui_available: true) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20191002005748_serbian_available.rb: -------------------------------------------------------------------------------- 1 | class SerbianAvailable < ActiveRecord::Migration[5.2] 2 | def change 3 | Locale.find_by(code: 'sr').update(ui_available: true) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20191013004547_add_language_to_script.rb: -------------------------------------------------------------------------------- 1 | class AddLanguageToScript < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :scripts, :language, :string, limit: 3, null: false, default: 'js' 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20191118031654_add_trusted_report_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddTrustedReportToUsers < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :users, :trusted_reports, :boolean, null: false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20191207032221_add_announcements_seen_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddAnnouncementsSeenToUsers < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :users, :announcements_seen, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20191220163134_add_css_convertible_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddCssConvertibleToScripts < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :scripts, :css_convertible_to_js, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20191225180112_add_canonical_email_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddCanonicalEmailToUsers < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :users, :canonical_email, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20191225180515_populate_user_canonical_email.rb: -------------------------------------------------------------------------------- 1 | class PopulateUserCanonicalEmail < ActiveRecord::Migration[5.2] 2 | def up 3 | User.select(:id, :email, :canonical_email).find_each do |u| 4 | u.update_column(:canonical_email, EmailAddress.canonical(u.email)) 5 | end unless Rails.env.production? 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20191226213624_drop_cpd_tables.rb: -------------------------------------------------------------------------------- 1 | class DropCpdTables < ActiveRecord::Migration[5.2] 2 | def change 3 | drop_table :cpd_duplications 4 | drop_table :cpd_duplication_scripts 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20191228011034_add_not_js_convertible_override.rb: -------------------------------------------------------------------------------- 1 | class AddNotJsConvertibleOverride < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :scripts, :not_js_convertible_override, :boolean, default: false, null: false 4 | add_column :script_versions, :not_js_convertible_override, :boolean, default: false, null: false 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20200101005408_create_blocked_script_urls.rb: -------------------------------------------------------------------------------- 1 | class CreateBlockedScriptUrls < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :blocked_script_urls do |t| 4 | t.string :url, null: false 5 | t.string :public_reason, null: false 6 | t.string :private_reason, null: false 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200101013842_add_private_reason_to_moderator_log.rb: -------------------------------------------------------------------------------- 1 | class AddPrivateReasonToModeratorLog < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :moderator_actions, :private_reason, :string, limit: 500 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200101030644_drpo_approve_redistribution.rb: -------------------------------------------------------------------------------- 1 | class DrpoApproveRedistribution < ActiveRecord::Migration[6.0] 2 | def change 3 | remove_column :scripts, :approve_redistribution 4 | remove_column :users, :approve_redistribution 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20200101203938_users_canonical_email_not_null.rb: -------------------------------------------------------------------------------- 1 | class UsersCanonicalEmailNotNull < ActiveRecord::Migration[6.0] 2 | def change 3 | change_column_null :users, :canonical_email, false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200103021449_create_blocked_script_codes.rb: -------------------------------------------------------------------------------- 1 | class CreateBlockedScriptCodes < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :blocked_script_codes do |t| 4 | t.string :pattern, null: false 5 | t.string :public_reason, null: false 6 | t.string :private_reason, null: false 7 | t.boolean :serious, null: false, default: false 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20200104202749_add_originating_script_id_to_blocked_script_codes.rb: -------------------------------------------------------------------------------- 1 | class AddOriginatingScriptIdToBlockedScriptCodes < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :blocked_script_codes, :originating_script_id, :integer 4 | add_foreign_key :blocked_script_codes, :scripts, column: :originating_script_id, on_delete: :cascade 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20200106011534_create_redirect_service_domains.rb: -------------------------------------------------------------------------------- 1 | class CreateRedirectServiceDomains < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :redirect_service_domains do |t| 4 | t.string :domain, limit: 50, null: false 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20200112155750_create_blocked_script_texts.rb: -------------------------------------------------------------------------------- 1 | class CreateBlockedScriptTexts < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :blocked_script_texts do |t| 4 | t.string :text, null: false 5 | t.string :public_reason, null: false 6 | t.string :private_reason, null: false 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200112162130_add_requires_review_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddRequiresReviewToScripts < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :scripts, :review_state, :string, null: false, default: 'not_required' 4 | add_index :scripts, :review_state 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20200122030130_index_users_name.rb: -------------------------------------------------------------------------------- 1 | class IndexUsersName < ActiveRecord::Migration[6.0] 2 | def change 3 | add_index :users, :name 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200216204021_add_moderator_note_to_script_reports.rb: -------------------------------------------------------------------------------- 1 | class AddModeratorNoteToScriptReports < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :script_reports, :moderator_note, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200308010644_add_hash_to_script_codes.rb: -------------------------------------------------------------------------------- 1 | class AddHashToScriptCodes < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :script_codes, :code_hash, :string, limit: 40 unless column_exists?(:script_codes, :code_hash) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200308024143_backfill_code_hash.rb: -------------------------------------------------------------------------------- 1 | class BackfillCodeHash < ActiveRecord::Migration[6.0] 2 | disable_ddl_transaction! 3 | 4 | def up 5 | ScriptCode.where(code_hash: nil).find_each { |sc| sc.code_hash = Digest::SHA1.hexdigest sc.code; sc.save } 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20200308042042_add_script_code_hash_index.rb: -------------------------------------------------------------------------------- 1 | class AddScriptCodeHashIndex < ActiveRecord::Migration[6.0] 2 | def change 3 | add_index :script_codes, :code_hash 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200308042133_script_code_hash_not_null.rb: -------------------------------------------------------------------------------- 1 | class ScriptCodeHashNotNull < ActiveRecord::Migration[6.0] 2 | def change 3 | change_column_null :script_codes, :code_hash, false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200310225042_add_indexes_to_script_version_code.rb: -------------------------------------------------------------------------------- 1 | class AddIndexesToScriptVersionCode < ActiveRecord::Migration[6.0] 2 | def change 3 | add_index :script_versions, :script_code_id 4 | add_index :script_versions, :rewritten_script_code_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20200314010547_add_index_to_user_canonical_email.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToUserCanonicalEmail < ActiveRecord::Migration[6.0] 2 | def change 3 | add_index :users, :canonical_email 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200315221243_add_deleted_at_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddDeletedAtToScripts < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :scripts, :deleted_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200315221318_script_deleted_at_backfill.rb: -------------------------------------------------------------------------------- 1 | class ScriptDeletedAtBackfill < ActiveRecord::Migration[6.0] 2 | def up 3 | execute 'update scripts set deleted_at = updated_at where script_delete_type_id IS NOT NULL' 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200316000339_drop_script_userscript_id.rb: -------------------------------------------------------------------------------- 1 | class DropScriptUserscriptId < ActiveRecord::Migration[6.0] 2 | def change 3 | remove_column :scripts, :userscripts_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200404022305_add_consecutive_bad_ratings_at_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddConsecutiveBadRatingsAtToScripts < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :scripts, :consecutive_bad_ratings_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200501203543_create_discussions.rb: -------------------------------------------------------------------------------- 1 | class CreateDiscussions < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :discussions do |t| 4 | t.timestamps 5 | t.integer :poster_id, null: false, index: true 6 | t.integer :script_id 7 | t.integer :rating 8 | end 9 | add_foreign_key :discussions, :scripts, on_delete: :cascade 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20200501204556_create_comments.rb: -------------------------------------------------------------------------------- 1 | class CreateComments < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :comments do |t| 4 | t.timestamps 5 | t.belongs_to :discussion, null: false 6 | t.integer :poster_id, null: false 7 | t.text :text, null: false 8 | t.string :text_markup, limit: 10, default: "html", null: false 9 | end 10 | add_foreign_key :comments, :discussions, on_delete: :cascade 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20200504010752_discussion_rating_not_null.rb: -------------------------------------------------------------------------------- 1 | class DiscussionRatingNotNull < ActiveRecord::Migration[6.0] 2 | def change 3 | change_column :discussions, :rating, :integer, null: false, default: 1 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200510183902_comment_edit_date.rb: -------------------------------------------------------------------------------- 1 | class CommentEditDate < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :comments, :edited_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200512022035_add_stats_to_discussions.rb: -------------------------------------------------------------------------------- 1 | class AddStatsToDiscussions < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :discussions, :stat_reply_count, :integer, default: 0, null: false 4 | add_column :discussions, :stat_last_reply_date, :datetime 5 | add_column :discussions, :stat_last_replier_id, :integer 6 | Discussion.all.each(&:update_stats!) 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20200514004501_add_index_to_last_reply_date.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToLastReplyDate < ActiveRecord::Migration[6.0] 2 | def change 3 | add_index :discussions, :stat_last_reply_date 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200601021359_add_use_new_discussions_to_script.rb: -------------------------------------------------------------------------------- 1 | class AddUseNewDiscussionsToScript < ActiveRecord::Migration[6.0] 2 | disable_ddl_transaction! 3 | 4 | def up 5 | add_column :scripts, :use_new_discussions, :boolean, default: false, null: false 6 | Script.find_each do |s| 7 | s.update_column(:use_new_discussions, s.discussions.none?) 8 | end 9 | change_column_default :scripts, :use_new_discussions, true 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20200604020122_add_first_comment_to_comments.rb: -------------------------------------------------------------------------------- 1 | class AddFirstCommentToComments < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :comments, :first_comment, :boolean, null: false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200606184728_add_migrated_from_to_discussions.rb: -------------------------------------------------------------------------------- 1 | class AddMigratedFromToDiscussions < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :discussions, :migrated_from, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200630024246_drop_script_use_new_discussions.rb: -------------------------------------------------------------------------------- 1 | class DropScriptUseNewDiscussions < ActiveRecord::Migration[6.0] 2 | def change 3 | remove_column :scripts, :use_new_discussions 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200630025057_create_discussion_category.rb: -------------------------------------------------------------------------------- 1 | class CreateDiscussionCategory < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :discussion_categories do |t| 4 | t.string :category_key, null: false, limit: 20 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20200630025140_populate_discussion_category.rb: -------------------------------------------------------------------------------- 1 | class PopulateDiscussionCategory < ActiveRecord::Migration[6.0] 2 | def up 3 | execute <<~SQL 4 | INSERT INTO discussion_categories (category_key) VALUES ('greasyfork'), ('development'), ('requests'), ('script-discussions') 5 | SQL 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20200630025619_add_discussion_category_to_discussions.rb: -------------------------------------------------------------------------------- 1 | class AddDiscussionCategoryToDiscussions < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :discussions, :discussion_category_id, :integer, index: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200630025650_backfill_discussion_category.rb: -------------------------------------------------------------------------------- 1 | class BackfillDiscussionCategory < ActiveRecord::Migration[6.0] 2 | def up 3 | script_discussion_category_id = Discussion.connection.select_value('select id from discussion_categories where category_key = "script-discussions"') 4 | execute "UPDATE discussions SET discussion_category_id = #{script_discussion_category_id}" 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20200630025853_discussion_category_not_null.rb: -------------------------------------------------------------------------------- 1 | class DiscussionCategoryNotNull < ActiveRecord::Migration[6.0] 2 | def change 3 | change_column_null :discussions, :discussion_category_id, false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200701171225_add_title_to_discussions.rb: -------------------------------------------------------------------------------- 1 | class AddTitleToDiscussions < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :discussions, :title, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200701175829_rating_nil.rb: -------------------------------------------------------------------------------- 1 | class RatingNil < ActiveRecord::Migration[6.0] 2 | def change 3 | change_column :discussions, :rating, :integer, null: true, default: nil 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200706015413_create_conversations.rb: -------------------------------------------------------------------------------- 1 | class CreateConversations < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :conversations do |t| 4 | t.timestamps 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20200706015815_create_conversation_users.rb: -------------------------------------------------------------------------------- 1 | class CreateConversationUsers < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :conversations_users do |t| 4 | t.bigint :conversation_id, null: false 5 | t.integer :user_id, null: false 6 | end 7 | add_foreign_key :conversations_users, :conversations, on_delete: :cascade 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200715013441_add_conversation_stats.rb: -------------------------------------------------------------------------------- 1 | class AddConversationStats < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :conversations, :stat_last_message_date, :datetime 4 | add_column :conversations, :stat_last_poster_id, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20200804032917_add_discussions_read_since_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddDiscussionsReadSinceToUsers < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :users, :discussions_read_since, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200806021345_add_more_notification_settings.rb: -------------------------------------------------------------------------------- 1 | class AddMoreNotificationSettings < ActiveRecord::Migration[6.0] 2 | def change 3 | change_table :users do |t| 4 | t.column :subscribe_on_discussion, :boolean, default: true, null: false 5 | t.column :subscribe_on_comment, :boolean, default: true, null: false 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20200812003620_add_deleted_at_to_comments.rb: -------------------------------------------------------------------------------- 1 | class AddDeletedAtToComments < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :comments, :deleted_at, :datetime 4 | add_column :comments, :deleted_by_user_id, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20200812232744_soft_delete_discussions.rb: -------------------------------------------------------------------------------- 1 | class SoftDeleteDiscussions < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :discussions, :deleted_at, :datetime 4 | add_column :discussions, :deleted_by_user_id, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20200814215855_add_akismet_results_to_discussions.rb: -------------------------------------------------------------------------------- 1 | class AddAkismetResultsToDiscussions < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :discussions, :akismet_spam, :boolean 4 | add_column :discussions, :akismet_blatant, :boolean 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20200815014922_conversation_subscription_backfill.rb: -------------------------------------------------------------------------------- 1 | class ConversationSubscriptionBackfill < ActiveRecord::Migration[6.0] 2 | def up 3 | execute <<~SQL 4 | INSERT INTO conversation_subscriptions (conversation_id, user_id, created_at, updated_at) 5 | (SELECT conversation_id, user_id, NOW(), NOW() from conversations_users WHERE conversation_id IS NOT NULL AND user_id IS NOT NULL) 6 | SQL 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20200815020841_add_conversation_notification_settings.rb: -------------------------------------------------------------------------------- 1 | class AddConversationNotificationSettings < ActiveRecord::Migration[6.0] 2 | def change 3 | change_table :users do |t| 4 | t.column :subscribe_on_conversation_starter, :boolean, default: true, null: false 5 | t.column :subscribe_on_conversation_receiver, :boolean, default: true, null: false 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20200818014737_add_review_reason_to_discussions.rb: -------------------------------------------------------------------------------- 1 | class AddReviewReasonToDiscussions < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :discussions, :review_reason, :string, limit: 10 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200818021213_akismet_reporter.rb: -------------------------------------------------------------------------------- 1 | class AkismetReporter < ActiveRecord::Migration[6.0] 2 | def change 3 | change_column_null :reports, :reporter_id, true 4 | add_column :reports, :auto_reporter, :string, limit: 10 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20200823013703_create_akismet_submissions.rb: -------------------------------------------------------------------------------- 1 | class CreateAkismetSubmissions < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :akismet_submissions do |t| 4 | t.belongs_to :item, polymorphic: true, null: false 5 | t.mediumtext :akismet_params, null: false 6 | t.boolean :result_spam, null: false 7 | t.boolean :result_blatant, null: false 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20200824013239_add_auto_reporter_to_script_reports.rb: -------------------------------------------------------------------------------- 1 | class AddAutoReporterToScriptReports < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :script_reports, :auto_reporter, :string, limit: 10 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200828200844_add_index_to_comments_poster_id.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToCommentsPosterId < ActiveRecord::Migration[6.0] 2 | def change 3 | add_index :comments, :poster_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200907200035_user_banned_at.rb: -------------------------------------------------------------------------------- 1 | class UserBannedAt < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :users, :banned_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200907200130_user_banned_at_backfill.rb: -------------------------------------------------------------------------------- 1 | class UserBannedAtBackfill < ActiveRecord::Migration[6.0] 2 | def up 3 | execute 'update users set banned_at = coalesce(updated_at, CURRENT_TIMESTAMP) where banned = 1' 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200910021353_add_email_domain_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddEmailDomainToUsers < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :users, :email_domain, :string, limit: 100, index: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200910021433_backfill_email_domain.rb: -------------------------------------------------------------------------------- 1 | class BackfillEmailDomain < ActiveRecord::Migration[6.0] 2 | def change 3 | User.where.not(email: nil).find_each do |user| 4 | user.email_domain = user.email.split('@').last 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20200912211814_add_index_to_email_domain_and_ip.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToEmailDomainAndIp < ActiveRecord::Migration[6.0] 2 | def change 3 | add_index :users, [:email_domain, :current_sign_in_ip, :banned_at] 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200918221428_add_session_token_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddSessionTokenToUsers < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :users, :session_token, :string, limit: 32 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200919012810_create_banned_email_hashes.rb: -------------------------------------------------------------------------------- 1 | class CreateBannedEmailHashes < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :banned_email_hashes do |t| 4 | t.string :email_hash, null: false, length: 40 5 | t.datetime :deleted_at, null: false 6 | t.datetime :banned_at 7 | end 8 | add_index :banned_email_hashes, :email_hash, unique: true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20201019005046_add_filter_locale_default_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddFilterLocaleDefaultToUsers < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :users, :filter_locale_default, :boolean, default: true, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20201021010617_add_result_to_blocked_script_texts.rb: -------------------------------------------------------------------------------- 1 | class AddResultToBlockedScriptTexts < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :blocked_script_texts, :result, :string, limit: 10 4 | execute 'UPDATE blocked_script_texts SET result = "review" WHERE result IS NULL' 5 | change_column_null :blocked_script_texts, :result, false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20201026004235_add_unique_index_user_name.rb: -------------------------------------------------------------------------------- 1 | class AddUniqueIndexUserName < ActiveRecord::Migration[6.0] 2 | def change 3 | remove_index :users, :name 4 | add_index :users, :name, unique: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20201027010717_add_mark_adult_by_user_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddMarkAdultByUserToScripts < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :scripts, :marked_adult_by_user_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20201105015427_drop_unused_user_columns.rb: -------------------------------------------------------------------------------- 1 | class DropUnusedUserColumns < ActiveRecord::Migration[6.0] 2 | def change 3 | remove_columns :users, :banned, :flattr_username 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20201108022746_add_notify_on_mention_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddNotifyOnMentionToUsers < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :users, :notify_on_mention, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20201108034727_add_domain_to_blocked_urls.rb: -------------------------------------------------------------------------------- 1 | class AddDomainToBlockedUrls < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :blocked_script_urls, :prefix, :boolean, null: false, default: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20201108041036_blocked_script_url_prefix_default_false.rb: -------------------------------------------------------------------------------- 1 | class BlockedScriptUrlPrefixDefaultFalse < ActiveRecord::Migration[6.0] 2 | def change 3 | change_column_default :blocked_script_urls, :prefix, false 4 | execute 'update blocked_script_urls set prefix = false' 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20201124014943_drop_dj_table.rb: -------------------------------------------------------------------------------- 1 | class DropDjTable < ActiveRecord::Migration[6.0] 2 | def change 3 | drop_table :delayed_jobs 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20201220200700_add_index_to_discussions_migrated_from.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToDiscussionsMigratedFrom < ActiveRecord::Migration[6.1] 2 | def change 3 | add_index :discussions, :migrated_from 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20201220204528_add_index_to_user_remember_token.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToUserRememberToken < ActiveRecord::Migration[6.1] 2 | def change 3 | add_index :users, :remember_token, unique: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20201230012028_add_index_to_moderator_action_user_id.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToModeratorActionUserId < ActiveRecord::Migration[6.1] 2 | def change 3 | add_index :moderator_actions, :user_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210109202918_add_edge.rb: -------------------------------------------------------------------------------- 1 | class AddEdge < ActiveRecord::Migration[6.1] 2 | def up 3 | Browser.create!(name: 'Edge', code: 'edge') 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210123022226_add_stat_first_comment_to_discussions.rb: -------------------------------------------------------------------------------- 1 | class AddStatFirstCommentToDiscussions < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :discussions, :stat_first_comment_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210123022257_stat_first_comment_backfill.rb: -------------------------------------------------------------------------------- 1 | class StatFirstCommentBackfill < ActiveRecord::Migration[6.1] 2 | def up 3 | execute <<~SQL 4 | update discussions 5 | join (select discussion_id, min(id) first_id from comments group by discussion_id) a on a.discussion_id = discussions.id 6 | set stat_first_comment_id = first_id 7 | SQL 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210213213755_add_locale_id_to_discussions.rb: -------------------------------------------------------------------------------- 1 | class AddLocaleIdToDiscussions < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :discussions, :locale_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210213222917_add_index_to_discussion_locale_id.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToDiscussionLocaleId < ActiveRecord::Migration[6.1] 2 | def change 3 | add_index :discussions, :locale_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210214165054_enable_uyghur.rb: -------------------------------------------------------------------------------- 1 | class EnableUyghur < ActiveRecord::Migration[6.1] 2 | def up 3 | Locale.where(code: 'ug').update_all(native_name: 'ئۇيغۇر', ui_available: true) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210214193805_add_explanation_markup_to_reports.rb: -------------------------------------------------------------------------------- 1 | class AddExplanationMarkupToReports < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :reports, :explanation_markup, :string, limit: 10 4 | execute 'update reports set explanation_markup = "text"' 5 | change_column_default :reports, :explanation_markup, 'html' 6 | change_column_null :reports, :explanation_markup, false 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20210216014727_add_script_url_to_reports.rb: -------------------------------------------------------------------------------- 1 | class AddScriptUrlToReports < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :reports, :script_url, :string 4 | add_column :reports, :reference_script_id, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210221225945_add_self_deleted_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddSelfDeletedToScripts < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :scripts, :self_deleted, :boolean, null: false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210221233018_add_rebuttal_to_reports.rb: -------------------------------------------------------------------------------- 1 | class AddRebuttalToReports < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :reports, :rebuttal, :text 4 | add_column :reports, :rebuttal_by_user_id, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210222030536_change_report_reason_length.rb: -------------------------------------------------------------------------------- 1 | class ChangeReportReasonLength < ActiveRecord::Migration[6.1] 2 | def change 3 | change_column :reports, :reason, :string, limit: 25, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210223233743_add_moderator_notes_to_reports.rb: -------------------------------------------------------------------------------- 1 | class AddModeratorNotesToReports < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :reports, :moderator_notes, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210228215935_add_created_at_to_reports.rb: -------------------------------------------------------------------------------- 1 | class AddCreatedAtToReports < ActiveRecord::Migration[6.1] 2 | def change 3 | add_timestamps(:reports) 4 | execute 'UPDATE reports SET created_at = NOW() where created_at IS NULL' 5 | execute 'UPDATE reports SET updated_at = NOW() where updated_at IS NULL' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20210303004355_add_moderator_category.rb: -------------------------------------------------------------------------------- 1 | class AddModeratorCategory < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :discussion_categories, :moderators_only, :boolean, default: false, null: false 4 | execute "INSERT INTO discussion_categories (category_key, moderators_only) VALUES ('moderators', true)" 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210425201410_add_sync_failure_count.rb: -------------------------------------------------------------------------------- 1 | class AddSyncFailureCount < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :scripts, :sync_attempt_count, :integer, default: 0, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210506145933_drop_userscripts_org_identifiers.rb: -------------------------------------------------------------------------------- 1 | class DropUserscriptsOrgIdentifiers < ActiveRecord::Migration[6.1] 2 | def up 3 | execute 'UPDATE scripts set sync_identifier = null, script_sync_type_id = null, script_sync_source_id = null where script_sync_source_id = 2' 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210506151411_drop_script_sync_source_type.rb: -------------------------------------------------------------------------------- 1 | class DropScriptSyncSourceType < ActiveRecord::Migration[6.1] 2 | def change 3 | drop_table :script_sync_sources 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210520013942_add_report_id_to_discussions.rb: -------------------------------------------------------------------------------- 1 | class AddReportIdToDiscussions < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :discussions, :report_id, :integer, index: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210718002238_add_indexto_delete_type.rb: -------------------------------------------------------------------------------- 1 | class AddIndextoDeleteType < ActiveRecord::Migration[6.1] 2 | def change 3 | add_index :scripts, :delete_type 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210720001120_remove_unused_script_columns.rb: -------------------------------------------------------------------------------- 1 | class RemoveUnusedScriptColumns < ActiveRecord::Migration[6.1] 2 | def change 3 | remove_columns(:scripts, :script_sync_source_id, :script_delete_type_id) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210720001211_remove_unused_localized_script_attribute.rb: -------------------------------------------------------------------------------- 1 | class RemoveUnusedLocalizedScriptAttribute < ActiveRecord::Migration[6.1] 2 | def change 3 | remove_column(:localized_script_attributes, :sync_source_id) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210720001400_remove_unused_discussion_attributes.rb: -------------------------------------------------------------------------------- 1 | class RemoveUnusedDiscussionAttributes < ActiveRecord::Migration[6.1] 2 | def change 3 | remove_columns(:discussions, :akismet_spam, :akismet_blatant) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210722011850_add_comment_to_allowed_requires.rb: -------------------------------------------------------------------------------- 1 | class AddCommentToAllowedRequires < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :allowed_requires, :comment, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210814162649_add_appeal_to_moderator_log.rb: -------------------------------------------------------------------------------- 1 | class AddAppealToModeratorLog < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :moderator_actions, :script_lock_appeal_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210814211458_add_edited_at_to_messages.rb: -------------------------------------------------------------------------------- 1 | class AddEditedAtToMessages < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :messages, :edited_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210828002422_moderator_notes_on_appeal.rb: -------------------------------------------------------------------------------- 1 | class ModeratorNotesOnAppeal < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :script_lock_appeals, :moderator_notes, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210927005947_add_discussion_category_id_to_reports.rb: -------------------------------------------------------------------------------- 1 | class AddDiscussionCategoryIdToReports < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :reports, :discussion_category_id, :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20211031001041_add_no_stats_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddNoStatsToScripts < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :scripts, :disable_stats, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20211102012556_create_cleaned_codes.rb: -------------------------------------------------------------------------------- 1 | class CreateCleanedCodes < ActiveRecord::Migration[6.1] 2 | def change 3 | create_table :cleaned_codes do |t| 4 | t.integer :script_id, null: false 5 | t.text :code, null: false 6 | end 7 | add_foreign_key :cleaned_codes, :scripts, on_delete: :cascade 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20211102022030_add_unique_index_to_cleaned_codes.rb: -------------------------------------------------------------------------------- 1 | class AddUniqueIndexToCleanedCodes < ActiveRecord::Migration[6.1] 2 | def change 3 | add_index :cleaned_codes, :script_id, unique: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20211104000300_moderator_actions_text.rb: -------------------------------------------------------------------------------- 1 | class ModeratorActionsText < ActiveRecord::Migration[6.1] 2 | def change 3 | change_column :moderator_actions, :action, :text 4 | change_column :moderator_actions, :private_reason, :text 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20211104021132_cleaned_code_longtext.rb: -------------------------------------------------------------------------------- 1 | class CleanedCodeLongtext < ActiveRecord::Migration[6.1] 2 | def change 3 | change_column :cleaned_codes, :code, :longtext 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20211110192948_add_pure404_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddPure404ToScripts < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :scripts, :pure_404, :boolean, null: false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20211111005455_add_missing_license_warned_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddMissingLicenseWarnedToScripts < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :scripts, :missing_license_warned, :boolean, null: false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20211227002934_add_resolver_to_reports.rb: -------------------------------------------------------------------------------- 1 | class AddResolverToReports < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :reports, :resolver_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20211227014433_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from active_storage (originally 20211119233751) 2 | class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0] 3 | def change 4 | change_column_null(:active_storage_blobs, :checksum, true) 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20220425234023_add_report_notifications_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddReportNotificationsToUsers < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :users, :notify_as_reporter, :boolean, default: true, null: false 4 | add_column :users, :notify_as_reported, :boolean, default: true, null: false 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20220914015921_create_subresource_integrity_hashes.rb: -------------------------------------------------------------------------------- 1 | class CreateSubresourceIntegrityHashes < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :subresource_integrity_hashes do |t| 4 | t.belongs_to :subresource, null: false 5 | t.string :algorithm, limit: 20, null: false 6 | t.string :encoding, limit: 10, null: false 7 | t.string :integrity_hash, limit: 128, null: false 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20220915003006_add_check_times_to_subresources.rb: -------------------------------------------------------------------------------- 1 | class AddCheckTimesToSubresources < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :subresources, :last_attempt_at, :datetime 4 | add_column :subresources, :last_success_at, :datetime 5 | add_column :subresources, :last_change_at, :datetime 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220917003952_add_encoding_to_script_subresource_usage.rb: -------------------------------------------------------------------------------- 1 | class AddEncodingToScriptSubresourceUsage < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :script_subresource_usages, :encoding, :string, limit: 10 4 | execute 'update script_subresource_usages set encoding = "hex" where encoding IS NULL and integrity_hash is not null' 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20221218174116_add_georgian_locale.rb: -------------------------------------------------------------------------------- 1 | class AddGeorgianLocale < ActiveRecord::Migration[7.0] 2 | def change 3 | Locale.where(code: 'ka').update_all(ui_available: true) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230227004731_add_review_reason_to_comments.rb: -------------------------------------------------------------------------------- 1 | class AddReviewReasonToComments < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :comments, :review_reason, :string, limit: 10 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230422004659_add_self_uphold_to_report.rb: -------------------------------------------------------------------------------- 1 | class AddSelfUpholdToReport < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :reports, :self_upheld, :boolean, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230617011356_expand_subresources_url.rb: -------------------------------------------------------------------------------- 1 | class ExpandSubresourcesUrl < ActiveRecord::Migration[7.0] 2 | def change 3 | change_column :subresources, :url, :string, limit: 1024, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230717184116_update_uighur_name.rb: -------------------------------------------------------------------------------- 1 | class UpdateUighurName < ActiveRecord::Migration[7.0] 2 | def change 3 | Locale.where(code: 'ug').update_all(native_name: 'ئۇيغۇرچە') 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230906005826_add_central_kurdish_locale.rb: -------------------------------------------------------------------------------- 1 | class AddCentralKurdishLocale < ActiveRecord::Migration[7.0] 2 | def change 3 | Locale.create!(code: 'ckb', english_name: 'Central Kurdish', native_name: 'کوردیی ناوەندی', rtl: true, ui_available: true) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230922233518_add_croatian.rb: -------------------------------------------------------------------------------- 1 | class AddCroatian < ActiveRecord::Migration[7.0] 2 | def change 3 | Locale.where(code: 'hr').update_all(ui_available: true) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230922235219_enum_script_type.rb: -------------------------------------------------------------------------------- 1 | class EnumScriptType < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :scripts, :script_type, :integer, default: 1, null: false 4 | execute 'update scripts set script_type = script_type_id' 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20230923204228_drop_script_types.rb: -------------------------------------------------------------------------------- 1 | class DropScriptTypes < ActiveRecord::Migration[7.0] 2 | def change 3 | drop_table :script_types 4 | remove_column :scripts, :script_type_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20231112225004_daily_install_counts_ipv6.rb: -------------------------------------------------------------------------------- 1 | class DailyInstallCountsIpv6 < ActiveRecord::Migration[7.0] 2 | def up 3 | execute <<~SQL 4 | ALTER TABLE daily_install_counts 5 | MODIFY COLUMN ip VARCHAR(45) NOT NULL 6 | SQL 7 | execute <<~SQL 8 | ALTER TABLE daily_update_check_counts 9 | MODIFY COLUMN ip VARCHAR(45) NOT NULL 10 | SQL 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20240122003921_add_plain_text_to_comments.rb: -------------------------------------------------------------------------------- 1 | class AddPlainTextToComments < ActiveRecord::Migration[7.1] 2 | def change 3 | add_column :comments, :plain_text, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240122005613_backfill_comment_plain_text.rb: -------------------------------------------------------------------------------- 1 | class BackfillCommentPlainText < ActiveRecord::Migration[7.1] 2 | disable_ddl_transaction! 3 | 4 | def up 5 | Comment.where(plain_text: nil).find_each{|c| c.set_plain_text; c.update_column(:plain_text, c.plain_text) } 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240122162848_add_delete_report_id_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddDeleteReportIdToScripts < ActiveRecord::Migration[7.1] 2 | def change 3 | add_column :scripts, :delete_report_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240225041012_add_deletion_message_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddDeletionMessageToScripts < ActiveRecord::Migration[7.1] 2 | def change 3 | add_column :scripts, :deletion_message, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240305015134_dropscript_applies_tos_bak.rb: -------------------------------------------------------------------------------- 1 | class DropscriptAppliesTosBak < ActiveRecord::Migration[7.1] 2 | def change 3 | drop_table :script_applies_tos_bak, if_exists: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240524155931_add_moderator_reason_override_to_reports.rb: -------------------------------------------------------------------------------- 1 | class AddModeratorReasonOverrideToReports < ActiveRecord::Migration[7.1] 2 | def change 3 | add_column :reports, :moderator_reason_override, :string, limit: 25 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240605140532_rename_script_sync_type.rb: -------------------------------------------------------------------------------- 1 | class RenameScriptSyncType < ActiveRecord::Migration[7.1] 2 | def change 3 | rename_column :scripts, :script_sync_type_id, :sync_type 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240605152157_drop_script_sync_types.rb: -------------------------------------------------------------------------------- 1 | class DropScriptSyncTypes < ActiveRecord::Migration[7.1] 2 | def change 3 | drop_table :script_sync_types 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240612160951_add_case_insensitive_to_blocked_script_codes.rb: -------------------------------------------------------------------------------- 1 | class AddCaseInsensitiveToBlockedScriptCodes < ActiveRecord::Migration[7.1] 2 | def change 3 | add_column :blocked_script_codes, :case_insensitive, :boolean, null: false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240614200415_deleted_unused_script_applications.rb: -------------------------------------------------------------------------------- 1 | class DeletedUnusedScriptApplications < ActiveRecord::Migration[7.1] 2 | disable_ddl_transaction! 3 | 4 | def up 5 | SiteApplication.connection.select_values('SELECT id from site_applications WHERE id NOT IN (select site_application_id FROM script_applies_tos)').each do |site_application_id| 6 | SiteApplication.where(id: site_application_id).delete_all 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20240614205858_add_unique_site_application.rb: -------------------------------------------------------------------------------- 1 | class AddUniqueSiteApplication < ActiveRecord::Migration[7.1] 2 | def change 3 | add_index :site_applications, [:text, :domain], unique: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240618193437_add_domain_text_to_site_applications.rb: -------------------------------------------------------------------------------- 1 | class AddDomainTextToSiteApplications < ActiveRecord::Migration[7.1] 2 | def change 3 | add_column :site_applications, :domain_text, :string, limit: 100 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240618193513_backfill_site_applications_domain_text.rb: -------------------------------------------------------------------------------- 1 | class BackfillSiteApplicationsDomainText < ActiveRecord::Migration[7.1] 2 | disable_ddl_transaction! 3 | 4 | def up 5 | execute <<~SQL 6 | UPDATE site_applications SET domain_text = text WHERE domain_text IS NULL AND domain 7 | SQL 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20240618194344_adjust_site_application_index.rb: -------------------------------------------------------------------------------- 1 | class AdjustSiteApplicationIndex < ActiveRecord::Migration[7.1] 2 | def change 3 | remove_index :site_applications, name: :index_site_applications_on_text_and_domain 4 | add_index :site_applications, :domain_text, unique: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20240618194529_site_applications_domain_nil.rb: -------------------------------------------------------------------------------- 1 | class SiteApplicationsDomainNil < ActiveRecord::Migration[7.1] 2 | def change 3 | change_column_null :site_applications, :domain, true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240628174038_add_publicly_visible_to_discussions.rb: -------------------------------------------------------------------------------- 1 | class AddPubliclyVisibleToDiscussions < ActiveRecord::Migration[7.1] 2 | def change 3 | add_column :discussions, :publicly_visible, :boolean, null: false, default: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240628174100_backfill_discussion_publicly_visisble.rb: -------------------------------------------------------------------------------- 1 | class BackfillDiscussionPubliclyVisisble < ActiveRecord::Migration[7.1] 2 | disable_ddl_transaction! 3 | 4 | def up 5 | Discussion.includes(:script).find_each do |d| 6 | d.calculate_publicly_visible 7 | d.save(validate: false) 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20240628174604_index_publicly_visible.rb: -------------------------------------------------------------------------------- 1 | class IndexPubliclyVisible < ActiveRecord::Migration[7.1] 2 | def change 3 | add_index :discussions, :publicly_visible 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240628185320_add_index_to_discussions_report_id.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToDiscussionsReportId < ActiveRecord::Migration[7.1] 2 | def change 3 | add_index :discussions, :report_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240628185847_remove_ignored_site_application_domain.rb: -------------------------------------------------------------------------------- 1 | class RemoveIgnoredSiteApplicationDomain < ActiveRecord::Migration[7.1] 2 | def change 3 | remove_column :site_applications, :domain 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240628230432_daily_install_counts_big_int.rb: -------------------------------------------------------------------------------- 1 | class DailyInstallCountsBigInt < ActiveRecord::Migration[7.1] 2 | def change 3 | execute <<~SQL 4 | ALTER TABLE daily_install_counts MODIFY COLUMN `id` BIGINT NOT NULL AUTO_INCREMENT 5 | SQL 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240628230757_install_counts_big_int.rb: -------------------------------------------------------------------------------- 1 | class InstallCountsBigInt < ActiveRecord::Migration[7.1] 2 | def change 3 | execute <<~SQL 4 | ALTER TABLE install_counts MODIFY COLUMN `id` BIGINT NOT NULL AUTO_INCREMENT 5 | SQL 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240628230841_update_check_counts_big_int.rb: -------------------------------------------------------------------------------- 1 | class UpdateCheckCountsBigInt < ActiveRecord::Migration[7.1] 2 | def change 3 | execute <<~SQL 4 | ALTER TABLE update_check_counts MODIFY COLUMN `id` BIGINT NOT NULL AUTO_INCREMENT 5 | SQL 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240815234051_add_summary_url_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddSummaryUrlToLicenses < ActiveRecord::Migration[7.1] 2 | def change 3 | add_column :licenses, :summary_url, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240905201335_create_user_notification_settings.rb: -------------------------------------------------------------------------------- 1 | class CreateUserNotificationSettings < ActiveRecord::Migration[7.2] 2 | def change 3 | create_table :user_notification_settings do |t| 4 | t.references :user, null: false, index: false 5 | t.integer :notification_type, null: false 6 | t.integer :delivery_type, null: false 7 | t.boolean :enabled, null: false 8 | t.index [:user_id, :notification_type] 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20240912145341_migrate_user_notify_as_reporter.rb: -------------------------------------------------------------------------------- 1 | class MigrateUserNotifyAsReporter < ActiveRecord::Migration[7.2] 2 | def change 3 | User.where(notify_as_reporter: false).find_each do |user| 4 | UserNotificationSetting.update_delivery_types_for_user(user, Notification::NOTIFICATION_TYPE_REPORT_RESOLVED_REPORTER, []) 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240912150839_migrate_user_notify_as_reported.rb: -------------------------------------------------------------------------------- 1 | class MigrateUserNotifyAsReported < ActiveRecord::Migration[7.2] 2 | def change 3 | User.where(notify_as_reported: false).find_each do |user| 4 | UserNotificationSetting.update_delivery_types_for_user(user, Notification::NOTIFICATION_TYPE_REPORT_FILED_REPORTED, []) 5 | UserNotificationSetting.update_delivery_types_for_user(user, Notification::NOTIFICATION_TYPE_REPORT_RESOLVED_REPORTED, []) 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20240916144947_add_notify_admin_to_blocked_script_code.rb: -------------------------------------------------------------------------------- 1 | class AddNotifyAdminToBlockedScriptCode < ActiveRecord::Migration[7.2] 2 | def change 3 | add_column :blocked_script_codes, :notify_admin, :boolean, default: true, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240916150622_add_es419.rb: -------------------------------------------------------------------------------- 1 | class AddEs419 < ActiveRecord::Migration[7.2] 2 | def change 3 | Locale.create!(code: 'es-419', english_name: 'Spanish, Latin American', native_name: 'Español Latinoamericano', ui_available: true) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240916153301_notification_fk_cascase.rb: -------------------------------------------------------------------------------- 1 | class NotificationFkCascase < ActiveRecord::Migration[7.2] 2 | def change 3 | remove_foreign_key :notifications, :users 4 | add_foreign_key :notifications, :users, on_delete: :cascade 5 | add_foreign_key :user_notification_settings, :users, on_delete: :cascade 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240923202914_drop_ignored_notify_columns.rb: -------------------------------------------------------------------------------- 1 | class DropIgnoredNotifyColumns < ActiveRecord::Migration[7.2] 2 | def change 3 | remove_columns :users, :notify_as_reporter, :notify_as_reported 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240923204104_add_subscribe_on_script_discussion_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddSubscribeOnScriptDiscussionToUsers < ActiveRecord::Migration[7.2] 2 | def change 3 | add_column :users, :subscribe_on_script_discussion, :boolean, default: true, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240923204158_subscribe_on_script_discussion_backfill.rb: -------------------------------------------------------------------------------- 1 | class SubscribeOnScriptDiscussionBackfill < ActiveRecord::Migration[7.2] 2 | def change 3 | execute <<~SQL 4 | UPDATE users SET subscribe_on_script_discussion = false WHERE author_email_notification_type_id = 1 5 | SQL 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240923231550_backfill_user_mention_setting.rb: -------------------------------------------------------------------------------- 1 | class BackfillUserMentionSetting < ActiveRecord::Migration[7.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | User.where(notify_on_mention: true).find_each do |user| 6 | UserNotificationSetting.update_delivery_types_for_user(user, Notification::NOTIFICATION_TYPE_MENTION, [UserNotificationSetting::DELIVERY_TYPE_ON_SITE, UserNotificationSetting::DELIVERY_TYPE_EMAIL]) 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20241022160755_add_created_at_to_akismet_submissions.rb: -------------------------------------------------------------------------------- 1 | class AddCreatedAtToAkismetSubmissions < ActiveRecord::Migration[7.2] 2 | def change 3 | add_column :akismet_submissions, :created_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022160816_backfill_created_at_akismet_submissions.rb: -------------------------------------------------------------------------------- 1 | class BackfillCreatedAtAkismetSubmissions < ActiveRecord::Migration[7.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | AkismetSubmission.includes(:item).find_each do |submission| 6 | submission.update!(created_at: submission.item&.created_at || Time.zone.now) 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20241022160849_not_null_default_created_at_akismet_submissions.rb: -------------------------------------------------------------------------------- 1 | class NotNullDefaultCreatedAtAkismetSubmissions < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :akismet_submissions, :created_at, :datetime, null: false, default: -> { 'CURRENT_TIMESTAMP' } 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022172039_allowed_require_bigint.rb: -------------------------------------------------------------------------------- 1 | class AllowedRequireBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :allowed_requires, :id, :bigint, auto_increment: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022172508_remove_unused_user_columns.rb: -------------------------------------------------------------------------------- 1 | class RemoveUnusedUserColumns < ActiveRecord::Migration[7.2] 2 | def change 3 | remove_column :users, :author_email_notification_type_id 4 | remove_column :users, :notify_on_mention 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20241022173046_drop_author_email_notification_types.rb: -------------------------------------------------------------------------------- 1 | class DropAuthorEmailNotificationTypes < ActiveRecord::Migration[7.2] 2 | def change 3 | drop_table :author_email_notification_types 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022173429_browsers_bigint.rb: -------------------------------------------------------------------------------- 1 | class BrowsersBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | remove_foreign_key :compatibilities, :browsers 4 | change_column :compatibilities, :browser_id, :bigint 5 | change_column :browsers, :id, :bigint, auto_increment: true 6 | add_foreign_key :compatibilities, :browsers, on_delete: :cascade 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20241022174031_compatiblities_bigint.rb: -------------------------------------------------------------------------------- 1 | class CompatiblitiesBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :compatibilities, :id, :bigint, auto_increment: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022175231_disallowed_codes_bigint.rb: -------------------------------------------------------------------------------- 1 | class DisallowedCodesBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :disallowed_codes, :id, :bigint, auto_increment: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022175341_identities_bigint.rb: -------------------------------------------------------------------------------- 1 | class IdentitiesBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :identities, :id, :bigint, auto_increment: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022175916_locale_contributors_bigint.rb: -------------------------------------------------------------------------------- 1 | class LocaleContributorsBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :locale_contributors, :id, :bigint, auto_increment: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022180155_locale_bigint.rb: -------------------------------------------------------------------------------- 1 | class LocaleBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | remove_foreign_key :antifeatures, :locales 4 | change_column :antifeatures, :locale_id, :bigint 5 | 6 | change_column :locales, :id, :bigint, auto_increment: true 7 | add_foreign_key :antifeatures, :locales 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20241022180716_localized_attributes_bigint.rb: -------------------------------------------------------------------------------- 1 | class LocalizedAttributesBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :localized_script_attributes, :id, :bigint, auto_increment: true 4 | change_column :localized_script_version_attributes, :id, :bigint, auto_increment: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20241022181445_moderator_actions_bigint.rb: -------------------------------------------------------------------------------- 1 | class ModeratorActionsBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :moderator_actions, :id, :bigint, auto_increment: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022181543_roles_bigint.rb: -------------------------------------------------------------------------------- 1 | class RolesBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :roles, :id, :bigint, auto_increment: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022181918_drop_screenshots.rb: -------------------------------------------------------------------------------- 1 | class DropScreenshots < ActiveRecord::Migration[7.2] 2 | def change 3 | drop_table :screenshots_script_versions 4 | drop_table :screenshots 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20241022182214_script_applies_to_bigint.rb: -------------------------------------------------------------------------------- 1 | class ScriptAppliesToBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :script_applies_tos, :id, :bigint, auto_increment: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022182612_script_codes_bigint.rb: -------------------------------------------------------------------------------- 1 | class ScriptCodesBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :script_codes, :id, :bigint, auto_increment: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022201401_drop_script_delete_types.rb: -------------------------------------------------------------------------------- 1 | class DropScriptDeleteTypes < ActiveRecord::Migration[7.2] 2 | def change 3 | drop_table :script_delete_types 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022201807_script_set_bigint.rb: -------------------------------------------------------------------------------- 1 | class ScriptSetBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | [:script_sets, :script_set_automatic_types, :script_set_automatic_set_inclusions, :script_set_script_inclusions, :script_set_set_inclusions].each do |table_name| 4 | change_column table_name, :id, :bigint, auto_increment: true 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20241022203127_sensitive_sites_bigint.rb: -------------------------------------------------------------------------------- 1 | class SensitiveSitesBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :sensitive_sites, :id, :bigint, auto_increment: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022203555_syntax_highlighted_codes_bigint.rb: -------------------------------------------------------------------------------- 1 | class SyntaxHighlightedCodesBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :syntax_highlighted_codes, :id, :bigint, auto_increment: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241022203932_drop_test_update_counts.rb: -------------------------------------------------------------------------------- 1 | class DropTestUpdateCounts < ActiveRecord::Migration[7.2] 2 | def change 3 | drop_table :test_update_counts 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241024020842_drop_unused_disallowed_tables.rb: -------------------------------------------------------------------------------- 1 | class DropUnusedDisallowedTables < ActiveRecord::Migration[7.2] 2 | def change 3 | drop_table :disallowed_codes 4 | drop_table :disallowed_attributes 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20241025160414_comments_user_bigint.rb: -------------------------------------------------------------------------------- 1 | class CommentsUserBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :comments, :poster_id, :bigint 4 | change_column :comments, :deleted_by_user_id, :bigint 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20241025160732_conversations_user_bigint.rb: -------------------------------------------------------------------------------- 1 | class ConversationsUserBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :conversations, :stat_last_poster_id, :bigint 4 | change_column :conversations_users, :user_id, :bigint 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20241026205203_script_lock_appeal_id_bigint.rb: -------------------------------------------------------------------------------- 1 | class ScriptLockAppealIdBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :moderator_actions, :script_lock_appeal_id, :bigint 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241026205306_role_id_bigint.rb: -------------------------------------------------------------------------------- 1 | class RoleIdBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :roles_users, :role_id, :bigint 4 | add_foreign_key :roles_users, :roles 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20241026205747_site_application_id_bigint.rb: -------------------------------------------------------------------------------- 1 | class SiteApplicationIdBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_column :script_applies_tos, :site_application_id, :bigint 4 | add_foreign_key :script_applies_tos, :site_applications, on_delete: :cascade 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20241027154556_add_fk_script_subresource_usages.rb: -------------------------------------------------------------------------------- 1 | class AddFkScriptSubresourceUsages < ActiveRecord::Migration[7.2] 2 | def change 3 | add_foreign_key :script_subresource_usages, :scripts, on_delete: :cascade 4 | add_foreign_key :script_subresource_usages, :subresources, on_delete: :cascade 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20241027220118_script_versions_script_code_bigint.rb: -------------------------------------------------------------------------------- 1 | class ScriptVersionsScriptCodeBigint < ActiveRecord::Migration[7.2] 2 | def change 3 | change_table :script_versions do |t| 4 | t.change :script_code_id, :bigint 5 | t.change :rewritten_script_code_id, :bigint 6 | end 7 | 8 | add_foreign_key :script_versions, :script_codes 9 | add_foreign_key :script_versions, :script_codes, column: :rewritten_script_code_id 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20241101004022_drop_script_report_fk.rb: -------------------------------------------------------------------------------- 1 | class DropScriptReportFk < ActiveRecord::Migration[7.2] 2 | def change 3 | remove_foreign_key :scripts, :reports, column: :delete_report_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241109012359_remove_scripts_promoted.rb: -------------------------------------------------------------------------------- 1 | class RemoveScriptsPromoted < ActiveRecord::Migration[7.2] 2 | def change 3 | remove_column :scripts, :promoted 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241109191808_add_index_discussion_script_publicly_visible.rb: -------------------------------------------------------------------------------- 1 | class AddIndexDiscussionScriptPubliclyVisible < ActiveRecord::Migration[7.2] 2 | def change 3 | add_index :discussions, [:script_id, :publicly_visible] 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241115154508_add_discussion_and_comment_to_moderator_actions.rb: -------------------------------------------------------------------------------- 1 | class AddDiscussionAndCommentToModeratorActions < ActiveRecord::Migration[7.2] 2 | def change 3 | change_table :moderator_actions do |t| 4 | t.bigint :discussion_id, index: true 5 | t.bigint :comment_id, index: true 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20241115164257_add_blatant_to_reports.rb: -------------------------------------------------------------------------------- 1 | class AddBlatantToReports < ActiveRecord::Migration[7.2] 2 | def change 3 | add_column :reports, :blatant, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241116204100_add_registration_email_domain_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddRegistrationEmailDomainToUsers < ActiveRecord::Migration[7.2] 2 | def change 3 | add_column :users, :registration_email_domain, :string, limit: 100 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241117160929_add_notify_admin_to_blocked_script_text.rb: -------------------------------------------------------------------------------- 1 | class AddNotifyAdminToBlockedScriptText < ActiveRecord::Migration[7.2] 2 | def change 3 | add_column :blocked_script_texts, :notify_admin, :boolean, default: true, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241120160804_add_devise_two_factor_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddDeviseTwoFactorToUsers < ActiveRecord::Migration[7.2] 2 | def change 3 | add_column :users, :otp_secret, :string 4 | add_column :users, :consumed_timestep, :integer 5 | add_column :users, :otp_required_for_login, :boolean 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20241122160246_script_delete_notification.rb: -------------------------------------------------------------------------------- 1 | class ScriptDeleteNotification < ActiveRecord::Migration[7.2] 2 | def change 3 | Notification.includes(:item).where(item_type: 'Script').select{|n|n.item.nil?}.each(&:destroy) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20241122185627_clear_notification_nil_item.rb: -------------------------------------------------------------------------------- 1 | class ClearNotificationNilItem < ActiveRecord::Migration[7.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | Notification.includes(:item).find_each.select{|n| n.item.nil?}.each(&:destroy) 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20241129152927_create_stat_bans.rb: -------------------------------------------------------------------------------- 1 | class CreateStatBans < ActiveRecord::Migration[7.2] 2 | def change 3 | create_table :stat_bans do |t| 4 | t.belongs_to :script, null: false, foreign_key: true 5 | t.timestamps 6 | t.datetime :expires_at, null: false 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20250103213614_add_code_size_to_scripts.rb: -------------------------------------------------------------------------------- 1 | class AddCodeSizeToScripts < ActiveRecord::Migration[8.0] 2 | def change 3 | add_column :scripts, :code_size, :integer, default: 0, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250103213743_backfill_script_code_size.rb: -------------------------------------------------------------------------------- 1 | class BackfillScriptCodeSize < ActiveRecord::Migration[8.0] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | Script.find_each do |script| 6 | script.update_column(:code_size, script.current_code.bytesize) 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20250108162648_add_category_to_blocked_script_code.rb: -------------------------------------------------------------------------------- 1 | class AddCategoryToBlockedScriptCode < ActiveRecord::Migration[8.0] 2 | def change 3 | add_column :blocked_script_codes, :category, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250121004654_add_created_at_to_script_lock_appeals.rb: -------------------------------------------------------------------------------- 1 | class AddCreatedAtToScriptLockAppeals < ActiveRecord::Migration[8.0] 2 | def change 3 | add_column :script_lock_appeals, :created_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250121005544_script_lock_appeal_created_at_not_null.rb: -------------------------------------------------------------------------------- 1 | class ScriptLockAppealCreatedAtNotNull < ActiveRecord::Migration[8.0] 2 | def change 3 | change_column_null :script_lock_appeals, :created_at, false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250122165121_remove_ignored_disable_stats.rb: -------------------------------------------------------------------------------- 1 | class RemoveIgnoredDisableStats < ActiveRecord::Migration[8.0] 2 | def change 3 | remove_column :scripts, :disable_stats 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250205223931_add_require_secure_login_for_author_to_usres.rb: -------------------------------------------------------------------------------- 1 | class AddRequireSecureLoginForAuthorToUsres < ActiveRecord::Migration[8.0] 2 | def change 3 | add_column :users, :require_secure_login_for_author, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250205224005_require_secure_login_for_author_backfill.rb: -------------------------------------------------------------------------------- 1 | class RequireSecureLoginForAuthorBackfill < ActiveRecord::Migration[8.0] 2 | def change 3 | execute <<~SQL 4 | UPDATE users SET require_secure_login_for_author = true WHERE created_at >= '2025-01-22' 5 | SQL 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20250205224138_require_secure_login_for_author_default.rb: -------------------------------------------------------------------------------- 1 | class RequireSecureLoginForAuthorDefault < ActiveRecord::Migration[8.0] 2 | def change 3 | change_column_default :users, :require_secure_login_for_author, true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250205225150_require_secure_login_for_no_scripts.rb: -------------------------------------------------------------------------------- 1 | class RequireSecureLoginForNoScripts < ActiveRecord::Migration[8.0] 2 | def change 3 | execute <<~SQL 4 | update users set require_secure_login_for_author = true where require_secure_login_for_author = false and id not in (select user_id from authors); 5 | SQL 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20250206002942_change_blocked_script_codes_result.rb: -------------------------------------------------------------------------------- 1 | class ChangeBlockedScriptCodesResult < ActiveRecord::Migration[8.0] 2 | def change 3 | add_column :blocked_script_codes, :result, :integer, null: false, default: 0 4 | execute 'update blocked_script_codes set result = 1 where serious' 5 | remove_column :blocked_script_codes, :serious 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20250224231045_marathi_available.rb: -------------------------------------------------------------------------------- 1 | class MarathiAvailable < ActiveRecord::Migration[8.0] 2 | def change 3 | Locale.where(code: 'mr').update!(native_name: 'मराठी', ui_available: true) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250227002159_create_blocked_users.rb: -------------------------------------------------------------------------------- 1 | class CreateBlockedUsers < ActiveRecord::Migration[8.0] 2 | def change 3 | create_table :blocked_users do |t| 4 | t.timestamps 5 | t.string :pattern, null: false 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20250227002546_backfill_blocked_users.rb: -------------------------------------------------------------------------------- 1 | class BackfillBlockedUsers < ActiveRecord::Migration[8.0] 2 | def change 3 | ['CX D K 58', '17197055000', 'www\\.xbs', 'hjv58\.top'].each do |pattern| 4 | BlockedUser.create!(pattern:) 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20250228220422_add_index_to_comments_deleted_at.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToCommentsDeletedAt < ActiveRecord::Migration[8.0] 2 | def change 3 | add_index :comments, :deleted_at 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250307155204_add_private_explanation_to_reports.rb: -------------------------------------------------------------------------------- 1 | class AddPrivateExplanationToReports < ActiveRecord::Migration[8.0] 2 | def change 3 | add_column :reports, :private_explanation, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250312210702_moderator_actions_auto_mod.rb: -------------------------------------------------------------------------------- 1 | class ModeratorActionsAutoMod < ActiveRecord::Migration[8.0] 2 | def change 3 | change_column_null :moderator_actions, :moderator_id, true 4 | add_column :moderator_actions, :automod, :boolean, default: false, null: false 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20250312212656_add_report_automod_resolved.rb: -------------------------------------------------------------------------------- 1 | class AddReportAutomodResolved < ActiveRecord::Migration[8.0] 2 | def change 3 | add_column :reports, :automod_resolved, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250409220424_add_action_taken_to_moderator_action.rb: -------------------------------------------------------------------------------- 1 | class AddActionTakenToModeratorAction < ActiveRecord::Migration[8.0] 2 | def change 3 | add_column :moderator_actions, :action_taken, :integer 4 | add_column :moderator_actions, :action_details, :text 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20250409221815_moderator_action_action_taken_not_null.rb: -------------------------------------------------------------------------------- 1 | class ModeratorActionActionTakenNotNull < ActiveRecord::Migration[8.0] 2 | def change 3 | change_column_null :moderator_actions, :action_taken, false 4 | change_column_null :moderator_actions, :action, true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/lib/assets/.keep -------------------------------------------------------------------------------- /lib/capistrano/tasks/invoke.rake: -------------------------------------------------------------------------------- 1 | desc 'run rake transifex:update_meta on the remote server' 2 | task transifex_update_meta: 'deploy:set_rails_env' do |_task, _args| 3 | on primary(:app) do 4 | within current_path do 5 | with rails_env: fetch(:rails_env) do 6 | rake 'transifex:update_meta' 7 | end 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /lib/script_importer/test_importer.rb: -------------------------------------------------------------------------------- 1 | require 'script_importer/base_script_importer' 2 | 3 | # A fake importer that treats the URL like data 4 | module ScriptImporter 5 | class TestImporter < BaseScriptImporter 6 | def self.can_handle_url(_url) 7 | true 8 | end 9 | 10 | def self.import_source_name 11 | 'Test' 12 | end 13 | 14 | def self.download(url) 15 | url 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /lib/searchkick_disable_middleware.rb: -------------------------------------------------------------------------------- 1 | class SearchkickDisableMiddleware 2 | def initialize(app) 3 | @app = app 4 | end 5 | 6 | def call(env) 7 | Searchkick.callbacks(false) do 8 | @app.call(env) 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/sidekiq/max_concurrency_exception.rb: -------------------------------------------------------------------------------- 1 | module Sidekiq 2 | class MaxConcurrencyException < StandardError 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/lib/tasks/.keep -------------------------------------------------------------------------------- /lib/tasks/code_search.rake: -------------------------------------------------------------------------------- 1 | namespace :code_search do 2 | desc 'reindex' 3 | task reindex: :environment do 4 | ScriptCodeSearch.index_all 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /lib/tasks/script_stats.rake: -------------------------------------------------------------------------------- 1 | namespace :script_stats do 2 | desc 'refresh' 3 | task refresh: :environment do 4 | TopSitesService.refresh! 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /lib/tasks/user_stats.rake: -------------------------------------------------------------------------------- 1 | namespace :user_stats do 2 | desc 'refresh' 3 | task refresh: :environment do 4 | User.left_joins(:authors).where('authors.id is not null or stats_script_count > 0').find_each(&:update_stats!) 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /lib/will_paginate/action_view/link_renderer_with_no_follow.rb: -------------------------------------------------------------------------------- 1 | require 'will_paginate/view_helpers/action_view' 2 | 3 | module WillPaginate 4 | module ActionView 5 | class LinkRendererWithNoFollow < LinkRenderer 6 | def rel_value(_page) 7 | 'nofollow' 8 | end 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /misc/logos/logo16.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/misc/logos/logo16.xcf -------------------------------------------------------------------------------- /misc/logos/logo32.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/misc/logos/logo32.xcf -------------------------------------------------------------------------------- /misc/logos/logo512.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/misc/logos/logo512.xcf -------------------------------------------------------------------------------- /misc/logos/logo96.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/misc/logos/logo96.xcf -------------------------------------------------------------------------------- /public/503.html: -------------------------------------------------------------------------------- 1 |

    2 | We're down for maintenance. Check back again soon. 3 |

    4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/public/favicon.ico -------------------------------------------------------------------------------- /public/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/public/icon.png -------------------------------------------------------------------------------- /public/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /public/images/blacklogo128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/public/images/blacklogo128.png -------------------------------------------------------------------------------- /public/images/blacklogo16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/public/images/blacklogo16.png -------------------------------------------------------------------------------- /public/images/blacklogo32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/public/images/blacklogo32.png -------------------------------------------------------------------------------- /public/images/blacklogo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/public/images/blacklogo512.png -------------------------------------------------------------------------------- /public/images/blacklogo96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/public/images/blacklogo96.png -------------------------------------------------------------------------------- /public/libraries/jscolor/1.4.2/arrow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/public/libraries/jscolor/1.4.2/arrow.gif -------------------------------------------------------------------------------- /public/libraries/jscolor/1.4.2/cross.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/public/libraries/jscolor/1.4.2/cross.gif -------------------------------------------------------------------------------- /public/libraries/jscolor/1.4.2/demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | jscolor demo 4 | 5 | 6 | 7 | 8 | 9 | Click here: 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /public/libraries/jscolor/1.4.2/hs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/public/libraries/jscolor/1.4.2/hs.png -------------------------------------------------------------------------------- /public/libraries/jscolor/1.4.2/hv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/public/libraries/jscolor/1.4.2/hv.png -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Crawl-delay: 1 3 | -------------------------------------------------------------------------------- /runnerscripts/applies_to_stats.rb: -------------------------------------------------------------------------------- 1 | applies_tos = {} 2 | Script.find_each do |script| 3 | script.script_versions.last.calculate_applies_to_names.each do |at| 4 | if applies_tos.key?(at) 5 | applies_tos[at] << script.id 6 | else 7 | applies_tos[at] = [script.id] 8 | end 9 | end 10 | end 11 | applies_tos.sort_by { |_name, script_id_array| script_id_array.length }.reverse_each do |name, script_id_array| 12 | puts "#{name} #{script_id_array.inspect}" 13 | end 14 | -------------------------------------------------------------------------------- /runnerscripts/detect_locale.rb: -------------------------------------------------------------------------------- 1 | Script.where(locale_id: nil).find_each do |script| 2 | script.locale = script.detect_locale 3 | puts "#{script.id} #{script.name} is #{script.locale.nil? ? 'undetectable' : script.locale.code}" 4 | script.save(validate: false) unless script.locale.nil? 5 | end 6 | -------------------------------------------------------------------------------- /runnerscripts/refresh_script_version_codes.rb: -------------------------------------------------------------------------------- 1 | ScriptVersion.record_timestamps = false 2 | # Load them one by one. They can pull in a lot of memory. 3 | start = ScriptVersion.last.id 4 | start.downto(1).each do |id| 5 | sv = ScriptVersion.find(id) 6 | puts sv.id 7 | sv.save(validate: false) 8 | end 9 | ScriptVersion.record_timestamps = true 10 | -------------------------------------------------------------------------------- /shellscripts/clear_cached_pages.sh: -------------------------------------------------------------------------------- 1 | find /www/greasyfork/shared/tmp/cached_pages/ -mmin +60 -type f -delete 2>/dev/null 2 | find /www/greasyfork/shared/tmp/cached_pages/ -mindepth 1 -type d -empty -delete 2>/dev/null 3 | -------------------------------------------------------------------------------- /shellscripts/update_counts_aggregate.sh: -------------------------------------------------------------------------------- 1 | echo "Starting at `date`" >> ../log/update_counts_aggregate.log 2 | mysql < ./update_counts_aggregate.sql >> ../log/update_counts_aggregate.log 2>&1 3 | echo "Done at `date`" >> ../log/update_counts_aggregate.log 4 | -------------------------------------------------------------------------------- /shellscripts/update_fan_counts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MAILTO="jason.barnabe@gmail.com" 4 | 5 | echo "Starting at `date`" >> ../log/update_fan_counts.log 6 | mysql < ./update_fan_counts.sql >> ../log/update_fan_counts.log 2>&1 7 | # Should also reindex after this, but we let update_install_counts.sh do it as it finishes after us. 8 | echo "Done at `date`" >> ../log/update_fan_counts.log 9 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/test/controllers/.keep -------------------------------------------------------------------------------- /test/controllers/users_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ScriptsControllerTest < ActionDispatch::IntegrationTest 4 | test 'render user as json' do 5 | get user_url(users(:consumer), locale: :en, format: :json, host: 'api.greasyfork.local') 6 | assert_response :ok 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/test/fixtures/.keep -------------------------------------------------------------------------------- /test/fixtures/allowed_requires.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | # This model initially had no columns defined. If you add columns to the 4 | # model remove the '{}' from the fixture names and add the columns immediately 5 | # below each fixture, per the syntax in the comments below 6 | # 7 | one: 8 | pattern: ^https?:\/\/ajax\.googleapis\.com/\.* 9 | name: Google Hosted Libraries 10 | -------------------------------------------------------------------------------- /test/fixtures/antifeatures.yml: -------------------------------------------------------------------------------- 1 | antifeatures_ads: 2 | script_id: 22 3 | antifeature_type: ads 4 | description: this has ads 5 | 6 | style_antifeatures_ads: 7 | script_id: 24 8 | antifeature_type: ads 9 | description: this has ads 10 | -------------------------------------------------------------------------------- /test/fixtures/blocked_script_texts.yml: -------------------------------------------------------------------------------- 1 | first: 2 | text: badguytext 3 | public_reason: Test value 4 | private_reason: Just for testing 5 | result: review 6 | 7 | second: 8 | text: horribleguytext 9 | public_reason: Test value 10 | private_reason: Just for testing 11 | result: ban 12 | -------------------------------------------------------------------------------- /test/fixtures/blocked_script_urls.yml: -------------------------------------------------------------------------------- 1 | first: 2 | url: https://example.com/unique-test-value 3 | public_reason: Test value 4 | private_reason: Just for testing -------------------------------------------------------------------------------- /test/fixtures/browsers.yml: -------------------------------------------------------------------------------- 1 | firefox: 2 | id: 1 3 | code: firefox 4 | name: Firefox 5 | 6 | chrome: 7 | id: 2 8 | code: chrome 9 | name: Chrome 10 | 11 | opera: 12 | id: 3 13 | code: opera 14 | name: Opera 15 | -------------------------------------------------------------------------------- /test/fixtures/conversations.yml: -------------------------------------------------------------------------------- 1 | geoff_and_junior: 2 | users: 3 | - geoff 4 | - junior 5 | -------------------------------------------------------------------------------- /test/fixtures/discussion_categories.yml: -------------------------------------------------------------------------------- 1 | greasyfork: 2 | category_key: greasyfork 3 | 4 | development: 5 | category_key: development 6 | 7 | requests: 8 | category_key: requests 9 | 10 | script-discussions: 11 | category_key: script-discussions -------------------------------------------------------------------------------- /test/fixtures/discussions.yml: -------------------------------------------------------------------------------- 1 | script_discussion: 2 | script_id: 1 3 | poster_id: 3 4 | rating: 0 5 | discussion_category: script-discussions 6 | stat_last_reply_date: <%= Time.now %> 7 | stat_first_comment: script_comment 8 | locale_id: 1 9 | 10 | non_script_discussion: 11 | title: discussing something 12 | poster_id: 1 13 | discussion_category: greasyfork 14 | stat_last_reply_date: <%= Time.now %> 15 | stat_first_comment: non_script_comment 16 | locale_id: 1 17 | -------------------------------------------------------------------------------- /test/fixtures/files/blacklogo16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/test/fixtures/files/blacklogo16.png -------------------------------------------------------------------------------- /test/fixtures/messages.yml: -------------------------------------------------------------------------------- 1 | geoff_and_junior_1: 2 | conversation: geoff_and_junior 3 | poster_id: 3 4 | content: This is my message 5 | content_markup: html 6 | -------------------------------------------------------------------------------- /test/fixtures/redirect_service_domains.yml: -------------------------------------------------------------------------------- 1 | bit.ly: 2 | domain: bit.ly 3 | 4 | bit.do: 5 | domain: bit.do 6 | 7 | cutt.ly: 8 | domain: cutt.ly 9 | -------------------------------------------------------------------------------- /test/fixtures/reports.yml: -------------------------------------------------------------------------------- 1 | derivative_with_same_name_report: 2 | item_type: Script 3 | item_id: 20 4 | reason: spam 5 | reporter_id: 3 6 | explanation: This is total spam! 7 | explanation_markup: markdown -------------------------------------------------------------------------------- /test/fixtures/roles.yml: -------------------------------------------------------------------------------- 1 | admin: 2 | id: 1 3 | name: Administrator 4 | 5 | moderator: 6 | id: 2 7 | name: Moderator 8 | -------------------------------------------------------------------------------- /test/fixtures/roles_users.yml: -------------------------------------------------------------------------------- 1 | admin: 2 | user_id: 6 3 | role_id: 1 4 | 5 | admin_mod: 6 | user_id: 6 7 | role_id: 2 8 | 9 | mod: 10 | user_id: 7 11 | role_id: 2 12 | -------------------------------------------------------------------------------- /test/fixtures/script_applies_tos.yml: -------------------------------------------------------------------------------- 1 | example_com_application: 2 | script_id: 25 3 | site_application: example_com_application 4 | -------------------------------------------------------------------------------- /test/fixtures/script_sets.yml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/fixtures/script_similarities.yml: -------------------------------------------------------------------------------- 1 | one: 2 | script_id: 1 3 | other_script_id: 2 4 | similarity: 0.8 5 | checked_at: <%= 1.day.ago %> -------------------------------------------------------------------------------- /test/fixtures/sensitive_sites.yml: -------------------------------------------------------------------------------- 1 | pornonthecob: 2 | domain: pornonthecob.com 3 | -------------------------------------------------------------------------------- /test/fixtures/site_applications.yml: -------------------------------------------------------------------------------- 1 | example_com_application: 2 | text: example.com 3 | domain_text: example.com 4 | -------------------------------------------------------------------------------- /test/fixtures/spammy_email_domains.yml: -------------------------------------------------------------------------------- 1 | derspamhaus: 2 | domain: derspamhaus.de 3 | block_type: block_script 4 | 5 | fishyhut: 6 | domain: fishy.hut 7 | block_type: confirmation 8 | 9 | reallybademail: 10 | domain: reallybademail.com 11 | block_type: block_register -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/test/helpers/.keep -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/test/integration/.keep -------------------------------------------------------------------------------- /test/jobs/script_duplicate_checker_job_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ScriptDuplicateCheckerJobTest < ActiveSupport::TestCase 4 | test 'no exceptions' do 5 | assert_no_error_reported do 6 | ScriptDuplicateCheckerJob.perform_inline(scripts(:one).id) 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /test/jobs/stat_ban_checking_job_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | require 'google_analytics' 3 | 4 | class StatBanCheckingJobTest < ActiveSupport::TestCase 5 | test 'no exceptions' do 6 | assert_no_error_reported do 7 | GoogleAnalytics.expects(:report_installs).returns({}).at_least_once 8 | StatBanCheckingJob.perform_inline 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/test/mailers/.keep -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greasyfork-org/greasyfork/436ea20b3b090125788c4821d686feeb8e95c841/test/models/.keep -------------------------------------------------------------------------------- /test/system/admin/ads_test.rb: -------------------------------------------------------------------------------- 1 | require 'application_system_test_case' 2 | 3 | class AdminAdsTest < ApplicationSystemTestCase 4 | test 'loading the pending page' do 5 | login_as(users(:admin), scope: :user) 6 | assert_no_error_reported do 7 | visit pending_admin_ads_url 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /test/system/discussions/listing_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | module Discussions 4 | class ListingTest < ApplicationSystemTestCase 5 | test 'default' do 6 | assert_no_error_reported do 7 | visit discussions_path 8 | end 9 | end 10 | 11 | test 'sort by discussion date' do 12 | visit discussions_path 13 | click_link 'Discussion start date' 14 | assert_no_link 'Discussion start date' 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /test/system/helps_test.rb: -------------------------------------------------------------------------------- 1 | require 'application_system_test_case' 2 | 3 | class HelpsTest < ApplicationSystemTestCase 4 | test '/help/external-scripts' do 5 | visit help_external_scripts_url 6 | assert_selector 'p', text: 'User scripts have the technical ability to load and execute other scripts.' 7 | end 8 | 9 | test '/help/cdns' do 10 | visit help_cdns_url 11 | assert_selector 'p', text: 'This is a list of CDNs' 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /test/system/scripts/derivatives_test.rb: -------------------------------------------------------------------------------- 1 | require 'application_system_test_case' 2 | 3 | class DerivativesTest < ApplicationSystemTestCase 4 | include ActiveJob::TestHelper 5 | 6 | test 'script derivatives' do 7 | script = Script.find(1) 8 | login_as(script.users.first, scope: :user) 9 | visit derivatives_script_url(script, locale: :en) 10 | click_on 'Recheck now' 11 | assert_content 'Similarity check will be completed in a few minutes.' 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /test/system/users/list_test.rb: -------------------------------------------------------------------------------- 1 | require 'application_system_test_case' 2 | 3 | module Users 4 | class ListTest < ::ApplicationSystemTestCase 5 | test 'can list users' do 6 | User.expects(:search).returns(User.all.paginate(page: 1)) 7 | 8 | visit users_path 9 | assert_content 'Gordon J. Canada' 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/system/users/show_test.rb: -------------------------------------------------------------------------------- 1 | require 'application_system_test_case' 2 | 3 | module Users 4 | class ShowTest < ::ApplicationSystemTestCase 5 | test 'can show a user' do 6 | visit user_path(id: users(:consumer)) 7 | assert_content 'Gordon J. Canada' 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import RubyPlugin from 'vite-plugin-ruby' 3 | import { compression } from 'vite-plugin-compression2' 4 | 5 | export default defineConfig({ 6 | plugins: [ 7 | RubyPlugin(), 8 | compression(), 9 | compression({ algorithm: 'brotliCompress' }) 10 | ], 11 | }) 12 | --------------------------------------------------------------------------------