From b2483634a47f6cbc301955ff729d5a6016f5ba3d Mon Sep 17 00:00:00 2001 From: f Date: Thu, 1 Feb 2024 18:18:50 -0300 Subject: [PATCH 01/48] feat: empresa recuperada #15092 --- db/seeds/designs.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/db/seeds/designs.yml b/db/seeds/designs.yml index d1ae458e..2b7b6492 100644 --- a/db/seeds/designs.yml +++ b/db/seeds/designs.yml @@ -91,6 +91,14 @@ description_en: "We're working towards adding more themes for you to use. [Contact us!](https://sutty.nl/en/#contact)" description_es: "Estamos trabajando para que puedas tener más diseños. [¡Escribinos!](https://sutty.nl/#contacto)" priority: '3' +- name_en: 'Worker-recovered factory' + name_es: 'Empresa recuperada' + gem: 'empresa-recuperada-jekyll-theme' + url: 'https://empresa-recuperada.sutty.nl/' + disabled: true + description_en: "A template for [empresas recuperadas](https://en.wikipedia.org/wiki/Workers%27_self-management#Empresas_recuperadas_movement). We're working towards adding more themes for you to use. [Contact us!](https://sutty.nl/en/#contact)" + description_es: "Estamos trabajando para que puedas tener más diseños. [¡Escribinos!](https://sutty.nl/#contacto)" + priority: '3' - name_en: 'More themes' name_es: 'Más plantillas' gem: 'sutty-theme-own' From a27d68cf544d1d9d5459e32c4b2059ef0f6dbeb5 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 26 Mar 2024 12:28:19 -0300 Subject: [PATCH 02/48] fix: las llaves estaban mal nombradas!! #13578 --- app/views/env/index.js.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/env/index.js.haml b/app/views/env/index.js.haml index 597ba53f..8627fa4f 100644 --- a/app/views/env/index.js.haml +++ b/app/views/env/index.js.haml @@ -2,7 +2,7 @@ = cache @site do :plain window.env = { - AIRBRAKE_SITE_ID: #{@site.id}, - AIRBRAKE_API_KEY: "#{@site.airbrake_api_key}", + AIRBRAKE_PROJECT_ID: #{@site.id}, + AIRBRAKE_PROJECT_KEY: "#{@site.airbrake_api_key}", PANEL_URL: "#{ENV['PANEL_URL']}" } From 2fdfbb2eaa0d56fcad9c0040c54ada83e0acccbe Mon Sep 17 00:00:00 2001 From: f Date: Tue, 26 Mar 2024 12:28:40 -0300 Subject: [PATCH 03/48] fix: si no hay sitio para el panel usar el primer sitio --- app/controllers/env_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/env_controller.rb b/app/controllers/env_controller.rb index de61c704..500cdee4 100644 --- a/app/controllers/env_controller.rb +++ b/app/controllers/env_controller.rb @@ -4,7 +4,7 @@ class EnvController < ActionController::Base skip_before_action :verify_authenticity_token def index - @site = Site.find_by_name('panel') + @site = Site.find_by_name('panel') || Site.first stale? @site if @site end From a79354ceb1223d0a952ec0a1c0dc45b1d5cc1997 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 26 Mar 2024 12:28:53 -0300 Subject: [PATCH 04/48] fix: atrasar la carga de js --- app/views/layouts/application.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 16765965..eaa15eb4 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -15,7 +15,7 @@ = csrf_meta_tags = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' = stylesheet_link_tag 'dark', rel: 'alternate stylesheet', media: 'all', 'data-turbolinks-track': 'reload', title: t('dark') - = javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' + = javascript_pack_tag 'application', 'data-turbolinks-track': 'reload', defer: true = stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' = favicon_link_tag 'sutty_cuadrada.png', rel: 'apple-touch-icon', type: 'image/png' = render 'layouts/link_rel_alternate' From b10eef7644a23e8104b9a97019f0f0ec793976bb Mon Sep 17 00:00:00 2001 From: f Date: Tue, 26 Mar 2024 13:03:46 -0300 Subject: [PATCH 05/48] =?UTF-8?q?fix:=20botones=20en=20una=20sola=20l?= =?UTF-8?q?=C3=ADnea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/posts/index.haml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 6d77b75d..9def84b0 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -125,10 +125,11 @@ %br/ = post.order %td.text-nowrap - - if @usuarie || policy(post).edit? - = link_to t('posts.edit_post'), edit_site_post_path(@site, post.path), class: 'btn btn-secondary btn-block' - - if @usuarie || policy(post).destroy? - = link_to t('posts.destroy'), site_post_path(@site, post.path), class: 'btn btn-secondary btn-block', method: :delete, data: { confirm: t('posts.confirm_destroy') } + .d-flex.flex-row.align-items-start + - if @usuarie || policy(post).edit? + = link_to t('posts.edit_post'), edit_site_post_path(@site, post.path), class: 'btn btn-secondary' + - if @usuarie || policy(post).destroy? + = link_to t('posts.destroy'), site_post_path(@site, post.path), class: 'btn btn-secondary', method: :delete, data: { confirm: t('posts.confirm_destroy') } #footnotes{ hidden: true } - @filter_params.each do |param, value| From 34a858f26a20fa0095bfb3efb02ef7252944918b Mon Sep 17 00:00:00 2001 From: f Date: Tue, 26 Mar 2024 13:08:11 -0300 Subject: [PATCH 06/48] fix: botones apaisados --- app/views/layouts/_breadcrumb.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_breadcrumb.haml b/app/views/layouts/_breadcrumb.haml index 137f086e..a946243a 100644 --- a/app/views/layouts/_breadcrumb.haml +++ b/app/views/layouts/_breadcrumb.haml @@ -13,7 +13,7 @@ %span.line-clamp-1= link_to crumb.name, crumb.url - if @current_usuarie || current_usuarie - %ul.navbar-nav + %ul.navbar-nav.flex-row - if @site&.tienda? %li.nav-item = link_to t('.tienda'), @site.tienda_url, From 263dce14358b2a71037f15f7a85e0f859c997bc0 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 26 Mar 2024 15:29:58 -0300 Subject: [PATCH 07/48] =?UTF-8?q?feat:=20poder=20traer=20algunas=20opcione?= =?UTF-8?q?s=20de=20configuraci=C3=B3n=20desde=20la=20plantilla=20#174?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 1 + Gemfile.lock | 1 + app/models/site.rb | 1 + app/models/site/default_options.rb | 44 ++++++++++++++++++++++++++++++ app/services/site_service.rb | 1 + 5 files changed, 48 insertions(+) create mode 100644 app/models/site/default_options.rb diff --git a/Gemfile b/Gemfile index 466ec079..c9f735a3 100644 --- a/Gemfile +++ b/Gemfile @@ -76,6 +76,7 @@ gem 'webpacker' gem 'yaml_db', git: 'https://0xacab.org/sutty/yaml_db.git' gem 'kaminari' gem 'device_detector' +gem 'dry-schema' # database gem 'hairtrigger' diff --git a/Gemfile.lock b/Gemfile.lock index 78563c84..7b4ac1ba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -603,6 +603,7 @@ DEPENDENCIES distributed-press-api-client (~> 0.3.0rc0) dotenv-rails down + dry-schema ed25519 email_address! exception_notification diff --git a/app/models/site.rb b/app/models/site.rb index 7b93184f..14e05e5d 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -11,6 +11,7 @@ class Site < ApplicationRecord include Site::BuildStats include Site::LayoutOrdering include Site::SocialDistributedPress + include Site::DefaultOptions include Tienda # Cifrar la llave privada que cifra y decifra campos ocultos. Sutty diff --git a/app/models/site/default_options.rb b/app/models/site/default_options.rb new file mode 100644 index 00000000..3e392782 --- /dev/null +++ b/app/models/site/default_options.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +require 'dry-schema' + +class Site + # Las opciones por defecto se aplican durante la creación del sitio y + # luego se permite a les usuaries modificarlas según quieran. Por el + # momento las opciones nuevas que aparezcan no modifican un sitio que + # ya existe. + module DefaultOptions + extend ActiveSupport::Concern + + Schema = Dry::Schema.Params do + optional(:colaboracion_anonima).value(:bool) + optional(:contact).value(:bool) + optional(:acepta_invitades).value(:bool) + optional(:slugify_mode).value(included_in?: Jekyll::Utils::SLUGIFY_MODES) + optional(:pagination).value(:bool) + end + + included do + validate :validate_options_from_theme!, if: :persisted? + + # @return [Dry::Schema::Result] + def options_from_theme + @options_from_theme ||= Schema.call(data['sutty']) + end + + def update_options_from_theme + return true if options_from_theme.to_h.blank? + + update(**options_from_theme.to_h) + end + + private + + def validate_options_from_theme! + options_from_theme.errors.each do |error| + errors.add(:default_options, "#{error.path.map(&:to_s).join('/')} #{error} (#{error.input})") + end + end + end + end +end diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 5c37cfe3..8c3ea6b6 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -27,6 +27,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do site.locales = [usuarie.lang] + I18n.available_locales site.save && + site.update_options_from_theme && site.config.write && commit_config(action: :create) && site.reset.nil? && From 0975d8d5cf90c0af5265116d38be2051b37bd169 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 26 Mar 2024 15:48:30 -0300 Subject: [PATCH 08/48] fix: no fallar si no hay ninguno --- ...20231101200026_add_default_to_distributed_press_publisher.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20231101200026_add_default_to_distributed_press_publisher.rb b/db/migrate/20231101200026_add_default_to_distributed_press_publisher.rb index ada9392f..fd833acb 100644 --- a/db/migrate/20231101200026_add_default_to_distributed_press_publisher.rb +++ b/db/migrate/20231101200026_add_default_to_distributed_press_publisher.rb @@ -5,7 +5,7 @@ class AddDefaultToDistributedPressPublisher < ActiveRecord::Migration[6.1] def up add_column :distributed_press_publishers, :default, :boolean, default: false - DistributedPressPublisher.last.update(default: true) + DistributedPressPublisher.last&.update(default: true) end def down From c501107856ff21909196a024889cfae0237d047d Mon Sep 17 00:00:00 2001 From: f Date: Wed, 27 Mar 2024 12:56:54 -0300 Subject: [PATCH 09/48] fix: indicar que no hay que reportar el error closes #15621 closes #15622 closes #15623 closes #15729 closes #15730 closes #15731 closes #15735 closes #15736 closes #15824 closes #15838 closes #15839 --- app/jobs/activity_pub/process_job.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/jobs/activity_pub/process_job.rb b/app/jobs/activity_pub/process_job.rb index d94c31e2..4d9c6869 100644 --- a/app/jobs/activity_pub/process_job.rb +++ b/app/jobs/activity_pub/process_job.rb @@ -30,6 +30,9 @@ class ActivityPub # Al generar una excepción, en lugar de seguir intentando, enviamos # el reporte. + # + # @param error [Exception] + # @return [Bool] def handle_error(error) case error when ActiveRecord::RecordInvalid then retry_in(ApplicationJob.random_wait) @@ -44,6 +47,8 @@ class ActivityPub message: 'Esta acción se canceló automáticamente, para regenerarla, volver a correr el proceso con los mismos parámetros.' }) end + + false end private From c9ef1171382e41512ef77c61fd277c9f63014ca7 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 27 Mar 2024 13:36:56 -0300 Subject: [PATCH 10/48] fix: reportar errores de ssh una sola vez closes #14339 closes #14561 closes #14662 closes #15845 closes #15846 closes #15847 closes #15848 closes #15849 closes #15855 closes #15856 closes #15857 closes #15858 closes #15859 closes #15860 closes #15861 closes #15862 closes #15863 closes #15864 closes #15865 closes #15866 closes #15867 closes #15868 closes #15869 closes #15870 closes #15871 --- app/jobs/git_push_job.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/jobs/git_push_job.rb b/app/jobs/git_push_job.rb index 3c62bee2..91589189 100644 --- a/app/jobs/git_push_job.rb +++ b/app/jobs/git_push_job.rb @@ -6,6 +6,14 @@ class GitPushJob < ApplicationJob # @param :site [Site] # @return [nil] def perform(site) - site.repository.push if site.repository.origin + site.repository.push if site.repository.origin end -end \ No newline at end of file + + # Reportar una sola vez para que podamos resolver el problema, pero + # reportarlo igual. + # + # @return [Bool] + def handle_error(error) + expire + end +end From ba3cc9cad99db093c7583e5f5d29964e2c6897a0 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 27 Mar 2024 13:42:27 -0300 Subject: [PATCH 11/48] chore: rubocop --- app/jobs/git_push_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/git_push_job.rb b/app/jobs/git_push_job.rb index 91589189..7c3eb236 100644 --- a/app/jobs/git_push_job.rb +++ b/app/jobs/git_push_job.rb @@ -13,7 +13,7 @@ class GitPushJob < ApplicationJob # reportarlo igual. # # @return [Bool] - def handle_error(error) + def handle_error(_) expire end end From 142962160a9f4a9f25fcc6f3dc5c842c9fe2f177 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 27 Mar 2024 14:06:23 -0300 Subject: [PATCH 12/48] fix: reintentar en algunos errores closes #15351 closes #15352 closes #15612 closes #15618 closes #15621 closes #15622 closes #15623 closes #15729 closes #15730 closes #15731 closes #15735 closes #15736 closes #15776 closes #15824 closes #15827 closes #15828 closes #15829 closes #15830 closes #15831 closes #15832 closes #15838 closes #15839 closes #15882 --- app/jobs/activity_pub/fetch_job.rb | 34 ++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/app/jobs/activity_pub/fetch_job.rb b/app/jobs/activity_pub/fetch_job.rb index b19d5e41..54641dbf 100644 --- a/app/jobs/activity_pub/fetch_job.rb +++ b/app/jobs/activity_pub/fetch_job.rb @@ -11,14 +11,42 @@ class ActivityPub class FetchJob < ApplicationJob self.priority = 50 + attr_reader :site, :object, :response + + # Notificar errores de JSON con el contenido, tomar los errores de + # validación y conexión como errores temporales y notificar todo lo + # demás sin reintentar. + # + # @param error [Exception] + # @return [Bool] + def handle_error(error) + case error + when FastJsonparser::ParseError + expire + + ExceptionNotifier.notify_exception(error, data: { site: site.name, object: object.uri, body: response.body }) + + false + when ActiveRecord::RecordInvalid, SocketError, SystemCallError, Net::OpenTimeout, OpenSSL::OpenSSLError + retry_in(ApplicationJob.random_wait) + + false + else + expire + + true + end + end + def perform(site:, object_id:) ActivityPub::Object.transaction do - object = ::ActivityPub::Object.find(object_id) + @site = site + @object = ::ActivityPub::Object.find(object_id) return if object.blank? return if object.activity_pubs.where(aasm_state: 'removed').count.positive? - response = site.social_inbox.dereferencer.get(uri: object.uri) + @response = site.social_inbox.dereferencer.get(uri: object.uri) # @todo Fallar cuando la respuesta no funcione? # @todo Eliminar en 410 Gone @@ -39,8 +67,6 @@ class ActivityPub # Arreglar las relaciones con actividades también ActivityPub.where(object_id: object.id).update_all(object_type: object.type, updated_at: Time.now) - rescue FastJsonparser::ParseError => e - ExceptionNotifier.notify_exception(e, data: { site: site.name, object: object.uri, body: response.body }) end end end From ca4017dbd0ff732b3ca6374103f04a5c178f506c Mon Sep 17 00:00:00 2001 From: f Date: Thu, 28 Mar 2024 10:09:20 -0300 Subject: [PATCH 13/48] =?UTF-8?q?fix:=20activejob=20usa=20su=20propio=20m?= =?UTF-8?q?=C3=A9todo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #15621 closes #15622 closes #15623 closes #15729 closes #15730 closes #15731 closes #15735 closes #15736 closes #15824 closes #15838 closes #15839 closes #15882 --- app/jobs/activity_pub/process_job.rb | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/app/jobs/activity_pub/process_job.rb b/app/jobs/activity_pub/process_job.rb index 4d9c6869..dd76a928 100644 --- a/app/jobs/activity_pub/process_job.rb +++ b/app/jobs/activity_pub/process_job.rb @@ -3,7 +3,9 @@ class ActivityPub # Procesar las actividades a medida que llegan class ProcessJob < ApplicationJob - attr_reader :body, :initial_state + attr_reader :body + + retry_on ActivityPub::RecordInvalid # Procesa la actividad en segundo plano # @@ -12,7 +14,6 @@ class ActivityPub def perform(site:, body:, initial_state: :paused) @site = site @body = body - @initial_state = initial_state ActiveRecord::Base.connection_pool.with_connection do ::ActivityPub.transaction do @@ -28,29 +29,6 @@ class ActivityPub end end - # Al generar una excepción, en lugar de seguir intentando, enviamos - # el reporte. - # - # @param error [Exception] - # @return [Bool] - def handle_error(error) - case error - when ActiveRecord::RecordInvalid then retry_in(ApplicationJob.random_wait) - else - ExceptionNotifier.notify_exception( - error, - data: { - site: site.name, - body: body, - initial_state: initial_state, - activity: original_activity, - message: 'Esta acción se canceló automáticamente, para regenerarla, volver a correr el proceso con los mismos parámetros.' - }) - end - - false - end - private # Si el objeto ya viene incorporado en la actividad o lo tenemos From 3f7f8878417bb034f97738de38d5e094bad0e65e Mon Sep 17 00:00:00 2001 From: f Date: Thu, 28 Mar 2024 10:13:13 -0300 Subject: [PATCH 14/48] fix: activejob gestiona errores por su cuenta closes #15351 closes #15352 closes #15612 closes #15618 closes #15621 closes #15622 closes #15623 closes #15729 closes #15730 closes #15731 closes #15735 closes #15736 closes #15776 closes #15824 closes #15827 closes #15828 closes #15829 closes #15830 closes #15831 closes #15832 closes #15838 closes #15839 closes #15882 --- app/jobs/activity_pub/fetch_job.rb | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/app/jobs/activity_pub/fetch_job.rb b/app/jobs/activity_pub/fetch_job.rb index 54641dbf..0a3ebf03 100644 --- a/app/jobs/activity_pub/fetch_job.rb +++ b/app/jobs/activity_pub/fetch_job.rb @@ -19,25 +19,16 @@ class ActivityPub # # @param error [Exception] # @return [Bool] - def handle_error(error) - case error - when FastJsonparser::ParseError - expire - - ExceptionNotifier.notify_exception(error, data: { site: site.name, object: object.uri, body: response.body }) - - false - when ActiveRecord::RecordInvalid, SocketError, SystemCallError, Net::OpenTimeout, OpenSSL::OpenSSLError - retry_in(ApplicationJob.random_wait) - - false - else - expire - - true - end + discard_on(FastJsonparser::ParseError) do |error| + ExceptionNotifier.notify_exception(error, data: { site: site.name, object: object.uri, body: response.body }) end + retry_on ActiveRecord::RecordInvalid + retry_on SocketError, wait: ApplicationJob.random_wait + retry_on SystemCallError, wait: ApplicationJob.random_wait + retry_on Net::OpenTimeout, wait: ApplicationJob.random_wait + retry_on OpenSSL::OpenSSLError, wait: ApplicationJob.random_wait + def perform(site:, object_id:) ActivityPub::Object.transaction do @site = site From fe51ef2193ef18e1cfcbc25bb4faef7a1a70643a Mon Sep 17 00:00:00 2001 From: f Date: Thu, 28 Mar 2024 10:15:21 -0300 Subject: [PATCH 15/48] =?UTF-8?q?fixup!=20fix:=20activejob=20usa=20su=20pr?= =?UTF-8?q?opio=20m=C3=A9todo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/activity_pub/process_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/activity_pub/process_job.rb b/app/jobs/activity_pub/process_job.rb index dd76a928..69c83e33 100644 --- a/app/jobs/activity_pub/process_job.rb +++ b/app/jobs/activity_pub/process_job.rb @@ -5,7 +5,7 @@ class ActivityPub class ProcessJob < ApplicationJob attr_reader :body - retry_on ActivityPub::RecordInvalid + retry_on ActiveRecord::RecordInvalid # Procesa la actividad en segundo plano # From 94d7b32ce6fc4e4b2fbcb89717655310876086ba Mon Sep 17 00:00:00 2001 From: f Date: Tue, 9 Apr 2024 14:16:01 -0300 Subject: [PATCH 16/48] fix: handle_error no es compatible con activejob --- app/jobs/application_job.rb | 5 +++++ app/jobs/git_push_job.rb | 12 ++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 06690c53..8b85358c 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -4,6 +4,11 @@ class ApplicationJob < ActiveJob::Base include Que::ActiveJob::JobExtensions + # Si falla por cualquier cosa informar y descartar + discard_on(Exception) do |error| + ExceptionNotifier.notify_exception(error, data: { site: site.name }) + end + private def site diff --git a/app/jobs/git_push_job.rb b/app/jobs/git_push_job.rb index 7c3eb236..260e3476 100644 --- a/app/jobs/git_push_job.rb +++ b/app/jobs/git_push_job.rb @@ -3,17 +3,13 @@ # Permite pushear los cambios cada vez que se # hacen commits en un sitio class GitPushJob < ApplicationJob + attr_reader :site + # @param :site [Site] # @return [nil] def perform(site) + @site = site + site.repository.push if site.repository.origin end - - # Reportar una sola vez para que podamos resolver el problema, pero - # reportarlo igual. - # - # @return [Bool] - def handle_error(_) - expire - end end From 6dbc8fa0c12bbfcec92b16ffaa72549dd83c5c2f Mon Sep 17 00:00:00 2001 From: f Date: Tue, 9 Apr 2024 14:16:27 -0300 Subject: [PATCH 17/48] fix: reintentar compilaciones --- app/jobs/deploy_job.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index 3044b59f..6765bb89 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -11,13 +11,8 @@ class DeployJob < ApplicationJob # Lanzar lo antes posible self.priority = 10 - def handle_error(error) - case error - when DeployAlreadyRunningException then retry_in 1.minute - when DeployTimedOutException then expire - else super - end - end + retry_on DeployAlreadyRunningException, wait: 1.minute + discard_on DeployTimedOutException # rubocop:disable Metrics/MethodLength def perform(site, notify: true, time: Time.now, output: false) From b0bf0c0c535b8c52ce6d4fafc5a3167c95322a4e Mon Sep 17 00:00:00 2001 From: f Date: Wed, 10 Apr 2024 11:00:18 -0300 Subject: [PATCH 18/48] BREAKING CHANGE: usar global ids en los jobs --- app/controllers/api/v1/contact_controller.rb | 2 +- app/controllers/api/v1/notices_controller.rb | 2 +- app/jobs/application_job.rb | 8 ++--- app/jobs/backtrace_job.rb | 9 ++---- app/jobs/contact_job.rb | 8 ++--- app/jobs/deploy_job.rb | 32 ++++++++++---------- app/jobs/git_push_job.rb | 4 --- app/jobs/maintenance_job.rb | 3 +- app/jobs/periodic_job.rb | 3 -- app/jobs/stat_collection_job.rb | 6 ++-- app/jobs/uri_collection_job.rb | 4 +-- app/mailers/application_mailer.rb | 2 +- app/mailers/deploy_mailer.rb | 3 +- app/mailers/invitadx_mailer.rb | 9 ------ app/models/log_entry.rb | 2 +- app/services/site_service.rb | 2 +- lib/tasks/stats.rake | 6 ++-- 17 files changed, 37 insertions(+), 68 deletions(-) delete mode 100644 app/mailers/invitadx_mailer.rb diff --git a/app/controllers/api/v1/contact_controller.rb b/app/controllers/api/v1/contact_controller.rb index d949dc30..c340097f 100644 --- a/app/controllers/api/v1/contact_controller.rb +++ b/app/controllers/api/v1/contact_controller.rb @@ -18,7 +18,7 @@ module Api # Si todo salió bien, enviar los correos y redirigir al sitio. # El sitio nos dice a dónde tenemos que ir. - ContactJob.perform_later site.id, + ContactJob.perform_later site, params[:form], contact_params.to_h.symbolize_keys, params[:redirect] diff --git a/app/controllers/api/v1/notices_controller.rb b/app/controllers/api/v1/notices_controller.rb index 8f384f1a..01bec517 100644 --- a/app/controllers/api/v1/notices_controller.rb +++ b/app/controllers/api/v1/notices_controller.rb @@ -11,7 +11,7 @@ module Api # respondemos con lo mismo. def create if (site&.airbrake_valid? airbrake_token) && !detected_device.bot? - BacktraceJob.perform_later site_id: params[:site_id], + BacktraceJob.perform_later site: site, params: airbrake_params.to_h end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 8b85358c..66345949 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -4,14 +4,10 @@ class ApplicationJob < ActiveJob::Base include Que::ActiveJob::JobExtensions + attr_reader :site + # Si falla por cualquier cosa informar y descartar discard_on(Exception) do |error| ExceptionNotifier.notify_exception(error, data: { site: site.name }) end - - private - - def site - @site ||= Site.find @params[:site_id] - end end diff --git a/app/jobs/backtrace_job.rb b/app/jobs/backtrace_job.rb index 97e6007b..830dc9b3 100644 --- a/app/jobs/backtrace_job.rb +++ b/app/jobs/backtrace_job.rb @@ -6,10 +6,9 @@ class BacktraceJob < ApplicationJob EMPTY_SOURCEMAP = { 'mappings' => '' }.freeze - attr_reader :params, :site_id + attr_reader :params - def perform(site_id:, params:) - @site_id = site_id + def perform(site:, params:) @params = params unless sources.empty? @@ -44,10 +43,6 @@ class BacktraceJob < ApplicationJob private - def site - @site ||= Site.find_by_id(site_id) - end - # Obtiene todos los archivos del backtrace solo si los puede descargar # desde fuentes seguras. # diff --git a/app/jobs/contact_job.rb b/app/jobs/contact_job.rb index c15d7eee..2ac80ce3 100644 --- a/app/jobs/contact_job.rb +++ b/app/jobs/contact_job.rb @@ -5,11 +5,7 @@ class ContactJob < ApplicationJob # @param [Integer] # @param [String] # @param [Hash] - def perform(site_id, form_name, form, origin = nil) - # Retrocompabilidad al actualizar a 2.7.1 - # @see ApplicationJob#site - @params = { site_id: site_id } - + def perform(site, form_name, form, origin = nil) # Sanitizar los valores form.each_key do |key| form[key] = ActionController::Base.helpers.sanitize form[key] @@ -23,7 +19,7 @@ class ContactJob < ApplicationJob usuaries.each_slice(10) do |u| ContactMailer.with(form_name: form_name, form: form, - site_id: site_id, + site: site, usuaries_emails: u, origin: origin) .notify_usuaries.deliver_now diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index 6765bb89..103656f4 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -16,34 +16,32 @@ class DeployJob < ApplicationJob # rubocop:disable Metrics/MethodLength def perform(site, notify: true, time: Time.now, output: false) - @output = output + @site = site ActiveRecord::Base.connection_pool.with_connection do - @site = Site.find(site) - # Si ya hay una tarea corriendo, aplazar esta. Si estuvo # esperando más de 10 minutos, recuperar el estado anterior. # # Como el trabajo actual se aplaza al siguiente, arrastrar la # hora original para poder ir haciendo timeouts. - if @site.building? + if site.building? notify = false if 10.minutes.ago >= time raise DeployTimedOutException, - "#{@site.name} la tarea estuvo más de 10 minutos esperando, volviendo al estado original" + "#{site.name} la tarea estuvo más de 10 minutos esperando, volviendo al estado original" else raise DeployAlreadyRunningException end end @deployed = {} - @site.update status: 'building' - @site.deployment_list.each do |d| + site.update status: 'building' + site.deployment_list.each do |d| begin raise DeployException, 'Una dependencia falló' if failed_dependencies? d - status = d.deploy(output: @output) + status = d.deploy(output: output) seconds = d.build_stats.last.try(:seconds) || 0 size = d.size urls = d.urls.map do |url| @@ -52,7 +50,7 @@ class DeployJob < ApplicationJob nil end.compact - if d == @site.deployment_list.last && !status + if d == site.deployment_list.last && !status raise DeployException, 'Falló la compilación' end rescue StandardError => e @@ -73,7 +71,7 @@ class DeployJob < ApplicationJob } end - return unless @output + return unless output puts (Terminal::Table.new do |t| t << (%w[type] + @deployed.values.first.keys) @@ -83,12 +81,12 @@ class DeployJob < ApplicationJob end end) ensure - if @site.present? - @site.update status: 'waiting' + if site.present? + site.update status: 'waiting' notify_usuaries if notify - puts "\a" if @output + puts "\a" if output end end end @@ -118,7 +116,7 @@ class DeployJob < ApplicationJob # @param :deploy [Deploy] def notify_exception(exception, deploy = nil) data = { - site: @site.id, + site: site.name, deploy: deploy&.type, log: deploy&.build_stats&.last&.log, failed_dependencies: (failed_dependencies(deploy) if deploy) @@ -128,8 +126,10 @@ class DeployJob < ApplicationJob end def notify_usuaries - @site.roles.where(rol: 'usuarie', temporal: false).pluck(:usuarie_id).each do |usuarie| - DeployMailer.with(usuarie: usuarie, site: @site.id) + usuarie_ids = site.roles.where(rol: 'usuarie', temporal: false).pluck(:usuarie_id) + + Usuarie.where(id: usuarie_ids).find_each do |usuarie| + DeployMailer.with(usuarie_id: usuarie, site: site) .deployed(@deployed) .deliver_now end diff --git a/app/jobs/git_push_job.rb b/app/jobs/git_push_job.rb index 260e3476..d8c811ba 100644 --- a/app/jobs/git_push_job.rb +++ b/app/jobs/git_push_job.rb @@ -3,13 +3,9 @@ # Permite pushear los cambios cada vez que se # hacen commits en un sitio class GitPushJob < ApplicationJob - attr_reader :site - # @param :site [Site] # @return [nil] def perform(site) - @site = site - site.repository.push if site.repository.origin end end diff --git a/app/jobs/maintenance_job.rb b/app/jobs/maintenance_job.rb index c7a962f9..02f29a77 100644 --- a/app/jobs/maintenance_job.rb +++ b/app/jobs/maintenance_job.rb @@ -15,8 +15,7 @@ # Lo mismo para salir de mantenimiento, agregando el atributo # are_we_back: true al crear el Maintenance. class MaintenanceJob < ApplicationJob - def perform(maintenance_id:) - maintenance = Maintenance.find(maintenance_id) + def perform(maintenance:) # Decidir cuál vamos a enviar según el estado de Maintenance mailer = maintenance.are_we_back ? :were_back : :notice diff --git a/app/jobs/periodic_job.rb b/app/jobs/periodic_job.rb index 2f60a2b3..f66434c9 100644 --- a/app/jobs/periodic_job.rb +++ b/app/jobs/periodic_job.rb @@ -6,9 +6,6 @@ class PeriodicJob < ApplicationJob STARTING_INTERVAL = Stat::INTERVALS.first - # Tener el sitio a mano - attr_reader :site - # Descartar y notificar si pasó algo más. # # XXX: En realidad deberíamos seguir reintentando? diff --git a/app/jobs/stat_collection_job.rb b/app/jobs/stat_collection_job.rb index e402e3b5..02752901 100644 --- a/app/jobs/stat_collection_job.rb +++ b/app/jobs/stat_collection_job.rb @@ -7,8 +7,8 @@ class StatCollectionJob < PeriodicJob STAT_NAME = 'stat_collection_job' - def perform(site_id:, once: true) - @site = Site.find site_id + def perform(site:, once: true) + @site = site beginning = beginning_of_interval stat = site.stats.create! name: STAT_NAME @@ -22,7 +22,7 @@ class StatCollectionJob < PeriodicJob rollup.average(:seconds) end - dimensions = { site_id: site_id } + dimensions = { site_id: site.id } reduce_rollup(name: 'builds', operation: :sum, dimensions: dimensions) reduce_rollup(name: 'space_used', operation: :average, dimensions: dimensions) diff --git a/app/jobs/uri_collection_job.rb b/app/jobs/uri_collection_job.rb index 4cbbf593..92d788bc 100644 --- a/app/jobs/uri_collection_job.rb +++ b/app/jobs/uri_collection_job.rb @@ -16,8 +16,8 @@ class UriCollectionJob < PeriodicJob IMAGES = %w[.png .jpg .jpeg .gif .webp .jfif].freeze STAT_NAME = 'uri_collection_job' - def perform(site_id:, once: true) - @site = Site.find site_id + def perform(site:, once: true) + @site = site # Obtener el principio del intervalo anterior beginning_of_interval diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 8369550d..1f1d453e 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -10,7 +10,7 @@ class ApplicationMailer < ActionMailer::Base private def site - @site ||= Site.find @params[:site_id] + @site ||= @params[:site] end def inline_logo! diff --git a/app/mailers/deploy_mailer.rb b/app/mailers/deploy_mailer.rb index 37748b42..abf6932c 100644 --- a/app/mailers/deploy_mailer.rb +++ b/app/mailers/deploy_mailer.rb @@ -13,8 +13,7 @@ class DeployMailer < ApplicationMailer # rubocop:disable Metrics/AbcSize def deployed(deploys = {}) - usuarie = Usuarie.find(params[:usuarie]) - site = usuarie.sites.find(params[:site]) + usuarie = params[:usuarie] hostname = site.hostname deploys ||= {} diff --git a/app/mailers/invitadx_mailer.rb b/app/mailers/invitadx_mailer.rb deleted file mode 100644 index cfb80a55..00000000 --- a/app/mailers/invitadx_mailer.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class InvitadxMailer < ApplicationMailer - def confirmation_required - @invitadx = params[:invitadx] - @site = params[:site] - mail from: "#{@site.config.dig('title')} <#{ENV.fetch('DEFAULT_FROM', 'sutty@kefir.red')}>", to: @invitadx.email, subject: t('.subject') - end -end diff --git a/app/models/log_entry.rb b/app/models/log_entry.rb index 9685e0d0..7525177a 100644 --- a/app/models/log_entry.rb +++ b/app/models/log_entry.rb @@ -11,7 +11,7 @@ class LogEntry < ApplicationRecord def resend return if sent - ContactJob.perform_later site_id, params[:form], params + ContactJob.perform_later site, params[:form], params end def params diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 5c37cfe3..3a6b36f7 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -5,7 +5,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do def deploy site.enqueue! - DeployJob.perform_later site.id + DeployJob.perform_later site end # Crea un sitio, agrega un rol nuevo y guarda los cambios a la diff --git a/lib/tasks/stats.rake b/lib/tasks/stats.rake index 9461782a..fbcb5fa4 100644 --- a/lib/tasks/stats.rake +++ b/lib/tasks/stats.rake @@ -3,9 +3,9 @@ namespace :stats do desc 'Process stats' task process_all: :environment do - Site.all.pluck(:id).each do |site_id| - UriCollectionJob.perform_now site_id: site_id, once: true - StatCollectionJob.perform_now site_id: site_id, once: true + Site.all.find_each do |site| + UriCollectionJob.perform_now site: site, once: true + StatCollectionJob.perform_now site: site, once: true end end end From 53fe2847a1ca5adb96776bb2b74730ec51de1b81 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 10 Apr 2024 13:22:17 -0300 Subject: [PATCH 19/48] fixup! BREAKING CHANGE: usar global ids en los jobs --- app/jobs/deploy_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index 103656f4..f84dc55c 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -129,7 +129,7 @@ class DeployJob < ApplicationJob usuarie_ids = site.roles.where(rol: 'usuarie', temporal: false).pluck(:usuarie_id) Usuarie.where(id: usuarie_ids).find_each do |usuarie| - DeployMailer.with(usuarie_id: usuarie, site: site) + DeployMailer.with(usuarie: usuarie, site: site) .deployed(@deployed) .deliver_now end From 7a71e1de8856f241e271d14ff3cf04c28544ed8a Mon Sep 17 00:00:00 2001 From: f Date: Fri, 12 Apr 2024 15:31:47 -0300 Subject: [PATCH 20/48] fix: no fallar si no hay sitio #16007 --- app/jobs/application_job.rb | 2 +- app/jobs/backtrace_job.rb | 1 + app/jobs/contact_job.rb | 2 ++ app/jobs/git_pull_job.rb | 2 ++ app/jobs/git_push_job.rb | 2 ++ 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 66345949..37ec0f76 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -8,6 +8,6 @@ class ApplicationJob < ActiveJob::Base # Si falla por cualquier cosa informar y descartar discard_on(Exception) do |error| - ExceptionNotifier.notify_exception(error, data: { site: site.name }) + ExceptionNotifier.notify_exception(error, data: { site: @site&.name }) end end diff --git a/app/jobs/backtrace_job.rb b/app/jobs/backtrace_job.rb index 830dc9b3..5e9a05cf 100644 --- a/app/jobs/backtrace_job.rb +++ b/app/jobs/backtrace_job.rb @@ -9,6 +9,7 @@ class BacktraceJob < ApplicationJob attr_reader :params def perform(site:, params:) + @site = site @params = params unless sources.empty? diff --git a/app/jobs/contact_job.rb b/app/jobs/contact_job.rb index 2ac80ce3..d4c2677f 100644 --- a/app/jobs/contact_job.rb +++ b/app/jobs/contact_job.rb @@ -6,6 +6,8 @@ class ContactJob < ApplicationJob # @param [String] # @param [Hash] def perform(site, form_name, form, origin = nil) + @site = site + # Sanitizar los valores form.each_key do |key| form[key] = ActionController::Base.helpers.sanitize form[key] diff --git a/app/jobs/git_pull_job.rb b/app/jobs/git_pull_job.rb index 58a4e6b1..72e20be0 100644 --- a/app/jobs/git_pull_job.rb +++ b/app/jobs/git_pull_job.rb @@ -7,6 +7,8 @@ class GitPullJob < ApplicationJob # @param :usuarie [Usuarie] # @return [nil] def perform(site, usuarie) + @site = site + return unless site.repository.origin return unless site.repository.fetch.positive? diff --git a/app/jobs/git_push_job.rb b/app/jobs/git_push_job.rb index d8c811ba..4df9f5aa 100644 --- a/app/jobs/git_push_job.rb +++ b/app/jobs/git_push_job.rb @@ -6,6 +6,8 @@ class GitPushJob < ApplicationJob # @param :site [Site] # @return [nil] def perform(site) + @site = site + site.repository.push if site.repository.origin end end From 4ccf37c370cdb3eac19b1ae8b1d222e3a8b7d52c Mon Sep 17 00:00:00 2001 From: f Date: Mon, 15 Apr 2024 11:54:28 -0300 Subject: [PATCH 21/48] =?UTF-8?q?fix:=20informar=20la=20tarea=20que=20fall?= =?UTF-8?q?=C3=B3=20de=20forma=20gen=C3=A9rica?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #16052 closes #16058 closes #16059 --- app/jobs/application_job.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 37ec0f76..d527c9b9 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -7,7 +7,7 @@ class ApplicationJob < ActiveJob::Base attr_reader :site # Si falla por cualquier cosa informar y descartar - discard_on(Exception) do |error| - ExceptionNotifier.notify_exception(error, data: { site: @site&.name }) + discard_on(Exception) do |job, error| + ExceptionNotifier.notify_exception(error, data: { job: job }) end end From fb4228b873e5e1873b82c38498c18f992df73fdb Mon Sep 17 00:00:00 2001 From: f Date: Mon, 15 Apr 2024 16:58:55 -0300 Subject: [PATCH 22/48] =?UTF-8?q?fix:=20no=20filtrar=20informaci=C3=B3n=20?= =?UTF-8?q?privada!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/application_record.rb | 7 +++++++ config/initializers/filter_parameter_logging.rb | 1 + 2 files changed, 8 insertions(+) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 71fbba5b..27ed3d56 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -2,4 +2,11 @@ class ApplicationRecord < ActiveRecord::Base self.abstract_class = true + + # Obtener una lista filtrada de atributos al momento de serializar + # + # @return [Hash] + def to_yaml(options = {}) + self.class.inspection_filter.filter attributes + end end diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 2fc446ff..8ef6ca49 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -5,4 +5,5 @@ # Configure sensitive parameters which will be filtered from the log file. Rails.application.config.filter_parameters += %i[ password passw secret token _key crypt salt certificate otp ssn key + _pem _ciphertext ] From 7f437f9e0659ae648c9d90e4c3ebf1d8ac760a3f Mon Sep 17 00:00:00 2001 From: f Date: Mon, 15 Apr 2024 17:00:58 -0300 Subject: [PATCH 23/48] =?UTF-8?q?fix:=20filtrar=20informaci=C3=B3n=20perso?= =?UTF-8?q?nal=20tambi=C3=A9n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/initializers/filter_parameter_logging.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 8ef6ca49..b1d9f2b0 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -5,5 +5,5 @@ # Configure sensitive parameters which will be filtered from the log file. Rails.application.config.filter_parameters += %i[ password passw secret token _key crypt salt certificate otp ssn key - _pem _ciphertext + _pem _ciphertext email ] From e8cf50b9d22154294b7ca03782d9ffa001273467 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 15 Apr 2024 17:10:19 -0300 Subject: [PATCH 24/48] fix: convertir a yaml --- app/models/application_record.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 27ed3d56..985df966 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -5,8 +5,8 @@ class ApplicationRecord < ActiveRecord::Base # Obtener una lista filtrada de atributos al momento de serializar # - # @return [Hash] + # @return [String] def to_yaml(options = {}) - self.class.inspection_filter.filter attributes + self.class.inspection_filter.filter(attributes).to_yaml(options) end end From 83add8dd7def7b58dfb741d5c51106576f3a0882 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 15 Apr 2024 17:26:40 -0300 Subject: [PATCH 25/48] =?UTF-8?q?fix:=20usar=20una=20versi=C3=B3n=20m?= =?UTF-8?q?=C3=A1s=20corta=20del=20hash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/application_record.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 985df966..f09c4dd4 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -7,6 +7,6 @@ class ApplicationRecord < ActiveRecord::Base # # @return [String] def to_yaml(options = {}) - self.class.inspection_filter.filter(attributes).to_yaml(options) + self.class.inspection_filter.filter(serializable_hash).to_yaml(options) end end From 2eb3145e1cf20581216b1ddcecebe6ee57f41e45 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 15 Apr 2024 17:28:30 -0300 Subject: [PATCH 26/48] fix: los atributos filtrados son por modelo --- app/models/site.rb | 2 ++ app/models/usuarie.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/models/site.rb b/app/models/site.rb index 7b93184f..c47a14a2 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -13,6 +13,8 @@ class Site < ApplicationRecord include Site::SocialDistributedPress include Tienda + self.filter_attributes += [/_key/, /_ciphertext\z/] + # Cifrar la llave privada que cifra y decifra campos ocultos. Sutty # tiene acceso pero los datos se guardan cifrados en el sitio. Esto # protege información privada en repositorios públicos, pero no la diff --git a/app/models/usuarie.rb b/app/models/usuarie.rb index 42f20c0b..4eba314a 100644 --- a/app/models/usuarie.rb +++ b/app/models/usuarie.rb @@ -21,6 +21,8 @@ class Usuarie < ApplicationRecord has_many :blazer_audits, foreign_key: 'user_id', class_name: 'Blazer::Audit' has_many :blazer_queries, foreign_key: 'creator_id', class_name: 'Blazer::Query' + self.filter_attributes += [/\Aemail\z/, /\Aencrypted_password\z/] + def name email.split('@', 2).first end From 452ca435081af9d29af1b1a03e2d99a221588942 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 19 Apr 2024 13:07:49 -0300 Subject: [PATCH 27/48] =?UTF-8?q?fix:=20doble=20negaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/components/_profiles_btn_box.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/components/_profiles_btn_box.haml b/app/views/components/_profiles_btn_box.haml index 8fc8dd39..2023de96 100644 --- a/app/views/components/_profiles_btn_box.haml +++ b/app/views/components/_profiles_btn_box.haml @@ -2,7 +2,7 @@ .d-flex.flex-row.w-100 - local = { report: { class: 'ml-auto', data: { confirm: t('.confirm_report') } } } - ActorModeration.events.each do |actor_event| - - possible = !actor_moderation.public_send(:"may_#{actor_event}?") + - possible = actor_moderation.public_send(:"may_#{actor_event}?") %div{ class: local.dig(actor_event, :class) } = render 'components/btn_base', text: t(".text_#{actor_event}"), From 8de05ccce6d2d7e9cfc8e509350bc0d6d1675311 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 22 Apr 2024 14:54:40 -0300 Subject: [PATCH 28/48] fix: solo permitir los mismos tipos de archivo que jekyll closes #16117 --- app/lib/jekyll/readers/data_reader_decorator.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/lib/jekyll/readers/data_reader_decorator.rb b/app/lib/jekyll/readers/data_reader_decorator.rb index 9fed7ac7..2a2a8fc2 100644 --- a/app/lib/jekyll/readers/data_reader_decorator.rb +++ b/app/lib/jekyll/readers/data_reader_decorator.rb @@ -14,6 +14,8 @@ module Jekyll extend ActiveSupport::Concern included do + DATA_EXTENSIONS = %w[.yaml .yml .json .csv .tsv].freeze + def read_data_to(dir, data) return unless File.directory?(dir) && !@entry_filter.symlink?(dir) @@ -24,7 +26,7 @@ module Jekyll if File.directory?(path) read_data_to(path, data[sanitize_filename(entry)] = {}) - else + elsif DATA_EXTENSIONS.include?(File.extname(entry)) key = sanitize_filename(File.basename(entry, ".*")) data[key] = read_data_file(path) end From 4f12d1211824ca2cd6652001aadf5592f5396a48 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 2 May 2024 15:49:20 -0300 Subject: [PATCH 29/48] ci: usar los locks para identificar la cache [skip ci] --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bb674844..dceb1a42 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,9 +6,15 @@ - paths: - "vendor/ruby" - ".bundle" + key: + files: + - "Gemfile.lock" .cache-node: &cache-node - paths: - "node_modules" + key: + files: + - "yarn.lock" .cache-task: &cache-task - paths: - ".task" From 9c0ea76c219fc5db9d2972e3118418bcd7f01d31 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 2 May 2024 15:54:54 -0300 Subject: [PATCH 30/48] ci: instalar gemas [skip ci] --- Taskfile.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Taskfile.yaml b/Taskfile.yaml index 57fb0238..796ab721 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -185,9 +185,13 @@ tasks: - "test -f ../hain/usr/bin/bundler-audit" rubocop: desc: "Ruby linting" + deps: + - "gems" cmds: - "./bin/modified_files | ./bin/with_extension rb | xargs -r {{.HAINISH}} bundle exec rubocop {{.CLI_ARGS}}" haml-lint: desc: "HAML linting" + deps: + - "gems" cmds: - "./bin/modified_files | ./bin/with_extension haml | xargs -r {{.HAINISH}} bundle exec haml-lint {{.CLI_ARGS}}" From 8fba98f9fd0da1a1e5949e5a729d4de8d74059f8 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 2 May 2024 15:57:49 -0300 Subject: [PATCH 31/48] chore: rubocop --- app/jobs/backtrace_job.rb | 4 +--- app/jobs/deploy_job.rb | 17 +++++++---------- app/models/site.rb | 18 +++++++++--------- app/models/usuarie.rb | 10 +++++----- app/services/site_service.rb | 4 +--- 5 files changed, 23 insertions(+), 30 deletions(-) diff --git a/app/jobs/backtrace_job.rb b/app/jobs/backtrace_job.rb index 5e9a05cf..4ef5287c 100644 --- a/app/jobs/backtrace_job.rb +++ b/app/jobs/backtrace_job.rb @@ -55,9 +55,7 @@ class BacktraceJob < ApplicationJob x['backtrace'] end.flatten.map do |x| x['file'].split('@').last - end.uniq.select do |x| - %r{\Ahttps://} =~ x - end + end.uniq.grep(%r{\Ahttps://}) end # Descarga y devuelve los datos de un archivo diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index f84dc55c..66cccd1b 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -27,12 +27,11 @@ class DeployJob < ApplicationJob if site.building? notify = false - if 10.minutes.ago >= time - raise DeployTimedOutException, - "#{site.name} la tarea estuvo más de 10 minutos esperando, volviendo al estado original" - else - raise DeployAlreadyRunningException - end + raise DeployAlreadyRunningException unless 10.minutes.ago >= time + + raise DeployTimedOutException, + "#{site.name} la tarea estuvo más de 10 minutos esperando, volviendo al estado original" + end @deployed = {} @@ -50,9 +49,7 @@ class DeployJob < ApplicationJob nil end.compact - if d == site.deployment_list.last && !status - raise DeployException, 'Falló la compilación' - end + raise DeployException, 'Falló la compilación' if d == site.deployment_list.last && !status rescue StandardError => e status = false seconds ||= 0 @@ -73,7 +70,7 @@ class DeployJob < ApplicationJob return unless output - puts (Terminal::Table.new do |t| + puts(Terminal::Table.new do |t| t << (%w[type] + @deployed.values.first.keys) t.add_separator @deployed.each do |type, row| diff --git a/app/models/site.rb b/app/models/site.rb index e3068734..f51d2c6f 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -292,11 +292,11 @@ class Site < ApplicationRecord # layouts. Si pasamos un layout que no existe, obtenemos un # NoMethodError @layouts_struct ||= Struct.new(*layout_keys, keyword_init: true) - @layouts ||= @layouts_struct.new(**data['layouts'].map do |name, metadata| + @layouts ||= @layouts_struct.new(**data['layouts'].to_h do |name, metadata| [name.to_sym, Layout.new(site: self, name: name.to_sym, meta: metadata.delete('meta')&.with_indifferent_access, metadata: metadata.with_indifferent_access)] - end.to_h) + end) end # TODO: Si la estructura de datos no existe, vamos a producir una @@ -389,7 +389,7 @@ class Site < ApplicationRecord end def reload - super.tap do |s| + super.tap do |_s| reload_jekyll! end self @@ -479,7 +479,7 @@ class Site < ApplicationRecord def clone_skel! return if jekyll? - Rugged::Repository.clone_at(ENV['SKEL_SUTTY'], path, checkout_branch: design.gem) + Rugged::Repository.clone_at(ENV.fetch('SKEL_SUTTY', nil), path, checkout_branch: design.gem) # Necesita un bloque repository.rugged.remotes.rename('origin', 'upstream') {} @@ -579,11 +579,11 @@ class Site < ApplicationRecord deploy_local = deploys.find_by_type('DeployLocal') deploy_local.git_lfs - if !gems_installed? || gemfile_updated? || gemfile_lock_updated? - deploy_local.bundle - touch - FileUtils.touch(gemfile_path) - end + return unless !gems_installed? || gemfile_updated? || gemfile_lock_updated? + + deploy_local.bundle + touch + FileUtils.touch(gemfile_path) end def gem_path diff --git a/app/models/usuarie.rb b/app/models/usuarie.rb index 4eba314a..4856f17f 100644 --- a/app/models/usuarie.rb +++ b/app/models/usuarie.rb @@ -76,10 +76,10 @@ class Usuarie < ApplicationRecord # Si le usuarie (re)confirma su cuenta con una invitación pendiente, # considerarla aceptada también. def accept_invitation_after_confirmation! - if confirmed? - self.invitation_token = nil - self.invitation_accepted_at ||= Time.now.utc - end + return unless confirmed? + + self.invitation_token = nil + self.invitation_accepted_at ||= Time.now.utc end # Muestra un error si el idioma no está disponible al cambiar el @@ -87,7 +87,7 @@ class Usuarie < ApplicationRecord # # @return [nil] def locale_available! - return if I18n.locale_available? self.lang + return if I18n.locale_available? lang errors.add(:lang, I18n.t('activerecord.errors.models.usuarie.attributes.lang.not_available')) nil diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 3a6b36f7..a28e5ee8 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -222,9 +222,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do end end - private - - def with_all_locales(&block) + def with_all_locales site.locales.map do |locale| next unless I18n.available_locales.include? locale From b11282997b8574c093e0742b6409b4378e966df3 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 2 May 2024 16:02:34 -0300 Subject: [PATCH 32/48] fix: redundante --- app/jobs/activity_pub/fetch_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/activity_pub/fetch_job.rb b/app/jobs/activity_pub/fetch_job.rb index 0a3ebf03..5d9e02de 100644 --- a/app/jobs/activity_pub/fetch_job.rb +++ b/app/jobs/activity_pub/fetch_job.rb @@ -11,7 +11,7 @@ class ActivityPub class FetchJob < ApplicationJob self.priority = 50 - attr_reader :site, :object, :response + attr_reader :object, :response # Notificar errores de JSON con el contenido, tomar los errores de # validación y conexión como errores temporales y notificar todo lo From c2cc08007e6d3018a929e61d7727f226380c074c Mon Sep 17 00:00:00 2001 From: f Date: Thu, 2 May 2024 16:05:35 -0300 Subject: [PATCH 33/48] chore: rubocop --- app/controllers/application_controller.rb | 9 +++------ app/helpers/application_helper.rb | 4 ++-- app/jobs/activity_pub/fetch_job.rb | 3 ++- app/jobs/activity_pub/sync_lists_job.rb | 4 +++- app/jobs/application_job.rb | 4 +--- app/models/activity_pub.rb | 5 +++-- app/models/activity_pub/fediblock.rb | 4 ++-- app/models/activity_pub/object.rb | 5 +++-- app/models/activity_pub/remote_flag.rb | 5 +++-- app/models/concerns/tienda.rb | 2 +- app/models/fediblock_state.rb | 3 ++- app/models/instance_moderation.rb | 4 +++- app/models/metadata_template.rb | 2 +- app/models/social_inbox.rb | 4 ++-- app/services/site_service.rb | 2 -- config/environments/production.rb | 9 +++++---- config/initializers/que_web.rb | 2 +- db/migrate/20240227142019_create_fediblock_states.rb | 4 +--- ...0313204105_brs_decompressor_corrupted_source_error.rb | 6 ++++-- db/migrate/20240314205923_fix_activity_type.rb | 4 +++- db/migrate/20240318183846_fix_duplicate_objects.rb | 2 +- db/migrate/20240319124212_add_fedipact_to_fediblocks.rb | 4 +--- db/migrate/20240319144735_add_missing_unique_indexes.rb | 6 +++--- db/seeds.rb | 4 ++-- 24 files changed, 52 insertions(+), 49 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b76238a0..117be995 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -14,7 +14,7 @@ class ApplicationController < ActionController::Base after_action :store_location! before_action do - Rack::MiniProfiler.authorize_request if current_usuarie&.email&.ends_with?('@' + ENV.fetch('SUTTY', 'sutty.nl')) + Rack::MiniProfiler.authorize_request if current_usuarie&.email&.ends_with?("@#{ENV.fetch('SUTTY', 'sutty.nl')}") end # No tenemos índice de sutty, vamos directamente a ver el listado de @@ -24,7 +24,7 @@ class ApplicationController < ActionController::Base end private - + def notify_unconfirmed_email return unless current_usuarie return if current_usuarie.confirmed? @@ -58,9 +58,7 @@ class ApplicationController < ActionController::Base def current_locale locale = params[:change_locale_to] - if locale.present? && I18n.locale_available?(locale) - session[:locale] = params[:change_locale_to] - end + session[:locale] = params[:change_locale_to] if locale.present? && I18n.locale_available?(locale) session[:locale] || current_usuarie&.lang || I18n.locale end @@ -119,5 +117,4 @@ class ApplicationController < ActionController::Base session[:usuarie_return_to] = request.fullpath end - end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 146846f0..fcbd4074 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -13,7 +13,7 @@ module ApplicationHelper root = names.shift names.each do |n| - root += '[' + n.to_s + ']' + root += "[#{n}]" end [root, name] @@ -22,7 +22,7 @@ module ApplicationHelper def plain_field_name_for(*names) root, name = field_name_for(*names) - root + '[' + name.to_s + ']' + "#{root}[#{name}]" end def distance_of_time_in_words_if_more_than_a_minute(seconds) diff --git a/app/jobs/activity_pub/fetch_job.rb b/app/jobs/activity_pub/fetch_job.rb index 5d9e02de..07190c35 100644 --- a/app/jobs/activity_pub/fetch_job.rb +++ b/app/jobs/activity_pub/fetch_job.rb @@ -50,7 +50,8 @@ class ActivityPub content = FastJsonparser.parse(response.body) # Modificar atómicamente - ::ActivityPub::Object.lock.find(object_id).update!(content: content, type: ActivityPub::Object.type_from(content).name) + ::ActivityPub::Object.lock.find(object_id).update!(content: content, + type: ActivityPub::Object.type_from(content).name) object = ::ActivityPub::Object.find(object_id) # Actualiza la mención diff --git a/app/jobs/activity_pub/sync_lists_job.rb b/app/jobs/activity_pub/sync_lists_job.rb index de71fe64..e37e15be 100644 --- a/app/jobs/activity_pub/sync_lists_job.rb +++ b/app/jobs/activity_pub/sync_lists_job.rb @@ -43,7 +43,9 @@ class ActivityPub # Si alguna falló, reintentar raise if logs.present? rescue Exception => e - ExceptionNotifier.notify_exception(e, data: { site: site.name, logs: logs, blocklist: blocklist, allowlist: allowlist, pauselist: pauselist }) + ExceptionNotifier.notify_exception(e, + data: { site: site.name, logs: logs, blocklist: blocklist, + allowlist: allowlist, pauselist: pauselist }) raise end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 4bb68359..ee4e3b2c 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -8,7 +8,7 @@ class ApplicationJob < ActiveJob::Base # superpongan tareas # # @return [Array] - RANDOM_WAIT = [3, 5, 7, 11, 13] + RANDOM_WAIT = [3, 5, 7, 11, 13].freeze # @return [ActiveSupport::Duration] def self.random_wait @@ -17,8 +17,6 @@ class ApplicationJob < ActiveJob::Base attr_reader :site - private - # Si falla por cualquier cosa informar y descartar discard_on(Exception) do |job, error| ExceptionNotifier.notify_exception(error, data: { job: job }) diff --git a/app/models/activity_pub.rb b/app/models/activity_pub.rb index cd893406..7f8155cd 100644 --- a/app/models/activity_pub.rb +++ b/app/models/activity_pub.rb @@ -64,7 +64,7 @@ class ActivityPub < ApplicationRecord # Array o mezcla y obtener el que más nos convenga o # adivinar uno. when Array - links = object['url'].map.with_index do |link, i| + links = object['url'].map.with_index do |link, _i| case link when Hash then link else { 'href' => link.to_s } @@ -93,7 +93,8 @@ class ActivityPub < ApplicationRecord # Gestionar todos los errores error_on_all_events do |e| - ExceptionNotifier.notify_exception(e, data: { site: site.name, activity_pub: self.id, activity: activities.first.uri }) + ExceptionNotifier.notify_exception(e, + data: { site: site.name, activity_pub: id, activity: activities.first.uri }) end # Se puede volver a pausa en caso de actualización remota, para diff --git a/app/models/activity_pub/fediblock.rb b/app/models/activity_pub/fediblock.rb index 17897d79..e66e6e60 100644 --- a/app/models/activity_pub/fediblock.rb +++ b/app/models/activity_pub/fediblock.rb @@ -35,9 +35,9 @@ class ActivityPub validates_inclusion_of :format, in: %w[mastodon fediblock none] HOSTNAME_HEADERS = { - 'mastodon' => '#domain', + 'mastodon' => '#domain', 'fediblock' => 'domain' - } + }.freeze def client @client ||= Client.new diff --git a/app/models/activity_pub/object.rb b/app/models/activity_pub/object.rb index d37c9b88..b10b4431 100644 --- a/app/models/activity_pub/object.rb +++ b/app/models/activity_pub/object.rb @@ -39,13 +39,14 @@ class ActivityPub def referenced(site) require 'distributed_press/v1/social/referenced_object' - @referenced ||= DistributedPress::V1::Social::ReferencedObject.new(object: content, dereferencer: site.social_inbox.dereferencer) + @referenced ||= DistributedPress::V1::Social::ReferencedObject.new(object: content, + dereferencer: site.social_inbox.dereferencer) end private def uri_is_content_id? - return if self.uri == content['id'] + return if uri == content['id'] errors.add(:activity_pub_objects, 'El ID del objeto no coincide con su URI') end diff --git a/app/models/activity_pub/remote_flag.rb b/app/models/activity_pub/remote_flag.rb index c3cc0fb0..d6348650 100644 --- a/app/models/activity_pub/remote_flag.rb +++ b/app/models/activity_pub/remote_flag.rb @@ -40,7 +40,8 @@ class ActivityPub def content { '@context' => 'https://www.w3.org/ns/activitystreams', - 'id' => Rails.application.routes.url_helpers.v1_activity_pub_remote_flag_url(self, host: site.social_inbox_hostname), + 'id' => Rails.application.routes.url_helpers.v1_activity_pub_remote_flag_url(self, + host: site.social_inbox_hostname), 'type' => 'Flag', 'actor' => main_site.social_inbox.actor_id, 'content' => message.to_s, @@ -53,7 +54,7 @@ class ActivityPub # # @return [Site] def main_site - @main_site ||= Site.find(ENV.fetch('PANEL_ACTOR_SITE_ID') { 1 }) + @main_site ||= Site.find(ENV.fetch('PANEL_ACTOR_SITE_ID', 1)) end end end diff --git a/app/models/concerns/tienda.rb b/app/models/concerns/tienda.rb index 86174c9a..a3e6007a 100644 --- a/app/models/concerns/tienda.rb +++ b/app/models/concerns/tienda.rb @@ -17,7 +17,7 @@ module Tienda return t if new_record? - t.blank? ? 'https://' + name + '.' + ENV.fetch('TIENDA', 'tienda.sutty.nl') : t + t.blank? ? "https://#{name}.#{ENV.fetch('TIENDA', 'tienda.sutty.nl')}" : t end end end diff --git a/app/models/fediblock_state.rb b/app/models/fediblock_state.rb index 82912f76..02dee2d8 100644 --- a/app/models/fediblock_state.rb +++ b/app/models/fediblock_state.rb @@ -45,7 +45,8 @@ class FediblockState < ApplicationRecord private def block_instances! - ActivityPub::InstanceModerationJob.perform_later(site: site, hostnames: fediblock.hostnames, perform_remotely: false) + ActivityPub::InstanceModerationJob.perform_later(site: site, hostnames: fediblock.hostnames, + perform_remotely: false) end # Pausar todas las moderaciones de las instancias que no estén diff --git a/app/models/instance_moderation.rb b/app/models/instance_moderation.rb index 5a1a5ed6..c1192615 100644 --- a/app/models/instance_moderation.rb +++ b/app/models/instance_moderation.rb @@ -16,7 +16,9 @@ class InstanceModeration < ApplicationRecord state :blocked error_on_all_events do |e| - ExceptionNotifier.notify_exception(e, data: { site: site.name, instance: instance.hostname, instance_moderation: id }) + ExceptionNotifier.notify_exception(e, + data: { site: site.name, instance: instance.hostname, + instance_moderation: id }) end after_all_events do diff --git a/app/models/metadata_template.rb b/app/models/metadata_template.rb index a9765918..78989e15 100644 --- a/app/models/metadata_template.rb +++ b/app/models/metadata_template.rb @@ -134,7 +134,7 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type, # En caso de que algún campo necesite realizar acciones antes de ser # guardado def save - if !changed? + unless changed? self[:value] = document_value if private? return true diff --git a/app/models/social_inbox.rb b/app/models/social_inbox.rb index 183ebfb0..adeedffc 100644 --- a/app/models/social_inbox.rb +++ b/app/models/social_inbox.rb @@ -45,7 +45,7 @@ class SocialInbox # @param url [String] # @return [DistributedPress::V1::Social::Client] def client_for(url) - raise "Falló generar un cliente" if url.blank? + raise 'Falló generar un cliente' if url.blank? @client_for ||= {} @client_for[url] ||= @@ -54,7 +54,7 @@ class SocialInbox public_key_url: public_key_url, private_key_pem: site.private_key_pem, logger: Rails.logger, - cache_store: HTTParty::Cache::Store::Redis.new(redis_url: ENV['REDIS_SERVER']) + cache_store: HTTParty::Cache::Store::Redis.new(redis_url: ENV.fetch('REDIS_SERVER', nil)) ) end diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 53e953f3..1a85d401 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -222,8 +222,6 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do end end - private - # Asignar un rol a cada deploy si no lo tenía ya def add_role_to_deploys!(role = current_role) site.deploys.each do |deploy| diff --git a/config/environments/production.rb b/config/environments/production.rb index bc7cecd7..5b0667a5 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -62,7 +62,7 @@ Rails.application.configure do config.log_tags = %i[request_id] # Use a different cache store in production. - config.cache_store = :redis_cache_store, { url: ENV['REDIS_SERVER'] } + config.cache_store = :redis_cache_store, { url: ENV.fetch('REDIS_SERVER', nil) } config.action_mailer.perform_caching = false @@ -87,7 +87,7 @@ Rails.application.configure do config.lograge.enabled = true # Use default logging formatter so that PID and timestamp are not # suppressed. - config.log_formatter = ::Logger::Formatter.new + config.log_formatter = Logger::Formatter.new # Use a different logger for distributed setups. require 'syslog/logger' @@ -140,9 +140,10 @@ Rails.application.configure do domain: ENV.fetch('SUTTY', 'sutty.nl'), enable_starttls_auto: false } - config.action_mailer.default_options = { from: ENV.fetch('DEFAULT_FROM', "noreply@sutty.nl") } + config.action_mailer.default_options = { from: ENV.fetch('DEFAULT_FROM', 'noreply@sutty.nl') } - config.middleware.use ExceptionNotification::Rack, gitlab: {}, error_grouping: true, ignore_exceptions: ['DeployJob::DeployAlreadyRunningException'] + config.middleware.use ExceptionNotification::Rack, gitlab: {}, error_grouping: true, + ignore_exceptions: ['DeployJob::DeployAlreadyRunningException'] Rails.application.routes.default_url_options[:host] = "panel.#{ENV.fetch('SUTTY', 'sutty.nl')}" Rails.application.routes.default_url_options[:protocol] = 'https' diff --git a/config/initializers/que_web.rb b/config/initializers/que_web.rb index 192256db..a6b87cf8 100644 --- a/config/initializers/que_web.rb +++ b/config/initializers/que_web.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true Que::Web.use(Rack::Auth::Basic) do |user, password| - [user, password] == [ENV['HTTP_BASIC_USER'], ENV['HTTP_BASIC_PASSWORD']] + [user, password] == [ENV.fetch('HTTP_BASIC_USER', nil), ENV.fetch('HTTP_BASIC_PASSWORD', nil)] end diff --git a/db/migrate/20240227142019_create_fediblock_states.rb b/db/migrate/20240227142019_create_fediblock_states.rb index c99cf63d..1e718343 100644 --- a/db/migrate/20240227142019_create_fediblock_states.rb +++ b/db/migrate/20240227142019_create_fediblock_states.rb @@ -16,9 +16,7 @@ class CreateFediblockStates < ActiveRecord::Migration[6.1] # Todas las listas están activas por defecto DeploySocialDistributedPress.find_each do |deploy| ActivityPub::Fediblock.find_each do |fediblock| - FediblockState.create(site: deploy.site, fediblock: fediblock, aasm_state: 'disabled').tap do |f| - f.enable! - end + FediblockState.create(site: deploy.site, fediblock: fediblock, aasm_state: 'disabled').tap(&:enable!) end end end diff --git a/db/migrate/20240313204105_brs_decompressor_corrupted_source_error.rb b/db/migrate/20240313204105_brs_decompressor_corrupted_source_error.rb index a0c29311..e22d759b 100644 --- a/db/migrate/20240313204105_brs_decompressor_corrupted_source_error.rb +++ b/db/migrate/20240313204105_brs_decompressor_corrupted_source_error.rb @@ -4,9 +4,11 @@ # decompresión class BrsDecompressorCorruptedSourceError < ActiveRecord::Migration[6.1] def up - raise unless HTTParty.get("https://mas.to/api/v2/instance", headers: { "Accept-Encoding": "br;q=1.0,gzip;q=1.0,deflate;q=0.6,identity;q=0.3" }).ok? + raise unless HTTParty.get('https://mas.to/api/v2/instance', + headers: { 'Accept-Encoding': 'br;q=1.0,gzip;q=1.0,deflate;q=0.6,identity;q=0.3' }).ok? - QueJob.where("last_error_message like '%BRS::DecompressorCorruptedSourceError%'").update_all(error_count: 0, run_at: Time.now) + QueJob.where("last_error_message like '%BRS::DecompressorCorruptedSourceError%'").update_all(error_count: 0, + run_at: Time.now) end def down; end diff --git a/db/migrate/20240314205923_fix_activity_type.rb b/db/migrate/20240314205923_fix_activity_type.rb index 042de8eb..e6640ff8 100644 --- a/db/migrate/20240314205923_fix_activity_type.rb +++ b/db/migrate/20240314205923_fix_activity_type.rb @@ -4,7 +4,9 @@ class FixActivityType < ActiveRecord::Migration[6.1] def up %w[Like Announce].each do |type| - ActivityPub::Activity.where(Arel.sql("content->>'type' = '#{type}'")).update_all(type: "ActivityPub::Activity::#{type}", updated_at: Time.now) + ActivityPub::Activity.where(Arel.sql("content->>'type' = '#{type}'")).update_all( + type: "ActivityPub::Activity::#{type}", updated_at: Time.now + ) end end diff --git a/db/migrate/20240318183846_fix_duplicate_objects.rb b/db/migrate/20240318183846_fix_duplicate_objects.rb index 88d23c6f..9f02c3db 100644 --- a/db/migrate/20240318183846_fix_duplicate_objects.rb +++ b/db/migrate/20240318183846_fix_duplicate_objects.rb @@ -3,7 +3,7 @@ # De alguna forma se guardaron objetos duplicados! class FixDuplicateObjects < ActiveRecord::Migration[6.1] def up - ActivityPub::Object.group(:uri).count.select { |_, v| v > 1 }.keys.each do |uri| + ActivityPub::Object.group(:uri).count.select { |_, v| v > 1 }.each_key do |uri| objects = ActivityPub::Object.where(uri: uri) deleted_ids = objects[1..].map(&:delete).map(&:id) diff --git a/db/migrate/20240319124212_add_fedipact_to_fediblocks.rb b/db/migrate/20240319124212_add_fedipact_to_fediblocks.rb index d78439b2..f751123a 100644 --- a/db/migrate/20240319124212_add_fedipact_to_fediblocks.rb +++ b/db/migrate/20240319124212_add_fedipact_to_fediblocks.rb @@ -14,9 +14,7 @@ class AddFedipactToFediblocks < ActiveRecord::Migration[6.1] ) DeploySocialDistributedPress.find_each do |deploy| - FediblockState.create(site: deploy.site, fediblock: fedipact, aasm_state: 'disabled').tap do |f| - f.enable! - end + FediblockState.create(site: deploy.site, fediblock: fedipact, aasm_state: 'disabled').tap(&:enable!) end end diff --git a/db/migrate/20240319144735_add_missing_unique_indexes.rb b/db/migrate/20240319144735_add_missing_unique_indexes.rb index 7d18c8e8..2f6ef1aa 100644 --- a/db/migrate/20240319144735_add_missing_unique_indexes.rb +++ b/db/migrate/20240319144735_add_missing_unique_indexes.rb @@ -4,14 +4,14 @@ # no es válida y por eso teníamos objetos duplicados. class AddMissingUniqueIndexes < ActiveRecord::Migration[6.1] def up - ActivityPub::Object.group(:uri).count.select { |_, v| v > 1 }.keys.each do |uri| + ActivityPub::Object.group(:uri).count.select { |_, v| v > 1 }.each_key do |uri| objects = ActivityPub::Object.where(uri: uri) deleted_ids = objects[1..].map(&:delete).map(&:id) ActivityPub.where(object_id: deleted_ids).update_all(object_id: objects.first.id, updated_at: Time.now) end - ActivityPub::Actor.group(:uri).count.select { |_, v| v > 1 }.keys.each do |uri| + ActivityPub::Actor.group(:uri).count.select { |_, v| v > 1 }.each_key do |uri| objects = ActivityPub::Actor.where(uri: uri) deleted_ids = objects[1..].map(&:delete).map(&:id) @@ -21,7 +21,7 @@ class AddMissingUniqueIndexes < ActiveRecord::Migration[6.1] ActivityPub::RemoteFlag.where(actor_id: deleted_ids).update_all(actor_id: objects.first.id, updated_at: Time.now) end - ActivityPub::Instance.group(:hostname).count.select { |_, v| v > 1 }.keys.each do |hostname| + ActivityPub::Instance.group(:hostname).count.select { |_, v| v > 1 }.each_key do |hostname| objects = ActivityPub::Instance.where(hostname: hostname) deleted_ids = objects[1..].map(&:delete).map(&:id) diff --git a/db/seeds.rb b/db/seeds.rb index 8e8c291f..41474883 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -20,13 +20,13 @@ if CodeOfConduct.count.zero? YAML.safe_load(File.read('db/seeds/codes_of_conduct.yml')).each do |coc| CodeOfConduct.new(**coc).save! end -end +end if PrivacyPolicy.count.zero? YAML.safe_load(File.read('db/seeds/privacy_policies.yml')).each do |pp| PrivacyPolicy.new(**pp).save! end -end +end YAML.safe_load(File.read('db/seeds/activity_pub/fediblocks.yml')).each do |fediblock| ActivityPub::Fediblock.find_or_create_by(id: fediblock['id']).tap do |f| From fe78c354a77e55668d235e6a68df66c72b4aa86b Mon Sep 17 00:00:00 2001 From: f Date: Thu, 2 May 2024 16:18:34 -0300 Subject: [PATCH 34/48] ci: instalar dependencias antes de usarlas --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dceb1a42..2830cd86 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,6 +36,7 @@ assets: - *cache-node - *cache-task before_script: + - *apk-add - "gitlab_ci_log_section --name git --header=\"Configuring git\"" - "git config --global user.email \"${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}\"" - "git config --global user.name \"${GIT_USER_NAME:-$GITLAB_USER_NAME}\"" @@ -43,7 +44,6 @@ assets: - "gitlab_ci_log_section --name git --end" - "gitlab_ci_log_section --name apk --header=\"Installing dependencies\"" - "apk add brotli" - - *apk-add - *disable-hainish - "gitlab_ci_log_section --name apk --end" script: From 074549613c90df65359d798a2b58a99ea7afda05 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 2 May 2024 16:34:41 -0300 Subject: [PATCH 35/48] =?UTF-8?q?ci:=20compilar=20assets=20en=20producci?= =?UTF-8?q?=C3=B3n=20y=20testing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2830cd86..262e127a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,7 +28,8 @@ assets: stage: "deploy" only: - "rails" - - "17.3.alpine.panel.sutty.nl" + - "production.panel.sutty.nl" + - "panel.sutty.nl" except: - "schedules" cache: From 5810d0c3df67db68c24d69d5afdd473f56541baf Mon Sep 17 00:00:00 2001 From: f Date: Thu, 2 May 2024 16:34:54 -0300 Subject: [PATCH 36/48] ci: pushear de vuelta a la rama --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 262e127a..9dff2f3a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -52,7 +52,7 @@ assets: - "go-task assets" after_script: - "git add public && git commit -m \"ci: assets [skip ci]\"" - - "git push -o ci.skip" + - "git push -o ci.skip origin HEAD:${CI_COMMIT_BRANCH}" gem-audit: stage: "test" only: From f8e281141a03f2a8b555cd65427e1a93cfe0349a Mon Sep 17 00:00:00 2001 From: f Date: Thu, 2 May 2024 16:40:46 -0300 Subject: [PATCH 37/48] =?UTF-8?q?ci:=20forzar=20recompilaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/packs/application.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index e10e2b5d..d634a64e 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -42,3 +42,5 @@ Turbolinks.start() ActiveStorage.start() window.htmx = require('htmx.org/dist/htmx.js') + +// rebuild From 5334a2e046a41138ead1a0f3841228b987c7cd65 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 2 May 2024 17:05:09 -0300 Subject: [PATCH 38/48] =?UTF-8?q?ci:=20forzar=20compilaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/packs/application.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index d634a64e..e10e2b5d 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -42,5 +42,3 @@ Turbolinks.start() ActiveStorage.start() window.htmx = require('htmx.org/dist/htmx.js') - -// rebuild From 368cb065ea890eab57df858fc2a42c6fff7330a0 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 2 May 2024 17:13:15 -0300 Subject: [PATCH 39/48] ci: el token correcto [skip ci] --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9dff2f3a..a906fc2a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,7 +41,7 @@ assets: - "gitlab_ci_log_section --name git --header=\"Configuring git\"" - "git config --global user.email \"${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}\"" - "git config --global user.name \"${GIT_USER_NAME:-$GITLAB_USER_NAME}\"" - - "git remote set-url --push origin \"https://${GITLAB_USERNAME}:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git\"" + - "git remote set-url --push origin \"https://${GITLAB_USERNAME}:${GITLAB_CI_PUSH_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git\"" - "gitlab_ci_log_section --name git --end" - "gitlab_ci_log_section --name apk --header=\"Installing dependencies\"" - "apk add brotli" From 330e82041bbd4d6fc1831ba7234e4ed149aff0d3 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 2 May 2024 18:49:29 -0300 Subject: [PATCH 40/48] =?UTF-8?q?fix:=20no=20filtrar=20informaci=C3=B3n=20?= =?UTF-8?q?privada=20en=20YAML.dump?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/application_record.rb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index f09c4dd4..6662ddeb 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -7,6 +7,23 @@ class ApplicationRecord < ActiveRecord::Base # # @return [String] def to_yaml(options = {}) - self.class.inspection_filter.filter(serializable_hash).to_yaml(options) + pruned_attributes.to_yaml(options) + end + + # Devuelve todos los atributos menos los filtrados + # + # @return [Hash] + def pruned_attributes + self.class.inspection_filter.filter(serializable_hash) + end + + # @param coder [Psych::Coder] + # @return nil + def encode_with(coder) + pruned_attributes.each_pair do |attr, value| + coder[attr] = value + end + + nil end end From eb80a83ddd17b31d7dcf0a2cff634a3b593d8230 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 9 May 2024 12:01:34 -0300 Subject: [PATCH 41/48] fix: editor 0.1.29 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index eea0473f..088316bc 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@rails/activestorage": "^6.1.3-1", "@rails/ujs": "^6.1.3-1", "@rails/webpacker": "5.4.4", - "@suttyweb/editor": "^0.1.27", + "@suttyweb/editor": "^0.1.29", "babel-loader": "^8.2.2", "bs-custom-file-input": "^1.3.4", "chart.js": "^3.5.1", diff --git a/yarn.lock b/yarn.lock index 7a81a221..fc6ae7cb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1975,10 +1975,10 @@ resolved "https://registry.npmjs.org/@stimulus/webpack-helpers/-/webpack-helpers-1.1.1.tgz" integrity sha512-XOkqSw53N9072FLHvpLM25PIwy+ndkSSbnTtjKuyzsv8K5yfkFB2rv68jU1pzqYa9FZLcvZWP4yazC0V38dx9A== -"@suttyweb/editor@^0.1.27": - version "0.1.27" - resolved "https://registry.yarnpkg.com/@suttyweb/editor/-/editor-0.1.27.tgz#9415a0b767e72dbe4fbf42ce87e62fb8f5125c31" - integrity sha512-Ts9TZtGiRIaHm+ffVBRl+/nuVcANWZNtFsrGacoajgEsagaIyA1cq8qjiNpPoM5ne9vTba3cAaLP04V/uEIhBw== +"@suttyweb/editor@^0.1.29": + version "0.1.29" + resolved "https://registry.yarnpkg.com/@suttyweb/editor/-/editor-0.1.29.tgz#8b5c6ae4e4d546002a96ecd65765d77d2a88d415" + integrity sha512-GshI8wE5UqXge2RhwAUxUXTRLPoOX7US9xVu1aLqT/deT/hDyN9S3PxVn9cJBf7uPHEqBzYXGDKWWF79PLqGHw== dependencies: "@floating-ui/dom" "^1.5.1" linkifyjs "^4.1.1" From 6972aafa75dd64e2195194c78d8bee2842754d33 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 9 May 2024 12:03:38 -0300 Subject: [PATCH 42/48] ci: pushear assets --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a906fc2a..0cf09b87 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,7 +41,7 @@ assets: - "gitlab_ci_log_section --name git --header=\"Configuring git\"" - "git config --global user.email \"${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}\"" - "git config --global user.name \"${GIT_USER_NAME:-$GITLAB_USER_NAME}\"" - - "git remote set-url --push origin \"https://${GITLAB_USERNAME}:${GITLAB_CI_PUSH_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git\"" + - "git remote set-url --push origin \"https://GITLAB_CI_PUSH_TOKEN:${GITLAB_CI_PUSH_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git\"" - "gitlab_ci_log_section --name git --end" - "gitlab_ci_log_section --name apk --header=\"Installing dependencies\"" - "apk add brotli" From 0d1ca35e6b4da250b73e4a247f23a0f454573038 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 9 May 2024 12:18:25 -0300 Subject: [PATCH 43/48] ci: probar que podemos pushear! --- .gitlab-ci.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0cf09b87..f736a316 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,6 +24,19 @@ variables: LC_ALL: "C.UTF-8" HAINISH: "" cache: +push: + stage: "deploy" + only: + - "rails" + except: + - "schedules" + before_script: + - "git config --global user.email \"${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}\"" + - "git config --global user.name \"${GIT_USER_NAME:-$GITLAB_USER_NAME}\"" + - "git remote set-url --push origin \"https://GITLAB_CI_PUSH_TOKEN:${GITLAB_CI_PUSH_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git\"" + script: + - "git commit --allow-empty -m \"ci: test [skip ci]\"" + - "git push -o ci.skip origin HEAD:${CI_COMMIT_BRANCH}" assets: stage: "deploy" only: From 2407ec11d9766297cac44eb3675f4792cf2559b2 Mon Sep 17 00:00:00 2001 From: fauno Date: Thu, 9 May 2024 15:19:09 +0000 Subject: [PATCH 44/48] ci: test [skip ci] From 088b495ed394b07ca65b1c74aed255e1088da55a Mon Sep 17 00:00:00 2001 From: f Date: Thu, 9 May 2024 12:20:55 -0300 Subject: [PATCH 45/48] ci: fallar temprano si ya no se puede pushear --- .gitlab-ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f736a316..c72a632d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,6 @@ +stages: +- "test" +- "deploy" .apk-add: &apk-add - "apk add go-task diffutils gitlab_ci_log_section" .disable-hainish: &disable-hainish @@ -25,7 +28,7 @@ variables: HAINISH: "" cache: push: - stage: "deploy" + stage: "test" only: - "rails" except: From ce1743c93c76b4ac7285e3dce282352b41592868 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 15 May 2024 15:46:03 -0300 Subject: [PATCH 46/48] =?UTF-8?q?fix:=20compilar=20assets=20en=20testing?= =?UTF-8?q?=20tambi=C3=A9n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c72a632d..8be521c7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,6 +46,7 @@ assets: - "rails" - "production.panel.sutty.nl" - "panel.sutty.nl" + - "panel.testing.sutty.nl" except: - "schedules" cache: From 1814948102847c5274ee2a021a44816172fffa26 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 15 May 2024 15:55:45 -0300 Subject: [PATCH 47/48] fix: capybara --- Gemfile.lock | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 32547ac7..5cbecf5c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -118,10 +118,11 @@ GEM bundler-audit (0.9.1) bundler (>= 1.2.0, < 3) thor (~> 1.0) - capybara (2.18.0) + capybara (3.40.0) addressable + matrix mini_mime (>= 0.1.3) - nokogiri (~> 1.8) + nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) @@ -361,13 +362,14 @@ GEM net-pop net-smtp marcel (1.0.2) + matrix (0.4.2) memory_profiler (1.0.1) mercenary (0.4.0) method_source (1.0.0) mini_histogram (0.3.1) mini_magick (4.12.0) mini_mime (1.1.5) - mini_portile2 (2.8.5) + mini_portile2 (2.8.6) minitest (5.21.1) mobility (1.2.9) i18n (>= 0.6.10, < 2) @@ -387,7 +389,7 @@ GEM net-ssh (7.2.1) netaddr (2.0.6) nio4r (2.7.0-x86_64-linux-musl) - nokogiri (1.16.0-x86_64-linux-musl) + nokogiri (1.16.5-x86_64-linux-musl) mini_portile2 (~> 2.8.2) racc (~> 1.4) orm_adapter (0.5.0) @@ -408,7 +410,7 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (5.0.4) + public_suffix (5.0.5) puma (6.4.2-x86_64-linux-musl) nio4r (~> 2.0) pundit (2.3.1) @@ -487,7 +489,7 @@ GEM redis-store (>= 1.2, < 2) redis-store (1.9.2) redis (>= 4, < 6) - regexp_parser (2.9.0) + regexp_parser (2.9.2) request_store (1.5.1) rack (>= 1.4) responders (3.1.1) From 6fd95ef544c7ff1ec261c354f11be6128e0ad5ee Mon Sep 17 00:00:00 2001 From: fauno Date: Wed, 15 May 2024 18:59:18 +0000 Subject: [PATCH 48/48] ci: assets [skip ci] --- public/packs/css/application-5688882d.css | 3 --- public/packs/css/application-5688882d.css.br | 3 --- public/packs/css/application-5688882d.css.gz | 3 --- public/packs/js/application-32aa31c983405e239377.js | 3 --- .../packs/js/application-32aa31c983405e239377.js.LICENSE.txt | 3 --- public/packs/js/application-32aa31c983405e239377.js.br | 3 --- public/packs/js/application-32aa31c983405e239377.js.gz | 3 --- public/packs/js/application-32aa31c983405e239377.js.map | 3 --- public/packs/js/application-32aa31c983405e239377.js.map.br | 3 --- public/packs/js/application-32aa31c983405e239377.js.map.gz | 3 --- public/packs/manifest.json | 3 --- public/packs/manifest.json.br | 3 --- public/packs/manifest.json.gz | 3 --- public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff | 3 --- public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2 | 3 --- public/packs/media/fonts/forkawesome-webfont-86541105.svg | 3 --- public/packs/media/fonts/forkawesome-webfont-86541105.svg.br | 3 --- public/packs/media/fonts/forkawesome-webfont-86541105.svg.gz | 3 --- public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot | 3 --- public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br | 3 --- public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.gz | 3 --- public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf | 3 --- public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br | 3 --- public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.gz | 3 --- public/packs/media/images/layers-2x-8f2c4d11.png | 3 --- public/packs/media/images/layers-416d9136.png | 3 --- public/packs/media/images/marker-icon-2b3e1faf.png | 3 --- public/packs/media/images/marker-icon-2x-680f69f3.png | 3 --- public/packs/media/images/marker-shadow-a0c6cc14.png | 3 --- 29 files changed, 87 deletions(-) delete mode 100644 public/packs/css/application-5688882d.css delete mode 100644 public/packs/css/application-5688882d.css.br delete mode 100644 public/packs/css/application-5688882d.css.gz delete mode 100644 public/packs/js/application-32aa31c983405e239377.js delete mode 100644 public/packs/js/application-32aa31c983405e239377.js.LICENSE.txt delete mode 100644 public/packs/js/application-32aa31c983405e239377.js.br delete mode 100644 public/packs/js/application-32aa31c983405e239377.js.gz delete mode 100644 public/packs/js/application-32aa31c983405e239377.js.map delete mode 100644 public/packs/js/application-32aa31c983405e239377.js.map.br delete mode 100644 public/packs/js/application-32aa31c983405e239377.js.map.gz delete mode 100644 public/packs/manifest.json delete mode 100644 public/packs/manifest.json.br delete mode 100644 public/packs/manifest.json.gz delete mode 100644 public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff delete mode 100644 public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2 delete mode 100644 public/packs/media/fonts/forkawesome-webfont-86541105.svg delete mode 100644 public/packs/media/fonts/forkawesome-webfont-86541105.svg.br delete mode 100644 public/packs/media/fonts/forkawesome-webfont-86541105.svg.gz delete mode 100644 public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot delete mode 100644 public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br delete mode 100644 public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.gz delete mode 100644 public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf delete mode 100644 public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br delete mode 100644 public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.gz delete mode 100644 public/packs/media/images/layers-2x-8f2c4d11.png delete mode 100644 public/packs/media/images/layers-416d9136.png delete mode 100644 public/packs/media/images/marker-icon-2b3e1faf.png delete mode 100644 public/packs/media/images/marker-icon-2x-680f69f3.png delete mode 100644 public/packs/media/images/marker-shadow-a0c6cc14.png diff --git a/public/packs/css/application-5688882d.css b/public/packs/css/application-5688882d.css deleted file mode 100644 index cca00ffe..00000000 --- a/public/packs/css/application-5688882d.css +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:185c95d8b69c7b6265a5e7a68ba926c2bd1f768fda8cf3be3368137ef6357730 -size 50273 diff --git a/public/packs/css/application-5688882d.css.br b/public/packs/css/application-5688882d.css.br deleted file mode 100644 index 6e13a79f..00000000 --- a/public/packs/css/application-5688882d.css.br +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9f5d0b5074f2b7fbbc9883beb27da4b4ca91652d3a0c931896a2fcaf97ec8142 -size 10185 diff --git a/public/packs/css/application-5688882d.css.gz b/public/packs/css/application-5688882d.css.gz deleted file mode 100644 index aced299a..00000000 --- a/public/packs/css/application-5688882d.css.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8a7df2acc6a691d864ccff15bc7d86c6a19a9f780d92d6fd9d1e6db6ff5e25ec -size 12559 diff --git a/public/packs/js/application-32aa31c983405e239377.js b/public/packs/js/application-32aa31c983405e239377.js deleted file mode 100644 index b3d9eda3..00000000 --- a/public/packs/js/application-32aa31c983405e239377.js +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:18afcff052d92b84eb8a57a3c75ea0906dade11a32e2555ae6a9bc96a2a445a7 -size 1643438 diff --git a/public/packs/js/application-32aa31c983405e239377.js.LICENSE.txt b/public/packs/js/application-32aa31c983405e239377.js.LICENSE.txt deleted file mode 100644 index dfe27ce7..00000000 --- a/public/packs/js/application-32aa31c983405e239377.js.LICENSE.txt +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7073b760337ff91f74933ece915ce12f8653f990f607a0925cc002dd610fa0f9 -size 1097 diff --git a/public/packs/js/application-32aa31c983405e239377.js.br b/public/packs/js/application-32aa31c983405e239377.js.br deleted file mode 100644 index ea4e3114..00000000 --- a/public/packs/js/application-32aa31c983405e239377.js.br +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:72569cbc80694b260f1f82b3f9c9e0aa9bed2c317a574f529c6a197ce5eb5e2d -size 366620 diff --git a/public/packs/js/application-32aa31c983405e239377.js.gz b/public/packs/js/application-32aa31c983405e239377.js.gz deleted file mode 100644 index d8060c6d..00000000 --- a/public/packs/js/application-32aa31c983405e239377.js.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0c11a3867cf8377ac78c267de3685d253535f051a059c41d0515578681f3543f -size 482994 diff --git a/public/packs/js/application-32aa31c983405e239377.js.map b/public/packs/js/application-32aa31c983405e239377.js.map deleted file mode 100644 index 6162baba..00000000 --- a/public/packs/js/application-32aa31c983405e239377.js.map +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0f2e11849e3d355d09c06a4d554a6e7dbd7b7103239dc61d042168600fbaa3f5 -size 6356834 diff --git a/public/packs/js/application-32aa31c983405e239377.js.map.br b/public/packs/js/application-32aa31c983405e239377.js.map.br deleted file mode 100644 index b70556ad..00000000 --- a/public/packs/js/application-32aa31c983405e239377.js.map.br +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:22cb28a364f48d6ded11199e796856ff5192929dec76ed12a167a2740c2d3c87 -size 1370769 diff --git a/public/packs/js/application-32aa31c983405e239377.js.map.gz b/public/packs/js/application-32aa31c983405e239377.js.map.gz deleted file mode 100644 index fb06ba6b..00000000 --- a/public/packs/js/application-32aa31c983405e239377.js.map.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0ce743a09f19854245fa6119551acc61a70ac11a4f3e21a0ae5f3f55571165ce -size 1694526 diff --git a/public/packs/manifest.json b/public/packs/manifest.json deleted file mode 100644 index 71ff6be5..00000000 --- a/public/packs/manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a97166493d79d64b69f3e72243b35ba9bb4ac97dc8602935a223894d6c663001 -size 1426 diff --git a/public/packs/manifest.json.br b/public/packs/manifest.json.br deleted file mode 100644 index 21f2c4ec..00000000 --- a/public/packs/manifest.json.br +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:22f043120eecf6137da58082cd2a2bd4bf98732f0b23966bc6c2c9e364c3e5d9 -size 323 diff --git a/public/packs/manifest.json.gz b/public/packs/manifest.json.gz deleted file mode 100644 index 9abcae66..00000000 --- a/public/packs/manifest.json.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:67ade2a6a2f2b79ad4a040b084d914859537f06cb1bc17788dc1573ee69df62d -size 366 diff --git a/public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff b/public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff deleted file mode 100644 index 8925c5d3..00000000 --- a/public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:53ab31062cf740aa76615d2c98aea80b177845d7ed95de45889b3824b0e1597c -size 115148 diff --git a/public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2 b/public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2 deleted file mode 100644 index 52865bdb..00000000 --- a/public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:84422de97eb1cf27bcb9bca4f3fbb18f3ebc711647b09c68292f5f43c89d5064 -size 91624 diff --git a/public/packs/media/fonts/forkawesome-webfont-86541105.svg b/public/packs/media/fonts/forkawesome-webfont-86541105.svg deleted file mode 100644 index af45aadc..00000000 --- a/public/packs/media/fonts/forkawesome-webfont-86541105.svg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:505e7f9fe61ba6d17d8514b5d0c3a75166dab1b57527e2d3a3baf2047624ba93 -size 480784 diff --git a/public/packs/media/fonts/forkawesome-webfont-86541105.svg.br b/public/packs/media/fonts/forkawesome-webfont-86541105.svg.br deleted file mode 100644 index 827ed0bc..00000000 --- a/public/packs/media/fonts/forkawesome-webfont-86541105.svg.br +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4df44c3056ab68d2e1cf1970189876295b62db1640e6ed885c78d8c46f94e66f -size 126249 diff --git a/public/packs/media/fonts/forkawesome-webfont-86541105.svg.gz b/public/packs/media/fonts/forkawesome-webfont-86541105.svg.gz deleted file mode 100644 index 0676bab5..00000000 --- a/public/packs/media/fonts/forkawesome-webfont-86541105.svg.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:49664085aa6a37335724f0288531562f352e81d10fdfeadd4a8ed0764eae2f50 -size 160947 diff --git a/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot b/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot deleted file mode 100644 index 37e93df5..00000000 --- a/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0d96fdd7d6854cf875ce3090e017b0078ae2f7e923763bcbb90748a01c6fb7fd -size 188946 diff --git a/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br b/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br deleted file mode 100644 index 01f63da2..00000000 --- a/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:36cb46345792080af5dbe8bd742dc632a3821276fff76e57877c93c0e8afb00a -size 107072 diff --git a/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.gz b/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.gz deleted file mode 100644 index 5bb32cdc..00000000 --- a/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:413b68fbd4bc71d5aa98410c6f8048f971b55e7d824180d0fab665cc55c3d9a3 -size 115772 diff --git a/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf b/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf deleted file mode 100644 index e6380d0e..00000000 --- a/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3e4beb40f0cc19ec55f2ab741d42e806fc6155ccf6e40e50965196c0bcc6aba4 -size 188756 diff --git a/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br b/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br deleted file mode 100644 index c35abc27..00000000 --- a/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:de3e4f20e5341214cc1292a61d0f49d833187e862fb1fbfeb746d25f0465ee6b -size 106884 diff --git a/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.gz b/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.gz deleted file mode 100644 index 44d9de5a..00000000 --- a/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:26c357b09eb784753afcd35a1aa47fe65378a52c95db0496e98dfb999c9ab1b8 -size 115685 diff --git a/public/packs/media/images/layers-2x-8f2c4d11.png b/public/packs/media/images/layers-2x-8f2c4d11.png deleted file mode 100644 index d3cf7e52..00000000 --- a/public/packs/media/images/layers-2x-8f2c4d11.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:066daca850d8ffbef007af00b06eac0015728dee279c51f3cb6c716df7c42edf -size 1259 diff --git a/public/packs/media/images/layers-416d9136.png b/public/packs/media/images/layers-416d9136.png deleted file mode 100644 index 7b44754c..00000000 --- a/public/packs/media/images/layers-416d9136.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1dbbe9d028e292f36fcba8f8b3a28d5e8932754fc2215b9ac69e4cdecf5107c6 -size 696 diff --git a/public/packs/media/images/marker-icon-2b3e1faf.png b/public/packs/media/images/marker-icon-2b3e1faf.png deleted file mode 100644 index b1789c76..00000000 --- a/public/packs/media/images/marker-icon-2b3e1faf.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:574c3a5cca85f4114085b6841596d62f00d7c892c7b03f28cbfa301deb1dc437 -size 1466 diff --git a/public/packs/media/images/marker-icon-2x-680f69f3.png b/public/packs/media/images/marker-icon-2x-680f69f3.png deleted file mode 100644 index 09e8445f..00000000 --- a/public/packs/media/images/marker-icon-2x-680f69f3.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:00179c4c1ee830d3a108412ae0d294f55776cfeb085c60129a39aa6fc4ae2528 -size 2464 diff --git a/public/packs/media/images/marker-shadow-a0c6cc14.png b/public/packs/media/images/marker-shadow-a0c6cc14.png deleted file mode 100644 index dc111216..00000000 --- a/public/packs/media/images/marker-shadow-a0c6cc14.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:264f5c640339f042dd729062cfc04c17f8ea0f29882b538e3848ed8f10edb4da -size 618