From 30398a8982a0c06d1da6161eb267392957cc9755 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 11 Apr 2022 14:17:27 -0300 Subject: [PATCH 001/475] incorporar assets en el repositorio usando lfs. esto nos permite hacer deploys con `git pull` --- .gitattributes | 2 ++ .gitignore | 7 ------- 2 files changed, 2 insertions(+), 7 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..0ede410e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +public/assets/** filter=lfs diff=lfs merge=lfs -text +public/packs/** filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index 496b66cb..e6f2adbb 100644 --- a/.gitignore +++ b/.gitignore @@ -34,12 +34,7 @@ /config/master.key /config/credentials.yml.enc -/public/packs /public/packs-test -/public/assets -/public/assets-production -/public/packs -/public/packs-production /node_modules /yarn-error.log yarn-debug.log* @@ -49,8 +44,6 @@ yarn-debug.log* *.key *.crt -/public/packs -/public/packs-test /node_modules /yarn-error.log yarn-debug.log* From dd32a5a0c1838e3e464e8fdbe80a4d1a9c2f8235 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 13 Apr 2022 12:31:36 -0300 Subject: [PATCH 002/475] woodpecker --- .woodpecker.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .woodpecker.yml diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 00000000..81af8efb --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,26 @@ +pipeline: + publish: + image: plugins/docker + settings: + registry: registry.nulo.in + username: sutty + repo: registry.nulo.in/sutty/panel + tags: + - ${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH} + - latest + build_args: + - RUBY_VERSION=${RUBY_VERSION} + - RUBY_PATCH=${RUBY_PATCH} + - ALPINE_VERSION=${ALPINE_VERSION} + - BASE_IMAGE=registry.nulo.in/sutty/rails + purge: false + secrets: + - docker_password + when: + branch: antifascista + event: push +matrix: + include: + - ALPINE_VERSION: 3.13.10 + RUBY_VERSION: 2.7 + RUBY_PATCH: 6 From d9a5f7ff238b10795022b160dfbabb1716ce4c29 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 13 Apr 2022 12:34:42 -0300 Subject: [PATCH 003/475] actualizar pandoc --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ecf43cbc..68ec6188 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM registry.nulo.in/sutty/rails:3.13.6-2.7.5 -ARG PANDOC_VERSION=2.17.1.1 +ARG PANDOC_VERSION=2.18 ENV RAILS_ENV production # Instalar las dependencias, separamos la librería de base de datos para From 244a8de406b6afaf471da8934e4ce9bec300701c Mon Sep 17 00:00:00 2001 From: f Date: Wed, 13 Apr 2022 12:37:13 -0300 Subject: [PATCH 004/475] ramas que provocan deploys --- .woodpecker.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 81af8efb..db2b307d 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -17,7 +17,9 @@ pipeline: secrets: - docker_password when: - branch: antifascista + branch: + - rails + - panel.sutty.nl event: push matrix: include: From d9e2291f264b273b53ecfe579d7b7d610045752a Mon Sep 17 00:00:00 2001 From: f Date: Wed, 13 Apr 2022 16:44:52 -0300 Subject: [PATCH 005/475] usar argumentos --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 68ec6188..ac90a548 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,8 @@ -FROM registry.nulo.in/sutty/rails:3.13.6-2.7.5 +ARG RUBY_VERSION=2.7 +ARG RUBY_PATCH=6 +ARG ALPINE_VERSION=3.13.10 +ARG BASE_IMAGE=registry.nulo.in/sutty/rails +FROM ${BASE_IMAGE}:${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH} ARG PANDOC_VERSION=2.18 ENV RAILS_ENV production From 1e0642c45b1b6293dbbe013ecffe11582f3abedc Mon Sep 17 00:00:00 2001 From: f Date: Thu, 14 Apr 2022 18:28:32 -0300 Subject: [PATCH 006/475] unificar ota de js --- Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 584d07d1..454e42f4 100644 --- a/Makefile +++ b/Makefile @@ -110,12 +110,9 @@ save: ## Subir la imagen Docker al nodo delegado date +%F | xargs -I {} git tag -f $(container)-{} @echo -e "\a" -ota-js: assets ## Actualizar Javascript en el nodo delegado - rsync -avi --delete-after --chown 1000:82 public/ root@$(delegate):/srv/sutty/srv/http/data/_$(public)/ - ssh root@$(delegate) docker exec $(container) sh -c "cat /srv/http/tmp/puma.pid | xargs -r kill -USR2" - ota: ## Actualizar Rails en el nodo delegado ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl pull ; true + ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl lfs prune ssh $(delegate) chown -R 1000:82 /srv/sutty/srv/http/panel.sutty.nl ssh $(delegate) docker exec $(container) rails reload From 30ddcca4a8a960647691a85d7d2ec29ceea45b6d Mon Sep 17 00:00:00 2001 From: f Date: Thu, 14 Apr 2022 18:30:34 -0300 Subject: [PATCH 007/475] enviar cambios --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 454e42f4..da7102e9 100644 --- a/Makefile +++ b/Makefile @@ -111,6 +111,7 @@ save: ## Subir la imagen Docker al nodo delegado @echo -e "\a" ota: ## Actualizar Rails en el nodo delegado + git push ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl pull ; true ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl lfs prune ssh $(delegate) chown -R 1000:82 /srv/sutty/srv/http/panel.sutty.nl From 80f135d49587b39a873f03bf158e9184d18e6fba Mon Sep 17 00:00:00 2001 From: f Date: Sat, 30 Apr 2022 12:19:51 -0300 Subject: [PATCH 008/475] =?UTF-8?q?commitear=20autom=C3=A1ticamente=20los?= =?UTF-8?q?=20assets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index da7102e9..4c68d72b 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,7 @@ help: always ## Ayuda @grep -E "^[a-z\-]+ \?=.*##" Makefile | sed -re "s/(.*) \?=.*##(.*)/\1;\2/" | column -s ";" -t | sed -re "s/^([^ ]+) /\x1B[38;5;197m\1\x1B[0m/" assets: public/packs/manifest.json.br ## Compilar los assets + git add public && git commit -m "assets [skip ci]" test: always ## Ejecutar los tests $(MAKE) rake args="test RAILS_ENV=test $(args)" @@ -112,7 +113,7 @@ save: ## Subir la imagen Docker al nodo delegado ota: ## Actualizar Rails en el nodo delegado git push - ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl pull ; true + ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl pull ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl lfs prune ssh $(delegate) chown -R 1000:82 /srv/sutty/srv/http/panel.sutty.nl ssh $(delegate) docker exec $(container) rails reload From ef74013fa3e2ec34749c14d59ea749556cf38077 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 30 Apr 2022 12:20:19 -0300 Subject: [PATCH 009/475] =?UTF-8?q?chequear=20que=20los=20assets=20est?= =?UTF-8?q?=C3=A9n=20actualizados=20al=20actualizar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4c68d72b..70cc11d0 100644 --- a/Makefile +++ b/Makefile @@ -111,7 +111,7 @@ save: ## Subir la imagen Docker al nodo delegado date +%F | xargs -I {} git tag -f $(container)-{} @echo -e "\a" -ota: ## Actualizar Rails en el nodo delegado +ota: assets ## Actualizar Rails en el nodo delegado git push ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl pull ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl lfs prune From 2589516b161ee7d25b5e80acbd73cad9e95a137c Mon Sep 17 00:00:00 2001 From: f Date: Sat, 30 Apr 2022 12:55:51 -0300 Subject: [PATCH 010/475] =?UTF-8?q?fixup!=20commitear=20autom=C3=A1ticamen?= =?UTF-8?q?te=20los=20assets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 70cc11d0..fd264d89 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ help: always ## Ayuda @grep -E "^[a-z\-]+ \?=.*##" Makefile | sed -re "s/(.*) \?=.*##(.*)/\1;\2/" | column -s ";" -t | sed -re "s/^([^ ]+) /\x1B[38;5;197m\1\x1B[0m/" assets: public/packs/manifest.json.br ## Compilar los assets - git add public && git commit -m "assets [skip ci]" + git add public/assets/ public/packs/ && git commit -m "assets [skip ci]" test: always ## Ejecutar los tests $(MAKE) rake args="test RAILS_ENV=test $(args)" From 44de5227646c3ae0549e863bb5b2c0a9b0918c94 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 5 Oct 2022 18:44:23 -0300 Subject: [PATCH 011/475] soportar distributed press apiv0 #7839 --- app/models/deploy.rb | 15 ++++++++++ app/models/deploy_distributed_press.rb | 34 +++++++++++++++++++++++ app/models/deploy_local.rb | 38 ++++++++++++++++++-------- 3 files changed, 76 insertions(+), 11 deletions(-) create mode 100644 app/models/deploy_distributed_press.rb diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 3f034ad5..c7e83539 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -75,6 +75,13 @@ class Deploy < ApplicationRecord r&.success? end + # Variables de entorno + # + # @return [Hash] + def local_env + @local_env ||= {} + end + private # @param [String] @@ -82,4 +89,12 @@ class Deploy < ApplicationRecord def readable_cmd(cmd) cmd.split(' -', 2).first.tr(' ', '_') end + + def deploy_local + @deploy_local ||= site.deploys.find_by(type: 'DeployLocal') + end + + def non_local_deploys + @non_local_deploys ||= site.deploys.where.not(type: 'DeployLocal') + end end diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb new file mode 100644 index 00000000..51788865 --- /dev/null +++ b/app/models/deploy_distributed_press.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Soportar Distributed Press APIv0 +# +# No se realiza ninguna acción porque el deploy se hace desde el plugin +# local. +class DeployDistributedPress < Deploy + store :values, accessors: %i[api_key hostname], coder: JSON + + def deploy; end + + def limit; end + + def size + deploy_local.size + end + + # TODO: Devolver hyper:// y otras + def url + "ipfs://#{hostname}/" + end + + # Devuelve variables de entorno para enviarle a DeployLocal + # + # @return [Hash] + def local_env + { + 'DISTRIBUTED_PRESS_PROJECT_DOMAIN' => hostname, + 'DISTRIBUTED_PRESS_API_KEY' => api_key + } + end + + def destination; end +end diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 4fa588f5..4b22d728 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -50,21 +50,24 @@ class DeployLocal < Deploy end # Un entorno que solo tiene lo que necesitamos + # + # @return [Hash] def env # XXX: This doesn't support Windows paths :B paths = [File.dirname(`which bundle`), '/usr/bin', '/bin'] - { - 'HOME' => home_dir, - 'PATH' => paths.join(':'), - 'SPREE_API_KEY' => site.tienda_api_key, - 'SPREE_URL' => site.tienda_url, - 'AIRBRAKE_PROJECT_ID' => site.id.to_s, - 'AIRBRAKE_PROJECT_KEY' => site.airbrake_api_key, - 'JEKYLL_ENV' => Rails.env, - 'LANG' => ENV['LANG'], - 'YARN_CACHE_FOLDER' => yarn_cache_dir - } + # Las variables de entorno extra no pueden superponerse al local. + extra_env.merge({ + 'HOME' => home_dir, + 'PATH' => paths.join(':'), + 'SPREE_API_KEY' => site.tienda_api_key, + 'SPREE_URL' => site.tienda_url, + 'AIRBRAKE_PROJECT_ID' => site.id.to_s, + 'AIRBRAKE_PROJECT_KEY' => site.airbrake_api_key, + 'JEKYLL_ENV' => Rails.env, + 'LANG' => ENV['LANG'], + 'YARN_CACHE_FOLDER' => yarn_cache_dir + }) end def yarn_cache_dir @@ -112,4 +115,17 @@ class DeployLocal < Deploy def remove_destination! FileUtils.rm_rf destination end + + # Consigue todas las variables de entorno configuradas por otros + # deploys. + # + # @return [Hash] + def extra_env + @extra_env ||= + non_local_deploys.reduce({}) do |extra_env, deploy| + extra_env.tap do |e| + e.merge! deploy.local_env + end + end + end end From 2dc01cef9c1aedc27a46e4f898fabd216da4e1d1 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 4 Nov 2022 14:13:44 -0300 Subject: [PATCH 012/475] fix: actualizar contenedor a alpine 3.14 #8369 --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index db2b307d..087b2e90 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -23,6 +23,6 @@ pipeline: event: push matrix: include: - - ALPINE_VERSION: 3.13.10 + - ALPINE_VERSION: 3.14.8 RUBY_VERSION: 2.7 RUBY_PATCH: 6 From d05b93d85ef3830e51131a6c09f48f47e2fd164b Mon Sep 17 00:00:00 2001 From: f Date: Fri, 18 Nov 2022 15:56:59 -0300 Subject: [PATCH 013/475] feat: poder modificar la url de distributed press --- app/models/deploy_distributed_press.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 51788865..a24ae62c 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -5,7 +5,7 @@ # No se realiza ninguna acción porque el deploy se hace desde el plugin # local. class DeployDistributedPress < Deploy - store :values, accessors: %i[api_key hostname], coder: JSON + store :values, accessors: %i[api_url api_key hostname], coder: JSON def deploy; end @@ -26,7 +26,8 @@ class DeployDistributedPress < Deploy def local_env { 'DISTRIBUTED_PRESS_PROJECT_DOMAIN' => hostname, - 'DISTRIBUTED_PRESS_API_KEY' => api_key + 'DISTRIBUTED_PRESS_API_KEY' => api_key, + 'DISTRIBUTED_PRESS_API_URL' => api_url } end From 3ec546eb82890490ad761014a23c6ea157c9fe1d Mon Sep 17 00:00:00 2001 From: f Date: Thu, 29 Dec 2022 14:55:30 -0300 Subject: [PATCH 014/475] fix: dependencias faltantes --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ac90a548..871e6fb0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ ENV RAILS_ENV production # principal RUN apk add --no-cache libxslt libxml2 postgresql-libs libssh2 \ rsync git jpegoptim vips tectonic oxipng git-lfs openssh-client \ - yarn daemonize ruby-webrick + yarn daemonize ruby-webrick postgresql-client dateutils file RUN gem install --no-document --no-user-install foreman RUN wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz -O - | tar --strip-components 1 -xvzf - pandoc-${PANDOC_VERSION}/bin/pandoc && mv /bin/pandoc /usr/bin/pandoc From aaaa1ad7b22943d3335ca8b1e5a3ece44d906134 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 2 Jan 2023 17:07:51 -0300 Subject: [PATCH 015/475] =?UTF-8?q?fix:=20enviar=20el=20per=C3=ADodo=20com?= =?UTF-8?q?o=20par=C3=A1metros=20del=20formulario=20#9359?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/stats/index.haml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/stats/index.haml b/app/views/stats/index.haml index 49fbd023..88e86aa3 100644 --- a/app/views/stats/index.haml +++ b/app/views/stats/index.haml @@ -27,6 +27,8 @@ %p.lead= t('.urls.description') %form{ method: 'get', action: '#custom-urls' } %input{ type: 'hidden', name: 'interval', value: @interval } + %input{ type: 'hidden', name: 'period_start', value: params[:period_start] } + %input{ type: 'hidden', name: 'period_end', value: params[:period_end] } .form-group %label{ for: 'urls' }= t('.urls.label') %textarea#urls.form-control{ name: 'urls', autocomplete: 'on', required: true, rows: @normalized_urls.size + 1, aria_describedby: 'help-urls' }= @normalized_urls.join("\n") From 5da4c796e0e9fc3afe0767822e4ed6b78d5feb7c Mon Sep 17 00:00:00 2001 From: Maki Date: Tue, 17 Jan 2023 18:31:54 -0300 Subject: [PATCH 016/475] agrego toggler para distributed press --- app/models/site.rb | 2 +- .../deploys/_deploy_distributed_press.haml | 21 +++++++++++++++++++ config/locales/en.yml | 4 ++++ config/locales/es.yml | 4 ++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 app/views/deploys/_deploy_distributed_press.haml diff --git a/app/models/site.rb b/app/models/site.rb index 638b3f47..fc012d7d 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -17,7 +17,7 @@ class Site < ApplicationRecord # TODO: Hacer que los diferentes tipos de deploy se auto registren # @see app/services/site_service.rb - DEPLOYS = %i[local private www zip hidden_service].freeze + DEPLOYS = %i[local private www zip hidden_service distributed_press].freeze validates :name, uniqueness: true, hostname: { allow_root_label: true diff --git a/app/views/deploys/_deploy_distributed_press.haml b/app/views/deploys/_deploy_distributed_press.haml new file mode 100644 index 00000000..d7d54db0 --- /dev/null +++ b/app/views/deploys/_deploy_distributed_press.haml @@ -0,0 +1,21 @@ +-# Publicar a la web distribuida + +.row + .col + = deploy.hidden_field :id + = deploy.hidden_field :type + .custom-control.custom-switch + -# + El checkbox invierte la lógica de destrucción porque queremos + crear el deploy si está activado y destruirlo si está + desactivado. + = deploy.check_box :_destroy, + { checked: deploy.object.persisted?, class: 'custom-control-input' }, + '0', '1' + = deploy.label :_destroy, class: 'custom-control-label' do + %h3= t('.title') + = sanitize_markdown t('.help', public_url: deploy.object.site.url), + tags: %w[p strong em a] + + +%hr/ diff --git a/config/locales/en.yml b/config/locales/en.yml index 530a9381..e7fb4f76 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -248,6 +248,10 @@ en: Only accessible through [Tor Browser](https://www.torproject.org/download/) + deploy_distributed_press: + title: 'Publish on Distributed Press' + help: | + ipfs stats: index: title: Statistics diff --git a/config/locales/es.yml b/config/locales/es.yml index eaa23137..18cf5326 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -253,6 +253,10 @@ es: Sólo será accesible a través del [Navegador Tor](https://www.torproject.org/es/download/). + deploy_distributed_press: + title: 'Alojar en la web distribuida' + help: | + Es para que esté en la web distribuida stats: index: title: Estadísticas From 67c0b29029d5f8731f0eb82c6b2c8c7d02e333e7 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 20 Jan 2023 18:22:08 -0300 Subject: [PATCH 017/475] feat: almacenar y renovar tokens de distributed press --- Gemfile | 1 + Gemfile.lock | 40 ++++++++++- Procfile | 1 + .../renew_distributed_press_tokens_job.rb | 17 +++++ app/models/distributed_press_publisher.rb | 68 +++++++++++++++++++ ...5420_create_distributed_press_publisher.rb | 14 ++++ lib/tasks/distributed_press.rake | 10 +++ monit.conf | 5 ++ 8 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 app/jobs/renew_distributed_press_tokens_job.rb create mode 100644 app/models/distributed_press_publisher.rb create mode 100644 db/migrate/20230119165420_create_distributed_press_publisher.rb create mode 100644 lib/tasks/distributed_press.rake diff --git a/Gemfile b/Gemfile index 2b304ee0..f317487b 100644 --- a/Gemfile +++ b/Gemfile @@ -38,6 +38,7 @@ gem 'commonmarker' gem 'devise' gem 'devise-i18n' gem 'devise_invitable' +gem 'distributed-press-api-client', '~> 0.2.0' gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n' gem 'exception_notification' gem 'fast_blank' diff --git a/Gemfile.lock b/Gemfile.lock index 8df2d77e..cdfe7183 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -124,6 +124,7 @@ GEM xpath (>= 2.0, < 4.0) chartkick (4.1.2) childprocess (4.1.0) + climate_control (1.2.0) coderay (1.1.3) colorator (1.1.0) commonmarker (0.21.2-x86_64-linux-musl) @@ -162,12 +163,45 @@ GEM devise_invitable (2.0.5) actionmailer (>= 5.0) devise (>= 4.6) + distributed-press-api-client (0.2.0) + addressable (~> 2.3, >= 2.3.0) + climate_control + dry-schema + httparty (~> 0.18) + json (~> 2.1, >= 2.1.0) + jwt (~> 2.6.0) dotenv (2.7.6) dotenv-rails (2.7.6) dotenv (= 2.7.6) railties (>= 3.2) down (5.2.4) addressable (~> 2.8) + dry-configurable (1.0.1) + dry-core (~> 1.0, < 2) + zeitwerk (~> 2.6) + dry-core (1.0.0) + concurrent-ruby (~> 1.0) + zeitwerk (~> 2.6) + dry-inflector (1.0.0) + dry-initializer (3.1.1) + dry-logic (1.5.0) + concurrent-ruby (~> 1.0) + dry-core (~> 1.0, < 2) + zeitwerk (~> 2.6) + dry-schema (1.13.0) + concurrent-ruby (~> 1.0) + dry-configurable (~> 1.0, >= 1.0.1) + dry-core (~> 1.0, < 2) + dry-initializer (~> 3.0) + dry-logic (>= 1.5, < 2) + dry-types (>= 1.7, < 2) + zeitwerk (~> 2.6) + dry-types (1.7.0) + concurrent-ruby (~> 1.0) + dry-core (~> 1.0, < 2) + dry-inflector (~> 1.0, < 2) + dry-logic (>= 1.4, < 2) + zeitwerk (~> 2.6) ed25519 (1.2.4-x86_64-linux-musl) editorial-autogestiva-jekyll-theme (0.3.4) jekyll (~> 4) @@ -244,8 +278,8 @@ GEM thor hiredis (0.6.3-x86_64-linux-musl) http_parser.rb (0.8.0-x86_64-linux-musl) - httparty (0.18.1) - mime-types (~> 3.0) + httparty (0.21.0) + mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) i18n (1.8.11) concurrent-ruby (~> 1.0) @@ -320,6 +354,7 @@ GEM jekyll-write-and-commit-changes (0.2.1) jekyll (~> 4) rugged (~> 1) + jwt (2.6.0) kaminari (1.2.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.1) @@ -669,6 +704,7 @@ DEPENDENCIES devise devise-i18n devise_invitable + distributed-press-api-client (~> 0.2.0) dotenv-rails down ed25519 diff --git a/Procfile b/Procfile index b308ffd5..1a4580d3 100644 --- a/Procfile +++ b/Procfile @@ -5,3 +5,4 @@ blazer_1h: bundle exec rake blazer:run_checks SCHEDULE="1 hour" blazer_1d: bundle exec rake blazer:run_checks SCHEDULE="1 day" blazer: bundle exec rake blazer:send_failing_checks prometheus: bundle exec prometheus_exporter -b 0.0.0.0 --prefix "sutty_" +distributed_press_renew_tokens: bundle exec rake distributed_press:tokens:renew diff --git a/app/jobs/renew_distributed_press_tokens_job.rb b/app/jobs/renew_distributed_press_tokens_job.rb new file mode 100644 index 00000000..5664d9fa --- /dev/null +++ b/app/jobs/renew_distributed_press_tokens_job.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# Renueva los tokens de Distributed Press antes que se venzan, +# activando los callbacks que hacen que se refresque el token. +class RenewDistributedPressTokensJob < ApplicationJob + # Renueva todos los tokens a punto de vencer o informa el error sin + # detener la tarea si algo pasa. + def perform + DistributedPressPublisher.with_about_to_expire_tokens.find_each do |publisher| + publisher.touch + rescue DistributedPress::V1::Error => e + data = { instance: publisher.instance, expires_at: publisher.client.token.expires_at } + + ExceptionNotifier.notify_exception(e, data: data) + end + end +end diff --git a/app/models/distributed_press_publisher.rb b/app/models/distributed_press_publisher.rb new file mode 100644 index 00000000..c120811e --- /dev/null +++ b/app/models/distributed_press_publisher.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +require 'distributed_press/v1' + +# Almacena el token de autenticación y la URL, por ahora solo vamos +# a tener uno, pero queda abierta la posibilidad de agregar más. +class DistributedPressPublisher < ApplicationRecord + # Cifrar la información del token en la base de datos + has_encrypted :token + + # La instancia es única + validates_uniqueness_of :instance + + # El token es necesario + validates_presence_of :token + + # Mantener la fecha de vencimiento actualizada + before_save :update_expires_at_from_token!, :update_token_from_client! + + # Devuelve todos los tokens que vencen en una hora + scope :with_about_to_expire_tokens, -> do + where('expires_at > ? and expires_at < ?', Time.now, Time.now + 1.hour) + end + + # Al cambiar el token genera un cliente nuevo + # + # @return [String] + def token=(new_token) + @client = nil + super + end + + # Al cambiar la instancia genera un cliente nuevo + # + # @return [String] + def instance=(new_instance) + @client = nil + super + end + + # Instancia un cliente de Distributed Press a partir del token. Al + # cargar un token a punto de vencer se renueva automáticamente. + # + # @return [DistributedPress::V1::Client] + def client + @client ||= DistributedPress::V1::Client.new(url: instance, token: token) + end + + private + + # Actualiza o desactiva la fecha de vencimiento a partir de la + # información del token. + # + # @return [nil] + def update_expires_at_from_token! + self.expires_at = client.token.forever? ? nil : client.token.expires_at + nil + end + + # Actualiza el token a partir del cliente, que ya actualiza el token + # automáticamente. + # + # @return [nil] + def update_token_from_client! + self.token = client.token.to_s + nil + end +end diff --git a/db/migrate/20230119165420_create_distributed_press_publisher.rb b/db/migrate/20230119165420_create_distributed_press_publisher.rb new file mode 100644 index 00000000..8d8de37a --- /dev/null +++ b/db/migrate/20230119165420_create_distributed_press_publisher.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# Crea la tabla de publishers de Distributed Press que contiene las +# instancias y tokens +class CreateDistributedPressPublisher < ActiveRecord::Migration[6.1] + def change + create_table :distributed_press_publishers do |t| + t.timestamps + t.string :instance, unique: true + t.text :token_ciphertext, null: false + t.datetime :expires_at, null: true + end + end +end diff --git a/lib/tasks/distributed_press.rake b/lib/tasks/distributed_press.rake new file mode 100644 index 00000000..8ba270ec --- /dev/null +++ b/lib/tasks/distributed_press.rake @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +namespace :distributed_press do + namespace :tokens do + desc 'Renew tokens' + task renew: :environment do + RenewDistributedPressTokensJob.perform_now + end + end +end diff --git a/monit.conf b/monit.conf index 96c08d8a..b785964d 100644 --- a/monit.conf +++ b/monit.conf @@ -25,3 +25,8 @@ check program blazer with path "/usr/local/bin/sutty blazer" every 61 cycles if status != 0 then alert + +check program distributed_press_tokens_renew + with path "/usr/bin/foreman run -f /srv/Procfile -d /srv distributed_press_tokens_renew" as uid "rails" gid "www-data" + every "0 3 * * *" + if status != 0 then alert From cbf7b5892746b544668c6043915da783a13b00d0 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 20 Jan 2023 18:28:29 -0300 Subject: [PATCH 018/475] fixup! feat: almacenar y renovar tokens de distributed press --- app/models/distributed_press_publisher.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/distributed_press_publisher.rb b/app/models/distributed_press_publisher.rb index c120811e..610d698d 100644 --- a/app/models/distributed_press_publisher.rb +++ b/app/models/distributed_press_publisher.rb @@ -18,9 +18,9 @@ class DistributedPressPublisher < ApplicationRecord before_save :update_expires_at_from_token!, :update_token_from_client! # Devuelve todos los tokens que vencen en una hora - scope :with_about_to_expire_tokens, -> do + scope :with_about_to_expire_tokens, lambda { where('expires_at > ? and expires_at < ?', Time.now, Time.now + 1.hour) - end + } # Al cambiar el token genera un cliente nuevo # From 932355fa2e331ac7e4bf142e21b1b879aa161a39 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 20 Jan 2023 20:34:27 -0300 Subject: [PATCH 019/475] feat: crear y publicar el sitio en distributed press v1 --- app/models/deploy_distributed_press.rb | 143 ++++++++++++++++++---- app/models/distributed_press_publisher.rb | 5 + 2 files changed, 125 insertions(+), 23 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index a24ae62c..09ba0364 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -1,13 +1,43 @@ # frozen_string_literal: true -# Soportar Distributed Press APIv0 -# -# No se realiza ninguna acción porque el deploy se hace desde el plugin -# local. -class DeployDistributedPress < Deploy - store :values, accessors: %i[api_url api_key hostname], coder: JSON +require 'distributed_press/v1/client/auth' +require 'distributed_press/v1/client/site' - def deploy; end +# Soportar Distributed Press APIv1 +# +# Usa tokens de publicación efímeros para todas las acciones. +# +# Al ser creado, genera el sitio en la instancia de Distributed Press +# configurada y almacena el ID. +# +# Al ser publicado, envía los archivos en un tarball y actualiza la +# información. +class DeployDistributedPress < Deploy + store :values, accessors: %i[hostname remote_site_id remote_info], coder: JSON + + before_create :create_remote_site! + + # Actualiza la información y luego envía los cambios + # + # @param :output [Bool] + # @return [Bool] + def deploy + time_start + + status = false + + site_client.tap do |c| + update remote_info: c.show(publishing_site).to_h + + status = c.publish(publishing_site, deploy_local.destination) + end + + time_stop + + create_stat! status + + status + end def limit; end @@ -15,21 +45,88 @@ class DeployDistributedPress < Deploy deploy_local.size end - # TODO: Devolver hyper:// y otras - def url - "ipfs://#{hostname}/" - end - - # Devuelve variables de entorno para enviarle a DeployLocal - # - # @return [Hash] - def local_env - { - 'DISTRIBUTED_PRESS_PROJECT_DOMAIN' => hostname, - 'DISTRIBUTED_PRESS_API_KEY' => api_key, - 'DISTRIBUTED_PRESS_API_URL' => api_url - } - end - def destination; end + + private + + # El cliente de la API + # + # TODO: cuando soportemos más, tiene que haber una relación entre + # DeployDistributedPress y DistributedPressPublisher. + # + # @return [DistributedPressPublisher] + def publisher + @publisher ||= DistributedPressPublisher.first + end + + # El cliente de autenticación se encarga de intercambiar un token por + # otro + # + # @return [DistributedPress::V1::Client::Auth] + def auth_client + DistributedPress::V1::Client::Auth.new(publisher.client) + end + + # Genera un token con permisos de publicación + # + # @return [DistributedPress::V1::Schemas::NewTokenPayload] + def publishing_token_payload + DistributedPress::V1::Schemas::NewTokenPayload.new.call(capabilities: %w[publisher]) + end + + # Genera un token efímero para publicar el sitio + # + # @return [DistributedPress::V1::Token] + def publishing_token + auth_client.exchange(publishing_token_payload) + end + + # Genera un cliente para publicar el sitio + # + # @return [DistributedPress::V1::Client] + def publishing_client + DistributedPress::V1::Client.new(url: publisher.instance, token: publishing_token) + end + + # El cliente para actualizar el sitio + # + # @return [DistributedPress::V1::Client::Site] + def site_client + DistributedPress::V1::Client::Site.new(publishing_client) + end + + # Genera el esquema de datos para poder publicar el sitio + # + # @return [DistributedPress::V1::Schemas::PublishingSite] + def publishing_site + DistributedPress::V1::Schemas::PublishingSite.new.call(id: remote_site_id) + end + + # Genera el esquema de datos para crear el sitio + # + # @return [DistributedPressPublisher::V1::Schemas::NewSite] + def create_site + DistributedPress::V1::Schemas::NewSite.new.call(domain: hostname, protocols: { http: true, ipfs: true, hyper: true }) + end + + # Crea el sitio en la instancia con el hostname especificado + # + # @return [nil] + def create_remote_site! + created_site = site_client.create(create_site) + + self.remote_site_id = created_site[:id] + self.remote_info = created_site.to_h + + nil + end + + # Registra lo que sucedió + # + # @param status [Bool] + # @return [nil] + def create_stat!(status) + build_stats.create action: publisher.to_s, seconds: time_spent_in_seconds, bytes: size, status: status + nil + end end diff --git a/app/models/distributed_press_publisher.rb b/app/models/distributed_press_publisher.rb index 610d698d..5358e738 100644 --- a/app/models/distributed_press_publisher.rb +++ b/app/models/distributed_press_publisher.rb @@ -46,6 +46,11 @@ class DistributedPressPublisher < ApplicationRecord @client ||= DistributedPress::V1::Client.new(url: instance, token: token) end + # @return [String] + def to_s + "Distributed Press <#{instance}>" + end + private # Actualiza o desactiva la fecha de vencimiento a partir de la From 8006bd03538dee1285ef7746db382958b6cabce7 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 20 Jan 2023 20:35:39 -0300 Subject: [PATCH 020/475] fix: permitir modificar el token estos parches hacian que no se pueda modificar el token --- app/models/distributed_press_publisher.rb | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/app/models/distributed_press_publisher.rb b/app/models/distributed_press_publisher.rb index 5358e738..acfc4226 100644 --- a/app/models/distributed_press_publisher.rb +++ b/app/models/distributed_press_publisher.rb @@ -22,22 +22,6 @@ class DistributedPressPublisher < ApplicationRecord where('expires_at > ? and expires_at < ?', Time.now, Time.now + 1.hour) } - # Al cambiar el token genera un cliente nuevo - # - # @return [String] - def token=(new_token) - @client = nil - super - end - - # Al cambiar la instancia genera un cliente nuevo - # - # @return [String] - def instance=(new_instance) - @client = nil - super - end - # Instancia un cliente de Distributed Press a partir del token. Al # cargar un token a punto de vencer se renueva automáticamente. # From b28d7946460d8bed6400a6f13d6f0911a12a8f53 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 23 Jan 2023 18:39:10 -0300 Subject: [PATCH 021/475] =?UTF-8?q?feat:=20no=20vamos=20a=20expedir=20toke?= =?UTF-8?q?ns=20ef=C3=ADmeros=20por=20ahora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_distributed_press.rb | 31 +------------------------- 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 09ba0364..38cb59e3 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -59,40 +59,11 @@ class DeployDistributedPress < Deploy @publisher ||= DistributedPressPublisher.first end - # El cliente de autenticación se encarga de intercambiar un token por - # otro - # - # @return [DistributedPress::V1::Client::Auth] - def auth_client - DistributedPress::V1::Client::Auth.new(publisher.client) - end - - # Genera un token con permisos de publicación - # - # @return [DistributedPress::V1::Schemas::NewTokenPayload] - def publishing_token_payload - DistributedPress::V1::Schemas::NewTokenPayload.new.call(capabilities: %w[publisher]) - end - - # Genera un token efímero para publicar el sitio - # - # @return [DistributedPress::V1::Token] - def publishing_token - auth_client.exchange(publishing_token_payload) - end - - # Genera un cliente para publicar el sitio - # - # @return [DistributedPress::V1::Client] - def publishing_client - DistributedPress::V1::Client.new(url: publisher.instance, token: publishing_token) - end - # El cliente para actualizar el sitio # # @return [DistributedPress::V1::Client::Site] def site_client - DistributedPress::V1::Client::Site.new(publishing_client) + DistributedPress::V1::Client::Site.new(publisher.client) end # Genera el esquema de datos para poder publicar el sitio From ebf1390bdf962c49f2fab7a914a3944060c0c461 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 26 Jan 2023 15:41:54 -0300 Subject: [PATCH 022/475] fix: actualizar api --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index cdfe7183..534ad298 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -163,7 +163,7 @@ GEM devise_invitable (2.0.5) actionmailer (>= 5.0) devise (>= 4.6) - distributed-press-api-client (0.2.0) + distributed-press-api-client (0.2.1) addressable (~> 2.3, >= 2.3.0) climate_control dry-schema From 928bc45920cfbf10a46e088ccbbcece043d24dd5 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 6 Feb 2023 16:09:51 -0300 Subject: [PATCH 023/475] feat: usar pnpm si existe relacionado con sutty/jekyll/sutty-base-jekyll-theme#53 --- Dockerfile | 2 ++ app/models/deploy_local.rb | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Dockerfile b/Dockerfile index ecf43cbc..b2f96612 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,8 @@ RUN apk add --no-cache libxslt libxml2 postgresql-libs libssh2 \ RUN gem install --no-document --no-user-install foreman RUN wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz -O - | tar --strip-components 1 -xvzf - pandoc-${PANDOC_VERSION}/bin/pandoc && mv /bin/pandoc /usr/bin/pandoc +RUN apk add npm && npm install -g pnpm && apk del npm + VOLUME "/srv" EXPOSE 3000 diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 4b22d728..51baf492 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -15,6 +15,7 @@ class DeployLocal < Deploy def deploy return false unless mkdir return false unless yarn + return false unless pnpm return false unless bundle jekyll_build @@ -74,6 +75,10 @@ class DeployLocal < Deploy Rails.root.join('_yarn_cache').to_s end + def pnpm_cache_dir + Rails.root.join('_pnpm_cache').to_s + end + def yarn_lock File.join(site.path, 'yarn.lock') end @@ -82,6 +87,14 @@ class DeployLocal < Deploy File.exist? yarn_lock end + def pnpm_lock + File.join(site.path, 'pnpm-lock.yaml') + end + + def pnpm_lock? + File.exist? pnpm_lock + end + def gem run %(gem install bundler --no-document) end @@ -93,6 +106,13 @@ class DeployLocal < Deploy run 'yarn install --production' end + def pnpm + return true unless pnpm_lock? + + run %(pnpm config set store-dir "#{pnpm_cache_dir}") + run 'pnpm install --production' + end + def bundle if Rails.env.production? run %(bundle install --no-cache --path="#{gems_dir}") From a73100a436a283533236989c58f162c0fe8dbd4f Mon Sep 17 00:00:00 2001 From: f Date: Mon, 6 Feb 2023 16:16:27 -0300 Subject: [PATCH 024/475] fix: pnpm se instala localmente --- app/models/deploy_local.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 51baf492..e4845d7c 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -55,7 +55,7 @@ class DeployLocal < Deploy # @return [Hash] def env # XXX: This doesn't support Windows paths :B - paths = [File.dirname(`which bundle`), '/usr/bin', '/bin'] + paths = [File.dirname(`which bundle`), '/usr/local/bin', '/usr/bin', '/bin'] # Las variables de entorno extra no pueden superponerse al local. extra_env.merge({ From 464ff4841b68affaa694ab0e8e348035cf565a38 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 7 Feb 2023 18:15:25 -0300 Subject: [PATCH 025/475] feat: textos para el panel --- config/locales/en.yml | 16 ++++++++++++++-- config/locales/es.yml | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index e7fb4f76..2bbf58ea 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -249,9 +249,21 @@ en: Only accessible through [Tor Browser](https://www.torproject.org/download/) deploy_distributed_press: - title: 'Publish on Distributed Press' + title: 'Publish to the distributed Web' help: | - ipfs + Make your site available through peer-to-peer protocols, + Inter-Planetary File System (IPFS), Hypercore, and via + BitTorrent, so your site is more resilient and can be available + offline, including in community mesh networks. + + **Important:** Only use this option if you would like your data + to be permanently available. If you decide to undo this + selection, a cleared version of the site will be shared in its + place. However, it is possible that nodes on the distributed + storage network may continue retaining copies of the data + indefinitely. + + [Learn more](#) stats: index: title: Statistics diff --git a/config/locales/es.yml b/config/locales/es.yml index 18cf5326..e3b24957 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -254,9 +254,21 @@ es: Sólo será accesible a través del [Navegador Tor](https://www.torproject.org/es/download/). deploy_distributed_press: - title: 'Alojar en la web distribuida' + title: 'Publicar a la Web distribuida' help: | - Es para que esté en la web distribuida + Utiliza protocolos de pares, Inter-Planetary File System (IPFS), + Hypercore y torrents, para que tu sitio sea más resiliente y + esté disponible _offline_, inclusive en redes _mesh_ + comunitarias. + + **Importante:** Sólo usa esta opción si te parece correcto que + tu contenido esté disponible permanentemente. Cuando elijas + des-hacer esta acción, una versión "vacía" del sitio será + compartida en su lugar. Sin embargo, es posible que algunos + nodos en la red de almacenamiento distribuida puedan retener + copias de tu contenido indefinidamente. + + [Saber más](#) stats: index: title: Estadísticas From 9661a34a04396c647f5ad1fe5d6ea75fc3b513ac Mon Sep 17 00:00:00 2001 From: f Date: Wed, 8 Feb 2023 09:38:36 -0300 Subject: [PATCH 026/475] fix: faltaban algunos require --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index f317487b..694358a6 100644 --- a/Gemfile +++ b/Gemfile @@ -38,7 +38,7 @@ gem 'commonmarker' gem 'devise' gem 'devise-i18n' gem 'devise_invitable' -gem 'distributed-press-api-client', '~> 0.2.0' +gem 'distributed-press-api-client', '~> 0.2.1' gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n' gem 'exception_notification' gem 'fast_blank' diff --git a/Gemfile.lock b/Gemfile.lock index 534ad298..5c074a7b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -704,7 +704,7 @@ DEPENDENCIES devise devise-i18n devise_invitable - distributed-press-api-client (~> 0.2.0) + distributed-press-api-client (~> 0.2.1) dotenv-rails down ed25519 From 6683f80aba504c2edca9bcb4ca5f3ce4f24eba9c Mon Sep 17 00:00:00 2001 From: f Date: Wed, 8 Feb 2023 11:55:07 -0300 Subject: [PATCH 027/475] fix: no fallar si tarda mucho dp --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 694358a6..7f4cc6ca 100644 --- a/Gemfile +++ b/Gemfile @@ -38,7 +38,7 @@ gem 'commonmarker' gem 'devise' gem 'devise-i18n' gem 'devise_invitable' -gem 'distributed-press-api-client', '~> 0.2.1' +gem 'distributed-press-api-client', '~> 0.2.2' gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n' gem 'exception_notification' gem 'fast_blank' diff --git a/Gemfile.lock b/Gemfile.lock index 5c074a7b..b5b6fd18 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -163,7 +163,7 @@ GEM devise_invitable (2.0.5) actionmailer (>= 5.0) devise (>= 4.6) - distributed-press-api-client (0.2.1) + distributed-press-api-client (0.2.2) addressable (~> 2.3, >= 2.3.0) climate_control dry-schema @@ -704,7 +704,7 @@ DEPENDENCIES devise devise-i18n devise_invitable - distributed-press-api-client (~> 0.2.1) + distributed-press-api-client (~> 0.2.2) dotenv-rails down ed25519 From ccfd77d9568dce55ea8ce29ea114b2487f7bc0b9 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 8 Feb 2023 17:08:02 -0300 Subject: [PATCH 028/475] =?UTF-8?q?feat:=20guardar=20un=20log=20y=20mostra?= =?UTF-8?q?rlo=20en=20output=20tambi=C3=A9n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_distributed_press.rb | 24 ++++++++++++++++++----- app/models/distributed_press_publisher.rb | 22 ++++++++++++++++++++- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 38cb59e3..d805e923 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -22,19 +22,32 @@ class DeployDistributedPress < Deploy # @param :output [Bool] # @return [Bool] def deploy + status = false + log = [] + time_start - status = false - site_client.tap do |c| + stdout = Thread.new(publisher.logger_out) do |io| + until io.eof? + line = io.gets + + puts line if output + log << line + end + end + update remote_info: c.show(publishing_site).to_h status = c.publish(publishing_site, deploy_local.destination) + + publisher.logger.close + stdout.join end time_stop - create_stat! status + create_stat! status, log.join status end @@ -95,9 +108,10 @@ class DeployDistributedPress < Deploy # Registra lo que sucedió # # @param status [Bool] + # @param log [String] # @return [nil] - def create_stat!(status) - build_stats.create action: publisher.to_s, seconds: time_spent_in_seconds, bytes: size, status: status + def create_stat!(status, log) + build_stats.create action: publisher.to_s,log: log, seconds: time_spent_in_seconds, bytes: size, status: status nil end end diff --git a/app/models/distributed_press_publisher.rb b/app/models/distributed_press_publisher.rb index acfc4226..089f63c6 100644 --- a/app/models/distributed_press_publisher.rb +++ b/app/models/distributed_press_publisher.rb @@ -8,6 +8,11 @@ class DistributedPressPublisher < ApplicationRecord # Cifrar la información del token en la base de datos has_encrypted :token + # La salida del log + # + # @return [IO] + attr_reader :logger_out + # La instancia es única validates_uniqueness_of :instance @@ -27,7 +32,7 @@ class DistributedPressPublisher < ApplicationRecord # # @return [DistributedPress::V1::Client] def client - @client ||= DistributedPress::V1::Client.new(url: instance, token: token) + @client ||= DistributedPress::V1::Client.new(url: instance, token: token, logger: logger) end # @return [String] @@ -35,8 +40,23 @@ class DistributedPressPublisher < ApplicationRecord "Distributed Press <#{instance}>" end + # @return [Logger] + def logger + @logger ||= + begin + @logger_out, @logger_in = IO.pipe + ::Logger.new @logger_in, formatter: formatter + end + end + private + def formatter + @formatter ||= lambda do |_, _, _, msg| + "#{msg}\n" + end + end + # Actualiza o desactiva la fecha de vencimiento a partir de la # información del token. # From 89f5ed90ebe60b2b9132c8bdad1e9ee3a310e970 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 8 Feb 2023 17:44:35 -0300 Subject: [PATCH 029/475] =?UTF-8?q?fix:=20link=20a=20saber=20m=C3=A1s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 2bbf58ea..f37afa7c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -263,7 +263,7 @@ en: storage network may continue retaining copies of the data indefinitely. - [Learn more](#) + [Learn more](https://ffdweb.org/building-distributed-press-a-publishing-tool-for-the-decentralized-web/) stats: index: title: Statistics diff --git a/config/locales/es.yml b/config/locales/es.yml index e3b24957..fef3b6eb 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -268,7 +268,7 @@ es: nodos en la red de almacenamiento distribuida puedan retener copias de tu contenido indefinidamente. - [Saber más](#) + [Saber más (en inglés)](https://ffdweb.org/building-distributed-press-a-publishing-tool-for-the-decentralized-web/) stats: index: title: Estadísticas From 15e6696bcf7b645b59a246c8fcd908db9671ad74 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 8 Feb 2023 18:49:37 -0300 Subject: [PATCH 030/475] feat: un deploy puede tener varias urls --- app/models/deploy_distributed_press.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index d805e923..d3474d50 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -60,6 +60,15 @@ class DeployDistributedPress < Deploy def destination; end + # Devuelve las URLs de todos los protocolos + def urls + remote_info[:links].values.map do |protocol| + [ protocol[:link], protocol[:gateway] ] + end.flatten.compact.select do |link| + link.include? '://' + end + end + private # El cliente de la API From 7ff284d547cd8e0ce8f0f30d4172db182e439430 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 8 Feb 2023 18:52:48 -0300 Subject: [PATCH 031/475] =?UTF-8?q?feat:=20texto=20para=20el=20correo=20de?= =?UTF-8?q?=20notificaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/en.yml | 4 ++++ config/locales/es.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index f37afa7c..ac8d7289 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -102,6 +102,10 @@ en: title: Alternative domain name success: Success! error: Error + deploy_distributed_press: + title: Distributed Web + success: Success! + error: Error help: You can contact us by replying to this e-mail maintenance_mailer: notice: diff --git a/config/locales/es.yml b/config/locales/es.yml index fef3b6eb..335fca66 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -102,6 +102,10 @@ es: title: Dominio alternativo success: ¡Éxito! error: Hubo un error + deploy_distributed_press: + title: Web distribuida + success: ¡Éxito! + error: Hubo un error help: Por cualquier duda, responde este correo para contactarte con nosotres. maintenance_mailer: notice: From 3f7b2484d04bee63bff7877f746721703043e217 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 9 Feb 2023 20:01:22 -0300 Subject: [PATCH 032/475] feat: crear temporalmente los dominios en njalla el problema es que no podemos delegar `_dnslink.*.sutty.nl` hacia distributed press, con lo que es necesario crear un subdominio por cada sitio que lo active. --- Gemfile | 1 + Gemfile.lock | 4 ++++ app/models/deploy_distributed_press.rb | 18 ++++++++++++++++++ app/models/distributed_press_publisher.rb | 7 +++++++ 4 files changed, 30 insertions(+) diff --git a/Gemfile b/Gemfile index 7f4cc6ca..8f742348 100644 --- a/Gemfile +++ b/Gemfile @@ -39,6 +39,7 @@ gem 'devise' gem 'devise-i18n' gem 'devise_invitable' gem 'distributed-press-api-client', '~> 0.2.2' +gem 'njalla-api-client' gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n' gem 'exception_notification' gem 'fast_blank' diff --git a/Gemfile.lock b/Gemfile.lock index b5b6fd18..6469b2db 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -419,6 +419,9 @@ GEM nokogiri (1.12.5-x86_64-linux-musl) mini_portile2 (~> 2.6.1) racc (~> 1.4) + njalla-api-client (0.1.0) + dry-schema + httparty (~> 0.18) orm_adapter (0.5.0) parallel (1.21.0) parser (3.0.2.0) @@ -741,6 +744,7 @@ DEPENDENCIES minima mobility net-ssh + njalla-api-client nokogiri pg pg_search diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index d3474d50..6f2b2c78 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -111,6 +111,12 @@ class DeployDistributedPress < Deploy self.remote_site_id = created_site[:id] self.remote_info = created_site.to_h + # XXX: Esto depende de nuestro DNS actual, cuando lo migremos hay + # que eliminarlo. + self.remote_info['njalla'] = {} + self.remote_info['njalla']['a'] = njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h + self.remote_info['njalla']['ns'] = njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h + nil end @@ -123,4 +129,16 @@ class DeployDistributedPress < Deploy build_stats.create action: publisher.to_s,log: log, seconds: time_spent_in_seconds, bytes: size, status: status nil end + + # Actualizar registros en Njalla + # + # @return [Njalla::V1::Domain] + def njalla + @njalla ||= + begin + client = Njalla::V1::Client.new(token: ENV['NJALLA_TOKEN']) + + Njalla::V1::Domain.new(domain: Site.domain, client: client) + end + end end diff --git a/app/models/distributed_press_publisher.rb b/app/models/distributed_press_publisher.rb index 089f63c6..6139db93 100644 --- a/app/models/distributed_press_publisher.rb +++ b/app/models/distributed_press_publisher.rb @@ -40,6 +40,13 @@ class DistributedPressPublisher < ApplicationRecord "Distributed Press <#{instance}>" end + # Devuelve el hostname de la instancia + # + # @return [String] + def hostname + @hostname ||= URI.parse(instance).hostname + end + # @return [Logger] def logger @logger ||= From a849eac17962a645a70b8fd5b5546aa8d285a46e Mon Sep 17 00:00:00 2001 From: f Date: Thu, 9 Feb 2023 20:08:56 -0300 Subject: [PATCH 033/475] fix: no crear subdominios para dominios personalizados esto es por retrocompatibilidad para sitios que no usan DeployAlternativeDomain --- app/models/deploy_distributed_press.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 6f2b2c78..1ae7a2f2 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -113,9 +113,11 @@ class DeployDistributedPress < Deploy # XXX: Esto depende de nuestro DNS actual, cuando lo migremos hay # que eliminarlo. - self.remote_info['njalla'] = {} - self.remote_info['njalla']['a'] = njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h - self.remote_info['njalla']['ns'] = njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h + unless site.name.end_with? '.' + self.remote_info['njalla'] = {} + self.remote_info['njalla']['a'] = njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h + self.remote_info['njalla']['ns'] = njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h + end nil end From a3c1d7193f8112006cffa60f830e38d9e8d669f2 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 9 Feb 2023 20:11:17 -0300 Subject: [PATCH 034/475] fix: requires --- app/models/deploy_distributed_press.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 1ae7a2f2..41054b99 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require 'distributed_press/v1/client/auth' require 'distributed_press/v1/client/site' +require 'njalla/v1' # Soportar Distributed Press APIv1 # From 8a5ecd98f75a9fcffefa68f8d0f9cb7516aa13c3 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 13 Mar 2023 20:31:16 -0300 Subject: [PATCH 035/475] fix: legible data, remove log section --- app/jobs/gitlab_notifier_job.rb | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index 701c6789..5d9baa9e 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -112,7 +112,6 @@ class GitlabNotifierJob < ApplicationJob # @return [String] def description @description ||= ''.dup.tap do |d| - d << log_section d << request_section d << javascript_section d << javascript_footer @@ -160,19 +159,6 @@ class GitlabNotifierJob < ApplicationJob @client ||= GitlabApiClient.new end - # @return [String] - def log_section - return '' unless options[:log] - - <<~LOG - # Log - - ``` - #{options[:log]} - ``` - LOG - end - # Muestra información de la petición # # @return [String] @@ -257,8 +243,8 @@ class GitlabNotifierJob < ApplicationJob ## Data - ``` - #{pp options[:data]} + ```yaml + #{options[:data].to_yaml} ``` DATA From df3faba784dd47542101175a0d9aacc8606e31a8 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 13 Mar 2023 20:31:39 -0300 Subject: [PATCH 036/475] fix: send sucker punch args --- config/initializers/sucker_punch.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/initializers/sucker_punch.rb b/config/initializers/sucker_punch.rb index 865af32d..19506c2d 100644 --- a/config/initializers/sucker_punch.rb +++ b/config/initializers/sucker_punch.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Enviar una notificación cuando falla una tarea -SuckerPunch.exception_handler = lambda { |ex, _klass, _args| - ExceptionNotifier.notify_exception(ex) +SuckerPunch.exception_handler = lambda { |ex, _, args| + ExceptionNotifier.notify_exception(ex, data: args) } From 72f982ee7646b211e16a50d04fc41a0e1346efae Mon Sep 17 00:00:00 2001 From: f Date: Mon, 13 Mar 2023 20:42:40 -0300 Subject: [PATCH 037/475] fix: no fallar la segunda vez que se reporta el issue --- app/jobs/gitlab_notifier_job.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index 5d9baa9e..d84ecda2 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -37,7 +37,7 @@ class GitlabNotifierJob < ApplicationJob } end - unless @issue['iid'] + if @issue['iid'].blank? && issue_data[:issue].blank? Rails.cache.delete(cache_key) raise GitlabNotifierError, @issue.dig('message', 'title')&.join(', ') end @@ -62,7 +62,7 @@ class GitlabNotifierJob < ApplicationJob # Si este trabajo genera una excepción va a entrar en un loop, así que # la notificamos por correo rescue Exception => e - email_notification.call(e) + email_notification.call(e, data: @issue) email_notification.call(exception, options) end From 347aba67287fedae424c0d52c2728e84a1dec2c2 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 13 Mar 2023 20:47:54 -0300 Subject: [PATCH 038/475] feat: seccion de log --- app/jobs/gitlab_notifier_job.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index d84ecda2..a127beaf 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -112,6 +112,7 @@ class GitlabNotifierJob < ApplicationJob # @return [String] def description @description ||= ''.dup.tap do |d| + d << log_section d << request_section d << javascript_section d << javascript_footer @@ -159,6 +160,21 @@ class GitlabNotifierJob < ApplicationJob @client ||= GitlabApiClient.new end + # @return [String] + def log_section + return if unless options.dig(:data, :log) + + <<~LOG + + # Build log + + ``` + #{option[:data].delete(:log)} + ``` + + LOG + end + # Muestra información de la petición # # @return [String] From 3764e14812309863a194a38efb17013414c3f88d Mon Sep 17 00:00:00 2001 From: f Date: Mon, 13 Mar 2023 20:49:00 -0300 Subject: [PATCH 039/475] fixup! feat: seccion de log --- app/jobs/gitlab_notifier_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index a127beaf..7c785126 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -162,7 +162,7 @@ class GitlabNotifierJob < ApplicationJob # @return [String] def log_section - return if unless options.dig(:data, :log) + return '' unless options.dig(:data, :log) <<~LOG From 5fe0efeccd7dd1fb9a16f8d89f0d448528934cb0 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 13 Mar 2023 20:50:14 -0300 Subject: [PATCH 040/475] fixup! fixup! feat: seccion de log --- app/jobs/gitlab_notifier_job.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index 7c785126..64caf977 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -126,6 +126,7 @@ class GitlabNotifierJob < ApplicationJob # @return [String] def body @body ||= ''.dup.tap do |b| + d << log_section b << request_section b << javascript_footer b << data_section From d166e669b7ce0e32ce9a0da07900f1dc675d992d Mon Sep 17 00:00:00 2001 From: f Date: Mon, 13 Mar 2023 20:51:28 -0300 Subject: [PATCH 041/475] fixup! fixup! fixup! feat: seccion de log --- app/jobs/gitlab_notifier_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index 64caf977..edc6cf63 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -126,7 +126,7 @@ class GitlabNotifierJob < ApplicationJob # @return [String] def body @body ||= ''.dup.tap do |b| - d << log_section + b << log_section b << request_section b << javascript_footer b << data_section From b552b0fecd8be260f06cc9c5e6a300cc87a557fe Mon Sep 17 00:00:00 2001 From: f Date: Mon, 13 Mar 2023 20:52:30 -0300 Subject: [PATCH 042/475] fixup! fixup! fixup! fixup! feat: seccion de log --- app/jobs/gitlab_notifier_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index edc6cf63..c8daf220 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -170,7 +170,7 @@ class GitlabNotifierJob < ApplicationJob # Build log ``` - #{option[:data].delete(:log)} + #{options[:data].delete(:log)} ``` LOG From 5822a9b661eecc331f422fb22c5b8365516522d2 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 14 Mar 2023 16:10:59 -0300 Subject: [PATCH 043/475] =?UTF-8?q?fix:=20enviar=20m=C3=A1s=20informaci?= =?UTF-8?q?=C3=B3n=20con=20el=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #10064 closes #10065 closes #10066 closes #10067 closes #10068 closes #10069 closes #10070 closes #10071 closes #10072 closes #10073 closes #10074 closes #10075 closes #10076 closes #10077 closes #10078 closes #10079 closes #10080 closes #10081 closes #10082 closes #10083 closes #10084 closes #10085 closes #10086 closes #10087 closes #10088 closes #10089 closes #10090 closes #10091 closes #10092 closes #10093 closes #10094 closes #10095 closes #10096 closes #10097 closes #10098 closes #10099 closes #10100 closes #10101 closes #10102 closes #10103 closes #10104 closes #10105 closes #10106 closes #10107 closes #10108 closes #10109 closes #10110 closes #10111 closes #10112 closes #10113 closes #10114 closes #10115 closes #10116 closes #10117 closes #10118 closes #10119 closes #10120 closes #10121 closes #10122 closes #10123 closes #10124 closes #10125 closes #10126 closes #10127 closes #10128 closes #10129 closes #10130 closes #10131 closes #10132 closes #10133 closes #10134 closes #10135 closes #10136 closes #10137 closes #10138 closes #10139 closes #10140 closes #10141 closes #10142 closes #10143 closes #10144 closes #10145 closes #10146 closes #10147 closes #10148 closes #10149 closes #10150 closes #10151 closes #10152 closes #10153 closes #10154 closes #10155 closes #10156 closes #10157 closes #10158 closes #10159 closes #10160 closes #10161 closes #10162 closes #10163 closes #10164 closes #10165 closes #10166 closes #10167 closes #10168 closes #10169 closes #10170 closes #10171 closes #10172 closes #10173 closes #10174 closes #10175 closes #10176 closes #10177 closes #10178 closes #10179 closes #10180 closes #10181 closes #10182 closes #10183 closes #10184 closes #10185 closes #10186 closes #10187 closes #10188 closes #10189 closes #10190 closes #10191 closes #10192 closes #10193 closes #10194 closes #10195 closes #10196 closes #10197 closes #10198 closes #10199 closes #10200 closes #10201 closes #10202 closes #10203 closes #10204 closes #10205 closes #10206 closes #10207 closes #10208 closes #10209 closes #10210 closes #10211 closes #10212 closes #10213 closes #10214 closes #10215 closes #10216 closes #10217 closes #10218 closes #10219 closes #10220 closes #10221 closes #10222 closes #10223 closes #10224 closes #10225 closes #10226 closes #10227 closes #10228 closes #10229 closes #10230 closes #10231 closes #10232 closes #10234 closes #10235 closes #10236 closes #10237 closes #10238 closes #10239 closes #10240 closes #10241 closes #10242 closes #10243 closes #10244 --- app/jobs/gitlab_notifier_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index c8daf220..11d4274a 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -63,7 +63,7 @@ class GitlabNotifierJob < ApplicationJob # la notificamos por correo rescue Exception => e email_notification.call(e, data: @issue) - email_notification.call(exception, options) + email_notification.call(exception, data: options) end private From 6f363f2c358a63d6ad74c2c0d962ca93f148c06b Mon Sep 17 00:00:00 2001 From: f Date: Tue, 14 Mar 2023 16:16:46 -0300 Subject: [PATCH 044/475] fix: params a veces es un array?? --- app/jobs/gitlab_notifier_job.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index 11d4274a..291112a5 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -84,10 +84,14 @@ class GitlabNotifierJob < ApplicationJob exception.class.name, Digest::SHA1.hexdigest(exception.message), Digest::SHA1.hexdigest(backtrace&.first.to_s), - Digest::SHA1.hexdigest(options.dig(:data, :params, 'errors').to_s) + Digest::SHA1.hexdigest(errors.to_s) ].join('/') end + def errors + options.dig(:data, :params, 'errors') if options.dig(:data, :params).is_a? Hash + end + # Define si es una excepción de javascript o local # # @see BacktraceJob From bbd19f44aee1686defc5039df36378ff8bc75c89 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 25 Jan 2023 14:27:14 -0300 Subject: [PATCH 045/475] ci: compilar assets cuando cambian las dependencias --- .woodpecker.yml | 17 +++++++++++++++++ package.json | 1 + 2 files changed, 18 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index 087b2e90..b3406f39 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,4 +1,21 @@ pipeline: + assets: + image: "registry.nulo.in/sutty/panel:3.14.8-2.7.6" + commands: + - "apk add python2" + - "yarn" + - "RAILS_GROUPS=assets bundle install --path=vendor" + - "RAILS_GROUPS=assets bundle exec rails assets:precompile assets:clean" + - "git add assets && git commit -m \"[skip ci] JS\" || true" + when: + branch: + - "rails" + - "panel.sutty.nl" + path: + include: + - "app/assets/**/*" + - "package.json" + - "yarn.lock" publish: image: plugins/docker settings: diff --git a/package.json b/package.json index d520c8f5..6a5f159f 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "sutty", + "author": "Sutty ", "private": true, "dependencies": { "@airbrake/browser": "^1.4.1", From 1b0c3cb0acf7d6aca045b253e2022065e60a152b Mon Sep 17 00:00:00 2001 From: f Date: Tue, 14 Mar 2023 19:11:18 -0300 Subject: [PATCH 046/475] ci: compilar en cambios de javascript tambien --- .woodpecker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index b3406f39..a2289c12 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -14,6 +14,7 @@ pipeline: path: include: - "app/assets/**/*" + - "app/javascript/**/*" - "package.json" - "yarn.lock" publish: From 0b63ebdd278051ba1b3b5c29fec87b67a6cedb60 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 14 Mar 2023 19:15:26 -0300 Subject: [PATCH 047/475] chore: yaml --- .woodpecker.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index a2289c12..de760284 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -18,29 +18,29 @@ pipeline: - "package.json" - "yarn.lock" publish: - image: plugins/docker + image: "plugins/docker" settings: - registry: registry.nulo.in - username: sutty - repo: registry.nulo.in/sutty/panel + registry: "registry.nulo.in" + username: "sutty" + repo: "registry.nulo.in/sutty/panel" tags: - - ${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH} - - latest + - "${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}" + - "latest" build_args: - - RUBY_VERSION=${RUBY_VERSION} - - RUBY_PATCH=${RUBY_PATCH} - - ALPINE_VERSION=${ALPINE_VERSION} - - BASE_IMAGE=registry.nulo.in/sutty/rails + - "RUBY_VERSION=${RUBY_VERSION}" + - "RUBY_PATCH=${RUBY_PATCH}" + - "ALPINE_VERSION=${ALPINE_VERSION}" + - "BASE_IMAGE=registry.nulo.in/sutty/rails" purge: false secrets: - - docker_password + - "docker_password" when: branch: - - rails - - panel.sutty.nl - event: push + - "rails" + - "panel.sutty.nl" + event: "push" matrix: include: - - ALPINE_VERSION: 3.14.8 - RUBY_VERSION: 2.7 - RUBY_PATCH: 6 + - ALPINE_VERSION: "3.14.8" + RUBY_VERSION: "2.7" + RUBY_PATCH: "6" From 6d25d71dd13d2dda59f7b8ae493cac597de383aa Mon Sep 17 00:00:00 2001 From: f Date: Tue, 14 Mar 2023 19:17:16 -0300 Subject: [PATCH 048/475] fix: solo compilar el container cuando cambia --- .woodpecker.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index de760284..aef70024 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -39,6 +39,10 @@ pipeline: - "rails" - "panel.sutty.nl" event: "push" + path: + include: + - "Dockerfile" + - ".dockerignore" matrix: include: - ALPINE_VERSION: "3.14.8" From 25e6cd62dd797be25c38e35124c8bce3ec11b3c1 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 14 Mar 2023 19:20:13 -0300 Subject: [PATCH 049/475] fix: aplicar una master key --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index aef70024..07f18570 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -5,7 +5,7 @@ pipeline: - "apk add python2" - "yarn" - "RAILS_GROUPS=assets bundle install --path=vendor" - - "RAILS_GROUPS=assets bundle exec rails assets:precompile assets:clean" + - "RAILS_GROUPS=assets RAILS_MASTER_KEY=nada bundle exec rails assets:precompile assets:clean" - "git add assets && git commit -m \"[skip ci] JS\" || true" when: branch: From 4b575801c539351f640a9cb36bcbebd902724780 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 14 Mar 2023 19:30:58 -0300 Subject: [PATCH 050/475] fix: usar .env --- .env.example | 3 ++- .woodpecker.yml | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index fb086224..3d134dc2 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,8 @@ +RAILS_MASTER_KEY=CHANGEME RAILS_GROUPS=assets DELEGATE=athshe.sutty.nl HAINISH=../haini.sh/haini.sh -DATABASE= +DATABASE_URL=postgres://suttier@postgresql.sutty.local/sutty RAILS_ENV=development IMAP_SERVER= DEFAULT_FROM= diff --git a/.woodpecker.yml b/.woodpecker.yml index 07f18570..1ad83060 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -2,10 +2,11 @@ pipeline: assets: image: "registry.nulo.in/sutty/panel:3.14.8-2.7.6" commands: - - "apk add python2" + - "apk add python2 dotenv" - "yarn" - - "RAILS_GROUPS=assets bundle install --path=vendor" - - "RAILS_GROUPS=assets RAILS_MASTER_KEY=nada bundle exec rails assets:precompile assets:clean" + - "cp .env.example .env" + - "dotenv bundle install --path=vendor" + - "dotenv RAILS_ENV=production bundle exec rails assets:precompile assets:clean" - "git add assets && git commit -m \"[skip ci] JS\" || true" when: branch: From cacd37348f0022c459fe3a59ddc88b3d40ceabb3 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 14 Mar 2023 19:51:46 -0300 Subject: [PATCH 051/475] fix: credenciales de prueba --- .env.example | 3 ++- .gitignore | 1 - config/credentials.yml.enc | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 config/credentials.yml.enc diff --git a/.env.example b/.env.example index 3d134dc2..f3cf48d9 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,5 @@ -RAILS_MASTER_KEY=CHANGEME +# pwgen -1 32 +RAILS_MASTER_KEY=11111111111111111111111111111111 RAILS_GROUPS=assets DELEGATE=athshe.sutty.nl HAINISH=../haini.sh/haini.sh diff --git a/.gitignore b/.gitignore index 496b66cb..baf85364 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,6 @@ # Ignore master key for decrypting credentials and more. /config/master.key -/config/credentials.yml.enc /public/packs /public/packs-test diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc new file mode 100644 index 00000000..ad215f22 --- /dev/null +++ b/config/credentials.yml.enc @@ -0,0 +1 @@ +r7drFxABS9885DuIhjg3ErL++9dkHZdO6/kBlBNlML20R2R2hhYkE1C2Q9fO7zGaHQX3y51FKu9nRAI9Bomp5JCF/RR3oEzP24Je9DsN/Q2lg3smTNuXKV5J8NuqZPRVBZIp7FsyR66xThzI6ZSrk0IFXRpTwQkW83v3Z+FqLKCAFBAiJ84occonkLUxppL0W0IYN4FzNAK0KiPixZDTg/oAqG17pY0suyJRCe86OYkdrvblI/EEmoxKzSPzT4fml4wka26z4KYeRYDjaQmlTJ8/zLK82AruxhYvL9abdtjsUYIVVWHdNrlRRZaVhFP79YIa0AFfHK1KviMKAAfb8EfDar1fivtzW9mb46dzZcEu0ynJB+HDdM1JFiVw33INI6BY8I604pu5B5ebd9Djd1nIP2wNZNu7ZBOgvbPnDJUdenVAnWYZAqmPVAryK1MfwvaG0RmVYnhlIZoQ2HTLENHV9AyAfUOUiZUse7GQ85iOqrn3yk2KxEh7i4U5yqZu2tuMBBmQK8jpDWiu6hEtIIDgL2327EUNTw1uDvMfpD64I9pBwHGXhKBr3Qi02rNwOI6wJBTLTaSHv15oAolVmiI3kWtQca+UO7LfMaU+mLb6xZ4jm3/maNmugKKHD4Ud7FO2nJ6m2FPUB7uolQPiiSY4cnkd2uKNn7aQPMDcWlQn1CQuwriGwhJD27YfYzyJRD5PG33bmR3JSSjUe4BI9cBTv3UZ7XS/B7Z7SEzqef09hpMUVzEsEsw5yW6Qm1MV8AhYaxPuWLOElwiATcObehJ7LyjeKQSwoTioEG4GBlvgujcNTxI5O0RkU7hP6I/A3Q==--3br8yafpyHA5Y6YU--Aq+HRsZsGTHm4pOfvQYyoA== \ No newline at end of file From 12a85bc5856424ed5ee87c9715410e4a05a6d694 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 14 Mar 2023 20:05:57 -0300 Subject: [PATCH 052/475] fix: credentials must be strings --- config/credentials.yml.enc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc index ad215f22..4add450d 100644 --- a/config/credentials.yml.enc +++ b/config/credentials.yml.enc @@ -1 +1 @@ -r7drFxABS9885DuIhjg3ErL++9dkHZdO6/kBlBNlML20R2R2hhYkE1C2Q9fO7zGaHQX3y51FKu9nRAI9Bomp5JCF/RR3oEzP24Je9DsN/Q2lg3smTNuXKV5J8NuqZPRVBZIp7FsyR66xThzI6ZSrk0IFXRpTwQkW83v3Z+FqLKCAFBAiJ84occonkLUxppL0W0IYN4FzNAK0KiPixZDTg/oAqG17pY0suyJRCe86OYkdrvblI/EEmoxKzSPzT4fml4wka26z4KYeRYDjaQmlTJ8/zLK82AruxhYvL9abdtjsUYIVVWHdNrlRRZaVhFP79YIa0AFfHK1KviMKAAfb8EfDar1fivtzW9mb46dzZcEu0ynJB+HDdM1JFiVw33INI6BY8I604pu5B5ebd9Djd1nIP2wNZNu7ZBOgvbPnDJUdenVAnWYZAqmPVAryK1MfwvaG0RmVYnhlIZoQ2HTLENHV9AyAfUOUiZUse7GQ85iOqrn3yk2KxEh7i4U5yqZu2tuMBBmQK8jpDWiu6hEtIIDgL2327EUNTw1uDvMfpD64I9pBwHGXhKBr3Qi02rNwOI6wJBTLTaSHv15oAolVmiI3kWtQca+UO7LfMaU+mLb6xZ4jm3/maNmugKKHD4Ud7FO2nJ6m2FPUB7uolQPiiSY4cnkd2uKNn7aQPMDcWlQn1CQuwriGwhJD27YfYzyJRD5PG33bmR3JSSjUe4BI9cBTv3UZ7XS/B7Z7SEzqef09hpMUVzEsEsw5yW6Qm1MV8AhYaxPuWLOElwiATcObehJ7LyjeKQSwoTioEG4GBlvgujcNTxI5O0RkU7hP6I/A3Q==--3br8yafpyHA5Y6YU--Aq+HRsZsGTHm4pOfvQYyoA== \ No newline at end of file +1jEfzfldP9tT4+HWfhP48I9hw31gYCnnxHWpYjPrcTm/pgkFdiG+mDa6y31EOxzs50w6FEw2GO127BnyBSUIPIxuWY0cR96xL5pVrS3vjyzM84QN4lJF9ER0Tz1AQ9S7NJ54CelSkMfFt/rf+O4YM8cLtdSVsVC/HlGbp16p3D1pm4MFo5cQb0hEmlyyYlzEn4oJtsp/MCIwI4+z8oFhxKdMIxdbiw+KS/7PBRfMm1h5rdGORCnD69iVmnXseMvVtZn9A7N7uR6+gFlhxlD5yyEW0pwTj3tbu9NeIOVbtmYOL5ZhLW9REXtGTqR5Op/LN+ukIXbDNEScKltJXUdWfa9Pd/QjVT8IMURZ04POEMDgs1cw363yz4f+WQForhSco9oYLDOd5hTGRXoZ9fnjnfJSTjINM62hkfDY3w3+s844nNbjbj+lPTJHU/QjRhcuNqBDDxWUfwTmRIqm5zrelnHnZnuFmFwCNet6NChC6EFUAFjrals6kTSQllyMt4xImqA+HL7DnjWj6VURSH+nGQTA4tQvDdfbDwTzg/PvRkJcsy2dRd135RQdmRZ+8KXBviLabwdR256vaCqSO1j+jyeUPGLll35ghyLxncyBkkAKt1zaDRPDWgVafg0gJ3v7hVV5TYgToPzlv4w88KPCY7cBhkb1qGoXAhtO6iAuZYK9eyZd1gNQJKyqbcLqA5aTTX/ylfdbptWhaZ8ibB8KBgVyn2RmrOHEhB38rDSMHHNfK3Xs4/hhqMFIGHGTGCUYVmjCzhVFd15yRurU32d3YtP8W4L77H7qkFsF1gnvsZx+R084LcJqknwY94dmjtUE4x2u+Qh3ElFj--lr8JoUq1WH9xXNsB--mE8hxHADL7SbDWabAPY1+Q== \ No newline at end of file From 723b8e7974f5a04d1bd775a40e3c9f2c5944ba4a Mon Sep 17 00:00:00 2001 From: f Date: Tue, 14 Mar 2023 20:26:07 -0300 Subject: [PATCH 053/475] ci: publicar los assets --- .woodpecker.yml | 51 +++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 1ad83060..3f3c510c 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,23 +1,4 @@ pipeline: - assets: - image: "registry.nulo.in/sutty/panel:3.14.8-2.7.6" - commands: - - "apk add python2 dotenv" - - "yarn" - - "cp .env.example .env" - - "dotenv bundle install --path=vendor" - - "dotenv RAILS_ENV=production bundle exec rails assets:precompile assets:clean" - - "git add assets && git commit -m \"[skip ci] JS\" || true" - when: - branch: - - "rails" - - "panel.sutty.nl" - path: - include: - - "app/assets/**/*" - - "app/javascript/**/*" - - "package.json" - - "yarn.lock" publish: image: "plugins/docker" settings: @@ -44,6 +25,38 @@ pipeline: include: - "Dockerfile" - ".dockerignore" + assets: + image: "registry.nulo.in/sutty/panel:${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}" + commands: + - "apk add python2 dotenv openssh-client" + - "mkdir ~/.ssh/" + - "echo \"$${KNOW_HOSTS}\" | base64 -d >> ~/.ssh/known_hosts" + - "eval $(ssh-agent -s)" + - "echo \"$${SSH_KEY}\" | base64 -d | ssh-add -" + - "git config user.name Woodpecker" + - "git config user.email ci@sutty.coop.ar" + - "git remote add origin ${ORIGIN}" + - "git checkout -B ${CI_COMMIT_BRANCH}" + - "yarn" + - "cp .env.example .env" + - "dotenv bundle install --path=vendor" + - "dotenv RAILS_ENV=production bundle exec rails assets:precompile assets:clean" + - "git add public && git commit -m \"ci: assets [skip ci]\"" + - "git push origin ${CI_COMMIT_BRANCH}" + secrets: + - "SSH_KEY" + - "KNOWN_HOSTS" + - "ORIGIN" + when: + branch: + - "rails" + - "panel.sutty.nl" + path: + include: + - "app/assets/**/*" + - "app/javascript/**/*" + - "package.json" + - "yarn.lock" matrix: include: - ALPINE_VERSION: "3.14.8" From 08cad58b77f418b983d03317e0a748153f336e07 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 14 Mar 2023 20:29:58 -0300 Subject: [PATCH 054/475] fixup! ci: publicar los assets --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 3f3c510c..198f5a99 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -35,7 +35,7 @@ pipeline: - "echo \"$${SSH_KEY}\" | base64 -d | ssh-add -" - "git config user.name Woodpecker" - "git config user.email ci@sutty.coop.ar" - - "git remote add origin ${ORIGIN}" + - "git remote add origin $${ORIGIN}" - "git checkout -B ${CI_COMMIT_BRANCH}" - "yarn" - "cp .env.example .env" From 9773285e9f4d060473eafb16a1b76edbf171b475 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 15 Mar 2023 11:23:35 -0300 Subject: [PATCH 055/475] fix: no duplicar el remote --- .woodpecker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 198f5a99..41dc85a3 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -35,14 +35,14 @@ pipeline: - "echo \"$${SSH_KEY}\" | base64 -d | ssh-add -" - "git config user.name Woodpecker" - "git config user.email ci@sutty.coop.ar" - - "git remote add origin $${ORIGIN}" + - "git remote add upstream $${ORIGIN}" - "git checkout -B ${CI_COMMIT_BRANCH}" - "yarn" - "cp .env.example .env" - "dotenv bundle install --path=vendor" - "dotenv RAILS_ENV=production bundle exec rails assets:precompile assets:clean" - "git add public && git commit -m \"ci: assets [skip ci]\"" - - "git push origin ${CI_COMMIT_BRANCH}" + - "git push upstream ${CI_COMMIT_BRANCH}" secrets: - "SSH_KEY" - "KNOWN_HOSTS" From c9d7ac437bd5e88531dac3d375250a2bb096a5cd Mon Sep 17 00:00:00 2001 From: f Date: Thu, 16 Mar 2023 09:51:28 -0300 Subject: [PATCH 056/475] =?UTF-8?q?ci:=20probar=20conexi=C3=B3n=20a=20ssh?= =?UTF-8?q?=20antes=20de=20perder=20tiempo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .woodpecker.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 41dc85a3..84101fdf 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -29,10 +29,12 @@ pipeline: image: "registry.nulo.in/sutty/panel:${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}" commands: - "apk add python2 dotenv openssh-client" - - "mkdir ~/.ssh/" - - "echo \"$${KNOW_HOSTS}\" | base64 -d >> ~/.ssh/known_hosts" + - "install -d -m 700 ~/.ssh/" + - "echo \"$${KNOWN_HOSTS}\" | base64 -d >> ~/.ssh/known_hosts" + - "chmod 600 ~/.ssh/known_hosts" - "eval $(ssh-agent -s)" - "echo \"$${SSH_KEY}\" | base64 -d | ssh-add -" + - "ssh $${ORIGIN%:*}" - "git config user.name Woodpecker" - "git config user.email ci@sutty.coop.ar" - "git remote add upstream $${ORIGIN}" From b51748ddcbc903838fb76c4d1c3df1ee490153bf Mon Sep 17 00:00:00 2001 From: f Date: Thu, 16 Mar 2023 10:18:42 -0300 Subject: [PATCH 057/475] ci: limpiar assets por separado --- .woodpecker.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 84101fdf..e550afbe 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -42,7 +42,8 @@ pipeline: - "yarn" - "cp .env.example .env" - "dotenv bundle install --path=vendor" - - "dotenv RAILS_ENV=production bundle exec rails assets:precompile assets:clean" + - "dotenv RAILS_ENV=production bundle exec rails assets:precompile" + - "dotenv RAILS_ENV=production bundle exec rails assets:clean" - "git add public && git commit -m \"ci: assets [skip ci]\"" - "git push upstream ${CI_COMMIT_BRANCH}" secrets: From 4de942a7ca5536260a092c0e2aa07e57f4f1d283 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 16 Mar 2023 10:23:11 -0300 Subject: [PATCH 058/475] ci: eliminar packs antes de recompilarlos --- .woodpecker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index e550afbe..0492cee2 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -42,6 +42,7 @@ pipeline: - "yarn" - "cp .env.example .env" - "dotenv bundle install --path=vendor" + - "dotenv RAILS_ENV=production bundle exec rails webpacker:clobber" - "dotenv RAILS_ENV=production bundle exec rails assets:precompile" - "dotenv RAILS_ENV=production bundle exec rails assets:clean" - "git add public && git commit -m \"ci: assets [skip ci]\"" From 800386e52ccbe6d40dfe08469d83f1bfa8696040 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 16 Mar 2023 11:24:38 -0300 Subject: [PATCH 059/475] =?UTF-8?q?ci:=20no=20hacer=20conflicto=20con=20la?= =?UTF-8?q?s=20credenciales=20de=20producci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .woodpecker.yml | 1 + config/{credentials.yml.enc => credentials.yml.enc.ci} | 0 2 files changed, 1 insertion(+) rename config/{credentials.yml.enc => credentials.yml.enc.ci} (100%) diff --git a/.woodpecker.yml b/.woodpecker.yml index 0492cee2..ab4887ac 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -39,6 +39,7 @@ pipeline: - "git config user.email ci@sutty.coop.ar" - "git remote add upstream $${ORIGIN}" - "git checkout -B ${CI_COMMIT_BRANCH}" + - "mv config/credentials.yml.enc.ci config/credentials.yml.enc" - "yarn" - "cp .env.example .env" - "dotenv bundle install --path=vendor" diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc.ci similarity index 100% rename from config/credentials.yml.enc rename to config/credentials.yml.enc.ci From a97da5b821768a1a2fdcf0eba185835d70cc2ee7 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 16 Mar 2023 12:22:37 -0300 Subject: [PATCH 060/475] fix: volver a ignorar los secretos --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index baf85364..496b66cb 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ # Ignore master key for decrypting credentials and more. /config/master.key +/config/credentials.yml.enc /public/packs /public/packs-test From 2654a5c977c6c8ff5ffef53d5dfd8f76093e7291 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 16 Mar 2023 12:29:57 -0300 Subject: [PATCH 061/475] fix: los assets los compila la ci --- Makefile | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Makefile b/Makefile index fd264d89..5d6c066b 100644 --- a/Makefile +++ b/Makefile @@ -48,9 +48,6 @@ help: always ## Ayuda @echo -e "\nArgumentos:\n" @grep -E "^[a-z\-]+ \?=.*##" Makefile | sed -re "s/(.*) \?=.*##(.*)/\1;\2/" | column -s ";" -t | sed -re "s/^([^ ]+) /\x1B[38;5;197m\1\x1B[0m/" -assets: public/packs/manifest.json.br ## Compilar los assets - git add public/assets/ public/packs/ && git commit -m "assets [skip ci]" - test: always ## Ejecutar los tests $(MAKE) rake args="test RAILS_ENV=test $(args)" @@ -111,19 +108,13 @@ save: ## Subir la imagen Docker al nodo delegado date +%F | xargs -I {} git tag -f $(container)-{} @echo -e "\a" -ota: assets ## Actualizar Rails en el nodo delegado +ota: ## Actualizar Rails en el nodo delegado git push ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl pull ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl lfs prune ssh $(delegate) chown -R 1000:82 /srv/sutty/srv/http/panel.sutty.nl ssh $(delegate) docker exec $(container) rails reload -# Todos los archivos de assets. Si alguno cambia, se van a recompilar -# los assets que luego se suben al nodo delegado. -assets := package.json yarn.lock $(shell find app/assets/ app/javascript/ -type f) -public/packs/manifest.json.br: $(assets) - $(hain) 'PANEL_URL=https://panel.sutty.nl RAILS_ENV=production NODE_ENV=production bundle exec rake assets:precompile assets:clean' - # Correr un test en particular por ejemplo # `make test/models/usuarie_test.rb` tests := $(shell find test/ -name "*_test.rb") From f2e79a733d26f1cf578d1f49f995aea14376a246 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 17 Mar 2023 17:33:52 -0300 Subject: [PATCH 062/475] fix: no fallar si hay errores remotos closes #10467 closes #10506 closes #10509 --- app/models/deploy_distributed_press.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 41054b99..09410201 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -118,7 +118,9 @@ class DeployDistributedPress < Deploy self.remote_info['njalla']['a'] = njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h self.remote_info['njalla']['ns'] = njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h end - + rescue DistributedPress::V1::Error, HTTParty::Error => e + ExceptionNotifier.notify_exception(e, data: { site: site.name }) + ensure nil end From 0c674d6ca12fc0f98645a922e18efd13de85cd09 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 17 Mar 2023 17:37:48 -0300 Subject: [PATCH 063/475] fix: crear el sitio remoto si no se pudo crear antes --- app/models/deploy_distributed_press.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 09410201..bd80dca4 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -27,6 +27,11 @@ class DeployDistributedPress < Deploy time_start + if remote_site_id.blank? || remote_info['njalla'].blank? + create_remote_site! + save + end + site_client.tap do |c| stdout = Thread.new(publisher.logger_out) do |io| until io.eof? From 698b3a0bf6bbbaf6b84a8c0c961de081e2c1989b Mon Sep 17 00:00:00 2001 From: f Date: Fri, 17 Mar 2023 17:39:41 -0300 Subject: [PATCH 064/475] =?UTF-8?q?feat:=20separar=20la=20creaci=C3=B3n=20?= =?UTF-8?q?de=20DP=20de=20njalla?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_distributed_press.rb | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index bd80dca4..9afc6a5d 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -15,7 +15,7 @@ require 'njalla/v1' class DeployDistributedPress < Deploy store :values, accessors: %i[hostname remote_site_id remote_info], coder: JSON - before_create :create_remote_site! + before_create :create_remote_site!, :create_njalla_records! # Actualiza la información y luego envía los cambios # @@ -27,10 +27,9 @@ class DeployDistributedPress < Deploy time_start - if remote_site_id.blank? || remote_info['njalla'].blank? - create_remote_site! - save - end + create_remote_site! if remote_site_id.blank? + create_njalla_records! if remote_info['njalla'].blank? + save site_client.tap do |c| stdout = Thread.new(publisher.logger_out) do |io| @@ -115,7 +114,16 @@ class DeployDistributedPress < Deploy self.remote_site_id = created_site[:id] self.remote_info = created_site.to_h + rescue DistributedPress::V1::Error + ExceptionNotifier.notify_exception(e, data: { site: site.name }) + ensure + nil + end + # Crea los registros en Njalla + # + # @return [nil] + def create_njalla_records! # XXX: Esto depende de nuestro DNS actual, cuando lo migremos hay # que eliminarlo. unless site.name.end_with? '.' @@ -123,7 +131,7 @@ class DeployDistributedPress < Deploy self.remote_info['njalla']['a'] = njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h self.remote_info['njalla']['ns'] = njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h end - rescue DistributedPress::V1::Error, HTTParty::Error => e + rescue HTTParty::Error => e ExceptionNotifier.notify_exception(e, data: { site: site.name }) ensure nil From b297800933ae0556845f1e710ce181a6d4e158cb Mon Sep 17 00:00:00 2001 From: f Date: Fri, 17 Mar 2023 17:44:13 -0300 Subject: [PATCH 065/475] fix: volver a fallar si al hacer deploy todavia estan caidos los servicios --- app/models/deploy_distributed_press.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 9afc6a5d..e8d8b095 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -31,6 +31,10 @@ class DeployDistributedPress < Deploy create_njalla_records! if remote_info['njalla'].blank? save + if remote_site_id.blank? || remote_info['njalla'].blank? + raise DeployJob::DeployException, '' + end + site_client.tap do |c| stdout = Thread.new(publisher.logger_out) do |io| until io.eof? @@ -133,6 +137,7 @@ class DeployDistributedPress < Deploy end rescue HTTParty::Error => e ExceptionNotifier.notify_exception(e, data: { site: site.name }) + self.remote_info['njalla'] = nil ensure nil end From 5ec698366a524583063cefb84d652084e2841788 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 20 Mar 2023 11:46:21 -0300 Subject: [PATCH 066/475] fix: capturar standard error --- app/jobs/gitlab_notifier_job.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index 291112a5..fb25be10 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -61,7 +61,7 @@ class GitlabNotifierJob < ApplicationJob Rails.cache.write(cache_key, issue_data) # Si este trabajo genera una excepción va a entrar en un loop, así que # la notificamos por correo - rescue Exception => e + rescue StandardError => e email_notification.call(e, data: @issue) email_notification.call(exception, data: options) end @@ -89,7 +89,9 @@ class GitlabNotifierJob < ApplicationJob end def errors - options.dig(:data, :params, 'errors') if options.dig(:data, :params).is_a? Hash + return '' unless javascript? + + options.dig(:data, :params, 'errors') end # Define si es una excepción de javascript o local From 16ed7db1d76ff24ee5c8a6d88b6c35788c22441a Mon Sep 17 00:00:00 2001 From: f Date: Mon, 20 Mar 2023 12:13:51 -0300 Subject: [PATCH 067/475] =?UTF-8?q?fix:=20capturar=20la=20excepci=C3=B3n?= =?UTF-8?q?=20#10546?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_distributed_press.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index e8d8b095..6940a83e 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -118,7 +118,7 @@ class DeployDistributedPress < Deploy self.remote_site_id = created_site[:id] self.remote_info = created_site.to_h - rescue DistributedPress::V1::Error + rescue DistributedPress::V1::Error => e ExceptionNotifier.notify_exception(e, data: { site: site.name }) ensure nil From d25937f536ef072f2a9323b03e1bbaa4809fcd40 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 20 Mar 2023 15:33:28 -0300 Subject: [PATCH 068/475] fix: no producir type error --- app/jobs/gitlab_notifier_job.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index fb25be10..2f39caf9 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -16,7 +16,7 @@ class GitlabNotifierJob < ApplicationJob # @param [Hash] opciones de ExceptionNotifier def perform(exception, **options) @exception = exception - @options = options + @options = fix_options options @issue_data = { count: 1 } # Necesitamos saber si el issue ya existía @cached = false @@ -88,10 +88,9 @@ class GitlabNotifierJob < ApplicationJob ].join('/') end + # @return [Array] def errors - return '' unless javascript? - - options.dig(:data, :params, 'errors') + options.dig(:data, :params, 'errors') || [] end # Define si es una excepción de javascript o local @@ -288,4 +287,15 @@ class GitlabNotifierJob < ApplicationJob def url @url ||= request&.url || options.dig(:data, :params, 'context', 'url') end + + # Define llaves necesarias + # + # @param :options [Hash] + # @return [Hash] + def fix_options(options) + options[:data] ||= {} + options[:data][:params] ||= {} + + options + end end From 7d7fcdc409b34b040218168499c558e0aa3d5e96 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 20 Mar 2023 16:08:37 -0300 Subject: [PATCH 069/475] fix: recuperar el comportamiento esperado #2123 --- app/controllers/usuaries_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 6d02a35a..c60ea206 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -88,16 +88,16 @@ class UsuariesController < ApplicationController # TODO: Enviar invitación igual! Podemos no usar el Mailer de # DeviseInvitations y usar uno propio que contenga texto y se # envíe de todas formas. - usuarie = Usuarie.invite! email: invitacion.address, - skip_invitation: true + attributes = { email: invitacion.address } + options = { skip_invitation: true } + usuarie = Usuarie.invite! attributes, current_usuarie, options # No invitar al sitio si ya estaba en la lista! # # XXX: En este caso no estamos enviando ninguna invitación next if usuarie.sites.exists? @site.id - @site.roles << Rol.create(usuarie: usuarie, site: @site, - temporal: true, rol: invited_as) + @site.roles.create(usuarie: usuarie, temporal: true, rol: invited_as) # Invitamos después de crear el rol para que el correo de # invitación pueda recibir el sitio. From 61a23cb3d7945171ce08f56e469fcfcf4b666eb1 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 20 Mar 2023 16:54:00 -0300 Subject: [PATCH 070/475] =?UTF-8?q?fix:=20solo=20enviar=20invitaci=C3=B3n?= =?UTF-8?q?=20si=20le=20usuarie=20no=20existe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/usuaries_controller.rb | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index c60ea206..3dd78de1 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -82,26 +82,14 @@ class UsuariesController < ApplicationController # Enviar la invitación si es necesario y agregar al sitio invitaciones.each do |invitacion| - # Si la cuenta no existe, envía una invitación por correo, sino, - # no se envía nada - # - # TODO: Enviar invitación igual! Podemos no usar el Mailer de - # DeviseInvitations y usar uno propio que contenga texto y se - # envíe de todas formas. attributes = { email: invitacion.address } - options = { skip_invitation: true } - usuarie = Usuarie.invite! attributes, current_usuarie, options - # No invitar al sitio si ya estaba en la lista! - # - # XXX: En este caso no estamos enviando ninguna invitación + usuarie = Usuarie.find_by attributes + usuarie ||= Usuarie.invite! attributes, current_usuarie + next if usuarie.sites.exists? @site.id @site.roles.create(usuarie: usuarie, temporal: true, rol: invited_as) - - # Invitamos después de crear el rol para que el correo de - # invitación pueda recibir el sitio. - usuarie.deliver_invitation end redirect_to site_usuaries_path(@site) From 92fa2b89324a9973d31bc5acdb3185246a12db06 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 20 Mar 2023 16:59:27 -0300 Subject: [PATCH 071/475] fix: no llevar registro de quien se conoce con quien aunque es un poco obvio al mirar la lista de usuaries de un sitio --- app/controllers/usuaries_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 3dd78de1..9cc756f7 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -85,7 +85,7 @@ class UsuariesController < ApplicationController attributes = { email: invitacion.address } usuarie = Usuarie.find_by attributes - usuarie ||= Usuarie.invite! attributes, current_usuarie + usuarie ||= Usuarie.invite! attributes next if usuarie.sites.exists? @site.id From 362e45b51d0bb67fbf4f88d19ead72c35b7f52dc Mon Sep 17 00:00:00 2001 From: f Date: Mon, 20 Mar 2023 17:17:53 -0300 Subject: [PATCH 072/475] fix: efectivamente ignorar mails que ya son usuaries de este sitio --- app/controllers/usuaries_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 9cc756f7..2dd3ea99 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -84,11 +84,11 @@ class UsuariesController < ApplicationController invitaciones.each do |invitacion| attributes = { email: invitacion.address } + next if Usuarie.where(id: @site.roles.pluck(:usuarie_id)).find_by(attributes) + usuarie = Usuarie.find_by attributes usuarie ||= Usuarie.invite! attributes - next if usuarie.sites.exists? @site.id - @site.roles.create(usuarie: usuarie, temporal: true, rol: invited_as) end From 11e503061cf3dde80bdf5100fe268ecc9fbbdb2d Mon Sep 17 00:00:00 2001 From: f Date: Mon, 20 Mar 2023 17:22:40 -0300 Subject: [PATCH 073/475] =?UTF-8?q?fix:=20enviar=20invitaci=C3=B3n=20sin?= =?UTF-8?q?=20link?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Usuarie#deliver_invitation además generaba un token cuando no era necesario y esto es lo que hacía que les usuaries quedaran flotando. --- app/controllers/usuaries_controller.rb | 5 ++++- .../mailer/invitation_instructions.html.haml | 17 +++++++++------- .../mailer/invitation_instructions.text.haml | 20 +++++++++++-------- config/locales/devise_invitable.en.yml | 1 + config/locales/devise_invitable.es.yml | 1 + 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 2dd3ea99..7621489e 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -86,7 +86,10 @@ class UsuariesController < ApplicationController next if Usuarie.where(id: @site.roles.pluck(:usuarie_id)).find_by(attributes) - usuarie = Usuarie.find_by attributes + usuarie = Usuarie.find_by(attributes).tap do |u| + u.send(:send_devise_notification, :invitation_instructions, nil) + end + usuarie ||= Usuarie.invite! attributes @site.roles.create(usuarie: usuarie, temporal: true, rol: invited_as) diff --git a/app/views/devise/mailer/invitation_instructions.html.haml b/app/views/devise/mailer/invitation_instructions.html.haml index 74193878..e1fe6812 100644 --- a/app/views/devise/mailer/invitation_instructions.html.haml +++ b/app/views/devise/mailer/invitation_instructions.html.haml @@ -8,12 +8,15 @@ %h1= site.title %p= site.description -%p= link_to t('devise.mailer.invitation_instructions.accept'), - accept_invitation_url(@resource, invitation_token: @token) +- if @resource.created_by_invite? + %p= link_to t('devise.mailer.invitation_instructions.accept'), + accept_invitation_url(@resource, invitation_token: @token) -- if @resource.invitation_due_at - %p= t('devise.mailer.invitation_instructions.accept_until', - due_date: l(@resource.invitation_due_at, - format: :'devise.mailer.invitation_instructions.accept_until_format')) + - if @resource.invitation_due_at + %p= t('devise.mailer.invitation_instructions.accept_until', + due_date: l(@resource.invitation_due_at, + format: :'devise.mailer.invitation_instructions.accept_until_format')) -%p= t('devise.mailer.invitation_instructions.ignore') + %p= t('devise.mailer.invitation_instructions.ignore') +- else + %p= link_to t('devise.mailer.invitation_instructions.sign_in'), root_url diff --git a/app/views/devise/mailer/invitation_instructions.text.haml b/app/views/devise/mailer/invitation_instructions.text.haml index 16a9f0a8..353f2a12 100644 --- a/app/views/devise/mailer/invitation_instructions.text.haml +++ b/app/views/devise/mailer/invitation_instructions.text.haml @@ -9,11 +9,15 @@ \ = site.description \ -= accept_invitation_url(@resource, invitation_token: @token) -\ -- if @resource.invitation_due_at - = t('devise.mailer.invitation_instructions.accept_until', - due_date: l(@resource.invitation_due_at, - format: :'devise.mailer.invitation_instructions.accept_until_format')) -\ -= t('devise.mailer.invitation_instructions.ignore') +- if @resource.created_by_invite? + = accept_invitation_url(@resource, invitation_token: @token) + \ + - if @resource.invitation_due_at + = t('devise.mailer.invitation_instructions.accept_until', + due_date: l(@resource.invitation_due_at, + format: :'devise.mailer.invitation_instructions.accept_until_format')) + \ + = t('devise.mailer.invitation_instructions.ignore') +- else + = root_url(change_locale_to: @resource.lang) + = t('devise.mailer.invitation_instructions.sign_in') diff --git a/config/locales/devise_invitable.en.yml b/config/locales/devise_invitable.en.yml index f6bfee40..39238140 100644 --- a/config/locales/devise_invitable.en.yml +++ b/config/locales/devise_invitable.en.yml @@ -23,6 +23,7 @@ en: accept: "Accept invitation" accept_until: "This invitation will be due in %{due_date}." ignore: "If you don't want to accept the invitation, please ignore this email. Your account won't be created until you access the link above and set your password." + sign_in: "Sign in to your account to accept or decline the invitation." time: formats: devise: diff --git a/config/locales/devise_invitable.es.yml b/config/locales/devise_invitable.es.yml index 144d6df6..e83a703c 100644 --- a/config/locales/devise_invitable.es.yml +++ b/config/locales/devise_invitable.es.yml @@ -23,6 +23,7 @@ es: accept: "Aceptar la invitación" accept_until: "La invitación vencerá el %{due_date}." ignore: "Si no querés aceptar la invitación, por favor ignora este correo. Tu cuenta no será creada hasta que aceptes la invitación y configures una contraseña." + sign_in: "Iniciá sesión con tu cuenta para aceptar o rechazar la invitación." time: formats: devise: From 706ff80b1864b791197741ff5afbd98ab808baae Mon Sep 17 00:00:00 2001 From: f Date: Tue, 21 Mar 2023 14:05:11 -0300 Subject: [PATCH 074/475] =?UTF-8?q?fix:=20algo=20est=C3=A1=20enviando=20la?= =?UTF-8?q?s=20opciones=20como=20array?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/gitlab_notifier_job.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index 2f39caf9..4d57c744 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -293,6 +293,7 @@ class GitlabNotifierJob < ApplicationJob # @param :options [Hash] # @return [Hash] def fix_options(options) + options = { data: options } if options.is_a? Array options[:data] ||= {} options[:data][:params] ||= {} From 1230dc2e96eb2bc117f1f92433e0d97748d4f2bf Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 09:58:00 -0300 Subject: [PATCH 075/475] fix: solo permitimos un hash de opciones --- app/jobs/gitlab_notifier_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index 4d57c744..7b369fab 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -293,7 +293,7 @@ class GitlabNotifierJob < ApplicationJob # @param :options [Hash] # @return [Hash] def fix_options(options) - options = { data: options } if options.is_a? Array + options = { data: options } unless options.is_a? Hash options[:data] ||= {} options[:data][:params] ||= {} From bbb951594b8594d6d71943b77c077573d813b8e1 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 09:59:36 -0300 Subject: [PATCH 076/475] fix: enviar las opciones post limpieza --- app/jobs/gitlab_notifier_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index 7b369fab..575d57d8 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -63,7 +63,7 @@ class GitlabNotifierJob < ApplicationJob # la notificamos por correo rescue StandardError => e email_notification.call(e, data: @issue) - email_notification.call(exception, data: options) + email_notification.call(exception, data: @options) end private From 823ac94e7434282a55a9d6a71fb235a7af553b2c Mon Sep 17 00:00:00 2001 From: Nulo Date: Mon, 2 May 2022 18:55:35 +0000 Subject: [PATCH 077/475] Arreglar scroll al reordenar posts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Utilizaba https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoViewIfNeeded que es propietario. Ahora usa scrollIntoView siempre, configurado para que prácticamente siempre se pueda ver el post al reordenar. --- app/javascript/controllers/reorder_controller.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/javascript/controllers/reorder_controller.js b/app/javascript/controllers/reorder_controller.js index dca6e166..2cba4163 100644 --- a/app/javascript/controllers/reorder_controller.js +++ b/app/javascript/controllers/reorder_controller.js @@ -103,11 +103,7 @@ export default class extends Controller { this.reorder() // Mantenemos el primero a la vista - if ("scrollIntoViewIfNeeded" in rows[0].row) { - rows[0].row.scrollIntoViewIfNeeded() - } else { - rows[0].row.scrollIntoView() - } + rows[0].row.scrollIntoView({ block: "center" }); } counter () { @@ -146,7 +142,7 @@ export default class extends Controller { this.reorder() // Mantenemos el primero a la vista - rows[0].row.scrollIntoViewIfNeeded() + rows[0].row.scrollIntoView({ block: "center" }); } bottom (event) { @@ -167,7 +163,7 @@ export default class extends Controller { this.reorder() // Mantenemos el primero a la vista - rows[0].row.scrollIntoViewIfNeeded() + rows[0].row.scrollIntoView({ block: "center" }); } /* From 88c1ffe4b8f1ff60bca474cf1ffe5263f8d417e9 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 13:43:13 -0300 Subject: [PATCH 078/475] fix: hacer que los locales sean bidireccionales #10491 #12064 --- app/models/metadata_locales.rb | 11 +----- app/views/posts/attributes/_locales.haml | 48 +++++++----------------- 2 files changed, 16 insertions(+), 43 deletions(-) diff --git a/app/models/metadata_locales.rb b/app/models/metadata_locales.rb index 4d540efc..702e1902 100644 --- a/app/models/metadata_locales.rb +++ b/app/models/metadata_locales.rb @@ -1,21 +1,14 @@ # frozen_string_literal: true # Los valores de este metadato son artículos en otros idiomas -class MetadataLocales < MetadataTemplate - def default_value - super || [] - end - +class MetadataLocales < MetadataHasAndBelongsToMany # Todos los valores posibles para cada idioma disponible # - # TODO: Optimizar? - # TODO: Mantener sincronizados - # # @return { lang: { title: uuid } } def values @values ||= site.locales.map do |locale| [locale, site.posts(lang: locale).map do |post| - [post.title.value, post.uuid.value] + [title(post), post.uuid.value] end.to_h] end.to_h end diff --git a/app/views/posts/attributes/_locales.haml b/app/views/posts/attributes/_locales.haml index 8dd7adf6..6d4d3326 100644 --- a/app/views/posts/attributes/_locales.haml +++ b/app/views/posts/attributes/_locales.haml @@ -1,39 +1,19 @@ --# +%fieldset + %legend= post_label_t(attribute, post: post) - Crea un input-map para cada idioma por separado. Podríamos hacer uno - solo que tenga todos los idiomas pero puede ser una interfaz confusa. + = render 'posts/attribute_feedback', + post: post, attribute: attribute, metadata: metadata - TODO: Esto permite seleccionar más de una traducción por idioma... + - site.locales.each do |locale| + - next if post.lang.value == locale + - locale_t = t("locales.#{locale}.name") -- site.locales.each do |locale| - -# Ignorar el idioma actual - - next if post.lang.value == locale - - locale_t = t("locales.#{locale}.name") - - values = metadata.value.select do |x| - - metadata.values[locale].values.include? x + .form-group + = label_tag "#{base}_#{attribute}_#{locale}", locale_t - .form-group - = label_tag "#{base}_#{attribute}_#{locale}", locale_t + = select_tag("#{plain_field_name_for(base, attribute)}[]", + options_for_select(metadata.values[locale]), + **field_options(attribute, metadata), include_blank: t('.empty')) - .mapable{ dir: t("locales.#{locale}.dir"), lang: locale, - data: { values: values.to_json, - 'default-values': metadata.values[locale].to_json, - name: "#{base}[#{attribute}][]", - list: id_for_datalist(attribute, locale), - button: t('posts.attributes.add'), - remove: 'false', legend: locale_t, - described: id_for_help(attribute, locale) } } - - = text_field(*field_name_for(base, attribute, '[]'), - value: values.join(', '), - dir: t("locales.#{locale}.dir"), lang: locale, - **field_options(attribute, metadata)) - - = render 'posts/attribute_feedback', - post: post, - attribute: [attribute, 'mapable'].flatten, - metadata: metadata - - %datalist{ id: id_for_datalist(attribute, locale) } - - metadata.values[locale].keys.each do |value| - %option{ value: value } + = render 'posts/attribute_feedback', + post: post, attribute: attribute, metadata: metadata From ad1d59d6a4616da92048d84587896dcc8041932d Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 13:55:51 -0300 Subject: [PATCH 079/475] fix: recuperar el valor --- app/views/posts/attributes/_locales.haml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/views/posts/attributes/_locales.haml b/app/views/posts/attributes/_locales.haml index 6d4d3326..21d410be 100644 --- a/app/views/posts/attributes/_locales.haml +++ b/app/views/posts/attributes/_locales.haml @@ -7,13 +7,12 @@ - site.locales.each do |locale| - next if post.lang.value == locale - locale_t = t("locales.#{locale}.name") + - value = metadata.value.find do |v| + - metadata.values[locale].values.include? v .form-group = label_tag "#{base}_#{attribute}_#{locale}", locale_t = select_tag("#{plain_field_name_for(base, attribute)}[]", - options_for_select(metadata.values[locale]), + options_for_select(metadata.values[locale], value), **field_options(attribute, metadata), include_blank: t('.empty')) - - = render 'posts/attribute_feedback', - post: post, attribute: attribute, metadata: metadata From 034015938bd07dd9471f006164cba6a6e564af8f Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 14:14:55 -0300 Subject: [PATCH 080/475] =?UTF-8?q?fix:=20mostrar=20el=20idioma=20si=20no?= =?UTF-8?q?=20existe=20una=20traducci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/posts/attributes/_locales.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/posts/attributes/_locales.haml b/app/views/posts/attributes/_locales.haml index 21d410be..23f66700 100644 --- a/app/views/posts/attributes/_locales.haml +++ b/app/views/posts/attributes/_locales.haml @@ -6,7 +6,7 @@ - site.locales.each do |locale| - next if post.lang.value == locale - - locale_t = t("locales.#{locale}.name") + - locale_t = t("locales.#{locale}.name", default: locale.to_s.humanize) - value = metadata.value.find do |v| - metadata.values[locale].values.include? v From 6d59d79e2a086bc653565cb93c9ef6406a9b910c Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 14:26:06 -0300 Subject: [PATCH 081/475] =?UTF-8?q?fix:=20establecer=20relaci=C3=B3n=20bid?= =?UTF-8?q?ireccional=20#10491?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/metadata_locales.rb | 36 +++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/app/models/metadata_locales.rb b/app/models/metadata_locales.rb index 702e1902..2e9080c9 100644 --- a/app/models/metadata_locales.rb +++ b/app/models/metadata_locales.rb @@ -7,9 +7,43 @@ class MetadataLocales < MetadataHasAndBelongsToMany # @return { lang: { title: uuid } } def values @values ||= site.locales.map do |locale| - [locale, site.posts(lang: locale).map do |post| + [locale, posts.where(lang: locale).map do |post| [title(post), post.uuid.value] end.to_h] end.to_h end + + # Siempre hay una relación inversa + # + # @return [True] + def inverse? + true + end + + # El campo inverso se llama igual en el otro post + # + # @return [Symbol] + def inverse + :locales + end + + private + + # Obtiene todos los locales distintos a este post + # + # @return [Array] + def other_locales + site.locales.reject do |locale| + locale == post.lang.value.to_sym + end + end + + # Obtiene todos los posts de los otros locales con el mismo layout + # + # @return [PostRelation] + def posts + other_locales.map do |locale| + site.posts(lang: locale).where(layout: post.layout.value) + end.reduce(&:concat) + end end From fc14889d0eeb579e2b86aa6fd2250889d3ae0227 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 14:35:47 -0300 Subject: [PATCH 082/475] fix: soporte para urdu --- config/locales/en.yml | 3 +++ config/locales/es.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index 10a4793b..eb7ef1ec 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -13,6 +13,9 @@ en: ar: name: Arabic dir: rtl + ur: + name: Urdu + dir: rtl login: email: E-mail address password: Password diff --git a/config/locales/es.yml b/config/locales/es.yml index 02973de5..665fb350 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -13,6 +13,9 @@ es: ar: name: Árabe dir: rtl + ur: + name: Urdu + dir: rtl login: email: Correo electrónico password: Contraseña From 59606f32639fd48f849a0e27fcb1ac3fa8d6c589 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 14:38:18 -0300 Subject: [PATCH 083/475] fix: reducir el alto de la leyenda --- app/assets/stylesheets/application.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index b756759a..ba8de715 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -154,6 +154,12 @@ ol.breadcrumb { transition: all 3s; } +fieldset { + legend { + font-size: 1rem; + } +} + .mapable, .taggable { .input-map, From 758f9de36dde570f619d4f56faf6d9d56144981d Mon Sep 17 00:00:00 2001 From: Nulo Date: Mon, 2 May 2022 18:55:35 +0000 Subject: [PATCH 084/475] Arreglar scroll al reordenar posts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Utilizaba https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoViewIfNeeded que es propietario. Ahora usa scrollIntoView siempre, configurado para que prácticamente siempre se pueda ver el post al reordenar. --- app/javascript/controllers/reorder_controller.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/javascript/controllers/reorder_controller.js b/app/javascript/controllers/reorder_controller.js index dca6e166..2cba4163 100644 --- a/app/javascript/controllers/reorder_controller.js +++ b/app/javascript/controllers/reorder_controller.js @@ -103,11 +103,7 @@ export default class extends Controller { this.reorder() // Mantenemos el primero a la vista - if ("scrollIntoViewIfNeeded" in rows[0].row) { - rows[0].row.scrollIntoViewIfNeeded() - } else { - rows[0].row.scrollIntoView() - } + rows[0].row.scrollIntoView({ block: "center" }); } counter () { @@ -146,7 +142,7 @@ export default class extends Controller { this.reorder() // Mantenemos el primero a la vista - rows[0].row.scrollIntoViewIfNeeded() + rows[0].row.scrollIntoView({ block: "center" }); } bottom (event) { @@ -167,7 +163,7 @@ export default class extends Controller { this.reorder() // Mantenemos el primero a la vista - rows[0].row.scrollIntoViewIfNeeded() + rows[0].row.scrollIntoView({ block: "center" }); } /* From abacabff8efa261f79855cdd22c6217806a096fe Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 18:39:56 -0300 Subject: [PATCH 085/475] fix: agregar licencia con layout --- app/services/site_service.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 22423bb8..436bc1c3 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -104,11 +104,10 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do def add_licencia(lang:) params = ActionController::Parameters.new( post: { + layout: 'license', lang: lang, title: site.licencia.name, description: I18n.t('sites.form.licencia.title'), - author: %w[Sutty], - permalink: "#{I18n.t('activerecord.models.licencia').downcase}/", content: CommonMarker.render_html(site.licencia.deed) } ) From 46c20cae7de41225b63ba5ff44eb7e5484a0e4ab Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 18:41:12 -0300 Subject: [PATCH 086/475] feat: no agregar licencia si la plantilla no lo soporta --- app/services/site_service.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 436bc1c3..87a08652 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -92,6 +92,8 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do # Crea la licencia del sitio para cada locale disponible en el sitio def add_licencias + return unless site.layout? :license + site.locales.each do |locale| next unless I18n.available_locales.include? locale From 0b353466a4c8113ed7c3fd57bed9f622ca298643 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 18:43:20 -0300 Subject: [PATCH 087/475] fix: solo cambiar la licencia si existe una #159 --- app/services/site_service.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 87a08652..b4fa2fa0 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -119,18 +119,14 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do # Encuentra la licencia a partir de su enlace permanente y le cambia # el contenido - # - # TODO: Crear un layout específico para licencias así es más certera - # la búsqueda. def change_licencias site.locales.each do |locale| next unless I18n.available_locales.include? locale Mobility.with_locale(locale) do - permalink = "#{I18n.t('activerecord.models.licencia').downcase}/" - post = site.posts(lang: locale).find_by(permalink: permalink) + post = site.posts(lang: locale).find_by(layout: 'license') - post ? change_licencia(post: post) : add_licencia(lang: locale) + change_licencia(post: post) if post end end end From 7b68bc15692ba4032e7ec9b660f6fc624512250d Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 18:45:41 -0300 Subject: [PATCH 088/475] =?UTF-8?q?fix:=20crear=20las=20licencias=20despu?= =?UTF-8?q?=C3=A9s=20de=20crear=20el=20t=C3=ADtulo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit y los commits también se harían en el idioma de le usuarie --- app/services/site_service.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index b4fa2fa0..e98d2487 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -14,11 +14,10 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do I18n.with_locale(usuarie&.lang&.to_sym || I18n.default_locale) do site.save && site.config.write && - commit_config(action: :create) + commit_config(action: :create) && + add_licencias end - add_licencias - site end @@ -27,11 +26,10 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do I18n.with_locale(usuarie&.lang&.to_sym || I18n.default_locale) do site.update(params) && site.config.write && - commit_config(action: :update) + commit_config(action: :update) && + change_licencias end - change_licencias - site end From ddd2bc07ff62b24745e74af4d6ce7284263e8117 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 19:04:15 -0300 Subject: [PATCH 089/475] =?UTF-8?q?feat:=20incorporar=20los=20c=C3=B3digos?= =?UTF-8?q?=20de=20conducta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/code_of_conduct.rb | 14 + app/services/site_service.rb | 34 +- config/initializers/inflections.rb | 4 + .../20230322214924_add_code_of_conduct.rb | 22 + db/seeds/codes_of_conduct.yml | 613 ++++++++++++++++++ 5 files changed, 686 insertions(+), 1 deletion(-) create mode 100644 app/models/code_of_conduct.rb create mode 100644 db/migrate/20230322214924_add_code_of_conduct.rb create mode 100644 db/seeds/codes_of_conduct.yml diff --git a/app/models/code_of_conduct.rb b/app/models/code_of_conduct.rb new file mode 100644 index 00000000..87c24c7f --- /dev/null +++ b/app/models/code_of_conduct.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# Códigos de conducta +class CodeOfConduct < ApplicationRecord + extend Mobility + + translates :title, type: :string, locale_accessors: true + translates :description, type: :text, locale_accessors: true + translates :content, type: :text, locale_accessors: true + + validates :title, presence: true, uniqueness: true + validates :description, presence: true + validates :content, presence: true +end diff --git a/app/services/site_service.rb b/app/services/site_service.rb index e98d2487..19b95302 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -15,7 +15,8 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do site.save && site.config.write && commit_config(action: :create) && - add_licencias + add_licencias && + add_code_of_conduct end site @@ -141,10 +142,41 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do params: params).update end + def add_code_of_conduct + # TODO: soportar más códigos de conducta + coc = CodeOfConduct.first + + with_all_locales do |locale| + params = ActionController::Parameters.new( + post: { + layout: 'code_of_conduct', + lang: locale.to_s, + title: coc.title, + description: coc.description, + content: CommonMarker.render_html(coc.content) + } + ) + + PostService.new(site: site, usuarie: usuarie, params: params).create + end + end + # Crea los deploys necesarios para sincronizar a otros nodos de Sutty def sync_nodes Rails.application.nodes.each do |node| site.deploys.build(type: 'DeployRsync', destination: "sutty@#{node}:#{site.hostname}") end end + + private + + def with_all_locales(&block) + site.locales.each do |locale| + next unless I18n.available_locales.include? locale + + Mobility.with_locale(locale) do + yield locale + end + end + end end diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 0e18b987..46cb9d78 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -13,6 +13,8 @@ ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.singular 'roles', 'rol' inflect.plural 'rollup', 'rollups' inflect.singular 'rollups', 'rollup' + inflect.plural 'code_of_conduct', 'codes_of_conduct' + inflect.singular 'codes_of_conduct', 'code_of_conduct' end ActiveSupport::Inflector.inflections(:es) do |inflect| @@ -28,4 +30,6 @@ ActiveSupport::Inflector.inflections(:es) do |inflect| inflect.singular 'licencias', 'licencia' inflect.plural 'rollup', 'rollups' inflect.singular 'rollups', 'rollup' + inflect.plural 'code_of_conduct', 'codes_of_conduct' + inflect.singular 'codes_of_conduct', 'code_of_conduct' end diff --git a/db/migrate/20230322214924_add_code_of_conduct.rb b/db/migrate/20230322214924_add_code_of_conduct.rb new file mode 100644 index 00000000..f859b08c --- /dev/null +++ b/db/migrate/20230322214924_add_code_of_conduct.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# Crea códigos de conducta +class AddCodeOfConduct < ActiveRecord::Migration[6.1] + def up + create_table :codes_of_conduct do |t| + t.timestamps + t.string :title + t.text :description + t.text :content + end + + # XXX: En lugar de ponerlo en las seeds + YAML.safe_load(File.read('db/seeds/codes_of_conduct.yml')).each do |coc| + CodeOfConduct.new(**coc).save! + end + end + + def down + drop_table :codes_of_conduct + end +end diff --git a/db/seeds/codes_of_conduct.yml b/db/seeds/codes_of_conduct.yml new file mode 100644 index 00000000..64582072 --- /dev/null +++ b/db/seeds/codes_of_conduct.yml @@ -0,0 +1,613 @@ +--- +- title_en: "Codes for sharing" + title_es: "Códigos para compartir" + description_en: "Codes of conduct allow inclusive communities." + description_es: "Los códigos de convivencia nos permiten alojar comunidades inclusivas." + content_en: | + # Code for sharing + + > This code of conduct is based in "[Códigos para compartir, hackear, + > piratear en + > libertad](https://utopia.partidopirata.com.ar/zines/codigos_para_compartir.html)" + > published by [Partido Interdimensional + > Pirata](https://partidopirata.com.ar/). + + > We use gender neutral pronouns to include all peoples. In this sense, + > we encourage different forms, strategies and tools used to embody + > practices that aren't anthropocentric, sexist, cis-sexist in our + > language. + + ## Introduction + + This is an example code that strives to give a consensual frame to + enable asistance, permanence and confortable stay to everyone using and + inhabiting [Sutty](https://sutty.nl/), and to welcome new users and + potential allies as well. It sets the floor for desirable and + acceptable, and undesirable and intolerable conducts for its community. + You can use it with or without changes, adapting it to your activities. + This code is in permanent and collective mutation and feeds, copies and + inspires on the following sources: + + * + + * + + * + + * + + We strive to sustain and foment an open community, that invites and + attains participation from more people, in all their diversity. We know + that spaces related to computing and free software are mostly inhabited + by middle class cis white males, even when there's an acknowledgement of + the need to close the gender gap. In this sense, this is our little + contribution, made from collective practices on multiple dimentions, + reflections, readings, and experiences that grow every day. + + ## That everyone needs to be well treated + + Every being that we share space with deserves good treatment, respect + and compassion. Here we share basic criteria for introduction and care. + + ### Towards humans + + Everyone is deserving of care and greetings and we have a right to + assume good intentions from others. + + When we refer to other humans, we try to be careful and respectul + towards their gender identity. For this, these principles are useful: + + * Don't assume, judge or try to "interpret" the gender of others. + + * Don't use gender beforehand. It's related to the previous item, but + puts emphasis towards naturalized gendering behaviour (ie. assuming + someone wearing a dress uses female pronouns...). The proposal is to + discard them. + + * If a person explicits their pronouns and mode in which they want to be + referenced, we respect them, by listening and trying to use their + prefered pronouns. + + * When presentations don't include pronouns, we can ask respectfully + for prefered pronouns. But be careful! This question must be asked + to everyone, otherwise the "suspicion" is loaded towards a person, and + it can become a form of harrassment. + + * Do we need to know the gender of a person to relate with them? Maybe + a better practice is to evade gendering others. But if this means to + use "them" compulsively, some people may be made to feel bad. (For + instance, trans\* people who use female or male pronouns may feel + upset or outed when refering to them as "them", specially if they're + the only ones to be gendered like this in a group! + + * When in doubt, asking and apologizing respectfully is a good way of + being careful towards each other. + + ## Important points to guarantee our space from being expulsive + + **Listening to and between everyone in a caring climate** + + * Listen to what everyone has to say, being mindful that everyone has + something valuable to communicate. + + * For active listening, we prefer to ask first, before making judgement. + + * Sometimes being silent is a condition for others to be able to talk. + To listen is an exercise that requires practice. Also talking. + + * We're interested in what everyone has to say. If you're more trained + in participating, talking, and having opinions, take into account that + not everyone does. Give them space if they want to take it. But + remember that encouraging is not the same as pressuring! + + * We try to check and stop offensive practices to add to the respectful + climate. This doesn't mean to be submissive or to agree to + everything. At the least, it sets a floor of respect towards enabling + a dialogue when necessary. + + * It's at the very least disrepectful to repeat damaging behaviour when + it was already identified as such. It can make others unconfortable, + or hurt and expel them. We'll make this point every time that is + needed and tolerable. + + * We avoid this behaviour ourselves and we help others to notice their + own. + + * When raising attention becomes insufficient, we need to review this + agreements to keep the coexistence. This implies to act in accord to + them, and that this code can be revised and updated when deemed + necessary (there's no consensus). + + * One of the ways in which free software spaces can be and are expulsive + is with attitudes that don't contemplate diversity in knowledges and + interlocutors. By appealing to technicisms, many comrades are kept + out of what's happening, and no one verifies if everyone is keeping up + with the conversation. + + Our fervent recommendation is to be attentive to this dynamic so we + can avoid or revert them. + + * The counter to the previous situation is "mansplaining": a cis-male + person assuming the authoritative place of knowledge to (over-)explain + everything to others, in a patronizing way and without taking into + account what others want to listen or not, to say, what already know + or do, etc. + + * We believe there's no "authoritative voice" to have an opinion and to + participate. Free culture is for everyone to share. + + * "Sharing is caring" v. "Google is your friend". Meritocracy and other + traditional codes in cyber-communities work against free culture. We + support the pirate culture that onboards ever more pirates to their + ships. We believe that culture is for everyone and we defy elitisms. + + * We don't assume that other people shares our likings, beliefs, class + position, sexuality, etc. We can be violent when we misread others. + We recommend to ask respectfully and to avoid comments or jokes that + can be hurtful to others. + + * We speak and act gently and inclusively. + + * We respect different points of view, experiences, beliefs, etc. and we + take them into account when we act collectively so it reflects in our + attitudes. + + * We welcome criticism, specially the constructive kind ;) + + * We focus in what's best for the community, without losing warmth, + respect and diversity amongst ourselves. + + * We show empathy toward others. We want to share and communicate. + + * It's useful to think everyone has different abilities, stories, + experiences... It's possible to not understand some comments. We try + to avoid acting in bad faith and to use every accessibility tool we + can. + + * The last item includes neurodiverse people and those that have + experienced trauma. Sometimes, sarcasm or irony is not well received + or understood by others. We take this into our strategies to include + everyone in our communications. Even more, if we think some topics + could be sensitive to others (memory-triggering, phobias, untolerable, + explicit violence or body images, etc.), we use content warnings (cw) + before what we wanted to share. For instance: "cw: comments about + sexual and physical violence". This allows everyone to opt in to the + content instead of being taken by surprise. + + * We're respectful of limits established by others (personal space, + physical contact, interaction mood, privacy, being photographed, etc.) + + * We want to and believe in welcoming more pirates! + + ## Consent for documenting and sharing in media + + * If you're going to take pictures or record video, ask consent from + people involved. + + * If there're minors, ask their responsible families. + + ## Our commitment against harassment + + In the interest of fomenting an open, diverse and welcoming community, + we contributors and admins make a commitment against harassment in our + projects and community for everyone, without regard of age, body + diversity, capacity, neuro-diversity, ethnicity, gender identity and + expression, experience level, nationality, physical appearance, + religion, sexual identity or orientation. + + Examples of unacceptable behaviour from participants: + + * Offensive comments about gender/s, gender identity and expression, + sexual orientation, capacity, mental sickness, neuro-(a)tipicality, + physical appearance, body size, ethnicity or religion. + + * Unwelcomed comments related to personal and life choices, including + amongst others, those related to food, health, children upbringing, + drug use and employment. + + * Insulting or despective comments and personal or political attacks. + **Trolling**. + + * Assuming others' gender. If you're in doubt, ask politely about + pronouns. Don't use the name(s) that people don't use anymore, use + the name, _nickname_ or pseudonym that they prefer. Do you really + need the name, ID number, biometric data, birth certificate of others? + + * Sexual comments, images or behaviour, unneeded or in spaces where they + weren't appropiate. + + * Unconsented physical contact or repeated after being asked to stop. + + * Threatening others. + + * Inciting violence towards others, including self-damage. + + * Deliberate intimidation. + + * Stalking. + + * To harass by photographing or recording without consent, including + uploading personal information to the Internet. + + * Interrupting a conversation constantly. + + * Making unwanted sexual comments. + + * Unappropiate patterns of social contact, like asking/assuming + inappropiate intimacy levels with others. + + * Trying to interact with a person after being asked not to. + + * Exposing deliberately any aspect of a person identity without consent, + except when necessary for protecting others against intentional abuse. + + * Making public any kind of private conversation. + + * Other kinds of conduct that can be considered inappropiate in an + environment of camaraderie. + + * Repeating attitudes that others find offensive or violatory of this + code. + + ## Consequences + + * Any person that has been asked to stop offensive behaviour is expected + to respond immediately, even when in disagreement. + + * Admins can take any action deemed necessary and adequate, including + expelling the person or removing their site without advertence. This + decision is taken by consensus between admins and is reserved for + extreme cases that compromise the community or the permanence of + others without feeling wronged or threatened. + + * Admins reserve the right to forbid participation to any future + activity or publication. + + As we mentioned before, this code is in permanent collective mutation. + It's main objective is to generate an inclusive and non-expulsive + environment that is also transparent and open without [missing + stairs](https://en.wikipedia.org/wiki/Missing_stair) ("the missing stair + from a house that everyone knows about but no one wants to take + responsibility for"). It's important to adapt it to different + activities and that it nurtures from contributions from its users. + Receiving your comments and input will help us to achieve this + objective. + + ## Let's keep in contact! + + Si pasaste por alguna situación que quieras compartir --te hayas animado + o no a decirlo en el momento--, podés ponerte en contacto con nosotres. + + Con respecto a quejas o avisos acerca de situaciones de violencia, + acoso, abuso o repetición de conductas que se advirtieron como + intolerables, tomamos la responsabilidad de tenerlas en cuenta y + trabajar en ellas para que el resultado sea el favorable al espíritu de + colectiva que elegimos y describimos aquí. Si bien consideramos que las + prácticas punitivistas no van con nosotres, nuestra decisión explícita + es escuchar a la persona que se manifiesta como violentada o víctima y + acompañarla. + + You can contact us if you were part of a situation you want to share + --even if you didn't pointed it in the moment. + + In regards to complaints or notices about violence, harassment, abuse or + repeated untolerable conducts, we take the responsibility of working on + them for a favorable result towards the collective spirit we defined + here. Even when we don't condone punitivist practices, our explicit + decision is for the victim to be listened and accompanied. + content_es: | + # Códigos para compartir + + > Este código de convivencia está basado en los "[Códigos para + > compartir, hackear, piratear en + > libertad](https://utopia.partidopirata.com.ar/zines/codigos_para_compartir.html)" + > publicados por el [Partido Interdimensional + > Pirata](https://partidopirata.com.ar/). + + > Utilizamos preferentemente la 'e' para referirnos a las personas en + > general. En ese sentido, alentamos las diferentes formas, estrategias + > y herramientas para incorporar prácticas no antropocéntricas, + > sexistas, ni cisexistas en la lengua. Otras alternativas que apoyamos + > --y eventualmente usamos-- son el uso del femenino, la letra e, arrobas, + > equis, asteriscos, etc. + + ## Introducción + + Este es un ejemplo de código que busca aportar un marco de consenso para + garantizar la asistencia, permanencia y cómoda estadía de todas las + personas que habitan y utilizan Sutty, así como para bienvenir a nueves + usuaries y potenciales aliades. Para esto, fija un piso de conductas + deseables, aceptables, indeseables y/o intolerables para la comunidad. + Podés usarlo sin cambios o modificarlo para adaptarlo a tus actividades. + Este código está en permanente mutación colectiva y se alimenta, copia e + inspira de las siguientes fuentes: + + * + + * + + * + + * + + Procuramos mantener y fomentar una comunidad abierta, que invite y logre + la participación de cada vez más personas, en toda su diversidad. + Sabemos que los espacios de Software Libre, informática, sistemas, etc. + son habitados mayormente por varones cis, blancos y de clase media, pese + al reconocimiento de la necesidad de eliminar la brecha de géneros. En + este sentido, este es nuestro pequeño aporte, hecho de prácticas + colectivas de múltiples dimensiones, reflexiones, lecturas, experiencias + que crecen día a día. + + ## Que todes les seres sean bien tratades + + Cada ser con el que compartamos el espacio es merecedore de buen trato, + respeto y compasión. En otras palabras, compartimos a continuación los + criterios básicos de presentación y cuidados. + + Para les humanes + + Todes somos dignes de cuidados y de saludos y tenemos derecho a suponer + las buenas intenciones de le otre. + + Para referirnos a otres humanes, trataremos de ser cuidadoses y + respuestuoses de su identidad de género. Para ello, son útiles los + siguientes principios: + + * No presuponer, juzgar o "interpretar" el género de le otre. + + * No generizar de antemano. Se desprende del punto anterior, pero hace + especial énfasis en comportamientos naturalizados de generización (EJ: + presuponer que porque una persona usa un vestido se nombra en + femenino...). La propuesta es desecharlos. + + * Si la persona explicita sus pronombres y modos en que quiere ser + referenciade, lo respetamos, escuchando y procurando referirnos a elle + usando sus pronombres elegidos. + + * Si no se incluye en la presentación los pronombres preferidos, podemos + preguntar respetuosamente qué pronombres se usan. ¡Pero atención! Es + una pregunta que debe dirigirse a todes por igual, de lo contrario, + carga la "sospecha" sobre la persona señalada y puede resultar en una + forma de hostigamiento. + + * ¿Es necesario conocer el género de una persona para relacionarnos o + referirnos a ella? Quizás una buena práctica es evitar generizar para + todas las personas. Pero si esto implica el uso compulsivo de la "e" + para todes, puede ser que alguna persona se sienta molesta. (Por + ejemplo, las personas trans\* que se identifican en femenino o + masculino suelen sentirse molestas y "sacadas del clóset" u *outeadas* + si se refieren a ellas con la "e", ¡en especial si son las únicas en + ser generizadas de esta forma en un grupo!). + + * Ante cualquier duda, preguntar respetuosamente y disculparse + respetuosamente es una buena idea para ayudar a cuidarnos. + + ## Puntos importantes para garantizar que nuestro espacio no resulte expulsivo + + **Escucharnos a todas y entre todas en un clima de cuidados** + + * Escuchar lo que cada quien tiene para decir, conscientes de que todes + tenemos algo valioso para comunicar(nos). + + * Para la escucha activa, preferimos preguntar primero, en lugar de + hacer juicios. + + * Hacer silencio a veces es la condición para que otres puedan animarse + a hablar. Escuchar es un ejercicio que requiere práctica. También lo + es hablar. + + * Nos interesa lo que todes tengan para decir. Por lo tanto, si estás + más entrenade en el ejercicio de participar, hablar, opinar, tené en + cuenta que quizás haya otres que no lo estén tanto: darles el espacio + si quieren tomarlo. ¡Pero recordá que incentivar no es lo mismo que + presionar! + + * Tratamos de revisar y discontinuar alguna práctica que pueda haber + resultado ofensiva, para sumar al clima de respeto. Sin embargo, esto + no significa "bajar la cabeza" o estar necesariamente de acuerdo. Al + menos, fija un piso de respeto para comenzar un diálogo en el caso en + que sea necesario. + + * Es --al menos-- una falta de respeto repetir un comportamiento dañino + que ya se identificó como tal. Puede incomodar, lastimar y expulsar a + otres, por lo que preferimos llamar la atención sobre este punto todas + las veces que sea necesario y tolerable. + + * Evitamos esto nosotres y ayudamos a otres a darse cuenta cuando lo + están haciendo. + + * En los casos en los que los llamados de atención resulten + insuficientes, hemos de revisar estos acuerdos para sostener la + convivencia. Eso implica actuar de acuerdo a ellos. Y también que + estos códigos pueden ser revisados y actualizados en caso de que se + considere necesario (deje de haber consenso). + + * Una manera en la que los espacios de Software Libre y tecnologías + pueden y suelen ser expulsivos es mediante actitudes que no contemplan + la diversidad de saberes e interlocutor\*s. So pretexto de incluir + tecnicismos, muches compañeres quedan al margen de lo que está + sucediendo, muchas veces, sin que nadie tenga la mínima delicadeza de + verificar que todes estén siguiendo la conversación. + + Recomendamos fervientemente estar atentes a estas dinámicas para poder + evitarlas y/o revertirlas. + + * La otra cara de la situación anterior es el famoso _mansplaining_: un + tipo cis poniéndose en el lugar de la autoridad del saber para + (sobre-)explicar todo a le otre, de manera paternalista y sin tener en + cuenta lo que le otre quiere o no escuchar, decir, lo que sabe o hace, + etc. + + * Creemos que no hace falta ser "una voz autorizada" para opinar y + participar. La cultura libre se comparte entre todes. + + * "Compartir es bueno" vs. "Google es tu amigo". La meritocracia y + ciertos códigos tradicionales de ciertas ciber-comunidades suelen + operar de manera contraria a la propuesta de la cultura libre de + compartir. Apoyamos la cultura piratil que suma más piratas a los + barcos. Creemos que la cultura es para todes y desafiamos las + prácticas elitistas. + + * No damos por sentado que la persona con la que estamos interactuando + comparte gustos, creencias, pertenencias de clase, sexualidad, etc. + Podemos ser violentes si hacemos una lectura equivocada de le otre. + Recomendamos siempre preguntar de manera respetuosa y evitar + comentarios o chistes que puedan herir a les otres. + + * Usamos lenguaje amable e inclusivo y mostramos conductas amables e + inclusivas. + + * Respetamos los diferentes puntos de vista, experiencias, creencias, + etc. y lo tenemos en cuenta cuando estamos en grupo para verlo + reflejado en nuestras actitudes. + + * Aceptamos las críticas. En especial las constructivas ;) + + * Nos enfocamos en lo que es mejor para la comunidad, sin por ello + perder de vista la calidez, el respeto y la diversidad entre cada une + de nosotres. + + * Mostramos empatía con les otres. Queremos comunicarnos y compartir. + + * Es útil tener en cuenta que las personas tenemos capacidades, + historias, recorridos... diferentes. Es posible que algunos + comentarios no sean comprendidos. Trataremos de evitar la mala fe y + sumar todas las herramientas de accesibilidad para todas las personas. + + * El punto anterior incluye a personas neurodiversas y con experiencias + de trauma. A veces el sarcasmo o la ironía no es bien recibido o + comprendido por todes. Será útil tenerlo en cuenta para buscar + estrategias que no excluyan a las personas de nuestros intercambios. + Por otro lado, si creemos que determinados temas pueden ser sensibles + (desencadenantes de recuerdos, fobias, difíciles de tolerar o cargados + de violencia o imágenes corporales muy explícitas, por ejemplo) para + algunas personas y nos valemos de las advertencias de contenido o + _content warning_ (cw) (ej: "cw: comentarios de violencia sexual y + violencia física") antes del contenido a introducir. Esto permite que + cada cual pueda elegir si acceder o no a esos contenidos y que no le + tomen por sorpresa. + + * Respetamos los límites que establecen otras personas (espacio + personal, contacto físico, ganas de interactuar, no querer dar datos + de contacto o ser fotografiades, etc.) + + * ¡Queremos y (creemos) en sumar piratas! + + ## Consentimiento para documentar o compartir en medios + + * Si vas a publicar video o fotos, obtené el consentimiento de las + personas. + + * Si hay menores, consultalo con su familia responsable. + + ## Nuestro compromiso contra el acoso + + En el interés de fomentar una comunidad abierta, diversa y hospitalaria, + nosotres como contribuyentes y administradores nos comprometemos a hacer + de la participación en nuestro proyecto y nuestra comunidad una + experiencia libre de acoso para todes, independientemente de la edad, + diversidad corporal, capacidades, neuro-diversidad, etnia, identidad y + expresión de género, nivel de experiencia, nacionalidad, apariencia + física, raza, religión, identidad u orientación sexual y otras. + + Ejemplos de comportamiento inaceptable por parte de participantes: + + * Comentarios ofensivos relacionados con el/los género/s, la identidad + y expresión de género, la orientación sexual, las capacidades, las + enfermedades mentales, la neuro(a)tipicalidad, la apariencia física, + el tamaño corporal, la raza o la religión. + + * Comentarios indeseados relacionados con las elecciones y las prácticas + de estilo de vida de una persona, incluidas, entre otras, las + relacionadas con alimentos, salud, crianza de les hijes, drogas y + empleo. + + * Comentarios insultantes o despectivos (_trolling_) y ataques + personales o políticos. + + * Dar por sentado el género de las demás personas. En caso de duda, + preguntá educadamente por los pronombres. No uses nombres con los que + las personas no se identifican, usá el nombre, _nickname_ o apodo que + hayan elegido (¿Realmente necesitás el nombre y el número de DNI, + datos biométricos, carta natal, etc.?). + + * Comentarios, imágenes o comportamientos sexuales innecesarios o fuera + de lugar en espacios en los que no son apropiados. + + * Contacto físico sin consentimiento o reiterado tras un pedido de cese. + En el mismo sentido, invasión del espacio corporal (y espacios en + general). + + * Amenazas contra otras personas. + + * Incitación a la violencia contra otra persona, que también incluye + alentar a una persona a autolesionarse. + + * Intimidación deliberada. + + * Acechar (_stalkear_) o perseguir. + + * Acosar fotografiando o grabando sin consentimiento, incluyendo también + subir información personal a Internet sobre alguien para acosarle. + + * Interrumpir constantemente en una conversación. + + * Hacer comentarios sexuales indeseados. + + * Patrones de contacto social inapropiados, como por ejemplo + pedir/suponer niveles de intimidad inapropiados con les demás. + + * Seguir tratando de entablar conversación con una persona cuando se te + pidió que no lo hagas. + + * Divulgar deliberadamente cualquier aspecto de la identidad de una + persona sin su consentimiento, excepto que sea necesario para proteger + a otras personas de abuso intencional. + + * Hacer pública una conversación privada de cualquier tipo. + + * Otros tipos de conducta que pudieran considerarse inapropiadas en un + entorno de camaradería. + + * Reiteración de actitudes que les participantes señalen como ofensivas + o violatorias de este código. + + ## Consecuencias + + * Se espera que la persona a la que se la haya pedido que cese un + comportamiento que infringe este código acate el pedido de forma + inmediata, incluso si no está de acuerdo con este. + + * Les administradores pueden tomar cualquier acción que juzguen + necesaria y adecuada, incluyendo expulsar a la persona o dar de baja + sus sitios sin advertencia. Esta decisión la toman les administradores + en consenso y se reserva para casos extremos que comprometan la + continuidad de la comunidad o bien la posibilidad de permanencia en + ella de otres participantes sin sentirse agraviades o amenazades. + + * Les administradores se reservan el derecho a prohibir la asistencia a + cualquier actividad futura o publicación de sitios. + + Como mencionamos antes, este código está en permanente mutación + colectiva. El objetivo principal es generar un ambiente inclusivo y no + expulsivo, un ambiente transparente y abierto en el que no haya + escalones faltantes ("el escalón que falta en la escalera y todo el + mundo sabe y avisa pero nadie se quiere hacer cargo"). Es importante que + se adapte a las actividades y se nutra de las contribuciones de les + usuaries. Recibir tus comentarios y aportes nos ayudará a cumplir con + su objetivo principal. + + ## ¡Sigamos en contacto! + + Si pasaste por alguna situación que quieras compartir --te hayas animado + o no a decirlo en el momento--, podés ponerte en contacto con nosotres. + + Con respecto a quejas o avisos acerca de situaciones de violencia, + acoso, abuso o repetición de conductas que se advirtieron como + intolerables, tomamos la responsabilidad de tenerlas en cuenta y + trabajar en ellas para que el resultado sea el favorable al espíritu de + colectiva que elegimos y describimos aquí. Si bien consideramos que las + prácticas punitivistas no van con nosotres, nuestra decisión explícita + es escuchar a la persona que se manifiesta como violentada o víctima y + acompañarla. From 3f3ef0041092c06ade35df5a0b278a4e79fc976c Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 19:06:57 -0300 Subject: [PATCH 090/475] =?UTF-8?q?fix:=20solo=20crear=20el=20c=C3=B3digo?= =?UTF-8?q?=20de=20conducta=20si=20la=20plantilla=20lo=20soporta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit como fallback usamos page --- app/services/site_service.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 19b95302..e0fe17cd 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -143,13 +143,15 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do end def add_code_of_conduct + return unless site.layout?(:code_of_conduct) || site.layout?(:page) + # TODO: soportar más códigos de conducta coc = CodeOfConduct.first with_all_locales do |locale| params = ActionController::Parameters.new( post: { - layout: 'code_of_conduct', + layout: site.layout?(:code_of_conduct) ? 'code_of_conduct' : 'page', lang: locale.to_s, title: coc.title, description: coc.description, From 89ef2959e3c93a889677c3051a6987712a3434af Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 19:21:52 -0300 Subject: [PATCH 091/475] feat: usar un slug sino cuando cambia la licencia queda con la url de la anterior --- app/services/site_service.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index e0fe17cd..225c6292 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -106,6 +106,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do params = ActionController::Parameters.new( post: { layout: 'license', + slug: Jekyll::Utils.slugify(I18n.t('activerecord.models.licencia')), lang: lang, title: site.licencia.name, description: I18n.t('sites.form.licencia.title'), From e25b4858a01df490a66e5c818c0676828e45d539 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 19:23:51 -0300 Subject: [PATCH 092/475] fix: no cambiar las licencias si el sitio no las soporta --- app/services/site_service.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 225c6292..e4793453 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -120,6 +120,8 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do # Encuentra la licencia a partir de su enlace permanente y le cambia # el contenido def change_licencias + return unless site.layout? :license + site.locales.each do |locale| next unless I18n.available_locales.include? locale From 368001b341bfa0b6891a15088625c615d6839098 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 19:32:52 -0300 Subject: [PATCH 093/475] =?UTF-8?q?fix:=20poder=20encadenar=20licencias=20?= =?UTF-8?q?con=20c=C3=B3digos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/site_service.rb | 46 ++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index e4793453..47b532f4 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -90,18 +90,19 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do end # Crea la licencia del sitio para cada locale disponible en el sitio + # + # @return [Boolean] def add_licencias - return unless site.layout? :license + return true unless site.layout? :license - site.locales.each do |locale| - next unless I18n.available_locales.include? locale - - Mobility.with_locale(locale) do - add_licencia lang: locale - end - end + with_all_locales do |locale| + add_licencia lang: locale + end.compact.map(&:valid?).all? end + # Crea una licencia + # + # @return [Post] def add_licencia(lang:) params = ActionController::Parameters.new( post: { @@ -119,20 +120,22 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do # Encuentra la licencia a partir de su enlace permanente y le cambia # el contenido + # + # @return [Boolean] def change_licencias - return unless site.layout? :license + return true unless site.layout? :license - site.locales.each do |locale| - next unless I18n.available_locales.include? locale + with_all_locales do |locale| + post = site.posts(lang: locale).find_by(layout: 'license') - Mobility.with_locale(locale) do - post = site.posts(lang: locale).find_by(layout: 'license') - - change_licencia(post: post) if post - end - end + change_licencia(post: post) if post + end.compact.map(&:valid?).all? end + # Cambia una licencia + # + # @param :post [Post] + # @return [Post] def change_licencia(post:) params = ActionController::Parameters.new( post: { @@ -145,8 +148,11 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do params: params).update end + # Agrega un código de conducta + # + # @return [Boolean] def add_code_of_conduct - return unless site.layout?(:code_of_conduct) || site.layout?(:page) + return true unless site.layout?(:code_of_conduct) || site.layout?(:page) # TODO: soportar más códigos de conducta coc = CodeOfConduct.first @@ -163,7 +169,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do ) PostService.new(site: site, usuarie: usuarie, params: params).create - end + end.compact.map(&:valid?).all? end # Crea los deploys necesarios para sincronizar a otros nodos de Sutty @@ -176,7 +182,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do private def with_all_locales(&block) - site.locales.each do |locale| + site.locales.map do |locale| next unless I18n.available_locales.include? locale Mobility.with_locale(locale) do From 136a9e3edba9f5fe719c072c4b020996e90a9a28 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 19:44:17 -0300 Subject: [PATCH 094/475] =?UTF-8?q?fix:=20traducir=20la=20descripci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/site_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 47b532f4..449db16a 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -110,7 +110,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do slug: Jekyll::Utils.slugify(I18n.t('activerecord.models.licencia')), lang: lang, title: site.licencia.name, - description: I18n.t('sites.form.licencia.title'), + description: site.licencia.description, content: CommonMarker.render_html(site.licencia.deed) } ) From caa4861d79172cf6e49dab6c0e5cade15abcf023 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 19:54:04 -0300 Subject: [PATCH 095/475] fix: poder pasar el slug como parametro como slug es un atributo privado, hay que asignarlo manualmente --- app/services/post_service.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/services/post_service.rb b/app/services/post_service.rb index e448bb4c..81ebe4a1 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -12,6 +12,10 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do post.usuaries << usuarie params[:post][:draft] = true if site.invitade? usuarie + params.require(:post).permit(:slug).tap do |p| + post.slug.value = p[:slug] if p[:slug].present? + end + commit(action: :created, file: update_related_posts) if post.update(post_params) # Devolver el post aunque no se haya salvado para poder rescatar los From 0263169074f7795ae719d074f9f90f7aa2163d5c Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 20:00:39 -0300 Subject: [PATCH 096/475] fix: devolver true aunque no haga falta modificar la configuracion --- app/models/site/config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/site/config.rb b/app/models/site/config.rb index 3215277e..11277a19 100644 --- a/app/models/site/config.rb +++ b/app/models/site/config.rb @@ -31,7 +31,7 @@ class Site # Escribe los cambios en el repositorio def write - return if persisted? + return true if persisted? @saved = Site::Writer.new(site: site, file: path, content: content.to_yaml).save From 0817139032ad0a93d4618fa6bcc78e474a4212bb Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 21:01:29 -0300 Subject: [PATCH 097/475] =?UTF-8?q?feat:=20agregar=20pol=C3=ADtica=20de=20?= =?UTF-8?q?privacidad?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/privacy_policy.rb | 14 +++ app/services/site_service.rb | 26 +++- config/initializers/inflections.rb | 4 + .../20230322231344_add_privacy_policy.rb | 22 ++++ db/seeds/privacy_policies.yml | 113 ++++++++++++++++++ 5 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 app/models/privacy_policy.rb create mode 100644 db/migrate/20230322231344_add_privacy_policy.rb create mode 100644 db/seeds/privacy_policies.yml diff --git a/app/models/privacy_policy.rb b/app/models/privacy_policy.rb new file mode 100644 index 00000000..8805daa9 --- /dev/null +++ b/app/models/privacy_policy.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# Políticas de privacidad +class PrivacyPolicy < ApplicationRecord + extend Mobility + + translates :title, type: :string, locale_accessors: true + translates :description, type: :text, locale_accessors: true + translates :content, type: :text, locale_accessors: true + + validates :title, presence: true, uniqueness: true + validates :description, presence: true + validates :content, presence: true +end diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 449db16a..64b25297 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -16,7 +16,8 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do site.config.write && commit_config(action: :create) && add_licencias && - add_code_of_conduct + add_code_of_conduct && + add_privacy_policy end site @@ -172,6 +173,29 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do end.compact.map(&:valid?).all? end + # Agrega política de privacidad + # + # @return [Boolean] + def add_privacy_policy + return true unless site.layout?(:privacy_policy) || site.layout?(:page) + + pp = PrivacyPolicy.first + + with_all_locales do |locale| + params = ActionController::Parameters.new( + post: { + layout: site.layout?(:privacy_policy) ? 'privacy_policy' : 'page', + lang: locale.to_s, + title: pp.title, + description: pp.description, + content: CommonMarker.render_html(pp.content) + } + ) + + PostService.new(site: site, usuarie: usuarie, params: params).create + end.compact.map(&:valid?).all? + end + # Crea los deploys necesarios para sincronizar a otros nodos de Sutty def sync_nodes Rails.application.nodes.each do |node| diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 46cb9d78..6002ee65 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -15,6 +15,8 @@ ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.singular 'rollups', 'rollup' inflect.plural 'code_of_conduct', 'codes_of_conduct' inflect.singular 'codes_of_conduct', 'code_of_conduct' + inflect.plural 'privacy_policy', 'privacy_policies' + inflect.singular 'privacy_policies', 'privacy_policy' end ActiveSupport::Inflector.inflections(:es) do |inflect| @@ -32,4 +34,6 @@ ActiveSupport::Inflector.inflections(:es) do |inflect| inflect.singular 'rollups', 'rollup' inflect.plural 'code_of_conduct', 'codes_of_conduct' inflect.singular 'codes_of_conduct', 'code_of_conduct' + inflect.plural 'privacy_policy', 'privacy_policies' + inflect.singular 'privacy_policies', 'privacy_policy' end diff --git a/db/migrate/20230322231344_add_privacy_policy.rb b/db/migrate/20230322231344_add_privacy_policy.rb new file mode 100644 index 00000000..e0d7ae59 --- /dev/null +++ b/db/migrate/20230322231344_add_privacy_policy.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# Agrega políticas de privacidad +class AddPrivacyPolicy < ActiveRecord::Migration[6.1] + def up + create_table :privacy_policies do |t| + t.timestamps + t.string :title + t.text :description + t.text :content + end + + # XXX: En lugar de ponerlo en las seeds + YAML.safe_load(File.read('db/seeds/privacy_policies.yml')).each do |pp| + PrivacyPolicy.new(**pp).save! + end + end + + def down + drop_table :privacy_policies + end +end diff --git a/db/seeds/privacy_policies.yml b/db/seeds/privacy_policies.yml new file mode 100644 index 00000000..98ce8379 --- /dev/null +++ b/db/seeds/privacy_policies.yml @@ -0,0 +1,113 @@ +--- +- title_en: "Privacy Policy" + title_es: "Políticas de privacidad" + description_en: "With what care does this site handles personal data of its users and visitors?" + description_es: "¿Cuáles son los cuidados de este sitio con respecto a sus usuaries y visitantes?" + content_en: | + > We use "them" as neutral pronoun to refer to people regardless of + > gender identity. + + This document details Sutty's privacy policy, including web site, + platform, other infrastructure (support channels, etc.) and web sites + generated by users. + + ## This is too long! + + * Sutty doesn't collect any kind of personal data. + + * Sutty may only collect statistical data that doesn't identify + individuals. + + ## Analytic data + + Sutty may only collect data for analytics (number of visits, duration, + etc.), not associated to personal data. + + Analytical data collected for every web site can only be used internally + by Sutty. Sutty doesn't share any data privately with any third + parties. Selected analytical data could be used publicly. + + Sutty doesn't recommend personal data collection in any way, but it + doesn't monitor if its users use third party services with their own + privacy policies. We recommend users and visitors to inform themselves + before using third parties analytics services. + + ## No personal data collection + + Sutty doesn't collect IP addresses from users nor visitors in any way. + + Sutty doesn't ask for personal data for registering user accounts in its + platform. + + Sutty only uses session "cookies" to identify users during their use of + the platform. It doesn't use "cookies" to identify visitors of web + sites hosted by Sutty. + + The only exception where Sutty could collect personal data is during + service payment. Digital safety measures will be taken to keep this + information and to discard it if possible after needed. + + Users will be notified when their personal data is removed. + + If users decide to host their web sites with third parties, they must + inform themselves about the corresponding privacy policies. Sutty only + recommends third parties with privacy policies compatible with these. + content_es: | + > Utilizamos la e como pronombre neutro para referirnos a personas + > independientemente de su identidad de género, por ejemplo “usuarie”. + + Este documento detalla la política de privacidad de Sutty, incluyendo + sitio web, plataforma de edición, infraestructura relacionada (salas de + chat, etc.) y sitios creados por sus usuaries a través de la plataforma, + en adelante "Sutty". + + ## ¡Esto es demasiado largo! + + Un resumen: + + * Sutty no recolecta datos personales de ningún tipo + + * Sutty solo recolectaría datos analíticos que no identifican a + personas + + ## Datos analíticos + + La única recolección de datos realizada por Sutty es con fines + analíticos (cantidad de visitas, duración, etc.), no asociados a datos + personales. + + Los datos analíticos recolectados por cada sitio podrán ser utilizados + internamente por Sutty. Sutty no comparte datos analíticos con + terceros en forma privada. Datos analíticos seleccionados podrán ser + utilizados públicamente. + + Sutty no recomienda la recolección de datos personales de ninguna forma, + pero no monitorea que les usuaries utilicen servicios de terceros con + sus propias políticas de privacidad. Recomendamos a les usuaries y + visitantes informarse antes de utilizar servicios de estadísticas de + terceros. + + ## No registro de datos personales + + Sutty no registra direcciones IP de usuaries ni de visitantes de ninguna + forma. + + Sutty no solicita datos personales para el registro de cuentas de + usuarie en su plataforma. + + Sutty solo utiliza “cookies” de sesión para identificar usuaries + mientras utilicen la plataforma. No se utilizan “cookies” para + identificar visitantes a los sitios alojados por Sutty. + + El único caso en el que Sutty podría solicitar datos personales es + durante el pago de servicios. Se tomarán medidas de seguridad digital + para salvaguardar esta información y descartar lo que sea posible una + vez que ya no sea necesaria. + + Se notificará a les usuaries cuando su información personal sea + eliminada. + + Si les usuaries deciden alojar sus sitios con terceros, deberán + informarse de las políticas de privacidad correspondientes. Sutty + recomienda servicios de terceros con políticas de privacidad coherentes + con estas. From 8fa2991bb1771288b8cad46fc30094ed96a365a1 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 11:44:47 -0300 Subject: [PATCH 098/475] =?UTF-8?q?fix:=20enviar=20la=20invitaci=C3=B3n=20?= =?UTF-8?q?luego=20de=20crear=20el=20rol=20#12728?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit de otra forma les usuaries que ya tienen sitios reciben una invitación a un sitio que no es y les que no tienen sitios no reciben nada porque hay un error. --- app/controllers/usuaries_controller.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 7621489e..3f672110 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -83,16 +83,19 @@ class UsuariesController < ApplicationController # Enviar la invitación si es necesario y agregar al sitio invitaciones.each do |invitacion| attributes = { email: invitacion.address } + options = { skip_invitation: true } next if Usuarie.where(id: @site.roles.pluck(:usuarie_id)).find_by(attributes) - usuarie = Usuarie.find_by(attributes).tap do |u| - u.send(:send_devise_notification, :invitation_instructions, nil) + usuarie = Usuarie.find_by attributes + usuarie ||= Usuarie.invite!(attributes, nil, options).tap do |u| + u.generate_invitation_token! end - usuarie ||= Usuarie.invite! attributes - @site.roles.create(usuarie: usuarie, temporal: true, rol: invited_as) + + # XXX: La invitación tiene que ser enviada luego de crear el rol + usuarie.send(:send_devise_notification, :invitation_instructions, nil) end redirect_to site_usuaries_path(@site) From 5cda6a440c00879b3ba6418c208fb2af9b8852b5 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 14:11:19 -0300 Subject: [PATCH 099/475] fix: enviar los argumentos como un hash closes ##12742 closes ##12740 closes ##12734 closes ##12732 closes ##12725 closes ##12721 closes ##12718 closes ##12715 --- config/initializers/sucker_punch.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/sucker_punch.rb b/config/initializers/sucker_punch.rb index 19506c2d..ce1209dd 100644 --- a/config/initializers/sucker_punch.rb +++ b/config/initializers/sucker_punch.rb @@ -2,5 +2,5 @@ # Enviar una notificación cuando falla una tarea SuckerPunch.exception_handler = lambda { |ex, _, args| - ExceptionNotifier.notify_exception(ex, data: args) + ExceptionNotifier.notify_exception(ex, data: { args: args }) } From 98b38e4caabcfa354b4d90e05112d1031fefcf7a Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 15:14:53 -0300 Subject: [PATCH 100/475] =?UTF-8?q?fix:=20el=20=C3=BAltimo=20=C3=ADtem=20e?= =?UTF-8?q?s=20un=20hash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #12747 --- config/initializers/sucker_punch.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/sucker_punch.rb b/config/initializers/sucker_punch.rb index ce1209dd..21997139 100644 --- a/config/initializers/sucker_punch.rb +++ b/config/initializers/sucker_punch.rb @@ -2,5 +2,5 @@ # Enviar una notificación cuando falla una tarea SuckerPunch.exception_handler = lambda { |ex, _, args| - ExceptionNotifier.notify_exception(ex, data: { args: args }) + ExceptionNotifier.notify_exception(ex, data: args.last) } From 1ac83140d60353ffc773622b75bb5c531264af65 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 15:32:54 -0300 Subject: [PATCH 101/475] =?UTF-8?q?fix:=20no=20enviar=20la=20invitaci?= =?UTF-8?q?=C3=B3n=20hasta=20=C3=BAltimo=20momento?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/usuaries_controller.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 3f672110..ab116572 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -82,20 +82,19 @@ class UsuariesController < ApplicationController # Enviar la invitación si es necesario y agregar al sitio invitaciones.each do |invitacion| - attributes = { email: invitacion.address } - options = { skip_invitation: true } + attributes = { email: invitacion.address, skip_invitation: true } next if Usuarie.where(id: @site.roles.pluck(:usuarie_id)).find_by(attributes) usuarie = Usuarie.find_by attributes - usuarie ||= Usuarie.invite!(attributes, nil, options).tap do |u| - u.generate_invitation_token! + usuarie ||= Usuarie.invite!(attributes).tap do |u| + u.send :generate_invitation_token! end @site.roles.create(usuarie: usuarie, temporal: true, rol: invited_as) # XXX: La invitación tiene que ser enviada luego de crear el rol - usuarie.send(:send_devise_notification, :invitation_instructions, nil) + usuarie.deliver_invitation end redirect_to site_usuaries_path(@site) From fce5c0d90b38edef44e8fdae37ec8b87c5758072 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 15:38:46 -0300 Subject: [PATCH 102/475] =?UTF-8?q?fix:=20hacer=20todo=20en=20una=20transa?= =?UTF-8?q?cci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/usuaries_controller.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index ab116572..84bcc13f 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -86,15 +86,17 @@ class UsuariesController < ApplicationController next if Usuarie.where(id: @site.roles.pluck(:usuarie_id)).find_by(attributes) - usuarie = Usuarie.find_by attributes - usuarie ||= Usuarie.invite!(attributes).tap do |u| - u.send :generate_invitation_token! + Usuarie.transaction do + usuarie = Usuarie.find_by attributes + usuarie ||= Usuarie.invite!(attributes).tap do |u| + u.send :generate_invitation_token! + end + + @site.roles.create(usuarie: usuarie, temporal: true, rol: invited_as) + + # XXX: La invitación tiene que ser enviada luego de crear el rol + usuarie.deliver_invitation end - - @site.roles.create(usuarie: usuarie, temporal: true, rol: invited_as) - - # XXX: La invitación tiene que ser enviada luego de crear el rol - usuarie.deliver_invitation end redirect_to site_usuaries_path(@site) From 732db666c7bf10d03696c243d54c351bb8c4e85b Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 15:42:20 -0300 Subject: [PATCH 103/475] =?UTF-8?q?fix:=20usar=20el=20=C3=BAltimo=20sitio?= =?UTF-8?q?=20al=20que=20todav=C3=ADa=20no=20aceptamos=20invitaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/devise/mailer/invitation_instructions.html.haml | 2 +- app/views/devise/mailer/invitation_instructions.text.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/devise/mailer/invitation_instructions.html.haml b/app/views/devise/mailer/invitation_instructions.html.haml index e1fe6812..bc9d9e4e 100644 --- a/app/views/devise/mailer/invitation_instructions.html.haml +++ b/app/views/devise/mailer/invitation_instructions.html.haml @@ -1,4 +1,4 @@ -- site = @resource.sites.last +- site = @resource.roles.where(temporal: true).last&.site %p= t('devise.mailer.invitation_instructions.hello', email: @resource.email) diff --git a/app/views/devise/mailer/invitation_instructions.text.haml b/app/views/devise/mailer/invitation_instructions.text.haml index 353f2a12..a1360bb0 100644 --- a/app/views/devise/mailer/invitation_instructions.text.haml +++ b/app/views/devise/mailer/invitation_instructions.text.haml @@ -1,4 +1,4 @@ -- site = @resource.sites.last +- site = @resource.roles.where(temporal: true).last&.site = t('devise.mailer.invitation_instructions.hello', email: @resource.email) \ From 1fa37b20e1ee5f218e98b21da518927a2512f953 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 15:47:06 -0300 Subject: [PATCH 104/475] fix: solo invitar una vez --- app/views/devise/mailer/invitation_instructions.html.haml | 2 +- app/views/devise/mailer/invitation_instructions.text.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/devise/mailer/invitation_instructions.html.haml b/app/views/devise/mailer/invitation_instructions.html.haml index bc9d9e4e..3cb9704e 100644 --- a/app/views/devise/mailer/invitation_instructions.html.haml +++ b/app/views/devise/mailer/invitation_instructions.html.haml @@ -8,7 +8,7 @@ %h1= site.title %p= site.description -- if @resource.created_by_invite? +- if @resource.created_by_invite? && !@resource.invitation_accepted? %p= link_to t('devise.mailer.invitation_instructions.accept'), accept_invitation_url(@resource, invitation_token: @token) diff --git a/app/views/devise/mailer/invitation_instructions.text.haml b/app/views/devise/mailer/invitation_instructions.text.haml index a1360bb0..2050c19c 100644 --- a/app/views/devise/mailer/invitation_instructions.text.haml +++ b/app/views/devise/mailer/invitation_instructions.text.haml @@ -9,7 +9,7 @@ \ = site.description \ -- if @resource.created_by_invite? +- if @resource.created_by_invite? && !@resource.invitation_accepted? = accept_invitation_url(@resource, invitation_token: @token) \ - if @resource.invitation_due_at From 1bfff4dfdb72ebdd676c324d0a60bcf16f5b2c5a Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 16:24:53 -0300 Subject: [PATCH 105/475] fix: enviar las invitaciones luego de crear el rol --- app/controllers/usuaries_controller.rb | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 84bcc13f..074694f1 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -81,21 +81,25 @@ class UsuariesController < ApplicationController authorize SiteUsuarie.new(@site, current_usuarie) # Enviar la invitación si es necesario y agregar al sitio - invitaciones.each do |invitacion| - attributes = { email: invitacion.address, skip_invitation: true } - - next if Usuarie.where(id: @site.roles.pluck(:usuarie_id)).find_by(attributes) + invitaciones.each do |address| + next if Usuarie.where(id: @site.roles.pluck(:usuarie_id)).find_by_email(address) Usuarie.transaction do - usuarie = Usuarie.find_by attributes - usuarie ||= Usuarie.invite!(attributes).tap do |u| + usuarie = Usuarie.find_by_email(address) + usuarie ||= Usuarie.invite!({ email: address, skip_invitation: true }).tap do |u| u.send :generate_invitation_token! end - @site.roles.create(usuarie: usuarie, temporal: true, rol: invited_as) + role = @site.roles.create(usuarie: usuarie, temporal: true, rol: invited_as) # XXX: La invitación tiene que ser enviada luego de crear el rol - usuarie.deliver_invitation + if role.persisted? + usuarie.deliver_invitation + else + raise ArgumentError, role.errors.full_messages + end + rescue ArgumentError => e + ExceptionNotifier.notify_exception(e, data: { site: @site.name, address: address }) end end @@ -137,6 +141,8 @@ class UsuariesController < ApplicationController private # Traer todas las invitaciones que al menos tengan usuarie y dominio + # + # @return [Array] def invitaciones # XXX: Podríamos usar EmailAddress pero hace chequeos más lentos params[:invitaciones]&.tr("\r", '')&.split("\n")&.map do |m| @@ -145,7 +151,7 @@ class UsuariesController < ApplicationController nil end.compact.select do |m| m.local && m.domain - end + end.map(&:address) end # El tipo de invitación que tenemos que enviar, si alguien mandó From d01f4ae5e2432b7f34835a1ca50e1629d8ba96c1 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 16:53:06 -0300 Subject: [PATCH 106/475] =?UTF-8?q?fix:=20volver=20a=20leer=20el=20sitio?= =?UTF-8?q?=20despu=C3=A9s=20de=20guardarlo=20#12755?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/site_service.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 64b25297..eaefca3a 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -15,6 +15,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do site.save && site.config.write && commit_config(action: :create) && + site.reset.nil? && add_licencias && add_code_of_conduct && add_privacy_policy @@ -29,6 +30,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do site.update(params) && site.config.write && commit_config(action: :update) && + site.reset.nil? && change_licencias end From 7a13dffc9b29e89525b9a6e37a38714d53fa9993 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 17:21:05 -0300 Subject: [PATCH 107/475] =?UTF-8?q?fix:=20establecer=20un=20par=C3=A1metro?= =?UTF-8?q?=20por=20defecto=20#12754?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/usuaries_controller.rb | 12 ++++++------ app/models/rol.rb | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 6d02a35a..746ee822 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -72,6 +72,8 @@ class UsuariesController < ApplicationController site_usuarie = SiteUsuarie.new(@site, current_usuarie) authorize site_usuarie + params[:invite_as] = invited_as :invite_as + @policy = policy(site_usuarie) end @@ -155,12 +157,10 @@ class UsuariesController < ApplicationController # El tipo de invitación que tenemos que enviar, si alguien mandó # cualquier cosa, usamos el privilegio menor. - def invited_as - if Rol::ROLES.include?(params[:invited_as]) - params[:invited_as] - else - 'invitade' - end + # + # @return [String] + def invited_as(param_key = :invited_as) + Rol.role?(params[param_key]) ? params[param_key] : Rol::INVITADE end def site diff --git a/app/models/rol.rb b/app/models/rol.rb index 5879d666..fcd07037 100644 --- a/app/models/rol.rb +++ b/app/models/rol.rb @@ -21,4 +21,8 @@ class Rol < ApplicationRecord def usuarie? rol == USUARIE end + + def self.role?(rol) + ROLES.include? rol + end end From df8efe800bb6c62b33df9624019e1468d3899cfe Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 17:38:48 -0300 Subject: [PATCH 108/475] fix: no hardcodear roles --- app/controllers/usuaries_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 746ee822..4db6aafd 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -47,7 +47,7 @@ class UsuariesController < ApplicationController @usuarie = Usuarie.find(params[:usuarie_id]) if @site.usuaries.count > 1 - @usuarie.rol_for_site(@site).update_attribute :rol, 'invitade' + @usuarie.rol_for_site(@site).update_attribute :rol, Rol::INVITADE else flash[:warning] = I18n.t('usuaries.index.demote.denied') end @@ -61,7 +61,7 @@ class UsuariesController < ApplicationController authorize SiteUsuarie.new(@site, current_usuarie) @usuarie = Usuarie.find(params[:usuarie_id]) - @usuarie.rol_for_site(@site).update_attribute :rol, 'usuarie' + @usuarie.rol_for_site(@site).update_attribute :rol, Rol::USUARIE redirect_to site_usuaries_path end From c2fbc06d4102eab6b45a3b567795dfac7a198e47 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 17:50:24 -0300 Subject: [PATCH 109/475] =?UTF-8?q?fix:=20tenemos=20un=20l=C3=ADo=20de=20s?= =?UTF-8?q?ingulares=20y=20plurales?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/usuaries_controller.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 4db6aafd..716668a9 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -72,7 +72,7 @@ class UsuariesController < ApplicationController site_usuarie = SiteUsuarie.new(@site, current_usuarie) authorize site_usuarie - params[:invite_as] = invited_as :invite_as + params[:invite_as] = invite_as @policy = policy(site_usuarie) end @@ -159,8 +159,12 @@ class UsuariesController < ApplicationController # cualquier cosa, usamos el privilegio menor. # # @return [String] - def invited_as(param_key = :invited_as) - Rol.role?(params[param_key]) ? params[param_key] : Rol::INVITADE + def invited_as + Rol.role?(params[:invited_as]) ? params[:invited_as] : Rol::INVITADE + end + + def invite_as + Rol.role?(params[:invite_as].singularize) ? params[:invite_as] : Rol::INVITADE.pluralize end def site From c9fa518b337b9426abb0a22ec61543582ef3bef5 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 17:53:13 -0300 Subject: [PATCH 110/475] =?UTF-8?q?fix:=20el=20parametro=20puede=20venir?= =?UTF-8?q?=20vac=C3=ADo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/usuaries_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 716668a9..d75f3c20 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -164,7 +164,7 @@ class UsuariesController < ApplicationController end def invite_as - Rol.role?(params[:invite_as].singularize) ? params[:invite_as] : Rol::INVITADE.pluralize + Rol.role?(params[:invite_as]&.singularize) ? params[:invite_as] : Rol::INVITADE.pluralize end def site From b51eb6856c358414a7d4f86cf45db8f511e8a78d Mon Sep 17 00:00:00 2001 From: f Date: Fri, 24 Mar 2023 11:50:25 -0300 Subject: [PATCH 111/475] =?UTF-8?q?fix:=20siempre=20devolver=20una=20relac?= =?UTF-8?q?i=C3=B3n=20#12768?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/metadata_locales.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/metadata_locales.rb b/app/models/metadata_locales.rb index 2e9080c9..3790b944 100644 --- a/app/models/metadata_locales.rb +++ b/app/models/metadata_locales.rb @@ -44,6 +44,6 @@ class MetadataLocales < MetadataHasAndBelongsToMany def posts other_locales.map do |locale| site.posts(lang: locale).where(layout: post.layout.value) - end.reduce(&:concat) + end.reduce(&:concat) || PostRelation.new end end From 42b2549f09e5fe9b3f33d6c632995253155400da Mon Sep 17 00:00:00 2001 From: f Date: Sat, 25 Mar 2023 13:46:30 -0300 Subject: [PATCH 112/475] =?UTF-8?q?feat:=20agregar=20una=20descripci=C3=B3?= =?UTF-8?q?n=20corta=20a=20la=20licencia?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit que es lo que usan las plantillas como aviso de licencia --- app/services/site_service.rb | 2 +- ...5163802_add_short_description_to_licencias.rb | 16 ++++++++++++++++ db/seeds/licencias.yml | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20230325163802_add_short_description_to_licencias.rb diff --git a/app/services/site_service.rb b/app/services/site_service.rb index eaefca3a..2719a26c 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -113,7 +113,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do slug: Jekyll::Utils.slugify(I18n.t('activerecord.models.licencia')), lang: lang, title: site.licencia.name, - description: site.licencia.description, + description: site.licencia.short_description, content: CommonMarker.render_html(site.licencia.deed) } ) diff --git a/db/migrate/20230325163802_add_short_description_to_licencias.rb b/db/migrate/20230325163802_add_short_description_to_licencias.rb new file mode 100644 index 00000000..efcc01e4 --- /dev/null +++ b/db/migrate/20230325163802_add_short_description_to_licencias.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# Agrega descripciones cortas a las licencias +class AddShortDescriptionToLicencias < ActiveRecord::Migration[6.1] + def up + add_column :licencias, :short_description, :string + + YAML.safe_load_file('db/seeds/licencias.yml').each do |licencia| + Licencia.find_by_icons(licencia['icons']).update licencia + end + end + + def down + remove_column :licencias, :short_description + end +end diff --git a/db/seeds/licencias.yml b/db/seeds/licencias.yml index cbe3bace..c5e2886a 100644 --- a/db/seeds/licencias.yml +++ b/db/seeds/licencias.yml @@ -1,6 +1,8 @@ --- - name_en: 'Peer Production License' name_es: 'Licencia de Producción de Pares' + short_description_en: "This work is licensed under a Peer Production License" + short_description_es: "Esta obra está bajo una Licencia de Producción de Pares" icons: "/images/ppl.png" url_en: 'https://wiki.p2pfoundation.net/Peer_Production_License' url_es: 'https://endefensadelsl.org/ppl_es.html' @@ -100,6 +102,8 @@ hacerlo es enlazar a esta página. - icons: "/images/by.png" + short_description_en: "This work is licensed under a Creative Commons Attribution 4.0 International License." + short_description_es: "Esta obra está bajo una Licencia Creative Commons Atribución 4.0 Internacional." name_en: 'Creative Commons Attribution 4.0 International (CC BY 4.0)' description_en: "This license gives everyone the freedom to use, adapt, and redistribute the contents of your site by requiring @@ -194,6 +198,8 @@ - icons: "/images/sa.png" name_en: "Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)" name_es: "Creative Commons Atribución-CompartirIgual 4.0 Internacional (CC BY-SA 4.0)" + short_description_en: "This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License." + short_description_es: "Esta obra está bajo una Licencia Creative Commons Atribución-CompartirIgual 4.0 Internacional." url_en: 'https://creativecommons.org/licenses/by-sa/4.0/' url_es: 'https://creativecommons.org/licenses/by-sa/4.0/deed.es' description_en: "This license is the same as the CC-BY 4.0 but it adds From c62d0d3a7254779f728fd14c224e2dc56127082e Mon Sep 17 00:00:00 2001 From: f Date: Sat, 25 Mar 2023 13:48:30 -0300 Subject: [PATCH 113/475] =?UTF-8?q?fixup!=20feat:=20agregar=20una=20descri?= =?UTF-8?q?pci=C3=B3n=20corta=20a=20la=20licencia?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/licencia.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/licencia.rb b/app/models/licencia.rb index c0eb1c80..f0a542ef 100644 --- a/app/models/licencia.rb +++ b/app/models/licencia.rb @@ -7,6 +7,7 @@ class Licencia < ApplicationRecord translates :name, type: :string, locale_accessors: true translates :url, type: :string, locale_accessors: true translates :description, type: :text, locale_accessors: true + translates :short_description, type: :string, locale_accessors: true translates :deed, type: :text, locale_accessors: true has_many :sites @@ -14,5 +15,6 @@ class Licencia < ApplicationRecord validates :name, presence: true, uniqueness: true validates :url, presence: true validates :description, presence: true + validates :short_description, presence: true validates :deed, presence: true end From d44ca16f81ec09f39713a94ee74da2b28c8b91e0 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 25 Mar 2023 13:51:07 -0300 Subject: [PATCH 114/475] =?UTF-8?q?fix:=20cambiar=20la=20descripci=C3=B3n?= =?UTF-8?q?=20de=20la=20licencia=20tambi=C3=A9n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/site_service.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 2719a26c..ce596482 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -143,6 +143,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do params = ActionController::Parameters.new( post: { title: site.licencia.name, + description: site.licencia.short_description, content: CommonMarker.render_html(site.licencia.deed) } ) From 960c8dcca450a27ab410833e6c5c35bcb9b8ccbf Mon Sep 17 00:00:00 2001 From: f Date: Sat, 25 Mar 2023 14:50:36 -0300 Subject: [PATCH 115/475] feat: implementar un servicio liviano de git-lfs #9361 --- app/services/lfs_object_service.rb | 64 ++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 app/services/lfs_object_service.rb diff --git a/app/services/lfs_object_service.rb b/app/services/lfs_object_service.rb new file mode 100644 index 00000000..65db113d --- /dev/null +++ b/app/services/lfs_object_service.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +# Representa un objeto git LFS +class LfsObjectService + attr_reader :site, :blob, :usuarie + + # @param :site [Site] + # @param :blob [ActiveStorage::Blob] + def initialize(site:, blob:, usuarie:) + @site = site + @blob = blob + @usuarie = usuarie + end + + def process + # Crear el directorio + FileUtils.mkdir_p(File.dirname(object_path)) + + # Mover el archivo + FileUtils.mv(path, object_path) unless File.exist? object_path + + # Crear el pointer + Site::Writer.new(site: site, file: path, content: pointer).save + + # Commitear el pointer + site.repository.commit(file: path, usuarie: usuarie, message: File.basename(path)) + + # Eliminar el pointer + FileUtils.rm(path) + + # Hacer link duro del objeto al archivo + FileUtils.ln(object_path, path) + end + + # @return [String] + def path + @path ||= blob.service.path_for(blob.key) + end + + # @return [String] + def digest + @digest ||= Digest::SHA256.file(path).hexdigest + end + + # @return [String] + def object_path + @git_lfs_object_path ||= File.join(site.path, '.git', 'lfs', 'objects', digest[0..1], digest[2..3], digest) + end + + # @return [Integer] + def size + @size ||= File.size(File.exist?(object_path) ? object_path : path) + end + + # @return [String] + def pointer + @pointer ||= + <<~POINTER + version https://git-lfs.github.com/spec/v1 + oid sha256:#{digest} + size #{size} + POINTER + end +end From 2215a00727d60d18147e76692dfe797a1183bd38 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 25 Mar 2023 15:22:54 -0300 Subject: [PATCH 116/475] feat: commitear el archivo en lfs al subirlo --- app/lib/active_storage/service/jekyll_service.rb | 15 +++++++++------ app/services/lfs_object_service.rb | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/lib/active_storage/service/jekyll_service.rb b/app/lib/active_storage/service/jekyll_service.rb index 88ffa83c..6763ee0d 100644 --- a/app/lib/active_storage/service/jekyll_service.rb +++ b/app/lib/active_storage/service/jekyll_service.rb @@ -4,11 +4,6 @@ module ActiveStorage class Service # Sube los archivos a cada repositorio y los agrega al LFS de su # repositorio git. - # - # @todo: Implementar LFS. No nos gusta mucho la idea porque duplica - # el espacio en disco, pero es la única forma que tenemos (hasta que - # implementemos IPFS) para poder transferir los archivos junto con el - # sitio. class JekyllService < Service::DiskService # Genera un servicio para un sitio determinado # @@ -27,7 +22,10 @@ module ActiveStorage # @param :checksum [String] def upload(key, io, checksum: nil, **) instrument :upload, key: key, checksum: checksum do - IO.copy_stream(io, make_path_for(key)) unless exist?(key) + unless exist?(key) + IO.copy_stream(io, make_path_for(key)) + LfsObjectService.new(site: site, usuarie: current_usuarie, blob: blob).process + end ensure_integrity_of(key, checksum) if checksum end end @@ -91,6 +89,11 @@ module ActiveStorage def path_for(key) File.join root, folder_for(key), filename_for(key) end + + # @return [Site] + def site + @site ||= Site.find_by_name(File.basename(root)) + end end end end diff --git a/app/services/lfs_object_service.rb b/app/services/lfs_object_service.rb index 65db113d..61775e12 100644 --- a/app/services/lfs_object_service.rb +++ b/app/services/lfs_object_service.rb @@ -44,7 +44,7 @@ class LfsObjectService # @return [String] def object_path - @git_lfs_object_path ||= File.join(site.path, '.git', 'lfs', 'objects', digest[0..1], digest[2..3], digest) + @object_path ||= File.join(site.path, '.git', 'lfs', 'objects', digest[0..1], digest[2..3], digest) end # @return [Integer] From 2940b5d3e818d047afedf173df0d7a2d6b6f0613 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 25 Mar 2023 15:29:49 -0300 Subject: [PATCH 117/475] =?UTF-8?q?fix:=20no=20podemos=20saber=20qui=C3=A9?= =?UTF-8?q?n=20subi=C3=B3=20el=20archivo=20todav=C3=ADa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/lib/active_storage/service/jekyll_service.rb | 2 +- app/services/lfs_object_service.rb | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/lib/active_storage/service/jekyll_service.rb b/app/lib/active_storage/service/jekyll_service.rb index 6763ee0d..f399f440 100644 --- a/app/lib/active_storage/service/jekyll_service.rb +++ b/app/lib/active_storage/service/jekyll_service.rb @@ -24,7 +24,7 @@ module ActiveStorage instrument :upload, key: key, checksum: checksum do unless exist?(key) IO.copy_stream(io, make_path_for(key)) - LfsObjectService.new(site: site, usuarie: current_usuarie, blob: blob).process + LfsObjectService.new(site: site, blob: blob).process end ensure_integrity_of(key, checksum) if checksum end diff --git a/app/services/lfs_object_service.rb b/app/services/lfs_object_service.rb index 61775e12..bb62301d 100644 --- a/app/services/lfs_object_service.rb +++ b/app/services/lfs_object_service.rb @@ -2,14 +2,13 @@ # Representa un objeto git LFS class LfsObjectService - attr_reader :site, :blob, :usuarie + attr_reader :site, :blob # @param :site [Site] # @param :blob [ActiveStorage::Blob] - def initialize(site:, blob:, usuarie:) + def initialize(site:, blob:) @site = site @blob = blob - @usuarie = usuarie end def process @@ -23,7 +22,7 @@ class LfsObjectService Site::Writer.new(site: site, file: path, content: pointer).save # Commitear el pointer - site.repository.commit(file: path, usuarie: usuarie, message: File.basename(path)) + site.repository.commit(file: path, usuarie: author, message: File.basename(path)) # Eliminar el pointer FileUtils.rm(path) @@ -61,4 +60,8 @@ class LfsObjectService size #{size} POINTER end + + def author + @author ||= GitAuthor.new email: "disk_service@#{Site.domain}", name: 'DiskService' + end end From 2fb5bc24d5d21fdc2d32146ef114518ed96140c8 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 25 Mar 2023 15:34:47 -0300 Subject: [PATCH 118/475] fix: encontrar el blob para este servicio --- app/lib/active_storage/service/jekyll_service.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/lib/active_storage/service/jekyll_service.rb b/app/lib/active_storage/service/jekyll_service.rb index f399f440..e6c5fda6 100644 --- a/app/lib/active_storage/service/jekyll_service.rb +++ b/app/lib/active_storage/service/jekyll_service.rb @@ -24,7 +24,7 @@ module ActiveStorage instrument :upload, key: key, checksum: checksum do unless exist?(key) IO.copy_stream(io, make_path_for(key)) - LfsObjectService.new(site: site, blob: blob).process + LfsObjectService.new(site: site, blob: blob_for(key)).process end ensure_integrity_of(key, checksum) if checksum end @@ -77,7 +77,7 @@ module ActiveStorage # @param :key [String] # @return [String] def filename_for(key) - ActiveStorage::Blob.where(key: key).limit(1).pluck(:filename).first.tap do |filename| + blob_for(key).filename.to_s.tap do |filename| raise ArgumentError, "Filename for key #{key} is blank" if filename.blank? end end @@ -92,7 +92,11 @@ module ActiveStorage # @return [Site] def site - @site ||= Site.find_by_name(File.basename(root)) + @site ||= Site.find_by_name(name) + end + + def blob_for(key) + ActiveStorage::Blob.find_by(key: key, service_name: name) end end end From 6b759c92ce0ad52caae465926af55edccc85f402 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 27 Mar 2023 11:45:23 -0300 Subject: [PATCH 119/475] fix: instalar las gemas cuando sea necesario #12755 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit si se modificó el gemfile queremos volver a instalarlas también --- app/models/site.rb | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/app/models/site.rb b/app/models/site.rb index 4b2a8eb9..6110f104 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -553,10 +553,33 @@ class Site < ApplicationRecord Dir.chdir path, &block end + # Instala las gemas cuando es necesario: + # + # * El sitio existe + # * No están instaladas + # * El archivo Gemfile se modificó + # * El archivo Gemfile.lock se modificó def install_gems return unless persisted? - return if Rails.root.join('_storage', 'gems', name).directory? - deploys.find_by_type('DeployLocal').send(:bundle) + if !gem_dir? || gemfile_updated? || gemfile_lock_updated? + deploys.find_by_type('DeployLocal').send(:bundle) + touch + end + end + + # Detecta si el repositorio de gemas existe + def gem_dir? + Rails.root.join('_storage', 'gems', name).directory? + end + + # Detecta si el Gemfile fue modificado + def gemfile_updated? + updated_at > File.mtime(File.join(path, 'Gemfile')) + end + + # Detecta si el Gemfile.lock fue modificado + def gemfile_lock_updated? + updated_at > File.mtime(File.join(path, 'Gemfile.lock')) end end From 5d40fabe54c34108cdbb5b42ca629568bbaf35d7 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 27 Mar 2023 12:38:31 -0300 Subject: [PATCH 120/475] feat: ordenar los sitios por actividad #12762 --- app/controllers/sites_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index f0eff0dc..7b1496e9 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -10,7 +10,7 @@ class SitesController < ApplicationController # Ver un listado de sitios def index authorize Site - @sites = current_usuarie.sites.order(:title) + @sites = current_usuarie.sites.order(updated_at: :desc) fresh_when @sites end From 39e997d0ca8ad2d41f7c361f458c08f669c679dd Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 20:21:52 -0300 Subject: [PATCH 121/475] BREAKING CHANGE: deprecar sucker punch en favor de que --- Gemfile | 2 +- Gemfile.lock | 8 ++------ app/jobs/application_job.rb | 2 +- config/environments/production.rb | 2 +- config/initializers/sucker_punch.rb | 6 ------ db/migrate/20230328231029_create_que_tables.rb | 12 ++++++++++++ 6 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 config/initializers/sucker_punch.rb create mode 100644 db/migrate/20230328231029_create_que_tables.rb diff --git a/Gemfile b/Gemfile index f3799638..7ff904dd 100644 --- a/Gemfile +++ b/Gemfile @@ -68,7 +68,7 @@ gem 'rollups', git: 'https://github.com/fauno/rollup.git', branch: 'update' gem 'rubyzip' gem 'rugged' gem 'concurrent-ruby-ext' -gem 'sucker_punch' +gem 'que' gem 'symbol-fstring', require: 'fstring/all' gem 'terminal-table' gem 'validates_hostname' diff --git a/Gemfile.lock b/Gemfile.lock index abaf45c9..ac8f6870 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -119,9 +119,6 @@ GEM colorator (1.1.0) commonmarker (0.21.2-x86_64-linux-musl) ruby-enum (~> 0.5) - concurrent-ruby (1.1.9) - concurrent-ruby-ext (1.1.9-x86_64-linux-musl) - concurrent-ruby (= 1.1.9) crass (1.0.6) database_cleaner (2.0.1) database_cleaner-active_record (~> 2.0.0) @@ -374,6 +371,7 @@ GEM pundit (2.1.1) activesupport (>= 3.0.0) racc (1.6.0-x86_64-linux-musl) + que (2.2.0) rack (2.2.3) rack-cors (1.1.1) rack (>= 2.0.0) @@ -510,8 +508,6 @@ GEM sprockets (>= 3.0.0) sqlite3 (1.4.2-x86_64-linux-musl) stackprof (0.2.17-x86_64-linux-musl) - sucker_punch (3.0.1) - concurrent-ruby (~> 1.0) sutty-archives (2.5.4) jekyll (>= 3.6, < 5.0) sutty-liquid (0.7.4) @@ -619,6 +615,7 @@ DEPENDENCIES pry puma pundit + que rack-cors rack-mini-profiler rails (~> 6) @@ -638,7 +635,6 @@ DEPENDENCIES spring-watcher-listen (~> 2.0.0) sqlite3 stackprof - sucker_punch sutty-liquid (>= 0.7.3) symbol-fstring terminal-table diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index f3673f0a..06690c53 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -2,7 +2,7 @@ # Base para trabajos class ApplicationJob < ActiveJob::Base - include SuckerPunch::Job + include Que::ActiveJob::JobExtensions private diff --git a/config/environments/production.rb b/config/environments/production.rb index d121bdbd..ed737146 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -66,7 +66,7 @@ Rails.application.configure do # Use a real queuing backend for Active Job (and separate queues per # environment) - config.active_job.queue_adapter = :sucker_punch + config.active_job.queue_adapter = :que config.active_job.queue_name_prefix = "sutty_#{Rails.env}" config.action_mailer.perform_caching = false diff --git a/config/initializers/sucker_punch.rb b/config/initializers/sucker_punch.rb deleted file mode 100644 index 865af32d..00000000 --- a/config/initializers/sucker_punch.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -# Enviar una notificación cuando falla una tarea -SuckerPunch.exception_handler = lambda { |ex, _klass, _args| - ExceptionNotifier.notify_exception(ex) -} diff --git a/db/migrate/20230328231029_create_que_tables.rb b/db/migrate/20230328231029_create_que_tables.rb new file mode 100644 index 00000000..1ed929f7 --- /dev/null +++ b/db/migrate/20230328231029_create_que_tables.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# Que +class CreateQueTables < ActiveRecord::Migration[6.1] + def up + Que.migrate! version: 7 + end + + def down + Que.migrate! version: 0 + end +end From cfc85e6356384e8e5f118badc677aa76fec217fa Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 21:15:55 -0300 Subject: [PATCH 122/475] feat: iniciar que en segundo plano --- Procfile | 1 + config/application.rb | 7 +++++++ config/environments/production.rb | 5 ----- monit.conf | 4 ++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Procfile b/Procfile index 45fe1df7..84842dff 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,3 @@ cleanup: bundle exec rake cleanup:everything stats: bundle exec rake stats:process_all +que: daemonize -c /srv/ -p /srv/tmp/que.pid -u rails /usr/local/bin/syslogize bundle exec que diff --git a/config/application.rb b/config/application.rb index 97ab244c..86265b24 100644 --- a/config/application.rb +++ b/config/application.rb @@ -38,6 +38,13 @@ module Sutty config.active_storage.variant_processor = :vips + # Que + config.action_mailer.deliver_later_queue_name = :default + config.active_storage.queues.analysis = :default + config.active_storage.queues.purge = :default + config.active_job.queue_adapter = :que + config.active_job.queue_name_prefix = "sutty_#{Rails.env}" + config.to_prepare do # Load application's model / class decorators Dir.glob(File.join(File.dirname(__FILE__), '..', 'app', '**', '*_decorator.rb')).sort.each do |c| diff --git a/config/environments/production.rb b/config/environments/production.rb index ed737146..f13488b8 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -64,11 +64,6 @@ Rails.application.configure do # Use a different cache store in production. config.cache_store = :redis_cache_store, { url: ENV['REDIS_SERVER'] } - # Use a real queuing backend for Active Job (and separate queues per - # environment) - config.active_job.queue_adapter = :que - config.active_job.queue_name_prefix = "sutty_#{Rails.env}" - config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. diff --git a/monit.conf b/monit.conf index 39f45d6d..4c7b345a 100644 --- a/monit.conf +++ b/monit.conf @@ -13,3 +13,7 @@ check program stats with path "/usr/bin/foreman run -f /srv/Procfile -d /srv stats" as uid "rails" gid "www-data" every "0 1 * * *" if status != 0 then alert + +check process que with pidfile /srv/tmp/que.pid + start program = "/usr/bin/foreman run -f /srv/Procfile -d /srv que" + stop program = "/bin/sh -c 'cat /srv/tmp/que.pid | xargs -r kill'" From d5db27ac95e296d2c9a9503756276cfef4b37a8d Mon Sep 17 00:00:00 2001 From: f Date: Wed, 29 Mar 2023 12:34:57 -0300 Subject: [PATCH 123/475] fix: sin prefijo para las colas --- config/application.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 86265b24..e02ddc8b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -43,7 +43,6 @@ module Sutty config.active_storage.queues.analysis = :default config.active_storage.queues.purge = :default config.active_job.queue_adapter = :que - config.active_job.queue_name_prefix = "sutty_#{Rails.env}" config.to_prepare do # Load application's model / class decorators From fd56ee4c3ece7d4aa26b070b1494423c1f848388 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 29 Mar 2023 15:35:00 -0300 Subject: [PATCH 124/475] fix: usar perform_later --- app/controllers/api/v1/contact_controller.rb | 2 +- app/jobs/maintenance_job.rb | 2 +- app/lib/exception_notifier/gitlab_notifier.rb | 2 +- app/models/log_entry.rb | 2 +- app/services/site_service.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/api/v1/contact_controller.rb b/app/controllers/api/v1/contact_controller.rb index deacf4a7..d949dc30 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_async site.id, + ContactJob.perform_later site.id, params[:form], contact_params.to_h.symbolize_keys, params[:redirect] diff --git a/app/jobs/maintenance_job.rb b/app/jobs/maintenance_job.rb index 4c411d0e..c7a962f9 100644 --- a/app/jobs/maintenance_job.rb +++ b/app/jobs/maintenance_job.rb @@ -10,7 +10,7 @@ # bundle exec rails c # m = Maintenance.create message_en: 'reason', message_es: 'razón', # estimated_from: Time.now, estimated_to: Time.now + 1.hour -# MaintenanceJob.perform_async(maintenance_id: m.id) +# MaintenanceJob.perform_later(maintenance_id: m.id) # # Lo mismo para salir de mantenimiento, agregando el atributo # are_we_back: true al crear el Maintenance. diff --git a/app/lib/exception_notifier/gitlab_notifier.rb b/app/lib/exception_notifier/gitlab_notifier.rb index 18bfc6d4..b596bcf4 100644 --- a/app/lib/exception_notifier/gitlab_notifier.rb +++ b/app/lib/exception_notifier/gitlab_notifier.rb @@ -11,7 +11,7 @@ module ExceptionNotifier # @param [Exception] # @param [Hash] def call(exception, **options) - GitlabNotifierJob.perform_async(exception, **options) + GitlabNotifierJob.perform_later(exception, **options) end end end diff --git a/app/models/log_entry.rb b/app/models/log_entry.rb index 1824da55..9685e0d0 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_async site_id, params[:form], params + ContactJob.perform_later site_id, params[:form], params end def params diff --git a/app/services/site_service.rb b/app/services/site_service.rb index f5f415e7..3d971b89 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_async site.id + DeployJob.perform_later site.id end # Crea un sitio, agrega un rol nuevo y guarda los cambios a la From fff499d1f823345f6dfd258730633124be0ab787 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 29 Mar 2023 15:40:57 -0300 Subject: [PATCH 125/475] fix: correr todo en la misma cola --- app/jobs/backtrace_job.rb | 2 -- app/jobs/gitlab_notifier_job.rb | 2 -- 2 files changed, 4 deletions(-) diff --git a/app/jobs/backtrace_job.rb b/app/jobs/backtrace_job.rb index 86a9b2a6..97e6007b 100644 --- a/app/jobs/backtrace_job.rb +++ b/app/jobs/backtrace_job.rb @@ -6,8 +6,6 @@ class BacktraceJob < ApplicationJob EMPTY_SOURCEMAP = { 'mappings' => '' }.freeze - queue_as :low_priority - attr_reader :params, :site_id def perform(site_id:, params:) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index 701c6789..cefe02ab 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -10,8 +10,6 @@ class GitlabNotifierJob < ApplicationJob # Variables que vamos a acceder luego attr_reader :exception, :options, :issue_data, :cached - queue_as :low_priority - # @param [Exception] la excepción lanzada # @param [Hash] opciones de ExceptionNotifier def perform(exception, **options) From 71afdc16ae8565323788f3e8e95e1d91f62bca36 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 29 Mar 2023 15:41:11 -0300 Subject: [PATCH 126/475] fix: aumentar la prioridad de las publicaciones --- app/jobs/deploy_job.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index e018533c..b3cb2b67 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -7,6 +7,9 @@ class DeployJob < ApplicationJob discard_on ActiveRecord::RecordNotFound + # Lanzar lo antes posible + self.priority = 10 + # rubocop:disable Metrics/MethodLength def perform(site, notify: true, time: Time.now, output: false) @output = output From be902e33bc4fa7bac1581da3bc2a7f8b5924b66a Mon Sep 17 00:00:00 2001 From: f Date: Wed, 29 Mar 2023 20:45:36 -0300 Subject: [PATCH 127/475] fix: demostrar otro sitio #10233 --- db/seeds/designs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/seeds/designs.yml b/db/seeds/designs.yml index 126a9b12..b1508b84 100644 --- a/db/seeds/designs.yml +++ b/db/seeds/designs.yml @@ -23,7 +23,7 @@ - name_en: 'Sutty' name_es: 'Sutty' gem: 'sutty-jekyll-theme' - url: 'https://rubygems.org/gems/sutty-jekyll-theme/' + url: "https://anarres.sutty.nl" description_en: "The Sutty design" description_es: 'El diseño de Sutty' license: 'https://0xacab.org/sutty/jekyll/sutty-jekyll-theme/-/blob/master/LICENSE.txt' From 117b8502769b1b554878a219b32f15d4a4dfb13b Mon Sep 17 00:00:00 2001 From: f Date: Thu, 30 Mar 2023 10:27:30 -0300 Subject: [PATCH 128/475] fix: hacer pull antes de push --- .woodpecker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index ab4887ac..887d397f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -47,6 +47,7 @@ pipeline: - "dotenv RAILS_ENV=production bundle exec rails assets:precompile" - "dotenv RAILS_ENV=production bundle exec rails assets:clean" - "git add public && git commit -m \"ci: assets [skip ci]\"" + - "git pull upstream ${CI_COMMIT_BRANCH}" - "git push upstream ${CI_COMMIT_BRANCH}" secrets: - "SSH_KEY" From edd88d04b93aee72429c826ccdf3437a4b2aa0f2 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 30 Mar 2023 11:29:23 -0300 Subject: [PATCH 129/475] =?UTF-8?q?feat:=20pre=20comprimir=20con=20brotli?= =?UTF-8?q?=20tambi=C3=A9n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .woodpecker.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 887d397f..19bd429b 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -28,7 +28,7 @@ pipeline: assets: image: "registry.nulo.in/sutty/panel:${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}" commands: - - "apk add python2 dotenv openssh-client" + - "apk add python2 dotenv openssh-client brotli" - "install -d -m 700 ~/.ssh/" - "echo \"$${KNOWN_HOSTS}\" | base64 -d >> ~/.ssh/known_hosts" - "chmod 600 ~/.ssh/known_hosts" @@ -46,6 +46,7 @@ pipeline: - "dotenv RAILS_ENV=production bundle exec rails webpacker:clobber" - "dotenv RAILS_ENV=production bundle exec rails assets:precompile" - "dotenv RAILS_ENV=production bundle exec rails assets:clean" + - "find public -type f -print0 | xargs -r0 brotli -k9" - "git add public && git commit -m \"ci: assets [skip ci]\"" - "git pull upstream ${CI_COMMIT_BRANCH}" - "git push upstream ${CI_COMMIT_BRANCH}" From d3166f2c5a27bf4d1602ac92273236ccc92019ab Mon Sep 17 00:00:00 2001 From: f Date: Thu, 30 Mar 2023 13:07:25 -0300 Subject: [PATCH 130/475] feat: poder serializar las excepciones --- config/initializers/que.rb | 8 +++++++ .../serializers/exception_serializer.rb | 22 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 config/initializers/que.rb create mode 100644 lib/active_job/serializers/exception_serializer.rb diff --git a/config/initializers/que.rb b/config/initializers/que.rb new file mode 100644 index 00000000..579f57d5 --- /dev/null +++ b/config/initializers/que.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +ActiveJob::Serializers.add_serializers ActiveJob::Serializers::ExceptionSerializer + +# Notificar los errores +Que.error_notifier = proc do |error, job| + ExceptionNotifier.notify_exception(error, data: job) +end diff --git a/lib/active_job/serializers/exception_serializer.rb b/lib/active_job/serializers/exception_serializer.rb new file mode 100644 index 00000000..42b55835 --- /dev/null +++ b/lib/active_job/serializers/exception_serializer.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require 'json/add/exception' + +module ActiveJob + module Serializers + class ExceptionSerializer < ObjectSerializer # :nodoc: + def serialize(ex) + super('value' => { 'class' => ex.class.name, 'exception' => ex.as_json }) + end + + def deserialize(hash) + hash.dig('value', 'class').constantize.json_create(hash.dig('value', 'exception')) + end + + private + def klass + Exception + end + end + end +end From 691b87b9116a623add90f4add0d0d03e7378ffa0 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 30 Mar 2023 13:11:37 -0300 Subject: [PATCH 131/475] fixup! feat: poder serializar las excepciones --- {lib => app/lib}/active_job/serializers/exception_serializer.rb | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {lib => app/lib}/active_job/serializers/exception_serializer.rb (100%) diff --git a/lib/active_job/serializers/exception_serializer.rb b/app/lib/active_job/serializers/exception_serializer.rb similarity index 100% rename from lib/active_job/serializers/exception_serializer.rb rename to app/lib/active_job/serializers/exception_serializer.rb From 661655abb5d03c2d2e21072de8230a05e324dc28 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 30 Mar 2023 13:51:09 -0300 Subject: [PATCH 132/475] =?UTF-8?q?fix:=20hacer=20el=20deploy=20cuando=20e?= =?UTF-8?q?l=20sitio=20ya=20est=C3=A1=20guardado=20#12276?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/site_service.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 75577226..70824422 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -30,11 +30,10 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do site.reset.nil? && add_licencias && add_code_of_conduct && - add_privacy_policy + add_privacy_policy && + deploy end - deploy - site end From 059230ad6b3249a9dc6c5717bd324102c373345c Mon Sep 17 00:00:00 2001 From: f Date: Thu, 30 Mar 2023 19:33:04 -0300 Subject: [PATCH 133/475] fix: poder cambiar de idioma manteniendo los parametros #12886 --- app/views/layouts/_breadcrumb.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/_breadcrumb.haml b/app/views/layouts/_breadcrumb.haml index 099ddde4..b1c42cb2 100644 --- a/app/views/layouts/_breadcrumb.haml +++ b/app/views/layouts/_breadcrumb.haml @@ -23,6 +23,7 @@ = link_to t('.logout'), main_app.destroy_usuarie_session_path, method: :delete, role: 'button', class: 'btn' - else + - params.permit! - I18n.available_locales.each do |locale| - next if locale == I18n.locale - = link_to t(locale), "?change_locale_to=#{locale}" + = link_to t(locale), params.to_h.merge(change_locale_to: locale) From 0744e124e350b45a1981080de5981784811dcee7 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 10:56:09 -0300 Subject: [PATCH 134/475] fixup! fix: instalar las gemas cuando sea necesario #12755 --- app/models/site.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/site.rb b/app/models/site.rb index 6110f104..804de42c 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -575,11 +575,11 @@ class Site < ApplicationRecord # Detecta si el Gemfile fue modificado def gemfile_updated? - updated_at > File.mtime(File.join(path, 'Gemfile')) + updated_at < File.mtime(File.join(path, 'Gemfile')) end # Detecta si el Gemfile.lock fue modificado def gemfile_lock_updated? - updated_at > File.mtime(File.join(path, 'Gemfile.lock')) + updated_at < File.mtime(File.join(path, 'Gemfile.lock')) end end From 8c5535c5c7a1dc4af94b57ed0e948c0e191f0350 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 17:39:25 -0300 Subject: [PATCH 135/475] =?UTF-8?q?fix:=20ordenar=20layouts=20alfab=C3=A9t?= =?UTF-8?q?icamente=20#5085?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/posts/index.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index a82616d8..8a2a678d 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -5,7 +5,7 @@ %h3= t('posts.new') %table.mb-3 - - @site.layouts.each do |layout| + - @site.layouts.sort_by(&:humanized_name).each do |layout| - next if layout.hidden? %tr %th= layout.humanized_name From 59e97ef6856fb8617df3edaab6dcf7e2df5554e5 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 18:16:11 -0300 Subject: [PATCH 136/475] =?UTF-8?q?fix:=20forzar=20la=20compilaci=C3=B3n?= =?UTF-8?q?=20de=20brotli?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 19bd429b..1d760b52 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -46,7 +46,7 @@ pipeline: - "dotenv RAILS_ENV=production bundle exec rails webpacker:clobber" - "dotenv RAILS_ENV=production bundle exec rails assets:precompile" - "dotenv RAILS_ENV=production bundle exec rails assets:clean" - - "find public -type f -print0 | xargs -r0 brotli -k9" + - "find public -type f -print0 | xargs -r0 brotli -k9f" - "git add public && git commit -m \"ci: assets [skip ci]\"" - "git pull upstream ${CI_COMMIT_BRANCH}" - "git push upstream ${CI_COMMIT_BRANCH}" From 0d0c8c8b073598d9a74114d8ec65923c90ab7e32 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 19:31:22 -0300 Subject: [PATCH 137/475] =?UTF-8?q?fix:=20mostrar=20los=20dise=C3=B1os=20e?= =?UTF-8?q?n=20dos=20columnas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/sites/_form.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index 757b8b48..2d8ea4fb 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -53,10 +53,10 @@ = render 'bootstrap/alert' do = t('activerecord.errors.models.site.attributes.design_id.layout_incompatible.help', layouts: site.incompatible_layouts.to_sentence) - .row.designs + .row.row-cols-1.row-cols-md-2.designs -# Demasiado complejo para un f.collection_radio_buttons - Design.all.find_each do |design| - .design.col-md-4.d-flex.flex-column + .design.col.d-flex.flex-column .custom-control.custom-radio = f.radio_button :design_id, design.id, checked: design.id == site.design_id, From c2fafac7f0556c12015fb0bf8c102cc22c15723f Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 19:32:36 -0300 Subject: [PATCH 138/475] feat: informar el estado del sitio #10492 --- app/models/site.rb | 1 + app/models/site/build_stats.rb | 45 ++++++++++++++++++++++++++++++++++ app/views/posts/index.haml | 4 ++- app/views/sites/_status.haml | 19 ++++++++++++++ config/locales/en.yml | 4 +++ config/locales/es.yml | 4 +++ 6 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 app/models/site/build_stats.rb create mode 100644 app/views/sites/_status.haml diff --git a/app/models/site.rb b/app/models/site.rb index 4b2a8eb9..6aa96612 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -7,6 +7,7 @@ class Site < ApplicationRecord include Site::Forms include Site::FindAndReplace include Site::Api + include Site::BuildStats include Tienda # Cifrar la llave privada que cifra y decifra campos ocultos. Sutty diff --git a/app/models/site/build_stats.rb b/app/models/site/build_stats.rb new file mode 100644 index 00000000..8b23942d --- /dev/null +++ b/app/models/site/build_stats.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +class Site + module BuildStats + extend ActiveSupport::Concern + + included do + # Devuelve el tiempo promedio de publicación para este sitio + # + # @return [Integer] + def average_publication_time + build_stats.group(:action).average(:seconds).values.reduce(:+).round + end + + # Devuelve el tiempo promedio de compilación para sitios similares + # a este. + # + # @return [Integer] + def average_publication_time_for_similar_sites + similar_deploys = Deploy.where(type: deploys.pluck(:type)).pluck(:id) + + BuildStat.where(deploy_id: similar_deploys).group(:action).average(:seconds).values.reduce(:+).round + end + + # Define si podemos calcular el tiempo promedio de publicación + # para este sitio + # + # @return [Boolean] + def average_publication_time_calculable? + build_stats.jekyll.where(status: true).count > 0 + end + + def similar_sites? + !design.no_theme? + end + + # Detecta si el sitio todavía no ha sido publicado + # + # @return [Boolean] + def not_published_yet? + build_stats.jekyll.where(status: true).count.zero? + end + end + end +end diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index dbeddaad..f7b884af 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -1,7 +1,9 @@ %main.row %aside.menu.col-md-3 - %h1= link_to @site.title, @site.url + %h1= @site.title %p.lead= @site.description + - cache_if @usuarie, [@site, I18n.locale] do + = render 'sites/status', site: @site %h3= t('posts.new') %table.mb-3 diff --git a/app/views/sites/_status.haml b/app/views/sites/_status.haml new file mode 100644 index 00000000..fb38896a --- /dev/null +++ b/app/views/sites/_status.haml @@ -0,0 +1,19 @@ +- link = nil +- if site.not_published_yet? + - message = t('.not_published_yet') +- if site.building? + - if site.average_publication_time_calculable? + - average_building_time = site.average_building_time + - elsif !site.similar_sites? + - average_building_time = 60 + - else + - average_building_time = site.average_publication_time_for_similar_sites + + - average_publication_time_human = distance_of_time_in_words average_building_time + - message = t('.building', average_time: average_publication_time_human, seconds: average_building_time) +- else + - message = t('.available') + - link = true + += render 'bootstrap/alert' do + = link_to_if link, message.html_safe, site.url diff --git a/config/locales/en.yml b/config/locales/en.yml index 567ab6bb..ee16f506 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -330,6 +330,10 @@ en: designer_url: 'Support the designer' static_file_migration: 'File migration' find_and_replace: 'Search and replace' + status: + building: "Your site is building, please wait ..." + not_published_yet: "Your site is being published for the first time, please wait up to 1 minute..." + available: "Your site is available! Click here to visit it." index: title: 'My Sites' pull: 'Upgrade' diff --git a/config/locales/es.yml b/config/locales/es.yml index 0a829e4a..e3d3f2ef 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -335,6 +335,10 @@ es: designer_url: 'Apoyá a le(s) diseñadore(s)' static_file_migration: 'Migración de archivos' find_and_replace: 'Búsqueda y reemplazo' + status: + building: "Tu sitio se está publicando, por favor espera ..." + not_published_yet: "Tu sitio se está publicando por primera vez, por favor espera hasta un minuto..." + available: "¡Tu sitio está disponible! Cliquea aquí para visitarlo." index: title: 'Mis sitios' pull: 'Actualizar' From 0442aa1e0672167a9502a5c5b7d14440bd7fdf88 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 19:37:47 -0300 Subject: [PATCH 139/475] fixup! feat: informar el estado del sitio #10492 --- app/views/sites/_status.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/sites/_status.haml b/app/views/sites/_status.haml index fb38896a..52afa3ca 100644 --- a/app/views/sites/_status.haml +++ b/app/views/sites/_status.haml @@ -3,7 +3,7 @@ - message = t('.not_published_yet') - if site.building? - if site.average_publication_time_calculable? - - average_building_time = site.average_building_time + - average_building_time = site.average_publication_time - elsif !site.similar_sites? - average_building_time = 60 - else From 8f19f837cdb11740cfe58d8be7fee4af30a70962 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 20:20:37 -0300 Subject: [PATCH 140/475] =?UTF-8?q?fix:=20hacer=20que=20devise=20respete?= =?UTF-8?q?=20el=20idioma=20de=20la=20sesi=C3=B3n=20#10478?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/lib/devise/failure_app_decorator.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 app/lib/devise/failure_app_decorator.rb diff --git a/app/lib/devise/failure_app_decorator.rb b/app/lib/devise/failure_app_decorator.rb new file mode 100644 index 00000000..f17cb482 --- /dev/null +++ b/app/lib/devise/failure_app_decorator.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Devise + module FailureAppDecorator + extend ActiveSupport::Concern + + included do + include AbstractController::Callbacks + + around_action :set_locale + + private + + def set_locale(&action) + I18n.with_locale(session[:locale] || I18n.locale, &action) + end + end + end +end + +Devise::FailureApp.include Devise::FailureAppDecorator From f62d7fcc800fd5e6c5eeea9306ee60df49ae9943 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 20:51:20 -0300 Subject: [PATCH 141/475] =?UTF-8?q?fix:=20esperar=20a=20que=20la=20primera?= =?UTF-8?q?=20publicaci=C3=B3n=20termine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/site/build_stats.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/site/build_stats.rb b/app/models/site/build_stats.rb index 8b23942d..6eebcc84 100644 --- a/app/models/site/build_stats.rb +++ b/app/models/site/build_stats.rb @@ -27,7 +27,7 @@ class Site # # @return [Boolean] def average_publication_time_calculable? - build_stats.jekyll.where(status: true).count > 0 + build_stats.jekyll.where(status: true).count > 1 end def similar_sites? From 5ae3fe0b354a9649c8b079c2f5966b23cd7b7eef Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 20:52:35 -0300 Subject: [PATCH 142/475] =?UTF-8?q?fix:=20dar=20una=20acci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index ee16f506..f3e319ee 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -331,7 +331,7 @@ en: static_file_migration: 'File migration' find_and_replace: 'Search and replace' status: - building: "Your site is building, please wait ..." + building: "Your site is building, please wait to refresh this page..." not_published_yet: "Your site is being published for the first time, please wait up to 1 minute..." available: "Your site is available! Click here to visit it." index: diff --git a/config/locales/es.yml b/config/locales/es.yml index e3d3f2ef..98181fb3 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -336,7 +336,7 @@ es: static_file_migration: 'Migración de archivos' find_and_replace: 'Búsqueda y reemplazo' status: - building: "Tu sitio se está publicando, por favor espera ..." + building: "Tu sitio se está publicando, por favor espera para recargar esta página..." not_published_yet: "Tu sitio se está publicando por primera vez, por favor espera hasta un minuto..." available: "¡Tu sitio está disponible! Cliquea aquí para visitarlo." index: From ec47335f04ccc4b0a7424fcbe92ad65d7ce6c129 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Apr 2023 12:44:09 -0300 Subject: [PATCH 143/475] fix: es necesario el arbol actual para ignorar cambios en paralelo cuando estamos guardando un post con archivos subidos y posts relacionados, al no usar el arbol actual se pisaban los archivos modificados y el repositorio quedaba en un estado inconsistente. --- app/models/site/repository.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index f63288d4..62e4c45e 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -117,6 +117,9 @@ class Site def commit(file:, usuarie:, message:, remove: false) file = [file] unless file.respond_to? :each + # Cargar el árbol actual + rugged.index.read_tree rugged.head.target.tree + file.each do |f| remove ? rm(f) : add(f) end From ad76fed1b19dac253f67b333be25b7cdd7ee01fa Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Apr 2023 13:31:32 -0300 Subject: [PATCH 144/475] fix: alert en modo oscuro --- app/assets/stylesheets/application.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 2f52829b..258698d3 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -52,6 +52,12 @@ $sizes: ( --background: #{$black}; --color: #{$cyan}; } + + .alert-primary { + @include alert-variant(theme-color-level($cyan, $alert-bg-level), + theme-color-level($cyan, $alert-border-level), + theme-color-level($cyan, $alert-color-level)); + } } // TODO: Encontrar la forma de generar esto desde los locales de Rails From bd21f3d9b4806b54b63b3ece2efa5a0d4acbbf5e Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Apr 2023 13:47:12 -0300 Subject: [PATCH 145/475] fixup! fix: alert en modo oscuro --- app/assets/stylesheets/application.scss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 258698d3..99b5a296 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -54,9 +54,9 @@ $sizes: ( } .alert-primary { - @include alert-variant(theme-color-level($cyan, $alert-bg-level), - theme-color-level($cyan, $alert-border-level), - theme-color-level($cyan, $alert-color-level)); + @include alert-variant(theme-color-level("cyan", $alert-bg-level), + theme-color-level("cyan", $alert-border-level), + theme-color-level("cyan", $alert-color-level)); } } From 191dbbd82344a8e7545c4c65e9d84838c435e27e Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Apr 2023 13:47:59 -0300 Subject: [PATCH 146/475] fix: indicar que hay un link --- app/views/sites/_status.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/sites/_status.haml b/app/views/sites/_status.haml index 52afa3ca..a731aa7d 100644 --- a/app/views/sites/_status.haml +++ b/app/views/sites/_status.haml @@ -16,4 +16,4 @@ - link = true = render 'bootstrap/alert' do - = link_to_if link, message.html_safe, site.url + = link_to_if link, message.html_safe, site.url, class: 'alert-link' From 3dacef76f1cafb9ecb64cb527737ba34452e9536 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Apr 2023 13:55:21 -0300 Subject: [PATCH 147/475] fix: esto no funciona --- app/assets/stylesheets/application.scss | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 99b5a296..2f52829b 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -52,12 +52,6 @@ $sizes: ( --background: #{$black}; --color: #{$cyan}; } - - .alert-primary { - @include alert-variant(theme-color-level("cyan", $alert-bg-level), - theme-color-level("cyan", $alert-border-level), - theme-color-level("cyan", $alert-color-level)); - } } // TODO: Encontrar la forma de generar esto desde los locales de Rails From b7a27a87dd2879622f89d4102f4a4346aa7c17ac Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Apr 2023 16:58:22 -0300 Subject: [PATCH 148/475] feat: cuando se modifica la licencia, considerarla personalizada --- app/models/licencia.rb | 4 ++++ app/services/post_service.rb | 12 ++++++++++++ app/views/sites/_form.haml | 1 + db/seeds/licencias.yml | 6 ++++++ 4 files changed, 23 insertions(+) diff --git a/app/models/licencia.rb b/app/models/licencia.rb index f0a542ef..351a8ae5 100644 --- a/app/models/licencia.rb +++ b/app/models/licencia.rb @@ -17,4 +17,8 @@ class Licencia < ApplicationRecord validates :description, presence: true validates :short_description, presence: true validates :deed, presence: true + + def custom? + url == 'custom' + end end diff --git a/app/services/post_service.rb b/app/services/post_service.rb index 81ebe4a1..f1b9f7c3 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -18,6 +18,8 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do commit(action: :created, file: update_related_posts) if post.update(post_params) + update_site_license! + # Devolver el post aunque no se haya salvado para poder rescatar los # errores post @@ -44,6 +46,8 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do # relacionados. commit(action: :updated, file: update_related_posts) if post.update(post_params) + update_site_license! + # Devolver el post aunque no se haya salvado para poder rescatar los # errores post @@ -137,4 +141,12 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do p.path.absolute if p.save(validate: false) end.compact << post.path.absolute end + + # Si les usuaries modifican o crean una licencia, considerarla + # personalizada en el panel. + def update_site_license! + if site.usuarie?(usuarie) && post.layout.name == :license + site.update licencia: Licencia.find_by_url('custom') + end + end end diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index 9a044c7f..10f158c8 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -79,6 +79,7 @@ %h2= t('.licencia.title') %p.lead= t('.help.licencia') - Licencia.all.find_each do |licencia| + - next if licencia.custom? && site.licencia != licencia .row.license .col .media.mt-1 diff --git a/db/seeds/licencias.yml b/db/seeds/licencias.yml index c5e2886a..402e5d8b 100644 --- a/db/seeds/licencias.yml +++ b/db/seeds/licencias.yml @@ -1,4 +1,10 @@ --- +- name_en: "Custom license" + name_es: "Licencia personalizada" + url_en: "custom" + url_es: "custom" + description_en: "The license terms are provided by you." + description_es: "Los términos de la licencia fueron provistos por vos." - name_en: 'Peer Production License' name_es: 'Licencia de Producción de Pares' short_description_en: "This work is licensed under a Peer Production License" From 94d30ac12aebac141992747613f888b573f5f43f Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Apr 2023 17:50:04 -0300 Subject: [PATCH 149/475] fixup! feat: cuando se modifica la licencia, considerarla personalizada --- app/models/licencia.rb | 2 +- app/services/post_service.rb | 4 ++-- app/services/site_service.rb | 2 ++ app/views/sites/_form.haml | 7 ++++--- db/seeds/licencias.yml | 9 +++++++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/models/licencia.rb b/app/models/licencia.rb index 351a8ae5..65009f46 100644 --- a/app/models/licencia.rb +++ b/app/models/licencia.rb @@ -19,6 +19,6 @@ class Licencia < ApplicationRecord validates :deed, presence: true def custom? - url == 'custom' + icons == 'custom' end end diff --git a/app/services/post_service.rb b/app/services/post_service.rb index f1b9f7c3..7b31867d 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -145,8 +145,8 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do # Si les usuaries modifican o crean una licencia, considerarla # personalizada en el panel. def update_site_license! - if site.usuarie?(usuarie) && post.layout.name == :license - site.update licencia: Licencia.find_by_url('custom') + if site.usuarie?(usuarie) && post.layout.name == :license && !site.licencia.custom? + site.update licencia: Licencia.find_by_icons('custom') end end end diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 70824422..5e1d5055 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -110,6 +110,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do # @return [Boolean] def add_licencias return true unless site.layout? :license + return true if site.licencia.custom? with_all_locales do |locale| add_licencia lang: locale @@ -140,6 +141,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do # @return [Boolean] def change_licencias return true unless site.layout? :license + return true if site.licencia.custom? with_all_locales do |locale| post = site.posts(lang: locale).find_by(layout: 'license') diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index 10f158c8..137a40b0 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -83,7 +83,8 @@ .row.license .col .media.mt-1 - = image_tag licencia.icons, alt: licencia.name, class: 'mr-3 mt-4' + - unless licencia.custom? + = image_tag licencia.icons, alt: licencia.name, class: 'mr-3 mt-4' .media-body .custom-control.custom-radio = f.radio_button :licencia_id, licencia.id, @@ -94,8 +95,8 @@ = sanitize_markdown licencia.description, tags: %w[p a strong em ul ol li h1 h2 h3 h4 h5 h6] - = link_to t('.licencia.url'), licencia.url, - target: '_blank', class: 'btn' + - unless licencia.custom? + = link_to t('.licencia.url'), licencia.url, target: '_blank', class: 'btn', rel: 'noopener' %hr/ diff --git a/db/seeds/licencias.yml b/db/seeds/licencias.yml index 402e5d8b..f6b76296 100644 --- a/db/seeds/licencias.yml +++ b/db/seeds/licencias.yml @@ -1,10 +1,15 @@ --- - name_en: "Custom license" name_es: "Licencia personalizada" - url_en: "custom" - url_es: "custom" + url_en: "" + url_es: "" + icons: "custom" + short_description_en: "" + short_description_es: "" description_en: "The license terms are provided by you." description_es: "Los términos de la licencia fueron provistos por vos." + deed_en: "" + deed_es: "" - name_en: 'Peer Production License' name_es: 'Licencia de Producción de Pares' short_description_en: "This work is licensed under a Peer Production License" From ea71aafe58c233234bcdf1c00df7fac5df2b1cea Mon Sep 17 00:00:00 2001 From: f Date: Tue, 4 Apr 2023 11:33:51 -0300 Subject: [PATCH 150/475] fix: enviar los correos de devise en el idioma de le usuarie #12952 --- app/models/usuarie.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/usuarie.rb b/app/models/usuarie.rb index c87d82f9..7b83ee75 100644 --- a/app/models/usuarie.rb +++ b/app/models/usuarie.rb @@ -41,6 +41,12 @@ class Usuarie < ApplicationRecord lock_access! if attempts_exceeded? && !access_locked? end + def send_devise_notification(notification, *args) + I18n.with_locale(lang) do + devise_mailer.send(notification, self, *args).deliver_later + end + end + private def lang_from_locale! From 38d6f6d842ebcb6715aa02427a8875e9c9fd2b3b Mon Sep 17 00:00:00 2001 From: f Date: Tue, 4 Apr 2023 13:21:38 -0300 Subject: [PATCH 151/475] =?UTF-8?q?fix:=20mantener=20la=20notificaci=C3=B3?= =?UTF-8?q?n=20hasta=20que=20se=20confirme=20el=20correo=20#12950?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e80c279d..0628421f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -9,6 +9,7 @@ class ApplicationController < ActionController::Base before_action :prepare_exception_notifier before_action :configure_permitted_parameters, if: :devise_controller? + before_action :notify_unconfirmed_email, unless: :devise_controller? around_action :set_locale rescue_from Pundit::NilPolicyError, with: :page_not_found @@ -27,6 +28,13 @@ class ApplicationController < ActionController::Base private + def notify_unconfirmed_email + return unless current_usuarie + return if current_usuarie.confirmed? + + flash[:notice] ||= I18n.t('devise.registrations.signed_up') + end + def uuid?(string) /[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12}/ =~ string end From 8d31170086d3fa51c946c244fff4814f72b9075f Mon Sep 17 00:00:00 2001 From: f Date: Tue, 4 Apr 2023 13:34:19 -0300 Subject: [PATCH 152/475] fix: usar el idioma de le usuarie --- app/controllers/application_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0628421f..b4be5a97 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -32,7 +32,9 @@ class ApplicationController < ActionController::Base return unless current_usuarie return if current_usuarie.confirmed? - flash[:notice] ||= I18n.t('devise.registrations.signed_up') + I18n.with_locale(current_usuarie.lang) do + flash[:notice] ||= I18n.t('devise.registrations.signed_up') + end end def uuid?(string) @@ -92,6 +94,7 @@ class ApplicationController < ActionController::Base protected def configure_permitted_parameters + devise_parameter_sanitizer.permit(:sign_up, keys: Usuarie::CONSENT_FIELDS) devise_parameter_sanitizer.permit(:account_update, keys: %i[lang]) end From 29be4b26b034ee7e2a78413e9c8dbd6278266fc8 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 5 Apr 2023 19:30:44 -0300 Subject: [PATCH 153/475] fix: no producir un error al no haber locales --- app/models/metadata_locales.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/metadata_locales.rb b/app/models/metadata_locales.rb index 3790b944..37b50286 100644 --- a/app/models/metadata_locales.rb +++ b/app/models/metadata_locales.rb @@ -44,6 +44,6 @@ class MetadataLocales < MetadataHasAndBelongsToMany def posts other_locales.map do |locale| site.posts(lang: locale).where(layout: post.layout.value) - end.reduce(&:concat) || PostRelation.new + end.reduce(&:concat) || PostRelation.new(site: site, lang: 'any') end end From 6bc013c8593bdb9d184fadcd6f091ab1e2d4d8eb Mon Sep 17 00:00:00 2001 From: f Date: Wed, 5 Apr 2023 19:30:59 -0300 Subject: [PATCH 154/475] fix: no mostrar el campo si no hay locales --- app/views/posts/attribute_ro/_locales.haml | 19 +++++++------- app/views/posts/attributes/_locales.haml | 29 +++++++++++----------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/app/views/posts/attribute_ro/_locales.haml b/app/views/posts/attribute_ro/_locales.haml index 3ac22933..16ecb532 100644 --- a/app/views/posts/attribute_ro/_locales.haml +++ b/app/views/posts/attribute_ro/_locales.haml @@ -1,9 +1,10 @@ -%tr{ id: attribute } - %th= post_label_t(attribute, post: post) - %td - %ul - - metadata.value.each do |uuid| - - p = site.docs.find(uuid, uuid: true) - %li{ dir: t("locales.#{p.lang.value}.dir"), lang: p.lang.value } - = link_to p.title.value, - site_post_path(site, p.id, locale: p.lang.value) +- if site.locales.count > 1 + %tr{ id: attribute } + %th= post_label_t(attribute, post: post) + %td + %ul + - metadata.value.each do |uuid| + - p = site.docs.find(uuid, uuid: true) + %li{ dir: t("locales.#{p.lang.value}.dir"), lang: p.lang.value } + = link_to p.title.value, + site_post_path(site, p.id, locale: p.lang.value) diff --git a/app/views/posts/attributes/_locales.haml b/app/views/posts/attributes/_locales.haml index 23f66700..4978f6b4 100644 --- a/app/views/posts/attributes/_locales.haml +++ b/app/views/posts/attributes/_locales.haml @@ -1,18 +1,19 @@ -%fieldset - %legend= post_label_t(attribute, post: post) +- if site.locales.count > 1 + %fieldset + %legend= post_label_t(attribute, post: post) - = render 'posts/attribute_feedback', - post: post, attribute: attribute, metadata: metadata + = render 'posts/attribute_feedback', + post: post, attribute: attribute, metadata: metadata - - site.locales.each do |locale| - - next if post.lang.value == locale - - locale_t = t("locales.#{locale}.name", default: locale.to_s.humanize) - - value = metadata.value.find do |v| - - metadata.values[locale].values.include? v + - site.locales.each do |locale| + - next if post.lang.value == locale + - locale_t = t("locales.#{locale}.name", default: locale.to_s.humanize) + - value = metadata.value.find do |v| + - metadata.values[locale].values.include? v - .form-group - = label_tag "#{base}_#{attribute}_#{locale}", locale_t + .form-group + = label_tag "#{base}_#{attribute}_#{locale}", locale_t - = select_tag("#{plain_field_name_for(base, attribute)}[]", - options_for_select(metadata.values[locale], value), - **field_options(attribute, metadata), include_blank: t('.empty')) + = select_tag("#{plain_field_name_for(base, attribute)}[]", + options_for_select(metadata.values[locale], value), + **field_options(attribute, metadata), include_blank: t('.empty')) From dd3ef04fc4b759d818ac9ef16db88e59761889ab Mon Sep 17 00:00:00 2001 From: f Date: Thu, 6 Apr 2023 11:19:33 -0300 Subject: [PATCH 155/475] =?UTF-8?q?feat:=20generar=20im=C3=A1genes=20p?= =?UTF-8?q?=C3=BAblicas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .woodpecker.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 1d760b52..2e775624 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,10 +1,10 @@ pipeline: publish: - image: "plugins/docker" + image: "docker.io/woodpeckerci/plugin-docker-buildx" settings: - registry: "registry.nulo.in" + registry: "gitea.nulo.in" username: "sutty" - repo: "registry.nulo.in/sutty/panel" + repo: "gitea.nulo.in/sutty/panel" tags: - "${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}" - "latest" @@ -12,10 +12,10 @@ pipeline: - "RUBY_VERSION=${RUBY_VERSION}" - "RUBY_PATCH=${RUBY_PATCH}" - "ALPINE_VERSION=${ALPINE_VERSION}" - - "BASE_IMAGE=registry.nulo.in/sutty/rails" + - "BASE_IMAGE=gitea.nulo.in/sutty/rails" purge: false secrets: - - "docker_password" + - "DOCKER_PASSWORD" when: branch: - "rails" @@ -26,7 +26,7 @@ pipeline: - "Dockerfile" - ".dockerignore" assets: - image: "registry.nulo.in/sutty/panel:${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}" + image: "gitea.nulo.in/sutty/panel:${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}" commands: - "apk add python2 dotenv openssh-client brotli" - "install -d -m 700 ~/.ssh/" @@ -66,6 +66,6 @@ pipeline: - "yarn.lock" matrix: include: - - ALPINE_VERSION: "3.14.8" + - ALPINE_VERSION: "3.14.10" RUBY_VERSION: "2.7" - RUBY_PATCH: "6" + RUBY_PATCH: "8" From 34d26a0174b0644d96e430b3bf894c734d366dce Mon Sep 17 00:00:00 2001 From: f Date: Thu, 6 Apr 2023 11:27:28 -0300 Subject: [PATCH 156/475] fix: instalar pnpm 7 porque 8 es incompatible con node 14 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a6420a35..3da9ffab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN apk add --no-cache libxslt libxml2 postgresql-libs libssh2 \ RUN gem install --no-document --no-user-install foreman RUN wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz -O - | tar --strip-components 1 -xvzf - pandoc-${PANDOC_VERSION}/bin/pandoc && mv /bin/pandoc /usr/bin/pandoc -RUN apk add npm && npm install -g pnpm && apk del npm +RUN apk add npm && npm install -g pnpm@~7 && apk del npm COPY ./monit.conf /etc/monit.d/sutty.conf From 54aa022b8c9dd844aacf2481606ccfe996e6982d Mon Sep 17 00:00:00 2001 From: f Date: Thu, 6 Apr 2023 11:27:28 -0300 Subject: [PATCH 157/475] fix: instalar pnpm 7 porque 8 es incompatible con node 14 --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 342c2750..3da9ffab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ RUN apk add --no-cache libxslt libxml2 postgresql-libs libssh2 \ RUN gem install --no-document --no-user-install foreman RUN wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz -O - | tar --strip-components 1 -xvzf - pandoc-${PANDOC_VERSION}/bin/pandoc && mv /bin/pandoc /usr/bin/pandoc +RUN apk add npm && npm install -g pnpm@~7 && apk del npm COPY ./monit.conf /etc/monit.d/sutty.conf From c45441430f45dad5061a49e38b4f51aa7f5e3d97 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 6 Apr 2023 15:09:14 -0300 Subject: [PATCH 158/475] =?UTF-8?q?fix:=20indicar=20qu=C3=A9=20acci=C3=B3n?= =?UTF-8?q?=20vamos=20a=20hacer=20#12970?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_breadcrumb.haml | 2 +- config/locales/en.yml | 6 ++++-- config/locales/es.yml | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/_breadcrumb.haml b/app/views/layouts/_breadcrumb.haml index 099ddde4..2a72ab11 100644 --- a/app/views/layouts/_breadcrumb.haml +++ b/app/views/layouts/_breadcrumb.haml @@ -25,4 +25,4 @@ - else - I18n.available_locales.each do |locale| - next if locale == I18n.locale - = link_to t(locale), "?change_locale_to=#{locale}" + = link_to t("switch_locale.#{locale}"), "?change_locale_to=#{locale}" diff --git a/config/locales/en.yml b/config/locales/en.yml index 567ab6bb..7798294c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,8 +1,10 @@ en: dir: ltr en: English - es: Castellano - es-AR: Castellano rioplatense + es: Castellano + es-AR: Castellano rioplatense + switch_locale: + es: "Cambiar a castellano" locales: es: name: Castillian Spanish diff --git a/config/locales/es.yml b/config/locales/es.yml index 0a829e4a..a7f06ba8 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -3,6 +3,8 @@ es: en: English es-AR: Castellano Rioplatense dir: ltr + switch_locale: + en: "Switch to English" locales: es: name: Castellano From 6cab61891c9c1fd0fb7c3a260febc816d40178ea Mon Sep 17 00:00:00 2001 From: f Date: Thu, 6 Apr 2023 20:30:47 -0300 Subject: [PATCH 159/475] fix: la tarea estaba mal nombrada --- Procfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Procfile b/Procfile index 950168dd..25a1639d 100644 --- a/Procfile +++ b/Procfile @@ -5,6 +5,6 @@ blazer_1h: bundle exec rake blazer:run_checks SCHEDULE="1 hour" blazer_1d: bundle exec rake blazer:run_checks SCHEDULE="1 day" blazer: bundle exec rake blazer:send_failing_checks prometheus: bundle exec prometheus_exporter -b 0.0.0.0 --prefix "sutty_" -distributed_press_renew_tokens: bundle exec rake distributed_press:tokens:renew +distributed_press_tokens_renew: bundle exec rake distributed_press:tokens:renew cleanup: bundle exec rake cleanup:everything stats: bundle exec rake stats:process_all From 4f8ea0d9a726b860edce4227939e7005c6b1107e Mon Sep 17 00:00:00 2001 From: f Date: Fri, 17 Mar 2023 18:38:47 -0300 Subject: [PATCH 160/475] feat: los deploys son interdependientes --- app/models/deploy.rb | 7 +++---- app/models/deploy_alternative_domain.rb | 2 ++ app/models/deploy_rsync.rb | 8 ++++++++ app/models/deploy_www.rb | 2 ++ app/models/deploy_zip.rb | 2 ++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 9d5c1d27..942336ad 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require 'open3' + # Este modelo implementa los distintos tipos de alojamiento que provee # Sutty. # @@ -11,11 +12,9 @@ class Deploy < ApplicationRecord belongs_to :site has_many :build_stats, dependent: :destroy - def deploy(**) - raise NotImplementedError - end + DEPENDENCIES = [] - def url + def deploy(**) raise NotImplementedError end diff --git a/app/models/deploy_alternative_domain.rb b/app/models/deploy_alternative_domain.rb index 5ad381d5..114f2aa5 100644 --- a/app/models/deploy_alternative_domain.rb +++ b/app/models/deploy_alternative_domain.rb @@ -4,6 +4,8 @@ class DeployAlternativeDomain < Deploy store :values, accessors: %i[hostname], coder: JSON + DEPENDENCIES = %i[local] + # Generar un link simbólico del sitio principal al alternativo def deploy(**) File.symlink?(destination) || diff --git a/app/models/deploy_rsync.rb b/app/models/deploy_rsync.rb index a658de6b..9ced0bb1 100644 --- a/app/models/deploy_rsync.rb +++ b/app/models/deploy_rsync.rb @@ -5,6 +5,14 @@ class DeployRsync < Deploy store :values, accessors: %i[destination host_keys], coder: JSON + DEPENDENCIES = %i[ + alternative_domain + hidden_service + local + www + zip + ] + def deploy(output: false) ssh? && rsync(output: output) end diff --git a/app/models/deploy_www.rb b/app/models/deploy_www.rb index dff769a6..e6cfe407 100644 --- a/app/models/deploy_www.rb +++ b/app/models/deploy_www.rb @@ -4,6 +4,8 @@ class DeployWww < Deploy store :values, accessors: %i[], coder: JSON + DEPENDENCIES = %i[local] + before_destroy :remove_destination! def deploy(**) diff --git a/app/models/deploy_zip.rb b/app/models/deploy_zip.rb index f1c94083..2f9ac173 100644 --- a/app/models/deploy_zip.rb +++ b/app/models/deploy_zip.rb @@ -8,6 +8,8 @@ require 'zip' class DeployZip < Deploy store :values, accessors: %i[], coder: JSON + DEPENDENCIES = %i[local] + # Una vez que el sitio está generado, tomar todos los archivos y # y generar un zip accesible públicamente. # From db25750ab0580f92d93e5194e4ba7d14ca883ddf Mon Sep 17 00:00:00 2001 From: f Date: Fri, 17 Mar 2023 18:54:38 -0300 Subject: [PATCH 161/475] feat: usar un grafo dirigido para ordenar las dependencias #10464 --- Gemfile | 1 + Gemfile.lock | 7 ++++++ app/models/site/deploy_dependencies.rb | 30 ++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 app/models/site/deploy_dependencies.rb diff --git a/Gemfile b/Gemfile index f3799638..489097a6 100644 --- a/Gemfile +++ b/Gemfile @@ -23,6 +23,7 @@ if ENV['RAILS_GROUPS']&.split(',')&.include? 'assets' end gem 'nokogiri' +gem 'rgl' # Turbolinks makes navigating your web application faster. Read more: # https://github.com/turbolinks/turbolinks diff --git a/Gemfile.lock b/Gemfile.lock index abaf45c9..5df84963 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -353,6 +353,7 @@ GEM mini_portile2 (~> 2.6.1) racc (~> 1.4) orm_adapter (0.5.0) + pairing_heap (3.0.0) parallel (1.21.0) parser (3.0.2.0) ast (~> 2.4.1) @@ -443,6 +444,10 @@ GEM actionpack (>= 5.0) railties (>= 5.0) rexml (3.2.5) + rgl (0.6.2) + pairing_heap (>= 0.3.0) + rexml (~> 3.2, >= 3.2.4) + stream (~> 0.5.3) rouge (3.26.1) rubocop (1.23.0) parallel (~> 1.10) @@ -510,6 +515,7 @@ GEM sprockets (>= 3.0.0) sqlite3 (1.4.2-x86_64-linux-musl) stackprof (0.2.17-x86_64-linux-musl) + stream (0.5.5) sucker_punch (3.0.1) concurrent-ruby (~> 1.0) sutty-archives (2.5.4) @@ -626,6 +632,7 @@ DEPENDENCIES rails_warden redis redis-rails + rgl rollups! rubocop-rails rubyzip diff --git a/app/models/site/deploy_dependencies.rb b/app/models/site/deploy_dependencies.rb new file mode 100644 index 00000000..33ed9e37 --- /dev/null +++ b/app/models/site/deploy_dependencies.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require 'rgl/adjacency' + +class Site + module DeployDependencies + extend ActiveSupport::Concern + + included do + # Genera un grafo dirigido de todos los métodos de publicación + # + # @return [RGL::DirectedAdjacencyGraph] + def deployment_graph + @deployment_graph ||= RGL::DirectedAdjacencyGraph.new.tap do |graph| + deploys.each do |deploy| + graph.add_vertex deploy + end + + deploys.each do |deploy| + deploy.class::DEPENDENCIES.each do |dependency| + deploys.where(type: "Deploy#{dependency.to_s.classify}").each do |deploy_dependency| + graph.add_edge deploy_dependency, deploy + end + end + end + end + end + end + end +end From 0ed01a61f7e85c8ac2580ccf4bb526edb905262c Mon Sep 17 00:00:00 2001 From: f Date: Fri, 17 Mar 2023 21:37:58 -0300 Subject: [PATCH 162/475] feat: devolver una lista ordenada de metodos de publicacion --- app/models/site/deploy_dependencies.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/models/site/deploy_dependencies.rb b/app/models/site/deploy_dependencies.rb index 33ed9e37..05939320 100644 --- a/app/models/site/deploy_dependencies.rb +++ b/app/models/site/deploy_dependencies.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require 'rgl/adjacency' +require 'rgl/topsort' class Site module DeployDependencies @@ -25,6 +26,13 @@ class Site end end end + + # Devuelve una lista ordenada de todos los métodos de publicación + # + # @return [Array] + def deployment_list + @deployment_list ||= deployment_graph.topsort_iterator.to_a + end end end end From 607f19f6805512383358b80eea64197d5a20aafe Mon Sep 17 00:00:00 2001 From: f Date: Fri, 17 Mar 2023 21:38:31 -0300 Subject: [PATCH 163/475] feat: activar ordenamiento de metodos de publicacion --- app/models/site.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/site.rb b/app/models/site.rb index 4b2a8eb9..f88e2e97 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -7,6 +7,7 @@ class Site < ApplicationRecord include Site::Forms include Site::FindAndReplace include Site::Api + include Site::DeployDependencies include Tienda # Cifrar la llave privada que cifra y decifra campos ocultos. Sutty From e5f96c435d8efec81f1a3cee4f5f657c3a32d7d3 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 13:42:47 -0300 Subject: [PATCH 164/475] feat: generar el sitio en orden #10464 --- app/jobs/deploy_job.rb | 86 +++++++++++-------------- app/models/deploy_alternative_domain.rb | 2 +- app/models/deploy_rsync.rb | 10 +-- app/models/deploy_www.rb | 2 +- app/models/deploy_zip.rb | 2 +- app/models/site/deploy_dependencies.rb | 2 +- 6 files changed, 48 insertions(+), 56 deletions(-) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index e018533c..f7d07349 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -30,28 +30,30 @@ class DeployJob < ApplicationJob return end + @deployed = {} @site.update status: 'building' - # Asegurarse que DeployLocal sea el primero! - @deployed = { - deploy_local: { - status: deploy_locally, - seconds: deploy_local.build_stats.last.seconds, - size: deploy_local.size, - urls: [deploy_local.url] + @site.deployment_list.each do |d| + begin + raise DeployException, 'Una dependencia falló' if failed_dependencies? d + + status = d.deploy + seconds = d.build_stats.last.try(:seconds) + rescue StandardError => e + status = false + seconds = 0 + + notify_exception e, d + end + + @deployed[d.type.underscore.to_sym] = { + status: status, + seconds: seconds || 0, + size: d.size, + urls: d.respond_to?(:urls) ? d.urls : [d.url].compact } - } - - # No es opcional - unless @deployed[:deploy_local][:status] - # Hacer fallar la tarea - raise DeployException, "#{@site.name}: Falló la compilación" end - - deploy_others rescue DeployTimedOutException => e notify_exception e - rescue DeployException => e - notify_exception e, deploy_local ensure @site&.update status: 'waiting' @@ -62,47 +64,37 @@ class DeployJob < ApplicationJob private + # Detecta si un método de publicación tiene dependencias fallidas + # + # @param :deploy [Deploy] + # @return [Boolean] + def failed_dependencies?(deploy) + failed_dependencies(deploy).present? + end + + # Obtiene las dependencias fallidas de un deploy + # + # @param :deploy [Deploy] + # @return [Array] + def failed_dependencies(deploy) + deploy.class::DEPENDENCIES & (@deployed.reject do |_, v| + v[:status] + end.keys) + end + # @param :exception [StandardError] # @param :deploy [Deploy] def notify_exception(exception, deploy = nil) data = { site: @site.id, deploy: deploy&.type, - log: deploy&.build_stats&.last&.log + log: deploy&.build_stats&.last&.log, + failed_dependencies: (failed_dependencies(deploy) if deploy) } ExceptionNotifier.notify_exception(exception, data: data) end - def deploy_local - @deploy_local ||= @site.deploys.find_by(type: 'DeployLocal') - end - - def deploy_locally - deploy_local.deploy(output: @output) - end - - def deploy_others - @site.deploys.where.not(type: 'DeployLocal').find_each do |d| - begin - status = d.deploy(output: @output) - seconds = d.build_stats.last.try(:seconds) - rescue StandardError => e - status = false - seconds = 0 - - notify_exception e, d - end - - @deployed[d.type.underscore.to_sym] = { - status: status, - seconds: seconds || 0, - size: d.size, - urls: d.respond_to?(:urls) ? d.urls : [d.url].compact - } - end - end - def notify_usuaries @site.roles.where(rol: 'usuarie', temporal: false).pluck(:usuarie_id).each do |usuarie| DeployMailer.with(usuarie: usuarie, site: @site.id) diff --git a/app/models/deploy_alternative_domain.rb b/app/models/deploy_alternative_domain.rb index 114f2aa5..9b1d63d7 100644 --- a/app/models/deploy_alternative_domain.rb +++ b/app/models/deploy_alternative_domain.rb @@ -4,7 +4,7 @@ class DeployAlternativeDomain < Deploy store :values, accessors: %i[hostname], coder: JSON - DEPENDENCIES = %i[local] + DEPENDENCIES = %i[deploy_local] # Generar un link simbólico del sitio principal al alternativo def deploy(**) diff --git a/app/models/deploy_rsync.rb b/app/models/deploy_rsync.rb index 9ced0bb1..dd7a492b 100644 --- a/app/models/deploy_rsync.rb +++ b/app/models/deploy_rsync.rb @@ -6,11 +6,11 @@ class DeployRsync < Deploy store :values, accessors: %i[destination host_keys], coder: JSON DEPENDENCIES = %i[ - alternative_domain - hidden_service - local - www - zip + deploy_alternative_domain + deploy_hidden_service + deploy_local + deploy_www + deploy_zip ] def deploy(output: false) diff --git a/app/models/deploy_www.rb b/app/models/deploy_www.rb index e6cfe407..d27f77cc 100644 --- a/app/models/deploy_www.rb +++ b/app/models/deploy_www.rb @@ -4,7 +4,7 @@ class DeployWww < Deploy store :values, accessors: %i[], coder: JSON - DEPENDENCIES = %i[local] + DEPENDENCIES = %i[deploy_local] before_destroy :remove_destination! diff --git a/app/models/deploy_zip.rb b/app/models/deploy_zip.rb index 2f9ac173..bba13686 100644 --- a/app/models/deploy_zip.rb +++ b/app/models/deploy_zip.rb @@ -8,7 +8,7 @@ require 'zip' class DeployZip < Deploy store :values, accessors: %i[], coder: JSON - DEPENDENCIES = %i[local] + DEPENDENCIES = %i[deploy_local] # Una vez que el sitio está generado, tomar todos los archivos y # y generar un zip accesible públicamente. diff --git a/app/models/site/deploy_dependencies.rb b/app/models/site/deploy_dependencies.rb index 05939320..a01f99e7 100644 --- a/app/models/site/deploy_dependencies.rb +++ b/app/models/site/deploy_dependencies.rb @@ -19,7 +19,7 @@ class Site deploys.each do |deploy| deploy.class::DEPENDENCIES.each do |dependency| - deploys.where(type: "Deploy#{dependency.to_s.classify}").each do |deploy_dependency| + deploys.where(type: dependency.to_s.classify).each do |deploy_dependency| graph.add_edge deploy_dependency, deploy end end From 3de6f14e63a7922e6670b45a87d4e079830e7244 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 13:47:34 -0300 Subject: [PATCH 165/475] =?UTF-8?q?fix:=20no=20pedir=20el=20tama=C3=B1o=20?= =?UTF-8?q?si=20fall=C3=B3=20la=20compilaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/deploy_job.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index f7d07349..fe344454 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -38,9 +38,11 @@ class DeployJob < ApplicationJob status = d.deploy seconds = d.build_stats.last.try(:seconds) + size = d.size rescue StandardError => e status = false seconds = 0 + size = 0 notify_exception e, d end @@ -48,7 +50,7 @@ class DeployJob < ApplicationJob @deployed[d.type.underscore.to_sym] = { status: status, seconds: seconds || 0, - size: d.size, + size: size, urls: d.respond_to?(:urls) ? d.urls : [d.url].compact } end From ea1ac09f9698be5cc615a4471a3d77b1bdbe9ca2 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 13:54:19 -0300 Subject: [PATCH 166/475] =?UTF-8?q?fix:=20mejorar=20gesti=C3=B3n=20de=20zi?= =?UTF-8?q?p?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_zip.rb | 53 +++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/app/models/deploy_zip.rb b/app/models/deploy_zip.rb index bba13686..5f72a728 100644 --- a/app/models/deploy_zip.rb +++ b/app/models/deploy_zip.rb @@ -14,24 +14,43 @@ class DeployZip < Deploy # y generar un zip accesible públicamente. # # rubocop:disable Metrics/MethodLength - def deploy(**) + def deploy(output: false) FileUtils.rm_f path - time_start - Dir.chdir(destination) do - Zip::File.open(path, Zip::File::CREATE) do |z| - Dir.glob('./**/**').each do |f| - File.directory?(f) ? z.mkdir(f) : z.add(f, f) + Zip::File.open(path, Zip::File::CREATE) do |zip| + Dir.glob(File.join(destination, '**', '**')).each do |file| + entry = Pathname.new(file).relative_path_from(destination).to_s + + if File.directory? file + log "Creando directorio #{entry}", output + + zip.mkdir(entry) + else + log "Comprimiendo #{entry}", output + zip.add(entry, file) end end end + time_stop - build_stats.create action: 'zip', - seconds: time_spent_in_seconds, - bytes: size + File.exist?(path).tap do |status| + build_stats.create action: 'zip', + seconds: time_spent_in_seconds, + bytes: size, + log: @log.join("\n"), + status: status + end + rescue Zip::Error => e + ExceptionNotifier.notify_exception(e, data: { site: site.name }) - File.exist? path + build_stats.create action: 'zip', + seconds: 0, + bytes: 0, + log: @log.join("\n"), + status: false + + false end # rubocop:enable Metrics/MethodLength @@ -43,8 +62,9 @@ class DeployZip < Deploy File.size path end + # @return [String] def destination - File.join(Rails.root, '_deploy', site.hostname) + Rails.root.join('_deploy', site.hostname).realpath.to_s end def file @@ -58,4 +78,15 @@ class DeployZip < Deploy def path File.join(destination, file) end + + private + + # @param :line [String] + # @param :output [Boolean] + def log(line, output) + @log ||= [] + @log << line + + puts line if output + end end From 199199117da9c70b666d851ebff29ea59f5c7ec0 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 16 Mar 2022 18:19:04 -0300 Subject: [PATCH 167/475] implementar la misma api en todos los deploys --- app/models/deploy.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 942336ad..7aedbb19 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -18,6 +18,10 @@ class Deploy < ApplicationRecord raise NotImplementedError end + def url + raise NotImplementedError + end + def limit raise NotImplementedError end From 875f1873d374d14b8fafbc5fb452afbf6ede9b3b Mon Sep 17 00:00:00 2001 From: f Date: Mon, 18 Apr 2022 17:27:43 -0300 Subject: [PATCH 168/475] no fallar al cerrarse la salida --- app/models/deploy.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 7aedbb19..922c7560 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -74,8 +74,7 @@ class Deploy < ApplicationRecord puts line if output end rescue IOError => e - lines << e.message - puts e.message if output + ExceptionNotifier.notify(e, data: { site: site.name }) end r = t.value From e8746ca385805b288f291866145ad8c005d7f4f0 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Jun 2022 15:07:08 -0300 Subject: [PATCH 169/475] =?UTF-8?q?notificar=20correctamente=20la=20excepc?= =?UTF-8?q?i=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 922c7560..e02602f8 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -74,7 +74,7 @@ class Deploy < ApplicationRecord puts line if output end rescue IOError => e - ExceptionNotifier.notify(e, data: { site: site.name }) + ExceptionNotifier.notify_exception(e, data: { site: site.name }) end r = t.value From 92b97b508b9414384adc2df6e697e7d537ef8d18 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 29 Jun 2022 18:41:51 -0300 Subject: [PATCH 170/475] no generar issues para log --- app/models/deploy.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/deploy.rb b/app/models/deploy.rb index e02602f8..7aedbb19 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -74,7 +74,8 @@ class Deploy < ApplicationRecord puts line if output end rescue IOError => e - ExceptionNotifier.notify_exception(e, data: { site: site.name }) + lines << e.message + puts e.message if output end r = t.value From 4ebd9881f558bf443ae58cb566952b0bd91f792e Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 14:31:39 -0300 Subject: [PATCH 171/475] =?UTF-8?q?fix:=20mejorar=20gesti=C3=B3n=20de=20sy?= =?UTF-8?q?mlink?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_www.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/deploy_www.rb b/app/models/deploy_www.rb index d27f77cc..bb25cc64 100644 --- a/app/models/deploy_www.rb +++ b/app/models/deploy_www.rb @@ -8,7 +8,9 @@ class DeployWww < Deploy before_destroy :remove_destination! - def deploy(**) + def deploy(output: false) + puts "Creando symlink #{site.hostname} => #{destination}" if output + File.symlink?(destination) || File.symlink(site.hostname, destination).zero? end @@ -30,7 +32,7 @@ class DeployWww < Deploy end def url - "https://www.#{site.hostname}/" + "https://#{fqdn}/" end private From 1e188bab0297ea1a21004239a59e7d118807ec69 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 14:37:52 -0300 Subject: [PATCH 172/475] =?UTF-8?q?fix:=20rsync=20no=20deber=C3=ADa=20depe?= =?UTF-8?q?nder=20de=20zip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit aunque el zip no se genere igual queremos poder sincronizar el sitio --- app/models/deploy_rsync.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/models/deploy_rsync.rb b/app/models/deploy_rsync.rb index dd7a492b..04c33cb8 100644 --- a/app/models/deploy_rsync.rb +++ b/app/models/deploy_rsync.rb @@ -10,7 +10,6 @@ class DeployRsync < Deploy deploy_hidden_service deploy_local deploy_www - deploy_zip ] def deploy(output: false) From 431b7223b6b4c428a6edde72d74f5ab8d030abd7 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 14:38:45 -0300 Subject: [PATCH 173/475] feat: eliminar archivos al sincronizar --- app/models/deploy_rsync.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/deploy_rsync.rb b/app/models/deploy_rsync.rb index 04c33cb8..8702449a 100644 --- a/app/models/deploy_rsync.rb +++ b/app/models/deploy_rsync.rb @@ -91,7 +91,7 @@ class DeployRsync < Deploy # # @return [Boolean] def rsync(output: output) - run %(rsync -aviH --timeout=5 #{Shellwords.escape source}/ #{Shellwords.escape destination}/), output: output + run %(rsync -aviH --delete-after --timeout=5 #{Shellwords.escape source}/ #{Shellwords.escape destination}/) end # El origen es el destino de la compilación From f90ca9cd12d1e6019272393864c5ccbc7e203229 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 14:45:35 -0300 Subject: [PATCH 174/475] fix: output para rsync --- app/models/deploy_rsync.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/deploy_rsync.rb b/app/models/deploy_rsync.rb index 8702449a..51d7b2d2 100644 --- a/app/models/deploy_rsync.rb +++ b/app/models/deploy_rsync.rb @@ -91,7 +91,7 @@ class DeployRsync < Deploy # # @return [Boolean] def rsync(output: output) - run %(rsync -aviH --delete-after --timeout=5 #{Shellwords.escape source}/ #{Shellwords.escape destination}/) + run %(rsync -aviH --delete-after --timeout=5 #{Shellwords.escape source}/ #{Shellwords.escape destination}/), output: output end # El origen es el destino de la compilación From c6f48f55fcaa602c960c602b70d503bf6e7969d1 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 14:59:34 -0300 Subject: [PATCH 175/475] feat: mostrar una tabla con el resumen en la consola --- app/jobs/deploy_job.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index fe344454..e7ce7ed0 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -54,6 +54,16 @@ class DeployJob < ApplicationJob urls: d.respond_to?(:urls) ? d.urls : [d.url].compact } end + + return unless @output + + puts (Terminal::Table.new do |t| + t << (%w[type] + @deployed.values.first.keys) + t.add_separator + @deployed.each do |type, row| + t << ([type.to_s] + row.values) + end + end) rescue DeployTimedOutException => e notify_exception e ensure From 58dffd00c9111ef2686264ae8f1d867a6fb46456 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 15:10:32 -0300 Subject: [PATCH 176/475] =?UTF-8?q?fix:=20fallar=20el=20hidden=20service?= =?UTF-8?q?=20si=20no=20se=20gener=C3=B3=20el=20onion=20aun?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_hidden_service.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/models/deploy_hidden_service.rb b/app/models/deploy_hidden_service.rb index dc9549f5..79ff1bae 100644 --- a/app/models/deploy_hidden_service.rb +++ b/app/models/deploy_hidden_service.rb @@ -2,14 +2,10 @@ # Genera una versión onion class DeployHiddenService < DeployWww - def deploy(**) - return true if fqdn.blank? - - super - end - def fqdn - values[:onion] + values[:onion].tap do |onion| + raise ArgumentError, 'Aun no se generó la dirección .onion' if onion.blank? + end end def url From d4f4627dab695c73d58c63deb19def3cff5c2d5c Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 15:22:10 -0300 Subject: [PATCH 177/475] fix: capturar todas las posibles excepciones --- app/jobs/deploy_job.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index e7ce7ed0..67548e07 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -39,19 +39,21 @@ class DeployJob < ApplicationJob status = d.deploy seconds = d.build_stats.last.try(:seconds) size = d.size + urls = d.respond_to?(:urls) ? d.urls : [d.url].compact rescue StandardError => e status = false - seconds = 0 - size = 0 + seconds ||= 0 + size ||= 0 + urls ||= [] notify_exception e, d end @deployed[d.type.underscore.to_sym] = { status: status, - seconds: seconds || 0, + seconds: seconds, size: size, - urls: d.respond_to?(:urls) ? d.urls : [d.url].compact + urls: urls } end From 5974a40d027e1f7c6de11585591f7190918efa56 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 15:23:13 -0300 Subject: [PATCH 178/475] feat: hacer sonar una campana --- app/jobs/deploy_job.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index 67548e07..3c9b2740 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -66,6 +66,8 @@ class DeployJob < ApplicationJob t << ([type.to_s] + row.values) end end) + + puts "\a" rescue DeployTimedOutException => e notify_exception e ensure From ba91ed56aa89546f494c14cd9dec8bcb1fe59ae9 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 15:50:05 -0300 Subject: [PATCH 179/475] feat: separar rsync de full rsync los segundos se usan para sincronizar todas las versiones de un sitio con otro servidor de sutty. los primeros solo sincronizan los archivos a otro servidor, no necesariamente bajo el mismo nombre. --- app/models/deploy_alternative_domain.rb | 6 ++- app/models/deploy_full_rsync.rb | 22 +++++++++++ app/models/deploy_rsync.rb | 9 +---- app/services/site_service.rb | 2 +- ...ename_deploy_rsync_to_deploy_full_rsync.rb | 37 +++++++++++++++++++ 5 files changed, 67 insertions(+), 9 deletions(-) create mode 100644 app/models/deploy_full_rsync.rb create mode 100644 db/migrate/20230318183722_rename_deploy_rsync_to_deploy_full_rsync.rb diff --git a/app/models/deploy_alternative_domain.rb b/app/models/deploy_alternative_domain.rb index 9b1d63d7..75b69180 100644 --- a/app/models/deploy_alternative_domain.rb +++ b/app/models/deploy_alternative_domain.rb @@ -20,7 +20,11 @@ class DeployAlternativeDomain < Deploy end def destination - @destination ||= File.join(Rails.root, '_deploy', hostname.gsub(/\.\z/, '')) + @destination ||= File.join(Rails.root, '_deploy', fqdn) + end + + def fqdn + hostname.gsub(/\.\z/, '') end def url diff --git a/app/models/deploy_full_rsync.rb b/app/models/deploy_full_rsync.rb new file mode 100644 index 00000000..c0ff84c6 --- /dev/null +++ b/app/models/deploy_full_rsync.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class DeployFullRsync < DeployRsync + DEPENDENCIES = %i[ + deploy_alternative_domain + deploy_hidden_service + deploy_local + deploy_www + ] + + # Sincroniza las ubicaciones alternativas también + # + # @param :output [Boolean] + # @return [Boolean] + def rsync(output: false) + DEPENDENCIES.map(&:to_s).map(&:classify).map do |dependency| + site.deploys.where(type: dependency).find_each.map do |deploy| + run %(rsync -aviH --delete-after --timeout=5 #{Shellwords.escape deploy.destination} #{Shellwords.escape destination}), output: output + end + end.flatten.all? + end +end diff --git a/app/models/deploy_rsync.rb b/app/models/deploy_rsync.rb index 51d7b2d2..6a96a274 100644 --- a/app/models/deploy_rsync.rb +++ b/app/models/deploy_rsync.rb @@ -5,12 +5,7 @@ class DeployRsync < Deploy store :values, accessors: %i[destination host_keys], coder: JSON - DEPENDENCIES = %i[ - deploy_alternative_domain - deploy_hidden_service - deploy_local - deploy_www - ] + DEPENDENCIES = %i[deploy_local] def deploy(output: false) ssh? && rsync(output: output) @@ -90,7 +85,7 @@ class DeployRsync < Deploy # Sincroniza hacia el directorio remoto # # @return [Boolean] - def rsync(output: output) + def rsync(output: false) run %(rsync -aviH --delete-after --timeout=5 #{Shellwords.escape source}/ #{Shellwords.escape destination}/), output: output end diff --git a/app/services/site_service.rb b/app/services/site_service.rb index f5f415e7..0ecccba4 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -163,7 +163,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do # Crea los deploys necesarios para sincronizar a otros nodos de Sutty def sync_nodes Rails.application.nodes.each do |node| - site.deploys.build(type: 'DeployRsync', destination: "sutty@#{node}:#{site.hostname}") + site.deploys.build(type: 'DeployFullRsync', destination: "sutty@#{node}:") end end end diff --git a/db/migrate/20230318183722_rename_deploy_rsync_to_deploy_full_rsync.rb b/db/migrate/20230318183722_rename_deploy_rsync_to_deploy_full_rsync.rb new file mode 100644 index 00000000..689dc559 --- /dev/null +++ b/db/migrate/20230318183722_rename_deploy_rsync_to_deploy_full_rsync.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# Cambia todos los DeployRsync propios de Sutty a DeployFullRsync que se +# encarga de sincronizar todo. +class RenameDeployRsyncToDeployFullRsync < ActiveRecord::Migration[6.1] + def up + DeployRsync.all.find_each do |deploy| + dest = deploy.destination.split(':', 2).first + + next unless nodes.include? dest + + deploy.destination = "#{dest}:" + deploy.type = 'DeployFullRsync' + + deploy.save + end + end + + def down + DeployFullRsync.all.find_each do |deploy| + next unless nodes.include? deploy.destination.split(':', 2).first + + deploy.destination = "#{deploy.destination}#{deploy.site.hostname}" + deploy.type = 'DeployRsync' + + deploy.save + end + end + + private + + def nodes + @nodes ||= Rails.application.nodes.map do |node| + "sutty@#{node}" + end + end +end From 6f4e91d3180005372a5ee9f7bb3e0db140d6c63f Mon Sep 17 00:00:00 2001 From: f Date: Wed, 5 Oct 2022 18:44:23 -0300 Subject: [PATCH 180/475] soportar distributed press apiv0 #7839 --- app/models/deploy.rb | 15 ++++++++++ app/models/deploy_distributed_press.rb | 34 +++++++++++++++++++++++ app/models/deploy_local.rb | 38 ++++++++++++++++++-------- 3 files changed, 76 insertions(+), 11 deletions(-) create mode 100644 app/models/deploy_distributed_press.rb diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 7aedbb19..52031d87 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -92,6 +92,13 @@ class Deploy < ApplicationRecord r&.success? end + # Variables de entorno + # + # @return [Hash] + def local_env + @local_env ||= {} + end + private # @param [String] @@ -99,4 +106,12 @@ class Deploy < ApplicationRecord def readable_cmd(cmd) cmd.split(' -', 2).first.tr(' ', '_') end + + def deploy_local + @deploy_local ||= site.deploys.find_by(type: 'DeployLocal') + end + + def non_local_deploys + @non_local_deploys ||= site.deploys.where.not(type: 'DeployLocal') + end end diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb new file mode 100644 index 00000000..51788865 --- /dev/null +++ b/app/models/deploy_distributed_press.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Soportar Distributed Press APIv0 +# +# No se realiza ninguna acción porque el deploy se hace desde el plugin +# local. +class DeployDistributedPress < Deploy + store :values, accessors: %i[api_key hostname], coder: JSON + + def deploy; end + + def limit; end + + def size + deploy_local.size + end + + # TODO: Devolver hyper:// y otras + def url + "ipfs://#{hostname}/" + end + + # Devuelve variables de entorno para enviarle a DeployLocal + # + # @return [Hash] + def local_env + { + 'DISTRIBUTED_PRESS_PROJECT_DOMAIN' => hostname, + 'DISTRIBUTED_PRESS_API_KEY' => api_key + } + end + + def destination; end +end diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 00e0985d..2d77df75 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -67,21 +67,24 @@ class DeployLocal < Deploy end # Un entorno que solo tiene lo que necesitamos + # + # @return [Hash] def env # XXX: This doesn't support Windows paths :B paths = [File.dirname(`which bundle`), '/usr/bin', '/bin'] - { - 'HOME' => home_dir, - 'PATH' => paths.join(':'), - 'SPREE_API_KEY' => site.tienda_api_key, - 'SPREE_URL' => site.tienda_url, - 'AIRBRAKE_PROJECT_ID' => site.id.to_s, - 'AIRBRAKE_PROJECT_KEY' => site.airbrake_api_key, - 'JEKYLL_ENV' => Rails.env, - 'LANG' => ENV['LANG'], - 'YARN_CACHE_FOLDER' => yarn_cache_dir - } + # Las variables de entorno extra no pueden superponerse al local. + extra_env.merge({ + 'HOME' => home_dir, + 'PATH' => paths.join(':'), + 'SPREE_API_KEY' => site.tienda_api_key, + 'SPREE_URL' => site.tienda_url, + 'AIRBRAKE_PROJECT_ID' => site.id.to_s, + 'AIRBRAKE_PROJECT_KEY' => site.airbrake_api_key, + 'JEKYLL_ENV' => Rails.env, + 'LANG' => ENV['LANG'], + 'YARN_CACHE_FOLDER' => yarn_cache_dir + }) end def yarn_cache_dir @@ -125,4 +128,17 @@ class DeployLocal < Deploy def remove_destination! FileUtils.rm_rf destination end + + # Consigue todas las variables de entorno configuradas por otros + # deploys. + # + # @return [Hash] + def extra_env + @extra_env ||= + non_local_deploys.reduce({}) do |extra_env, deploy| + extra_env.tap do |e| + e.merge! deploy.local_env + end + end + end end From b7daa8e0eb4a111e880329b1ed57ccf6dc88063a Mon Sep 17 00:00:00 2001 From: f Date: Fri, 18 Nov 2022 15:56:59 -0300 Subject: [PATCH 181/475] feat: poder modificar la url de distributed press --- app/models/deploy_distributed_press.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 51788865..a24ae62c 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -5,7 +5,7 @@ # No se realiza ninguna acción porque el deploy se hace desde el plugin # local. class DeployDistributedPress < Deploy - store :values, accessors: %i[api_key hostname], coder: JSON + store :values, accessors: %i[api_url api_key hostname], coder: JSON def deploy; end @@ -26,7 +26,8 @@ class DeployDistributedPress < Deploy def local_env { 'DISTRIBUTED_PRESS_PROJECT_DOMAIN' => hostname, - 'DISTRIBUTED_PRESS_API_KEY' => api_key + 'DISTRIBUTED_PRESS_API_KEY' => api_key, + 'DISTRIBUTED_PRESS_API_URL' => api_url } end From ecdbfeb56863589f0c2b16031a17ecaf3da5769c Mon Sep 17 00:00:00 2001 From: Maki Date: Tue, 17 Jan 2023 18:31:54 -0300 Subject: [PATCH 182/475] agrego toggler para distributed press --- app/models/site.rb | 2 +- .../deploys/_deploy_distributed_press.haml | 21 +++++++++++++++++++ config/locales/en.yml | 4 ++++ config/locales/es.yml | 4 ++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 app/views/deploys/_deploy_distributed_press.haml diff --git a/app/models/site.rb b/app/models/site.rb index f88e2e97..af0b2c53 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -18,7 +18,7 @@ class Site < ApplicationRecord # TODO: Hacer que los diferentes tipos de deploy se auto registren # @see app/services/site_service.rb - DEPLOYS = %i[local private www zip hidden_service].freeze + DEPLOYS = %i[local private www zip hidden_service distributed_press].freeze validates :name, uniqueness: true, hostname: { allow_root_label: true diff --git a/app/views/deploys/_deploy_distributed_press.haml b/app/views/deploys/_deploy_distributed_press.haml new file mode 100644 index 00000000..d7d54db0 --- /dev/null +++ b/app/views/deploys/_deploy_distributed_press.haml @@ -0,0 +1,21 @@ +-# Publicar a la web distribuida + +.row + .col + = deploy.hidden_field :id + = deploy.hidden_field :type + .custom-control.custom-switch + -# + El checkbox invierte la lógica de destrucción porque queremos + crear el deploy si está activado y destruirlo si está + desactivado. + = deploy.check_box :_destroy, + { checked: deploy.object.persisted?, class: 'custom-control-input' }, + '0', '1' + = deploy.label :_destroy, class: 'custom-control-label' do + %h3= t('.title') + = sanitize_markdown t('.help', public_url: deploy.object.site.url), + tags: %w[p strong em a] + + +%hr/ diff --git a/config/locales/en.yml b/config/locales/en.yml index 567ab6bb..595d6145 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -272,6 +272,10 @@ en: Only accessible through [Tor Browser](https://www.torproject.org/download/) + deploy_distributed_press: + title: 'Publish on Distributed Press' + help: | + ipfs stats: index: title: Statistics diff --git a/config/locales/es.yml b/config/locales/es.yml index 0a829e4a..3be67130 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -277,6 +277,10 @@ es: Sólo será accesible a través del [Navegador Tor](https://www.torproject.org/es/download/). + deploy_distributed_press: + title: 'Alojar en la web distribuida' + help: | + Es para que esté en la web distribuida stats: index: title: Estadísticas From 84b2968cdbf85c66a5a9ab1a4534f75a20463e3a Mon Sep 17 00:00:00 2001 From: f Date: Fri, 20 Jan 2023 18:22:08 -0300 Subject: [PATCH 183/475] feat: almacenar y renovar tokens de distributed press --- Gemfile | 1 + Gemfile.lock | 40 ++++++++++- Procfile | 1 + .../renew_distributed_press_tokens_job.rb | 17 +++++ app/models/distributed_press_publisher.rb | 68 +++++++++++++++++++ ...5420_create_distributed_press_publisher.rb | 14 ++++ lib/tasks/distributed_press.rake | 10 +++ monit.conf | 5 ++ 8 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 app/jobs/renew_distributed_press_tokens_job.rb create mode 100644 app/models/distributed_press_publisher.rb create mode 100644 db/migrate/20230119165420_create_distributed_press_publisher.rb create mode 100644 lib/tasks/distributed_press.rake diff --git a/Gemfile b/Gemfile index 489097a6..fb1f4953 100644 --- a/Gemfile +++ b/Gemfile @@ -39,6 +39,7 @@ gem 'commonmarker' gem 'devise' gem 'devise-i18n' gem 'devise_invitable' +gem 'distributed-press-api-client', '~> 0.2.0' gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n' gem 'exception_notification' gem 'fast_blank' diff --git a/Gemfile.lock b/Gemfile.lock index 5df84963..9a754b83 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -115,6 +115,7 @@ GEM xpath (>= 2.0, < 4.0) chartkick (4.1.2) childprocess (4.1.0) + climate_control (1.2.0) coderay (1.1.3) colorator (1.1.0) commonmarker (0.21.2-x86_64-linux-musl) @@ -153,12 +154,45 @@ GEM devise_invitable (2.0.5) actionmailer (>= 5.0) devise (>= 4.6) + distributed-press-api-client (0.2.0) + addressable (~> 2.3, >= 2.3.0) + climate_control + dry-schema + httparty (~> 0.18) + json (~> 2.1, >= 2.1.0) + jwt (~> 2.6.0) dotenv (2.7.6) dotenv-rails (2.7.6) dotenv (= 2.7.6) railties (>= 3.2) down (5.2.4) addressable (~> 2.8) + dry-configurable (1.0.1) + dry-core (~> 1.0, < 2) + zeitwerk (~> 2.6) + dry-core (1.0.0) + concurrent-ruby (~> 1.0) + zeitwerk (~> 2.6) + dry-inflector (1.0.0) + dry-initializer (3.1.1) + dry-logic (1.5.0) + concurrent-ruby (~> 1.0) + dry-core (~> 1.0, < 2) + zeitwerk (~> 2.6) + dry-schema (1.13.0) + concurrent-ruby (~> 1.0) + dry-configurable (~> 1.0, >= 1.0.1) + dry-core (~> 1.0, < 2) + dry-initializer (~> 3.0) + dry-logic (>= 1.5, < 2) + dry-types (>= 1.7, < 2) + zeitwerk (~> 2.6) + dry-types (1.7.0) + concurrent-ruby (~> 1.0) + dry-core (~> 1.0, < 2) + dry-inflector (~> 1.0, < 2) + dry-logic (>= 1.4, < 2) + zeitwerk (~> 2.6) ed25519 (1.2.4-x86_64-linux-musl) em-websocket (0.5.3) eventmachine (>= 0.12.9) @@ -216,8 +250,8 @@ GEM thor hiredis (0.6.3-x86_64-linux-musl) http_parser.rb (0.8.0-x86_64-linux-musl) - httparty (0.18.1) - mime-types (~> 3.0) + httparty (0.21.0) + mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) i18n (1.8.11) concurrent-ruby (~> 1.0) @@ -292,6 +326,7 @@ GEM jekyll-write-and-commit-changes (0.2.1) jekyll (~> 4) rugged (~> 1) + jwt (2.6.0) kaminari (1.2.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.1) @@ -584,6 +619,7 @@ DEPENDENCIES devise devise-i18n devise_invitable + distributed-press-api-client (~> 0.2.0) dotenv-rails down ed25519 diff --git a/Procfile b/Procfile index 45fe1df7..79daa90b 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,3 @@ cleanup: bundle exec rake cleanup:everything stats: bundle exec rake stats:process_all +distributed_press_renew_tokens: bundle exec rake distributed_press:tokens:renew diff --git a/app/jobs/renew_distributed_press_tokens_job.rb b/app/jobs/renew_distributed_press_tokens_job.rb new file mode 100644 index 00000000..5664d9fa --- /dev/null +++ b/app/jobs/renew_distributed_press_tokens_job.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# Renueva los tokens de Distributed Press antes que se venzan, +# activando los callbacks que hacen que se refresque el token. +class RenewDistributedPressTokensJob < ApplicationJob + # Renueva todos los tokens a punto de vencer o informa el error sin + # detener la tarea si algo pasa. + def perform + DistributedPressPublisher.with_about_to_expire_tokens.find_each do |publisher| + publisher.touch + rescue DistributedPress::V1::Error => e + data = { instance: publisher.instance, expires_at: publisher.client.token.expires_at } + + ExceptionNotifier.notify_exception(e, data: data) + end + end +end diff --git a/app/models/distributed_press_publisher.rb b/app/models/distributed_press_publisher.rb new file mode 100644 index 00000000..610d698d --- /dev/null +++ b/app/models/distributed_press_publisher.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +require 'distributed_press/v1' + +# Almacena el token de autenticación y la URL, por ahora solo vamos +# a tener uno, pero queda abierta la posibilidad de agregar más. +class DistributedPressPublisher < ApplicationRecord + # Cifrar la información del token en la base de datos + has_encrypted :token + + # La instancia es única + validates_uniqueness_of :instance + + # El token es necesario + validates_presence_of :token + + # Mantener la fecha de vencimiento actualizada + before_save :update_expires_at_from_token!, :update_token_from_client! + + # Devuelve todos los tokens que vencen en una hora + scope :with_about_to_expire_tokens, lambda { + where('expires_at > ? and expires_at < ?', Time.now, Time.now + 1.hour) + } + + # Al cambiar el token genera un cliente nuevo + # + # @return [String] + def token=(new_token) + @client = nil + super + end + + # Al cambiar la instancia genera un cliente nuevo + # + # @return [String] + def instance=(new_instance) + @client = nil + super + end + + # Instancia un cliente de Distributed Press a partir del token. Al + # cargar un token a punto de vencer se renueva automáticamente. + # + # @return [DistributedPress::V1::Client] + def client + @client ||= DistributedPress::V1::Client.new(url: instance, token: token) + end + + private + + # Actualiza o desactiva la fecha de vencimiento a partir de la + # información del token. + # + # @return [nil] + def update_expires_at_from_token! + self.expires_at = client.token.forever? ? nil : client.token.expires_at + nil + end + + # Actualiza el token a partir del cliente, que ya actualiza el token + # automáticamente. + # + # @return [nil] + def update_token_from_client! + self.token = client.token.to_s + nil + end +end diff --git a/db/migrate/20230119165420_create_distributed_press_publisher.rb b/db/migrate/20230119165420_create_distributed_press_publisher.rb new file mode 100644 index 00000000..8d8de37a --- /dev/null +++ b/db/migrate/20230119165420_create_distributed_press_publisher.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# Crea la tabla de publishers de Distributed Press que contiene las +# instancias y tokens +class CreateDistributedPressPublisher < ActiveRecord::Migration[6.1] + def change + create_table :distributed_press_publishers do |t| + t.timestamps + t.string :instance, unique: true + t.text :token_ciphertext, null: false + t.datetime :expires_at, null: true + end + end +end diff --git a/lib/tasks/distributed_press.rake b/lib/tasks/distributed_press.rake new file mode 100644 index 00000000..8ba270ec --- /dev/null +++ b/lib/tasks/distributed_press.rake @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +namespace :distributed_press do + namespace :tokens do + desc 'Renew tokens' + task renew: :environment do + RenewDistributedPressTokensJob.perform_now + end + end +end diff --git a/monit.conf b/monit.conf index 39f45d6d..1d6bbae1 100644 --- a/monit.conf +++ b/monit.conf @@ -13,3 +13,8 @@ check program stats with path "/usr/bin/foreman run -f /srv/Procfile -d /srv stats" as uid "rails" gid "www-data" every "0 1 * * *" if status != 0 then alert + +check program distributed_press_tokens_renew + with path "/usr/bin/foreman run -f /srv/Procfile -d /srv distributed_press_tokens_renew" as uid "rails" gid "www-data" + every "0 3 * * *" + if status != 0 then alert From c44584596da1d3e23d8f986ec7d2b9a421bfb1b6 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 20 Jan 2023 20:34:27 -0300 Subject: [PATCH 184/475] feat: crear y publicar el sitio en distributed press v1 --- app/models/deploy_distributed_press.rb | 143 ++++++++++++++++++---- app/models/distributed_press_publisher.rb | 5 + 2 files changed, 125 insertions(+), 23 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index a24ae62c..09ba0364 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -1,13 +1,43 @@ # frozen_string_literal: true -# Soportar Distributed Press APIv0 -# -# No se realiza ninguna acción porque el deploy se hace desde el plugin -# local. -class DeployDistributedPress < Deploy - store :values, accessors: %i[api_url api_key hostname], coder: JSON +require 'distributed_press/v1/client/auth' +require 'distributed_press/v1/client/site' - def deploy; end +# Soportar Distributed Press APIv1 +# +# Usa tokens de publicación efímeros para todas las acciones. +# +# Al ser creado, genera el sitio en la instancia de Distributed Press +# configurada y almacena el ID. +# +# Al ser publicado, envía los archivos en un tarball y actualiza la +# información. +class DeployDistributedPress < Deploy + store :values, accessors: %i[hostname remote_site_id remote_info], coder: JSON + + before_create :create_remote_site! + + # Actualiza la información y luego envía los cambios + # + # @param :output [Bool] + # @return [Bool] + def deploy + time_start + + status = false + + site_client.tap do |c| + update remote_info: c.show(publishing_site).to_h + + status = c.publish(publishing_site, deploy_local.destination) + end + + time_stop + + create_stat! status + + status + end def limit; end @@ -15,21 +45,88 @@ class DeployDistributedPress < Deploy deploy_local.size end - # TODO: Devolver hyper:// y otras - def url - "ipfs://#{hostname}/" - end - - # Devuelve variables de entorno para enviarle a DeployLocal - # - # @return [Hash] - def local_env - { - 'DISTRIBUTED_PRESS_PROJECT_DOMAIN' => hostname, - 'DISTRIBUTED_PRESS_API_KEY' => api_key, - 'DISTRIBUTED_PRESS_API_URL' => api_url - } - end - def destination; end + + private + + # El cliente de la API + # + # TODO: cuando soportemos más, tiene que haber una relación entre + # DeployDistributedPress y DistributedPressPublisher. + # + # @return [DistributedPressPublisher] + def publisher + @publisher ||= DistributedPressPublisher.first + end + + # El cliente de autenticación se encarga de intercambiar un token por + # otro + # + # @return [DistributedPress::V1::Client::Auth] + def auth_client + DistributedPress::V1::Client::Auth.new(publisher.client) + end + + # Genera un token con permisos de publicación + # + # @return [DistributedPress::V1::Schemas::NewTokenPayload] + def publishing_token_payload + DistributedPress::V1::Schemas::NewTokenPayload.new.call(capabilities: %w[publisher]) + end + + # Genera un token efímero para publicar el sitio + # + # @return [DistributedPress::V1::Token] + def publishing_token + auth_client.exchange(publishing_token_payload) + end + + # Genera un cliente para publicar el sitio + # + # @return [DistributedPress::V1::Client] + def publishing_client + DistributedPress::V1::Client.new(url: publisher.instance, token: publishing_token) + end + + # El cliente para actualizar el sitio + # + # @return [DistributedPress::V1::Client::Site] + def site_client + DistributedPress::V1::Client::Site.new(publishing_client) + end + + # Genera el esquema de datos para poder publicar el sitio + # + # @return [DistributedPress::V1::Schemas::PublishingSite] + def publishing_site + DistributedPress::V1::Schemas::PublishingSite.new.call(id: remote_site_id) + end + + # Genera el esquema de datos para crear el sitio + # + # @return [DistributedPressPublisher::V1::Schemas::NewSite] + def create_site + DistributedPress::V1::Schemas::NewSite.new.call(domain: hostname, protocols: { http: true, ipfs: true, hyper: true }) + end + + # Crea el sitio en la instancia con el hostname especificado + # + # @return [nil] + def create_remote_site! + created_site = site_client.create(create_site) + + self.remote_site_id = created_site[:id] + self.remote_info = created_site.to_h + + nil + end + + # Registra lo que sucedió + # + # @param status [Bool] + # @return [nil] + def create_stat!(status) + build_stats.create action: publisher.to_s, seconds: time_spent_in_seconds, bytes: size, status: status + nil + end end diff --git a/app/models/distributed_press_publisher.rb b/app/models/distributed_press_publisher.rb index 610d698d..5358e738 100644 --- a/app/models/distributed_press_publisher.rb +++ b/app/models/distributed_press_publisher.rb @@ -46,6 +46,11 @@ class DistributedPressPublisher < ApplicationRecord @client ||= DistributedPress::V1::Client.new(url: instance, token: token) end + # @return [String] + def to_s + "Distributed Press <#{instance}>" + end + private # Actualiza o desactiva la fecha de vencimiento a partir de la From f190fb2dc82bc5f3a3e829ec1a10aa672f19f890 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 20 Jan 2023 20:35:39 -0300 Subject: [PATCH 185/475] fix: permitir modificar el token estos parches hacian que no se pueda modificar el token --- app/models/distributed_press_publisher.rb | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/app/models/distributed_press_publisher.rb b/app/models/distributed_press_publisher.rb index 5358e738..acfc4226 100644 --- a/app/models/distributed_press_publisher.rb +++ b/app/models/distributed_press_publisher.rb @@ -22,22 +22,6 @@ class DistributedPressPublisher < ApplicationRecord where('expires_at > ? and expires_at < ?', Time.now, Time.now + 1.hour) } - # Al cambiar el token genera un cliente nuevo - # - # @return [String] - def token=(new_token) - @client = nil - super - end - - # Al cambiar la instancia genera un cliente nuevo - # - # @return [String] - def instance=(new_instance) - @client = nil - super - end - # Instancia un cliente de Distributed Press a partir del token. Al # cargar un token a punto de vencer se renueva automáticamente. # From 4ebbd48fde8b8bf8203e163a48ddd9159f1a06df Mon Sep 17 00:00:00 2001 From: f Date: Mon, 23 Jan 2023 18:39:10 -0300 Subject: [PATCH 186/475] =?UTF-8?q?feat:=20no=20vamos=20a=20expedir=20toke?= =?UTF-8?q?ns=20ef=C3=ADmeros=20por=20ahora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_distributed_press.rb | 31 +------------------------- 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 09ba0364..38cb59e3 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -59,40 +59,11 @@ class DeployDistributedPress < Deploy @publisher ||= DistributedPressPublisher.first end - # El cliente de autenticación se encarga de intercambiar un token por - # otro - # - # @return [DistributedPress::V1::Client::Auth] - def auth_client - DistributedPress::V1::Client::Auth.new(publisher.client) - end - - # Genera un token con permisos de publicación - # - # @return [DistributedPress::V1::Schemas::NewTokenPayload] - def publishing_token_payload - DistributedPress::V1::Schemas::NewTokenPayload.new.call(capabilities: %w[publisher]) - end - - # Genera un token efímero para publicar el sitio - # - # @return [DistributedPress::V1::Token] - def publishing_token - auth_client.exchange(publishing_token_payload) - end - - # Genera un cliente para publicar el sitio - # - # @return [DistributedPress::V1::Client] - def publishing_client - DistributedPress::V1::Client.new(url: publisher.instance, token: publishing_token) - end - # El cliente para actualizar el sitio # # @return [DistributedPress::V1::Client::Site] def site_client - DistributedPress::V1::Client::Site.new(publishing_client) + DistributedPress::V1::Client::Site.new(publisher.client) end # Genera el esquema de datos para poder publicar el sitio From c789813a46834ee675f12c1a05bb7fe987dbb817 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 26 Jan 2023 15:41:54 -0300 Subject: [PATCH 187/475] fix: actualizar api --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9a754b83..c739d86b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -154,7 +154,7 @@ GEM devise_invitable (2.0.5) actionmailer (>= 5.0) devise (>= 4.6) - distributed-press-api-client (0.2.0) + distributed-press-api-client (0.2.1) addressable (~> 2.3, >= 2.3.0) climate_control dry-schema From ea0539bb1f2db3145f3a05b9ab067a9530872d84 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 6 Feb 2023 16:09:51 -0300 Subject: [PATCH 188/475] feat: usar pnpm si existe relacionado con sutty/jekyll/sutty-base-jekyll-theme#53 --- Dockerfile | 2 ++ app/models/deploy_local.rb | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Dockerfile b/Dockerfile index 342c2750..71edc3d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,8 @@ RUN wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pando COPY ./monit.conf /etc/monit.d/sutty.conf +RUN apk add npm && npm install -g pnpm && apk del npm + VOLUME "/srv" EXPOSE 3000 diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 2d77df75..0e4f6c1c 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -15,6 +15,7 @@ class DeployLocal < Deploy def deploy(output: false) return false unless mkdir return false unless yarn(output: output) + return false unless pnpm(output: output) return false unless bundle(output: output) jekyll_build(output: output) @@ -91,6 +92,10 @@ class DeployLocal < Deploy Rails.root.join('_yarn_cache').to_s end + def pnpm_cache_dir + Rails.root.join('_pnpm_cache').to_s + end + def yarn_lock File.join(site.path, 'yarn.lock') end @@ -103,6 +108,14 @@ class DeployLocal < Deploy run %(gem install bundler --no-document), output: output end + def pnpm_lock + File.join(site.path, 'pnpm-lock.yaml') + end + + def pnpm_lock? + File.exist? pnpm_lock + end + # Corre yarn dentro del repositorio def yarn(output: false) return true unless yarn_lock? @@ -114,6 +127,13 @@ class DeployLocal < Deploy run %(bundle install --no-cache --path="#{gems_dir}" --clean --without test development), output: output end + def pnpm + return true unless pnpm_lock? + + run %(pnpm config set store-dir "#{pnpm_cache_dir}") + run 'pnpm install --production' + end + def jekyll_build(output: false) run %(bundle exec jekyll build --trace --profile --destination "#{escaped_destination}"), output: output end From 0bb0698bd45cb2224d9d81e973f7b8cde1c19c90 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 6 Feb 2023 16:16:27 -0300 Subject: [PATCH 189/475] fix: pnpm se instala localmente --- app/models/deploy_local.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 0e4f6c1c..d6dc6c28 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -72,7 +72,7 @@ class DeployLocal < Deploy # @return [Hash] def env # XXX: This doesn't support Windows paths :B - paths = [File.dirname(`which bundle`), '/usr/bin', '/bin'] + paths = [File.dirname(`which bundle`), '/usr/local/bin', '/usr/bin', '/bin'] # Las variables de entorno extra no pueden superponerse al local. extra_env.merge({ From 436b55d3179beca19495a61b273ab2ed22a66474 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 7 Feb 2023 18:15:25 -0300 Subject: [PATCH 190/475] feat: textos para el panel --- config/locales/en.yml | 16 ++++++++++++++-- config/locales/es.yml | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 595d6145..66372077 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -273,9 +273,21 @@ en: Only accessible through [Tor Browser](https://www.torproject.org/download/) deploy_distributed_press: - title: 'Publish on Distributed Press' + title: 'Publish to the distributed Web' help: | - ipfs + Make your site available through peer-to-peer protocols, + Inter-Planetary File System (IPFS), Hypercore, and via + BitTorrent, so your site is more resilient and can be available + offline, including in community mesh networks. + + **Important:** Only use this option if you would like your data + to be permanently available. If you decide to undo this + selection, a cleared version of the site will be shared in its + place. However, it is possible that nodes on the distributed + storage network may continue retaining copies of the data + indefinitely. + + [Learn more](#) stats: index: title: Statistics diff --git a/config/locales/es.yml b/config/locales/es.yml index 3be67130..79736137 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -278,9 +278,21 @@ es: Sólo será accesible a través del [Navegador Tor](https://www.torproject.org/es/download/). deploy_distributed_press: - title: 'Alojar en la web distribuida' + title: 'Publicar a la Web distribuida' help: | - Es para que esté en la web distribuida + Utiliza protocolos de pares, Inter-Planetary File System (IPFS), + Hypercore y torrents, para que tu sitio sea más resiliente y + esté disponible _offline_, inclusive en redes _mesh_ + comunitarias. + + **Importante:** Sólo usa esta opción si te parece correcto que + tu contenido esté disponible permanentemente. Cuando elijas + des-hacer esta acción, una versión "vacía" del sitio será + compartida en su lugar. Sin embargo, es posible que algunos + nodos en la red de almacenamiento distribuida puedan retener + copias de tu contenido indefinidamente. + + [Saber más](#) stats: index: title: Estadísticas From 4c6818762d72cca41c3cf22118abbd5e7e163dba Mon Sep 17 00:00:00 2001 From: f Date: Wed, 8 Feb 2023 09:38:36 -0300 Subject: [PATCH 191/475] fix: faltaban algunos require --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index fb1f4953..f92a37bf 100644 --- a/Gemfile +++ b/Gemfile @@ -39,7 +39,7 @@ gem 'commonmarker' gem 'devise' gem 'devise-i18n' gem 'devise_invitable' -gem 'distributed-press-api-client', '~> 0.2.0' +gem 'distributed-press-api-client', '~> 0.2.1' gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n' gem 'exception_notification' gem 'fast_blank' diff --git a/Gemfile.lock b/Gemfile.lock index c739d86b..244d5511 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -619,7 +619,7 @@ DEPENDENCIES devise devise-i18n devise_invitable - distributed-press-api-client (~> 0.2.0) + distributed-press-api-client (~> 0.2.1) dotenv-rails down ed25519 From 975bf39c2e233b6d78f0e968c43a34359c3aec7c Mon Sep 17 00:00:00 2001 From: f Date: Wed, 8 Feb 2023 11:55:07 -0300 Subject: [PATCH 192/475] fix: no fallar si tarda mucho dp --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index f92a37bf..64869a4b 100644 --- a/Gemfile +++ b/Gemfile @@ -39,7 +39,7 @@ gem 'commonmarker' gem 'devise' gem 'devise-i18n' gem 'devise_invitable' -gem 'distributed-press-api-client', '~> 0.2.1' +gem 'distributed-press-api-client', '~> 0.2.2' gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n' gem 'exception_notification' gem 'fast_blank' diff --git a/Gemfile.lock b/Gemfile.lock index 244d5511..c214e144 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -154,7 +154,7 @@ GEM devise_invitable (2.0.5) actionmailer (>= 5.0) devise (>= 4.6) - distributed-press-api-client (0.2.1) + distributed-press-api-client (0.2.2) addressable (~> 2.3, >= 2.3.0) climate_control dry-schema @@ -619,7 +619,7 @@ DEPENDENCIES devise devise-i18n devise_invitable - distributed-press-api-client (~> 0.2.1) + distributed-press-api-client (~> 0.2.2) dotenv-rails down ed25519 From 4e1f14a528f44d98199b20c3969e8129e7e274ad Mon Sep 17 00:00:00 2001 From: f Date: Wed, 8 Feb 2023 17:08:02 -0300 Subject: [PATCH 193/475] =?UTF-8?q?feat:=20guardar=20un=20log=20y=20mostra?= =?UTF-8?q?rlo=20en=20output=20tambi=C3=A9n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_distributed_press.rb | 24 ++++++++++++++++++----- app/models/distributed_press_publisher.rb | 22 ++++++++++++++++++++- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 38cb59e3..d805e923 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -22,19 +22,32 @@ class DeployDistributedPress < Deploy # @param :output [Bool] # @return [Bool] def deploy + status = false + log = [] + time_start - status = false - site_client.tap do |c| + stdout = Thread.new(publisher.logger_out) do |io| + until io.eof? + line = io.gets + + puts line if output + log << line + end + end + update remote_info: c.show(publishing_site).to_h status = c.publish(publishing_site, deploy_local.destination) + + publisher.logger.close + stdout.join end time_stop - create_stat! status + create_stat! status, log.join status end @@ -95,9 +108,10 @@ class DeployDistributedPress < Deploy # Registra lo que sucedió # # @param status [Bool] + # @param log [String] # @return [nil] - def create_stat!(status) - build_stats.create action: publisher.to_s, seconds: time_spent_in_seconds, bytes: size, status: status + def create_stat!(status, log) + build_stats.create action: publisher.to_s,log: log, seconds: time_spent_in_seconds, bytes: size, status: status nil end end diff --git a/app/models/distributed_press_publisher.rb b/app/models/distributed_press_publisher.rb index acfc4226..089f63c6 100644 --- a/app/models/distributed_press_publisher.rb +++ b/app/models/distributed_press_publisher.rb @@ -8,6 +8,11 @@ class DistributedPressPublisher < ApplicationRecord # Cifrar la información del token en la base de datos has_encrypted :token + # La salida del log + # + # @return [IO] + attr_reader :logger_out + # La instancia es única validates_uniqueness_of :instance @@ -27,7 +32,7 @@ class DistributedPressPublisher < ApplicationRecord # # @return [DistributedPress::V1::Client] def client - @client ||= DistributedPress::V1::Client.new(url: instance, token: token) + @client ||= DistributedPress::V1::Client.new(url: instance, token: token, logger: logger) end # @return [String] @@ -35,8 +40,23 @@ class DistributedPressPublisher < ApplicationRecord "Distributed Press <#{instance}>" end + # @return [Logger] + def logger + @logger ||= + begin + @logger_out, @logger_in = IO.pipe + ::Logger.new @logger_in, formatter: formatter + end + end + private + def formatter + @formatter ||= lambda do |_, _, _, msg| + "#{msg}\n" + end + end + # Actualiza o desactiva la fecha de vencimiento a partir de la # información del token. # From c291fefa998110ecef8f53486169f504ab0f9bb2 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 8 Feb 2023 17:44:35 -0300 Subject: [PATCH 194/475] =?UTF-8?q?fix:=20link=20a=20saber=20m=C3=A1s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 66372077..531b492f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -287,7 +287,7 @@ en: storage network may continue retaining copies of the data indefinitely. - [Learn more](#) + [Learn more](https://ffdweb.org/building-distributed-press-a-publishing-tool-for-the-decentralized-web/) stats: index: title: Statistics diff --git a/config/locales/es.yml b/config/locales/es.yml index 79736137..84723b81 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -292,7 +292,7 @@ es: nodos en la red de almacenamiento distribuida puedan retener copias de tu contenido indefinidamente. - [Saber más](#) + [Saber más (en inglés)](https://ffdweb.org/building-distributed-press-a-publishing-tool-for-the-decentralized-web/) stats: index: title: Estadísticas From 56a3f2becb0f09909e220dd0c62794b95e8aa9d3 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 8 Feb 2023 18:49:37 -0300 Subject: [PATCH 195/475] feat: un deploy puede tener varias urls --- app/models/deploy_distributed_press.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index d805e923..d3474d50 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -60,6 +60,15 @@ class DeployDistributedPress < Deploy def destination; end + # Devuelve las URLs de todos los protocolos + def urls + remote_info[:links].values.map do |protocol| + [ protocol[:link], protocol[:gateway] ] + end.flatten.compact.select do |link| + link.include? '://' + end + end + private # El cliente de la API From 0b96fc44d6ba7eedf93d9dcb4ee607c777d7970e Mon Sep 17 00:00:00 2001 From: f Date: Wed, 8 Feb 2023 18:52:48 -0300 Subject: [PATCH 196/475] =?UTF-8?q?feat:=20texto=20para=20el=20correo=20de?= =?UTF-8?q?=20notificaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/en.yml | 4 ++++ config/locales/es.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index 531b492f..e040b781 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -126,6 +126,10 @@ en: title: Synchronize to backup server success: Success! error: Error + deploy_distributed_press: + title: Distributed Web + success: Success! + error: Error help: You can contact us by replying to this e-mail maintenance_mailer: notice: diff --git a/config/locales/es.yml b/config/locales/es.yml index 84723b81..f9fdcf29 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -126,6 +126,10 @@ es: title: Sincronizar al servidor alternativo success: ¡Éxito! error: Hubo un error + deploy_distributed_press: + title: Web distribuida + success: ¡Éxito! + error: Hubo un error help: Por cualquier duda, responde este correo para contactarte con nosotres. maintenance_mailer: notice: From 1b5adfb712bf89342993d3b315f236830bf76c6c Mon Sep 17 00:00:00 2001 From: f Date: Thu, 9 Feb 2023 20:01:22 -0300 Subject: [PATCH 197/475] feat: crear temporalmente los dominios en njalla el problema es que no podemos delegar `_dnslink.*.sutty.nl` hacia distributed press, con lo que es necesario crear un subdominio por cada sitio que lo active. --- Gemfile | 1 + Gemfile.lock | 4 ++++ app/models/deploy_distributed_press.rb | 18 ++++++++++++++++++ app/models/distributed_press_publisher.rb | 7 +++++++ 4 files changed, 30 insertions(+) diff --git a/Gemfile b/Gemfile index 64869a4b..9d1b6d67 100644 --- a/Gemfile +++ b/Gemfile @@ -40,6 +40,7 @@ gem 'devise' gem 'devise-i18n' gem 'devise_invitable' gem 'distributed-press-api-client', '~> 0.2.2' +gem 'njalla-api-client' gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n' gem 'exception_notification' gem 'fast_blank' diff --git a/Gemfile.lock b/Gemfile.lock index c214e144..c2c29531 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -387,6 +387,9 @@ GEM nokogiri (1.12.5-x86_64-linux-musl) mini_portile2 (~> 2.6.1) racc (~> 1.4) + njalla-api-client (0.1.0) + dry-schema + httparty (~> 0.18) orm_adapter (0.5.0) pairing_heap (3.0.0) parallel (1.21.0) @@ -654,6 +657,7 @@ DEPENDENCIES mini_magick mobility net-ssh + njalla-api-client nokogiri pg pg_search diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index d3474d50..6f2b2c78 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -111,6 +111,12 @@ class DeployDistributedPress < Deploy self.remote_site_id = created_site[:id] self.remote_info = created_site.to_h + # XXX: Esto depende de nuestro DNS actual, cuando lo migremos hay + # que eliminarlo. + self.remote_info['njalla'] = {} + self.remote_info['njalla']['a'] = njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h + self.remote_info['njalla']['ns'] = njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h + nil end @@ -123,4 +129,16 @@ class DeployDistributedPress < Deploy build_stats.create action: publisher.to_s,log: log, seconds: time_spent_in_seconds, bytes: size, status: status nil end + + # Actualizar registros en Njalla + # + # @return [Njalla::V1::Domain] + def njalla + @njalla ||= + begin + client = Njalla::V1::Client.new(token: ENV['NJALLA_TOKEN']) + + Njalla::V1::Domain.new(domain: Site.domain, client: client) + end + end end diff --git a/app/models/distributed_press_publisher.rb b/app/models/distributed_press_publisher.rb index 089f63c6..6139db93 100644 --- a/app/models/distributed_press_publisher.rb +++ b/app/models/distributed_press_publisher.rb @@ -40,6 +40,13 @@ class DistributedPressPublisher < ApplicationRecord "Distributed Press <#{instance}>" end + # Devuelve el hostname de la instancia + # + # @return [String] + def hostname + @hostname ||= URI.parse(instance).hostname + end + # @return [Logger] def logger @logger ||= From 4666e67b5da555380d340b7b263b0c735e65dd51 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 9 Feb 2023 20:08:56 -0300 Subject: [PATCH 198/475] fix: no crear subdominios para dominios personalizados esto es por retrocompatibilidad para sitios que no usan DeployAlternativeDomain --- app/models/deploy_distributed_press.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 6f2b2c78..1ae7a2f2 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -113,9 +113,11 @@ class DeployDistributedPress < Deploy # XXX: Esto depende de nuestro DNS actual, cuando lo migremos hay # que eliminarlo. - self.remote_info['njalla'] = {} - self.remote_info['njalla']['a'] = njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h - self.remote_info['njalla']['ns'] = njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h + unless site.name.end_with? '.' + self.remote_info['njalla'] = {} + self.remote_info['njalla']['a'] = njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h + self.remote_info['njalla']['ns'] = njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h + end nil end From 812fc0315cc2dfee183e87983894848b6ad03e57 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 9 Feb 2023 20:11:17 -0300 Subject: [PATCH 199/475] fix: requires --- app/models/deploy_distributed_press.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 1ae7a2f2..41054b99 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require 'distributed_press/v1/client/auth' require 'distributed_press/v1/client/site' +require 'njalla/v1' # Soportar Distributed Press APIv1 # From debf45b726cfc1c50cfe379bd73e5365ee9e8faa Mon Sep 17 00:00:00 2001 From: f Date: Fri, 17 Mar 2023 17:33:52 -0300 Subject: [PATCH 200/475] fix: no fallar si hay errores remotos closes #10467 closes #10506 closes #10509 --- app/models/deploy_distributed_press.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 41054b99..09410201 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -118,7 +118,9 @@ class DeployDistributedPress < Deploy self.remote_info['njalla']['a'] = njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h self.remote_info['njalla']['ns'] = njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h end - + rescue DistributedPress::V1::Error, HTTParty::Error => e + ExceptionNotifier.notify_exception(e, data: { site: site.name }) + ensure nil end From 2b340a4488da30a82fbdfb51bcdf8796a37ebc3d Mon Sep 17 00:00:00 2001 From: f Date: Fri, 17 Mar 2023 17:37:48 -0300 Subject: [PATCH 201/475] fix: crear el sitio remoto si no se pudo crear antes --- app/models/deploy_distributed_press.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 09410201..bd80dca4 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -27,6 +27,11 @@ class DeployDistributedPress < Deploy time_start + if remote_site_id.blank? || remote_info['njalla'].blank? + create_remote_site! + save + end + site_client.tap do |c| stdout = Thread.new(publisher.logger_out) do |io| until io.eof? From 29e1d09986022af9a9257941cfbe9b53ddf6b8e9 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 17 Mar 2023 17:39:41 -0300 Subject: [PATCH 202/475] =?UTF-8?q?feat:=20separar=20la=20creaci=C3=B3n=20?= =?UTF-8?q?de=20DP=20de=20njalla?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_distributed_press.rb | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index bd80dca4..9afc6a5d 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -15,7 +15,7 @@ require 'njalla/v1' class DeployDistributedPress < Deploy store :values, accessors: %i[hostname remote_site_id remote_info], coder: JSON - before_create :create_remote_site! + before_create :create_remote_site!, :create_njalla_records! # Actualiza la información y luego envía los cambios # @@ -27,10 +27,9 @@ class DeployDistributedPress < Deploy time_start - if remote_site_id.blank? || remote_info['njalla'].blank? - create_remote_site! - save - end + create_remote_site! if remote_site_id.blank? + create_njalla_records! if remote_info['njalla'].blank? + save site_client.tap do |c| stdout = Thread.new(publisher.logger_out) do |io| @@ -115,7 +114,16 @@ class DeployDistributedPress < Deploy self.remote_site_id = created_site[:id] self.remote_info = created_site.to_h + rescue DistributedPress::V1::Error + ExceptionNotifier.notify_exception(e, data: { site: site.name }) + ensure + nil + end + # Crea los registros en Njalla + # + # @return [nil] + def create_njalla_records! # XXX: Esto depende de nuestro DNS actual, cuando lo migremos hay # que eliminarlo. unless site.name.end_with? '.' @@ -123,7 +131,7 @@ class DeployDistributedPress < Deploy self.remote_info['njalla']['a'] = njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h self.remote_info['njalla']['ns'] = njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h end - rescue DistributedPress::V1::Error, HTTParty::Error => e + rescue HTTParty::Error => e ExceptionNotifier.notify_exception(e, data: { site: site.name }) ensure nil From f0eab9a7b340ca32842373c3937e35794d509602 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 17 Mar 2023 17:44:13 -0300 Subject: [PATCH 203/475] fix: volver a fallar si al hacer deploy todavia estan caidos los servicios --- app/models/deploy_distributed_press.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 9afc6a5d..e8d8b095 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -31,6 +31,10 @@ class DeployDistributedPress < Deploy create_njalla_records! if remote_info['njalla'].blank? save + if remote_site_id.blank? || remote_info['njalla'].blank? + raise DeployJob::DeployException, '' + end + site_client.tap do |c| stdout = Thread.new(publisher.logger_out) do |io| until io.eof? @@ -133,6 +137,7 @@ class DeployDistributedPress < Deploy end rescue HTTParty::Error => e ExceptionNotifier.notify_exception(e, data: { site: site.name }) + self.remote_info['njalla'] = nil ensure nil end From 78c2fd0053f8491adf71889477e9a76ccb58dada Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 16:40:17 -0300 Subject: [PATCH 204/475] fix: agregar dependencias a distributed press --- app/models/deploy_distributed_press.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index e8d8b095..7f663a0b 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -17,6 +17,8 @@ class DeployDistributedPress < Deploy before_create :create_remote_site!, :create_njalla_records! + DEPENDENCIES = %i[deploy_local] + # Actualiza la información y luego envía los cambios # # @param :output [Bool] From 3dc10c46f80ae1a750a544351ecce69bc8dac9ce Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 16:41:32 -0300 Subject: [PATCH 205/475] =?UTF-8?q?feat:=20todav=C3=ADa=20no=20hay=20inter?= =?UTF-8?q?faz=20para=20estos=20deploys?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/deploys/_deploy_full_rsync.haml | 1 + app/views/deploys/_deploy_localized_domain.haml | 1 + 2 files changed, 2 insertions(+) create mode 100644 app/views/deploys/_deploy_full_rsync.haml create mode 100644 app/views/deploys/_deploy_localized_domain.haml diff --git a/app/views/deploys/_deploy_full_rsync.haml b/app/views/deploys/_deploy_full_rsync.haml new file mode 100644 index 00000000..0aab9802 --- /dev/null +++ b/app/views/deploys/_deploy_full_rsync.haml @@ -0,0 +1 @@ +-# nada diff --git a/app/views/deploys/_deploy_localized_domain.haml b/app/views/deploys/_deploy_localized_domain.haml new file mode 100644 index 00000000..0aab9802 --- /dev/null +++ b/app/views/deploys/_deploy_localized_domain.haml @@ -0,0 +1 @@ +-# nada From 8b10cfb524fd8874126070d1f307b423c881e09e Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 16:48:32 -0300 Subject: [PATCH 206/475] feat: darle url a deploy rsync --- app/models/deploy_rsync.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/deploy_rsync.rb b/app/models/deploy_rsync.rb index 6a96a274..ac9f19ec 100644 --- a/app/models/deploy_rsync.rb +++ b/app/models/deploy_rsync.rb @@ -3,7 +3,7 @@ # Sincroniza sitios a servidores remotos usando Rsync. El servidor # remoto tiene que tener rsync instalado. class DeployRsync < Deploy - store :values, accessors: %i[destination host_keys], coder: JSON + store :values, accessors: %i[hostname destination host_keys], coder: JSON DEPENDENCIES = %i[deploy_local] @@ -25,6 +25,11 @@ class DeployRsync < Deploy end end + # @return [String] + def url + "https://#{hostname}/" + end + private # Verificar la conexión SSH implementando Trust On First Use From 91750116a16ba0b64708f69435d7ae0216121881 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 16:52:36 -0300 Subject: [PATCH 207/475] feat: darle url a full rsync --- app/models/deploy_full_rsync.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/deploy_full_rsync.rb b/app/models/deploy_full_rsync.rb index c0ff84c6..8f1d306e 100644 --- a/app/models/deploy_full_rsync.rb +++ b/app/models/deploy_full_rsync.rb @@ -19,4 +19,8 @@ class DeployFullRsync < DeployRsync end end.flatten.all? end + + def url + "https://#{user_host.last}/" + end end From 75621fb5c553368f8c4013a8f4cd2dea856dc5ee Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 16:53:56 -0300 Subject: [PATCH 208/475] fix: traducir metodos de publicacion #10030 --- config/locales/en.yml | 4 ++++ config/locales/es.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index e040b781..8ecdd6d3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -126,6 +126,10 @@ en: title: Synchronize to backup server success: Success! error: Error + deploy_full_rsync: + title: Synchronize to another Sutty node + success: Success! + error: Error deploy_distributed_press: title: Distributed Web success: Success! diff --git a/config/locales/es.yml b/config/locales/es.yml index f9fdcf29..90c07e32 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -126,6 +126,10 @@ es: title: Sincronizar al servidor alternativo success: ¡Éxito! error: Hubo un error + deploy_full_rsync: + title: Sincronizar a otro nodo de Sutty + success: ¡Éxito! + error: Hubo un error deploy_distributed_press: title: Web distribuida success: ¡Éxito! From ad5724be297accc3dd439f0325b615dec9e119e1 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 17:00:29 -0300 Subject: [PATCH 209/475] fix: siempre hay segundos --- 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 3c9b2740..7cc49157 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -37,7 +37,7 @@ class DeployJob < ApplicationJob raise DeployException, 'Una dependencia falló' if failed_dependencies? d status = d.deploy - seconds = d.build_stats.last.try(:seconds) + seconds = d.build_stats.last.try(:seconds) || 0 size = d.size urls = d.respond_to?(:urls) ? d.urls : [d.url].compact rescue StandardError => e From d40c401a7204c277214ddb57cdd955c0eef8e2c7 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 17:01:38 -0300 Subject: [PATCH 210/475] fix: mostrar la salida --- 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 7cc49157..83b17459 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -36,7 +36,7 @@ class DeployJob < ApplicationJob begin raise DeployException, 'Una dependencia falló' if failed_dependencies? d - status = d.deploy + status = d.deploy(output: @output) seconds = d.build_stats.last.try(:seconds) || 0 size = d.size urls = d.respond_to?(:urls) ? d.urls : [d.url].compact From 54575b3bc3e33f3b7a8425a4c9792957e6c9aa71 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 17:02:38 -0300 Subject: [PATCH 211/475] =?UTF-8?q?fix:=20siempre=20avisar=20cuando=20term?= =?UTF-8?q?in=C3=B3=20el=20deploy=20en=20la=20consola?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/deploy_job.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index 83b17459..890f993a 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -66,14 +66,14 @@ class DeployJob < ApplicationJob t << ([type.to_s] + row.values) end end) - - puts "\a" rescue DeployTimedOutException => e notify_exception e ensure @site&.update status: 'waiting' notify_usuaries if notify + + puts "\a" if @output end end # rubocop:enable Metrics/MethodLength From 8b51eb99a3e0224fe0aace172735ebf9025618cd Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 19:01:13 -0300 Subject: [PATCH 212/475] fix: private depende de local para instalar las dependencias --- app/models/deploy_private.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/deploy_private.rb b/app/models/deploy_private.rb index d3bfb50d..1fa42648 100644 --- a/app/models/deploy_private.rb +++ b/app/models/deploy_private.rb @@ -6,6 +6,8 @@ # XXX: La plantilla tiene que soportar esto con el plugin # jekyll-private-data class DeployPrivate < DeployLocal + DEPENDENCIES = %i[deploy_local] + # No es necesario volver a instalar dependencias def deploy(output: false) jekyll_build(output: output) From 94980051b65f8ee9bf44fc2890edf02d89c679bb Mon Sep 17 00:00:00 2001 From: f Date: Sat, 18 Mar 2023 19:33:25 -0300 Subject: [PATCH 213/475] fix: volver a hacer depender la sincronizacion del zip --- app/models/deploy_full_rsync.rb | 1 + app/models/deploy_rsync.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/deploy_full_rsync.rb b/app/models/deploy_full_rsync.rb index 8f1d306e..5bdfeeff 100644 --- a/app/models/deploy_full_rsync.rb +++ b/app/models/deploy_full_rsync.rb @@ -6,6 +6,7 @@ class DeployFullRsync < DeployRsync deploy_hidden_service deploy_local deploy_www + deploy_zip ] # Sincroniza las ubicaciones alternativas también diff --git a/app/models/deploy_rsync.rb b/app/models/deploy_rsync.rb index ac9f19ec..1dff2d99 100644 --- a/app/models/deploy_rsync.rb +++ b/app/models/deploy_rsync.rb @@ -5,7 +5,7 @@ class DeployRsync < Deploy store :values, accessors: %i[hostname destination host_keys], coder: JSON - DEPENDENCIES = %i[deploy_local] + DEPENDENCIES = %i[deploy_local deploy_zip] def deploy(output: false) ssh? && rsync(output: output) From 2a93218ef9d8f412b4116b8463e239cf2e413fb4 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 20 Mar 2023 12:20:50 -0300 Subject: [PATCH 214/475] fix: siempre devolver el destino closes ##10541 closes ##10540 closes ##10539 closes ##10538 closes ##10537 closes ##10536 closes ##10535 closes ##10534 closes ##10533 --- app/models/deploy_zip.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/deploy_zip.rb b/app/models/deploy_zip.rb index 5f72a728..85005470 100644 --- a/app/models/deploy_zip.rb +++ b/app/models/deploy_zip.rb @@ -65,6 +65,8 @@ class DeployZip < Deploy # @return [String] def destination Rails.root.join('_deploy', site.hostname).realpath.to_s + rescue Errno::ENOENT + Rails.root.join('_deploy', site.hostname).to_s end def file From f5274cf34224f3e5cef4ae72dbe1a4cb99d5f1a3 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 20 Mar 2023 12:26:11 -0300 Subject: [PATCH 215/475] =?UTF-8?q?fix:=20no=20hacer=20falla=20la=20config?= =?UTF-8?q?uraci=C3=B3n=20si=20todav=C3=ADa=20no=20se=20gener=C3=B3=20el?= =?UTF-8?q?=20onion=20#10542?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/deploys/_deploy_hidden_service.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/deploys/_deploy_hidden_service.haml b/app/views/deploys/_deploy_hidden_service.haml index d6388123..9ebda012 100644 --- a/app/views/deploys/_deploy_hidden_service.haml +++ b/app/views/deploys/_deploy_hidden_service.haml @@ -17,7 +17,8 @@ = sanitize_markdown t('.help', public_url: deploy.object.site.url), tags: %w[p strong em a] - - if deploy.object.fqdn + - begin = sanitize_markdown t('.help_2', url: deploy.object.url), tags: %w[p strong em a] + - rescue ArgumentError %hr/ From ecd8c80e028ab572ea82546e386bce1d17ceb8ba Mon Sep 17 00:00:00 2001 From: f Date: Mon, 20 Mar 2023 12:13:51 -0300 Subject: [PATCH 216/475] =?UTF-8?q?fix:=20capturar=20la=20excepci=C3=B3n?= =?UTF-8?q?=20#10546?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_distributed_press.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 7f663a0b..9414abc6 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -120,7 +120,7 @@ class DeployDistributedPress < Deploy self.remote_site_id = created_site[:id] self.remote_info = created_site.to_h - rescue DistributedPress::V1::Error + rescue DistributedPress::V1::Error => e ExceptionNotifier.notify_exception(e, data: { site: site.name }) ensure nil From 3abd87e8e6ad18744d5b62a3386bdaeef31e258d Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 17:11:51 -0300 Subject: [PATCH 217/475] feat: guardar la api key de njalla en las credenciales --- app/models/deploy_distributed_press.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 9414abc6..6a6b1d64 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -160,7 +160,7 @@ class DeployDistributedPress < Deploy def njalla @njalla ||= begin - client = Njalla::V1::Client.new(token: ENV['NJALLA_TOKEN']) + client = Njalla::V1::Client.new(token: Rails.application.credentials.njalla) Njalla::V1::Domain.new(domain: Site.domain, client: client) end From 1ff48bf4589e8da1b73323c646af9d95d01524b0 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 18:02:43 -0300 Subject: [PATCH 218/475] fix: no intentar notificar si no hay sitio closes #12753 --- app/jobs/deploy_job.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index 890f993a..530b69dd 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -69,11 +69,13 @@ class DeployJob < ApplicationJob rescue DeployTimedOutException => e notify_exception e ensure - @site&.update status: 'waiting' + if @site.present? + @site.update status: 'waiting' - notify_usuaries if notify + notify_usuaries if notify - puts "\a" if @output + puts "\a" if @output + end end end # rubocop:enable Metrics/MethodLength From 21dd6ffd55d7870eac6d682efa183a43aaf2deaa Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Mar 2023 18:25:55 -0300 Subject: [PATCH 219/475] =?UTF-8?q?fix:=20no=20fallar=20njalla=20si=20fall?= =?UTF-8?q?=C3=B3=20dp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #12410 --- app/models/deploy_distributed_press.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 6a6b1d64..679da09d 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -133,6 +133,7 @@ class DeployDistributedPress < Deploy # XXX: Esto depende de nuestro DNS actual, cuando lo migremos hay # que eliminarlo. unless site.name.end_with? '.' + self.remote_info ||= {} self.remote_info['njalla'] = {} self.remote_info['njalla']['a'] = njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h self.remote_info['njalla']['ns'] = njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h From c53391b21cd881f4de246cf18eacd345d314c215 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 24 Mar 2023 13:30:14 -0300 Subject: [PATCH 220/475] =?UTF-8?q?fix:=20mostrar=20los=20metodos=20fallid?= =?UTF-8?q?os=20en=20el=20correo=20de=20notificaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no salían porque la tabla se genera en base a expandir las urls y cuando las urls venían vacías no se generaba la fila. --- app/jobs/deploy_job.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index 530b69dd..aeb0f4b6 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -44,7 +44,8 @@ class DeployJob < ApplicationJob status = false seconds ||= 0 size ||= 0 - urls ||= [] + # XXX: Hace que se vea la tabla + urls ||= [nil] notify_exception e, d end From da192ef14cf43ac136d22a9601073f3bd6f23682 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 24 Mar 2023 14:23:34 -0300 Subject: [PATCH 221/475] =?UTF-8?q?fix:=20sincronizar=20aunque=20algunos?= =?UTF-8?q?=20destinos=20todav=C3=ADa=20no=20existan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit por ejemplo la dependencia en hidden service hace que no se sincronice el sitio principal. --- app/models/deploy_full_rsync.rb | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/app/models/deploy_full_rsync.rb b/app/models/deploy_full_rsync.rb index 5bdfeeff..a3c1840d 100644 --- a/app/models/deploy_full_rsync.rb +++ b/app/models/deploy_full_rsync.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class DeployFullRsync < DeployRsync - DEPENDENCIES = %i[ + SOFT_DEPENDENCIES = %i[ deploy_alternative_domain deploy_hidden_service deploy_local @@ -9,16 +9,24 @@ class DeployFullRsync < DeployRsync deploy_zip ] - # Sincroniza las ubicaciones alternativas también + # Sincroniza las ubicaciones alternativas también, ignorando las que + # todavía no se generaron. Solo falla si ningún sitio fue + # sincronizado o si alguna sincronización falló. # # @param :output [Boolean] # @return [Boolean] def rsync(output: false) - DEPENDENCIES.map(&:to_s).map(&:classify).map do |dependency| - site.deploys.where(type: dependency).find_each.map do |deploy| - run %(rsync -aviH --delete-after --timeout=5 #{Shellwords.escape deploy.destination} #{Shellwords.escape destination}), output: output - end - end.flatten.all? + result = + SOFT_DEPENDENCIES.map(&:to_s).map(&:classify).map do |dependency| + site.deploys.where(type: dependency).find_each.map do |deploy| + next unless File.exist? deploy.destination + + run %(rsync -aviH --delete-after --timeout=5 #{Shellwords.escape deploy.destination} #{Shellwords.escape destination}), output: output + rescue StandardError + end + end.flatten.compact + + result.present? && result.all? end def url From 57542c92a7fcf1548e93e87b0162e19497507037 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 27 Mar 2023 14:08:19 -0300 Subject: [PATCH 222/475] fix: typo --- app/models/deploy_local.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index d6dc6c28..5b48df29 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -123,15 +123,15 @@ class DeployLocal < Deploy run 'yarn install --production', output: output end - def bundle(output: false) - run %(bundle install --no-cache --path="#{gems_dir}" --clean --without test development), output: output - end - - def pnpm + def pnpm(output: false) return true unless pnpm_lock? - run %(pnpm config set store-dir "#{pnpm_cache_dir}") - run 'pnpm install --production' + run %(pnpm config set store-dir "#{pnpm_cache_dir}"), output: output + run 'pnpm install --production', output: output + end + + def bundle(output: false) + run %(bundle install --no-cache --path="#{gems_dir}" --clean --without test development), output: output end def jekyll_build(output: false) From 42c7e93ac96cff1681047cb9bfc9f4c5f9353945 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 27 Mar 2023 14:09:16 -0300 Subject: [PATCH 223/475] =?UTF-8?q?fix:=20crear=20un=20registro=20para=20w?= =?UTF-8?q?ww=20tambi=C3=A9n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_distributed_press.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 679da09d..f26a72b5 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -136,6 +136,7 @@ class DeployDistributedPress < Deploy self.remote_info ||= {} self.remote_info['njalla'] = {} self.remote_info['njalla']['a'] = njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h + self.remote_info['njalla']['cname'] = njalla.add_record(name: "www.#{site.name}", type: 'CNAME', content: "#{Site.domain}.").to_h self.remote_info['njalla']['ns'] = njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h end rescue HTTParty::Error => e From bef171d3ace090d2afcca7be5ea7be91930baf26 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 27 Mar 2023 14:10:35 -0300 Subject: [PATCH 224/475] fix: intentar crear siempre los registros en njalla --- app/models/deploy_distributed_press.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index f26a72b5..a2e2e20a 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -30,7 +30,7 @@ class DeployDistributedPress < Deploy time_start create_remote_site! if remote_site_id.blank? - create_njalla_records! if remote_info['njalla'].blank? + create_njalla_records! save if remote_site_id.blank? || remote_info['njalla'].blank? @@ -134,10 +134,10 @@ class DeployDistributedPress < Deploy # que eliminarlo. unless site.name.end_with? '.' self.remote_info ||= {} - self.remote_info['njalla'] = {} - self.remote_info['njalla']['a'] = njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h - self.remote_info['njalla']['cname'] = njalla.add_record(name: "www.#{site.name}", type: 'CNAME', content: "#{Site.domain}.").to_h - self.remote_info['njalla']['ns'] = njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h + self.remote_info['njalla'] ||= {} + self.remote_info['njalla']['a'] ||= njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h + self.remote_info['njalla']['cname'] ||= njalla.add_record(name: "www.#{site.name}", type: 'CNAME', content: "#{Site.domain}.").to_h + self.remote_info['njalla']['ns'] ||= njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h end rescue HTTParty::Error => e ExceptionNotifier.notify_exception(e, data: { site: site.name }) From c774337fd325b421fd53c3873b6c9ae0aaef6582 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 27 Mar 2023 14:43:01 -0300 Subject: [PATCH 225/475] feat: sincronizar dominios por idioma --- app/models/deploy_full_rsync.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/deploy_full_rsync.rb b/app/models/deploy_full_rsync.rb index a3c1840d..7bc0e788 100644 --- a/app/models/deploy_full_rsync.rb +++ b/app/models/deploy_full_rsync.rb @@ -3,6 +3,7 @@ class DeployFullRsync < DeployRsync SOFT_DEPENDENCIES = %i[ deploy_alternative_domain + deploy_localized_domain deploy_hidden_service deploy_local deploy_www From b2c6d40b0f0dbdb7ff26b763db8865b24c4294b0 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 27 Mar 2023 14:44:22 -0300 Subject: [PATCH 226/475] fix: deprecar DeployLocal#extra_env --- app/models/deploy.rb | 1 + app/models/deploy_local.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 52031d87..33dc9f2b 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -13,6 +13,7 @@ class Deploy < ApplicationRecord has_many :build_stats, dependent: :destroy DEPENDENCIES = [] + SOFT_DEPENDENCIES = [] def deploy(**) raise NotImplementedError diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 5b48df29..d1d93fe5 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -152,6 +152,7 @@ class DeployLocal < Deploy # Consigue todas las variables de entorno configuradas por otros # deploys. # + # @deprecated Solo tenía sentido para Distributed Press v0 # @return [Hash] def extra_env @extra_env ||= From ad0d7aac10736cc375a069e5172454c38950699a Mon Sep 17 00:00:00 2001 From: f Date: Mon, 27 Mar 2023 14:52:37 -0300 Subject: [PATCH 227/475] feat: tener en cuenta las dependencias suaves al armar el grafo --- app/models/deploy.rb | 7 +++++++ app/models/deploy_full_rsync.rb | 4 +--- app/models/site/deploy_dependencies.rb | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 33dc9f2b..a92708c0 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -100,6 +100,13 @@ class Deploy < ApplicationRecord @local_env ||= {} end + # Trae todas las dependencias + # + # @return [Array] + def self.all_dependencies + self::DEPENDENCIES | self::SOFT_DEPENDENCIES + end + private # @param [String] diff --git a/app/models/deploy_full_rsync.rb b/app/models/deploy_full_rsync.rb index 7bc0e788..b8c48eab 100644 --- a/app/models/deploy_full_rsync.rb +++ b/app/models/deploy_full_rsync.rb @@ -5,9 +5,7 @@ class DeployFullRsync < DeployRsync deploy_alternative_domain deploy_localized_domain deploy_hidden_service - deploy_local deploy_www - deploy_zip ] # Sincroniza las ubicaciones alternativas también, ignorando las que @@ -18,7 +16,7 @@ class DeployFullRsync < DeployRsync # @return [Boolean] def rsync(output: false) result = - SOFT_DEPENDENCIES.map(&:to_s).map(&:classify).map do |dependency| + self.class.all_dependencies.map(&:to_s).map(&:classify).map do |dependency| site.deploys.where(type: dependency).find_each.map do |deploy| next unless File.exist? deploy.destination diff --git a/app/models/site/deploy_dependencies.rb b/app/models/site/deploy_dependencies.rb index a01f99e7..ed80a8af 100644 --- a/app/models/site/deploy_dependencies.rb +++ b/app/models/site/deploy_dependencies.rb @@ -18,7 +18,7 @@ class Site end deploys.each do |deploy| - deploy.class::DEPENDENCIES.each do |dependency| + deploy.class.all_dependencies.each do |dependency| deploys.where(type: dependency.to_s.classify).each do |deploy_dependency| graph.add_edge deploy_dependency, deploy end From bee16538301b11a5b8c0bc3645ebe59a09816968 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 30 Mar 2023 14:45:49 -0300 Subject: [PATCH 228/475] =?UTF-8?q?fix:=20evitar=20m=C3=A9todos=20de=20pub?= =?UTF-8?q?licaci=C3=B3n=20duplicados=20#12276?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/sites_controller.rb | 2 -- app/services/site_service.rb | 1 + app/views/sites/_form.haml | 3 --- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index f0eff0dc..8d49fd8a 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -28,8 +28,6 @@ class SitesController < ApplicationController @site = Site.new authorize @site - - @site.deploys.build type: 'DeployLocal' end def create diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 0ecccba4..bb76c6ac 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -14,6 +14,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do self.site = Site.new params add_role temporal: false, rol: 'usuarie' + site.deploys.build type: 'DeployLocal' sync_nodes I18n.with_locale(usuarie.lang.to_sym || I18n.default_locale) do diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index 757b8b48..48e30e0c 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -158,9 +158,6 @@ = f.fields_for :deploys do |deploy| = render "deploys/#{deploy.object.type.underscore}", deploy: deploy, site: site - - else - = f.fields_for :deploys do |deploy| - = deploy.hidden_field :type .form-group = f.submit submit, class: 'btn btn-lg btn-block' From 95198832c4791134df2c8f11fd682219e4684780 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 30 Mar 2023 14:53:34 -0300 Subject: [PATCH 229/475] feat: configurar la fuente de gemas del skel desde el panel --- app/models/deploy_local.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index d1d93fe5..39cd9622 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -84,7 +84,8 @@ class DeployLocal < Deploy 'AIRBRAKE_PROJECT_KEY' => site.airbrake_api_key, 'JEKYLL_ENV' => Rails.env, 'LANG' => ENV['LANG'], - 'YARN_CACHE_FOLDER' => yarn_cache_dir + 'YARN_CACHE_FOLDER' => yarn_cache_dir, + 'GEMS_SOURCE' => ENV['GEMS_SOURCE'] }) end From b759398a4ee15beaa52972840dfc29ac27557a55 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 12:01:00 -0300 Subject: [PATCH 230/475] =?UTF-8?q?BREAKING=20CHANGE:=20usar=20la=20=C3=BA?= =?UTF-8?q?ltima=20instancia=20de=20Distributed=20Press?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_distributed_press.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index a2e2e20a..64c66cfc 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -88,7 +88,7 @@ class DeployDistributedPress < Deploy # # @return [DistributedPressPublisher] def publisher - @publisher ||= DistributedPressPublisher.first + @publisher ||= DistributedPressPublisher.last end # El cliente para actualizar el sitio From b818408f3e7f5b2c9a4a0983e26102af9e428073 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 12:14:14 -0300 Subject: [PATCH 231/475] feat: indicarle a distributed press que elimine el sitio sutty/distributed-press-api-client#10 --- Gemfile | 2 +- Gemfile.lock | 2 +- app/models/deploy_distributed_press.rb | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 9d1b6d67..2ff1c68c 100644 --- a/Gemfile +++ b/Gemfile @@ -39,7 +39,7 @@ gem 'commonmarker' gem 'devise' gem 'devise-i18n' gem 'devise_invitable' -gem 'distributed-press-api-client', '~> 0.2.2' +gem 'distributed-press-api-client', '~> 0.2.3' gem 'njalla-api-client' gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n' gem 'exception_notification' diff --git a/Gemfile.lock b/Gemfile.lock index c2c29531..30619795 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -622,7 +622,7 @@ DEPENDENCIES devise devise-i18n devise_invitable - distributed-press-api-client (~> 0.2.2) + distributed-press-api-client (~> 0.2.3) dotenv-rails down ed25519 diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 64c66cfc..ca10218a 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -16,6 +16,7 @@ class DeployDistributedPress < Deploy store :values, accessors: %i[hostname remote_site_id remote_info], coder: JSON before_create :create_remote_site!, :create_njalla_records! + before_destroy :delete_remote_site! DEPENDENCIES = %i[deploy_local] @@ -120,9 +121,9 @@ class DeployDistributedPress < Deploy self.remote_site_id = created_site[:id] self.remote_info = created_site.to_h + nil rescue DistributedPress::V1::Error => e ExceptionNotifier.notify_exception(e, data: { site: site.name }) - ensure nil end @@ -156,6 +157,14 @@ class DeployDistributedPress < Deploy nil end + def delete_remote_site! + site_client.delete(publishing_site) + nil + rescue DistributedPress::V1::Error => e + ExceptionNotifier.notify_exception(e, data: { site: site.name }) + nil + end + # Actualizar registros en Njalla # # @return [Njalla::V1::Domain] From f6a08f1073c834d2201b7cbcb5d067fa28140cd7 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 13:35:42 -0300 Subject: [PATCH 232/475] feat: eliminar registros en njalla --- Gemfile | 2 +- Gemfile.lock | 2 +- app/models/deploy_distributed_press.rb | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 2ff1c68c..b2472035 100644 --- a/Gemfile +++ b/Gemfile @@ -40,7 +40,7 @@ gem 'devise' gem 'devise-i18n' gem 'devise_invitable' gem 'distributed-press-api-client', '~> 0.2.3' -gem 'njalla-api-client' +gem 'njalla-api-client', '~> 0.2.0' gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n' gem 'exception_notification' gem 'fast_blank' diff --git a/Gemfile.lock b/Gemfile.lock index 30619795..67ce13e2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -387,7 +387,7 @@ GEM nokogiri (1.12.5-x86_64-linux-musl) mini_portile2 (~> 2.6.1) racc (~> 1.4) - njalla-api-client (0.1.0) + njalla-api-client (0.2.0) dry-schema httparty (~> 0.18) orm_adapter (0.5.0) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index ca10218a..9f78ba28 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -16,7 +16,7 @@ class DeployDistributedPress < Deploy store :values, accessors: %i[hostname remote_site_id remote_info], coder: JSON before_create :create_remote_site!, :create_njalla_records! - before_destroy :delete_remote_site! + before_destroy :delete_remote_site!, :delete_njalla_records! DEPENDENCIES = %i[deploy_local] @@ -165,6 +165,14 @@ class DeployDistributedPress < Deploy nil end + def delete_njalla_records! + %w[a ns cname].each do |type| + next if (id = remote_info.dig('njalla', type, 'id')).blank? + + njalla.remove_record(id: id.to_i) + end + end + # Actualizar registros en Njalla # # @return [Njalla::V1::Domain] From d2e4fe09646e7b337868bf6711e2a3e5062a426b Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 13:58:10 -0300 Subject: [PATCH 233/475] fix: los registros en njalla no siempre son necesarios --- app/models/deploy_distributed_press.rb | 36 ++++++++++++++++++-------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 9f78ba28..b77dfe19 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -34,8 +34,12 @@ class DeployDistributedPress < Deploy create_njalla_records! save - if remote_site_id.blank? || remote_info['njalla'].blank? - raise DeployJob::DeployException, '' + if remote_site_id.blank? + raise DeployJob::DeployException, 'El sitio no se creó en Distributed Press' + end + + if create_njalla_records? && remote_info['njalla'].blank? + raise DeployJob::DeployException, 'No se pudieron crear los registros necesarios en Njalla' end site_client.tap do |c| @@ -129,17 +133,20 @@ class DeployDistributedPress < Deploy # Crea los registros en Njalla # + # XXX: Esto depende de nuestro DNS actual, cuando lo migremos hay + # que eliminarlo. + # # @return [nil] def create_njalla_records! - # XXX: Esto depende de nuestro DNS actual, cuando lo migremos hay - # que eliminarlo. - unless site.name.end_with? '.' - self.remote_info ||= {} - self.remote_info['njalla'] ||= {} - self.remote_info['njalla']['a'] ||= njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h - self.remote_info['njalla']['cname'] ||= njalla.add_record(name: "www.#{site.name}", type: 'CNAME', content: "#{Site.domain}.").to_h - self.remote_info['njalla']['ns'] ||= njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h - end + return unless create_njalla_records? + + self.remote_info ||= {} + self.remote_info['njalla'] ||= {} + self.remote_info['njalla']['a'] ||= njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h + self.remote_info['njalla']['cname'] ||= njalla.add_record(name: "www.#{site.name}", type: 'CNAME', content: "#{Site.domain}.").to_h + self.remote_info['njalla']['ns'] ||= njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h + + nil rescue HTTParty::Error => e ExceptionNotifier.notify_exception(e, data: { site: site.name }) self.remote_info['njalla'] = nil @@ -166,6 +173,8 @@ class DeployDistributedPress < Deploy end def delete_njalla_records! + return unless create_njalla_records? + %w[a ns cname].each do |type| next if (id = remote_info.dig('njalla', type, 'id')).blank? @@ -184,4 +193,9 @@ class DeployDistributedPress < Deploy Njalla::V1::Domain.new(domain: Site.domain, client: client) end end + + # Detecta si tenemos que crear registros en Njalla + def create_njalla_records? + !site.name.end_with?('.') + end end From 943bf7b5bdafd2080736d8cdf4774ee6632d5b91 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 14:38:04 -0300 Subject: [PATCH 234/475] fix: no pisar las datos de njalla con los de distributed press --- app/models/deploy_distributed_press.rb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index b77dfe19..081ceeb5 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -38,7 +38,7 @@ class DeployDistributedPress < Deploy raise DeployJob::DeployException, 'El sitio no se creó en Distributed Press' end - if create_njalla_records? && remote_info['njalla'].blank? + if create_njalla_records? && remote_info[:njalla].blank? raise DeployJob::DeployException, 'No se pudieron crear los registros necesarios en Njalla' end @@ -52,7 +52,8 @@ class DeployDistributedPress < Deploy end end - update remote_info: c.show(publishing_site).to_h + self.remote_info[:distributed_press] = c.show(publishing_site).to_h + save status = c.publish(publishing_site, deploy_local.destination) @@ -77,7 +78,7 @@ class DeployDistributedPress < Deploy # Devuelve las URLs de todos los protocolos def urls - remote_info[:links].values.map do |protocol| + remote_info.dig(:distributed_press, :links).values.map do |protocol| [ protocol[:link], protocol[:gateway] ] end.flatten.compact.select do |link| link.include? '://' @@ -124,7 +125,8 @@ class DeployDistributedPress < Deploy created_site = site_client.create(create_site) self.remote_site_id = created_site[:id] - self.remote_info = created_site.to_h + self.remote_info ||= {} + self.remote_info[:distributed_press] = created_site.to_h nil rescue DistributedPress::V1::Error => e ExceptionNotifier.notify_exception(e, data: { site: site.name }) @@ -141,15 +143,15 @@ class DeployDistributedPress < Deploy return unless create_njalla_records? self.remote_info ||= {} - self.remote_info['njalla'] ||= {} - self.remote_info['njalla']['a'] ||= njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h - self.remote_info['njalla']['cname'] ||= njalla.add_record(name: "www.#{site.name}", type: 'CNAME', content: "#{Site.domain}.").to_h - self.remote_info['njalla']['ns'] ||= njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h + self.remote_info[:njalla] ||= {} + self.remote_info[:njalla][:a] ||= njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h + self.remote_info[:njalla][:cname] ||= njalla.add_record(name: "www.#{site.name}", type: 'CNAME', content: "#{Site.domain}.").to_h + self.remote_info[:njalla][:ns] ||= njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h nil rescue HTTParty::Error => e ExceptionNotifier.notify_exception(e, data: { site: site.name }) - self.remote_info['njalla'] = nil + self.remote_info.delete :njalla ensure nil end From a56acfd6da2aec2c3e5b913c91bae4de229be5ec Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 14:44:48 -0300 Subject: [PATCH 235/475] =?UTF-8?q?fix:=20obtener=20los=20links=20luego=20?= =?UTF-8?q?de=20la=20publicaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_distributed_press.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 081ceeb5..d8fd3f61 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -52,11 +52,13 @@ class DeployDistributedPress < Deploy end end - self.remote_info[:distributed_press] = c.show(publishing_site).to_h - save - status = c.publish(publishing_site, deploy_local.destination) + if status + self.remote_info[:distributed_press] = c.show(publishing_site).to_h + save + end + publisher.logger.close stdout.join end From ab126038afe4a9352c82002d58687bb5074142bf Mon Sep 17 00:00:00 2001 From: f Date: Fri, 31 Mar 2023 14:49:17 -0300 Subject: [PATCH 236/475] feat: devolver las urls con protocolos --- app/models/deploy_distributed_press.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index d8fd3f61..32a3049e 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -80,6 +80,12 @@ class DeployDistributedPress < Deploy # Devuelve las URLs de todos los protocolos def urls + protocol_urls + gateway_urls + end + + private + + def gateway_urls remote_info.dig(:distributed_press, :links).values.map do |protocol| [ protocol[:link], protocol[:gateway] ] end.flatten.compact.select do |link| @@ -87,7 +93,13 @@ class DeployDistributedPress < Deploy end end - private + def protocol_urls + remote_info.dig(:distributed_press, :protocols).select do |_, enabled| + enabled + end.map do |protocol, _| + "#{protocol}://#{site.hostname}" + end + end # El cliente de la API # From 87d51e88562faf61eb81a3a3833a2799813d86a0 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 17:31:35 -0300 Subject: [PATCH 237/475] feat: pedir consentimiento #12795 --- app/views/bootstrap/_custom_checkbox.haml | 6 ++++++ app/views/devise/registrations/new.haml | 18 +++++++++++++++++- config/locales/devise.views.en.yml | 19 +++++++++++++++++++ config/locales/devise.views.es.yml | 18 ++++++++++++++++++ 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 app/views/bootstrap/_custom_checkbox.haml diff --git a/app/views/bootstrap/_custom_checkbox.haml b/app/views/bootstrap/_custom_checkbox.haml new file mode 100644 index 00000000..0c3ff3a6 --- /dev/null +++ b/app/views/bootstrap/_custom_checkbox.haml @@ -0,0 +1,6 @@ +- help_id = "#{id}_help" + +.custom-control.custom-checkbox + %input.custom-control-input{ id: id, type: 'checkbox', name: name, value: value, required: required } + %label.custom-control-label{ for: id, aria: { describedby: help_id } }= content + %small.form-text.text-muted{ id: help_id }= yield diff --git a/app/views/devise/registrations/new.haml b/app/views/devise/registrations/new.haml index e6bda964..75015831 100644 --- a/app/views/devise/registrations/new.haml +++ b/app/views/devise/registrations/new.haml @@ -4,7 +4,7 @@ = render 'devise/shared/error_messages', resource: resource .row.align-items-center.justify-content-center.full-height - .col-md-5.align-self-center + .col-md-6.align-self-center %h2= t('.sign_up') %p= t('.help') @@ -39,6 +39,22 @@ min: @minimum_password_length, aria: { describedby: 'minimum-password-length' }, placeholder: t("#{password}_confirmation") + + - if params[:consent] + .form-group + - %i[privacy_policy_accepted terms_of_service_accepted code_of_conduct_accepted available_for_feedback_accepted].each do |field| + - required = t(".#{field}.required", default: '').present? + - id = "usuarie_#{field}" + - name = "usuarie[#{field}]" + - content = t(".#{field}.label") + - href = t(".#{field}.href", default: '') + - help_content = t(".#{field}.help") + = render 'bootstrap/custom_checkbox', id: id, name: name, content: content, required: required, value: "1" do + - if href.present? + = link_to help_content, href, target: '_blank', rel: 'noopener' + - else + = help_content + .actions = f.submit t('.sign_up'), class: 'btn btn-lg btn-block' diff --git a/config/locales/devise.views.en.yml b/config/locales/devise.views.en.yml index 793f3a0a..3dd666b1 100644 --- a/config/locales/devise.views.en.yml +++ b/config/locales/devise.views.en.yml @@ -104,6 +104,25 @@ en: new: sign_up: Sign up help: We only ask for an e-mail address and a password. The password is safely stored, no one else besides you knows it! You'll also receive an e-mail to confirm your account. + privacy_policy_accepted: + label: "I know about Sutty's privacy policy" + help: "Read privacy policy" + href: "https://sutty.nl/en/privacy-policy/" + required: true + terms_of_service_accepted: + label: "My sites won't promote hate towards minorities" + help: "Read terms of service" + href: "https://sutty.nl/en/terms-of-service/" + required: true + code_of_conduct_accepted: + label: "My sites are inclusive spaces" + help: "Read codes for sharing" + href: "https://sutty.nl/en/code-of-conduct/" + required: true + available_for_feedback_accepted: + label: "I'm available to provide feedback" + help: "We may contact you occasionaly" + required: false signed_up: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." signed_up_but_inactive: You have signed up successfully. However, we could not sign you in because your account is not yet activated. signed_up_but_locked: You have signed up successfully. However, we could not sign you in because your account is locked. diff --git a/config/locales/devise.views.es.yml b/config/locales/devise.views.es.yml index b745fc5f..c955373f 100644 --- a/config/locales/devise.views.es.yml +++ b/config/locales/devise.views.es.yml @@ -104,6 +104,24 @@ es: new: sign_up: Registrarme help: Para registrarte solo pedimos una dirección de correo y una contraseña. La contraseña se almacena de forma segura, ¡nadie más que vos la sabe! Recibirás un correo de confirmación de cuenta. + privacy_policy_accepted: + label: "Conozco la política de privacidad de Sutty" + help: "Leer política de privacidad" + href: "https://sutty.nl/politica-de-privacidad/" + required: "true" + terms_of_service_accepted: + label: "Mis sitios no promueven el odio a minorías" + help: "Leer términos de servicio" + href: "https://sutty.nl/terminos-de-servicio/" + required: "true" + code_of_conduct_accepted: + label: "Mis sitios son espacios inclusivos" + help: "Leer códigos para compartir" + href: "https://sutty.nl/codigo-de-convivencia/" + required: "true" + available_for_feedback_accepted: + label: "Estoy disponible para ofrecer retroalimentación" + help: "Te contactaremos ocasionalmente" signed_up: "Hemos enviado un mensaje con un enlace de confirmación a tu correo electrónico. Por favor, abrí el enlace para terminar de activar tu cuenta." signed_up_but_inactive: Tu cuenta ha sido creada correctamente. Sin embargo, no hemos podido iniciar la sesión porque tu cuenta aún no está activada. signed_up_but_locked: Tu cuenta ha sido creada correctamente. Sin embargo, no hemos podido iniciar la sesión porque que tu cuenta está bloqueada. From 8f0f260a4f9bd345eddcf66ab079da054d9d2a00 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 18:18:53 -0300 Subject: [PATCH 238/475] feat: almacenar los campos --- app/models/concerns/usuarie/consent.rb | 26 +++++++++++++++++++ app/models/usuarie.rb | 2 ++ app/views/devise/registrations/new.haml | 2 +- .../20230328200129_add_consent_to_usuaries.rb | 12 +++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 app/models/concerns/usuarie/consent.rb create mode 100644 db/migrate/20230328200129_add_consent_to_usuaries.rb diff --git a/app/models/concerns/usuarie/consent.rb b/app/models/concerns/usuarie/consent.rb new file mode 100644 index 00000000..14e67fbc --- /dev/null +++ b/app/models/concerns/usuarie/consent.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class Usuarie + # Gestiona los campos de consentimiento + module Consent + extend ActiveSupport::Concern + + included do + CONSENT_FIELDS = %i[privacy_policy_accepted terms_of_service_accepted code_of_conduct_accepted available_for_feedback_accepted] + + CONSENT_FIELDS.each do |field| + attribute field, :boolean + end + + before_save :update_consent_fields! + + private + + def update_consent_fields! + CONSENT_FIELDS.each do |field| + send(:"#{field}_at=", Time.now) if send(field).present? + end + end + end + end +end diff --git a/app/models/usuarie.rb b/app/models/usuarie.rb index 7b83ee75..9b9fd4e6 100644 --- a/app/models/usuarie.rb +++ b/app/models/usuarie.rb @@ -2,6 +2,8 @@ # Usuarie de la plataforma class Usuarie < ApplicationRecord + include Usuarie::Consent + devise :invitable, :database_authenticatable, :recoverable, :rememberable, :validatable, :confirmable, :lockable, :registerable diff --git a/app/views/devise/registrations/new.haml b/app/views/devise/registrations/new.haml index 75015831..04e81917 100644 --- a/app/views/devise/registrations/new.haml +++ b/app/views/devise/registrations/new.haml @@ -42,7 +42,7 @@ - if params[:consent] .form-group - - %i[privacy_policy_accepted terms_of_service_accepted code_of_conduct_accepted available_for_feedback_accepted].each do |field| + - Usuarie::CONSENT_FIELDS.each do |field| - required = t(".#{field}.required", default: '').present? - id = "usuarie_#{field}" - name = "usuarie[#{field}]" diff --git a/db/migrate/20230328200129_add_consent_to_usuaries.rb b/db/migrate/20230328200129_add_consent_to_usuaries.rb new file mode 100644 index 00000000..1e85864d --- /dev/null +++ b/db/migrate/20230328200129_add_consent_to_usuaries.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# Agrega consentimientos a les usuaries. No usamos un loop de +# Usuarie::CONSENT_FIELDS porque quizás agreguemos campos luego. +class AddConsentToUsuaries < ActiveRecord::Migration[6.1] + def change + add_column :usuaries, :privacy_policy_accepted_at, :datetime + add_column :usuaries, :terms_of_service_accepted_at, :datetime + add_column :usuaries, :code_of_conduct_accepted_at, :datetime + add_column :usuaries, :available_for_feedback_accepted_at, :datetime + end +end From 492d238f579b02f6a0ffdbe78e71f4b00c554ae8 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 18:33:19 -0300 Subject: [PATCH 239/475] =?UTF-8?q?BREAKING=20CHANGE:=20eliminar=20campo?= =?UTF-8?q?=20que=20no=20se=20us=C3=B3=20nunca?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...remove_acepta_politicas_de_privacidad_from_usuaries.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 db/migrate/20230328213242_remove_acepta_politicas_de_privacidad_from_usuaries.rb diff --git a/db/migrate/20230328213242_remove_acepta_politicas_de_privacidad_from_usuaries.rb b/db/migrate/20230328213242_remove_acepta_politicas_de_privacidad_from_usuaries.rb new file mode 100644 index 00000000..7ca562bf --- /dev/null +++ b/db/migrate/20230328213242_remove_acepta_politicas_de_privacidad_from_usuaries.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# Elimina un campo que nunca se usó +class RemoveAceptaPoliticasDePrivacidadFromUsuaries < ActiveRecord::Migration[6.1] + def change + remove_column :usuaries, :acepta_politicas_de_privacidad, :boolean, default: false + end +end From c66d1f0f087310085da99f8e76fb7389d783cbdc Mon Sep 17 00:00:00 2001 From: f Date: Wed, 29 Mar 2023 15:50:45 -0300 Subject: [PATCH 240/475] =?UTF-8?q?fix:=20mejorar=20la=20redacci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/devise.views.en.yml | 6 +++--- config/locales/devise.views.es.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/locales/devise.views.en.yml b/config/locales/devise.views.en.yml index 3dd666b1..a524cf7c 100644 --- a/config/locales/devise.views.en.yml +++ b/config/locales/devise.views.en.yml @@ -105,17 +105,17 @@ en: sign_up: Sign up help: We only ask for an e-mail address and a password. The password is safely stored, no one else besides you knows it! You'll also receive an e-mail to confirm your account. privacy_policy_accepted: - label: "I know about Sutty's privacy policy" + label: "I understand and accept the privacy policy" help: "Read privacy policy" href: "https://sutty.nl/en/privacy-policy/" required: true terms_of_service_accepted: - label: "My sites won't promote hate towards minorities" + label: "My sites won't promote hate speech" help: "Read terms of service" href: "https://sutty.nl/en/terms-of-service/" required: true code_of_conduct_accepted: - label: "My sites are inclusive spaces" + label: "I want a more inclusive Internet" help: "Read codes for sharing" href: "https://sutty.nl/en/code-of-conduct/" required: true diff --git a/config/locales/devise.views.es.yml b/config/locales/devise.views.es.yml index c955373f..4575c628 100644 --- a/config/locales/devise.views.es.yml +++ b/config/locales/devise.views.es.yml @@ -105,17 +105,17 @@ es: sign_up: Registrarme help: Para registrarte solo pedimos una dirección de correo y una contraseña. La contraseña se almacena de forma segura, ¡nadie más que vos la sabe! Recibirás un correo de confirmación de cuenta. privacy_policy_accepted: - label: "Conozco la política de privacidad de Sutty" + label: "Comprendo y acepto la política de privacidad" help: "Leer política de privacidad" href: "https://sutty.nl/politica-de-privacidad/" required: "true" terms_of_service_accepted: - label: "Mis sitios no promueven el odio a minorías" + label: "Mis sitios no promueven el discurso de odio" help: "Leer términos de servicio" href: "https://sutty.nl/terminos-de-servicio/" required: "true" code_of_conduct_accepted: - label: "Mis sitios son espacios inclusivos" + label: "Quiero una Internet más inclusiva" help: "Leer códigos para compartir" href: "https://sutty.nl/codigo-de-convivencia/" required: "true" From 414fd7348d7b5b3d9801ee7f8068c193b12d3df8 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 29 Mar 2023 15:51:10 -0300 Subject: [PATCH 241/475] fix: activarlo --- app/views/devise/registrations/new.haml | 27 ++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/app/views/devise/registrations/new.haml b/app/views/devise/registrations/new.haml index 04e81917..26fc8e18 100644 --- a/app/views/devise/registrations/new.haml +++ b/app/views/devise/registrations/new.haml @@ -40,20 +40,19 @@ aria: { describedby: 'minimum-password-length' }, placeholder: t("#{password}_confirmation") - - if params[:consent] - .form-group - - Usuarie::CONSENT_FIELDS.each do |field| - - required = t(".#{field}.required", default: '').present? - - id = "usuarie_#{field}" - - name = "usuarie[#{field}]" - - content = t(".#{field}.label") - - href = t(".#{field}.href", default: '') - - help_content = t(".#{field}.help") - = render 'bootstrap/custom_checkbox', id: id, name: name, content: content, required: required, value: "1" do - - if href.present? - = link_to help_content, href, target: '_blank', rel: 'noopener' - - else - = help_content + .form-group + - Usuarie::CONSENT_FIELDS.each do |field| + - required = t(".#{field}.required", default: '').present? + - id = "usuarie_#{field}" + - name = "usuarie[#{field}]" + - content = t(".#{field}.label") + - href = t(".#{field}.href", default: '') + - help_content = t(".#{field}.help") + = render 'bootstrap/custom_checkbox', id: id, name: name, content: content, required: required, value: "1" do + - if href.present? + = link_to help_content, href, target: '_blank', rel: 'noopener' + - else + = help_content .actions = f.submit t('.sign_up'), From 252652c94b2bff95ad0304422b73d7c19a6efa13 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 15 Mar 2022 16:03:16 -0300 Subject: [PATCH 242/475] poder ver la salida si lo ejecutamos desde la terminal --- app/models/deploy_local.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 71c23b36..bfde29f7 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -117,14 +117,6 @@ class DeployLocal < Deploy run %(gem install bundler --no-document), output: output end - def pnpm_lock - File.join(site.path, 'pnpm-lock.yaml') - end - - def pnpm_lock? - File.exist? pnpm_lock - end - # Corre yarn dentro del repositorio def yarn(output: false) return true unless yarn_lock? From 718463f0eae2255e7cb33cddb72a6ab4364b6405 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 15:28:46 -0300 Subject: [PATCH 243/475] feat: generar direcciones tor a demanda #12773 --- app/lib/hidden_service_client.rb | 13 +++++++++++++ app/models/deploy_hidden_service.rb | 21 ++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 app/lib/hidden_service_client.rb diff --git a/app/lib/hidden_service_client.rb b/app/lib/hidden_service_client.rb new file mode 100644 index 00000000..5715a869 --- /dev/null +++ b/app/lib/hidden_service_client.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require 'httparty' + +class HiddenServiceClient + include HTTParty + + base_uri ENV.fetch('HIDDEN_SERVICE', 'http://tor:3000') + + def create(name) + self.class.get("/#{name}").body + end +end diff --git a/app/models/deploy_hidden_service.rb b/app/models/deploy_hidden_service.rb index 79ff1bae..aa495baf 100644 --- a/app/models/deploy_hidden_service.rb +++ b/app/models/deploy_hidden_service.rb @@ -2,8 +2,12 @@ # Genera una versión onion class DeployHiddenService < DeployWww + store :values, accessors: %i[onion], coder: JSON + + before_create :create_hidden_service! + def fqdn - values[:onion].tap do |onion| + onion.tap do |onion| raise ArgumentError, 'Aun no se generó la dirección .onion' if onion.blank? end end @@ -11,4 +15,19 @@ class DeployHiddenService < DeployWww def url "http://#{fqdn}" end + + private + + def create_hidden_service! + onion_address = HiddenServiceClient.new.create(site.name) + + if ONION_RE =~ onion_address + self.onion = onion_address + + usuarie = GitAuthor.new email: "tor@#{Site.domain}", name: 'Tor' + params = { onion: onion_address, deploy: self } + + SiteService.new(site: site, usuarie: usuarie, params: params).add_onion + end + end end From 487765f7d88356b4d33242ca95c4487bb6488917 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 16:21:29 -0300 Subject: [PATCH 244/475] =?UTF-8?q?feat:=20validar=20y=20agregar=20la=20di?= =?UTF-8?q?recci=C3=B3n=20a=20la=20configuraci=C3=B3n=20del=20sitio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_hidden_service.rb | 2 ++ app/services/site_service.rb | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/models/deploy_hidden_service.rb b/app/models/deploy_hidden_service.rb index aa495baf..3356e815 100644 --- a/app/models/deploy_hidden_service.rb +++ b/app/models/deploy_hidden_service.rb @@ -6,6 +6,8 @@ class DeployHiddenService < DeployWww before_create :create_hidden_service! + ONION_RE = /\A[a-z0-9]{56}\.onion\z/.freeze + def fqdn onion.tap do |onion| raise ArgumentError, 'Aun no se generó la dirección .onion' if onion.blank? diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 848f3cfc..8ecc3f56 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -64,14 +64,11 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do # Agregar una dirección oculta de Tor al DeployHiddenService y a la # configuración del Site. def add_onion - onion = params[:onion].strip - deploy = DeployHiddenService.find_by(site: site) + onion = params[:onion] + deploy = params[:deploy] return false unless !onion.blank? && deploy - deploy.values[:onion] = onion - deploy.save - site.config['onion-location'] = onion site.config.write From 0002ed53a940f69da649ab3ebe4c1b90bb8c3433 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 16:22:02 -0300 Subject: [PATCH 245/475] BREAKING CHANGE: deprecar la api de onion --- app/controllers/api/v1/sites_controller.rb | 25 ---------------------- config/routes.rb | 2 -- 2 files changed, 27 deletions(-) diff --git a/app/controllers/api/v1/sites_controller.rb b/app/controllers/api/v1/sites_controller.rb index 10a92907..ae64cf74 100644 --- a/app/controllers/api/v1/sites_controller.rb +++ b/app/controllers/api/v1/sites_controller.rb @@ -12,31 +12,6 @@ module Api render json: sites_names + alternative_names + api_names + www_names end - # Sitios con hidden service de Tor - # - # @return [Array] lista de nombres de sitios sin onion aun - def hidden_services - render json: DeployHiddenService.where(values: nil).includes(:site).pluck(:name) - end - - # Tor va a enviar el onion junto con el nombre del sitio y tenemos - # que guardarlo en su deploy_hidden_service. - # - # @params [String] name - # @params [String] onion - def add_onion - site = Site.find_by(name: params[:name]) - - if site - usuarie = GitAuthor.new email: "tor@#{Site.domain}", name: 'Tor' - service = SiteService.new site: site, usuarie: usuarie, - params: params - service.add_onion - end - - head :ok - end - private def canonicalize(name) diff --git a/config/routes.rb b/config/routes.rb index a132135a..511ca654 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,8 +11,6 @@ Rails.application.routes.draw do namespace :v1 do resources :csp_reports, only: %i[create] - get :'sites/hidden_services', to: 'sites#hidden_services' - post :'sites/add_onion', to: 'sites#add_onion' resources :sites, only: %i[index], constraints: { site_id: /[a-z0-9\-.]+/, id: /[a-z0-9\-.]+/ } do get :'invitades/cookie', to: 'invitades#cookie' post :'posts/:layout', to: 'posts#create', as: :posts From 2f745886f5240a7b4f524155f505900ef54932fd Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 16:22:58 -0300 Subject: [PATCH 246/475] =?UTF-8?q?fix:=20reintentar=20si=20fall=C3=B3=20l?= =?UTF-8?q?a=20generaci=C3=B3n=20en=20el=20pasado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_hidden_service.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/deploy_hidden_service.rb b/app/models/deploy_hidden_service.rb index 3356e815..25c0c217 100644 --- a/app/models/deploy_hidden_service.rb +++ b/app/models/deploy_hidden_service.rb @@ -9,6 +9,8 @@ class DeployHiddenService < DeployWww ONION_RE = /\A[a-z0-9]{56}\.onion\z/.freeze def fqdn + create_hidden_service! if onion.blank? + onion.tap do |onion| raise ArgumentError, 'Aun no se generó la dirección .onion' if onion.blank? end From 20e8e83ab601168214974333e69a2968970a9c2a Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 13:28:01 -0300 Subject: [PATCH 247/475] feat: notificar errores de que --- config/initializers/que.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 config/initializers/que.rb diff --git a/config/initializers/que.rb b/config/initializers/que.rb new file mode 100644 index 00000000..d7abfeb5 --- /dev/null +++ b/config/initializers/que.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +ActiveJob::Serializers.add_serializers ActiveJob::Serializers::ExceptionSerializer + +# Notificar los errores +Que.error_notifier = proc do |error, job| + ExceptionNotifier.notify_exception(error, data: (job || {})) +end From a58936b22ecc2e70903c89d8dcf8e501d00f6642 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 13:28:32 -0300 Subject: [PATCH 248/475] =?UTF-8?q?fix:=20retomar=20la=20publicaci=C3=B3n?= =?UTF-8?q?=20de=20cambios=20#12958?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/deploy_job.rb | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index aeb0f4b6..a7f59afb 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -4,9 +4,23 @@ class DeployJob < ApplicationJob class DeployException < StandardError; end class DeployTimedOutException < DeployException; end + class DeployAlreadyRunningException < DeployException; end discard_on ActiveRecord::RecordNotFound + # Lanzar lo antes posible + self.priority = 10 + # Intentar dentro de un minuto + self.retry_interval = 60 + + def handle_error(error) + case error + when DeployAlreadyRunningException then retry_in 1.minute + when DeployTimedOutException then expire + else super + end + end + # rubocop:disable Metrics/MethodLength def perform(site, notify: true, time: Time.now, output: false) @output = output @@ -20,14 +34,14 @@ class DeployJob < ApplicationJob # Como el trabajo actual se aplaza al siguiente, arrastrar la # hora original para poder ir haciendo timeouts. if @site.building? + notify = false + if 10.minutes.ago >= time - notify = false raise DeployTimedOutException, "#{@site.name} la tarea estuvo más de 10 minutos esperando, volviendo al estado original" + else + raise DeployAlreadyRunningException end - - DeployJob.perform_in(60, site, notify: notify, time: time, output: output) - return end @deployed = {} @@ -67,8 +81,6 @@ class DeployJob < ApplicationJob t << ([type.to_s] + row.values) end end) - rescue DeployTimedOutException => e - notify_exception e ensure if @site.present? @site.update status: 'waiting' From 79f3958a0697d16c59b079da86db601bdf1abf90 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 16:53:35 -0300 Subject: [PATCH 249/475] fix: que no expone este metodo en activejob --- app/jobs/deploy_job.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index a7f59afb..a5cda360 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -10,8 +10,6 @@ class DeployJob < ApplicationJob # Lanzar lo antes posible self.priority = 10 - # Intentar dentro de un minuto - self.retry_interval = 60 def handle_error(error) case error From 6c1dcf5ded419363690844a3a66eda6047c9d0bd Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 17:31:26 -0300 Subject: [PATCH 250/475] =?UTF-8?q?fix:=20evitar=20errores=20de=20serializ?= =?UTF-8?q?aci=C3=B3n=20#12998?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `que` falla silenciosamente cuando no puede serializar errores para enviar, que es la mayor parte de las veces. enviar los errores sincronicamente excepto los de airbrake --- app/lib/exception_notifier/gitlab_notifier.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/lib/exception_notifier/gitlab_notifier.rb b/app/lib/exception_notifier/gitlab_notifier.rb index 18bfc6d4..8152bb62 100644 --- a/app/lib/exception_notifier/gitlab_notifier.rb +++ b/app/lib/exception_notifier/gitlab_notifier.rb @@ -11,7 +11,12 @@ module ExceptionNotifier # @param [Exception] # @param [Hash] def call(exception, **options) - GitlabNotifierJob.perform_async(exception, **options) + case exception + when BacktraceJob::BacktraceException + GitlabNotifierJob.perform_later(exception, **options) + else + GitlabNotifierJob.perform_now(exception, **options) + end end end end From 482a63720793508f03e8756d575ea2d39021ff5d Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 17:33:07 -0300 Subject: [PATCH 251/475] fix: perform_later --- app/controllers/api/v1/contact_controller.rb | 2 +- app/jobs/maintenance_job.rb | 2 +- app/models/log_entry.rb | 2 +- app/services/site_service.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/v1/contact_controller.rb b/app/controllers/api/v1/contact_controller.rb index deacf4a7..d949dc30 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_async site.id, + ContactJob.perform_later site.id, params[:form], contact_params.to_h.symbolize_keys, params[:redirect] diff --git a/app/jobs/maintenance_job.rb b/app/jobs/maintenance_job.rb index 4c411d0e..c7a962f9 100644 --- a/app/jobs/maintenance_job.rb +++ b/app/jobs/maintenance_job.rb @@ -10,7 +10,7 @@ # bundle exec rails c # m = Maintenance.create message_en: 'reason', message_es: 'razón', # estimated_from: Time.now, estimated_to: Time.now + 1.hour -# MaintenanceJob.perform_async(maintenance_id: m.id) +# MaintenanceJob.perform_later(maintenance_id: m.id) # # Lo mismo para salir de mantenimiento, agregando el atributo # are_we_back: true al crear el Maintenance. diff --git a/app/models/log_entry.rb b/app/models/log_entry.rb index 1824da55..9685e0d0 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_async site_id, params[:form], params + ContactJob.perform_later site_id, params[:form], params end def params diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 8ecc3f56..5d28bf91 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_async site.id + DeployJob.perform_later site.id end # Crea un sitio, agrega un rol nuevo y guarda los cambios a la From 1e79e2687295d8c12ded65c0ccb2e82f8f144346 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 17:38:16 -0300 Subject: [PATCH 252/475] fix: ignorar las excepciones de publicaciones duplicadas --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index d121bdbd..653ca8aa 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -147,7 +147,7 @@ Rails.application.configure do } config.action_mailer.default_options = { from: ENV.fetch('DEFAULT_FROM', "noreply@sutty.nl") } - config.middleware.use ExceptionNotification::Rack, gitlab: {} + config.middleware.use ExceptionNotification::Rack, gitlab: {}, ignore_exceptions: (['DeployJob::DeployAlreadyRunningException'] + ExceptionNotifier.ignored_exceptions) Rails.application.routes.default_url_options[:host] = "panel.#{ENV.fetch('SUTTY', 'sutty.nl')}" Rails.application.routes.default_url_options[:protocol] = 'https' From 2086ade1a7d4acf92b5a7df4e3fca9867c25aa3d Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 18:21:33 -0300 Subject: [PATCH 253/475] =?UTF-8?q?fix:=20solo=20permitir=20subir=20im?= =?UTF-8?q?=C3=A1genes=20para=20web=20#13009?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/posts/attributes/_image.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/posts/attributes/_image.haml b/app/views/posts/attributes/_image.haml index f4d9bb3d..84fe56fd 100644 --- a/app/views/posts/attributes/_image.haml +++ b/app/views/posts/attributes/_image.haml @@ -22,7 +22,7 @@ = file_field(*field_name_for(base, attribute, :path), **field_options(attribute, metadata, required: (metadata.required && !metadata.path?)), class: "custom-file-input #{invalid(post, attribute)}", - accept: 'image/*', data: { preview: "#{attribute}-preview" }) + accept: ActiveStorage.web_image_content_types.join(','), data: { preview: "#{attribute}-preview" }) = label_tag "#{base}_#{attribute}_path", post_label_t(attribute, :path, post: post), class: 'custom-file-label' = render 'posts/attribute_feedback', From 563060e1132df7db6aa3e13a8323ed9144a80e8a Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 18:22:49 -0300 Subject: [PATCH 254/475] feat: permitir subir webp --- config/application.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/application.rb b/config/application.rb index 97ab244c..941caa68 100644 --- a/config/application.rb +++ b/config/application.rb @@ -37,6 +37,7 @@ module Sutty .rescue_responses['Pundit::NotAuthorizedError'] = :forbidden config.active_storage.variant_processor = :vips + config.active_storage.web_image_content_types << 'image/webp' config.to_prepare do # Load application's model / class decorators From f2b6e2929c317c9ad1b216e7d3ae59fdba85c747 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 18:29:13 -0300 Subject: [PATCH 255/475] =?UTF-8?q?fix:=20informar=20cu=C3=A1les=20formato?= =?UTF-8?q?s=20aceptamos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ddf681d..50392ed3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -50,7 +50,7 @@ en: cant_be_empty: 'This field cannot be empty' image: site_invalid: 'The image cannot be stored if the site configuration is not valid' - not_an_image: 'Not an image' + not_an_image: 'Not a web image. Accepted formats: PNG, JPEG, GIF, WEBP' path_required: 'Missing image for upload' no_file_for_description: "Description with no associated image" attachment_missing: "I couldn't save the image :(" diff --git a/config/locales/es.yml b/config/locales/es.yml index 01f1085c..340e3d6a 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -50,7 +50,7 @@ es: cant_be_empty: 'El campo no puede estar vacío' image: site_invalid: 'La imagen no se puede almacenar si la configuración del sitio no es válida' - not_an_image: 'No es una imagen' + not_an_image: 'No es una imagen en formato web. Formatos aceptados: PNG, JPEG, GIF, WEBP' path_required: 'Se necesita una imagen' no_file_for_description: 'Se envió una descripción sin imagen asociada' attachment_missing: 'no pude guardar el archivo :(' From 83a16c7b94b8336f10a547bc26e6200c75c5c728 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 18:36:03 -0300 Subject: [PATCH 256/475] fix: typo #13008 --- config/locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ddf681d..7befed7a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -516,7 +516,7 @@ en: file: destroy: Remove file image: - label: Imagen + label: Image destroy: Remove image belongs_to: empty: "(Empty)" From d84975a61ada0783edc82ed5f948b0355e1a6c5a Mon Sep 17 00:00:00 2001 From: f Date: Tue, 11 Apr 2023 10:42:07 -0300 Subject: [PATCH 257/475] feat: poder hacer git lfs checkout --- app/models/deploy_local.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index bfde29f7..ee06fa4e 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -14,6 +14,7 @@ class DeployLocal < Deploy # Sutty def deploy(output: false) return false unless mkdir + return false unless git_lfs(output: output) return false unless yarn(output: output) return false unless pnpm(output: output) return false unless bundle(output: output) @@ -113,6 +114,11 @@ class DeployLocal < Deploy File.exist? pnpm_lock end + def git_lfs(output: false) + run %(git lfs fetch), output: output + run %(git lfs checkout), output: output + end + def gem(output: false) run %(gem install bundler --no-document), output: output end From 1c5dd603e5890b32eaf864e11213206229d3f78a Mon Sep 17 00:00:00 2001 From: f Date: Tue, 11 Apr 2023 10:42:33 -0300 Subject: [PATCH 258/475] fix: hacer git lfs checkout despues de clonar el sitio #13022 --- app/models/site.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/site.rb b/app/models/site.rb index 3f2aa34e..9a6a3865 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -473,6 +473,8 @@ class Site < ApplicationRecord return if jekyll? Rugged::Repository.clone_at ENV['SKEL_SUTTY'], path + + deploys.find_by_type('DeployLocal').send(:git_lfs) end # Elimina el directorio del sitio From 9e177a2257db47eddaf7f70f90ce98d5b7e09bbe Mon Sep 17 00:00:00 2001 From: f Date: Tue, 11 Apr 2023 10:48:00 -0300 Subject: [PATCH 259/475] fix: correr lfs junto con las gemas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit esto es una solución temporal! --- app/models/site.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/site.rb b/app/models/site.rb index 9a6a3865..6ac10329 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -473,8 +473,6 @@ class Site < ApplicationRecord return if jekyll? Rugged::Repository.clone_at ENV['SKEL_SUTTY'], path - - deploys.find_by_type('DeployLocal').send(:git_lfs) end # Elimina el directorio del sitio @@ -566,6 +564,8 @@ class Site < ApplicationRecord def install_gems return unless persisted? + deploys.find_by_type('DeployLocal').send(:git_lfs) + if !gem_dir? || gemfile_updated? || gemfile_lock_updated? deploys.find_by_type('DeployLocal').send(:bundle) touch From 9aa99e27540fa4e6559cdc8bb3b340a1a3742891 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 11 Apr 2023 12:09:13 -0300 Subject: [PATCH 260/475] feat: establecer los metadatos para cambiar el idioma #12925 --- app/views/layouts/_link_rel_alternate.haml | 7 +++++++ app/views/layouts/application.html.haml | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 app/views/layouts/_link_rel_alternate.haml diff --git a/app/views/layouts/_link_rel_alternate.haml b/app/views/layouts/_link_rel_alternate.haml new file mode 100644 index 00000000..64a70977 --- /dev/null +++ b/app/views/layouts/_link_rel_alternate.haml @@ -0,0 +1,7 @@ +- unless current_usuarie + - params.permit! + - I18n.available_locales.each do |locale| + - url = url_for(**params.to_h.merge(change_locale_to: locale), only_path: false) + - if locale == I18n.default_locale + %link{ rel: 'alternate', hreflang: 'x-default', href: url } + %link{ rel: 'alternate', hreflang: locale, href: url } diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 965a856f..d2113398 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -4,7 +4,7 @@ %meta{ charset: 'UTF-8' }/ %meta{ content: 'text/html; charset=UTF-8', 'http-equiv': 'Content-Type' }/ - %meta{ name: 'color-scheme', content: 'light dark' }/ + %meta{ name: 'color-scheme', content: 'light' }/ %meta{ name: 'viewport', content: 'width=device-width, initial-scale=1.0' }/ %meta{ name: 'referrer', content: 'same-origin' }/ @@ -17,6 +17,7 @@ = javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' = 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' %body{ class: yield(:body) } .container-fluid#sutty From 556a0541a57ecd607716b22b39496e1ddf34abb1 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 11 Apr 2023 16:19:49 -0300 Subject: [PATCH 261/475] =?UTF-8?q?feat:=20agregar=20las=20columnas=20para?= =?UTF-8?q?=20la=20recolecci=C3=B3n=20de=20datos=20#13029?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20230411185406_add_sustainability_to_access_logs.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 db/migrate/20230411185406_add_sustainability_to_access_logs.rb diff --git a/db/migrate/20230411185406_add_sustainability_to_access_logs.rb b/db/migrate/20230411185406_add_sustainability_to_access_logs.rb new file mode 100644 index 00000000..80f16fb5 --- /dev/null +++ b/db/migrate/20230411185406_add_sustainability_to_access_logs.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +# Agrega las columnas de calculo de emisiones de CO2 +class AddSustainabilityToAccessLogs < ActiveRecord::Migration[6.1] + def change + %i[datacenter_co2 network_co2 consumer_device_co2 production_co2 total_co2].each do |column| + add_column :access_logs, column, :decimal, limit: 53 + end + end +end From 030a64a31cc88eda93d2149a2e86d55677b25be7 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 11 Apr 2023 16:37:24 -0300 Subject: [PATCH 262/475] fix: generar una imagen por rama --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 2e775624..dfade89d 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -6,7 +6,7 @@ pipeline: username: "sutty" repo: "gitea.nulo.in/sutty/panel" tags: - - "${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}" + - "${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}-${CI_COMMIT_BRANCH}" - "latest" build_args: - "RUBY_VERSION=${RUBY_VERSION}" From 8f1c38b8fc770219cb4a0819a4c9ac7a9cf786ad Mon Sep 17 00:00:00 2001 From: f Date: Tue, 11 Apr 2023 16:39:10 -0300 Subject: [PATCH 263/475] fix: correr la ci cuando cambia --- .woodpecker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index dfade89d..cdd99651 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -25,6 +25,7 @@ pipeline: include: - "Dockerfile" - ".dockerignore" + - ".woodpecker.yml" assets: image: "gitea.nulo.in/sutty/panel:${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}" commands: From 991624b951f7ab2141e147f50e1165a709cb0701 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 11 Apr 2023 17:45:01 -0300 Subject: [PATCH 264/475] feat: no instalar otras gemas que las especificadas sutty/skel.sutty.nl#7 --- app/models/deploy_local.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index bfde29f7..69f1c030 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -132,7 +132,7 @@ class DeployLocal < Deploy end def bundle(output: false) - run %(bundle install --no-cache --path="#{gems_dir}" --clean --without test development), output: output + run %(bundle install --deployment --no-cache --path="#{gems_dir}" --clean --without test development), output: output end def jekyll_build(output: false) From 8457a07664ea914f4d18ef0d1cf39fffcfc4d8a9 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 11 Apr 2023 17:49:45 -0300 Subject: [PATCH 265/475] fix: al usar alert tenemos que cambiar i18n #13034 --- app/views/posts/_submit.haml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/posts/_submit.haml b/app/views/posts/_submit.haml index cad43320..944694c1 100644 --- a/app/views/posts/_submit.haml +++ b/app/views/posts/_submit.haml @@ -1,6 +1,8 @@ +- invalid_help = site.config.fetch('invalid_help', t('.invalid_help')) +- sending_help = site.config.fetch('sending_help', t('.sending_help')) .form-group = submit_tag t('.save'), class: 'btn submit-post' = render 'bootstrap/alert', class: 'invalid-help d-none' do - = site.config.fetch('invalid_help', t('.invalid_help')) + = invalid_help = render 'bootstrap/alert', class: 'sending-help d-none' do - = site.config.fetch('sending_help', t('.sending_help')) + = sending_help From f5aae98b91d0b8c269f461a804674de0f4ae7af4 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 13 Apr 2023 14:25:56 -0300 Subject: [PATCH 266/475] =?UTF-8?q?feat:=20mover=20el=20bot=C3=B3n=20de=20?= =?UTF-8?q?publicaci=C3=B3n=20a=20una=20zona=20m=C3=A1s=20visible=20#13071?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/posts/index.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 4f814cda..49a55f55 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -5,6 +5,8 @@ - cache_if @usuarie, [@site, I18n.locale] do = render 'sites/status', site: @site + = render 'sites/build', site: @site + %h3= t('posts.new') %table.mb-3 - @site.layouts.sort_by(&:humanized_name).each do |layout| @@ -33,8 +35,6 @@ type: 'info', link: site_usuaries_path(@site) - = render 'sites/build', site: @site - - if @site.design.credits = render 'bootstrap/alert' do = sanitize_markdown @site.design.credits From 8aed1edaff81544ecfd6ac21559db5af5048229b Mon Sep 17 00:00:00 2001 From: f Date: Thu, 13 Apr 2023 14:27:51 -0300 Subject: [PATCH 267/475] feat: ocupar todo el ancho --- app/views/posts/index.haml | 2 +- app/views/sites/_build.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 49a55f55..591f5795 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -5,7 +5,7 @@ - cache_if @usuarie, [@site, I18n.locale] do = render 'sites/status', site: @site - = render 'sites/build', site: @site + = render 'sites/build', site: @site, class: 'btn-block' %h3= t('posts.new') %table.mb-3 diff --git a/app/views/sites/_build.haml b/app/views/sites/_build.haml index 6bc4d11b..5911e908 100644 --- a/app/views/sites/_build.haml +++ b/app/views/sites/_build.haml @@ -3,7 +3,7 @@ method: :post, class: 'form-inline inline' do = submit_tag site.enqueued? ? t('sites.enqueued') : t('sites.enqueue'), - class: 'btn no-border-radius', + class: "btn no-border-radius #{local_assigns[:class]}", title: site.enqueued? ? t('help.sites.enqueued') : t('help.sites.enqueue'), data: { disable_with: t('sites.enqueued') }, disabled: site.enqueued? From 6e567787681b5177e31e0ccef83b52e54635cb9b Mon Sep 17 00:00:00 2001 From: f Date: Sat, 15 Apr 2023 11:16:58 -0300 Subject: [PATCH 268/475] fix: renovar el token #13105 `touch` no corre `before_save`, con lo que el token nunca se renovaba --- app/jobs/renew_distributed_press_tokens_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/renew_distributed_press_tokens_job.rb b/app/jobs/renew_distributed_press_tokens_job.rb index 5664d9fa..86086ac7 100644 --- a/app/jobs/renew_distributed_press_tokens_job.rb +++ b/app/jobs/renew_distributed_press_tokens_job.rb @@ -7,7 +7,7 @@ class RenewDistributedPressTokensJob < ApplicationJob # detener la tarea si algo pasa. def perform DistributedPressPublisher.with_about_to_expire_tokens.find_each do |publisher| - publisher.touch + publisher.save rescue DistributedPress::V1::Error => e data = { instance: publisher.instance, expires_at: publisher.client.token.expires_at } From aa0cd9d6a301cc955632a42afe442093d3e97521 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 15 Apr 2023 12:23:43 -0300 Subject: [PATCH 269/475] =?UTF-8?q?ci:=20compilar=20assets=20tambi=C3=A9n?= =?UTF-8?q?=20en=20gitlab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..41b504ac --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,33 @@ +image: "gitea.nulo.in/sutty/panel:3.14.10-2.7.8-panel.sutty.nl" +variables: + RAILS_ENV: "production" + LC_ALL: "C.UTF-8" +cache: + paths: + - "vendor/ruby" +assets: + stage: "assets" + rules: + - if: "$CI_COMMIT_BRANCH == panel.sutty.nl" + - if: "$CI_COMMIT_BRANCH" + changes: + compares_to: "refs/heads/rails" + paths: + - "package.json" + - "app/javascript/**/*" + - "app/assets/**/*" + 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_USERNAME}:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git\"" + - "apk add python2 dotenv brotli" + - "mv config/credentials.yml.enc.ci config/credentials.yml.enc" + - "cp .env.example .env" + - "dotenv bundle install --path=vendor" + script: + - "dotenv RAILS_ENV=production bundle exec rails webpacker:clobber" + - "dotenv RAILS_ENV=production bundle exec rails assets:precompile" + - "dotenv RAILS_ENV=production bundle exec rails assets:clean" + after_script: + - "git add public && git commit -m \"ci: assets [skip ci]\"" + - "git push -o ci.skip" From e85ce7c883746dcb79c514814e45f50e8e5e481a Mon Sep 17 00:00:00 2001 From: f Date: Sat, 15 Apr 2023 12:28:37 -0300 Subject: [PATCH 270/475] ci: typo --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 41b504ac..7c09d65f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,7 +11,7 @@ assets: - if: "$CI_COMMIT_BRANCH == panel.sutty.nl" - if: "$CI_COMMIT_BRANCH" changes: - compares_to: "refs/heads/rails" + compare_to: "refs/heads/rails" paths: - "package.json" - "app/javascript/**/*" From 1231f3bdab0d608e258b2cd25f59e509a2106f4d Mon Sep 17 00:00:00 2001 From: f Date: Sat, 15 Apr 2023 12:31:12 -0300 Subject: [PATCH 271/475] ci: comillas --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7c09d65f..bd9a3903 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,7 +8,7 @@ cache: assets: stage: "assets" rules: - - if: "$CI_COMMIT_BRANCH == panel.sutty.nl" + - if: "$CI_COMMIT_BRANCH == \"panel.sutty.nl\"" - if: "$CI_COMMIT_BRANCH" changes: compare_to: "refs/heads/rails" From 29f4c7a847d191b66c249501d31546b6e7890d91 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 15 Apr 2023 12:31:52 -0300 Subject: [PATCH 272/475] =?UTF-8?q?ci:=20estad=C3=ADo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bd9a3903..f8994356 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,7 @@ cache: paths: - "vendor/ruby" assets: - stage: "assets" + stage: "build" rules: - if: "$CI_COMMIT_BRANCH == \"panel.sutty.nl\"" - if: "$CI_COMMIT_BRANCH" From d59fa43082a119eb2f0a478d14539ba76436d29a Mon Sep 17 00:00:00 2001 From: jazzari Date: Sat, 15 Apr 2023 13:31:09 -0300 Subject: [PATCH 273/475] feat: reorder template designs according to complexity # 13091 --- app/views/sites/_form.haml | 2 +- .../20230415153231_add_priority_to_designs.rb | 5 + db/schema.rb | 222 +++++++++++++++++- db/seeds/designs.yml | 11 +- 4 files changed, 235 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20230415153231_add_priority_to_designs.rb diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index 001f542e..50391871 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -55,7 +55,7 @@ layouts: site.incompatible_layouts.to_sentence) .row.row-cols-1.row-cols-md-2.designs -# Demasiado complejo para un f.collection_radio_buttons - - Design.all.find_each do |design| + - Design.all.order(priority: :desc).find_each do |design| .design.col.d-flex.flex-column .custom-control.custom-radio = f.radio_button :design_id, design.id, diff --git a/db/migrate/20230415153231_add_priority_to_designs.rb b/db/migrate/20230415153231_add_priority_to_designs.rb new file mode 100644 index 00000000..7fc45558 --- /dev/null +++ b/db/migrate/20230415153231_add_priority_to_designs.rb @@ -0,0 +1,5 @@ +class AddPriorityToDesigns < ActiveRecord::Migration[6.1] + def change + add_column :designs, :priority, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index a395329d..f659f11d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_10_22_225449) do +ActiveRecord::Schema.define(version: 2023_04_15_153231) do # These are extensions that must be enabled in order to support this database enable_extension "pg_trgm" @@ -65,6 +65,11 @@ ActiveRecord::Schema.define(version: 2021_10_22_225449) do t.boolean "crawler", default: false t.string "http_referer" t.datetime "created_at", precision: 6 + t.decimal "datacenter_co2" + t.decimal "network_co2" + t.decimal "consumer_device_co2" + t.decimal "production_co2" + t.decimal "total_co2" t.index ["geoip2_data_city_name"], name: "index_access_logs_on_geoip2_data_city_name" t.index ["geoip2_data_country_name"], name: "index_access_logs_on_geoip2_data_country_name" t.index ["host"], name: "index_access_logs_on_host" @@ -103,7 +108,7 @@ ActiveRecord::Schema.define(version: 2021_10_22_225449) do t.string "checksum", null: false t.datetime "created_at", null: false t.string "service_name", null: false - t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true + t.index ["key", "service_name"], name: "index_active_storage_blobs_on_key_and_service_name", unique: true end create_table "active_storage_variant_records", force: :cascade do |t| @@ -179,6 +184,14 @@ ActiveRecord::Schema.define(version: 2021_10_22_225449) do t.index ["deploy_id"], name: "index_build_stats_on_deploy_id" end + create_table "codes_of_conduct", force: :cascade do |t| + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.string "title" + t.text "description" + t.text "content" + end + create_table "csp_reports", id: :uuid, default: nil, force: :cascade do |t| t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false @@ -217,6 +230,15 @@ ActiveRecord::Schema.define(version: 2021_10_22_225449) do t.boolean "disabled", default: false t.text "credits" t.string "designer_url" + t.integer "priority" + end + + create_table "distributed_press_publishers", force: :cascade do |t| + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.string "instance" + t.text "token_ciphertext", null: false + t.datetime "expires_at" end create_table "indexed_posts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -232,6 +254,7 @@ ActiveRecord::Schema.define(version: 2021_10_22_225449) do t.tsvector "indexed_content" t.integer "order", default: 0 t.string "dictionary" + t.uuid "post_id" t.index ["front_matter"], name: "index_indexed_posts_on_front_matter", using: :gin t.index ["indexed_content"], name: "index_indexed_posts_on_indexed_content", using: :gin t.index ["layout"], name: "index_indexed_posts_on_layout" @@ -247,6 +270,7 @@ ActiveRecord::Schema.define(version: 2021_10_22_225449) do t.text "deed" t.string "url" t.string "icons" + t.string "short_description" end create_table "log_entries", force: :cascade do |t| @@ -292,6 +316,56 @@ ActiveRecord::Schema.define(version: 2021_10_22_225449) do t.index ["translatable_id", "translatable_type", "locale", "key"], name: "index_mobility_text_translations_on_keys", unique: true end + create_table "privacy_policies", force: :cascade do |t| + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.string "title" + t.text "description" + t.text "content" + end + + create_table "que_jobs", comment: "7", force: :cascade do |t| + t.integer "priority", limit: 2, default: 100, null: false + t.datetime "run_at", default: -> { "now()" }, null: false + t.text "job_class", null: false + t.integer "error_count", default: 0, null: false + t.text "last_error_message" + t.text "queue", default: "default", null: false + t.text "last_error_backtrace" + t.datetime "finished_at" + t.datetime "expired_at" + t.jsonb "args", default: [], null: false + t.jsonb "data", default: {}, null: false + t.integer "job_schema_version", null: false + t.jsonb "kwargs", default: {}, null: false + t.index ["args"], name: "que_jobs_args_gin_idx", opclass: :jsonb_path_ops, using: :gin + t.index ["data"], name: "que_jobs_data_gin_idx", opclass: :jsonb_path_ops, using: :gin + t.index ["job_schema_version", "queue", "priority", "run_at", "id"], name: "que_poll_idx", where: "((finished_at IS NULL) AND (expired_at IS NULL))" + t.index ["kwargs"], name: "que_jobs_kwargs_gin_idx", opclass: :jsonb_path_ops, using: :gin + t.check_constraint "(char_length(last_error_message) <= 500) AND (char_length(last_error_backtrace) <= 10000)", name: "error_length" + t.check_constraint "(jsonb_typeof(data) = 'object'::text) AND ((NOT (data ? 'tags'::text)) OR ((jsonb_typeof((data -> 'tags'::text)) = 'array'::text) AND (jsonb_array_length((data -> 'tags'::text)) <= 5) AND que_validate_tags((data -> 'tags'::text))))", name: "valid_data" + t.check_constraint "char_length(queue) <= 100", name: "queue_length" + t.check_constraint "jsonb_typeof(args) = 'array'::text", name: "valid_args" + t.check_constraint nil, name: "job_class_length" + end + + create_table "que_lockers", primary_key: "pid", id: :integer, default: nil, force: :cascade do |t| + t.integer "worker_count", null: false + t.integer "worker_priorities", null: false, array: true + t.integer "ruby_pid", null: false + t.text "ruby_hostname", null: false + t.text "queues", null: false, array: true + t.boolean "listening", null: false + t.integer "job_schema_version", default: 1 + t.check_constraint "(array_ndims(queues) = 1) AND (array_length(queues, 1) IS NOT NULL)", name: "valid_queues" + t.check_constraint "(array_ndims(worker_priorities) = 1) AND (array_length(worker_priorities, 1) IS NOT NULL)", name: "valid_worker_priorities" + end + + create_table "que_values", primary_key: "key", id: :text, force: :cascade do |t| + t.jsonb "value", default: {}, null: false + t.check_constraint "jsonb_typeof(value) = 'object'::text", name: "valid_value" + end + create_table "roles", force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -329,6 +403,7 @@ ActiveRecord::Schema.define(version: 2021_10_22_225449) do t.string "tienda_api_key_ciphertext", default: "" t.string "tienda_url", default: "" t.string "api_key_ciphertext" + t.string "slugify_mode", default: "default" t.index ["design_id"], name: "index_sites_on_design_id" t.index ["licencia_id"], name: "index_sites_on_licencia_id" t.index ["name"], name: "index_sites_on_name", unique: true @@ -358,7 +433,6 @@ ActiveRecord::Schema.define(version: 2021_10_22_225449) do t.integer "failed_attempts", default: 0, null: false t.string "unlock_token" t.datetime "locked_at" - t.boolean "acepta_politicas_de_privacidad", default: false t.string "invitation_token" t.datetime "invitation_created_at" t.datetime "invitation_sent_at" @@ -368,6 +442,10 @@ ActiveRecord::Schema.define(version: 2021_10_22_225449) do t.bigint "invited_by_id" t.integer "invitations_count", default: 0 t.string "lang", default: "es" + t.datetime "privacy_policy_accepted_at" + t.datetime "terms_of_service_accepted_at" + t.datetime "code_of_conduct_accepted_at" + t.datetime "available_for_feedback_accepted_at" t.index ["confirmation_token"], name: "index_usuaries_on_confirmation_token", unique: true t.index ["email"], name: "index_usuaries_on_email", unique: true t.index ["invitation_token"], name: "index_usuaries_on_invitation_token", unique: true @@ -380,6 +458,144 @@ ActiveRecord::Schema.define(version: 2021_10_22_225449) do add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" + # no candidate create_trigger statement could be found, creating an adapter-specific one + execute(<<-SQL) +CREATE OR REPLACE FUNCTION public.que_job_notify() + RETURNS trigger + LANGUAGE plpgsql +AS $function$ + DECLARE + locker_pid integer; + sort_key json; + BEGIN + -- Don't do anything if the job is scheduled for a future time. + IF NEW.run_at IS NOT NULL AND NEW.run_at > now() THEN + RETURN null; + END IF; + + -- Pick a locker to notify of the job's insertion, weighted by their number + -- of workers. Should bounce pseudorandomly between lockers on each + -- invocation, hence the md5-ordering, but still touch each one equally, + -- hence the modulo using the job_id. + SELECT pid + INTO locker_pid + FROM ( + SELECT *, last_value(row_number) OVER () + 1 AS count + FROM ( + SELECT *, row_number() OVER () - 1 AS row_number + FROM ( + SELECT * + FROM public.que_lockers ql, generate_series(1, ql.worker_count) AS id + WHERE + listening AND + queues @> ARRAY[NEW.queue] AND + ql.job_schema_version = NEW.job_schema_version + ORDER BY md5(pid::text || id::text) + ) t1 + ) t2 + ) t3 + WHERE NEW.id % count = row_number; + + IF locker_pid IS NOT NULL THEN + -- There's a size limit to what can be broadcast via LISTEN/NOTIFY, so + -- rather than throw errors when someone enqueues a big job, just + -- broadcast the most pertinent information, and let the locker query for + -- the record after it's taken the lock. The worker will have to hit the + -- DB in order to make sure the job is still visible anyway. + SELECT row_to_json(t) + INTO sort_key + FROM ( + SELECT + 'job_available' AS message_type, + NEW.queue AS queue, + NEW.priority AS priority, + NEW.id AS id, + -- Make sure we output timestamps as UTC ISO 8601 + to_char(NEW.run_at AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.US"Z"') AS run_at + ) t; + + PERFORM pg_notify('que_listener_' || locker_pid::text, sort_key::text); + END IF; + + RETURN null; + END +$function$ + SQL + + # no candidate create_trigger statement could be found, creating an adapter-specific one + execute("CREATE TRIGGER que_job_notify AFTER INSERT ON \"que_jobs\" FOR EACH ROW WHEN (NOT COALESCE(current_setting('que.skip_notify'::text, true), ''::text) = 'true'::text) EXECUTE FUNCTION que_job_notify()") + + # no candidate create_trigger statement could be found, creating an adapter-specific one + execute(<<-SQL) +CREATE OR REPLACE FUNCTION public.que_state_notify() + RETURNS trigger + LANGUAGE plpgsql +AS $function$ + DECLARE + row record; + message json; + previous_state text; + current_state text; + BEGIN + IF TG_OP = 'INSERT' THEN + previous_state := 'nonexistent'; + current_state := public.que_determine_job_state(NEW); + row := NEW; + ELSIF TG_OP = 'DELETE' THEN + previous_state := public.que_determine_job_state(OLD); + current_state := 'nonexistent'; + row := OLD; + ELSIF TG_OP = 'UPDATE' THEN + previous_state := public.que_determine_job_state(OLD); + current_state := public.que_determine_job_state(NEW); + + -- If the state didn't change, short-circuit. + IF previous_state = current_state THEN + RETURN null; + END IF; + + row := NEW; + ELSE + RAISE EXCEPTION 'Unrecognized TG_OP: %', TG_OP; + END IF; + + SELECT row_to_json(t) + INTO message + FROM ( + SELECT + 'job_change' AS message_type, + row.id AS id, + row.queue AS queue, + + coalesce(row.data->'tags', '[]'::jsonb) AS tags, + + to_char(row.run_at AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.US"Z"') AS run_at, + to_char(now() AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.US"Z"') AS time, + + CASE row.job_class + WHEN 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' THEN + coalesce( + row.args->0->>'job_class', + 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' + ) + ELSE + row.job_class + END AS job_class, + + previous_state AS previous_state, + current_state AS current_state + ) t; + + PERFORM pg_notify('que_state', message::text); + + RETURN null; + END +$function$ + SQL + + # no candidate create_trigger statement could be found, creating an adapter-specific one + execute("CREATE TRIGGER que_state_notify AFTER INSERT OR DELETE OR UPDATE ON \"que_jobs\" FOR EACH ROW WHEN (NOT COALESCE(current_setting('que.skip_notify'::text, true), ''::text) = 'true'::text) EXECUTE FUNCTION que_state_notify()") + create_trigger("indexed_posts_before_insert_update_row_tr", :compatibility => 1). on("indexed_posts"). before(:insert, :update) do diff --git a/db/seeds/designs.yml b/db/seeds/designs.yml index b1508b84..22615638 100644 --- a/db/seeds/designs.yml +++ b/db/seeds/designs.yml @@ -6,6 +6,7 @@ disabled: true description_en: "Upload your own theme. [This feature is in development, help us!](https://sutty.nl/en/#contact)" description_es: "Subir tu propio diseño. [Esta posibilidad está en desarrollo, ¡ayudanos!](https://sutty.nl/#contacto)" + priority: '8' - name_en: 'I want you to develop a site for me' name_es: 'Quiero que desarrollen mi sitio' gem: 'sutty-theme-custom' @@ -13,6 +14,7 @@ disabled: true description_en: "If you want us to develop your site, you're welcome to [contact us!](https://sutty.nl/en/#contact) :)" description_es: "Si querés que desarrollemos tu sitio, [escribinos](https://sutty.nl/#contacto) :)" + priority: '7' - name_en: 'Minima' name_es: 'Mínima' gem: 'sutty-minima' @@ -20,6 +22,7 @@ description_en: "Sutty Minima is based on [Minima](https://jekyll.github.io/minima/), a blog-focused theme for Jekyll." description_es: 'Sutty Mínima es una plantilla para blogs basada en [Mínima](https://jekyll.github.io/minima/).' license: 'https://0xacab.org/sutty/jekyll/minima/-/blob/master/LICENSE.txt' + priority: '1' - name_en: 'Sutty' name_es: 'Sutty' gem: 'sutty-jekyll-theme' @@ -29,6 +32,7 @@ license: 'https://0xacab.org/sutty/jekyll/sutty-jekyll-theme/-/blob/master/LICENSE.txt' credits_es: 'Sutty es parte de la economía solidaria :)' credits_en: 'Sutty is a solidarity economy project!' + priority: '2' - name_en: 'Self-managed Book Publisher' name_es: 'Editorial Autogestiva' gem: 'editorial-autogestiva-jekyll-theme' @@ -38,6 +42,7 @@ license: 'https://0xacab.org/sutty/jekyll/editorial-autogestiva-jekyll-theme/-/blob/master/LICENSE.txt' credits_es: 'Esta plantilla fue inspirada en el trabajo de las [editoriales autogestivas](https://sutty.nl/plantillas-para-crear-cat%C3%A1logos-de-editoriales-autogestivas/)' credits_en: 'This theme is inspired by [independent publishing projects](https://sutty.nl/en/new-template-for-publishing-projects/)' + priority: '6' - name_en: 'Donations' name_es: 'Donaciones' gem: 'sutty-donaciones-jekyll-theme' @@ -47,6 +52,7 @@ license: 'https://0xacab.org/sutty/jekyll/sutty-donaciones-jekyll-theme/-/blob/master/LICENSE.txt' credits_es: 'Diseñamos esta plantilla para [visibilizar campañas de donaciones](https://sutty.nl/plantilla-para-donaciones/) durante la cuarentena.' credits_en: 'We designed this theme to increase [visibility for donation requests](https://sutty.nl/template-for-donations/) during the quarantine.' + priority: '3' - name_en: 'Support campaign' name_es: 'Adhesiones' gem: 'adhesiones-jekyll-theme' @@ -57,6 +63,7 @@ credits_es: 'Desarrollamos esta plantilla junto con [Librenauta](https://sutty.nl/plantilla-para-campa%C3%B1as-de-adhesiones/)' credits_en: 'This template was made in collaboration with Librenauta' designer_url: 'https://copiona.com/donaunbit/' + priority: '5' - name_en: 'Community Radio' name_es: 'Radio comunitaria' gem: 'radios-comunitarias-jekyll-theme' @@ -67,6 +74,7 @@ credits_es: 'Desarrollamos esta plantilla junto con Librenauta en 15 horas :)' credits_en: 'This template was made in collaboration with Librenauta in 15 hours!' designer_url: 'https://copiona.com/donaunbit/' + priority: '4' - name_en: 'Resource toolkit' name_es: 'Recursero' gem: 'recursero-jekyll-theme' @@ -75,9 +83,10 @@ 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)" - name_en: 'Other themes' - name_es: 'Mi propio diseño' + name_es: 'Otros temas' gem: 'sutty-theme-own' url: 'https://jekyllthemes.org' disabled: true 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: '9' \ No newline at end of file From bdac1fb0b834ac8b00025c754b6c03c455703bdb Mon Sep 17 00:00:00 2001 From: f Date: Sat, 15 Apr 2023 14:39:55 -0300 Subject: [PATCH 274/475] fix: estos cambios no pertenecen a esta rama --- db/schema.rb | 211 +-------------------------------------------------- 1 file changed, 1 insertion(+), 210 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index f659f11d..fd8e5b48 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -184,14 +184,6 @@ ActiveRecord::Schema.define(version: 2023_04_15_153231) do t.index ["deploy_id"], name: "index_build_stats_on_deploy_id" end - create_table "codes_of_conduct", force: :cascade do |t| - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.string "title" - t.text "description" - t.text "content" - end - create_table "csp_reports", id: :uuid, default: nil, force: :cascade do |t| t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false @@ -233,14 +225,6 @@ ActiveRecord::Schema.define(version: 2023_04_15_153231) do t.integer "priority" end - create_table "distributed_press_publishers", force: :cascade do |t| - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.string "instance" - t.text "token_ciphertext", null: false - t.datetime "expires_at" - end - create_table "indexed_posts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.bigint "site_id" t.datetime "created_at", precision: 6, null: false @@ -254,7 +238,6 @@ ActiveRecord::Schema.define(version: 2023_04_15_153231) do t.tsvector "indexed_content" t.integer "order", default: 0 t.string "dictionary" - t.uuid "post_id" t.index ["front_matter"], name: "index_indexed_posts_on_front_matter", using: :gin t.index ["indexed_content"], name: "index_indexed_posts_on_indexed_content", using: :gin t.index ["layout"], name: "index_indexed_posts_on_layout" @@ -270,7 +253,6 @@ ActiveRecord::Schema.define(version: 2023_04_15_153231) do t.text "deed" t.string "url" t.string "icons" - t.string "short_description" end create_table "log_entries", force: :cascade do |t| @@ -316,56 +298,6 @@ ActiveRecord::Schema.define(version: 2023_04_15_153231) do t.index ["translatable_id", "translatable_type", "locale", "key"], name: "index_mobility_text_translations_on_keys", unique: true end - create_table "privacy_policies", force: :cascade do |t| - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.string "title" - t.text "description" - t.text "content" - end - - create_table "que_jobs", comment: "7", force: :cascade do |t| - t.integer "priority", limit: 2, default: 100, null: false - t.datetime "run_at", default: -> { "now()" }, null: false - t.text "job_class", null: false - t.integer "error_count", default: 0, null: false - t.text "last_error_message" - t.text "queue", default: "default", null: false - t.text "last_error_backtrace" - t.datetime "finished_at" - t.datetime "expired_at" - t.jsonb "args", default: [], null: false - t.jsonb "data", default: {}, null: false - t.integer "job_schema_version", null: false - t.jsonb "kwargs", default: {}, null: false - t.index ["args"], name: "que_jobs_args_gin_idx", opclass: :jsonb_path_ops, using: :gin - t.index ["data"], name: "que_jobs_data_gin_idx", opclass: :jsonb_path_ops, using: :gin - t.index ["job_schema_version", "queue", "priority", "run_at", "id"], name: "que_poll_idx", where: "((finished_at IS NULL) AND (expired_at IS NULL))" - t.index ["kwargs"], name: "que_jobs_kwargs_gin_idx", opclass: :jsonb_path_ops, using: :gin - t.check_constraint "(char_length(last_error_message) <= 500) AND (char_length(last_error_backtrace) <= 10000)", name: "error_length" - t.check_constraint "(jsonb_typeof(data) = 'object'::text) AND ((NOT (data ? 'tags'::text)) OR ((jsonb_typeof((data -> 'tags'::text)) = 'array'::text) AND (jsonb_array_length((data -> 'tags'::text)) <= 5) AND que_validate_tags((data -> 'tags'::text))))", name: "valid_data" - t.check_constraint "char_length(queue) <= 100", name: "queue_length" - t.check_constraint "jsonb_typeof(args) = 'array'::text", name: "valid_args" - t.check_constraint nil, name: "job_class_length" - end - - create_table "que_lockers", primary_key: "pid", id: :integer, default: nil, force: :cascade do |t| - t.integer "worker_count", null: false - t.integer "worker_priorities", null: false, array: true - t.integer "ruby_pid", null: false - t.text "ruby_hostname", null: false - t.text "queues", null: false, array: true - t.boolean "listening", null: false - t.integer "job_schema_version", default: 1 - t.check_constraint "(array_ndims(queues) = 1) AND (array_length(queues, 1) IS NOT NULL)", name: "valid_queues" - t.check_constraint "(array_ndims(worker_priorities) = 1) AND (array_length(worker_priorities, 1) IS NOT NULL)", name: "valid_worker_priorities" - end - - create_table "que_values", primary_key: "key", id: :text, force: :cascade do |t| - t.jsonb "value", default: {}, null: false - t.check_constraint "jsonb_typeof(value) = 'object'::text", name: "valid_value" - end - create_table "roles", force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -403,7 +335,6 @@ ActiveRecord::Schema.define(version: 2023_04_15_153231) do t.string "tienda_api_key_ciphertext", default: "" t.string "tienda_url", default: "" t.string "api_key_ciphertext" - t.string "slugify_mode", default: "default" t.index ["design_id"], name: "index_sites_on_design_id" t.index ["licencia_id"], name: "index_sites_on_licencia_id" t.index ["name"], name: "index_sites_on_name", unique: true @@ -433,6 +364,7 @@ ActiveRecord::Schema.define(version: 2023_04_15_153231) do t.integer "failed_attempts", default: 0, null: false t.string "unlock_token" t.datetime "locked_at" + t.boolean "acepta_politicas_de_privacidad", default: false t.string "invitation_token" t.datetime "invitation_created_at" t.datetime "invitation_sent_at" @@ -442,10 +374,6 @@ ActiveRecord::Schema.define(version: 2023_04_15_153231) do t.bigint "invited_by_id" t.integer "invitations_count", default: 0 t.string "lang", default: "es" - t.datetime "privacy_policy_accepted_at" - t.datetime "terms_of_service_accepted_at" - t.datetime "code_of_conduct_accepted_at" - t.datetime "available_for_feedback_accepted_at" t.index ["confirmation_token"], name: "index_usuaries_on_confirmation_token", unique: true t.index ["email"], name: "index_usuaries_on_email", unique: true t.index ["invitation_token"], name: "index_usuaries_on_invitation_token", unique: true @@ -458,143 +386,6 @@ ActiveRecord::Schema.define(version: 2023_04_15_153231) do add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" - # no candidate create_trigger statement could be found, creating an adapter-specific one - execute(<<-SQL) -CREATE OR REPLACE FUNCTION public.que_job_notify() - RETURNS trigger - LANGUAGE plpgsql -AS $function$ - DECLARE - locker_pid integer; - sort_key json; - BEGIN - -- Don't do anything if the job is scheduled for a future time. - IF NEW.run_at IS NOT NULL AND NEW.run_at > now() THEN - RETURN null; - END IF; - - -- Pick a locker to notify of the job's insertion, weighted by their number - -- of workers. Should bounce pseudorandomly between lockers on each - -- invocation, hence the md5-ordering, but still touch each one equally, - -- hence the modulo using the job_id. - SELECT pid - INTO locker_pid - FROM ( - SELECT *, last_value(row_number) OVER () + 1 AS count - FROM ( - SELECT *, row_number() OVER () - 1 AS row_number - FROM ( - SELECT * - FROM public.que_lockers ql, generate_series(1, ql.worker_count) AS id - WHERE - listening AND - queues @> ARRAY[NEW.queue] AND - ql.job_schema_version = NEW.job_schema_version - ORDER BY md5(pid::text || id::text) - ) t1 - ) t2 - ) t3 - WHERE NEW.id % count = row_number; - - IF locker_pid IS NOT NULL THEN - -- There's a size limit to what can be broadcast via LISTEN/NOTIFY, so - -- rather than throw errors when someone enqueues a big job, just - -- broadcast the most pertinent information, and let the locker query for - -- the record after it's taken the lock. The worker will have to hit the - -- DB in order to make sure the job is still visible anyway. - SELECT row_to_json(t) - INTO sort_key - FROM ( - SELECT - 'job_available' AS message_type, - NEW.queue AS queue, - NEW.priority AS priority, - NEW.id AS id, - -- Make sure we output timestamps as UTC ISO 8601 - to_char(NEW.run_at AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.US"Z"') AS run_at - ) t; - - PERFORM pg_notify('que_listener_' || locker_pid::text, sort_key::text); - END IF; - - RETURN null; - END -$function$ - SQL - - # no candidate create_trigger statement could be found, creating an adapter-specific one - execute("CREATE TRIGGER que_job_notify AFTER INSERT ON \"que_jobs\" FOR EACH ROW WHEN (NOT COALESCE(current_setting('que.skip_notify'::text, true), ''::text) = 'true'::text) EXECUTE FUNCTION que_job_notify()") - - # no candidate create_trigger statement could be found, creating an adapter-specific one - execute(<<-SQL) -CREATE OR REPLACE FUNCTION public.que_state_notify() - RETURNS trigger - LANGUAGE plpgsql -AS $function$ - DECLARE - row record; - message json; - previous_state text; - current_state text; - BEGIN - IF TG_OP = 'INSERT' THEN - previous_state := 'nonexistent'; - current_state := public.que_determine_job_state(NEW); - row := NEW; - ELSIF TG_OP = 'DELETE' THEN - previous_state := public.que_determine_job_state(OLD); - current_state := 'nonexistent'; - row := OLD; - ELSIF TG_OP = 'UPDATE' THEN - previous_state := public.que_determine_job_state(OLD); - current_state := public.que_determine_job_state(NEW); - - -- If the state didn't change, short-circuit. - IF previous_state = current_state THEN - RETURN null; - END IF; - - row := NEW; - ELSE - RAISE EXCEPTION 'Unrecognized TG_OP: %', TG_OP; - END IF; - - SELECT row_to_json(t) - INTO message - FROM ( - SELECT - 'job_change' AS message_type, - row.id AS id, - row.queue AS queue, - - coalesce(row.data->'tags', '[]'::jsonb) AS tags, - - to_char(row.run_at AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.US"Z"') AS run_at, - to_char(now() AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.US"Z"') AS time, - - CASE row.job_class - WHEN 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' THEN - coalesce( - row.args->0->>'job_class', - 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' - ) - ELSE - row.job_class - END AS job_class, - - previous_state AS previous_state, - current_state AS current_state - ) t; - - PERFORM pg_notify('que_state', message::text); - - RETURN null; - END -$function$ - SQL - - # no candidate create_trigger statement could be found, creating an adapter-specific one - execute("CREATE TRIGGER que_state_notify AFTER INSERT OR DELETE OR UPDATE ON \"que_jobs\" FOR EACH ROW WHEN (NOT COALESCE(current_setting('que.skip_notify'::text, true), ''::text) = 'true'::text) EXECUTE FUNCTION que_state_notify()") create_trigger("indexed_posts_before_insert_update_row_tr", :compatibility => 1). on("indexed_posts"). From bc74f85ba2c4b3b943cc1999b56de1032b302d08 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 15 Apr 2023 14:56:58 -0300 Subject: [PATCH 275/475] =?UTF-8?q?fix:=20mejorar=20el=20t=C3=ADtulo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/seeds/designs.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/seeds/designs.yml b/db/seeds/designs.yml index 22615638..67bccad3 100644 --- a/db/seeds/designs.yml +++ b/db/seeds/designs.yml @@ -82,11 +82,11 @@ disabled: true 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)" -- name_en: 'Other themes' - name_es: 'Otros temas' +- name_en: 'More themes' + name_es: 'Más plantillas' gem: 'sutty-theme-own' url: 'https://jekyllthemes.org' disabled: true 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: '9' \ No newline at end of file + priority: '9' From fd41242985cf43912d0224444defb3f55963a9dc Mon Sep 17 00:00:00 2001 From: f Date: Sat, 15 Apr 2023 15:03:38 -0300 Subject: [PATCH 276/475] fix: el orden es de mayor a menor prioridad dejando espacio entre algunos para poder intercalar otras plantillas --- db/seeds/designs.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/db/seeds/designs.yml b/db/seeds/designs.yml index 67bccad3..a04c99c1 100644 --- a/db/seeds/designs.yml +++ b/db/seeds/designs.yml @@ -6,7 +6,7 @@ disabled: true description_en: "Upload your own theme. [This feature is in development, help us!](https://sutty.nl/en/#contact)" description_es: "Subir tu propio diseño. [Esta posibilidad está en desarrollo, ¡ayudanos!](https://sutty.nl/#contacto)" - priority: '8' + priority: '0' - name_en: 'I want you to develop a site for me' name_es: 'Quiero que desarrollen mi sitio' gem: 'sutty-theme-custom' @@ -14,7 +14,7 @@ disabled: true description_en: "If you want us to develop your site, you're welcome to [contact us!](https://sutty.nl/en/#contact) :)" description_es: "Si querés que desarrollemos tu sitio, [escribinos](https://sutty.nl/#contacto) :)" - priority: '7' + priority: '2' - name_en: 'Minima' name_es: 'Mínima' gem: 'sutty-minima' @@ -22,7 +22,7 @@ description_en: "Sutty Minima is based on [Minima](https://jekyll.github.io/minima/), a blog-focused theme for Jekyll." description_es: 'Sutty Mínima es una plantilla para blogs basada en [Mínima](https://jekyll.github.io/minima/).' license: 'https://0xacab.org/sutty/jekyll/minima/-/blob/master/LICENSE.txt' - priority: '1' + priority: '100' - name_en: 'Sutty' name_es: 'Sutty' gem: 'sutty-jekyll-theme' @@ -32,7 +32,7 @@ license: 'https://0xacab.org/sutty/jekyll/sutty-jekyll-theme/-/blob/master/LICENSE.txt' credits_es: 'Sutty es parte de la economía solidaria :)' credits_en: 'Sutty is a solidarity economy project!' - priority: '2' + priority: '90' - name_en: 'Self-managed Book Publisher' name_es: 'Editorial Autogestiva' gem: 'editorial-autogestiva-jekyll-theme' @@ -42,7 +42,7 @@ license: 'https://0xacab.org/sutty/jekyll/editorial-autogestiva-jekyll-theme/-/blob/master/LICENSE.txt' credits_es: 'Esta plantilla fue inspirada en el trabajo de las [editoriales autogestivas](https://sutty.nl/plantillas-para-crear-cat%C3%A1logos-de-editoriales-autogestivas/)' credits_en: 'This theme is inspired by [independent publishing projects](https://sutty.nl/en/new-template-for-publishing-projects/)' - priority: '6' + priority: '50' - name_en: 'Donations' name_es: 'Donaciones' gem: 'sutty-donaciones-jekyll-theme' @@ -52,7 +52,7 @@ license: 'https://0xacab.org/sutty/jekyll/sutty-donaciones-jekyll-theme/-/blob/master/LICENSE.txt' credits_es: 'Diseñamos esta plantilla para [visibilizar campañas de donaciones](https://sutty.nl/plantilla-para-donaciones/) durante la cuarentena.' credits_en: 'We designed this theme to increase [visibility for donation requests](https://sutty.nl/template-for-donations/) during the quarantine.' - priority: '3' + priority: '80' - name_en: 'Support campaign' name_es: 'Adhesiones' gem: 'adhesiones-jekyll-theme' @@ -63,7 +63,7 @@ credits_es: 'Desarrollamos esta plantilla junto con [Librenauta](https://sutty.nl/plantilla-para-campa%C3%B1as-de-adhesiones/)' credits_en: 'This template was made in collaboration with Librenauta' designer_url: 'https://copiona.com/donaunbit/' - priority: '5' + priority: '60' - name_en: 'Community Radio' name_es: 'Radio comunitaria' gem: 'radios-comunitarias-jekyll-theme' @@ -74,7 +74,7 @@ credits_es: 'Desarrollamos esta plantilla junto con Librenauta en 15 horas :)' credits_en: 'This template was made in collaboration with Librenauta in 15 hours!' designer_url: 'https://copiona.com/donaunbit/' - priority: '4' + priority: '70' - name_en: 'Resource toolkit' name_es: 'Recursero' gem: 'recursero-jekyll-theme' @@ -82,6 +82,7 @@ disabled: true 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: 'More themes' name_es: 'Más plantillas' gem: 'sutty-theme-own' @@ -89,4 +90,4 @@ disabled: true 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: '9' + priority: '1' From 020fb250b496112265407281be0b003837f13a50 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 15 Apr 2023 15:12:08 -0300 Subject: [PATCH 277/475] fix: #find_each no respeta el orden --- app/views/sites/_form.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index 50391871..69997ffa 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -55,7 +55,7 @@ layouts: site.incompatible_layouts.to_sentence) .row.row-cols-1.row-cols-md-2.designs -# Demasiado complejo para un f.collection_radio_buttons - - Design.all.order(priority: :desc).find_each do |design| + - Design.all.order(priority: :desc).each do |design| .design.col.d-flex.flex-column .custom-control.custom-radio = f.radio_button :design_id, design.id, From 2d6e3443d7664a7440eaada0ae3ebfdffb773e9d Mon Sep 17 00:00:00 2001 From: f Date: Sat, 15 Apr 2023 15:16:31 -0300 Subject: [PATCH 278/475] fix: estos cambios tampoco --- db/schema.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index fd8e5b48..fd82d447 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -65,11 +65,6 @@ ActiveRecord::Schema.define(version: 2023_04_15_153231) do t.boolean "crawler", default: false t.string "http_referer" t.datetime "created_at", precision: 6 - t.decimal "datacenter_co2" - t.decimal "network_co2" - t.decimal "consumer_device_co2" - t.decimal "production_co2" - t.decimal "total_co2" t.index ["geoip2_data_city_name"], name: "index_access_logs_on_geoip2_data_city_name" t.index ["geoip2_data_country_name"], name: "index_access_logs_on_geoip2_data_country_name" t.index ["host"], name: "index_access_logs_on_host" @@ -108,7 +103,7 @@ ActiveRecord::Schema.define(version: 2023_04_15_153231) do t.string "checksum", null: false t.datetime "created_at", null: false t.string "service_name", null: false - t.index ["key", "service_name"], name: "index_active_storage_blobs_on_key_and_service_name", unique: true + t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end create_table "active_storage_variant_records", force: :cascade do |t| From 4eb23a787bbdf66fbf9d26d1c44f4413fe0f4ab9 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 15 Apr 2023 18:36:56 -0300 Subject: [PATCH 279/475] feat: lista de links #13096 --- app/controllers/application_controller.rb | 4 +++ app/controllers/build_stats_controller.rb | 41 +++++++++++++++++++++++ app/controllers/posts_controller.rb | 4 --- app/policies/site_build_stat_policy.rb | 16 +++++++++ app/views/build_stats/index.haml | 21 ++++++++++++ config/locales/en.yml | 3 ++ config/locales/es.yml | 3 ++ config/routes.rb | 2 ++ 8 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 app/controllers/build_stats_controller.rb create mode 100644 app/policies/site_build_stat_policy.rb create mode 100644 app/views/build_stats/index.haml diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b4be5a97..ee153394 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -91,6 +91,10 @@ class ApplicationController < ActionController::Base breadcrumb 'stats.index', root_path, match: :exact end + def site + @site ||= find_site + end + protected def configure_permitted_parameters diff --git a/app/controllers/build_stats_controller.rb b/app/controllers/build_stats_controller.rb new file mode 100644 index 00000000..31a4c5d6 --- /dev/null +++ b/app/controllers/build_stats_controller.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +# La lista de estados de compilación, por ahora solo mostramos el último +# estado. +class BuildStatsController < ApplicationController + include ActionView::Helpers::NumberHelper + include ActionView::Helpers::DateHelper + + before_action :authenticate_usuarie! + + breadcrumb -> { current_usuarie.email }, :edit_usuarie_registration_path + breadcrumb 'sites.index', :sites_path, match: :exact + breadcrumb -> { site.title }, -> { site_posts_path(site, locale: locale) }, match: :exact + + def index + authorize SiteBuildStat.new(site) + breadcrumb I18n.t('build_stats.index.title'), '' + + @headers = %w[type url seconds size].map do |header| + t("deploy_mailer.deployed.th.#{header}") + end + + @table = site.deployment_list.map do |deploy| + type = deploy.class.name.underscore + urls = deploy.respond_to?(:urls) ? deploy.urls : [deploy.url].compact + urls = [nil] if urls.empty? + build_stat = deploy.build_stats.where(status: true).last + seconds = build_stat&.seconds || 0 + + { + title: t("deploy_mailer.deployed.#{type}.title"), + urls: urls, + seconds: { + human: distance_of_time_in_words(seconds), + machine: "PT#{seconds}S" + }, + size: number_to_human_size(build_stat&.bytes || 0, precision: 2) + } + end + end +end diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 3c529c24..9720fe13 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -159,10 +159,6 @@ class PostsController < ApplicationController end.transform_keys(&:to_sym) end - def site - @site ||= find_site - end - def post @post ||= site.posts(lang: locale).find(params[:post_id] || params[:id]) end diff --git a/app/policies/site_build_stat_policy.rb b/app/policies/site_build_stat_policy.rb new file mode 100644 index 00000000..03f09d21 --- /dev/null +++ b/app/policies/site_build_stat_policy.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# Quiénes pueden ver estados de compilación de un sitio +class SiteBuildStatPolicy + attr_reader :site_build_stat, :usuarie + + def initialize(usuarie, site_build_stat) + @usuarie = usuarie + @site_build_stat = site_build_stat + end + + # Todes les usuaries e invitades de este sitio + def index? + site_build_stat.site.usuarie?(usuarie) || site_build_stat.site.invitade?(usuarie) + end +end diff --git a/app/views/build_stats/index.haml b/app/views/build_stats/index.haml new file mode 100644 index 00000000..dab5fc9a --- /dev/null +++ b/app/views/build_stats/index.haml @@ -0,0 +1,21 @@ +%main.row + %aside.menu.col-md-3 + %h1= @site.title + %p.lead= @site.description + .col + %h1= t('.title') + + %table.table + %thead + %tr + - @headers.each do |header| + %th{ scope: 'col' }= header + %tbody + - @table.each do |row| + - row[:urls].each do |url| + %tr + %th{ scope: 'row' }= row[:title] + %td= link_to_if url.present?, url, url + %td + %time{ datetime: row[:seconds][:machine] }= row[:seconds][:human] + %td= row[:size] diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ddf681d..d92aa42a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -697,3 +697,6 @@ en: queries: show: empty: '(empty)' + build_stats: + index: + title: "Publications" diff --git a/config/locales/es.yml b/config/locales/es.yml index 01f1085c..db116e37 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -705,3 +705,6 @@ es: queries: show: empty: '(vacío)' + build_stats: + index: + title: "Publicaciones" diff --git a/config/routes.rb b/config/routes.rb index 511ca654..3828915c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -75,5 +75,7 @@ Rails.application.routes.draw do get :'stats/host', to: 'stats#host' get :'stats/uris', to: 'stats#uris' get :'stats/resources', to: 'stats#resources' + + resources :build_stats, only: %i[index] end end From 5d541ebee64c34885baba12f7a4370984138f257 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 15 Apr 2023 19:06:20 -0300 Subject: [PATCH 280/475] fixup! feat: lista de links #13096 --- app/models/site_build_stat.rb | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 app/models/site_build_stat.rb diff --git a/app/models/site_build_stat.rb b/app/models/site_build_stat.rb new file mode 100644 index 00000000..1a63a0bb --- /dev/null +++ b/app/models/site_build_stat.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +SiteBuildStat = Struct.new(:site) From 251dde865b534f93a2fd8a090d13676a34d0814f Mon Sep 17 00:00:00 2001 From: f Date: Sat, 15 Apr 2023 19:13:23 -0300 Subject: [PATCH 281/475] fix: siempre devolver un array --- app/models/deploy_distributed_press.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 32a3049e..ff2f7325 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -85,20 +85,22 @@ class DeployDistributedPress < Deploy private + # @return [Array] def gateway_urls - remote_info.dig(:distributed_press, :links).values.map do |protocol| + remote_info.dig(:distributed_press, :links)&.values&.map do |protocol| [ protocol[:link], protocol[:gateway] ] - end.flatten.compact.select do |link| + end&.flatten&.compact&.select do |link| link.include? '://' - end + end || [] end + # @return [Array] def protocol_urls - remote_info.dig(:distributed_press, :protocols).select do |_, enabled| + remote_info.dig(:distributed_press, :protocols)&.select do |_, enabled| enabled - end.map do |protocol, _| + end&.map do |protocol, _| "#{protocol}://#{site.hostname}" - end + end || [] end # El cliente de la API From 07d6b14b872d50c4bcca1b092a1599eee72a4199 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 15 Apr 2023 19:24:45 -0300 Subject: [PATCH 282/475] fix: cortar los links largos --- app/assets/stylesheets/application.scss | 4 ++++ app/views/build_stats/index.haml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index bba48558..fadbcbab 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -383,6 +383,8 @@ $bezier: cubic-bezier(0.75, 0, 0.25, 1); } } +.word-break-all { word-break: break-all !important; } + /* * Modificadores de Bootstrap que no tienen versión responsive. */ @@ -405,6 +407,8 @@ $bezier: cubic-bezier(0.75, 0, 0.25, 1); .text-#{$grid-breakpoint}-right { text-align: right !important; } .text-#{$grid-breakpoint}-center { text-align: center !important; } + .word-break-#{$grid-breakpoint}-all { word-break: break-all !important; } + // posición @each $position in $positions { .position-#{$grid-breakpoint}-#{$position} { position: $position !important; } diff --git a/app/views/build_stats/index.haml b/app/views/build_stats/index.haml index dab5fc9a..27dc20d1 100644 --- a/app/views/build_stats/index.haml +++ b/app/views/build_stats/index.haml @@ -15,7 +15,7 @@ - row[:urls].each do |url| %tr %th{ scope: 'row' }= row[:title] - %td= link_to_if url.present?, url, url + %td= link_to_if url.present?, url, url, class: 'word-break-all' %td %time{ datetime: row[:seconds][:machine] }= row[:seconds][:human] %td= row[:size] From 56d5ee3dfec628bd006cdbfb2de7f3230d313f1c Mon Sep 17 00:00:00 2001 From: jazzari Date: Sun, 16 Apr 2023 18:01:17 -0300 Subject: [PATCH 283/475] fix: change key in line 433 from licencia to license in en.yml #13092 --- config/locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ddf681d..7059b79b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -430,7 +430,7 @@ en: title: 'Design' actions: 'Information about this design' url: 'Demo' - licencia: 'License' + license: 'License' licencia: title: 'License for the site and everything published on it' url: 'Read the license' From 0955dc62b4f7cdbe3af0295478e9ea848305090e Mon Sep 17 00:00:00 2001 From: f Date: Thu, 9 Mar 2023 15:54:34 -0300 Subject: [PATCH 284/475] fix: mejorar la ayuda del nombre #9986 --- config/locales/es.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/es.yml b/config/locales/es.yml index 01f1085c..236de325 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -413,7 +413,7 @@ es: title: Hubo errores y no pudimos guardar tus cambios :( help: Por favor, busca los campos marcados como no válidos para resolverlos help: - name: 'El nombre de tu sitio que formará parte de la dirección (**ejemplo**.sutty.nl). Solo puede contener letras minúsculas, números y guiones.' + name: 'El nombre de tu sitio que formará parte de la dirección (**ejemplo**.sutty.nl). Solo puede contener hasta 63 letras minúsculas, números y guiones, **pero sin espacios**. No puede empezar ni terminar con guión, ni estar compuesto enteramente por números.' title: 'El título de tu sitio puede ser lo que quieras.' description: 'La descripción del sitio, que saldrá en buscadores. Entre 50 y 160 caracteres.' design: 'Elegí el diseño que va a tener tu sitio aquí. Podés cambiarlo luego. De tanto en tanto vamos sumando diseños nuevos.' From 7ac8f58acb0c1c1a50d12658f56bcdd831a78846 Mon Sep 17 00:00:00 2001 From: jazzari Date: Sat, 15 Apr 2023 12:02:43 -0300 Subject: [PATCH 285/475] fix: change in help how create a new site en & es #13089 --- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ddf681d..f067ce3e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -407,7 +407,7 @@ en: title: There were errors and we couldn't save your changes :( help: Please, look for the invalid fields to fix them help: - name: "The name of your site. It can only include numbers and letters." + name: "This will be the host name for your site, ie. **example**.sutty.nl. Choose an expression up to 63 characters. It can contain only lowercase letters, numbers and dashes, **and no spaces**. It can't start or end with a dash, or be entirely composed of numbers." title: 'The title can be anything you want' description: 'You site description that appears in search engines. Between 50 and 160 characters.' design: 'Select the design for your site. You can change it later. We add more designs from time to time!' diff --git a/config/locales/es.yml b/config/locales/es.yml index 236de325..1e00a6a6 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -413,7 +413,7 @@ es: title: Hubo errores y no pudimos guardar tus cambios :( help: Por favor, busca los campos marcados como no válidos para resolverlos help: - name: 'El nombre de tu sitio que formará parte de la dirección (**ejemplo**.sutty.nl). Solo puede contener hasta 63 letras minúsculas, números y guiones, **pero sin espacios**. No puede empezar ni terminar con guión, ni estar compuesto enteramente por números.' + name: 'El nombre de tu sitio que formará parte de la dirección (**ejemplo**.sutty.nl). Solo puede contener hasta 63 letras minúsculas, números y guiones, pero **sin espacios**. No puede empezar ni terminar con guión, ni estar compuesto enteramente por números.' title: 'El título de tu sitio puede ser lo que quieras.' description: 'La descripción del sitio, que saldrá en buscadores. Entre 50 y 160 caracteres.' design: 'Elegí el diseño que va a tener tu sitio aquí. Podés cambiarlo luego. De tanto en tanto vamos sumando diseños nuevos.' From 6651781cac78f169cc220d16cc680748694dad72 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 17 Apr 2023 14:45:12 -0300 Subject: [PATCH 286/475] feat: poder ir a la lista de publicaciones del sitio --- app/views/sites/_status.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/sites/_status.haml b/app/views/sites/_status.haml index a731aa7d..4cf480df 100644 --- a/app/views/sites/_status.haml +++ b/app/views/sites/_status.haml @@ -16,4 +16,4 @@ - link = true = render 'bootstrap/alert' do - = link_to_if link, message.html_safe, site.url, class: 'alert-link' + = link_to_if link, message.html_safe, site_build_stats_path(site), class: 'alert-link' From 31b66373aec1073e1742f33585e568bddf6c7aff Mon Sep 17 00:00:00 2001 From: f Date: Mon, 17 Apr 2023 15:03:00 -0300 Subject: [PATCH 287/475] fix: mejorar el mensaje de espera, dando un accionable --- config/locales/en.yml | 4 ++-- config/locales/es.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index d92aa42a..76fc20ab 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -362,9 +362,9 @@ en: static_file_migration: 'File migration' find_and_replace: 'Search and replace' status: - building: "Your site is building, please wait to refresh this page..." + building: "Your site is building, refresh this page in ." not_published_yet: "Your site is being published for the first time, please wait up to 1 minute..." - available: "Your site is available! Click here to visit it." + available: "Your site is available! Click here to visit find all the different ways to visit it." index: title: 'My Sites' pull: 'Upgrade' diff --git a/config/locales/es.yml b/config/locales/es.yml index db116e37..f4c579f1 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -367,9 +367,9 @@ es: static_file_migration: 'Migración de archivos' find_and_replace: 'Búsqueda y reemplazo' status: - building: "Tu sitio se está publicando, por favor espera para recargar esta página..." + building: "Tu sitio se está publicando, recargá esta página en ." not_published_yet: "Tu sitio se está publicando por primera vez, por favor espera hasta un minuto..." - available: "¡Tu sitio está disponible! Cliquea aquí para visitarlo." + available: "¡Tu sitio está disponible! Cliqueá aquí para encontrar todas las formas en que podés visitarlo." index: title: 'Mis sitios' pull: 'Actualizar' From 6b9eead0abfe8b35fcd083d9f7270e2f668628b2 Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 17 Apr 2023 15:13:37 -0300 Subject: [PATCH 288/475] fix: search placeholder in index.haml view #13095 --- app/views/posts/index.haml | 3 ++- config/locales/en.yml | 3 ++- config/locales/es.yml | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 4f814cda..1a12e405 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -49,7 +49,8 @@ - next if param == 'q' %input{ type: 'hidden', name: param, value: value } .form-group.flex-grow-0.m-0 - %input.form-control.border.border-magenta{ type: 'search', placeholder: 'Buscar', name: 'q', value: @filter_params[:q] } + .label.sr-only t('.search') + %input.form-control.border.border-magenta{ type: 'search', placeholder: t('.search'), name: 'q', value: @filter_params[:q] } %input.sr-only{ type: 'submit' } - if @site.locales.size > 1 diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ddf681d..163d6021 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -544,7 +544,8 @@ en: remove_filter: 'Back' remove_filter_help: 'Remove the filter: %{filter}' categories: 'Everything' - index: 'Posts' + index: + search: 'search' edit: 'Edit' preview: btn: 'Preliminary version' diff --git a/config/locales/es.yml b/config/locales/es.yml index 01f1085c..b67db8ca 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -552,7 +552,8 @@ es: filter: 'Filtrar' remove_filter: 'Volver' remove_filter_help: 'Quitar este filtro: %{filter}' - index: 'Artículos' + index: + search: 'buscar' edit: 'Editar' preview: btn: 'Versión preliminar' From 1fea5b771de4bf611575ad7c9e2d5c7c9035ebac Mon Sep 17 00:00:00 2001 From: f Date: Mon, 17 Apr 2023 15:42:32 -0300 Subject: [PATCH 289/475] =?UTF-8?q?fix:=20no=20es=20necesario=20marcar=20l?= =?UTF-8?q?os=20campos=20que=20est=C3=A1n=20bien=20#13094?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/application.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index bba48558..c0db9ffd 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -16,7 +16,7 @@ $primary: $magenta; $secondary: $black; $jumbotron-bg: transparent; $enable-rounded: false; -$form-feedback-valid-color: $cyan; +$form-feedback-valid-color: $black; $form-feedback-invalid-color: $magenta; $form-feedback-icon-valid-color: $black; $component-active-bg: $magenta; From fcbed5003e28953a90d1ac317b5016dd012f74a9 Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 17 Apr 2023 16:15:09 -0300 Subject: [PATCH 290/475] fix: add missing sign = in view #13095 --- app/views/posts/index.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 1a12e405..ac2932f8 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -49,7 +49,7 @@ - next if param == 'q' %input{ type: 'hidden', name: param, value: value } .form-group.flex-grow-0.m-0 - .label.sr-only t('.search') + .label.sr-only = t('.search') %input.form-control.border.border-magenta{ type: 'search', placeholder: t('.search'), name: 'q', value: @filter_params[:q] } %input.sr-only{ type: 'submit' } From 19bf8fb8bf682381db1815a8f8836cdd564ffae9 Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 17 Apr 2023 16:37:10 -0300 Subject: [PATCH 291/475] fix: capitalization en yml & fix in view #13095 --- app/views/posts/index.haml | 2 +- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index ac2932f8..bceb0a24 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -49,7 +49,7 @@ - next if param == 'q' %input{ type: 'hidden', name: param, value: value } .form-group.flex-grow-0.m-0 - .label.sr-only = t('.search') + .label.sr-only= t('.search') %input.form-control.border.border-magenta{ type: 'search', placeholder: t('.search'), name: 'q', value: @filter_params[:q] } %input.sr-only{ type: 'submit' } diff --git a/config/locales/en.yml b/config/locales/en.yml index 163d6021..64f596d7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -545,7 +545,7 @@ en: remove_filter_help: 'Remove the filter: %{filter}' categories: 'Everything' index: - search: 'search' + search: 'Search' edit: 'Edit' preview: btn: 'Preliminary version' diff --git a/config/locales/es.yml b/config/locales/es.yml index b67db8ca..6ad61228 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -553,7 +553,7 @@ es: remove_filter: 'Volver' remove_filter_help: 'Quitar este filtro: %{filter}' index: - search: 'buscar' + search: 'Buscar' edit: 'Editar' preview: btn: 'Versión preliminar' From 219c0f4fb6837808e415cff5142cae5921bf2916 Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 17 Apr 2023 16:47:09 -0300 Subject: [PATCH 292/475] fix: label tag in view #13095 --- app/views/posts/index.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index bceb0a24..62760e85 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -49,7 +49,7 @@ - next if param == 'q' %input{ type: 'hidden', name: param, value: value } .form-group.flex-grow-0.m-0 - .label.sr-only= t('.search') + %label.sr-only= t('.search') %input.form-control.border.border-magenta{ type: 'search', placeholder: t('.search'), name: 'q', value: @filter_params[:q] } %input.sr-only{ type: 'submit' } From 85f959071912af407bb707cf4956d6211b88f673 Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 17 Apr 2023 17:49:39 -0300 Subject: [PATCH 293/475] fix label in view #13095 --- app/views/posts/index.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 62760e85..d1a4f84d 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -49,7 +49,7 @@ - next if param == 'q' %input{ type: 'hidden', name: param, value: value } .form-group.flex-grow-0.m-0 - %label.sr-only= t('.search') + %label{for: 'q'}.sr-only= t('.search') %input.form-control.border.border-magenta{ type: 'search', placeholder: t('.search'), name: 'q', value: @filter_params[:q] } %input.sr-only{ type: 'submit' } From 6921a33f61ecd38c6726f9af7f3371e5d4d6009c Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 17 Apr 2023 17:59:35 -0300 Subject: [PATCH 294/475] fix: add id to input in view #13095 --- app/views/posts/index.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index d1a4f84d..60cc6245 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -50,7 +50,7 @@ %input{ type: 'hidden', name: param, value: value } .form-group.flex-grow-0.m-0 %label{for: 'q'}.sr-only= t('.search') - %input.form-control.border.border-magenta{ type: 'search', placeholder: t('.search'), name: 'q', value: @filter_params[:q] } + %input#q.form-control.border.border-magenta{ type: 'search', placeholder: t('.search'), name: 'q', value: @filter_params[:q] } %input.sr-only{ type: 'submit' } - if @site.locales.size > 1 From 7d9b96980ad6c96bc0d7d48345a9ca0af4cf46c5 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 17 Apr 2023 18:29:01 -0300 Subject: [PATCH 295/475] fix: establecer el color por defecto de los botones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit si lo establecemos después de bootstrap, pisamos los colores de los botones --- app/assets/stylesheets/application.scss | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index bba48558..0f848946 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -29,6 +29,11 @@ $sizes: ( "70ch": 70ch, ); +.btn { + background-color: var(--foreground); + color: var(--background); +} + @import "bootstrap"; @import "editor"; @@ -204,8 +209,6 @@ svg { } .btn { - background-color: var(--foreground); - color: var(--background); border: none; border-radius: 0; margin-right: 0.3rem; From 35b79ed9b463cdf555be626c49895e795b39509f Mon Sep 17 00:00:00 2001 From: f Date: Mon, 17 Apr 2023 18:30:21 -0300 Subject: [PATCH 296/475] feat: organizar layouts #13072 --- app/models/layout.rb | 7 ++++++ app/models/site.rb | 1 + app/models/site/layout_ordering.rb | 38 ++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 app/models/site/layout_ordering.rb diff --git a/app/models/layout.rb b/app/models/layout.rb index c70829fa..efca66ee 100644 --- a/app/models/layout.rb +++ b/app/models/layout.rb @@ -9,6 +9,13 @@ Layout = Struct.new(:site, :name, :meta, :metadata, keyword_init: true) do name.to_s end + # Obtiene todos los layouts (schemas) dependientes de este. + # + # @return [Array] + def schemas + @schemas ||= site.layouts.to_h.slice(*site.schema_organization[name]).values + end + def attributes @attributes ||= metadata.keys.map(&:to_sym) end diff --git a/app/models/site.rb b/app/models/site.rb index 3f2aa34e..521f298d 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -9,6 +9,7 @@ class Site < ApplicationRecord include Site::Api include Site::DeployDependencies include Site::BuildStats + include Site::LayoutOrdering include Tienda # Cifrar la llave privada que cifra y decifra campos ocultos. Sutty diff --git a/app/models/site/layout_ordering.rb b/app/models/site/layout_ordering.rb new file mode 100644 index 00000000..9fecbf21 --- /dev/null +++ b/app/models/site/layout_ordering.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +class Site + # Obtiene un listado de layouts (schemas) + module LayoutOrdering + extend ActiveSupport::Concern + + included do + + # Obtiene o genera un listado de layouts (schemas) con sus + # dependencias, para poder generar un árbol. + # + # Por defecto, si el sitio no lo soporta, se obtienen los layouts + # ordenados alfabéticamente por traducción. + # + # @return [Hash] + def schema_organization + @schema_organization ||= + begin + schema_organization = data.dig('schema', 'organization') + schema_organization&.symbolize_keys! + schema_organization&.transform_values! do |ary| + ary.map(&:to_sym) + end + + schema_organization || + begin + layouts = self.layouts.sort_by(&:humanized_name).map(&:name) + Hash[layouts.zip([].fill([], 0, layouts.size))] + end + end + end + + # TODO: Deprecar cuando renombremos layouts a schemas + alias layout_organization schema_organization + end + end +end From 5c976377387d62bf515bb6d4cbf103029984b780 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 17 Apr 2023 18:31:51 -0300 Subject: [PATCH 297/475] =?UTF-8?q?feat:=20mostrar=20la=20lista=20de=20art?= =?UTF-8?q?=C3=ADculos=20organizada=20#13072?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/posts/index.haml | 16 ++++++---------- app/views/schemas/_add.haml | 1 + app/views/schemas/_filter.haml | 4 ++++ app/views/schemas/_row.haml | 12 ++++++++++++ config/locales/en.yml | 8 +++++--- config/locales/es.yml | 9 ++++++--- 6 files changed, 34 insertions(+), 16 deletions(-) create mode 100644 app/views/schemas/_add.haml create mode 100644 app/views/schemas/_filter.haml create mode 100644 app/views/schemas/_row.haml diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 4f814cda..cbc67a60 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -6,16 +6,12 @@ = render 'sites/status', site: @site %h3= t('posts.new') - %table.mb-3 - - @site.layouts.sort_by(&:humanized_name).each do |layout| - - next if layout.hidden? - %tr - %th= layout.humanized_name - %td.pl-3= link_to t('posts.add'), new_site_post_path(@site, layout: layout.value), class: 'btn btn-secondary btn-sm' - - if @filter_params[:layout] == layout.name.to_s - %td= link_to t('posts.remove_filter'), site_posts_path(@site, **@filter_params.merge(layout: nil)), class: 'btn btn-primary btn-sm' - - else - %td= link_to t('posts.filter'), site_posts_path(@site, **@filter_params.merge(layout: layout.value)), class: 'btn btn-secondary btn-sm' + %table.table.table-sm.mb-3 + %tbody + - @site.schema_organization.each do |schema, _| + - schema = @site.layouts[schema] + - next if schema.hidden? + = render 'schemas/row', site: @site, schema: schema, filter: @filter_params - if policy(@site_stat).index? = link_to t('stats.index.title'), site_stats_path(@site), class: 'btn' diff --git a/app/views/schemas/_add.haml b/app/views/schemas/_add.haml new file mode 100644 index 00000000..0131a6bb --- /dev/null +++ b/app/views/schemas/_add.haml @@ -0,0 +1 @@ += link_to t('.add'), new_site_post_path(site, layout: schema.value), class: 'btn btn-secondary btn-sm m-0' diff --git a/app/views/schemas/_filter.haml b/app/views/schemas/_filter.haml new file mode 100644 index 00000000..c422c5b8 --- /dev/null +++ b/app/views/schemas/_filter.haml @@ -0,0 +1,4 @@ +- if filter[:layout] == schema.name.to_s + = link_to t('.remove'), site_posts_path(site, **filter.merge(layout: nil)), class: 'btn btn-primary btn-sm m-0' +- else + = link_to t('.filter'), site_posts_path(site, **filter.merge(layout: schema.value)), class: 'btn btn-secondary btn-sm m-0' diff --git a/app/views/schemas/_row.haml b/app/views/schemas/_row.haml new file mode 100644 index 00000000..9a759fd9 --- /dev/null +++ b/app/views/schemas/_row.haml @@ -0,0 +1,12 @@ +%tr + %th{ scope: 'row' } + - if local_assigns[:parent_schema] + %span.text-muted — + = schema.humanized_name + %td.px-0= render 'schemas/add', **local_assigns + %td.px-0= render 'schemas/filter', **local_assigns + +-# XXX: Solo un nivel de recursividad +- unless local_assigns[:parent_schema] + - schema.schemas.each do |s| + = render 'schemas/row', schema: s, site: site, filter: filter, parent_schema: schema diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ddf681d..5da5fe4f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -539,9 +539,6 @@ en: order: 'Order' content: 'Text' new: 'Post types' - add: 'Add' - filter: 'Filter' - remove_filter: 'Back' remove_filter_help: 'Remove the filter: %{filter}' categories: 'Everything' index: 'Posts' @@ -697,3 +694,8 @@ en: queries: show: empty: '(empty)' + schemas: + add: 'Add' + filter: + filter: 'Filter' + remove: 'Back' diff --git a/config/locales/es.yml b/config/locales/es.yml index 01f1085c..829e0ccc 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -548,9 +548,6 @@ es: content: 'Cuerpo del artículo' categories: 'Todos' new: 'Tipos de artículos' - add: 'Agregar' - filter: 'Filtrar' - remove_filter: 'Volver' remove_filter_help: 'Quitar este filtro: %{filter}' index: 'Artículos' edit: 'Editar' @@ -705,3 +702,9 @@ es: queries: show: empty: '(vacío)' + schemas: + add: + add: 'Agregar' + filter: + filter: 'Filtrar' + remove: 'Volver' From fbc822ba5ddda3d92a1b50f887756f75618819c6 Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 17 Apr 2023 20:02:00 -0300 Subject: [PATCH 298/475] fix: attributes on label in view #13095 --- app/views/posts/index.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 60cc6245..9159d5e7 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -49,7 +49,7 @@ - next if param == 'q' %input{ type: 'hidden', name: param, value: value } .form-group.flex-grow-0.m-0 - %label{for: 'q'}.sr-only= t('.search') + %label.sr-only{for: 'q'}= t('.search') %input#q.form-control.border.border-magenta{ type: 'search', placeholder: t('.search'), name: 'q', value: @filter_params[:q] } %input.sr-only{ type: 'submit' } From 6e5fcc17ff25adedbbb9c5f5f4ad1a085cc6ef15 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 18 Apr 2023 17:38:45 -0300 Subject: [PATCH 299/475] fix: palabra sobrante --- config/locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 76fc20ab..2423ab61 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -364,7 +364,7 @@ en: status: building: "Your site is building, refresh this page in ." not_published_yet: "Your site is being published for the first time, please wait up to 1 minute..." - available: "Your site is available! Click here to visit find all the different ways to visit it." + available: "Your site is available! Click here to find all the different ways to visit it." index: title: 'My Sites' pull: 'Upgrade' From bd48b8561cfbf9a01bde04e41d5a95b76ad63a2b Mon Sep 17 00:00:00 2001 From: f Date: Wed, 19 Apr 2023 18:04:22 -0300 Subject: [PATCH 300/475] fix: no generar urls a partir de los protocolos #13163 porque ipfs es ipns (!) --- app/models/deploy_distributed_press.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 32a3049e..a9494658 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -80,7 +80,7 @@ class DeployDistributedPress < Deploy # Devuelve las URLs de todos los protocolos def urls - protocol_urls + gateway_urls + gateway_urls end private @@ -93,14 +93,6 @@ class DeployDistributedPress < Deploy end end - def protocol_urls - remote_info.dig(:distributed_press, :protocols).select do |_, enabled| - enabled - end.map do |protocol, _| - "#{protocol}://#{site.hostname}" - end - end - # El cliente de la API # # TODO: cuando soportemos más, tiene que haber una relación entre From 712514bc8c03b0ccd9f0289e3956aeddc8993c0b Mon Sep 17 00:00:00 2001 From: f Date: Thu, 20 Apr 2023 18:11:43 -0300 Subject: [PATCH 301/475] feat: avisar que hay que publicar al cambiar la configuracion #13114 --- app/controllers/sites_controller.rb | 1 + app/views/layouts/_flash.haml | 2 +- config/locales/en.yml | 2 ++ config/locales/es.yml | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index 63865e44..17287eb0 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -57,6 +57,7 @@ class SitesController < ApplicationController usuarie: current_usuarie) if service.update.valid? + flash[:notice] = I18n.t('sites.update.post') redirect_to site_posts_path(site, locale: site.default_locale) else render 'edit' diff --git a/app/views/layouts/_flash.haml b/app/views/layouts/_flash.haml index 7bd7ec0b..2d65ff78 100644 --- a/app/views/layouts/_flash.haml +++ b/app/views/layouts/_flash.haml @@ -1,4 +1,4 @@ - flash.each do |type, message| - unless type == 'js' = render 'bootstrap/alert' do - = message + = sanitize_markdown message, tags: %w[a strong em] diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ddf681d..b37214e5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -402,6 +402,8 @@ en: title: 'Edit %{site}' submit: 'Save changes' btn: 'Configuration' + update: + post: "Your changes have been saved. **If you enabled a publication method, don't forget to publish changes.**" form: errors: title: There were errors and we couldn't save your changes :( diff --git a/config/locales/es.yml b/config/locales/es.yml index 01f1085c..aaff1a24 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -408,6 +408,8 @@ es: title: 'Editar %{site}' submit: 'Guardar cambios' btn: 'Configuración' + update: + post: "Tus cambios han sido guardados. **Si agregaste un método de publicación, no te olvides de publicar cambios.**" form: errors: title: Hubo errores y no pudimos guardar tus cambios :( From 76ddbaf5ab90272daaad862e1e7488ffccc5834f Mon Sep 17 00:00:00 2001 From: f Date: Thu, 20 Apr 2023 18:14:48 -0300 Subject: [PATCH 302/475] =?UTF-8?q?fix:=20vincular=20a=20saber=20m=C3=A1s?= =?UTF-8?q?=20#10449?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ddf681d..941280c0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -302,7 +302,7 @@ en: storage network may continue retaining copies of the data indefinitely. - [Learn more](https://ffdweb.org/building-distributed-press-a-publishing-tool-for-the-decentralized-web/) + [Learn more](https://sutty.nl/learn-more-about-publish-to-dweb-functionality/) stats: index: title: Statistics diff --git a/config/locales/es.yml b/config/locales/es.yml index 01f1085c..af84b474 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -307,7 +307,7 @@ es: nodos en la red de almacenamiento distribuida puedan retener copias de tu contenido indefinidamente. - [Saber más (en inglés)](https://ffdweb.org/building-distributed-press-a-publishing-tool-for-the-decentralized-web/) + [Saber más](https://sutty.nl/saber-mas-sobre-publicar-a-la-web-distribuida/) stats: index: title: Estadísticas From f35df41d1be8b0e699246a27091a499c8ff4a752 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 20 Apr 2023 18:17:41 -0300 Subject: [PATCH 303/475] =?UTF-8?q?fix:=20usar=20guionado=20en=20t=C3=ADtu?= =?UTF-8?q?lo=20y=20descripci=C3=B3n=20#13160?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/application.scss | 2 ++ app/views/posts/index.haml | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index bba48558..fa07a185 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -383,6 +383,8 @@ $bezier: cubic-bezier(0.75, 0, 0.25, 1); } } +.hyphens { hyphens: auto; } + /* * Modificadores de Bootstrap que no tienen versión responsive. */ diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 4f814cda..ba8f3ee5 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -1,7 +1,9 @@ %main.row %aside.menu.col-md-3 - %h1= @site.title - %p.lead= @site.description + .hyphens{ lang: @site.default_locale } + %h1= @site.title + %p.lead= @site.description + - cache_if @usuarie, [@site, I18n.locale] do = render 'sites/status', site: @site From 7e8bcc55a11ab2fbdbf5dbba93e3cec6d072aafc Mon Sep 17 00:00:00 2001 From: f Date: Thu, 20 Apr 2023 18:22:00 -0300 Subject: [PATCH 304/475] feat: indicar que se puede publicar el sitio #13178 --- app/models/site/build_stats.rb | 7 +++++++ app/views/sites/_status.haml | 2 ++ config/locales/en.yml | 1 + config/locales/es.yml | 1 + 4 files changed, 11 insertions(+) diff --git a/app/models/site/build_stats.rb b/app/models/site/build_stats.rb index 6eebcc84..64e689b6 100644 --- a/app/models/site/build_stats.rb +++ b/app/models/site/build_stats.rb @@ -40,6 +40,13 @@ class Site def not_published_yet? build_stats.jekyll.where(status: true).count.zero? end + + # Hubo cambios desde la última publicación? + # + # @return [Boolean] + def awaiting_publication? + updated_at > (build_stats.jekyll.where(status: true).last&.created_at || updated_at) + end end end end diff --git a/app/views/sites/_status.haml b/app/views/sites/_status.haml index a731aa7d..2d0de7b9 100644 --- a/app/views/sites/_status.haml +++ b/app/views/sites/_status.haml @@ -1,6 +1,8 @@ - link = nil - if site.not_published_yet? - message = t('.not_published_yet') +- elsif site.awaiting_publication? + - message = t('.awaiting_publication') - if site.building? - if site.average_publication_time_calculable? - average_building_time = site.average_publication_time diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ddf681d..afb470c8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -365,6 +365,7 @@ en: building: "Your site is building, please wait to refresh this page..." not_published_yet: "Your site is being published for the first time, please wait up to 1 minute..." available: "Your site is available! Click here to visit it." + awaiting_publication: "There are unpublished changes. Click the button below and wait a moment to find them on your site." index: title: 'My Sites' pull: 'Upgrade' diff --git a/config/locales/es.yml b/config/locales/es.yml index 01f1085c..d80e2676 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -370,6 +370,7 @@ es: building: "Tu sitio se está publicando, por favor espera para recargar esta página..." not_published_yet: "Tu sitio se está publicando por primera vez, por favor espera hasta un minuto..." available: "¡Tu sitio está disponible! Cliquea aquí para visitarlo." + awaiting_publication: "Hay cambios sin publicar, cliqueá el botón debajo y espera un momento para encontrarlos en tu sitio." index: title: 'Mis sitios' pull: 'Actualizar' From 0567e491eedb6c7bf59718b4b684c8c7796b7a53 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 20 Apr 2023 18:22:21 -0300 Subject: [PATCH 305/475] fix: poder ver los mensajes en el orden correcto --- app/views/sites/_status.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/sites/_status.haml b/app/views/sites/_status.haml index 2d0de7b9..9a671d71 100644 --- a/app/views/sites/_status.haml +++ b/app/views/sites/_status.haml @@ -3,7 +3,7 @@ - message = t('.not_published_yet') - elsif site.awaiting_publication? - message = t('.awaiting_publication') -- if site.building? +- elsif site.building? - if site.average_publication_time_calculable? - average_building_time = site.average_publication_time - elsif !site.similar_sites? From 498c8cc5ad5653631b7d8b9d3133111eb4ce3832 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 20 Apr 2023 21:14:12 -0300 Subject: [PATCH 306/475] fix: usar los posts indexados para obtener la diferencia --- app/models/site/build_stats.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/site/build_stats.rb b/app/models/site/build_stats.rb index 64e689b6..63761bae 100644 --- a/app/models/site/build_stats.rb +++ b/app/models/site/build_stats.rb @@ -45,7 +45,7 @@ class Site # # @return [Boolean] def awaiting_publication? - updated_at > (build_stats.jekyll.where(status: true).last&.created_at || updated_at) + waiting? && updated_at >= (indexed_posts.order(updated_at: :desc).select(:updated_at).first&.updated_at || 1.second.ago) end end end From da873d2efe41ae63d5bb3f63eebfdf6e490a2b10 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 21 Apr 2023 12:10:03 -0300 Subject: [PATCH 307/475] =?UTF-8?q?fix:=20detectar=20si=20el=20sitio=20o?= =?UTF-8?q?=20los=20art=C3=ADculos=20fueron=20modificados=20luego=20de=20p?= =?UTF-8?q?ublicar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/site/build_stats.rb | 41 ++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/app/models/site/build_stats.rb b/app/models/site/build_stats.rb index 63761bae..23931140 100644 --- a/app/models/site/build_stats.rb +++ b/app/models/site/build_stats.rb @@ -41,11 +41,48 @@ class Site build_stats.jekyll.where(status: true).count.zero? end - # Hubo cambios desde la última publicación? + # Cambios posibles luego de la última publicación exitosa: + # + # * Artículos modificados + # * Configuración modificada + # * Métodos de publicación añadidos # # @return [Boolean] def awaiting_publication? - waiting? && updated_at >= (indexed_posts.order(updated_at: :desc).select(:updated_at).first&.updated_at || 1.second.ago) + waiting? && (post_publication_pending? || configuration_publication_pending?) + end + + # Se modificaron artículos después de publicar el sitio por última + # vez + # + # @return [Boolean] + def post_publication_pending? + last_indexed_post_time > last_publication_time + end + + # Se modificó el sitio después de publicarlo por última vez + # + # @return [Boolean] + def configuration_publication_pending? + updated_at > last_publication_time + end + + private + + # Encuentra el último artículo modificado. Si no hay ninguno, + # devuelve la fecha de modificación del sitio. + # + # @return [Time] + def last_indexed_post_time + indexed_posts.order(updated_at: :desc).select(:updated_at).first&.updated_at || updated_at + end + + # Encuentra la fecha de última publicación exitosa, si no hay + # ninguno, devuelve la fecha de modificación del sitio. + # + # @return [Time] + def last_publication_time + build_stats.jekyll.where(status: true).order(created_at: :desc).select(:created_at).first&.created_at || updated_at end end end From 04c9ff5319000c27f404682d712c2f1738886871 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 21 Apr 2023 12:15:22 -0300 Subject: [PATCH 308/475] =?UTF-8?q?fix:=20detectar=20cambios=20de=20config?= =?UTF-8?q?uraci=C3=B3n=20por=20separado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/site/build_stats.rb | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/app/models/site/build_stats.rb b/app/models/site/build_stats.rb index 23931140..0d1d5a57 100644 --- a/app/models/site/build_stats.rb +++ b/app/models/site/build_stats.rb @@ -49,34 +49,49 @@ class Site # # @return [Boolean] def awaiting_publication? - waiting? && (post_publication_pending? || configuration_publication_pending?) + waiting? && (post_pending? || deploy_pending? || configuration_pending?) end # Se modificaron artículos después de publicar el sitio por última # vez # # @return [Boolean] - def post_publication_pending? + def post_pending? last_indexed_post_time > last_publication_time end # Se modificó el sitio después de publicarlo por última vez # # @return [Boolean] - def configuration_publication_pending? - updated_at > last_publication_time + def deploy_pending? + last_deploy_time > last_publication_time + end + + # Se modificó la configuración del sitio + # + # @return [Boolean] + def configuration_pending? + last_configuration_time > last_publication_time end private - # Encuentra el último artículo modificado. Si no hay ninguno, - # devuelve la fecha de modificación del sitio. + # Encuentra la fecha del último artículo modificado. Si no hay + # ninguno, devuelve la fecha de modificación del sitio. # # @return [Time] def last_indexed_post_time indexed_posts.order(updated_at: :desc).select(:updated_at).first&.updated_at || updated_at end + # Encuentra la fecha de última modificación de los métodos de + # publicación. + # + # @return [Time] + def last_deploy_time + deploys.order(updated_at: :desc).select(:updated_at).first&.updated_at || updated_at + end + # Encuentra la fecha de última publicación exitosa, si no hay # ninguno, devuelve la fecha de modificación del sitio. # @@ -84,6 +99,13 @@ class Site def last_publication_time build_stats.jekyll.where(status: true).order(created_at: :desc).select(:created_at).first&.created_at || updated_at end + + # Fecha de última modificación de la configuración + # + # @return [Time] + def last_configuration_time + File.mtime(config.path) + end end end end From 8ed5aedf757db07da0cbfbabe156913886c1ea5f Mon Sep 17 00:00:00 2001 From: f Date: Fri, 21 Apr 2023 12:31:46 -0300 Subject: [PATCH 309/475] feat: componente de cabecera de sitio --- app/views/posts/index.haml | 4 +--- app/views/sites/_header.haml | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 app/views/sites/_header.haml diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index ba8f3ee5..dd0bf052 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -1,8 +1,6 @@ %main.row %aside.menu.col-md-3 - .hyphens{ lang: @site.default_locale } - %h1= @site.title - %p.lead= @site.description + = render 'sites/header', site: @site - cache_if @usuarie, [@site, I18n.locale] do = render 'sites/status', site: @site diff --git a/app/views/sites/_header.haml b/app/views/sites/_header.haml new file mode 100644 index 00000000..c8931041 --- /dev/null +++ b/app/views/sites/_header.haml @@ -0,0 +1,3 @@ +.hyphens{ lang: site.default_locale } + %h1= site.title + %p.lead= site.description From f1aefbcb34526a02acdd41b9bba80bcb9de6c4d5 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 21 Apr 2023 12:36:40 -0300 Subject: [PATCH 310/475] fix: guionar titulo y descripciones largas #13096 --- app/views/build_stats/index.haml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/build_stats/index.haml b/app/views/build_stats/index.haml index 27dc20d1..27c063f9 100644 --- a/app/views/build_stats/index.haml +++ b/app/views/build_stats/index.haml @@ -1,7 +1,6 @@ %main.row %aside.menu.col-md-3 - %h1= @site.title - %p.lead= @site.description + = render 'sites/header', site: @site .col %h1= t('.title') From 3f4517b4272ee4a3cc10ef7602359f41dc4b79c7 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 21 Apr 2023 12:40:36 -0300 Subject: [PATCH 311/475] fix: no cachear el estado --- app/views/posts/index.haml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 4f814cda..2a0b92f8 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -2,8 +2,7 @@ %aside.menu.col-md-3 %h1= @site.title %p.lead= @site.description - - cache_if @usuarie, [@site, I18n.locale] do - = render 'sites/status', site: @site + = render 'sites/status', site: @site %h3= t('posts.new') %table.mb-3 From 04ad7e2324096378d1aa3ac0489b68e79d05b2ef Mon Sep 17 00:00:00 2001 From: f Date: Fri, 21 Apr 2023 13:47:02 -0300 Subject: [PATCH 312/475] =?UTF-8?q?fix:=20usar=20la=20fecha=20de=20creaci?= =?UTF-8?q?=C3=B3n=20del=20deploy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit para saber si hubo publicaciones después de su creación. no usamos la fecha de modificación porque la configuración manual solo los crea o los elimina y los métodos pueden automodificarse durante la publicación. --- app/models/site/build_stats.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/site/build_stats.rb b/app/models/site/build_stats.rb index 0d1d5a57..071b1eab 100644 --- a/app/models/site/build_stats.rb +++ b/app/models/site/build_stats.rb @@ -89,7 +89,7 @@ class Site # # @return [Time] def last_deploy_time - deploys.order(updated_at: :desc).select(:updated_at).first&.updated_at || updated_at + deploys.order(created_at: :desc).select(:created_at).first&.created_at || updated_at end # Encuentra la fecha de última publicación exitosa, si no hay From d8c432b71ad5c682d3cbde79c423d7a7c75e51db Mon Sep 17 00:00:00 2001 From: f Date: Fri, 21 Apr 2023 14:14:39 -0300 Subject: [PATCH 313/475] fix: ocupar menos espacio #13199 --- app/views/schemas/_row.haml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/schemas/_row.haml b/app/views/schemas/_row.haml index 9a759fd9..1d1fca87 100644 --- a/app/views/schemas/_row.haml +++ b/app/views/schemas/_row.haml @@ -1,10 +1,11 @@ %tr - %th{ scope: 'row' } + %th.w-100{ scope: 'row' } - if local_assigns[:parent_schema] %span.text-muted — = schema.humanized_name - %td.px-0= render 'schemas/add', **local_assigns - %td.px-0= render 'schemas/filter', **local_assigns + %td.px-0.text-nowrap + = render 'schemas/add', **local_assigns + = render 'schemas/filter', **local_assigns -# XXX: Solo un nivel de recursividad - unless local_assigns[:parent_schema] From 834715d559d8275210bc6c510b45a1d466c42d34 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 21 Apr 2023 14:17:09 -0300 Subject: [PATCH 314/475] =?UTF-8?q?fix:=20traducir=20el=20bot=C3=B3n=20de?= =?UTF-8?q?=20agregar=20#13177?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/en.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 5da5fe4f..05223ba3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -695,7 +695,8 @@ en: show: empty: '(empty)' schemas: - add: 'Add' + add: + add: 'Add' filter: filter: 'Filter' remove: 'Back' From 79fd1b7fbbc6e7fcc92c143e775a3490adde187d Mon Sep 17 00:00:00 2001 From: f Date: Fri, 21 Apr 2023 15:24:40 -0300 Subject: [PATCH 315/475] BREAKING CHANGE: usar rsyncd en lugar de ssh #13171 --- app/services/site_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 5d28bf91..d9c7783e 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -215,7 +215,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do # Crea los deploys necesarios para sincronizar a otros nodos de Sutty def sync_nodes Rails.application.nodes.each do |node| - site.deploys.build(type: 'DeployFullRsync', destination: "sutty@#{node}:") + site.deploys.build(type: 'DeployFullRsync', destination: "rsync://#{node}/deploys/") end end From a6bba8c3cbb84051fd709fb45be3eb6ae7e3ce14 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 21 Apr 2023 15:42:16 -0300 Subject: [PATCH 316/475] =?UTF-8?q?fix:=20cambiar=20las=20direcciones=20de?= =?UTF-8?q?=20sincronizaci=C3=B3n=20a=20rsyncd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...421182627_change_full_rsync_destination.rb | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 db/migrate/20230421182627_change_full_rsync_destination.rb diff --git a/db/migrate/20230421182627_change_full_rsync_destination.rb b/db/migrate/20230421182627_change_full_rsync_destination.rb new file mode 100644 index 00000000..47352139 --- /dev/null +++ b/db/migrate/20230421182627_change_full_rsync_destination.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# Envía los cambios a través de rsyncd +class ChangeFullRsyncDestination < ActiveRecord::Migration[6.1] + def up + DeployFullRsync.find_each do |deploy| + Rails.application.nodes.each do |node| + deploy.destination = "rsync://#{node}/deploys/" + deploy.save + end + end + end + + def down + DeployFullRsync.find_each do |deploy| + Rails.application.nodes.each do |node| + deploy.destination = "sutty@#{node}:" + deploy.save + end + end + end +end From 79398d0448bd707906c2a15e719fc76acb72db98 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 21 Apr 2023 15:44:22 -0300 Subject: [PATCH 317/475] =?UTF-8?q?fixup!=20fix:=20cambiar=20las=20direcci?= =?UTF-8?q?ones=20de=20sincronizaci=C3=B3n=20a=20rsyncd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20230421182627_change_full_rsync_destination.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20230421182627_change_full_rsync_destination.rb b/db/migrate/20230421182627_change_full_rsync_destination.rb index 47352139..3a22aea6 100644 --- a/db/migrate/20230421182627_change_full_rsync_destination.rb +++ b/db/migrate/20230421182627_change_full_rsync_destination.rb @@ -5,7 +5,7 @@ class ChangeFullRsyncDestination < ActiveRecord::Migration[6.1] def up DeployFullRsync.find_each do |deploy| Rails.application.nodes.each do |node| - deploy.destination = "rsync://#{node}/deploys/" + deploy.destination = "rsync://rsyncd.#{node}/deploys/" deploy.save end end From 4f74c6f6cad3e62d2841e3811e9f31add3f8b566 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 21 Apr 2023 15:48:09 -0300 Subject: [PATCH 318/475] fix: no configurar ssh para rsyncd --- app/models/deploy_rsync.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/deploy_rsync.rb b/app/models/deploy_rsync.rb index 1dff2d99..fcc5a65d 100644 --- a/app/models/deploy_rsync.rb +++ b/app/models/deploy_rsync.rb @@ -38,6 +38,7 @@ class DeployRsync < Deploy # # @return [Boolean] def ssh? + return true if destination.start_with? 'rsync://' user, host = user_host ssh_available = false From f1e53c04db1a59d8f15f46e6d839eb21d586d946 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 22 Apr 2023 18:18:30 -0300 Subject: [PATCH 319/475] fix: ir al contenedor de rsyncd --- app/services/site_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index d9c7783e..5a2b7dde 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -215,7 +215,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do # Crea los deploys necesarios para sincronizar a otros nodos de Sutty def sync_nodes Rails.application.nodes.each do |node| - site.deploys.build(type: 'DeployFullRsync', destination: "rsync://#{node}/deploys/") + site.deploys.build(type: 'DeployFullRsync', destination: "rsync://rsyncd.#{node}/deploys/") end end From b78dd1661ad1a98be8fdbd535a157d6d16a61eb5 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 24 Apr 2023 14:41:45 -0300 Subject: [PATCH 320/475] fix: guardar el hostname --- app/services/site_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 5a2b7dde..696acd57 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -215,7 +215,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do # Crea los deploys necesarios para sincronizar a otros nodos de Sutty def sync_nodes Rails.application.nodes.each do |node| - site.deploys.build(type: 'DeployFullRsync', destination: "rsync://rsyncd.#{node}/deploys/") + site.deploys.build(type: 'DeployFullRsync', destination: "rsync://rsyncd.#{node}/deploys/", hostname: node) end end From 3a99e1a8677e3a3ec13212394eac6d7418846efe Mon Sep 17 00:00:00 2001 From: f Date: Mon, 24 Apr 2023 14:42:02 -0300 Subject: [PATCH 321/475] fix: usar el hostname como url --- app/models/deploy_full_rsync.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/models/deploy_full_rsync.rb b/app/models/deploy_full_rsync.rb index b8c48eab..b417470a 100644 --- a/app/models/deploy_full_rsync.rb +++ b/app/models/deploy_full_rsync.rb @@ -27,8 +27,4 @@ class DeployFullRsync < DeployRsync result.present? && result.all? end - - def url - "https://#{user_host.last}/" - end end From 47969cc410c42fe912e5cd0634db54b0f58b26b7 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 24 Apr 2023 14:46:56 -0300 Subject: [PATCH 322/475] fix: no sincronizar los sitios de testeo --- app/services/site_service.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 696acd57..2c29538c 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -15,7 +15,8 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do add_role temporal: false, rol: 'usuarie' site.deploys.build type: 'DeployLocal' - sync_nodes + # Los sitios de testing no se sincronizan + sync_nodes unless site.name.end_with? '.testing' I18n.with_locale(usuarie.lang.to_sym || I18n.default_locale) do # No se puede llamar a site.config antes de save porque el sitio From 61bc23babec3e4b6ec4f265eccada5e8bd77a4a6 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 24 Apr 2023 14:55:46 -0300 Subject: [PATCH 323/475] feat: agregar nodo en los logs --- db/migrate/20230424174544_add_node_to_access_logs.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 db/migrate/20230424174544_add_node_to_access_logs.rb diff --git a/db/migrate/20230424174544_add_node_to_access_logs.rb b/db/migrate/20230424174544_add_node_to_access_logs.rb new file mode 100644 index 00000000..805fbc27 --- /dev/null +++ b/db/migrate/20230424174544_add_node_to_access_logs.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# Agrega la columna de nodo a los logs +class AddNodeToAccessLogs < ActiveRecord::Migration[6.1] + def change + add_column :access_logs, :node, :string, index: true + end +end From 1cf5ca5953da4f54f18b2951a2781b325f77d05c Mon Sep 17 00:00:00 2001 From: f Date: Mon, 24 Apr 2023 17:03:38 -0300 Subject: [PATCH 324/475] =?UTF-8?q?fix:=20aceptar=20la=20invitaci=C3=B3n?= =?UTF-8?q?=20al=20confirmar=20la=20cuenta=20#13247?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/usuarie.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/models/usuarie.rb b/app/models/usuarie.rb index 9b9fd4e6..0dcf917d 100644 --- a/app/models/usuarie.rb +++ b/app/models/usuarie.rb @@ -12,6 +12,7 @@ class Usuarie < ApplicationRecord validates_with EmailAddress::ActiveRecordValidator, field: :email before_create :lang_from_locale! + before_update :accept_invitation_after_confirmation! has_many :roles has_many :sites, through: :roles @@ -54,4 +55,13 @@ class Usuarie < ApplicationRecord def lang_from_locale! self.lang = I18n.locale.to_s end + + # 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 + end end From 5c467e08b88d3c0db22d496fee1c7591adfcd3ec Mon Sep 17 00:00:00 2001 From: f Date: Mon, 24 Apr 2023 17:21:24 -0300 Subject: [PATCH 325/475] =?UTF-8?q?fix:=20aceptar=20la=20invitaci=C3=B3n?= =?UTF-8?q?=20tambi=C3=A9n=20confirma=20el=20correo=20#13247?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit les usuaries que no confirmaron su correo quedaban en un loop si luego eran invitades a un sitio. --- app/models/usuarie.rb | 6 ++++++ app/views/devise/mailer/invitation_instructions.html.haml | 2 +- app/views/devise/mailer/invitation_instructions.text.haml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/models/usuarie.rb b/app/models/usuarie.rb index 0dcf917d..ef13239b 100644 --- a/app/models/usuarie.rb +++ b/app/models/usuarie.rb @@ -50,6 +50,12 @@ class Usuarie < ApplicationRecord end end + # Les usuaries necesitan link de invitación si no tenían cuenta + # o todavía no la confirmaron + def needs_invitation_link? + (created_by_invite? && !invitation_accepted?) || !confirmed? + end + private def lang_from_locale! diff --git a/app/views/devise/mailer/invitation_instructions.html.haml b/app/views/devise/mailer/invitation_instructions.html.haml index b12cef64..1cdcb2a9 100644 --- a/app/views/devise/mailer/invitation_instructions.html.haml +++ b/app/views/devise/mailer/invitation_instructions.html.haml @@ -8,7 +8,7 @@ %h1= site.title %p= site.description -- if @resource.created_by_invite? && !@resource.invitation_accepted? +- if @resource.needs_invitation_link? %p= link_to t('devise.mailer.invitation_instructions.accept'), accept_invitation_url(@resource, invitation_token: @token, change_locale_to: @resource.lang) diff --git a/app/views/devise/mailer/invitation_instructions.text.haml b/app/views/devise/mailer/invitation_instructions.text.haml index bb496733..eab021ef 100644 --- a/app/views/devise/mailer/invitation_instructions.text.haml +++ b/app/views/devise/mailer/invitation_instructions.text.haml @@ -9,7 +9,7 @@ \ = site.description \ -- if @resource.created_by_invite? && !@resource.invitation_accepted? +- if @resource.needs_invitation_link? = accept_invitation_url(@resource, invitation_token: @token, change_locale_to: @resource.lang) \ - if @resource.invitation_due_at From 229914e8493a158192c5ee9bc10ede0516bbe0cc Mon Sep 17 00:00:00 2001 From: f Date: Mon, 24 Apr 2023 17:44:04 -0300 Subject: [PATCH 326/475] =?UTF-8?q?fix:=20confirmar=20usuaries=20en=20la?= =?UTF-8?q?=20invitaci=C3=B3n=20#13247?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/usuaries_controller.rb | 6 ++++++ app/models/usuarie.rb | 4 ++-- app/views/devise/mailer/invitation_instructions.html.haml | 4 ++++ app/views/devise/mailer/invitation_instructions.text.haml | 4 ++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 9e9cac71..28513e63 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -96,6 +96,12 @@ class UsuariesController < ApplicationController # XXX: La invitación tiene que ser enviada luego de crear el rol if role.persisted? + # Si es una cuenta manual que no está confirmada aun, + # aprovechar para reconfirmarla. + if !usuarie.confirmed? && !usuarie.created_by_invite? + usuarie.generate_confirmation_token! + end + usuarie.deliver_invitation else raise ArgumentError, role.errors.full_messages diff --git a/app/models/usuarie.rb b/app/models/usuarie.rb index ef13239b..e25a6785 100644 --- a/app/models/usuarie.rb +++ b/app/models/usuarie.rb @@ -51,9 +51,9 @@ class Usuarie < ApplicationRecord end # Les usuaries necesitan link de invitación si no tenían cuenta - # o todavía no la confirmaron + # y todavía no aceptaron la invitación anterior. def needs_invitation_link? - (created_by_invite? && !invitation_accepted?) || !confirmed? + created_by_invite? && !invitation_accepted? end private diff --git a/app/views/devise/mailer/invitation_instructions.html.haml b/app/views/devise/mailer/invitation_instructions.html.haml index 1cdcb2a9..6370ed1a 100644 --- a/app/views/devise/mailer/invitation_instructions.html.haml +++ b/app/views/devise/mailer/invitation_instructions.html.haml @@ -18,5 +18,9 @@ format: :'devise.mailer.invitation_instructions.accept_until_format')) %p= t('devise.mailer.invitation_instructions.ignore') +- elsif !@resource.confirmed? && @resource.confirmation_token + = confirmation_url(@resource, confirmation_token: @token, change_locale_to: @resource.lang) + \ + = t('devise.mailer.invitation_instructions.ignore') - else %p= link_to t('devise.mailer.invitation_instructions.sign_in'), root_url diff --git a/app/views/devise/mailer/invitation_instructions.text.haml b/app/views/devise/mailer/invitation_instructions.text.haml index eab021ef..719c7cd2 100644 --- a/app/views/devise/mailer/invitation_instructions.text.haml +++ b/app/views/devise/mailer/invitation_instructions.text.haml @@ -18,6 +18,10 @@ format: :'devise.mailer.invitation_instructions.accept_until_format')) \ = t('devise.mailer.invitation_instructions.ignore') +- elsif !@resource.confirmed? && @resource.confirmation_token + = confirmation_url(@resource, confirmation_token: @token, change_locale_to: @resource.lang) + \ + = t('devise.mailer.invitation_instructions.ignore') - else = root_url(change_locale_to: @resource.lang) = t('devise.mailer.invitation_instructions.sign_in') From e35d09e343fa79232edeae617de849e958f64781 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 24 Apr 2023 18:07:57 -0300 Subject: [PATCH 327/475] fix: si le usuarie creo su cuenta manualmente no necesita ser invitade --- app/models/usuarie.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/models/usuarie.rb b/app/models/usuarie.rb index e25a6785..2bc7a1b5 100644 --- a/app/models/usuarie.rb +++ b/app/models/usuarie.rb @@ -12,6 +12,7 @@ class Usuarie < ApplicationRecord validates_with EmailAddress::ActiveRecordValidator, field: :email before_create :lang_from_locale! + before_update :remove_confirmation_invitation_inconsistencies! before_update :accept_invitation_after_confirmation! has_many :roles @@ -62,6 +63,13 @@ class Usuarie < ApplicationRecord self.lang = I18n.locale.to_s end + # El invitation_token solo es necesario cuando fue creade por otre + # usuarie. De lo contrario lo que queremos es un proceso de + # confirmación. + def remove_confirmation_invitation_inconsistencies! + self.invitation_token = nil unless created_by_invite? + end + # Si le usuarie (re)confirma su cuenta con una invitación pendiente, # considerarla aceptada también. def accept_invitation_after_confirmation! From 3a7c9c6b623f68a445441e58de8b98094401c357 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 24 Apr 2023 18:12:40 -0300 Subject: [PATCH 328/475] =?UTF-8?q?fixup!=20fix:=20confirmar=20usuaries=20?= =?UTF-8?q?en=20la=20invitaci=C3=B3n=20#13247?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/usuaries_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 28513e63..76d17541 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -99,7 +99,7 @@ class UsuariesController < ApplicationController # Si es una cuenta manual que no está confirmada aun, # aprovechar para reconfirmarla. if !usuarie.confirmed? && !usuarie.created_by_invite? - usuarie.generate_confirmation_token! + usuarie.send :generate_confirmation_token! end usuarie.deliver_invitation From 838b398f289be22158ea81857d664cebc95398b7 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 24 Apr 2023 18:58:05 -0300 Subject: [PATCH 329/475] =?UTF-8?q?fix:=20cambiar=20el=20token=20de=20conf?= =?UTF-8?q?irmaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/usuaries_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 76d17541..6924c860 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -99,6 +99,7 @@ class UsuariesController < ApplicationController # Si es una cuenta manual que no está confirmada aun, # aprovechar para reconfirmarla. if !usuarie.confirmed? && !usuarie.created_by_invite? + usuarie.confirmation_token = nil usuarie.send :generate_confirmation_token! end From 18de36939f50266ba6b1707c41dc769bd51cd65d Mon Sep 17 00:00:00 2001 From: f Date: Mon, 24 Apr 2023 19:00:23 -0300 Subject: [PATCH 330/475] fix: usar el token correcto --- app/views/devise/mailer/invitation_instructions.html.haml | 2 +- app/views/devise/mailer/invitation_instructions.text.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/devise/mailer/invitation_instructions.html.haml b/app/views/devise/mailer/invitation_instructions.html.haml index 6370ed1a..5c10c433 100644 --- a/app/views/devise/mailer/invitation_instructions.html.haml +++ b/app/views/devise/mailer/invitation_instructions.html.haml @@ -19,7 +19,7 @@ %p= t('devise.mailer.invitation_instructions.ignore') - elsif !@resource.confirmed? && @resource.confirmation_token - = confirmation_url(@resource, confirmation_token: @token, change_locale_to: @resource.lang) + = confirmation_url(@resource, confirmation_token: @resource.confirmation_token, change_locale_to: @resource.lang) \ = t('devise.mailer.invitation_instructions.ignore') - else diff --git a/app/views/devise/mailer/invitation_instructions.text.haml b/app/views/devise/mailer/invitation_instructions.text.haml index 719c7cd2..ee0247a0 100644 --- a/app/views/devise/mailer/invitation_instructions.text.haml +++ b/app/views/devise/mailer/invitation_instructions.text.haml @@ -19,7 +19,7 @@ \ = t('devise.mailer.invitation_instructions.ignore') - elsif !@resource.confirmed? && @resource.confirmation_token - = confirmation_url(@resource, confirmation_token: @token, change_locale_to: @resource.lang) + = confirmation_url(@resource, confirmation_token: @resource.confirmation_token, change_locale_to: @resource.lang) \ = t('devise.mailer.invitation_instructions.ignore') - else From 34947ffd4e9069f787973cfc9fd009ec3f94c394 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 24 Apr 2023 19:01:02 -0300 Subject: [PATCH 331/475] fix: typo --- config/locales/devise_invitable.es.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/devise_invitable.es.yml b/config/locales/devise_invitable.es.yml index e83a703c..860ee4f8 100644 --- a/config/locales/devise_invitable.es.yml +++ b/config/locales/devise_invitable.es.yml @@ -22,7 +22,7 @@ es: someone_invited_you: "Alguien te ha invitado a colaborar en %{url}, podés aceptar la invitación con el enlace a continuación." accept: "Aceptar la invitación" accept_until: "La invitación vencerá el %{due_date}." - ignore: "Si no querés aceptar la invitación, por favor ignora este correo. Tu cuenta no será creada hasta que aceptes la invitación y configures una contraseña." + ignore: "Si no querés aceptar la invitación, por favor ignorá este correo. Tu cuenta no será creada hasta que aceptes la invitación y configures una contraseña." sign_in: "Iniciá sesión con tu cuenta para aceptar o rechazar la invitación." time: formats: From 5c44a4f15ee0a6af0fe14664c1d9f7bfe4a9a41c Mon Sep 17 00:00:00 2001 From: f Date: Mon, 24 Apr 2023 19:01:19 -0300 Subject: [PATCH 332/475] fix: el mensaje de ignorar no es el correcto --- app/views/devise/mailer/invitation_instructions.html.haml | 2 -- app/views/devise/mailer/invitation_instructions.text.haml | 2 -- 2 files changed, 4 deletions(-) diff --git a/app/views/devise/mailer/invitation_instructions.html.haml b/app/views/devise/mailer/invitation_instructions.html.haml index 5c10c433..e87d99d9 100644 --- a/app/views/devise/mailer/invitation_instructions.html.haml +++ b/app/views/devise/mailer/invitation_instructions.html.haml @@ -20,7 +20,5 @@ %p= t('devise.mailer.invitation_instructions.ignore') - elsif !@resource.confirmed? && @resource.confirmation_token = confirmation_url(@resource, confirmation_token: @resource.confirmation_token, change_locale_to: @resource.lang) - \ - = t('devise.mailer.invitation_instructions.ignore') - else %p= link_to t('devise.mailer.invitation_instructions.sign_in'), root_url diff --git a/app/views/devise/mailer/invitation_instructions.text.haml b/app/views/devise/mailer/invitation_instructions.text.haml index ee0247a0..5cb007de 100644 --- a/app/views/devise/mailer/invitation_instructions.text.haml +++ b/app/views/devise/mailer/invitation_instructions.text.haml @@ -20,8 +20,6 @@ = t('devise.mailer.invitation_instructions.ignore') - elsif !@resource.confirmed? && @resource.confirmation_token = confirmation_url(@resource, confirmation_token: @resource.confirmation_token, change_locale_to: @resource.lang) - \ - = t('devise.mailer.invitation_instructions.ignore') - else = root_url(change_locale_to: @resource.lang) = t('devise.mailer.invitation_instructions.sign_in') From fb7fb080d1628aaa6fd87eefccdb6dd8f6d48bea Mon Sep 17 00:00:00 2001 From: f Date: Tue, 25 Apr 2023 13:12:07 -0300 Subject: [PATCH 333/475] =?UTF-8?q?feat:=20vincular=20al=20formulario=20de?= =?UTF-8?q?=20contacto=20desde=20la=20p=C3=A1gina=20de=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/500.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/public/500.html b/public/500.html index 2d69baf6..9e8ea780 100644 --- a/public/500.html +++ b/public/500.html @@ -19,7 +19,11 @@

Gracias por ayudarnos a encontrar errores :)

-

Volver al panel

+

+ Volver al panel + | + Contáctanos +

@@ -31,7 +35,11 @@

Thanks for helping us in finding errors! :)

-

Go back to panel

+

+ Go back to panel + | + Contact us +

From 0b2cc38691356fcac3dc1cbf86c3aeada5417773 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 25 Apr 2023 13:14:29 -0300 Subject: [PATCH 334/475] =?UTF-8?q?feat:=20bot=C3=B3n=20de=20contacto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_breadcrumb.haml | 4 ++++ config/locales/en.yml | 2 ++ config/locales/es.yml | 2 ++ 3 files changed, 8 insertions(+) diff --git a/app/views/layouts/_breadcrumb.haml b/app/views/layouts/_breadcrumb.haml index b1c42cb2..6281404a 100644 --- a/app/views/layouts/_breadcrumb.haml +++ b/app/views/layouts/_breadcrumb.haml @@ -19,6 +19,10 @@ = link_to t('.tienda'), @site.tienda_url, role: 'button', class: 'btn' + %li.nav-item + = link_to t('.contact_us'), t('.contact_us_href'), + class: 'btn', rel: 'me', target: '_blank' + %li.nav-item = link_to t('.logout'), main_app.destroy_usuarie_session_path, method: :delete, role: 'button', class: 'btn' diff --git a/config/locales/en.yml b/config/locales/en.yml index 941280c0..5b65f42e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -206,6 +206,8 @@ en: title: 'Your location in Sutty' logout: Log out mutual_aid: Mutual aid + contact_us: "Contact us" + contact_us_href: "https://sutty.nl/en/#contact" collaborations: collaborate: submit: Register diff --git a/config/locales/es.yml b/config/locales/es.yml index af84b474..bef67311 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -206,6 +206,8 @@ es: title: 'Tu ubicación en Sutty' logout: Cerrar sesión mutual_aid: Ayuda mutua + contact_us: "Contacto" + contact_us_href: "https://sutty.nl/#contacto" collaborations: collaborate: submit: Registrarme From e9d33b625a8843f9fb9a20015b36045a4e7ba010 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 25 Apr 2023 14:51:54 -0300 Subject: [PATCH 335/475] =?UTF-8?q?feat:=20encontrar=20el=20post=20a=20par?= =?UTF-8?q?tir=20de=20su=20indexaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/indexed_post.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/models/indexed_post.rb b/app/models/indexed_post.rb index 7f6865f6..184cd05f 100644 --- a/app/models/indexed_post.rb +++ b/app/models/indexed_post.rb @@ -36,6 +36,15 @@ class IndexedPost < ApplicationRecord belongs_to :site + # Encuentra el post original + # + # @return [nil,Post] + def post + return if post_id.blank? + + @post ||= site.posts(lang: locale).find(post_id, uuid: true) + end + # Convertir locale a direccionario de PG # # @param [String,Symbol] From f38251af7a30ca65848c68971fe6aad10a7ef074 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 26 Apr 2023 15:15:56 -0300 Subject: [PATCH 336/475] fix: permisos para posts indexados #13266 --- app/policies/indexed_post_policy.rb | 66 +++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 app/policies/indexed_post_policy.rb diff --git a/app/policies/indexed_post_policy.rb b/app/policies/indexed_post_policy.rb new file mode 100644 index 00000000..e0151c7a --- /dev/null +++ b/app/policies/indexed_post_policy.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +# Política de acceso a artículos +class IndexedPostPolicy + attr_reader :indexed_post, :usuarie, :site + + def initialize(usuarie, indexed_post) + @usuarie = usuarie + @indexed_post = indexed_post + @site = indexed_post.site + end + + def index? + true + end + + # Les invitades solo pueden ver sus propios posts + def show? + site.usuarie?(usuarie) || site.indexed_posts.by_usuarie(usuarie.id).find_by_post_id(indexed_post.post_id).present? + end + + def preview? + show? + end + + def new? + create? + end + + def create? + true + end + + def edit? + update? + end + + # Les invitades solo pueden modificar sus propios artículos + def update? + show? + end + + # Solo las usuarias pueden eliminar artículos. Les invitades pueden + # borrar sus propios artículos + def destroy? + update? + end + + # Las usuarias pueden ver todos los posts + # + # Les invitades solo pueden ver sus propios posts + class Scope + attr_reader :usuarie, :scope + + def initialize(usuarie, scope) + @usuarie = usuarie + @scope = scope + end + + def resolve + return scope if scope&.first&.site&.usuarie? usuarie + + scope.by_usuarie(usuarie.id) + end + end +end From a9bce070e8753c28dc208e650366b30013f5d9fa Mon Sep 17 00:00:00 2001 From: f Date: Wed, 26 Apr 2023 15:25:09 -0300 Subject: [PATCH 337/475] fix: temporalmente deshabilitar el cambio de plantillas #13260 --- app/views/sites/_form.haml | 59 +++++++++++++++++++------------------- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index 69997ffa..0dcccbe3 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -46,36 +46,37 @@ .invalid-feedback= site.errors.messages[:description].join(', ') %hr/ - .form-group#design_id - %h2= t('.design.title') - %p.lead= t('.help.design') - - if invalid? site, :design_id - = render 'bootstrap/alert' do - = t('activerecord.errors.models.site.attributes.design_id.layout_incompatible.help', - layouts: site.incompatible_layouts.to_sentence) - .row.row-cols-1.row-cols-md-2.designs - -# Demasiado complejo para un f.collection_radio_buttons - - Design.all.order(priority: :desc).each do |design| - .design.col.d-flex.flex-column - .custom-control.custom-radio - = f.radio_button :design_id, design.id, - checked: design.id == site.design_id, - disabled: design.disabled, - required: true, class: 'custom-control-input' - = f.label "design_id_#{design.id}", design.name, - class: 'custom-control-label' - .flex-fill - = sanitize_markdown design.description, - tags: %w[p a strong em] + - unless site.persisted? + .form-group#design_id + %h2= t('.design.title') + %p.lead= t('.help.design') + - if invalid? site, :design_id + = render 'bootstrap/alert' do + = t('activerecord.errors.models.site.attributes.design_id.layout_incompatible.help', + layouts: site.incompatible_layouts.to_sentence) + .row.row-cols-1.row-cols-md-2.designs + -# Demasiado complejo para un f.collection_radio_buttons + - Design.all.order(priority: :desc).each do |design| + .design.col.d-flex.flex-column + .custom-control.custom-radio + = f.radio_button :design_id, design.id, + checked: design.id == site.design_id, + disabled: design.disabled, + required: true, class: 'custom-control-input' + = f.label "design_id_#{design.id}", design.name, + class: 'custom-control-label' + .flex-fill + = sanitize_markdown design.description, + tags: %w[p a strong em] - .btn-group{ role: 'group', 'aria-label': t('.design.actions') } - - if design.url - = link_to t('.design.url'), design.url, - target: '_blank', class: 'btn' - - if design.license - = link_to t('.design.license'), design.license, - target: '_blank', class: 'btn' - %hr/ + .btn-group{ role: 'group', 'aria-label': t('.design.actions') } + - if design.url + = link_to t('.design.url'), design.url, + target: '_blank', class: 'btn' + - if design.license + = link_to t('.design.license'), design.license, + target: '_blank', class: 'btn' + %hr/ .form-group.licenses#license_id %h2= t('.licencia.title') diff --git a/config/locales/en.yml b/config/locales/en.yml index 2628ffb1..1f46ffed 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -410,7 +410,7 @@ en: name: "The name of your site. It can only include numbers and letters." title: 'The title can be anything you want' description: 'You site description that appears in search engines. Between 50 and 160 characters.' - design: 'Select the design for your site. You can change it later. We add more designs from time to time!' + design: 'Select the design for your site. We add more designs from time to time!' licencia: 'Everything we publish has automatic copyright. This means nobody can use our works without explicit permission. By using licenses, we stablish conditions by which we want to share diff --git a/config/locales/es.yml b/config/locales/es.yml index 6ad61228..3630ea25 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -416,7 +416,7 @@ es: name: 'El nombre de tu sitio que formará parte de la dirección (**ejemplo**.sutty.nl). Solo puede contener letras minúsculas, números y guiones.' title: 'El título de tu sitio puede ser lo que quieras.' description: 'La descripción del sitio, que saldrá en buscadores. Entre 50 y 160 caracteres.' - design: 'Elegí el diseño que va a tener tu sitio aquí. Podés cambiarlo luego. De tanto en tanto vamos sumando diseños nuevos.' + design: 'Elegí el diseño que va a tener tu sitio aquí. De tanto en tanto vamos sumando diseños nuevos.' licencia: 'Todo lo que publicamos posee automáticamente derechos de autore. Esto significa que nadie puede hacer uso de nuestras obras sin permiso explícito. Con las licencias establecemos From 1839d48893ca278a71208d40c17f3ed4d009233a Mon Sep 17 00:00:00 2001 From: f Date: Sat, 29 Apr 2023 18:10:28 -0300 Subject: [PATCH 338/475] fix: permitir el atributo start #13321 --- app/models/metadata_template.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/metadata_template.rb b/app/models/metadata_template.rb index 5de54be1..b324e71c 100644 --- a/app/models/metadata_template.rb +++ b/app/models/metadata_template.rb @@ -202,7 +202,7 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type, def allowed_attributes @allowed_attributes ||= %w[style href src alt controls data-align data-multimedia data-multimedia-inner id - name].freeze + name start].freeze end def allowed_tags From 068bed5c0ad58be73949dd9b01304db4295f7002 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 19 May 2023 14:34:24 -0300 Subject: [PATCH 339/475] Revert "deshabilitar el paginado temporalmente" This reverts commit 9c4a0a86f3eeec8f578e3872096896a710e01632. --- app/controllers/posts_controller.rb | 4 ++-- app/views/posts/index.haml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 9720fe13..21a6dc06 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -23,7 +23,7 @@ class PostsController < ApplicationController return unless stale?([current_usuarie, site, filter_params]) # Todos los artículos de este sitio para el idioma actual - @posts = site.indexed_posts.where(locale: locale) + @posts = site.indexed_posts.where(locale: locale).page(filter_params.delete(:page)) # De este tipo @posts = @posts.where(layout: filter_params[:layout]) if filter_params[:layout] # Que estén dentro de la categoría @@ -154,7 +154,7 @@ class PostsController < ApplicationController # # @return [Hash] def filter_params - @filter_params ||= params.permit(:q, :category, :layout).to_hash.select do |_, v| + @filter_params ||= params.permit(:q, :category, :layout, :page).to_hash.select do |_, v| v.present? end.transform_keys(&:to_sym) end diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index e8c3dea7..470e9641 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -85,6 +85,8 @@ %button.btn{ data: { action: 'reorder#bottom' } }= t('posts.reorder.bottom') %div + = link_to_prev_page @posts, t('posts.prev'), class: 'btn' + = link_to_next_page @posts, t('posts.next'), class: 'btn' %tbody - dir = @site.data.dig(params[:locale], 'dir') - size = @posts.size From 3540886554455ac1627b190327d32117e04bf129 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 19 May 2023 14:36:42 -0300 Subject: [PATCH 340/475] feat: poder paginar solo algunos sitios #12714 --- app/controllers/posts_controller.rb | 3 ++- app/views/posts/index.haml | 7 ++++--- db/migrate/20230519143500_add_pagination_to_site.rb | 8 ++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20230519143500_add_pagination_to_site.rb diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 21a6dc06..057c3068 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -23,7 +23,8 @@ class PostsController < ApplicationController return unless stale?([current_usuarie, site, filter_params]) # Todos los artículos de este sitio para el idioma actual - @posts = site.indexed_posts.where(locale: locale).page(filter_params.delete(:page)) + @posts = site.indexed_posts.where(locale: locale) + @posts = @posts.page(filter_params.delete(:page)) if site.pagination # De este tipo @posts = @posts.where(layout: filter_params[:layout]) if filter_params[:layout] # Que estén dentro de la categoría diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 470e9641..ae53aa7a 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -84,9 +84,10 @@ %button.btn{ data: { action: 'reorder#top' } }= t('posts.reorder.top') %button.btn{ data: { action: 'reorder#bottom' } }= t('posts.reorder.bottom') - %div - = link_to_prev_page @posts, t('posts.prev'), class: 'btn' - = link_to_next_page @posts, t('posts.next'), class: 'btn' + - if @site.pagination + %div + = link_to_prev_page @posts, t('posts.prev'), class: 'btn' + = link_to_next_page @posts, t('posts.next'), class: 'btn' %tbody - dir = @site.data.dig(params[:locale], 'dir') - size = @posts.size diff --git a/db/migrate/20230519143500_add_pagination_to_site.rb b/db/migrate/20230519143500_add_pagination_to_site.rb new file mode 100644 index 00000000..776fa318 --- /dev/null +++ b/db/migrate/20230519143500_add_pagination_to_site.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# Agrega la opción de paginación a los sitios +class AddPaginationToSites < ActiveRecord::Migration[6.1] + def change + add_column :sites, :pagination, :boolean, default: false + end +end From d0f7843fbf90ef936afe955b046d8cab1ee6f7d8 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 19 May 2023 14:40:42 -0300 Subject: [PATCH 341/475] fixup! feat: poder paginar solo algunos sitios #12714 --- db/migrate/20230519143500_add_pagination_to_site.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20230519143500_add_pagination_to_site.rb b/db/migrate/20230519143500_add_pagination_to_site.rb index 776fa318..387dc588 100644 --- a/db/migrate/20230519143500_add_pagination_to_site.rb +++ b/db/migrate/20230519143500_add_pagination_to_site.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # Agrega la opción de paginación a los sitios -class AddPaginationToSites < ActiveRecord::Migration[6.1] +class AddPaginationToSite < ActiveRecord::Migration[6.1] def change add_column :sites, :pagination, :boolean, default: false end From 5dcf87710b79005db0c0ee2a7f3a860fd8b6c5ee Mon Sep 17 00:00:00 2001 From: f Date: Sat, 20 May 2023 14:19:28 -0300 Subject: [PATCH 342/475] feat: generar contenedor con ruby 3.1 --- .woodpecker.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index cdd99651..1b81af31 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -67,6 +67,9 @@ pipeline: - "yarn.lock" matrix: include: + - ALPINE_VERSION: "3.17.3" + RUBY_VERSION: "3.1" + RUBY_PATCH: "4" - ALPINE_VERSION: "3.14.10" RUBY_VERSION: "2.7" RUBY_PATCH: "8" From e0ed3779404abc3989f3a50098fd241a478e279a Mon Sep 17 00:00:00 2001 From: f Date: Sat, 20 May 2023 14:20:17 -0300 Subject: [PATCH 343/475] =?UTF-8?q?feat:=20los=20assets=20todav=C3=ADa=20s?= =?UTF-8?q?e=20compilan=20en=20alpine=203.14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .woodpecker.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 1b81af31..325731b7 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -27,7 +27,7 @@ pipeline: - ".dockerignore" - ".woodpecker.yml" assets: - image: "gitea.nulo.in/sutty/panel:${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}" + image: "gitea.nulo.in/sutty/panel:3.14.10-2.7.8" commands: - "apk add python2 dotenv openssh-client brotli" - "install -d -m 700 ~/.ssh/" @@ -65,6 +65,10 @@ pipeline: - "app/javascript/**/*" - "package.json" - "yarn.lock" + matrix: + ALPINE_VERSION: "3.14.10" + RUBY_VERSION: "2.7" + RUBY_PATCH: "8" matrix: include: - ALPINE_VERSION: "3.17.3" From c12a6e1535f585ca273e639c8ebe324a3bff196b Mon Sep 17 00:00:00 2001 From: f Date: Sat, 20 May 2023 14:25:29 -0300 Subject: [PATCH 344/475] =?UTF-8?q?feat:=20poder=20pasar=20la=20versi?= =?UTF-8?q?=C3=B3n=20de=20ruby=20y=20gems=20por=20env?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .woodpecker.yml | 3 +++ Gemfile | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 325731b7..c2bc3a83 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -51,6 +51,9 @@ pipeline: - "git add public && git commit -m \"ci: assets [skip ci]\"" - "git pull upstream ${CI_COMMIT_BRANCH}" - "git push upstream ${CI_COMMIT_BRANCH}" + environment: + - "RUBY_VERSION=${RUBY_VERSION}" + - "GEMS_SOURCE=https://14.3.alpine.gems.sutty.nl" secrets: - "SSH_KEY" - "KNOWN_HOSTS" diff --git a/Gemfile b/Gemfile index b2472035..ad92645a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,8 @@ # frozen_string_literal: true -puts 'Usa haini.sh para generar un entorno de trabajo reproducible' -source 'https://gems.sutty.nl' +source 'https://17.3.alpine.gems.sutty.nl' -ruby '~> 2.7' +ruby "~> #{ENV.fetch('RUBY_VERSION', '3.1')}" gem 'dotenv-rails', require: 'dotenv/rails-now' From 202992d1cd210746be71af85c5535ffc48935823 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 20 May 2023 14:27:03 -0300 Subject: [PATCH 345/475] feat: actualizar a ruby 3.1 rails 6.1 --- Gemfile | 17 +- Gemfile.lock | 559 ++++++++++++++++++++++++--------------------------- 2 files changed, 276 insertions(+), 300 deletions(-) diff --git a/Gemfile b/Gemfile index ad92645a..948af2ee 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ ruby "~> #{ENV.fetch('RUBY_VERSION', '3.1')}" gem 'dotenv-rails', require: 'dotenv/rails-now' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 6' +gem 'rails', '~> 6.1' # Use Puma as the app server gem 'puma' @@ -50,10 +50,10 @@ gem 'image_processing' gem 'icalendar' gem 'inline_svg' gem 'httparty' -gem 'safe_yaml' -gem 'jekyll', '~> 4.2' +gem 'safe_yaml', require: false +gem 'jekyll', '~> 4.2.0' gem 'jekyll-data' -gem 'jekyll-commonmark' +gem 'jekyll-commonmark', '~> 1.4.0' gem 'jekyll-images' gem 'jekyll-include-cache' gem 'sutty-liquid', '>= 0.7.3' @@ -108,8 +108,7 @@ end group :development, :test do gem 'derailed_benchmarks' gem 'pry' - # Adds support for Capybara system testing and selenium driver - gem 'capybara', '~> 2.13' + gem 'capybara' gem 'selenium-webdriver' gem 'sqlite3' end @@ -118,11 +117,11 @@ group :development do gem 'brakeman' gem 'haml-lint', require: false gem 'letter_opener' - gem 'listen', '>= 3.0.5', '< 3.2' + gem 'listen' gem 'rubocop-rails' gem 'spring' - gem 'spring-watcher-listen', '~> 2.0.0' - gem 'web-console', '>= 3.3.0' + gem 'spring-watcher-listen' + gem 'web-console' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 67ce13e2..43db922a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -25,113 +25,115 @@ GIT groupdate (>= 5.2) GEM - remote: https://gems.sutty.nl/ + remote: https://17.3.alpine.gems.sutty.nl/ specs: - actioncable (6.1.4.1) - actionpack (= 6.1.4.1) - activesupport (= 6.1.4.1) + actioncable (6.1.7.3) + actionpack (= 6.1.7.3) + activesupport (= 6.1.7.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.4.1) - actionpack (= 6.1.4.1) - activejob (= 6.1.4.1) - activerecord (= 6.1.4.1) - activestorage (= 6.1.4.1) - activesupport (= 6.1.4.1) + actionmailbox (6.1.7.3) + actionpack (= 6.1.7.3) + activejob (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) mail (>= 2.7.1) - actionmailer (6.1.4.1) - actionpack (= 6.1.4.1) - actionview (= 6.1.4.1) - activejob (= 6.1.4.1) - activesupport (= 6.1.4.1) + actionmailer (6.1.7.3) + actionpack (= 6.1.7.3) + actionview (= 6.1.7.3) + activejob (= 6.1.7.3) + activesupport (= 6.1.7.3) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.4.1) - actionview (= 6.1.4.1) - activesupport (= 6.1.4.1) + actionpack (6.1.7.3) + actionview (= 6.1.7.3) + activesupport (= 6.1.7.3) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.4.1) - actionpack (= 6.1.4.1) - activerecord (= 6.1.4.1) - activestorage (= 6.1.4.1) - activesupport (= 6.1.4.1) + actiontext (6.1.7.3) + actionpack (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) nokogiri (>= 1.8.5) - actionview (6.1.4.1) - activesupport (= 6.1.4.1) + actionview (6.1.7.3) + activesupport (= 6.1.7.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.4.1) - activesupport (= 6.1.4.1) + activejob (6.1.7.3) + activesupport (= 6.1.7.3) globalid (>= 0.3.6) - activemodel (6.1.4.1) - activesupport (= 6.1.4.1) - activerecord (6.1.4.1) - activemodel (= 6.1.4.1) - activesupport (= 6.1.4.1) - activestorage (6.1.4.1) - actionpack (= 6.1.4.1) - activejob (= 6.1.4.1) - activerecord (= 6.1.4.1) - activesupport (= 6.1.4.1) - marcel (~> 1.0.0) + activemodel (6.1.7.3) + activesupport (= 6.1.7.3) + activerecord (6.1.7.3) + activemodel (= 6.1.7.3) + activesupport (= 6.1.7.3) + activestorage (6.1.7.3) + actionpack (= 6.1.7.3) + activejob (= 6.1.7.3) + activerecord (= 6.1.7.3) + activesupport (= 6.1.7.3) + marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.4.1) + activesupport (6.1.7.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.4) + public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) - autoprefixer-rails (10.3.3.0) + autoprefixer-rails (10.4.13.0) execjs (~> 2) - bcrypt (3.1.16-x86_64-linux-musl) + bcrypt (3.1.18-x86_64-linux-musl) bcrypt_pbkdf (1.1.0-x86_64-linux-musl) - benchmark-ips (2.9.2) + benchmark-ips (2.12.0) bindex (0.8.1-x86_64-linux-musl) - blazer (2.4.7) + blazer (2.6.5) activerecord (>= 5) chartkick (>= 3.2) railties (>= 5) safely_block (>= 0.1.1) - bootstrap (4.6.0) + bootstrap (4.6.2) autoprefixer-rails (>= 9.1.0) - popper_js (>= 1.14.3, < 2) + popper_js (>= 1.16.1, < 2) sassc-rails (>= 2.0.0) - brakeman (5.1.2) + brakeman (5.4.1) builder (3.2.4) - capybara (2.18.0) + capybara (3.39.1) addressable + matrix mini_mime (>= 0.1.3) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (>= 2.0, < 4.0) - chartkick (4.1.2) - childprocess (4.1.0) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (>= 1.5, < 3.0) + xpath (~> 3.2) + chartkick (5.0.2) climate_control (1.2.0) coderay (1.1.3) colorator (1.1.0) - commonmarker (0.21.2-x86_64-linux-musl) - ruby-enum (~> 0.5) - concurrent-ruby (1.1.9) - concurrent-ruby-ext (1.1.9-x86_64-linux-musl) - concurrent-ruby (= 1.1.9) + commonmarker (0.23.9-x86_64-linux-musl) + concurrent-ruby (1.2.2) + concurrent-ruby-ext (1.2.2-x86_64-linux-musl) + concurrent-ruby (= 1.2.2) + connection_pool (2.4.1) crass (1.0.6) - database_cleaner (2.0.1) - database_cleaner-active_record (~> 2.0.0) - database_cleaner-active_record (2.0.1) + database_cleaner (2.0.2) + database_cleaner-active_record (>= 2, < 3) + database_cleaner-active_record (2.1.0) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) - dead_end (3.1.0) - derailed_benchmarks (2.1.1) + date (3.3.3-x86_64-linux-musl) + dead_end (4.0.0) + derailed_benchmarks (2.1.2) benchmark-ips (~> 2) dead_end get_process_mem (~> 0) @@ -143,29 +145,29 @@ GEM rake (> 10, < 14) ruby-statistics (>= 2.1) thor (>= 0.19, < 2) - devise (4.8.0) + devise (4.9.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.10.1) - devise (>= 4.8.0) - devise_invitable (2.0.5) + devise-i18n (1.11.0) + devise (>= 4.9.0) + devise_invitable (2.0.8) actionmailer (>= 5.0) devise (>= 4.6) - distributed-press-api-client (0.2.2) + distributed-press-api-client (0.2.3) addressable (~> 2.3, >= 2.3.0) climate_control dry-schema httparty (~> 0.18) json (~> 2.1, >= 2.1.0) jwt (~> 2.6.0) - dotenv (2.7.6) - dotenv-rails (2.7.6) - dotenv (= 2.7.6) + dotenv (2.8.1) + dotenv-rails (2.8.1) + dotenv (= 2.8.1) railties (>= 3.2) - down (5.2.4) + down (5.4.0) addressable (~> 2.8) dry-configurable (1.0.1) dry-core (~> 1.0, < 2) @@ -179,65 +181,65 @@ GEM concurrent-ruby (~> 1.0) dry-core (~> 1.0, < 2) zeitwerk (~> 2.6) - dry-schema (1.13.0) + dry-schema (1.13.1) concurrent-ruby (~> 1.0) dry-configurable (~> 1.0, >= 1.0.1) dry-core (~> 1.0, < 2) dry-initializer (~> 3.0) - dry-logic (>= 1.5, < 2) + dry-logic (>= 1.4, < 2) dry-types (>= 1.7, < 2) zeitwerk (~> 2.6) - dry-types (1.7.0) + dry-types (1.7.1) concurrent-ruby (~> 1.0) - dry-core (~> 1.0, < 2) - dry-inflector (~> 1.0, < 2) - dry-logic (>= 1.4, < 2) + dry-core (~> 1.0) + dry-inflector (~> 1.0) + dry-logic (~> 1.4) zeitwerk (~> 2.6) - ed25519 (1.2.4-x86_64-linux-musl) + ed25519 (1.3.0-x86_64-linux-musl) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) - errbase (0.2.1) - erubi (1.10.0) + erubi (1.12.0) eventmachine (1.2.7-x86_64-linux-musl) - exception_notification (4.4.3) - actionmailer (>= 4.0, < 7) - activesupport (>= 4.0, < 7) + exception_notification (4.5.0) + actionmailer (>= 5.2, < 8) + activesupport (>= 5.2, < 8) execjs (2.8.1) - factory_bot (6.2.0) + factory_bot (6.2.1) activesupport (>= 5.0.0) factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) fast_blank (1.0.1-x86_64-linux-musl) fast_jsonparser (0.5.0-x86_64-linux-musl) - ffi (1.15.4-x86_64-linux-musl) + ffi (1.15.5-x86_64-linux-musl) flamegraph (0.9.5) forwardable-extended (2.6.0) - friendly_id (5.4.2) + friendly_id (5.5.0) activerecord (>= 4.0.0) get_process_mem (0.2.7) ffi (~> 1.0) - globalid (0.6.0) + globalid (1.1.0) activesupport (>= 5.0) - groupdate (6.1.0) + groupdate (6.2.1) activesupport (>= 5.2) - hairtrigger (0.2.24) - activerecord (>= 5.0, < 7) + hairtrigger (1.0.0) + activerecord (>= 6.0, < 8) ruby2ruby (~> 2.4) ruby_parser (~> 3.10) - haml (5.2.2) - temple (>= 0.8.0) + haml (6.1.1-x86_64-linux-musl) + temple (>= 0.8.2) + thor tilt haml-lint (0.999.999) haml_lint - haml_lint (0.37.1) - haml (>= 4.0, < 5.3) + haml_lint (0.45.0) + haml (>= 4.0, < 6.2) parallel (~> 1.10) rainbow rubocop (>= 0.50.0) sysexits (~> 1.1) - hamlit (2.15.1-x86_64-linux-musl) + hamlit (3.0.3-x86_64-linux-musl) temple (>= 0.8.2) thor tilt @@ -253,20 +255,21 @@ GEM httparty (0.21.0) mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) - i18n (1.8.11) + i18n (1.13.0) concurrent-ruby (~> 1.0) - icalendar (2.7.1) + icalendar (2.8.0) ice_cube (~> 0.16) ice_cube (0.16.4) - image_processing (1.12.1) + image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - inline_svg (1.7.2) + inline_svg (1.9.0) activesupport (>= 3.0) nokogiri (>= 1.6) - jbuilder (2.11.3) + jbuilder (2.11.5) + actionview (>= 5.0.0) activesupport (>= 5.0.0) - jekyll (4.2.1) + jekyll (4.2.2) addressable (~> 2.4) colorator (~> 1.0) em-websocket (~> 0.5) @@ -281,245 +284,222 @@ GEM rouge (~> 3.0) safe_yaml (~> 1.0) terminal-table (~> 2.0) - jekyll-commonmark (1.3.2) - commonmarker (~> 0.14, < 0.22) - jekyll (>= 3.7, < 5.0) + jekyll-commonmark (1.4.0) + commonmarker (~> 0.22) jekyll-data (1.1.2) jekyll (>= 3.3, < 5.0.0) - jekyll-dotenv (0.2.0) - dotenv (~> 2.7) - jekyll (~> 4) - jekyll-feed (0.15.1) - jekyll (>= 3.7, < 5.0) - jekyll-hardlinks (0.1.2) - jekyll (~> 4) - jekyll-ignore-layouts (0.1.2) - jekyll (~> 4) - jekyll-images (0.3.2) + jekyll-images (0.4.1) jekyll (~> 4) ruby-filemagic (~> 0.7) ruby-vips (~> 2) jekyll-include-cache (0.2.1) jekyll (>= 3.7, < 5.0) - jekyll-linked-posts (0.4.2) - jekyll (~> 4) - jekyll-locales (0.1.13) - jekyll-lunr (0.3.0) - loofah (~> 2.4) - jekyll-order (0.1.4) - jekyll-relative-urls (0.0.6) - jekyll (~> 4) - jekyll-sass-converter (2.1.0) + jekyll-sass-converter (2.2.0) sassc (> 2.0.1, < 3.0) - jekyll-seo-tag (2.7.1) - jekyll (>= 3.8, < 5.0) - jekyll-spree-client (0.1.19) - fast_blank (~> 1) - spree-api-client (>= 0.2.4) - jekyll-turbolinks (0.0.5) - jekyll (~> 4) - turbolinks-source (~> 5) - jekyll-unique-urls (0.1.1) - jekyll (~> 4) jekyll-watch (2.2.1) listen (~> 3.0) - jekyll-write-and-commit-changes (0.2.1) - jekyll (~> 4) - rugged (~> 1) + json (2.6.3-x86_64-linux-musl) jwt (2.6.0) - kaminari (1.2.1) + kaminari (1.2.2) activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.1) - kaminari-activerecord (= 1.2.1) - kaminari-core (= 1.2.1) - kaminari-actionview (1.2.1) + kaminari-actionview (= 1.2.2) + kaminari-activerecord (= 1.2.2) + kaminari-core (= 1.2.2) + kaminari-actionview (1.2.2) actionview - kaminari-core (= 1.2.1) - kaminari-activerecord (1.2.1) + kaminari-core (= 1.2.2) + kaminari-activerecord (1.2.2) activerecord - kaminari-core (= 1.2.1) - kaminari-core (1.2.1) - kramdown (2.3.1) + kaminari-core (= 1.2.2) + kaminari-core (1.2.2) + kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - launchy (2.5.0) - addressable (~> 2.7) - letter_opener (1.7.0) - launchy (~> 2.2) - liquid (4.0.3) - listen (3.1.5) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) + launchy (2.5.2) + addressable (~> 2.8) + letter_opener (1.8.1) + launchy (>= 2.2, < 3) + liquid (4.0.4) + listen (3.8.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) loaf (0.10.0) railties (>= 3.2) - lockbox (0.6.6) - lograge (0.11.2) + lockbox (1.2.0) + lograge (0.12.0) actionpack (>= 4) activesupport (>= 4) railties (>= 4) request_store (~> 1.0) - loofah (2.12.0) + loofah (2.21.3) crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) + nokogiri (>= 1.12.0) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (1.0.2) - memory_profiler (1.0.0) + matrix (0.4.2) + memory_profiler (1.0.1) mercenary (0.4.0) method_source (1.0.0) - mime-types (3.4.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2021.1115) mini_histogram (0.3.1) - mini_magick (4.11.0) + mini_magick (4.12.0) mini_mime (1.1.2) - mini_portile2 (2.6.1) - minitest (5.14.4) - mobility (1.2.4) + minitest (5.18.0) + mobility (1.2.9) i18n (>= 0.6.10, < 2) request_store (~> 1.0) multi_xml (0.6.0) - net-ssh (6.1.0) - netaddr (2.0.5) - nio4r (2.5.8-x86_64-linux-musl) - nokogiri (1.12.5-x86_64-linux-musl) - mini_portile2 (~> 2.6.1) - racc (~> 1.4) + net-imap (0.3.4) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.3.3) + net-protocol + net-ssh (7.1.0) + netaddr (2.0.6) + nio4r (2.5.9-x86_64-linux-musl) njalla-api-client (0.2.0) dry-schema httparty (~> 0.18) + nokogiri (1.15.1-x86_64-linux) + racc (~> 1.4) orm_adapter (0.5.0) - pairing_heap (3.0.0) - parallel (1.21.0) - parser (3.0.2.0) + pairing_heap (3.0.1) + parallel (1.23.0) + parser (3.2.2.1) ast (~> 2.4.1) pathutil (0.16.2) forwardable-extended (~> 2.6) - pg (1.2.3-x86_64-linux-musl) - pg_search (2.3.5) + pg (1.5.3-x86_64-linux-musl) + pg_search (2.3.6) activerecord (>= 5.2) activesupport (>= 5.2) - popper_js (1.16.0) - prometheus_exporter (1.0.0) + popper_js (1.16.1) + prometheus_exporter (2.0.8) webrick - pry (0.14.1) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (4.0.6) - puma (5.5.2-x86_64-linux-musl) + public_suffix (5.0.1) + puma (6.2.2-x86_64-linux-musl) nio4r (~> 2.0) - pundit (2.1.1) + pundit (2.3.0) activesupport (>= 3.0.0) - racc (1.6.0-x86_64-linux-musl) - rack (2.2.3) - rack-cors (1.1.1) + racc (1.6.2-x86_64-linux-musl) + rack (2.2.7) + rack-cors (2.0.1) rack (>= 2.0.0) - rack-mini-profiler (2.3.3) + rack-mini-profiler (3.1.0) rack (>= 1.2.0) - rack-proxy (0.7.0) + rack-proxy (0.7.6) rack - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (6.1.4.1) - actioncable (= 6.1.4.1) - actionmailbox (= 6.1.4.1) - actionmailer (= 6.1.4.1) - actionpack (= 6.1.4.1) - actiontext (= 6.1.4.1) - actionview (= 6.1.4.1) - activejob (= 6.1.4.1) - activemodel (= 6.1.4.1) - activerecord (= 6.1.4.1) - activestorage (= 6.1.4.1) - activesupport (= 6.1.4.1) + rack-test (2.1.0) + rack (>= 1.3) + rails (6.1.7.3) + actioncable (= 6.1.7.3) + actionmailbox (= 6.1.7.3) + actionmailer (= 6.1.7.3) + actionpack (= 6.1.7.3) + actiontext (= 6.1.7.3) + actionview (= 6.1.7.3) + activejob (= 6.1.7.3) + activemodel (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) bundler (>= 1.15.0) - railties (= 6.1.4.1) + railties (= 6.1.7.3) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.4.2) - loofah (~> 2.3) - rails-i18n (6.0.0) + rails-html-sanitizer (1.5.0) + loofah (~> 2.19, >= 2.19.1) + rails-i18n (7.0.7) i18n (>= 0.7, < 2) - railties (>= 6.0.0, < 7) + railties (>= 6.0.0, < 8) rails_warden (0.6.0) warden (>= 1.2.0) - railties (6.1.4.1) - actionpack (= 6.1.4.1) - activesupport (= 6.1.4.1) + railties (6.1.7.3) + actionpack (= 6.1.7.3) + activesupport (= 6.1.7.3) method_source - rake (>= 0.13) + rake (>= 12.2) thor (~> 1.0) - rainbow (3.0.0) + rainbow (3.1.1) rake (13.0.6) - rb-fsevent (0.11.0) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - redis (4.5.1) - redis-actionpack (5.2.0) - actionpack (>= 5, < 7) + redis (5.0.6) + redis-client (>= 0.9.0) + redis-actionpack (5.3.0) + actionpack (>= 5, < 8) redis-rack (>= 2.1.0, < 3) redis-store (>= 1.1.0, < 2) - redis-activesupport (5.2.1) - activesupport (>= 3, < 7) + redis-activesupport (5.3.0) + activesupport (>= 3, < 8) redis-store (>= 1.3, < 2) - redis-rack (2.1.3) + redis-client (0.14.1) + connection_pool + redis-rack (2.1.4) rack (>= 2.0.8, < 3) redis-store (>= 1.2, < 2) redis-rails (5.0.2) redis-actionpack (>= 5.0, < 6) redis-activesupport (>= 5.0, < 6) redis-store (>= 1.2, < 2) - redis-store (1.9.0) - redis (>= 4, < 5) - regexp_parser (2.1.1) - request_store (1.5.0) + redis-store (1.9.2) + redis (>= 4, < 6) + regexp_parser (2.8.0) + request_store (1.5.1) rack (>= 1.4) - responders (3.0.1) - actionpack (>= 5.0) - railties (>= 5.0) + responders (3.1.0) + actionpack (>= 5.2) + railties (>= 5.2) rexml (3.2.5) - rgl (0.6.2) + rgl (0.6.3) pairing_heap (>= 0.3.0) rexml (~> 3.2, >= 3.2.4) stream (~> 0.5.3) - rouge (3.26.1) - rubocop (1.23.0) + rouge (3.30.0) + rubocop (1.42.0) + json (~> 2.3) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.12.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.24.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.13.0) - parser (>= 3.0.1.1) - rubocop-rails (2.12.4) + rubocop-ast (1.28.1) + parser (>= 3.2.1.0) + rubocop-rails (2.19.1) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.7.0, < 2.0) - ruby-enum (0.9.0) - i18n - ruby-filemagic (0.7.2-x86_64-linux-musl) - ruby-progressbar (1.11.0) - ruby-statistics (3.0.0) + rubocop (>= 1.33.0, < 2.0) + ruby-filemagic (0.7.3-x86_64-linux-musl) + ruby-progressbar (1.13.0) + ruby-statistics (3.0.2) ruby-vips (2.1.4) ffi (~> 1.12) - ruby2ruby (2.4.4) + ruby2ruby (2.5.0) ruby_parser (~> 3.1) sexp_processor (~> 4.6) - ruby_dep (1.5.0) - ruby_parser (3.18.1) + ruby_parser (3.20.1) sexp_processor (~> 4.16) rubyzip (2.3.2) - rugged (1.2.0-x86_64-linux-musl) + rugged (1.6.3-x86_64-linux-musl) safe_yaml (1.0.6) - safely_block (0.3.0) - errbase (>= 0.1.1) + safely_block (0.4.0) sassc (2.4.0-x86_64-linux-musl) ffi (~> 1.9) sassc-rails (2.1.2) @@ -528,59 +508,55 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (4.1.0) - childprocess (>= 0.5, < 5.0) + selenium-webdriver (4.9.1) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) semantic_range (3.0.0) - sexp_processor (4.16.0) + sexp_processor (4.17.0) simpleidn (0.2.1) unf (~> 0.1.4) sourcemap (0.1.1) - spree-api-client (0.2.4) - fast_blank (~> 1) - httparty (~> 0.18.0) - spring (2.1.1) - spring-watcher-listen (2.0.1) + spring (4.1.1) + spring-watcher-listen (2.1.0) listen (>= 2.7, < 4.0) - spring (>= 1.2, < 3.0) - sprockets (4.0.2) + spring (>= 4) + sprockets (4.2.0) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.4.1) + rack (>= 2.2.4, < 4) + sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.4.2-x86_64-linux-musl) - stackprof (0.2.17-x86_64-linux-musl) + sqlite3 (1.6.3-x86_64-linux) + stackprof (0.2.25-x86_64-linux-musl) stream (0.5.5) - sucker_punch (3.0.1) + sucker_punch (3.1.0) concurrent-ruby (~> 1.0) - sutty-archives (2.5.4) - jekyll (>= 3.6, < 5.0) - sutty-liquid (0.7.4) + sutty-liquid (0.11.10) fast_blank (~> 1.0) jekyll (~> 4) symbol-fstring (1.0.2-x86_64-linux-musl) sysexits (1.2.0) - temple (0.8.2) + temple (0.10.1) terminal-table (2.0.0) unicode-display_width (~> 1.1, >= 1.1.1) - thor (1.1.0) - tilt (2.0.10) - timecop (0.9.4) + thor (1.2.2) + tilt (2.1.0) + timecop (0.9.6) + timeout (0.3.2) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (2.0.4) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.8-x86_64-linux-musl) + unf_ext (0.0.8.2-x86_64-linux-musl) unicode-display_width (1.8.0) - validates_hostname (1.0.11) + validates_hostname (1.0.13) activerecord (>= 3.0) activesupport (>= 3.0) warden (1.2.9) @@ -590,18 +566,19 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webpacker (5.4.3) + webpacker (5.4.4) activesupport (>= 5.2) rack-proxy (>= 0.6.1) railties (>= 5.2) semantic_range (>= 2.3.0) - webrick (1.7.0) + webrick (1.8.1) + websocket (1.2.9) websocket-driver (0.7.5-x86_64-linux-musl) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.5.1) + zeitwerk (2.6.8) PLATFORMS ruby @@ -613,7 +590,7 @@ DEPENDENCIES blazer bootstrap (~> 4) brakeman - capybara (~> 2.13) + capybara chartkick commonmarker concurrent-ruby-ext @@ -630,7 +607,7 @@ DEPENDENCIES exception_notification factory_bot_rails fast_blank - fast_jsonparser + fast_jsonparser (~> 0.5.0) flamegraph friendly_id hairtrigger @@ -642,14 +619,14 @@ DEPENDENCIES image_processing inline_svg jbuilder (~> 2.5) - jekyll (~> 4.2) - jekyll-commonmark + jekyll (~> 4.2.0) + jekyll-commonmark (~> 1.4.0) jekyll-data jekyll-images jekyll-include-cache kaminari letter_opener - listen (>= 3.0.5, < 3.2) + listen loaf lockbox lograge @@ -657,7 +634,7 @@ DEPENDENCIES mini_magick mobility net-ssh - njalla-api-client + njalla-api-client (~> 0.2.0) nokogiri pg pg_search @@ -667,7 +644,7 @@ DEPENDENCIES pundit rack-cors rack-mini-profiler - rails (~> 6) + rails (~> 6.1) rails-i18n rails_warden redis @@ -682,7 +659,7 @@ DEPENDENCIES selenium-webdriver sourcemap spring - spring-watcher-listen (~> 2.0.0) + spring-watcher-listen sqlite3 stackprof sucker_punch @@ -693,12 +670,12 @@ DEPENDENCIES turbolinks (~> 5) uglifier (>= 1.3.0) validates_hostname - web-console (>= 3.3.0) + web-console webpacker yaml_db! RUBY VERSION - ruby 2.7.1p83 + ruby 3.1.3p185 BUNDLED WITH 2.2.2 From 18b7f39248c136d5d7da3bb8dbf535ad48115180 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 20 May 2023 14:28:03 -0300 Subject: [PATCH 346/475] feat: crear una rama para probar los cambios --- .woodpecker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index c2bc3a83..a140f93f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -20,6 +20,7 @@ pipeline: branch: - "rails" - "panel.sutty.nl" + - "17.3.alpine.panel.sutty.nl" event: "push" path: include: @@ -62,6 +63,7 @@ pipeline: branch: - "rails" - "panel.sutty.nl" + - "17.3.alpine.panel.sutty.nl" path: include: - "app/assets/**/*" From 0056adf7373af8d6ffc8cb342108fa4c606432b6 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 20 May 2023 14:30:44 -0300 Subject: [PATCH 347/475] =?UTF-8?q?fixup!=20feat:=20poder=20pasar=20la=20v?= =?UTF-8?q?ersi=C3=B3n=20de=20ruby=20y=20gems=20por=20env?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 948af2ee..b2ede2ec 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ # frozen_string_literal: true -source 'https://17.3.alpine.gems.sutty.nl' +source ENV.fetch('GEMS_SOURCE', 'https://17.3.alpine.gems.sutty.nl') ruby "~> #{ENV.fetch('RUBY_VERSION', '3.1')}" From e7a6eb575110db58bb09273f08ccbf910fd1261e Mon Sep 17 00:00:00 2001 From: f Date: Sat, 20 May 2023 14:31:43 -0300 Subject: [PATCH 348/475] fixup! feat: actualizar a ruby 3.1 rails 6.1 --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index b2ede2ec..415d1fb4 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ ruby "~> #{ENV.fetch('RUBY_VERSION', '3.1')}" gem 'dotenv-rails', require: 'dotenv/rails-now' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 6.1' +gem 'rails', '~> 6.1.0' # Use Puma as the app server gem 'puma' diff --git a/Gemfile.lock b/Gemfile.lock index 43db922a..700abede 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -167,7 +167,7 @@ GEM dotenv-rails (2.8.1) dotenv (= 2.8.1) railties (>= 3.2) - down (5.4.0) + down (5.4.1) addressable (~> 2.8) dry-configurable (1.0.1) dry-core (~> 1.0, < 2) @@ -644,7 +644,7 @@ DEPENDENCIES pundit rack-cors rack-mini-profiler - rails (~> 6.1) + rails (~> 6.1.0) rails-i18n rails_warden redis From 521922c131db7a82f0b0cb9fdb03ff86a05f3395 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 20 May 2023 14:46:09 -0300 Subject: [PATCH 349/475] fix: no compilar assets en 3.17 --- .woodpecker.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index a140f93f..b5806bf3 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -63,7 +63,6 @@ pipeline: branch: - "rails" - "panel.sutty.nl" - - "17.3.alpine.panel.sutty.nl" path: include: - "app/assets/**/*" From e35bddf915ea332c0a169556d581d41744b6f0ad Mon Sep 17 00:00:00 2001 From: f Date: Wed, 24 May 2023 10:04:22 -0300 Subject: [PATCH 350/475] fix: no permitir que les usuaries elijan un idioma que no existe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit porque se les rompe el panel después --- app/models/usuarie.rb | 12 ++++++++++++ config/locales/en.yml | 4 ++++ config/locales/es.yml | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/app/models/usuarie.rb b/app/models/usuarie.rb index 2bc7a1b5..42f20c0b 100644 --- a/app/models/usuarie.rb +++ b/app/models/usuarie.rb @@ -10,6 +10,7 @@ class Usuarie < ApplicationRecord validates_uniqueness_of :email validates_with EmailAddress::ActiveRecordValidator, field: :email + validate :locale_available! before_create :lang_from_locale! before_update :remove_confirmation_invitation_inconsistencies! @@ -78,4 +79,15 @@ class Usuarie < ApplicationRecord self.invitation_accepted_at ||= Time.now.utc end end + + # Muestra un error si el idioma no está disponible al cambiar el + # idioma de la cuenta. + # + # @return [nil] + def locale_available! + return if I18n.locale_available? self.lang + + errors.add(:lang, I18n.t('activerecord.errors.models.usuarie.attributes.lang.not_available')) + nil + end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 5f97a8b9..ab6a9305 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -194,6 +194,10 @@ en: layout_incompatible: error: "Design can't be changed because there are posts with incompatible layouts" help: "Your site has posts with layouts only compatible with the current design. If you change it, the site won't work as you expect. If you're trying out designs, you can delete posts in the following incompatible layouts:: %{layouts}." + usuarie: + attributes: + lang: + not_available: "This language is not yet available, would you help us by translating Sutty into it?" errors: argument_error: 'Argument `%{argument}` must be an instance of %{class}' unknown_locale: 'Unknown %{locale} locale' diff --git a/config/locales/es.yml b/config/locales/es.yml index 9e0b8945..e3c271da 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -194,6 +194,10 @@ es: layout_incompatible: error: 'No se puede cambiar la plantilla porque hay artículos con formatos incompatibles' help: 'En tu sitio hay artículos que solo son compatibles con el diseño actual, si cambias la plantilla el sitio no funcionará como esperas. Si estás probando plantillas, puedes eliminar los artículos en los formatos incompatibles: %{layouts}.' + usuarie: + attributes: + lang: + not_available: "Este idioma todavía no está disponible, ¿nos ayudas a agregarlo y mantenerlo?" errors: argument_error: 'El argumento `%{argument}` debe ser una instancia de %{class}' unknown_locale: 'El idioma %{locale} es desconocido' From 4e002e042bc5b0e5c129ab8cac3df03cf340fefb Mon Sep 17 00:00:00 2001 From: f Date: Wed, 24 May 2023 10:06:11 -0300 Subject: [PATCH 351/475] fix: no permitir idiomas que no existen en el cambio de idioma #13493 --- app/controllers/application_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ee153394..2746ab10 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -59,7 +59,11 @@ class ApplicationController < ActionController::Base # # @return [String,Symbol] def current_locale - session[:locale] = params[:change_locale_to] if params[:change_locale_to].present? + locale = params[:change_locale_to] + + if locale.present? && I18n.locale_available?(locale) + session[:locale] = params[:change_locale_to] + end session[:locale] || current_usuarie&.lang || I18n.locale end From 28b74492f0d6ec60eaaf7545e36cfb425e5ffeaf Mon Sep 17 00:00:00 2001 From: Sutty Date: Tue, 16 May 2023 16:38:49 +0000 Subject: [PATCH 352/475] =?UTF-8?q?fix:=20dump=20de=20producci=C3=B3n=20#1?= =?UTF-8?q?3498?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/application.rb | 2 + db/schema.rb | 400 -------- db/structure.sql | 2267 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2269 insertions(+), 400 deletions(-) delete mode 100644 db/schema.rb create mode 100644 db/structure.sql diff --git a/config/application.rb b/config/application.rb index 057a22d3..606ccaf4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -45,6 +45,8 @@ module Sutty config.active_storage.queues.purge = :default config.active_job.queue_adapter = :que + config.active_record.schema_format = :sql + config.to_prepare do # Load application's model / class decorators Dir.glob(File.join(File.dirname(__FILE__), '..', 'app', '**', '*_decorator.rb')).sort.each do |c| diff --git a/db/schema.rb b/db/schema.rb deleted file mode 100644 index fd82d447..00000000 --- a/db/schema.rb +++ /dev/null @@ -1,400 +0,0 @@ -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# This file is the source Rails uses to define your schema when running `bin/rails -# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to -# be faster and is potentially less error prone than running all of your -# migrations from scratch. Old migrations may fail to apply correctly if those -# migrations use external dependencies or application code. -# -# It's strongly recommended that you check this file into your version control system. - -ActiveRecord::Schema.define(version: 2023_04_15_153231) do - - # These are extensions that must be enabled in order to support this database - enable_extension "pg_trgm" - enable_extension "pgcrypto" - enable_extension "plpgsql" - - create_table "access_logs", id: :uuid, default: nil, force: :cascade do |t| - t.string "host" - t.float "msec" - t.string "server_protocol" - t.string "request_method" - t.string "request_completion" - t.string "uri" - t.string "query_string" - t.integer "status" - t.string "sent_http_content_type" - t.string "sent_http_content_encoding" - t.string "sent_http_etag" - t.string "sent_http_last_modified" - t.string "http_accept" - t.string "http_accept_encoding" - t.string "http_accept_language" - t.string "http_pragma" - t.string "http_cache_control" - t.string "http_if_none_match" - t.string "http_dnt" - t.string "http_user_agent" - t.string "http_origin" - t.float "request_time" - t.integer "bytes_sent" - t.integer "body_bytes_sent" - t.integer "request_length" - t.string "http_connection" - t.string "pipe" - t.integer "connection_requests" - t.string "geoip2_data_country_name" - t.string "geoip2_data_city_name" - t.string "ssl_server_name" - t.string "ssl_protocol" - t.string "ssl_early_data" - t.string "ssl_session_reused" - t.string "ssl_curves" - t.string "ssl_ciphers" - t.string "ssl_cipher" - t.string "sent_http_x_xss_protection" - t.string "sent_http_x_frame_options" - t.string "sent_http_x_content_type_options" - t.string "sent_http_strict_transport_security" - t.string "nginx_version" - t.integer "pid" - t.string "remote_user" - t.boolean "crawler", default: false - t.string "http_referer" - t.datetime "created_at", precision: 6 - t.index ["geoip2_data_city_name"], name: "index_access_logs_on_geoip2_data_city_name" - t.index ["geoip2_data_country_name"], name: "index_access_logs_on_geoip2_data_country_name" - t.index ["host"], name: "index_access_logs_on_host" - t.index ["http_origin"], name: "index_access_logs_on_http_origin" - t.index ["http_user_agent"], name: "index_access_logs_on_http_user_agent" - t.index ["status"], name: "index_access_logs_on_status" - t.index ["uri"], name: "index_access_logs_on_uri" - end - - create_table "action_text_rich_texts", force: :cascade do |t| - t.string "name", null: false - t.text "body" - t.string "record_type", null: false - t.bigint "record_id", null: false - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true - end - - create_table "active_storage_attachments", force: :cascade do |t| - t.string "name", null: false - t.string "record_type", null: false - t.bigint "record_id", null: false - t.bigint "blob_id", null: false - t.datetime "created_at", null: false - t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" - t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true - end - - create_table "active_storage_blobs", force: :cascade do |t| - t.string "key", null: false - t.string "filename", null: false - t.string "content_type" - t.text "metadata" - t.bigint "byte_size", null: false - t.string "checksum", null: false - t.datetime "created_at", null: false - t.string "service_name", null: false - t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true - end - - create_table "active_storage_variant_records", force: :cascade do |t| - t.bigint "blob_id", null: false - t.string "variation_digest", null: false - t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true - end - - create_table "blazer_audits", force: :cascade do |t| - t.bigint "user_id" - t.bigint "query_id" - t.text "statement" - t.string "data_source" - t.datetime "created_at" - t.index ["query_id"], name: "index_blazer_audits_on_query_id" - t.index ["user_id"], name: "index_blazer_audits_on_user_id" - end - - create_table "blazer_checks", force: :cascade do |t| - t.bigint "creator_id" - t.bigint "query_id" - t.string "state" - t.string "schedule" - t.text "emails" - t.text "slack_channels" - t.string "check_type" - t.text "message" - t.datetime "last_run_at" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.index ["creator_id"], name: "index_blazer_checks_on_creator_id" - t.index ["query_id"], name: "index_blazer_checks_on_query_id" - end - - create_table "blazer_dashboard_queries", force: :cascade do |t| - t.bigint "dashboard_id" - t.bigint "query_id" - t.integer "position" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.index ["dashboard_id"], name: "index_blazer_dashboard_queries_on_dashboard_id" - t.index ["query_id"], name: "index_blazer_dashboard_queries_on_query_id" - end - - create_table "blazer_dashboards", force: :cascade do |t| - t.bigint "creator_id" - t.text "name" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.index ["creator_id"], name: "index_blazer_dashboards_on_creator_id" - end - - create_table "blazer_queries", force: :cascade do |t| - t.bigint "creator_id" - t.string "name" - t.text "description" - t.text "statement" - t.string "data_source" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.index ["creator_id"], name: "index_blazer_queries_on_creator_id" - end - - create_table "build_stats", force: :cascade do |t| - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.bigint "deploy_id" - t.bigint "bytes" - t.float "seconds" - t.string "action", null: false - t.text "log" - t.boolean "status", default: false - t.index ["deploy_id"], name: "index_build_stats_on_deploy_id" - end - - create_table "csp_reports", id: :uuid, default: nil, force: :cascade do |t| - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.string "disposition" - t.string "referrer" - t.string "blocked_uri" - t.string "document_uri" - t.string "effective_directive" - t.string "original_policy" - t.string "script_sample" - t.string "status_code" - t.string "violated_directive" - t.integer "column_number" - t.integer "line_number" - t.string "source_file" - end - - create_table "deploys", force: :cascade do |t| - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.bigint "site_id" - t.string "type" - t.text "values" - t.index ["site_id"], name: "index_deploys_on_site_id" - t.index ["type"], name: "index_deploys_on_type" - end - - create_table "designs", force: :cascade do |t| - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "name" - t.text "description" - t.string "gem" - t.string "url" - t.string "license" - t.boolean "disabled", default: false - t.text "credits" - t.string "designer_url" - t.integer "priority" - end - - create_table "indexed_posts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| - t.bigint "site_id" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.string "locale", default: "simple" - t.string "layout", null: false - t.string "path", null: false - t.string "title", default: "" - t.jsonb "front_matter", default: "{}" - t.string "content", default: "" - t.tsvector "indexed_content" - t.integer "order", default: 0 - t.string "dictionary" - t.index ["front_matter"], name: "index_indexed_posts_on_front_matter", using: :gin - t.index ["indexed_content"], name: "index_indexed_posts_on_indexed_content", using: :gin - t.index ["layout"], name: "index_indexed_posts_on_layout" - t.index ["locale"], name: "index_indexed_posts_on_locale" - t.index ["site_id"], name: "index_indexed_posts_on_site_id" - end - - create_table "licencias", force: :cascade do |t| - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "name" - t.text "description" - t.text "deed" - t.string "url" - t.string "icons" - end - - create_table "log_entries", force: :cascade do |t| - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.bigint "site_id" - t.text "text" - t.boolean "sent", default: false - t.index ["site_id"], name: "index_log_entries_on_site_id" - end - - create_table "maintenances", force: :cascade do |t| - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.text "message" - t.datetime "estimated_from" - t.datetime "estimated_to" - t.boolean "are_we_back", default: false - end - - create_table "mobility_string_translations", force: :cascade do |t| - t.string "locale", null: false - t.string "key", null: false - t.string "value" - t.string "translatable_type" - t.bigint "translatable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["translatable_id", "translatable_type", "key"], name: "index_mobility_string_translations_on_translatable_attribute" - t.index ["translatable_id", "translatable_type", "locale", "key"], name: "index_mobility_string_translations_on_keys", unique: true - t.index ["translatable_type", "key", "value", "locale"], name: "index_mobility_string_translations_on_query_keys" - end - - create_table "mobility_text_translations", force: :cascade do |t| - t.string "locale", null: false - t.string "key", null: false - t.text "value" - t.string "translatable_type" - t.bigint "translatable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["translatable_id", "translatable_type", "key"], name: "index_mobility_text_translations_on_translatable_attribute" - t.index ["translatable_id", "translatable_type", "locale", "key"], name: "index_mobility_text_translations_on_keys", unique: true - end - - create_table "roles", force: :cascade do |t| - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.bigint "site_id" - t.bigint "usuarie_id" - t.string "rol" - t.boolean "temporal" - t.index ["site_id", "usuarie_id"], name: "index_roles_on_site_id_and_usuarie_id", unique: true - t.index ["site_id"], name: "index_roles_on_site_id" - t.index ["usuarie_id"], name: "index_roles_on_usuarie_id" - end - - create_table "rollups", force: :cascade do |t| - t.string "name", null: false - t.string "interval", null: false - t.datetime "time", null: false - t.jsonb "dimensions", default: {}, null: false - t.float "value" - t.index ["name", "interval", "time", "dimensions"], name: "index_rollups_on_name_and_interval_and_time_and_dimensions", unique: true - end - - create_table "sites", force: :cascade do |t| - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "name" - t.bigint "design_id" - t.bigint "licencia_id" - t.string "status", default: "waiting" - t.text "description" - t.string "title" - t.boolean "colaboracion_anonima", default: false - t.boolean "contact", default: false - t.string "private_key_ciphertext" - t.boolean "acepta_invitades", default: false - t.string "tienda_api_key_ciphertext", default: "" - t.string "tienda_url", default: "" - t.string "api_key_ciphertext" - t.index ["design_id"], name: "index_sites_on_design_id" - t.index ["licencia_id"], name: "index_sites_on_licencia_id" - t.index ["name"], name: "index_sites_on_name", unique: true - end - - create_table "stats", force: :cascade do |t| - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.bigint "site_id" - t.string "name", null: false - t.index ["name"], name: "index_stats_on_name", using: :hash - t.index ["site_id"], name: "index_stats_on_site_id" - end - - create_table "usuaries", force: :cascade do |t| - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" - t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" - t.string "confirmation_token" - t.datetime "confirmed_at" - t.datetime "confirmation_sent_at" - t.string "unconfirmed_email" - t.integer "failed_attempts", default: 0, null: false - t.string "unlock_token" - t.datetime "locked_at" - t.boolean "acepta_politicas_de_privacidad", default: false - t.string "invitation_token" - t.datetime "invitation_created_at" - t.datetime "invitation_sent_at" - t.datetime "invitation_accepted_at" - t.integer "invitation_limit" - t.string "invited_by_type" - t.bigint "invited_by_id" - t.integer "invitations_count", default: 0 - t.string "lang", default: "es" - t.index ["confirmation_token"], name: "index_usuaries_on_confirmation_token", unique: true - t.index ["email"], name: "index_usuaries_on_email", unique: true - t.index ["invitation_token"], name: "index_usuaries_on_invitation_token", unique: true - t.index ["invitations_count"], name: "index_usuaries_on_invitations_count" - t.index ["invited_by_id"], name: "index_usuaries_on_invited_by_id" - t.index ["invited_by_type", "invited_by_id"], name: "index_usuaries_on_invited_by" - t.index ["reset_password_token"], name: "index_usuaries_on_reset_password_token", unique: true - t.index ["unlock_token"], name: "index_usuaries_on_unlock_token", unique: true - end - - add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" - add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" - - create_trigger("indexed_posts_before_insert_update_row_tr", :compatibility => 1). - on("indexed_posts"). - before(:insert, :update) do - <<-SQL_ACTIONS -new.indexed_content := to_tsvector(('pg_catalog.' || new.dictionary)::regconfig, coalesce(new.title, '') || ' -' || coalesce(new.content,'')); - SQL_ACTIONS - end - - create_trigger("access_logs_before_insert_row_tr", :compatibility => 1). - on("access_logs"). - before(:insert) do - "new.created_at := to_timestamp(new.msec);" - end - -end diff --git a/db/structure.sql b/db/structure.sql new file mode 100644 index 00000000..e50ae337 --- /dev/null +++ b/db/structure.sql @@ -0,0 +1,2267 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 15.2 +-- Dumped by pg_dump version 15.2 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- Name: public; Type: SCHEMA; Schema: -; Owner: - +-- + +-- *not* creating schema, since initdb creates it + + +-- +-- Name: dblink; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS dblink WITH SCHEMA public; + + +-- +-- Name: EXTENSION dblink; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION dblink IS 'connect to other PostgreSQL databases from within a database'; + + +-- +-- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public; + + +-- +-- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams'; + + +-- +-- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public; + + +-- +-- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions'; + + +-- +-- Name: que_validate_tags(jsonb); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.que_validate_tags(tags_array jsonb) RETURNS boolean + LANGUAGE sql + AS $$ + SELECT bool_and( + jsonb_typeof(value) = 'string' + AND + char_length(value::text) <= 100 + ) + FROM jsonb_array_elements(tags_array) +$$; + + +SET default_tablespace = ''; + +SET default_table_access_method = heap; + +-- +-- Name: que_jobs; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.que_jobs ( + priority smallint DEFAULT 100 NOT NULL, + run_at timestamp with time zone DEFAULT now() NOT NULL, + id bigint NOT NULL, + job_class text NOT NULL, + error_count integer DEFAULT 0 NOT NULL, + last_error_message text, + queue text DEFAULT 'default'::text NOT NULL, + last_error_backtrace text, + finished_at timestamp with time zone, + expired_at timestamp with time zone, + args jsonb DEFAULT '[]'::jsonb NOT NULL, + data jsonb DEFAULT '{}'::jsonb NOT NULL, + job_schema_version integer NOT NULL, + kwargs jsonb DEFAULT '{}'::jsonb NOT NULL, + CONSTRAINT error_length CHECK (((char_length(last_error_message) <= 500) AND (char_length(last_error_backtrace) <= 10000))), + CONSTRAINT job_class_length CHECK ((char_length( +CASE job_class + WHEN 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper'::text THEN ((args -> 0) ->> 'job_class'::text) + ELSE job_class +END) <= 200)), + CONSTRAINT queue_length CHECK ((char_length(queue) <= 100)), + CONSTRAINT valid_args CHECK ((jsonb_typeof(args) = 'array'::text)), + CONSTRAINT valid_data CHECK (((jsonb_typeof(data) = 'object'::text) AND ((NOT (data ? 'tags'::text)) OR ((jsonb_typeof((data -> 'tags'::text)) = 'array'::text) AND (jsonb_array_length((data -> 'tags'::text)) <= 5) AND public.que_validate_tags((data -> 'tags'::text)))))) +) +WITH (fillfactor='90'); + + +-- +-- Name: TABLE que_jobs; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE public.que_jobs IS '7'; + + +-- +-- Name: access_logs_before_insert_row_tr(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.access_logs_before_insert_row_tr() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + new.created_at := to_timestamp(new.msec); + RETURN NEW; +END; +$$; + + +-- +-- Name: indexed_posts_before_insert_update_row_tr(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.indexed_posts_before_insert_update_row_tr() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + new.indexed_content := to_tsvector(('pg_catalog.' || new.dictionary)::regconfig, coalesce(new.title, '') || ' + ' || coalesce(new.content,'')); + RETURN NEW; +END; +$$; + + +-- +-- Name: que_determine_job_state(public.que_jobs); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.que_determine_job_state(job public.que_jobs) RETURNS text + LANGUAGE sql + AS $$ + SELECT + CASE + WHEN job.expired_at IS NOT NULL THEN 'expired' + WHEN job.finished_at IS NOT NULL THEN 'finished' + WHEN job.error_count > 0 THEN 'errored' + WHEN job.run_at > CURRENT_TIMESTAMP THEN 'scheduled' + ELSE 'ready' + END +$$; + + +-- +-- Name: que_job_notify(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.que_job_notify() RETURNS trigger + LANGUAGE plpgsql + AS $$ + DECLARE + locker_pid integer; + sort_key json; + BEGIN + -- Don't do anything if the job is scheduled for a future time. + IF NEW.run_at IS NOT NULL AND NEW.run_at > now() THEN + RETURN null; + END IF; + + -- Pick a locker to notify of the job's insertion, weighted by their number + -- of workers. Should bounce pseudorandomly between lockers on each + -- invocation, hence the md5-ordering, but still touch each one equally, + -- hence the modulo using the job_id. + SELECT pid + INTO locker_pid + FROM ( + SELECT *, last_value(row_number) OVER () + 1 AS count + FROM ( + SELECT *, row_number() OVER () - 1 AS row_number + FROM ( + SELECT * + FROM public.que_lockers ql, generate_series(1, ql.worker_count) AS id + WHERE + listening AND + queues @> ARRAY[NEW.queue] AND + ql.job_schema_version = NEW.job_schema_version + ORDER BY md5(pid::text || id::text) + ) t1 + ) t2 + ) t3 + WHERE NEW.id % count = row_number; + + IF locker_pid IS NOT NULL THEN + -- There's a size limit to what can be broadcast via LISTEN/NOTIFY, so + -- rather than throw errors when someone enqueues a big job, just + -- broadcast the most pertinent information, and let the locker query for + -- the record after it's taken the lock. The worker will have to hit the + -- DB in order to make sure the job is still visible anyway. + SELECT row_to_json(t) + INTO sort_key + FROM ( + SELECT + 'job_available' AS message_type, + NEW.queue AS queue, + NEW.priority AS priority, + NEW.id AS id, + -- Make sure we output timestamps as UTC ISO 8601 + to_char(NEW.run_at AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.US"Z"') AS run_at + ) t; + + PERFORM pg_notify('que_listener_' || locker_pid::text, sort_key::text); + END IF; + + RETURN null; + END +$$; + + +-- +-- Name: que_state_notify(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.que_state_notify() RETURNS trigger + LANGUAGE plpgsql + AS $$ + DECLARE + row record; + message json; + previous_state text; + current_state text; + BEGIN + IF TG_OP = 'INSERT' THEN + previous_state := 'nonexistent'; + current_state := public.que_determine_job_state(NEW); + row := NEW; + ELSIF TG_OP = 'DELETE' THEN + previous_state := public.que_determine_job_state(OLD); + current_state := 'nonexistent'; + row := OLD; + ELSIF TG_OP = 'UPDATE' THEN + previous_state := public.que_determine_job_state(OLD); + current_state := public.que_determine_job_state(NEW); + + -- If the state didn't change, short-circuit. + IF previous_state = current_state THEN + RETURN null; + END IF; + + row := NEW; + ELSE + RAISE EXCEPTION 'Unrecognized TG_OP: %', TG_OP; + END IF; + + SELECT row_to_json(t) + INTO message + FROM ( + SELECT + 'job_change' AS message_type, + row.id AS id, + row.queue AS queue, + + coalesce(row.data->'tags', '[]'::jsonb) AS tags, + + to_char(row.run_at AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.US"Z"') AS run_at, + to_char(now() AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.US"Z"') AS time, + + CASE row.job_class + WHEN 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' THEN + coalesce( + row.args->0->>'job_class', + 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' + ) + ELSE + row.job_class + END AS job_class, + + previous_state AS previous_state, + current_state AS current_state + ) t; + + PERFORM pg_notify('que_state', message::text); + + RETURN null; + END +$$; + + +-- +-- Name: access_logs; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.access_logs ( + id uuid DEFAULT public.gen_random_uuid() NOT NULL, + host character varying, + msec double precision, + server_protocol character varying, + request_method character varying, + request_completion character varying, + uri character varying, + query_string character varying, + status integer, + sent_http_content_type character varying, + sent_http_content_encoding character varying, + sent_http_etag character varying, + sent_http_last_modified character varying, + http_accept character varying, + http_accept_encoding character varying, + http_accept_language character varying, + http_pragma character varying, + http_cache_control character varying, + http_if_none_match character varying, + http_dnt character varying, + http_user_agent character varying, + http_origin character varying, + request_time double precision, + bytes_sent integer, + body_bytes_sent integer, + request_length integer, + http_connection character varying, + pipe character varying, + connection_requests integer, + geoip2_data_country_name character varying, + geoip2_data_city_name character varying, + ssl_server_name character varying, + ssl_protocol character varying, + ssl_early_data character varying, + ssl_session_reused character varying, + ssl_curves character varying, + ssl_ciphers character varying, + ssl_cipher character varying, + sent_http_x_xss_protection character varying, + sent_http_x_frame_options character varying, + sent_http_x_content_type_options character varying, + sent_http_strict_transport_security character varying, + nginx_version character varying, + pid integer, + remote_user character varying, + crawler boolean DEFAULT false, + http_referer character varying, + created_at timestamp(6) without time zone, + request_uri character varying DEFAULT ''::character varying, + datacenter_co2 numeric, + network_co2 numeric, + consumer_device_co2 numeric, + production_co2 numeric, + total_co2 numeric, + node character varying +); + + +-- +-- Name: action_text_rich_texts; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.action_text_rich_texts ( + id bigint NOT NULL, + name character varying NOT NULL, + body text, + record_type character varying NOT NULL, + record_id integer NOT NULL, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: action_text_rich_texts_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.action_text_rich_texts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: action_text_rich_texts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.action_text_rich_texts_id_seq OWNED BY public.action_text_rich_texts.id; + + +-- +-- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.active_storage_attachments ( + id bigint NOT NULL, + name character varying NOT NULL, + record_type character varying NOT NULL, + record_id integer NOT NULL, + blob_id integer NOT NULL, + created_at timestamp without time zone NOT NULL +); + + +-- +-- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.active_storage_attachments_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id; + + +-- +-- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.active_storage_blobs ( + id bigint NOT NULL, + key character varying NOT NULL, + filename character varying NOT NULL, + content_type character varying, + metadata text, + byte_size bigint NOT NULL, + checksum character varying NOT NULL, + created_at timestamp without time zone NOT NULL, + service_name character varying NOT NULL +); + + +-- +-- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.active_storage_blobs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id; + + +-- +-- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.active_storage_variant_records ( + id bigint NOT NULL, + blob_id bigint NOT NULL, + variation_digest character varying NOT NULL +); + + +-- +-- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.active_storage_variant_records_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id; + + +-- +-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.ar_internal_metadata ( + key character varying NOT NULL, + value character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: blazer_audits; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.blazer_audits ( + id bigint NOT NULL, + user_id bigint, + query_id bigint, + statement text, + data_source character varying, + created_at timestamp without time zone +); + + +-- +-- Name: blazer_audits_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.blazer_audits_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blazer_audits_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.blazer_audits_id_seq OWNED BY public.blazer_audits.id; + + +-- +-- Name: blazer_checks; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.blazer_checks ( + id bigint NOT NULL, + creator_id bigint, + query_id bigint, + state character varying, + schedule character varying, + emails text, + slack_channels text, + check_type character varying, + message text, + last_run_at timestamp without time zone, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: blazer_checks_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.blazer_checks_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blazer_checks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.blazer_checks_id_seq OWNED BY public.blazer_checks.id; + + +-- +-- Name: blazer_dashboard_queries; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.blazer_dashboard_queries ( + id bigint NOT NULL, + dashboard_id bigint, + query_id bigint, + "position" integer, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: blazer_dashboard_queries_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.blazer_dashboard_queries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blazer_dashboard_queries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.blazer_dashboard_queries_id_seq OWNED BY public.blazer_dashboard_queries.id; + + +-- +-- Name: blazer_dashboards; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.blazer_dashboards ( + id bigint NOT NULL, + creator_id bigint, + name text, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: blazer_dashboards_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.blazer_dashboards_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blazer_dashboards_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.blazer_dashboards_id_seq OWNED BY public.blazer_dashboards.id; + + +-- +-- Name: blazer_queries; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.blazer_queries ( + id bigint NOT NULL, + creator_id bigint, + name character varying, + description text, + statement text, + data_source character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: blazer_queries_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.blazer_queries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blazer_queries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.blazer_queries_id_seq OWNED BY public.blazer_queries.id; + + +-- +-- Name: build_stats; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.build_stats ( + id bigint NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + deploy_id integer, + bytes bigint, + seconds double precision, + action character varying NOT NULL, + log text, + status boolean DEFAULT false +); + + +-- +-- Name: build_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.build_stats_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: build_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.build_stats_id_seq OWNED BY public.build_stats.id; + + +-- +-- Name: codes_of_conduct; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.codes_of_conduct ( + id bigint NOT NULL, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + title character varying, + description text, + content text +); + + +-- +-- Name: codes_of_conduct_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.codes_of_conduct_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: codes_of_conduct_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.codes_of_conduct_id_seq OWNED BY public.codes_of_conduct.id; + + +-- +-- Name: csp_reports; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.csp_reports ( + id uuid DEFAULT public.gen_random_uuid() NOT NULL, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + disposition character varying, + referrer character varying, + blocked_uri character varying, + document_uri character varying, + effective_directive character varying, + original_policy character varying, + script_sample character varying, + status_code character varying, + violated_directive character varying, + column_number integer, + line_number integer, + source_file character varying +); + + +-- +-- Name: deploys; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.deploys ( + id bigint NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + site_id integer, + type character varying, + "values" text +); + + +-- +-- Name: deploys_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.deploys_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: deploys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.deploys_id_seq OWNED BY public.deploys.id; + + +-- +-- Name: designs; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.designs ( + id bigint NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + name character varying, + description text, + gem character varying, + url character varying, + license character varying, + disabled boolean DEFAULT false, + credits text, + designer_url character varying, + priority integer +); + + +-- +-- Name: designs_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.designs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: designs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.designs_id_seq OWNED BY public.designs.id; + + +-- +-- Name: distributed_press_publishers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.distributed_press_publishers ( + id bigint NOT NULL, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + instance character varying, + token_ciphertext text NOT NULL, + expires_at timestamp without time zone +); + + +-- +-- Name: distributed_press_publishers_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.distributed_press_publishers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: distributed_press_publishers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.distributed_press_publishers_id_seq OWNED BY public.distributed_press_publishers.id; + + +-- +-- Name: indexed_posts; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.indexed_posts ( + id uuid DEFAULT public.gen_random_uuid() NOT NULL, + site_id bigint, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + locale character varying DEFAULT 'simple'::character varying, + layout character varying NOT NULL, + path character varying NOT NULL, + title character varying DEFAULT ''::character varying, + front_matter jsonb DEFAULT '"{}"'::jsonb, + content character varying DEFAULT ''::character varying, + indexed_content tsvector, + "order" integer DEFAULT 0, + dictionary character varying, + post_id uuid +); + + +-- +-- Name: licencias; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.licencias ( + id bigint NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + name character varying, + description text, + deed text, + url character varying, + icons character varying, + short_description character varying +); + + +-- +-- Name: licencias_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.licencias_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: licencias_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.licencias_id_seq OWNED BY public.licencias.id; + + +-- +-- Name: log_entries; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.log_entries ( + id bigint NOT NULL, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + site_id bigint, + text text, + sent boolean DEFAULT false +); + + +-- +-- Name: log_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.log_entries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: log_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.log_entries_id_seq OWNED BY public.log_entries.id; + + +-- +-- Name: maintenances; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.maintenances ( + id bigint NOT NULL, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + message text, + estimated_from timestamp without time zone, + estimated_to timestamp without time zone, + are_we_back boolean DEFAULT false +); + + +-- +-- Name: maintenances_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.maintenances_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: maintenances_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.maintenances_id_seq OWNED BY public.maintenances.id; + + +-- +-- Name: mobility_string_translations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mobility_string_translations ( + id bigint NOT NULL, + locale character varying NOT NULL, + key character varying NOT NULL, + value character varying, + translatable_type character varying, + translatable_id integer, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: mobility_string_translations_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.mobility_string_translations_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mobility_string_translations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.mobility_string_translations_id_seq OWNED BY public.mobility_string_translations.id; + + +-- +-- Name: mobility_text_translations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mobility_text_translations ( + id bigint NOT NULL, + locale character varying NOT NULL, + key character varying NOT NULL, + value text, + translatable_type character varying, + translatable_id integer, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: mobility_text_translations_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.mobility_text_translations_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mobility_text_translations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.mobility_text_translations_id_seq OWNED BY public.mobility_text_translations.id; + + +-- +-- Name: privacy_policies; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.privacy_policies ( + id bigint NOT NULL, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + title character varying, + description text, + content text +); + + +-- +-- Name: privacy_policies_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.privacy_policies_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: privacy_policies_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.privacy_policies_id_seq OWNED BY public.privacy_policies.id; + + +-- +-- Name: que_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.que_jobs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: que_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.que_jobs_id_seq OWNED BY public.que_jobs.id; + + +-- +-- Name: que_lockers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE UNLOGGED TABLE public.que_lockers ( + pid integer NOT NULL, + worker_count integer NOT NULL, + worker_priorities integer[] NOT NULL, + ruby_pid integer NOT NULL, + ruby_hostname text NOT NULL, + queues text[] NOT NULL, + listening boolean NOT NULL, + job_schema_version integer DEFAULT 1, + CONSTRAINT valid_queues CHECK (((array_ndims(queues) = 1) AND (array_length(queues, 1) IS NOT NULL))), + CONSTRAINT valid_worker_priorities CHECK (((array_ndims(worker_priorities) = 1) AND (array_length(worker_priorities, 1) IS NOT NULL))) +); + + +-- +-- Name: que_values; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.que_values ( + key text NOT NULL, + value jsonb DEFAULT '{}'::jsonb NOT NULL, + CONSTRAINT valid_value CHECK ((jsonb_typeof(value) = 'object'::text)) +) +WITH (fillfactor='90'); + + +-- +-- Name: roles; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.roles ( + id bigint NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + site_id integer, + usuarie_id integer, + rol character varying, + temporal boolean +); + + +-- +-- Name: roles_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.roles_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.roles_id_seq OWNED BY public.roles.id; + + +-- +-- Name: rollups; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.rollups ( + id bigint NOT NULL, + name character varying NOT NULL, + "interval" character varying NOT NULL, + "time" timestamp without time zone NOT NULL, + dimensions jsonb DEFAULT '{}'::jsonb NOT NULL, + value double precision +); + + +-- +-- Name: rollups_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.rollups_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: rollups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.rollups_id_seq OWNED BY public.rollups.id; + + +-- +-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.schema_migrations ( + version character varying NOT NULL +); + + +-- +-- Name: sites; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.sites ( + id bigint NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + name character varying, + design_id integer, + licencia_id integer, + status character varying DEFAULT 'waiting'::character varying, + description text, + title character varying, + colaboracion_anonima boolean DEFAULT false, + contact boolean DEFAULT false, + private_key_ciphertext character varying, + acepta_invitades boolean DEFAULT false, + tienda_api_key_ciphertext character varying DEFAULT ''::character varying, + tienda_url character varying DEFAULT ''::character varying, + api_key_ciphertext character varying, + slugify_mode character varying DEFAULT 'default'::character varying +); + + +-- +-- Name: sites_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.sites_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sites_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.sites_id_seq OWNED BY public.sites.id; + + +-- +-- Name: stats; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.stats ( + id bigint NOT NULL, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + site_id bigint, + name character varying NOT NULL +); + + +-- +-- Name: stats_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.stats_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.stats_id_seq OWNED BY public.stats.id; + + +-- +-- Name: usuaries; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.usuaries ( + id bigint NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + email character varying DEFAULT ''::character varying NOT NULL, + encrypted_password character varying DEFAULT ''::character varying NOT NULL, + reset_password_token character varying, + reset_password_sent_at timestamp without time zone, + remember_created_at timestamp without time zone, + confirmation_token character varying, + confirmed_at timestamp without time zone, + confirmation_sent_at timestamp without time zone, + unconfirmed_email character varying, + failed_attempts integer DEFAULT 0 NOT NULL, + unlock_token character varying, + locked_at timestamp without time zone, + invitation_token character varying, + invitation_created_at timestamp without time zone, + invitation_sent_at timestamp without time zone, + invitation_accepted_at timestamp without time zone, + invitation_limit integer, + invited_by_type character varying, + invited_by_id integer, + invitations_count integer DEFAULT 0, + lang character varying DEFAULT 'es'::character varying, + privacy_policy_accepted_at timestamp without time zone, + terms_of_service_accepted_at timestamp without time zone, + code_of_conduct_accepted_at timestamp without time zone, + available_for_feedback_accepted_at timestamp without time zone +); + + +-- +-- Name: usuaries_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.usuaries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: usuaries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.usuaries_id_seq OWNED BY public.usuaries.id; + + +-- +-- Name: action_text_rich_texts id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.action_text_rich_texts ALTER COLUMN id SET DEFAULT nextval('public.action_text_rich_texts_id_seq'::regclass); + + +-- +-- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass); + + +-- +-- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass); + + +-- +-- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass); + + +-- +-- Name: blazer_audits id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.blazer_audits ALTER COLUMN id SET DEFAULT nextval('public.blazer_audits_id_seq'::regclass); + + +-- +-- Name: blazer_checks id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.blazer_checks ALTER COLUMN id SET DEFAULT nextval('public.blazer_checks_id_seq'::regclass); + + +-- +-- Name: blazer_dashboard_queries id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.blazer_dashboard_queries ALTER COLUMN id SET DEFAULT nextval('public.blazer_dashboard_queries_id_seq'::regclass); + + +-- +-- Name: blazer_dashboards id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.blazer_dashboards ALTER COLUMN id SET DEFAULT nextval('public.blazer_dashboards_id_seq'::regclass); + + +-- +-- Name: blazer_queries id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.blazer_queries ALTER COLUMN id SET DEFAULT nextval('public.blazer_queries_id_seq'::regclass); + + +-- +-- Name: build_stats id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.build_stats ALTER COLUMN id SET DEFAULT nextval('public.build_stats_id_seq'::regclass); + + +-- +-- Name: codes_of_conduct id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.codes_of_conduct ALTER COLUMN id SET DEFAULT nextval('public.codes_of_conduct_id_seq'::regclass); + + +-- +-- Name: deploys id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.deploys ALTER COLUMN id SET DEFAULT nextval('public.deploys_id_seq'::regclass); + + +-- +-- Name: designs id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.designs ALTER COLUMN id SET DEFAULT nextval('public.designs_id_seq'::regclass); + + +-- +-- Name: distributed_press_publishers id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.distributed_press_publishers ALTER COLUMN id SET DEFAULT nextval('public.distributed_press_publishers_id_seq'::regclass); + + +-- +-- Name: licencias id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.licencias ALTER COLUMN id SET DEFAULT nextval('public.licencias_id_seq'::regclass); + + +-- +-- Name: log_entries id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.log_entries ALTER COLUMN id SET DEFAULT nextval('public.log_entries_id_seq'::regclass); + + +-- +-- Name: maintenances id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.maintenances ALTER COLUMN id SET DEFAULT nextval('public.maintenances_id_seq'::regclass); + + +-- +-- Name: mobility_string_translations id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mobility_string_translations ALTER COLUMN id SET DEFAULT nextval('public.mobility_string_translations_id_seq'::regclass); + + +-- +-- Name: mobility_text_translations id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mobility_text_translations ALTER COLUMN id SET DEFAULT nextval('public.mobility_text_translations_id_seq'::regclass); + + +-- +-- Name: privacy_policies id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.privacy_policies ALTER COLUMN id SET DEFAULT nextval('public.privacy_policies_id_seq'::regclass); + + +-- +-- Name: que_jobs id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.que_jobs ALTER COLUMN id SET DEFAULT nextval('public.que_jobs_id_seq'::regclass); + + +-- +-- Name: roles id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.roles ALTER COLUMN id SET DEFAULT nextval('public.roles_id_seq'::regclass); + + +-- +-- Name: rollups id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.rollups ALTER COLUMN id SET DEFAULT nextval('public.rollups_id_seq'::regclass); + + +-- +-- Name: sites id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.sites ALTER COLUMN id SET DEFAULT nextval('public.sites_id_seq'::regclass); + + +-- +-- Name: stats id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.stats ALTER COLUMN id SET DEFAULT nextval('public.stats_id_seq'::regclass); + + +-- +-- Name: usuaries id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.usuaries ALTER COLUMN id SET DEFAULT nextval('public.usuaries_id_seq'::regclass); + + +-- +-- Name: access_logs access_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.access_logs + ADD CONSTRAINT access_logs_pkey PRIMARY KEY (id); + + +-- +-- Name: action_text_rich_texts action_text_rich_texts_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.action_text_rich_texts + ADD CONSTRAINT action_text_rich_texts_pkey PRIMARY KEY (id); + + +-- +-- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.active_storage_attachments + ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id); + + +-- +-- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.active_storage_blobs + ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id); + + +-- +-- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.active_storage_variant_records + ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id); + + +-- +-- Name: blazer_audits blazer_audits_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.blazer_audits + ADD CONSTRAINT blazer_audits_pkey PRIMARY KEY (id); + + +-- +-- Name: blazer_checks blazer_checks_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.blazer_checks + ADD CONSTRAINT blazer_checks_pkey PRIMARY KEY (id); + + +-- +-- Name: blazer_dashboard_queries blazer_dashboard_queries_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.blazer_dashboard_queries + ADD CONSTRAINT blazer_dashboard_queries_pkey PRIMARY KEY (id); + + +-- +-- Name: blazer_dashboards blazer_dashboards_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.blazer_dashboards + ADD CONSTRAINT blazer_dashboards_pkey PRIMARY KEY (id); + + +-- +-- Name: blazer_queries blazer_queries_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.blazer_queries + ADD CONSTRAINT blazer_queries_pkey PRIMARY KEY (id); + + +-- +-- Name: build_stats build_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.build_stats + ADD CONSTRAINT build_stats_pkey PRIMARY KEY (id); + + +-- +-- Name: codes_of_conduct codes_of_conduct_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.codes_of_conduct + ADD CONSTRAINT codes_of_conduct_pkey PRIMARY KEY (id); + + +-- +-- Name: csp_reports csp_reports_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.csp_reports + ADD CONSTRAINT csp_reports_pkey PRIMARY KEY (id); + + +-- +-- Name: deploys deploys_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.deploys + ADD CONSTRAINT deploys_pkey PRIMARY KEY (id); + + +-- +-- Name: designs designs_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.designs + ADD CONSTRAINT designs_pkey PRIMARY KEY (id); + + +-- +-- Name: distributed_press_publishers distributed_press_publishers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.distributed_press_publishers + ADD CONSTRAINT distributed_press_publishers_pkey PRIMARY KEY (id); + + +-- +-- Name: indexed_posts indexed_posts_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.indexed_posts + ADD CONSTRAINT indexed_posts_pkey PRIMARY KEY (id); + + +-- +-- Name: licencias licencias_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.licencias + ADD CONSTRAINT licencias_pkey PRIMARY KEY (id); + + +-- +-- Name: log_entries log_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.log_entries + ADD CONSTRAINT log_entries_pkey PRIMARY KEY (id); + + +-- +-- Name: maintenances maintenances_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.maintenances + ADD CONSTRAINT maintenances_pkey PRIMARY KEY (id); + + +-- +-- Name: mobility_string_translations mobility_string_translations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mobility_string_translations + ADD CONSTRAINT mobility_string_translations_pkey PRIMARY KEY (id); + + +-- +-- Name: mobility_text_translations mobility_text_translations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mobility_text_translations + ADD CONSTRAINT mobility_text_translations_pkey PRIMARY KEY (id); + + +-- +-- Name: privacy_policies privacy_policies_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.privacy_policies + ADD CONSTRAINT privacy_policies_pkey PRIMARY KEY (id); + + +-- +-- Name: que_jobs que_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.que_jobs + ADD CONSTRAINT que_jobs_pkey PRIMARY KEY (id); + + +-- +-- Name: que_lockers que_lockers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.que_lockers + ADD CONSTRAINT que_lockers_pkey PRIMARY KEY (pid); + + +-- +-- Name: que_values que_values_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.que_values + ADD CONSTRAINT que_values_pkey PRIMARY KEY (key); + + +-- +-- Name: roles roles_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.roles + ADD CONSTRAINT roles_pkey PRIMARY KEY (id); + + +-- +-- Name: rollups rollups_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.rollups + ADD CONSTRAINT rollups_pkey PRIMARY KEY (id); + + +-- +-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.schema_migrations + ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); + + +-- +-- Name: sites sites_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.sites + ADD CONSTRAINT sites_pkey PRIMARY KEY (id); + + +-- +-- Name: stats stats_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.stats + ADD CONSTRAINT stats_pkey PRIMARY KEY (id); + + +-- +-- Name: usuaries usuaries_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.usuaries + ADD CONSTRAINT usuaries_pkey PRIMARY KEY (id); + + +-- +-- Name: index_access_logs_on_geoip2_data_city_name; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_access_logs_on_geoip2_data_city_name ON public.access_logs USING btree (geoip2_data_city_name); + + +-- +-- Name: index_access_logs_on_geoip2_data_country_name; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_access_logs_on_geoip2_data_country_name ON public.access_logs USING btree (geoip2_data_country_name); + + +-- +-- Name: index_access_logs_on_host; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_access_logs_on_host ON public.access_logs USING btree (host); + + +-- +-- Name: index_access_logs_on_http_origin; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_access_logs_on_http_origin ON public.access_logs USING btree (http_origin); + + +-- +-- Name: index_access_logs_on_http_user_agent; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_access_logs_on_http_user_agent ON public.access_logs USING btree (http_user_agent); + + +-- +-- Name: index_access_logs_on_status; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_access_logs_on_status ON public.access_logs USING btree (status); + + +-- +-- Name: index_access_logs_on_uri; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_access_logs_on_uri ON public.access_logs USING btree (uri); + + +-- +-- Name: index_action_text_rich_texts_uniqueness; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_action_text_rich_texts_uniqueness ON public.action_text_rich_texts USING btree (record_type, record_id, name); + + +-- +-- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id); + + +-- +-- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id); + + +-- +-- Name: index_active_storage_blobs_on_key_and_service_name; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_active_storage_blobs_on_key_and_service_name ON public.active_storage_blobs USING btree (key, service_name); + + +-- +-- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest); + + +-- +-- Name: index_blazer_audits_on_query_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_blazer_audits_on_query_id ON public.blazer_audits USING btree (query_id); + + +-- +-- Name: index_blazer_audits_on_user_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_blazer_audits_on_user_id ON public.blazer_audits USING btree (user_id); + + +-- +-- Name: index_blazer_checks_on_creator_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_blazer_checks_on_creator_id ON public.blazer_checks USING btree (creator_id); + + +-- +-- Name: index_blazer_checks_on_query_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_blazer_checks_on_query_id ON public.blazer_checks USING btree (query_id); + + +-- +-- Name: index_blazer_dashboard_queries_on_dashboard_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_blazer_dashboard_queries_on_dashboard_id ON public.blazer_dashboard_queries USING btree (dashboard_id); + + +-- +-- Name: index_blazer_dashboard_queries_on_query_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_blazer_dashboard_queries_on_query_id ON public.blazer_dashboard_queries USING btree (query_id); + + +-- +-- Name: index_blazer_dashboards_on_creator_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_blazer_dashboards_on_creator_id ON public.blazer_dashboards USING btree (creator_id); + + +-- +-- Name: index_blazer_queries_on_creator_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_blazer_queries_on_creator_id ON public.blazer_queries USING btree (creator_id); + + +-- +-- Name: index_build_stats_on_deploy_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_build_stats_on_deploy_id ON public.build_stats USING btree (deploy_id); + + +-- +-- Name: index_deploys_on_site_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_deploys_on_site_id ON public.deploys USING btree (site_id); + + +-- +-- Name: index_deploys_on_type; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_deploys_on_type ON public.deploys USING btree (type); + + +-- +-- Name: index_designs_on_gem; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_designs_on_gem ON public.designs USING btree (gem); + + +-- +-- Name: index_designs_on_name; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_designs_on_name ON public.designs USING btree (name); + + +-- +-- Name: index_indexed_posts_on_front_matter; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_indexed_posts_on_front_matter ON public.indexed_posts USING gin (front_matter); + + +-- +-- Name: index_indexed_posts_on_indexed_content; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_indexed_posts_on_indexed_content ON public.indexed_posts USING gin (indexed_content); + + +-- +-- Name: index_indexed_posts_on_layout; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_indexed_posts_on_layout ON public.indexed_posts USING btree (layout); + + +-- +-- Name: index_indexed_posts_on_locale; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_indexed_posts_on_locale ON public.indexed_posts USING btree (locale); + + +-- +-- Name: index_indexed_posts_on_site_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_indexed_posts_on_site_id ON public.indexed_posts USING btree (site_id); + + +-- +-- Name: index_licencias_on_name; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_licencias_on_name ON public.licencias USING btree (name); + + +-- +-- Name: index_log_entries_on_site_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_log_entries_on_site_id ON public.log_entries USING btree (site_id); + + +-- +-- Name: index_mobility_string_translations_on_keys; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_mobility_string_translations_on_keys ON public.mobility_string_translations USING btree (translatable_id, translatable_type, locale, key); + + +-- +-- Name: index_mobility_string_translations_on_query_keys; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_mobility_string_translations_on_query_keys ON public.mobility_string_translations USING btree (translatable_type, key, value, locale); + + +-- +-- Name: index_mobility_string_translations_on_translatable_attribute; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_mobility_string_translations_on_translatable_attribute ON public.mobility_string_translations USING btree (translatable_id, translatable_type, key); + + +-- +-- Name: index_mobility_text_translations_on_keys; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_mobility_text_translations_on_keys ON public.mobility_text_translations USING btree (translatable_id, translatable_type, locale, key); + + +-- +-- Name: index_mobility_text_translations_on_translatable_attribute; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_mobility_text_translations_on_translatable_attribute ON public.mobility_text_translations USING btree (translatable_id, translatable_type, key); + + +-- +-- Name: index_roles_on_site_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_roles_on_site_id ON public.roles USING btree (site_id); + + +-- +-- Name: index_roles_on_site_id_and_usuarie_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_roles_on_site_id_and_usuarie_id ON public.roles USING btree (site_id, usuarie_id); + + +-- +-- Name: index_roles_on_usuarie_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_roles_on_usuarie_id ON public.roles USING btree (usuarie_id); + + +-- +-- Name: index_rollups_on_name_and_interval_and_time_and_dimensions; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_rollups_on_name_and_interval_and_time_and_dimensions ON public.rollups USING btree (name, "interval", "time", dimensions); + + +-- +-- Name: index_sites_on_design_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_sites_on_design_id ON public.sites USING btree (design_id); + + +-- +-- Name: index_sites_on_licencia_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_sites_on_licencia_id ON public.sites USING btree (licencia_id); + + +-- +-- Name: index_sites_on_name; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_sites_on_name ON public.sites USING btree (name); + + +-- +-- Name: index_stats_on_name; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_stats_on_name ON public.stats USING hash (name); + + +-- +-- Name: index_stats_on_site_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_stats_on_site_id ON public.stats USING btree (site_id); + + +-- +-- Name: index_usuaries_on_confirmation_token; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_usuaries_on_confirmation_token ON public.usuaries USING btree (confirmation_token); + + +-- +-- Name: index_usuaries_on_email; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_usuaries_on_email ON public.usuaries USING btree (email); + + +-- +-- Name: index_usuaries_on_invitation_token; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_usuaries_on_invitation_token ON public.usuaries USING btree (invitation_token); + + +-- +-- Name: index_usuaries_on_invitations_count; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_usuaries_on_invitations_count ON public.usuaries USING btree (invitations_count); + + +-- +-- Name: index_usuaries_on_invited_by_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_usuaries_on_invited_by_id ON public.usuaries USING btree (invited_by_id); + + +-- +-- Name: index_usuaries_on_invited_by_type_and_invited_by_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_usuaries_on_invited_by_type_and_invited_by_id ON public.usuaries USING btree (invited_by_type, invited_by_id); + + +-- +-- Name: index_usuaries_on_reset_password_token; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_usuaries_on_reset_password_token ON public.usuaries USING btree (reset_password_token); + + +-- +-- Name: index_usuaries_on_unlock_token; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_usuaries_on_unlock_token ON public.usuaries USING btree (unlock_token); + + +-- +-- Name: que_jobs_args_gin_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX que_jobs_args_gin_idx ON public.que_jobs USING gin (args jsonb_path_ops); + + +-- +-- Name: que_jobs_data_gin_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX que_jobs_data_gin_idx ON public.que_jobs USING gin (data jsonb_path_ops); + + +-- +-- Name: que_jobs_kwargs_gin_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX que_jobs_kwargs_gin_idx ON public.que_jobs USING gin (kwargs jsonb_path_ops); + + +-- +-- Name: que_poll_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX que_poll_idx ON public.que_jobs USING btree (job_schema_version, queue, priority, run_at, id) WHERE ((finished_at IS NULL) AND (expired_at IS NULL)); + + +-- +-- Name: access_logs access_logs_before_insert_row_tr; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER access_logs_before_insert_row_tr BEFORE INSERT ON public.access_logs FOR EACH ROW EXECUTE FUNCTION public.access_logs_before_insert_row_tr(); + + +-- +-- Name: indexed_posts indexed_posts_before_insert_update_row_tr; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER indexed_posts_before_insert_update_row_tr BEFORE INSERT OR UPDATE ON public.indexed_posts FOR EACH ROW EXECUTE FUNCTION public.indexed_posts_before_insert_update_row_tr(); + + +-- +-- Name: que_jobs que_job_notify; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER que_job_notify AFTER INSERT ON public.que_jobs FOR EACH ROW WHEN ((NOT (COALESCE(current_setting('que.skip_notify'::text, true), ''::text) = 'true'::text))) EXECUTE FUNCTION public.que_job_notify(); + + +-- +-- Name: que_jobs que_state_notify; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER que_state_notify AFTER INSERT OR DELETE OR UPDATE ON public.que_jobs FOR EACH ROW WHEN ((NOT (COALESCE(current_setting('que.skip_notify'::text, true), ''::text) = 'true'::text))) EXECUTE FUNCTION public.que_state_notify(); + + +-- +-- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.active_storage_variant_records + ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id); + + +-- +-- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.active_storage_attachments + ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id); + + +-- +-- Name: publisher; Type: PUBLICATION; Schema: -; Owner: - +-- + +CREATE PUBLICATION publisher FOR ALL TABLES WITH (publish = 'insert, update, delete, truncate'); + + +-- +-- PostgreSQL database dump complete +-- + From 707695f97d935f2ddc6e006233e993f623690c6a Mon Sep 17 00:00:00 2001 From: f Date: Wed, 24 May 2023 15:52:41 -0300 Subject: [PATCH 353/475] =?UTF-8?q?fix:=20la=20replicaci=C3=B3n=20la=20con?= =?UTF-8?q?figuramos=20en=20otro=20lado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/structure.sql | 7 ------- 1 file changed, 7 deletions(-) diff --git a/db/structure.sql b/db/structure.sql index e50ae337..ab92db9a 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -2254,13 +2254,6 @@ ALTER TABLE ONLY public.active_storage_attachments ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id); --- --- Name: publisher; Type: PUBLICATION; Schema: -; Owner: - --- - -CREATE PUBLICATION publisher FOR ALL TABLES WITH (publish = 'insert, update, delete, truncate'); - - -- -- PostgreSQL database dump complete -- From 11d0431b3455e827b6f19f065ec402286a1a50ca Mon Sep 17 00:00:00 2001 From: f Date: Wed, 24 May 2023 15:53:01 -0300 Subject: [PATCH 354/475] =?UTF-8?q?fix:=20dblink=20no=20es=20una=20extensi?= =?UTF-8?q?=C3=B3n=20que=20usemos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/structure.sql | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/db/structure.sql b/db/structure.sql index ab92db9a..97aec2d1 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -23,20 +23,6 @@ SET row_security = off; -- *not* creating schema, since initdb creates it --- --- Name: dblink; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS dblink WITH SCHEMA public; - - --- --- Name: EXTENSION dblink; Type: COMMENT; Schema: -; Owner: - --- - -COMMENT ON EXTENSION dblink IS 'connect to other PostgreSQL databases from within a database'; - - -- -- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: - -- From eba42c9b7914aeaae04d9c155eee5a1185f2c99a Mon Sep 17 00:00:00 2001 From: f Date: Wed, 24 May 2023 16:52:29 -0300 Subject: [PATCH 355/475] fix: hacer el dump desde rails --- db/structure.sql | 93 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 85 insertions(+), 8 deletions(-) diff --git a/db/structure.sql b/db/structure.sql index 97aec2d1..e0d8f710 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1,10 +1,3 @@ --- --- PostgreSQL database dump --- - --- Dumped from database version 15.2 --- Dumped by pg_dump version 15.2 - SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; @@ -1242,7 +1235,8 @@ CREATE TABLE public.sites ( tienda_api_key_ciphertext character varying DEFAULT ''::character varying, tienda_url character varying DEFAULT ''::character varying, api_key_ciphertext character varying, - slugify_mode character varying DEFAULT 'default'::character varying + slugify_mode character varying DEFAULT 'default'::character varying, + pagination boolean DEFAULT false ); @@ -2244,3 +2238,86 @@ ALTER TABLE ONLY public.active_storage_attachments -- PostgreSQL database dump complete -- +SET search_path TO "$user", public; + +INSERT INTO "schema_migrations" (version) VALUES +('20180925183241'), +('20190211184815'), +('20190703190859'), +('20190703200455'), +('20190705195758'), +('20190705215536'), +('20190706000159'), +('20190706002615'), +('20190711183726'), +('20190712165059'), +('20190716195155'), +('20190716195449'), +('20190716195811'), +('20190716195812'), +('20190716202024'), +('20190717214308'), +('20190718185817'), +('20190719221653'), +('20190723220002'), +('20190725185427'), +('20190726003756'), +('20190730211624'), +('20190730211756'), +('20190820225238'), +('20190829163530'), +('20190829180743'), +('20200118155319'), +('20200126175158'), +('20200130193655'), +('20200205173039'), +('20200206151057'), +('20200206163257'), +('20200527221900'), +('20200529154040'), +('20200615171026'), +('20200616133218'), +('20200801230101'), +('20200801233025'), +('20200810230944'), +('20200811210507'), +('20200816003344'), +('20200820165316'), +('20200822204920'), +('20201111203031'), +('20201207152354'), +('20201224162153'), +('20201224162154'), +('20210414152728'), +('20210504224144'), +('20210504224343'), +('20210506212356'), +('20210507221120'), +('20210511211357'), +('20210722191718'), +('20210807003928'), +('20210807004941'), +('20210926205448'), +('20211008201239'), +('20211022224008'), +('20211022225449'), +('20220406211042'), +('20220428135113'), +('20220712135053'), +('20220802153308'), +('20230119165420'), +('20230318183722'), +('20230322214924'), +('20230322231344'), +('20230325163802'), +('20230328200129'), +('20230328213242'), +('20230328231029'), +('20230411185406'), +('20230415153231'), +('20230421182627'), +('20230424174544'), +('20230519143500'), +('20230524190240'); + + From f546cb902ad17f65a03ea0eae1f411c4f4ab6318 Mon Sep 17 00:00:00 2001 From: jazzari Date: Fri, 9 Jun 2023 12:13:43 -0300 Subject: [PATCH 356/475] fix: no crea los sitios #1278 --- db/seeds.rb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 214bbcb0..0ab8be61 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -16,12 +16,3 @@ licencias.each do |l| licencia.update l end -unless Rails.env.test? - YAML.safe_load(File.read('db/seeds/sites.yml')).each do |site| - site = Site.find_or_create_by name: site['name'] - - site.update licencia: Licencia.first, design: Design.first, - title: site.name, description: 'x' * 50, - deploys: site.deploys.empty? ? [DeployLocal.new] : site.deploys - end -end From 3d7394655c9c97f86461889cf872d64c8719925f Mon Sep 17 00:00:00 2001 From: jazzari Date: Fri, 9 Jun 2023 12:44:40 -0300 Subject: [PATCH 357/475] fix: agrego polizas & codigo de conducta #1278 --- db/seeds.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/db/seeds.rb b/db/seeds.rb index 0ab8be61..b9ef96a1 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -16,3 +16,14 @@ licencias.each do |l| licencia.update l end +if CodeOfConduct.count.zero? + YAML.safe_load(File.read('db/seeds/codes_of_conduct.yml')).each do |coc| + CodeOfConduct.new(**coc).save! + 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 From 6c6566422efc9a1de5cd46612b8cca62f8308d89 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 9 Jun 2023 13:11:02 -0300 Subject: [PATCH 358/475] fix: arreglar dependencias --- Gemfile | 11 +- Gemfile.lock | 537 +++++++++++++++++++++++++-------------------------- 2 files changed, 274 insertions(+), 274 deletions(-) diff --git a/Gemfile b/Gemfile index a3b78f05..9be8a763 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ ruby '~> 2.7' gem 'dotenv-rails', require: 'dotenv/rails-now' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 6' +gem 'rails', '~> 6.1.0' # Use Puma as the app server gem 'puma' @@ -33,6 +33,7 @@ gem 'turbolinks', '~> 5' gem 'jbuilder', '~> 2.5' # Use ActiveModel has_secure_password gem 'bcrypt', '~> 3.1.7' +gem 'safely_block', '~> 0.3.0' gem 'blazer' gem 'chartkick' gem 'commonmarker' @@ -51,8 +52,8 @@ gem 'image_processing' gem 'icalendar' gem 'inline_svg' gem 'httparty' -gem 'safe_yaml' -gem 'jekyll', '~> 4.2' +gem 'safe_yaml', require: false +gem 'jekyll', '~> 4.2.0' gem 'jekyll-data' gem 'jekyll-commonmark' gem 'jekyll-images' @@ -65,7 +66,7 @@ gem 'mobility' gem 'pundit' gem 'rails-i18n' gem 'rails_warden' -gem 'redis', require: %w[redis redis/connection/hiredis] +gem 'redis', '~> 4.0', require: %w[redis redis/connection/hiredis] gem 'redis-rails' gem 'rollups', git: 'https://github.com/fauno/rollup.git', branch: 'update' gem 'rubyzip' @@ -111,7 +112,7 @@ group :development, :test do gem 'pry' # Adds support for Capybara system testing and selenium driver gem 'capybara', '~> 2.13' - gem 'selenium-webdriver' + gem 'selenium-webdriver', '~> 4.8.0' gem 'sqlite3' end diff --git a/Gemfile.lock b/Gemfile.lock index 6b46eaa9..96889531 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -27,84 +27,86 @@ GIT GEM remote: https://gems.sutty.nl/ specs: - actioncable (6.1.4.1) - actionpack (= 6.1.4.1) - activesupport (= 6.1.4.1) + actioncable (6.1.7.3) + actionpack (= 6.1.7.3) + activesupport (= 6.1.7.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.4.1) - actionpack (= 6.1.4.1) - activejob (= 6.1.4.1) - activerecord (= 6.1.4.1) - activestorage (= 6.1.4.1) - activesupport (= 6.1.4.1) + actionmailbox (6.1.7.3) + actionpack (= 6.1.7.3) + activejob (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) mail (>= 2.7.1) - actionmailer (6.1.4.1) - actionpack (= 6.1.4.1) - actionview (= 6.1.4.1) - activejob (= 6.1.4.1) - activesupport (= 6.1.4.1) + actionmailer (6.1.7.3) + actionpack (= 6.1.7.3) + actionview (= 6.1.7.3) + activejob (= 6.1.7.3) + activesupport (= 6.1.7.3) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.4.1) - actionview (= 6.1.4.1) - activesupport (= 6.1.4.1) + actionpack (6.1.7.3) + actionview (= 6.1.7.3) + activesupport (= 6.1.7.3) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.4.1) - actionpack (= 6.1.4.1) - activerecord (= 6.1.4.1) - activestorage (= 6.1.4.1) - activesupport (= 6.1.4.1) + actiontext (6.1.7.3) + actionpack (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) nokogiri (>= 1.8.5) - actionview (6.1.4.1) - activesupport (= 6.1.4.1) + actionview (6.1.7.3) + activesupport (= 6.1.7.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.4.1) - activesupport (= 6.1.4.1) + activejob (6.1.7.3) + activesupport (= 6.1.7.3) globalid (>= 0.3.6) - activemodel (6.1.4.1) - activesupport (= 6.1.4.1) - activerecord (6.1.4.1) - activemodel (= 6.1.4.1) - activesupport (= 6.1.4.1) - activestorage (6.1.4.1) - actionpack (= 6.1.4.1) - activejob (= 6.1.4.1) - activerecord (= 6.1.4.1) - activesupport (= 6.1.4.1) - marcel (~> 1.0.0) + activemodel (6.1.7.3) + activesupport (= 6.1.7.3) + activerecord (6.1.7.3) + activemodel (= 6.1.7.3) + activesupport (= 6.1.7.3) + activestorage (6.1.7.3) + actionpack (= 6.1.7.3) + activejob (= 6.1.7.3) + activerecord (= 6.1.7.3) + activesupport (= 6.1.7.3) + marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.4.1) + activesupport (6.1.7.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.4) + public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) - autoprefixer-rails (10.3.3.0) + autoprefixer-rails (10.4.13.0) execjs (~> 2) - bcrypt (3.1.16-x86_64-linux-musl) + bcrypt (3.1.18-x86_64-linux-musl) + bcrypt_pbkdf (1.1.0) bcrypt_pbkdf (1.1.0-x86_64-linux-musl) - benchmark-ips (2.9.2) + benchmark-ips (2.12.0) + bindex (0.8.1) bindex (0.8.1-x86_64-linux-musl) - blazer (2.4.7) + blazer (2.6.5) activerecord (>= 5) chartkick (>= 3.2) railties (>= 5) safely_block (>= 0.1.1) - bootstrap (4.6.0) + bootstrap (4.6.2) autoprefixer-rails (>= 9.1.0) - popper_js (>= 1.14.3, < 2) + popper_js (>= 1.16.1, < 2) sassc-rails (>= 2.0.0) - brakeman (5.1.2) + brakeman (5.4.1) builder (3.2.4) capybara (2.18.0) addressable @@ -113,22 +115,26 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (>= 2.0, < 4.0) - chartkick (4.1.2) - childprocess (4.1.0) + chartkick (5.0.2) climate_control (1.2.0) coderay (1.1.3) colorator (1.1.0) - commonmarker (0.21.2-x86_64-linux-musl) - ruby-enum (~> 0.5) + commonmarker (0.23.9) + commonmarker (0.23.9-x86_64-linux-musl) + concurrent-ruby (1.2.2) + concurrent-ruby-ext (1.2.2-x86_64-linux-musl) + concurrent-ruby (= 1.2.2) crass (1.0.6) - database_cleaner (2.0.1) - database_cleaner-active_record (~> 2.0.0) - database_cleaner-active_record (2.0.1) + database_cleaner (2.0.2) + database_cleaner-active_record (>= 2, < 3) + database_cleaner-active_record (2.1.0) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) - dead_end (3.1.0) - derailed_benchmarks (2.1.1) + date (3.3.3) + date (3.3.3-x86_64-linux-musl) + dead_end (4.0.0) + derailed_benchmarks (2.1.2) benchmark-ips (~> 2) dead_end get_process_mem (~> 0) @@ -140,29 +146,29 @@ GEM rake (> 10, < 14) ruby-statistics (>= 2.1) thor (>= 0.19, < 2) - devise (4.8.0) + devise (4.9.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.10.1) - devise (>= 4.8.0) - devise_invitable (2.0.5) + devise-i18n (1.11.0) + devise (>= 4.9.0) + devise_invitable (2.0.7) actionmailer (>= 5.0) devise (>= 4.6) - distributed-press-api-client (0.2.2) + distributed-press-api-client (0.2.4) addressable (~> 2.3, >= 2.3.0) climate_control dry-schema httparty (~> 0.18) json (~> 2.1, >= 2.1.0) jwt (~> 2.6.0) - dotenv (2.7.6) - dotenv-rails (2.7.6) - dotenv (= 2.7.6) + dotenv (2.8.1) + dotenv-rails (2.8.1) + dotenv (= 2.8.1) railties (>= 3.2) - down (5.2.4) + down (5.4.1) addressable (~> 2.8) dry-configurable (1.0.1) dry-core (~> 1.0, < 2) @@ -176,65 +182,75 @@ GEM concurrent-ruby (~> 1.0) dry-core (~> 1.0, < 2) zeitwerk (~> 2.6) - dry-schema (1.13.0) + dry-schema (1.13.1) concurrent-ruby (~> 1.0) dry-configurable (~> 1.0, >= 1.0.1) dry-core (~> 1.0, < 2) dry-initializer (~> 3.0) - dry-logic (>= 1.5, < 2) + dry-logic (>= 1.4, < 2) dry-types (>= 1.7, < 2) zeitwerk (~> 2.6) - dry-types (1.7.0) + dry-types (1.7.1) concurrent-ruby (~> 1.0) - dry-core (~> 1.0, < 2) - dry-inflector (~> 1.0, < 2) - dry-logic (>= 1.4, < 2) + dry-core (~> 1.0) + dry-inflector (~> 1.0) + dry-logic (~> 1.4) zeitwerk (~> 2.6) - ed25519 (1.2.4-x86_64-linux-musl) + ed25519 (1.3.0) + ed25519 (1.3.0-x86_64-linux-musl) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) - errbase (0.2.1) - erubi (1.10.0) + errbase (0.2.2) + erubi (1.12.0) + eventmachine (1.2.7) eventmachine (1.2.7-x86_64-linux-musl) - exception_notification (4.4.3) - actionmailer (>= 4.0, < 7) - activesupport (>= 4.0, < 7) + exception_notification (4.5.0) + actionmailer (>= 5.2, < 8) + activesupport (>= 5.2, < 8) execjs (2.8.1) - factory_bot (6.2.0) + factory_bot (6.2.1) activesupport (>= 5.0.0) factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) + fast_blank (1.0.1) fast_blank (1.0.1-x86_64-linux-musl) + fast_jsonparser (0.5.0) fast_jsonparser (0.5.0-x86_64-linux-musl) - ffi (1.15.4-x86_64-linux-musl) + ffi (1.15.5) + ffi (1.15.5-x86_64-linux-musl) flamegraph (0.9.5) forwardable-extended (2.6.0) - friendly_id (5.4.2) + friendly_id (5.5.0) activerecord (>= 4.0.0) get_process_mem (0.2.7) ffi (~> 1.0) - globalid (0.6.0) + globalid (1.1.0) activesupport (>= 5.0) - groupdate (6.1.0) + groupdate (6.2.1) activesupport (>= 5.2) - hairtrigger (0.2.24) - activerecord (>= 5.0, < 7) + hairtrigger (1.0.0) + activerecord (>= 6.0, < 8) ruby2ruby (~> 2.4) ruby_parser (~> 3.10) - haml (5.2.2) - temple (>= 0.8.0) + haml (6.1.1-x86_64-linux-musl) + temple (>= 0.8.2) + thor tilt haml-lint (0.999.999) haml_lint - haml_lint (0.37.1) - haml (>= 4.0, < 5.3) + haml_lint (0.45.0) + haml (>= 4.0, < 6.2) parallel (~> 1.10) rainbow rubocop (>= 0.50.0) sysexits (~> 1.1) - hamlit (2.15.1-x86_64-linux-musl) + hamlit (3.0.3) + temple (>= 0.8.2) + thor + tilt + hamlit (3.0.3-x86_64-linux-musl) temple (>= 0.8.2) thor tilt @@ -245,25 +261,28 @@ GEM railties (>= 4.0.1) heapy (0.2.0) thor + hiredis (0.6.3) hiredis (0.6.3-x86_64-linux-musl) + http_parser.rb (0.8.0) http_parser.rb (0.8.0-x86_64-linux-musl) httparty (0.21.0) mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) - i18n (1.8.11) + i18n (1.13.0) concurrent-ruby (~> 1.0) - icalendar (2.7.1) + icalendar (2.8.0) ice_cube (~> 0.16) ice_cube (0.16.4) - image_processing (1.12.1) + image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - inline_svg (1.7.2) + inline_svg (1.9.0) activesupport (>= 3.0) nokogiri (>= 1.6) - jbuilder (2.11.3) + jbuilder (2.11.5) + actionview (>= 5.0.0) activesupport (>= 5.0.0) - jekyll (4.2.1) + jekyll (4.2.2) addressable (~> 2.4) colorator (~> 1.0) em-websocket (~> 0.5) @@ -278,246 +297,227 @@ GEM rouge (~> 3.0) safe_yaml (~> 1.0) terminal-table (~> 2.0) - jekyll-commonmark (1.3.2) - commonmarker (~> 0.14, < 0.22) - jekyll (>= 3.7, < 5.0) + jekyll-commonmark (1.4.0) + commonmarker (~> 0.22) jekyll-data (1.1.2) jekyll (>= 3.3, < 5.0.0) - jekyll-dotenv (0.2.0) - dotenv (~> 2.7) - jekyll (~> 4) - jekyll-feed (0.15.1) - jekyll (>= 3.7, < 5.0) - jekyll-hardlinks (0.1.2) - jekyll (~> 4) - jekyll-ignore-layouts (0.1.2) - jekyll (~> 4) - jekyll-images (0.3.2) + jekyll-images (0.4.1) jekyll (~> 4) ruby-filemagic (~> 0.7) ruby-vips (~> 2) jekyll-include-cache (0.2.1) jekyll (>= 3.7, < 5.0) - jekyll-linked-posts (0.4.2) - jekyll (~> 4) - jekyll-locales (0.1.13) - jekyll-lunr (0.3.0) - loofah (~> 2.4) - jekyll-order (0.1.4) - jekyll-relative-urls (0.0.6) - jekyll (~> 4) - jekyll-sass-converter (2.1.0) + jekyll-sass-converter (2.2.0) sassc (> 2.0.1, < 3.0) - jekyll-seo-tag (2.7.1) - jekyll (>= 3.8, < 5.0) - jekyll-spree-client (0.1.19) - fast_blank (~> 1) - spree-api-client (>= 0.2.4) - jekyll-turbolinks (0.0.5) - jekyll (~> 4) - turbolinks-source (~> 5) - jekyll-unique-urls (0.1.1) - jekyll (~> 4) jekyll-watch (2.2.1) listen (~> 3.0) - jekyll-write-and-commit-changes (0.2.1) - jekyll (~> 4) - rugged (~> 1) + json (2.6.3-x86_64-linux-musl) jwt (2.6.0) - kaminari (1.2.1) + kaminari (1.2.2) activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.1) - kaminari-activerecord (= 1.2.1) - kaminari-core (= 1.2.1) - kaminari-actionview (1.2.1) + kaminari-actionview (= 1.2.2) + kaminari-activerecord (= 1.2.2) + kaminari-core (= 1.2.2) + kaminari-actionview (1.2.2) actionview - kaminari-core (= 1.2.1) - kaminari-activerecord (1.2.1) + kaminari-core (= 1.2.2) + kaminari-activerecord (1.2.2) activerecord - kaminari-core (= 1.2.1) - kaminari-core (1.2.1) - kramdown (2.3.1) + kaminari-core (= 1.2.2) + kaminari-core (1.2.2) + kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - launchy (2.5.0) - addressable (~> 2.7) - letter_opener (1.7.0) - launchy (~> 2.2) - liquid (4.0.3) + launchy (2.5.2) + addressable (~> 2.8) + letter_opener (1.8.1) + launchy (>= 2.2, < 3) + liquid (4.0.4) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) loaf (0.10.0) railties (>= 3.2) - lockbox (0.6.6) - lograge (0.11.2) + lockbox (1.2.0) + lograge (0.12.0) actionpack (>= 4) activesupport (>= 4) railties (>= 4) request_store (~> 1.0) - loofah (2.12.0) + loofah (2.21.3) crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) + nokogiri (>= 1.12.0) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (1.0.2) - memory_profiler (1.0.0) + memory_profiler (1.0.1) mercenary (0.4.0) method_source (1.0.0) - mime-types (3.4.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2021.1115) mini_histogram (0.3.1) - mini_magick (4.11.0) + mini_magick (4.12.0) mini_mime (1.1.2) - mini_portile2 (2.6.1) - minitest (5.14.4) - mobility (1.2.4) + minitest (5.18.0) + mobility (1.2.9) i18n (>= 0.6.10, < 2) request_store (~> 1.0) multi_xml (0.6.0) - net-ssh (6.1.0) - netaddr (2.0.5) - nio4r (2.5.8-x86_64-linux-musl) - nokogiri (1.12.5-x86_64-linux-musl) - mini_portile2 (~> 2.6.1) - racc (~> 1.4) + net-imap (0.3.4) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.3.3) + net-protocol + net-ssh (7.1.0) + netaddr (2.0.6) + nio4r (2.5.9-x86_64-linux-musl) njalla-api-client (0.2.0) dry-schema httparty (~> 0.18) + nokogiri (1.15.1-x86_64-linux) + racc (~> 1.4) orm_adapter (0.5.0) - pairing_heap (3.0.0) - parallel (1.21.0) - parser (3.0.2.0) + pairing_heap (3.0.1) + parallel (1.23.0) + parser (3.2.2.1) ast (~> 2.4.1) pathutil (0.16.2) forwardable-extended (~> 2.6) - pg (1.2.3-x86_64-linux-musl) - pg_search (2.3.5) + pg (1.5.3-x86_64-linux-musl) + pg_search (2.3.6) activerecord (>= 5.2) activesupport (>= 5.2) - popper_js (1.16.0) - prometheus_exporter (1.0.0) + popper_js (1.16.1) + prometheus_exporter (2.0.8) webrick - pry (0.14.1) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (4.0.6) - puma (5.5.2-x86_64-linux-musl) + public_suffix (5.0.1) + puma (6.2.2-x86_64-linux-musl) nio4r (~> 2.0) - pundit (2.1.1) + pundit (2.3.0) activesupport (>= 3.0.0) - racc (1.6.0-x86_64-linux-musl) - que (2.2.0) - rack (2.2.3) - rack-cors (1.1.1) + que (2.2.1) + racc (1.6.2) + racc (1.6.2-x86_64-linux-musl) + rack (2.2.7) + rack-cors (2.0.1) rack (>= 2.0.0) - rack-mini-profiler (2.3.3) + rack-mini-profiler (3.1.0) rack (>= 1.2.0) - rack-proxy (0.7.0) + rack-proxy (0.7.6) rack - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (6.1.4.1) - actioncable (= 6.1.4.1) - actionmailbox (= 6.1.4.1) - actionmailer (= 6.1.4.1) - actionpack (= 6.1.4.1) - actiontext (= 6.1.4.1) - actionview (= 6.1.4.1) - activejob (= 6.1.4.1) - activemodel (= 6.1.4.1) - activerecord (= 6.1.4.1) - activestorage (= 6.1.4.1) - activesupport (= 6.1.4.1) + rack-test (2.1.0) + rack (>= 1.3) + rails (6.1.7.3) + actioncable (= 6.1.7.3) + actionmailbox (= 6.1.7.3) + actionmailer (= 6.1.7.3) + actionpack (= 6.1.7.3) + actiontext (= 6.1.7.3) + actionview (= 6.1.7.3) + activejob (= 6.1.7.3) + activemodel (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) bundler (>= 1.15.0) - railties (= 6.1.4.1) + railties (= 6.1.7.3) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.4.2) - loofah (~> 2.3) - rails-i18n (6.0.0) + rails-html-sanitizer (1.5.0) + loofah (~> 2.19, >= 2.19.1) + rails-i18n (7.0.7) i18n (>= 0.7, < 2) - railties (>= 6.0.0, < 7) + railties (>= 6.0.0, < 8) rails_warden (0.6.0) warden (>= 1.2.0) - railties (6.1.4.1) - actionpack (= 6.1.4.1) - activesupport (= 6.1.4.1) + railties (6.1.7.3) + actionpack (= 6.1.7.3) + activesupport (= 6.1.7.3) method_source - rake (>= 0.13) + rake (>= 12.2) thor (~> 1.0) - rainbow (3.0.0) + rainbow (3.1.1) rake (13.0.6) - rb-fsevent (0.11.0) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - redis (4.5.1) - redis-actionpack (5.2.0) - actionpack (>= 5, < 7) + redis (4.8.1) + redis-actionpack (5.3.0) + actionpack (>= 5, < 8) redis-rack (>= 2.1.0, < 3) redis-store (>= 1.1.0, < 2) - redis-activesupport (5.2.1) - activesupport (>= 3, < 7) + redis-activesupport (5.3.0) + activesupport (>= 3, < 8) redis-store (>= 1.3, < 2) - redis-rack (2.1.3) + redis-rack (2.1.4) rack (>= 2.0.8, < 3) redis-store (>= 1.2, < 2) redis-rails (5.0.2) redis-actionpack (>= 5.0, < 6) redis-activesupport (>= 5.0, < 6) redis-store (>= 1.2, < 2) - redis-store (1.9.0) - redis (>= 4, < 5) - regexp_parser (2.1.1) - request_store (1.5.0) + redis-store (1.9.2) + redis (>= 4, < 6) + regexp_parser (2.8.0) + request_store (1.5.1) rack (>= 1.4) - responders (3.0.1) - actionpack (>= 5.0) - railties (>= 5.0) + responders (3.1.0) + actionpack (>= 5.2) + railties (>= 5.2) rexml (3.2.5) - rgl (0.6.2) + rgl (0.6.3) pairing_heap (>= 0.3.0) rexml (~> 3.2, >= 3.2.4) stream (~> 0.5.3) - rouge (3.26.1) - rubocop (1.23.0) + rouge (3.30.0) + rubocop (1.42.0) + json (~> 2.3) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.12.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.24.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.13.0) - parser (>= 3.0.1.1) - rubocop-rails (2.12.4) + rubocop-ast (1.28.1) + parser (>= 3.2.1.0) + rubocop-rails (2.19.1) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.7.0, < 2.0) - ruby-enum (0.9.0) - i18n - ruby-filemagic (0.7.2-x86_64-linux-musl) - ruby-progressbar (1.11.0) - ruby-statistics (3.0.0) + rubocop (>= 1.33.0, < 2.0) + ruby-filemagic (0.7.3) + ruby-filemagic (0.7.3-x86_64-linux-musl) + ruby-progressbar (1.13.0) + ruby-statistics (3.0.2) ruby-vips (2.1.4) ffi (~> 1.12) - ruby2ruby (2.4.4) + ruby2ruby (2.5.0) ruby_parser (~> 3.1) sexp_processor (~> 4.6) ruby_dep (1.5.0) - ruby_parser (3.18.1) + ruby_parser (3.20.1) sexp_processor (~> 4.16) rubyzip (2.3.2) - rugged (1.2.0-x86_64-linux-musl) + rugged (1.6.3) + rugged (1.6.3-x86_64-linux-musl) safe_yaml (1.0.6) safely_block (0.3.0) errbase (>= 0.1.1) + sassc (2.4.0) + ffi (~> 1.9) sassc (2.4.0-x86_64-linux-musl) ffi (~> 1.9) sassc-rails (2.1.2) @@ -526,56 +526,53 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (4.1.0) - childprocess (>= 0.5, < 5.0) + selenium-webdriver (4.8.6) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) semantic_range (3.0.0) - sexp_processor (4.16.0) + sexp_processor (4.17.0) simpleidn (0.2.1) unf (~> 0.1.4) sourcemap (0.1.1) - spree-api-client (0.2.4) - fast_blank (~> 1) - httparty (~> 0.18.0) spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (4.0.2) + sprockets (4.2.0) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.4.1) + rack (>= 2.2.4, < 4) + sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.4.2-x86_64-linux-musl) - stackprof (0.2.17-x86_64-linux-musl) - sutty-archives (2.5.4) - jekyll (>= 3.6, < 5.0) - sutty-liquid (0.7.4) + sqlite3 (1.6.3-x86_64-linux) + stackprof (0.2.25-x86_64-linux-musl) + stream (0.5.5) + sutty-liquid (0.11.10) fast_blank (~> 1.0) jekyll (~> 4) symbol-fstring (1.0.2-x86_64-linux-musl) sysexits (1.2.0) - temple (0.8.2) + temple (0.10.1) terminal-table (2.0.0) unicode-display_width (~> 1.1, >= 1.1.1) - thor (1.1.0) - tilt (2.0.10) - timecop (0.9.4) + thor (1.2.2) + tilt (2.1.0) + timecop (0.9.6) + timeout (0.3.2) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (2.0.4) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.8-x86_64-linux-musl) + unf_ext (0.0.8.2-x86_64-linux-musl) unicode-display_width (1.8.0) - validates_hostname (1.0.11) + validates_hostname (1.0.13) activerecord (>= 3.0) activesupport (>= 3.0) warden (1.2.9) @@ -585,18 +582,19 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webpacker (5.4.3) + webpacker (5.4.4) activesupport (>= 5.2) rack-proxy (>= 0.6.1) railties (>= 5.2) semantic_range (>= 2.3.0) - webrick (1.7.0) + webrick (1.8.1) + websocket (1.2.9) websocket-driver (0.7.5-x86_64-linux-musl) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.5.1) + zeitwerk (2.6.8) PLATFORMS ruby @@ -625,7 +623,7 @@ DEPENDENCIES exception_notification factory_bot_rails fast_blank - fast_jsonparser + fast_jsonparser (~> 0.5.0) flamegraph friendly_id hairtrigger @@ -637,7 +635,7 @@ DEPENDENCIES image_processing inline_svg jbuilder (~> 2.5) - jekyll (~> 4.2) + jekyll (~> 4.2.0) jekyll-commonmark jekyll-data jekyll-images @@ -652,7 +650,7 @@ DEPENDENCIES mini_magick mobility net-ssh - njalla-api-client + njalla-api-client (~> 0.2.0) nokogiri pg pg_search @@ -663,10 +661,10 @@ DEPENDENCIES que rack-cors rack-mini-profiler - rails (~> 6) + rails (~> 6.1.0) rails-i18n rails_warden - redis + redis (~> 4.0) redis-rails rgl rollups! @@ -674,8 +672,9 @@ DEPENDENCIES rubyzip rugged safe_yaml + safely_block (~> 0.3.0) sassc-rails - selenium-webdriver + selenium-webdriver (~> 4.8.0) sourcemap spring spring-watcher-listen (~> 2.0.0) @@ -696,4 +695,4 @@ RUBY VERSION ruby 2.7.1p83 BUNDLED WITH - 2.2.2 + 2.2.20 From 679a3fde85305c0c9fcf511e05b7d2bb18e63d88 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 9 Jun 2023 13:26:41 -0300 Subject: [PATCH 359/475] chore: force ci --- app/assets/stylesheets/application.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index eb953c30..65a207fa 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -525,3 +525,5 @@ $bezier: cubic-bezier(0.75, 0, 0.25, 1); } } } + +// force ci From 504f30997e5c94d2e9ab70a85fa72f264cd1cedd Mon Sep 17 00:00:00 2001 From: f Date: Sat, 10 Jun 2023 12:18:25 -0300 Subject: [PATCH 360/475] fix: no fallar si no hay sitio del panel --- app/controllers/env_controller.rb | 3 ++- app/views/env/index.js.haml | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/controllers/env_controller.rb b/app/controllers/env_controller.rb index 0f34e15f..de61c704 100644 --- a/app/controllers/env_controller.rb +++ b/app/controllers/env_controller.rb @@ -5,6 +5,7 @@ class EnvController < ActionController::Base def index @site = Site.find_by_name('panel') - stale? @site + + stale? @site if @site end end diff --git a/app/views/env/index.js.haml b/app/views/env/index.js.haml index f4bd69cf..597ba53f 100644 --- a/app/views/env/index.js.haml +++ b/app/views/env/index.js.haml @@ -1,7 +1,8 @@ -= cache @site do - :plain - window.env = { - AIRBRAKE_SITE_ID: #{@site.id}, - AIRBRAKE_API_KEY: "#{@site.airbrake_api_key}", - PANEL_URL: "#{ENV['PANEL_URL']}" - } +- if @site + = cache @site do + :plain + window.env = { + AIRBRAKE_SITE_ID: #{@site.id}, + AIRBRAKE_API_KEY: "#{@site.airbrake_api_key}", + PANEL_URL: "#{ENV['PANEL_URL']}" + } From 764fd70e065a56a2bf11ede657c83d4c803e1c87 Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 12 Jun 2023 11:20:26 -0300 Subject: [PATCH 361/475] fix: add try catch to application.js so can notify js errors with the console #13578 --- app/javascript/packs/application.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 492ca736..9cbc30bf 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -2,11 +2,21 @@ import { Notifier } from '@airbrake/browser' -window.airbrake = new Notifier({ - projectId: window.env.AIRBRAKE_SITE_ID, - projectKey: window.env.AIRBRAKE_API_KEY, - host: window.env.PANEL_URL -}) +try { + window.airbrake = new Notifier({ + projectId: window.env.AIRBRAKE_PROJECT_ID, + projectKey: window.env.AIRBRAKE_PROJECT_KEY, + host: window.env.PANEL_URL + }); + + console.originalError = console.error; + console.error = (...e) => { + window.airbrake.notify(e.join(" ")); + return console.originalError(...e); + }; +} catch(e) { + console.error(e); +} import 'core-js/stable' import 'regenerator-runtime/runtime' From 83ebdea24bfa045e0072d1d9a7e62796c5d4f961 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 14 Jun 2023 13:33:47 -0300 Subject: [PATCH 362/475] fix: soporte para ruby 3.1 #9357 closes #13603 --- app/lib/exception_notifier/gitlab_notifier.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/lib/exception_notifier/gitlab_notifier.rb b/app/lib/exception_notifier/gitlab_notifier.rb index 8152bb62..947e4e44 100644 --- a/app/lib/exception_notifier/gitlab_notifier.rb +++ b/app/lib/exception_notifier/gitlab_notifier.rb @@ -8,9 +8,9 @@ module ExceptionNotifier # Recibe la excepción y empieza la tarea de notificación en segundo # plano. # - # @param [Exception] - # @param [Hash] - def call(exception, **options) + # @param :exception [Exception] + # @param :options [Hash] + def call(exception, options, &block) case exception when BacktraceJob::BacktraceException GitlabNotifierJob.perform_later(exception, **options) From 4064d41855590ca76c7c4f86eb4150275cda68b5 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 14 Jun 2023 13:39:26 -0300 Subject: [PATCH 363/475] fix: duplicar el hash --- config/initializers/que.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/que.rb b/config/initializers/que.rb index d7abfeb5..eb898ae7 100644 --- a/config/initializers/que.rb +++ b/config/initializers/que.rb @@ -4,5 +4,5 @@ ActiveJob::Serializers.add_serializers ActiveJob::Serializers::ExceptionSerializ # Notificar los errores Que.error_notifier = proc do |error, job| - ExceptionNotifier.notify_exception(error, data: (job || {})) + ExceptionNotifier.notify_exception(error, data: (job.dup || {})) end From 8d7d1c10b18cd4725f994c9f5900517947f3f9d3 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 15 Jun 2023 12:04:44 -0300 Subject: [PATCH 364/475] fix: indexar posts luego de crear el sitio #13610 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit se producía una condición donde el sitio se quería indexar sin haber terminado de instalar las gemas y todo fallaba. no tenemos que usar más callbacks, solo servicios --- app/models/site/index.rb | 2 -- app/services/site_service.rb | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/site/index.rb b/app/models/site/index.rb index e11095e3..c2c55ade 100644 --- a/app/models/site/index.rb +++ b/app/models/site/index.rb @@ -8,8 +8,6 @@ class Site extend ActiveSupport::Concern included do - # TODO: Debería ser un Job? - after_create :index_posts! has_many :indexed_posts, dependent: :destroy def index_posts! diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 2c29538c..367d3b08 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -33,6 +33,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do add_licencias && add_code_of_conduct && add_privacy_policy && + site.index_posts! && deploy end From 6e4247206719c8330f6229139df17858e8de734c Mon Sep 17 00:00:00 2001 From: f Date: Thu, 15 Jun 2023 13:33:25 -0300 Subject: [PATCH 365/475] =?UTF-8?q?fix:=20darle=20bola=20a=20los=20mensaje?= =?UTF-8?q?s=20de=20deprecaci=C3=B3n=20de=20bundler=20#13610?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit se configuraban las opciones que le pasábamos pero no se aplicaban en el comando actual, con lo que quería instalar las gemas globalmente y fallaba la creación de sitios. --- app/models/deploy_local.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 75ea8b1c..ed5f1919 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -138,7 +138,12 @@ class DeployLocal < Deploy end def bundle(output: false) - run %(bundle install --deployment --no-cache --path="#{gems_dir}" --clean --without test development), output: output + run %(bundle config set --local clean 'true'), output: output + run %(bundle config set --local deployment 'true'), output: output + run %(bundle config set --local path '#{gems_dir}'), output: output + run %(bundle config set --local without 'test development'), output: output + run %(bundle config set --local cache_all 'false'), output: output + run %(bundle install), output: output end def jekyll_build(output: false) From d17db5428abb9df95ddf32bf8cdbd7189a60fec5 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 15 Jun 2023 18:28:34 -0300 Subject: [PATCH 366/475] fix: deprecar Dir#chdir #13619 --- app/models/deploy.rb | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/app/models/deploy.rb b/app/models/deploy.rb index a92708c0..515a8530 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -65,22 +65,20 @@ class Deploy < ApplicationRecord lines = [] time_start - Dir.chdir(site.path) do - Open3.popen2e(env, cmd, unsetenv_others: true) do |_, o, t| - # TODO: Enviar a un websocket para ver el proceso en vivo? - Thread.new do - o.each do |line| - lines << line + Open3.popen2e(env, cmd, unsetenv_others: true, chdir: site.path) do |_, o, t| + # TODO: Enviar a un websocket para ver el proceso en vivo? + Thread.new do + o.each do |line| + lines << line - puts line if output - end - rescue IOError => e - lines << e.message - puts e.message if output + puts line if output end - - r = t.value + rescue IOError => e + lines << e.message + puts e.message if output end + + r = t.value end time_stop From 6d64fa144392d0b011ca56ec677f99f095857a27 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 15 Jun 2023 18:51:16 -0300 Subject: [PATCH 367/475] fix: generar un registro cuando falla distributed press #13628 --- app/models/deploy_distributed_press.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 889d8e34..2c892b55 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -52,7 +52,12 @@ class DeployDistributedPress < Deploy end end - status = c.publish(publishing_site, deploy_local.destination) + begin + status = c.publish(publishing_site, deploy_local.destination) + rescue DistributedPress::V1::Error => e + ExceptionNotifier.notify_exception(e, data: { site: site.name }) + status = false + end if status self.remote_info[:distributed_press] = c.show(publishing_site).to_h From 224bdeeccae05f3b988537e7a6a1ae89ad0b20a2 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Jul 2023 13:10:39 -0300 Subject: [PATCH 368/475] fix: no usar Dir.chdir --- app/models/site/repository.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index 62e4c45e..d149b732 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -158,10 +158,8 @@ class Site cmd = 'git gc' r = nil - Dir.chdir(path) do - Open3.popen2e(env, cmd, unsetenv_others: true) do |_, _, t| - r = t.value - end + Open3.popen2e(env, cmd, unsetenv_others: true, chdir: path) do |_, _, t| + r = t.value end r&.success? From 6ff0a36b44342f18d724b04685fc96e87637ac06 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Jul 2023 13:23:54 -0300 Subject: [PATCH 369/475] BREAKING CHANGE: Site::Repository#commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit poder añadir y eliminar archivos en el mismo commit --- app/models/site/find_and_replace.rb | 2 +- app/models/site/repository.rb | 25 ++++++++++++------------- app/services/lfs_object_service.rb | 2 +- app/services/post_service.rb | 16 ++++++++-------- app/services/site_service.rb | 2 +- 5 files changed, 23 insertions(+), 24 deletions(-) diff --git a/app/models/site/find_and_replace.rb b/app/models/site/find_and_replace.rb index 2670159d..5da673c2 100644 --- a/app/models/site/find_and_replace.rb +++ b/app/models/site/find_and_replace.rb @@ -37,7 +37,7 @@ class Site author = GitAuthor.new email: "sutty@#{Site.domain}", name: 'Sutty' - repository.commit(file: modified, + repository.commit(add: modified, message: I18n.t('sites.find_and_replace'), usuarie: author) end diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index d149b732..9c435fb5 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -114,14 +114,21 @@ class Site end # Guarda los cambios en git - def commit(file:, usuarie:, message:, remove: false) - file = [file] unless file.respond_to? :each - + # + # @param :add [Array] Archivos a agregar + # @param :rm [Array] Archivos a eliminar + # @param :usuarie [Usuarie] Quién hace el commit + # @param :message [String] Mensaje + def commit(add: [], rm: [], usuarie:, message:) # Cargar el árbol actual rugged.index.read_tree rugged.head.target.tree - file.each do |f| - remove ? rm(f) : add(f) + add.each do |file| + rugged.index.add(relativize(file)) + end + + rm.each do |file| + rugged.index.remove(relativize(file)) end # Escribir los cambios para que el repositorio se vea tal cual @@ -142,14 +149,6 @@ class Site { name: 'Sutty', email: "sutty@#{Site.domain}", time: Time.now } end - def add(file) - rugged.index.add(relativize(file)) - end - - def rm(file) - rugged.index.remove(relativize(file)) - end - # Garbage collection # # @return [Boolean] diff --git a/app/services/lfs_object_service.rb b/app/services/lfs_object_service.rb index bb62301d..c885936a 100644 --- a/app/services/lfs_object_service.rb +++ b/app/services/lfs_object_service.rb @@ -22,7 +22,7 @@ class LfsObjectService Site::Writer.new(site: site, file: path, content: pointer).save # Commitear el pointer - site.repository.commit(file: path, usuarie: author, message: File.basename(path)) + site.repository.commit(add: [path], usuarie: author, message: File.basename(path)) # Eliminar el pointer FileUtils.rm(path) diff --git a/app/services/post_service.rb b/app/services/post_service.rb index 7b31867d..aef7db80 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -16,7 +16,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do post.slug.value = p[:slug] if p[:slug].present? end - commit(action: :created, file: update_related_posts) if post.update(post_params) + commit(action: :created, add: update_related_posts) if post.update(post_params) update_site_license! @@ -34,7 +34,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do # Los artículos anónimos siempre son borradores params[:draft] = true - commit(action: :created) if post.update(anon_post_params) + commit(action: :created, add: [post.path.absolute]) if post.update(anon_post_params) post end @@ -44,7 +44,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do # Es importante que el artículo se guarde primero y luego los # relacionados. - commit(action: :updated, file: update_related_posts) if post.update(post_params) + commit(action: :updated, add: update_related_posts) if post.update(post_params) update_site_license! @@ -56,7 +56,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do def destroy post.destroy! - commit(action: :destroyed) if post.destroyed? + commit(action: :destroyed, rm: [post.path.absolute]) if post.destroyed? post end @@ -85,15 +85,15 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do # TODO: Implementar transacciones! posts.save_all(validate: false) && - commit(action: :reorder, file: files) + commit(action: :reorder, add: files) end private - def commit(action:, file: nil) - site.repository.commit(file: file || post.path.absolute, + def commit(action:, add: [], rm: []) + site.repository.commit(add: add, + rm: rm, usuarie: usuarie, - remove: action == :destroyed, message: I18n.t("post_service.#{action}", title: post&.title&.value)) end diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 2c29538c..b1df3d10 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -94,7 +94,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do def commit_config(action:) site.repository .commit(usuarie: usuarie, - file: site.config.path, + add: [site.config.path], message: I18n.t("site_service.#{action}", name: site.name)) end From 63620b2d091a195cfec85015b10df5ee56090e1a Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Jul 2023 13:27:51 -0300 Subject: [PATCH 370/475] fix: commitear el cambio de nombre de archivo #2183 --- app/services/post_service.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/services/post_service.rb b/app/services/post_service.rb index aef7db80..4b7ce4fa 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -42,9 +42,13 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do post.usuaries << usuarie params[:post][:draft] = true if site.invitade? usuarie + # Eliminar ("mover") el archivo si cambió de ubicación. + rm = [] + rm << post.path.value_was if post.path.changed? + # Es importante que el artículo se guarde primero y luego los # relacionados. - commit(action: :updated, add: update_related_posts) if post.update(post_params) + commit(action: :updated, add: update_related_posts, rm: rm) if post.update(post_params) update_site_license! From f05830c646faed40d16923923bd3867176a1c98b Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Jul 2023 13:38:29 -0300 Subject: [PATCH 371/475] fix: primero hay que modificar los datos --- app/services/post_service.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/services/post_service.rb b/app/services/post_service.rb index 4b7ce4fa..dda7992d 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -43,14 +43,16 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do params[:post][:draft] = true if site.invitade? usuarie # Eliminar ("mover") el archivo si cambió de ubicación. - rm = [] - rm << post.path.value_was if post.path.changed? + if post.update(post_params) + rm = [] + rm << post.path.value_was if post.path.changed? - # Es importante que el artículo se guarde primero y luego los - # relacionados. - commit(action: :updated, add: update_related_posts, rm: rm) if post.update(post_params) + # Es importante que el artículo se guarde primero y luego los + # relacionados. + commit(action: :updated, add: update_related_posts, rm: rm) - update_site_license! + update_site_license! + end # Devolver el post aunque no se haya salvado para poder rescatar los # errores From bb7487e941f86fb74a3be4dbc7383ebd5384c721 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 6 Jul 2023 12:43:28 -0300 Subject: [PATCH 372/475] fix: correr chdir de a uno por thread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit como jekyll no es multi-threaded, pero rails si, es posible que se produzca una excepción en Dir.chdir si se intenta leer sitios concurrentemente (por ejemplo, abrir dos pestañas del mismo sitio). closes #13717 closes #13716 closes #13715 closes #13619 --- app/models/site.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/site.rb b/app/models/site.rb index 24644b9c..81264a24 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -447,6 +447,10 @@ class Site < ApplicationRecord find_by(name: "#{Site.domain}.") end + def self.one_at_a_time + @@one_at_a_time ||= Thread::Mutex.new + end + def reset @read = false @layouts = nil @@ -553,7 +557,9 @@ class Site < ApplicationRecord end def run_in_path(&block) - Dir.chdir path, &block + Site.one_at_a_time.synchronize do + Dir.chdir path, &block + end end # Instala las gemas cuando es necesario: From 42b6744f81c8b3399893fba9cf561ef6f96b2b4b Mon Sep 17 00:00:00 2001 From: jazzari Date: Tue, 18 Jul 2023 15:47:26 -0300 Subject: [PATCH 373/475] feat: Job para hacer push #12919 --- app/jobs/git_push_job.rb | 12 ++++++++++++ app/models/site/repository.rb | 31 ++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 app/jobs/git_push_job.rb diff --git a/app/jobs/git_push_job.rb b/app/jobs/git_push_job.rb new file mode 100644 index 00000000..fb3ca662 --- /dev/null +++ b/app/jobs/git_push_job.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# Permite pushear los cambios cada vez que se +# hacen commits en un sitio +class GitPushJob < ApplicationJob + # @param :site [Site] + # @return [nil] + def perform(site) + #detectar que el repo local tiene repo remoto + site.repository.push if site.repository.origin + end +end \ No newline at end of file diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index 62e4c45e..10ab481d 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -29,7 +29,7 @@ class Site # Obtiene el origin # - # @return [Rugged::Remote] + # @return [Rugged::Remote, nil] def origin @origin ||= rugged.remotes.find do |remote| remote.name == 'origin' @@ -154,17 +154,15 @@ class Site # # @return [Boolean] def gc - env = { 'PATH' => '/usr/bin', 'LANG' => ENV['LANG'], 'HOME' => path } - cmd = 'git gc' + git_sh("git gc") + end - r = nil - Dir.chdir(path) do - Open3.popen2e(env, cmd, unsetenv_others: true) do |_, _, t| - r = t.value - end - end - - r&.success? + # Pushea cambios al repositorio remoto + # + # @return [Boolean, nil] + def push + origin.push(rugged.head.canonical_name, credentials: credentials) + git_sh("git lfs push") end private @@ -192,5 +190,16 @@ class Site def relativize(file) Pathname.new(file).relative_path_from(Pathname.new(path)).to_s end + + def git_sh(cmd) + env = { 'PATH' => '/usr/bin', 'LANG' => ENV['LANG'], 'HOME' => path } + + r = nil + Open3.popen2e(env, cmd, unsetenv_others: true, chdir: path) do |_, _, t| + r = t.value + end + + r&.success? + end end end From d77b8ba67be5d4955cfaeb141197a1ab0ab86963 Mon Sep 17 00:00:00 2001 From: jazzari Date: Thu, 20 Jul 2023 14:58:21 -0300 Subject: [PATCH 374/475] feat: created job to make git pull #12980 --- app/jobs/git_pull_job.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 app/jobs/git_pull_job.rb diff --git a/app/jobs/git_pull_job.rb b/app/jobs/git_pull_job.rb new file mode 100644 index 00000000..0c9ef237 --- /dev/null +++ b/app/jobs/git_pull_job.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# Permite traer los cambios cada vez que se +# hace un push al repositorio +class GitPullJob < ApplicationJob + # @param :site [Site] + # @return [nil] + def perform(site) + # hace un fetch para ver cambios + site.repository.fetch + + # hace un merge + site.repository.merge(site.usuarie) + site.repository.git_sh("git lfs fetch") + + end + end \ No newline at end of file From ca9fa31cf135d79e0204aad24d716a7f04c917c7 Mon Sep 17 00:00:00 2001 From: jazzari Date: Thu, 20 Jul 2023 15:31:38 -0300 Subject: [PATCH 375/475] fix: change git_sh method to accept array of params #12919 --- app/jobs/git_push_job.rb | 1 - app/models/site/repository.rb | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/jobs/git_push_job.rb b/app/jobs/git_push_job.rb index fb3ca662..3c62bee2 100644 --- a/app/jobs/git_push_job.rb +++ b/app/jobs/git_push_job.rb @@ -6,7 +6,6 @@ class GitPushJob < ApplicationJob # @param :site [Site] # @return [nil] def perform(site) - #detectar que el repo local tiene repo remoto site.repository.push if site.repository.origin end end \ No newline at end of file diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index 10ab481d..6306730e 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -154,7 +154,7 @@ class Site # # @return [Boolean] def gc - git_sh("git gc") + git_sh("git", "gc") end # Pushea cambios al repositorio remoto @@ -162,7 +162,7 @@ class Site # @return [Boolean, nil] def push origin.push(rugged.head.canonical_name, credentials: credentials) - git_sh("git lfs push") + git_sh("git", "lfs", "push", "origin", "#{default_branch}") end private @@ -191,11 +191,15 @@ class Site Pathname.new(file).relative_path_from(Pathname.new(path)).to_s end - def git_sh(cmd) + # Ejecuta un comando de git + # + # @param :args [Array] + # @return [Boolean] + def git_sh(*args) env = { 'PATH' => '/usr/bin', 'LANG' => ENV['LANG'], 'HOME' => path } r = nil - Open3.popen2e(env, cmd, unsetenv_others: true, chdir: path) do |_, _, t| + Open3.popen2e(env, args, unsetenv_others: true, chdir: path) do |_, _, t| r = t.value end From c2d64e11d7c0c6fb414e6970f6c933db19442561 Mon Sep 17 00:00:00 2001 From: jazzari Date: Thu, 20 Jul 2023 16:26:43 -0300 Subject: [PATCH 376/475] fix: missing splat in git_sh method #12919 --- app/models/site/repository.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index 6306730e..a900fea2 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -162,7 +162,7 @@ class Site # @return [Boolean, nil] def push origin.push(rugged.head.canonical_name, credentials: credentials) - git_sh("git", "lfs", "push", "origin", "#{default_branch}") + git_sh("git", "lfs", "push", "origin", "default_branch") end private @@ -199,7 +199,7 @@ class Site env = { 'PATH' => '/usr/bin', 'LANG' => ENV['LANG'], 'HOME' => path } r = nil - Open3.popen2e(env, args, unsetenv_others: true, chdir: path) do |_, _, t| + Open3.popen2e(env, *args, unsetenv_others: true, chdir: path) do |_, _, t| r = t.value end From 3e12bfbe9ec950ec4dfd639717664742bc0491b6 Mon Sep 17 00:00:00 2001 From: jazzari Date: Fri, 21 Jul 2023 17:12:26 -0300 Subject: [PATCH 377/475] fix: add git lfs fetch to repository#fetch method #12980 --- app/jobs/git_pull_job.rb | 12 ++++-------- app/models/site/repository.rb | 6 +++++- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/jobs/git_pull_job.rb b/app/jobs/git_pull_job.rb index 0c9ef237..de263403 100644 --- a/app/jobs/git_pull_job.rb +++ b/app/jobs/git_pull_job.rb @@ -4,14 +4,10 @@ # hace un push al repositorio class GitPullJob < ApplicationJob # @param :site [Site] + # @param :usuarie [Usuarie] # @return [nil] - def perform(site) - # hace un fetch para ver cambios + def perform(site, usuarie) site.repository.fetch - - # hace un merge - site.repository.merge(site.usuarie) - site.repository.git_sh("git lfs fetch") - + site.repository.merge(usuarie) end - end \ No newline at end of file +end \ No newline at end of file diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index 62e4c45e..d2832091 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -45,7 +45,9 @@ class Site # @return [Integer] def fetch if origin.check_connection(:fetch, credentials: credentials) - rugged.fetch(origin, credentials: credentials)[:received_objects] + rugged.fetch(origin, credentials: credentials)[:received_objects].tap do |objects| + git_sh("git", "lfs", "fetch", "origin", default_branch) if objects&.positive? + end else 0 end @@ -75,6 +77,8 @@ class Site # Forzamos el checkout para mover el HEAD al último commit y # escribir los cambios rugged.checkout 'HEAD', strategy: :force + # reemplaza los pointers por los archivos correspondientes + git_sh("git", "lfs", "checkout") commit end From b7dc448daaec35c2e45045ab2272fe0f82ada948 Mon Sep 17 00:00:00 2001 From: jazzari Date: Fri, 21 Jul 2023 17:15:36 -0300 Subject: [PATCH 378/475] fix: fix git_sh method in site.repository.rb #12919 --- app/models/site/repository.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index a900fea2..1ce10ed5 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -162,7 +162,7 @@ class Site # @return [Boolean, nil] def push origin.push(rugged.head.canonical_name, credentials: credentials) - git_sh("git", "lfs", "push", "origin", "default_branch") + git_sh("git", "lfs", "push", "origin", default_branch) end private From ae794322787548a79e6416663c45f3e8dd9cad62 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 21 Jul 2023 17:33:23 -0300 Subject: [PATCH 379/475] fix: renombrar el skel a upstream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit si lo mantenemos como origin por defecto, el GitPushJob va a querer enviar cambios a un repositorio común, rompiendo todo. --- app/models/site.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/site.rb b/app/models/site.rb index 24644b9c..0fddeff5 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -473,7 +473,7 @@ class Site < ApplicationRecord def clone_skel! return if jekyll? - Rugged::Repository.clone_at ENV['SKEL_SUTTY'], path + Rugged::Repository.clone_at ENV['SKEL_SUTTY'], path, remote: 'upstream' end # Elimina el directorio del sitio From b7e93cd8c8e8a9cbccc40d865571e21ecf0abfc3 Mon Sep 17 00:00:00 2001 From: jazzari Date: Wed, 26 Jul 2023 14:44:11 -0300 Subject: [PATCH 380/475] feat: controlador para gestionar los webhooks #13903 --- app/controllers/api/v1/webhooks_controller.rb | 17 +++++++++++++++++ app/models/site/repository.rb | 4 ++-- config/locales/en.yml | 3 +++ config/locales/es.yml | 3 +++ config/routes.rb | 2 ++ 5 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 app/controllers/api/v1/webhooks_controller.rb diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb new file mode 100644 index 00000000..4811d792 --- /dev/null +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Api + module V1 + # Recibe webhooks y lanza jobs + class WebhooksController < BaseController + def pull + # encontrar el sitio + site = Site.find_by_name(params[:site_id]) + usuarie = GitAuthor.new email: "webhook@#{Site.domain}", name: 'Webhook' + message = I18n.t('webhooks.pull.message') + + GitPullJob.perform_later(site, usuarie, message) + end + end + end +end \ No newline at end of file diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index 404cde3e..a3487bc5 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -56,7 +56,7 @@ class Site # Incorpora los cambios en el repositorio actual # # @return [Rugged::Commit] - def merge(usuarie) + def merge(usuarie, message) merge = rugged.merge_commits(head_commit, remote_head_commit) # No hacemos nada si hay conflictos, pero notificarnos @@ -71,7 +71,7 @@ class Site .create(rugged, update_ref: 'HEAD', parents: [head_commit, remote_head_commit], tree: merge.write_tree(rugged), - message: I18n.t('sites.fetch.merge.message'), + message: message, author: author(usuarie), committer: committer) # Forzamos el checkout para mover el HEAD al último commit y diff --git a/config/locales/en.yml b/config/locales/en.yml index 5f97a8b9..05fcf1e5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -466,6 +466,9 @@ en: success: 'Site upgrade has been completed. Your next build will run this upgrade :)' error: "There was an error when trying to upgrade your site. This could be due to conflicts that couldn't be solved automatically. A report of the issue has already been sent to our admins. Sorry for the inconvenience! :(" message: 'Skeleton upgrade' + webhooks_controller: + pull: + message: 'Webhooks upgrade' footer: powered_by: 'is developed by' i18n: diff --git a/config/locales/es.yml b/config/locales/es.yml index 9e0b8945..af5a7db7 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -474,6 +474,9 @@ es: success: 'Ya se incorporaron los cambios en el sitio, se aplicarán en la próxima compilación que hagas :)' error: 'Hubo un error al incorporar los cambios en el sitio. Esto puede deberse a conflictos entre cambios que no se pueden resolver automáticamente. Hemos enviado un reporte del problema a les administradores de Sutty para que estén al tanto de la situación. ¡Lo sentimos! :(' message: 'Actualización del esqueleto' + webhooks_controller: + pull: + message: 'Actualización desde Webhooks' footer: powered_by: 'es desarrollada por' i18n: diff --git a/config/routes.rb b/config/routes.rb index 3828915c..f2487066 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,6 +17,8 @@ Rails.application.routes.draw do get :'contact/cookie', to: 'invitades#contact_cookie' post :'contact/:form', to: 'contact#receive', as: :contact + + post :'webhooks/pull', to: 'webhooks#pull' end end end From 8947942cb9066f2775faf4b0864e2874a1c39907 Mon Sep 17 00:00:00 2001 From: jazzari Date: Thu, 27 Jul 2023 16:46:32 -0300 Subject: [PATCH 381/475] fix: commit message fixed #13903 --- app/controllers/api/v1/webhooks_controller.rb | 9 ++++++--- app/jobs/git_pull_job.rb | 4 ++-- app/models/site/repository.rb | 2 +- config/locales/en.yml | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 4811d792..40187915 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -4,11 +4,14 @@ module Api module V1 # Recibe webhooks y lanza jobs class WebhooksController < BaseController + # Trae los cambios a partir de un post de Webhooks: + # (Gitlab, Github, Guitea, etc) def pull - # encontrar el sitio - site = Site.find_by_name(params[:site_id]) + site = Site.find_by_name!(params[:site_id]) usuarie = GitAuthor.new email: "webhook@#{Site.domain}", name: 'Webhook' - message = I18n.t('webhooks.pull.message') + message = I18n.with_locale(site.default_locale) do + I18n.t('webhooks.pull.message') + end GitPullJob.perform_later(site, usuarie, message) end diff --git a/app/jobs/git_pull_job.rb b/app/jobs/git_pull_job.rb index de263403..5cd86981 100644 --- a/app/jobs/git_pull_job.rb +++ b/app/jobs/git_pull_job.rb @@ -6,8 +6,8 @@ class GitPullJob < ApplicationJob # @param :site [Site] # @param :usuarie [Usuarie] # @return [nil] - def perform(site, usuarie) + def perform(site, usuarie, message) site.repository.fetch - site.repository.merge(usuarie) + site.repository.merge(usuarie, message) if site.repository.fetch&.positive? end end \ No newline at end of file diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index a3487bc5..a864e8b9 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -56,7 +56,7 @@ class Site # Incorpora los cambios en el repositorio actual # # @return [Rugged::Commit] - def merge(usuarie, message) + def merge(usuarie, message= I18n.t('sites.fetch.merge.message')) merge = rugged.merge_commits(head_commit, remote_head_commit) # No hacemos nada si hay conflictos, pero notificarnos diff --git a/config/locales/en.yml b/config/locales/en.yml index 05fcf1e5..8ae8cce5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -468,7 +468,7 @@ en: message: 'Skeleton upgrade' webhooks_controller: pull: - message: 'Webhooks upgrade' + message: 'Webhooks pull' footer: powered_by: 'is developed by' i18n: From 9f5364a738825e7dc17b8482ecdd882f069d1ba4 Mon Sep 17 00:00:00 2001 From: jazzari Date: Thu, 27 Jul 2023 17:02:48 -0300 Subject: [PATCH 382/475] fix: add documentation to pull job #13903 --- app/jobs/git_pull_job.rb | 2 +- app/models/site/repository.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/jobs/git_pull_job.rb b/app/jobs/git_pull_job.rb index 5cd86981..a0c15950 100644 --- a/app/jobs/git_pull_job.rb +++ b/app/jobs/git_pull_job.rb @@ -5,9 +5,9 @@ class GitPullJob < ApplicationJob # @param :site [Site] # @param :usuarie [Usuarie] + # @param :message [String] # @return [nil] def perform(site, usuarie, message) - site.repository.fetch site.repository.merge(usuarie, message) if site.repository.fetch&.positive? end end \ No newline at end of file diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index a864e8b9..c0607d84 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -56,7 +56,7 @@ class Site # Incorpora los cambios en el repositorio actual # # @return [Rugged::Commit] - def merge(usuarie, message= I18n.t('sites.fetch.merge.message')) + def merge(usuarie, message = I18n.t('sites.fetch.merge.message')) merge = rugged.merge_commits(head_commit, remote_head_commit) # No hacemos nada si hay conflictos, pero notificarnos From 9f94ee3bc704dfe9a7787ce6be0b8015a2fcb676 Mon Sep 17 00:00:00 2001 From: jazzari Date: Thu, 27 Jul 2023 17:23:40 -0300 Subject: [PATCH 383/475] fix: add response status to pull method #13903 --- app/controllers/api/v1/webhooks_controller.rb | 2 ++ config/locales/es.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 40187915..a538d99f 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -14,6 +14,8 @@ module Api end GitPullJob.perform_later(site, usuarie, message) + + head :ok end end end diff --git a/config/locales/es.yml b/config/locales/es.yml index af5a7db7..b03a222f 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -476,7 +476,7 @@ es: message: 'Actualización del esqueleto' webhooks_controller: pull: - message: 'Actualización desde Webhooks' + message: 'Pull de webhooks' footer: powered_by: 'es desarrollada por' i18n: From 9a78c628b4aac8bffe44e4dffb80d0c268be6b83 Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 31 Jul 2023 12:29:27 -0300 Subject: [PATCH 384/475] fix: fix typo in es.yml #13864 --- config/locales/es.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/es.yml b/config/locales/es.yml index 9e0b8945..eabddcc9 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -693,7 +693,7 @@ es: new: 'Crear' edit: 'Configurar' posts: - new: 'Nuevo %{layout}' + new: 'Agregar %{layout}' edit: 'Editando' usuaries: index: 'Usuaries' From 06ebb63d9389c260e547c73487eb89c108dacb0b Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 31 Jul 2023 14:18:07 -0300 Subject: [PATCH 385/475] =?UTF-8?q?fix:=20movido=20git=20lfs=20a=20m=C3=A9?= =?UTF-8?q?todo=20merge=20en=20repository.rb=20#13903?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/git_pull_job.rb | 4 ++-- app/models/site/repository.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/jobs/git_pull_job.rb b/app/jobs/git_pull_job.rb index a0c15950..dc4a285c 100644 --- a/app/jobs/git_pull_job.rb +++ b/app/jobs/git_pull_job.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -# Permite traer los cambios cada vez que se -# hace un push al repositorio +# Permite traer los cambios desde webhooks + class GitPullJob < ApplicationJob # @param :site [Site] # @param :usuarie [Usuarie] diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index c0607d84..9c4d873f 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -45,9 +45,7 @@ class Site # @return [Integer] def fetch if origin.check_connection(:fetch, credentials: credentials) - rugged.fetch(origin, credentials: credentials)[:received_objects].tap do |objects| - git_sh("git", "lfs", "fetch", "origin", default_branch) if objects&.positive? - end + rugged.fetch(origin, credentials: credentials)[:received_objects] else 0 end @@ -77,6 +75,8 @@ class Site # Forzamos el checkout para mover el HEAD al último commit y # escribir los cambios rugged.checkout 'HEAD', strategy: :force + + git_sh("git", "lfs", "fetch", "origin", default_branch) # reemplaza los pointers por los archivos correspondientes git_sh("git", "lfs", "checkout") commit From 579e1776842774733c036b6b621ccf087b2b06cc Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 31 Jul 2023 17:32:14 -0300 Subject: [PATCH 386/475] feat: agregada columna token a model rol #13903 --- app/models/rol.rb | 10 ++++++++++ db/migrate/20230731195050_add_token_to_roles.rb | 5 +++++ db/migrate/20230731202003_change_token_name.rb | 5 +++++ 3 files changed, 20 insertions(+) create mode 100644 db/migrate/20230731195050_add_token_to_roles.rb create mode 100644 db/migrate/20230731202003_change_token_name.rb diff --git a/app/models/rol.rb b/app/models/rol.rb index fcd07037..f17bf418 100644 --- a/app/models/rol.rb +++ b/app/models/rol.rb @@ -14,6 +14,9 @@ class Rol < ApplicationRecord validates_inclusion_of :rol, in: ROLES + encrypts :token + before_save :add_token_if_missing! + def invitade? rol == INVITADE end @@ -25,4 +28,11 @@ class Rol < ApplicationRecord def self.role?(rol) ROLES.include? rol end + + private + + # Asegurarse que tenga un token + def add_token_if_missing! + self.token ||= SecureRandom.hex(64) + end end diff --git a/db/migrate/20230731195050_add_token_to_roles.rb b/db/migrate/20230731195050_add_token_to_roles.rb new file mode 100644 index 00000000..635e065c --- /dev/null +++ b/db/migrate/20230731195050_add_token_to_roles.rb @@ -0,0 +1,5 @@ +class AddTokenToRoles < ActiveRecord::Migration[6.1] + def change + add_column :roles, :token, :text + end +end diff --git a/db/migrate/20230731202003_change_token_name.rb b/db/migrate/20230731202003_change_token_name.rb new file mode 100644 index 00000000..50fc0c40 --- /dev/null +++ b/db/migrate/20230731202003_change_token_name.rb @@ -0,0 +1,5 @@ +class ChangeTokenName < ActiveRecord::Migration[6.1] + def change + rename_column :roles, :token, :token_cyphertext + end +end From c19c834f10962e3c58d2b08418ee7790430318c9 Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 31 Jul 2023 18:46:07 -0300 Subject: [PATCH 387/475] =?UTF-8?q?fix:=20cambio=20nombre=20comuna=20token?= =?UTF-8?q?=5Fcyphertext=20en=20modelo=20rol=20y=20asignaci=C3=B3n=20retro?= =?UTF-8?q?activa=20#13903?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20230731202003_change_token_name.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/db/migrate/20230731202003_change_token_name.rb b/db/migrate/20230731202003_change_token_name.rb index 50fc0c40..c3fce3c0 100644 --- a/db/migrate/20230731202003_change_token_name.rb +++ b/db/migrate/20230731202003_change_token_name.rb @@ -1,5 +1,6 @@ class ChangeTokenName < ActiveRecord::Migration[6.1] def change rename_column :roles, :token, :token_cyphertext + Rol.find_each { |m| m.update_column( :token_cyphertext, SecureRandom.hex(64) ) } end end From 705d15c0c1959d3e50b2f8646830a15372c4797e Mon Sep 17 00:00:00 2001 From: jazzari Date: Thu, 10 Aug 2023 16:05:14 -0300 Subject: [PATCH 388/475] fix: change token attribute from encrypted to normal in Rol model #13903 --- app/controllers/api/v1/webhooks_controller.rb | 22 ++++++++++++++----- app/models/rol.rb | 1 - 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index a538d99f..1933f24e 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -2,19 +2,31 @@ module Api module V1 - # Recibe webhooks y lanza jobs + # Recibe webhooks y lanza un PullJob class WebhooksController < BaseController + rescue_from ActiveRecord::RecordNotFound, with: :platforms_answer + + def site + @site ||= Site.find_by_name!(params[:site_id]) + end + + # valida la plataforma del webhook + def usuarie + # Gitlab + token = request.headers["X-Gitlab-Token"] + @usuarie = site.roles.find_by!(temporal: false, rol: 'usuarie', token: token).usuarie + end + # Trae los cambios a partir de un post de Webhooks: # (Gitlab, Github, Guitea, etc) def pull - site = Site.find_by_name!(params[:site_id]) - usuarie = GitAuthor.new email: "webhook@#{Site.domain}", name: 'Webhook' message = I18n.with_locale(site.default_locale) do I18n.t('webhooks.pull.message') end - GitPullJob.perform_later(site, usuarie, message) - + end + + def platforms_answer head :ok end end diff --git a/app/models/rol.rb b/app/models/rol.rb index f17bf418..37332400 100644 --- a/app/models/rol.rb +++ b/app/models/rol.rb @@ -14,7 +14,6 @@ class Rol < ApplicationRecord validates_inclusion_of :rol, in: ROLES - encrypts :token before_save :add_token_if_missing! def invitade? From 63fd91ee48f3a9cab4417f6e9bd21be6604440f0 Mon Sep 17 00:00:00 2001 From: jazzari Date: Thu, 10 Aug 2023 16:13:13 -0300 Subject: [PATCH 389/475] feat: add token to existing records #13903 --- db/migrate/20230731195050_add_token_to_roles.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/db/migrate/20230731195050_add_token_to_roles.rb b/db/migrate/20230731195050_add_token_to_roles.rb index 635e065c..620c9fef 100644 --- a/db/migrate/20230731195050_add_token_to_roles.rb +++ b/db/migrate/20230731195050_add_token_to_roles.rb @@ -1,5 +1,6 @@ class AddTokenToRoles < ActiveRecord::Migration[6.1] def change add_column :roles, :token, :text + Rol.find_each { |m| m.update_column( :token, SecureRandom.hex(64) ) } end end From 23732bbfe0ed8c4920bd7188b700f63ed5612b51 Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 14 Aug 2023 12:50:18 -0300 Subject: [PATCH 390/475] feat: add method to validate token from diff platforms in webhooks controller #13903 --- app/controllers/api/v1/webhooks_controller.rb | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 1933f24e..091d467e 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -10,10 +10,32 @@ module Api @site ||= Site.find_by_name!(params[:site_id]) end - # valida la plataforma del webhook + # valida el token que envía la plataforma del webhook + def token + @token ||= + begin + # Gitlab + if request.headers['X-Gitlab-Token'] + request.headers["X-Gitlab-Token"] + # Github + elsif request.headers['X-HUB-SIGNATURE-256'] + signature(request.env['HTTP_X_HUB_SIGNATURE_256']) + # Guitea + else + signature(request.env['HTTP_X_GITEA_SIGNATURE']) + end + end + end + + def token_from_signature(signature) + payload = request.body.read + site.roles.where(temporal: false, rol: 'usuarie').pluck(:token).find do |token| + new_signature = hash_mac(OpenSSL::Digest.new('sha256'), token, payload) + @token ||= Rack::Utils.secure_compare(new_signature, signature) + end + end + def usuarie - # Gitlab - token = request.headers["X-Gitlab-Token"] @usuarie = site.roles.find_by!(temporal: false, rol: 'usuarie', token: token).usuarie end @@ -23,6 +45,7 @@ module Api message = I18n.with_locale(site.default_locale) do I18n.t('webhooks.pull.message') end + GitPullJob.perform_later(site, usuarie, message) end From f2236bb305573e7a471e1b3a94ab50d486bc0d63 Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 14 Aug 2023 16:49:24 -0300 Subject: [PATCH 391/475] feat: move methods to private #13903 --- app/controllers/api/v1/webhooks_controller.rb | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 091d467e..b356d20a 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -6,6 +6,19 @@ module Api class WebhooksController < BaseController rescue_from ActiveRecord::RecordNotFound, with: :platforms_answer + # Trae los cambios a partir de un post de Webhooks: + # (Gitlab, Github, Guitea, etc) + def pull + message = I18n.with_locale(site.default_locale) do + I18n.t('webhooks.pull.message') + end + + GitPullJob.perform_later(site, usuarie, message) + platforms_answer + end + + private + def site @site ||= Site.find_by_name!(params[:site_id]) end @@ -37,17 +50,7 @@ module Api def usuarie @usuarie = site.roles.find_by!(temporal: false, rol: 'usuarie', token: token).usuarie - end - - # Trae los cambios a partir de un post de Webhooks: - # (Gitlab, Github, Guitea, etc) - def pull - message = I18n.with_locale(site.default_locale) do - I18n.t('webhooks.pull.message') - end - - GitPullJob.perform_later(site, usuarie, message) - end + end def platforms_answer head :ok From a098e1baa7d2e7e96b18bc16be7a21cc413c8f38 Mon Sep 17 00:00:00 2001 From: jazzari Date: Tue, 15 Aug 2023 16:14:34 -0300 Subject: [PATCH 392/475] fix: change migration methods to add token to roles #13903 --- db/migrate/20230731195050_add_token_to_roles.rb | 12 +++++++++--- db/migrate/20230731202003_change_token_name.rb | 6 ------ 2 files changed, 9 insertions(+), 9 deletions(-) delete mode 100644 db/migrate/20230731202003_change_token_name.rb diff --git a/db/migrate/20230731195050_add_token_to_roles.rb b/db/migrate/20230731195050_add_token_to_roles.rb index 620c9fef..c38b0526 100644 --- a/db/migrate/20230731195050_add_token_to_roles.rb +++ b/db/migrate/20230731195050_add_token_to_roles.rb @@ -1,6 +1,12 @@ class AddTokenToRoles < ActiveRecord::Migration[6.1] - def change - add_column :roles, :token, :text - Rol.find_each { |m| m.update_column( :token, SecureRandom.hex(64) ) } + def up + add_column :roles, :token, :string + Rol.find_each do |m| + m.update_column( :token, SecureRandom.hex(64) ) + end + end + + def down + remove_column :roles, :token end end diff --git a/db/migrate/20230731202003_change_token_name.rb b/db/migrate/20230731202003_change_token_name.rb deleted file mode 100644 index c3fce3c0..00000000 --- a/db/migrate/20230731202003_change_token_name.rb +++ /dev/null @@ -1,6 +0,0 @@ -class ChangeTokenName < ActiveRecord::Migration[6.1] - def change - rename_column :roles, :token, :token_cyphertext - Rol.find_each { |m| m.update_column( :token_cyphertext, SecureRandom.hex(64) ) } - end -end From c5406acb26221e591804d481ac6547072dd38952 Mon Sep 17 00:00:00 2001 From: jazzari Date: Tue, 15 Aug 2023 16:59:16 -0300 Subject: [PATCH 393/475] fix: add documentation and fix typos #13903 --- app/controllers/api/v1/webhooks_controller.rb | 101 ++++++++++-------- config/locales/es.yml | 2 +- 2 files changed, 56 insertions(+), 47 deletions(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index b356d20a..20cc0ddc 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -1,60 +1,69 @@ # frozen_string_literal: true module Api - module V1 - # Recibe webhooks y lanza un PullJob - class WebhooksController < BaseController - rescue_from ActiveRecord::RecordNotFound, with: :platforms_answer + module V1 + # Recibe webhooks y lanza un PullJob + class WebhooksController < BaseController + # responde con forbidden si falla la validación del token + rescue_from ActiveRecord::RecordNotFound, with: :platforms_answer - # Trae los cambios a partir de un post de Webhooks: - # (Gitlab, Github, Guitea, etc) - def pull - message = I18n.with_locale(site.default_locale) do - I18n.t('webhooks.pull.message') - end - - GitPullJob.perform_later(site, usuarie, message) - platforms_answer + # Trae los cambios a partir de un post de Webhooks: + # (Gitlab, Github, Gitea, etc) + def pull + message = I18n.with_locale(site.default_locale) do + I18n.t('webhooks.pull.message') end - private + GitPullJob.perform_later(site, usuarie, message) + head :ok + end - def site - @site ||= Site.find_by_name!(params[:site_id]) - end + private - # valida el token que envía la plataforma del webhook - def token - @token ||= - begin - # Gitlab - if request.headers['X-Gitlab-Token'] - request.headers["X-Gitlab-Token"] - # Github - elsif request.headers['X-HUB-SIGNATURE-256'] - signature(request.env['HTTP_X_HUB_SIGNATURE_256']) - # Guitea - else - signature(request.env['HTTP_X_GITEA_SIGNATURE']) - end - end - end + # encuentra el sitio a partir de la url + def site + @site ||= Site.find_by_name!(params[:site_id]) + end - def token_from_signature(signature) - payload = request.body.read - site.roles.where(temporal: false, rol: 'usuarie').pluck(:token).find do |token| - new_signature = hash_mac(OpenSSL::Digest.new('sha256'), token, payload) - @token ||= Rack::Utils.secure_compare(new_signature, signature) - end - end + # valida el token que envía la plataforma del webhook + # + # @return [String] + def token + @token ||= + begin + # Gitlab + if request.headers['X-Gitlab-Token'] + request.headers['X-Gitlab-Token'] + # Github + elsif request.headers['X-HUB-SIGNATURE-256'] + request.env['HTTP_X_HUB_SIGNATURE_256'] + # Gitea + else + request.env['HTTP_X_GITEA_SIGNATURE'] + end + end + end - def usuarie - @usuarie = site.roles.find_by!(temporal: false, rol: 'usuarie', token: token).usuarie - end - - def platforms_answer - head :ok + # valida token a partir de firma de webhook + # + # @return [String] + def token_from_signature(signature) + payload = request.body.read + site.roles.where(temporal: false, rol: 'usuarie').pluck(:token).find do |token| + new_signature = 'sha256=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload) + ActiveSupport::SecurityUtils.secure_compare(new_signature, signature) end end + + # encuentra le usuarie + def usuarie + @usuarie ||= site.roles.find_by!(temporal: false, rol: 'usuarie', token: token).usuarie + end + + # respuesta de error a plataformas + def platforms_answer + head :forbidden + end end + end end \ No newline at end of file diff --git a/config/locales/es.yml b/config/locales/es.yml index b03a222f..7a83483f 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -476,7 +476,7 @@ es: message: 'Actualización del esqueleto' webhooks_controller: pull: - message: 'Pull de webhooks' + message: 'Traer los cambios a partir de un evento remoto' footer: powered_by: 'es desarrollada por' i18n: From aeb2105dc7273cf603ab8e86f7bc90780f96093f Mon Sep 17 00:00:00 2001 From: jazzari Date: Tue, 15 Aug 2023 19:25:06 -0300 Subject: [PATCH 394/475] fix: add rescue in token_from_signature method #13903 --- app/controllers/api/v1/webhooks_controller.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 20cc0ddc..0ecca9d7 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -9,6 +9,8 @@ module Api # Trae los cambios a partir de un post de Webhooks: # (Gitlab, Github, Gitea, etc) + # + # @return [nil] def pull message = I18n.with_locale(site.default_locale) do I18n.t('webhooks.pull.message') @@ -36,22 +38,27 @@ module Api request.headers['X-Gitlab-Token'] # Github elsif request.headers['X-HUB-SIGNATURE-256'] - request.env['HTTP_X_HUB_SIGNATURE_256'] + token_from_signature(request.env['HTTP_X_HUB_SIGNATURE_256']) # Gitea else - request.env['HTTP_X_GITEA_SIGNATURE'] + token_from_signatureq(request.env['HTTP_X_GITEA_SIGNATURE']) end end end # valida token a partir de firma de webhook # - # @return [String] + # @return [String, Boolean] def token_from_signature(signature) payload = request.body.read site.roles.where(temporal: false, rol: 'usuarie').pluck(:token).find do |token| new_signature = 'sha256=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload) ActiveSupport::SecurityUtils.secure_compare(new_signature, signature) + end.tap do |t| + raise ArgumentError, 'token no encontrado' if t.nil? + rescue ArgumentError => e + ExceptionNotifier.notify_exception(e, data: { params: params.to_h }) + raise ActiveRecord::RecordNotFound end end From 5ac628b38a0032a26e0f9d29f1c4e1266069360b Mon Sep 17 00:00:00 2001 From: jazzari Date: Wed, 16 Aug 2023 12:58:14 -0300 Subject: [PATCH 395/475] fix: fix typo and change response to platforms #13903 --- app/controllers/api/v1/webhooks_controller.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 0ecca9d7..40f2f06d 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -40,8 +40,10 @@ module Api elsif request.headers['X-HUB-SIGNATURE-256'] token_from_signature(request.env['HTTP_X_HUB_SIGNATURE_256']) # Gitea + elsif + token_from_signature(request.env['HTTP_X_GITEA_SIGNATURE']) else - token_from_signatureq(request.env['HTTP_X_GITEA_SIGNATURE']) + raise ActiveRecord::RecordNotFound end end end @@ -55,10 +57,7 @@ module Api new_signature = 'sha256=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload) ActiveSupport::SecurityUtils.secure_compare(new_signature, signature) end.tap do |t| - raise ArgumentError, 'token no encontrado' if t.nil? - rescue ArgumentError => e - ExceptionNotifier.notify_exception(e, data: { params: params.to_h }) - raise ActiveRecord::RecordNotFound + raise ActiveRecord::RecordNotFound if t.nil? end end @@ -70,6 +69,9 @@ module Api # respuesta de error a plataformas def platforms_answer head :forbidden + raise ArgumentError, 'token no encontrado' + rescue ArgumentError => e + ExceptionNotifier.notify_exception(e, data: { params: params.to_h }) end end end From 35dca9d7565f40f2a037b095ea8005cd2a953232 Mon Sep 17 00:00:00 2001 From: jazzari Date: Wed, 16 Aug 2023 13:39:29 -0300 Subject: [PATCH 396/475] fix: fix exception in platforms_answer method #13903 --- app/controllers/api/v1/webhooks_controller.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 40f2f06d..13a227ce 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -57,7 +57,7 @@ module Api new_signature = 'sha256=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload) ActiveSupport::SecurityUtils.secure_compare(new_signature, signature) end.tap do |t| - raise ActiveRecord::RecordNotFound if t.nil? + raise ActiveRecord::RecordNotFound, 'token no encontrado' if t.nil? end end @@ -67,12 +67,9 @@ module Api end # respuesta de error a plataformas - def platforms_answer + def platforms_answer(exception) head :forbidden - raise ArgumentError, 'token no encontrado' - rescue ArgumentError => e - ExceptionNotifier.notify_exception(e, data: { params: params.to_h }) - end + ExceptionNotifier.notify_exception(exception, data: { params: params.to_h }) end end end \ No newline at end of file From cefd053d1d7f70233f07cd047fd1dc5d321dd8b5 Mon Sep 17 00:00:00 2001 From: jazzari Date: Wed, 16 Aug 2023 14:57:01 -0300 Subject: [PATCH 397/475] fix: add condition in elsif in token method #13903 --- app/controllers/api/v1/webhooks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 13a227ce..3af9abee 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -40,7 +40,7 @@ module Api elsif request.headers['X-HUB-SIGNATURE-256'] token_from_signature(request.env['HTTP_X_HUB_SIGNATURE_256']) # Gitea - elsif + elsif request.headers['HTTP_X_GITEA_SIGNATURE'] token_from_signature(request.env['HTTP_X_GITEA_SIGNATURE']) else raise ActiveRecord::RecordNotFound From 114fe4b2d5dce83874735cf1de97af6e89b925d5 Mon Sep 17 00:00:00 2001 From: jazzari Date: Wed, 16 Aug 2023 15:43:57 -0300 Subject: [PATCH 398/475] fix: fix in es.yml & en.yml and missing end #13903 --- app/controllers/api/v1/webhooks_controller.rb | 11 ++++++----- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 3af9abee..8ef943be 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -38,12 +38,12 @@ module Api request.headers['X-Gitlab-Token'] # Github elsif request.headers['X-HUB-SIGNATURE-256'] - token_from_signature(request.env['HTTP_X_HUB_SIGNATURE_256']) + token_from_signature(request.env['HTTP_X_HUB_SIGNATURE_256'], 'sha256=') # Gitea elsif request.headers['HTTP_X_GITEA_SIGNATURE'] token_from_signature(request.env['HTTP_X_GITEA_SIGNATURE']) else - raise ActiveRecord::RecordNotFound + raise ActiveRecord::RecordNotFound, 'proveedor no soportado' end end end @@ -51,10 +51,10 @@ module Api # valida token a partir de firma de webhook # # @return [String, Boolean] - def token_from_signature(signature) + def token_from_signature(signature. prepend = '') payload = request.body.read site.roles.where(temporal: false, rol: 'usuarie').pluck(:token).find do |token| - new_signature = 'sha256=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload) + new_signature = prepend + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload) ActiveSupport::SecurityUtils.secure_compare(new_signature, signature) end.tap do |t| raise ActiveRecord::RecordNotFound, 'token no encontrado' if t.nil? @@ -69,7 +69,8 @@ module Api # respuesta de error a plataformas def platforms_answer(exception) head :forbidden - ExceptionNotifier.notify_exception(exception, data: { params: params.to_h }) + ExceptionNotifier.notify_exception(exception, env: request.env) + end end end end \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 8ae8cce5..c9a723bc 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -466,7 +466,7 @@ en: success: 'Site upgrade has been completed. Your next build will run this upgrade :)' error: "There was an error when trying to upgrade your site. This could be due to conflicts that couldn't be solved automatically. A report of the issue has already been sent to our admins. Sorry for the inconvenience! :(" message: 'Skeleton upgrade' - webhooks_controller: + webhooks: pull: message: 'Webhooks pull' footer: diff --git a/config/locales/es.yml b/config/locales/es.yml index 7a83483f..857217ec 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -474,7 +474,7 @@ es: success: 'Ya se incorporaron los cambios en el sitio, se aplicarán en la próxima compilación que hagas :)' error: 'Hubo un error al incorporar los cambios en el sitio. Esto puede deberse a conflictos entre cambios que no se pueden resolver automáticamente. Hemos enviado un reporte del problema a les administradores de Sutty para que estén al tanto de la situación. ¡Lo sentimos! :(' message: 'Actualización del esqueleto' - webhooks_controller: + webhooks: pull: message: 'Traer los cambios a partir de un evento remoto' footer: From 5ef601139fab2f99952dcda124a6a06bd10dc054 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 16 Aug 2023 16:21:48 -0300 Subject: [PATCH 399/475] fix: eliminar espacio en blanco --- app/controllers/api/v1/webhooks_controller.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 8ef943be..fb4a710c 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -11,7 +11,7 @@ module Api # (Gitlab, Github, Gitea, etc) # # @return [nil] - def pull + def pull message = I18n.with_locale(site.default_locale) do I18n.t('webhooks.pull.message') end @@ -20,17 +20,17 @@ module Api head :ok end - private + private # encuentra el sitio a partir de la url - def site + def site @site ||= Site.find_by_name!(params[:site_id]) end # valida el token que envía la plataforma del webhook # # @return [String] - def token + def token @token ||= begin # Gitlab @@ -45,14 +45,14 @@ module Api else raise ActiveRecord::RecordNotFound, 'proveedor no soportado' end - end + end end # valida token a partir de firma de webhook # # @return [String, Boolean] def token_from_signature(signature. prepend = '') - payload = request.body.read + payload = request.body.read site.roles.where(temporal: false, rol: 'usuarie').pluck(:token).find do |token| new_signature = prepend + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload) ActiveSupport::SecurityUtils.secure_compare(new_signature, signature) @@ -61,10 +61,10 @@ module Api end end - # encuentra le usuarie + # encuentra le usuarie def usuarie @usuarie ||= site.roles.find_by!(temporal: false, rol: 'usuarie', token: token).usuarie - end + end # respuesta de error a plataformas def platforms_answer(exception) @@ -73,4 +73,4 @@ module Api end end end -end \ No newline at end of file +end From 690efe329c571c0d8c601645735d186b7890a572 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 16 Aug 2023 16:22:57 -0300 Subject: [PATCH 400/475] fix: llamar a los headers consistentemente --- app/controllers/api/v1/webhooks_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index fb4a710c..1d1258fd 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -37,11 +37,11 @@ module Api if request.headers['X-Gitlab-Token'] request.headers['X-Gitlab-Token'] # Github - elsif request.headers['X-HUB-SIGNATURE-256'] - token_from_signature(request.env['HTTP_X_HUB_SIGNATURE_256'], 'sha256=') + elsif request.headers['X-Hub-Signature-256'] + token_from_signature(request.headers['X_Hub_Signature_256'], 'sha256=') # Gitea - elsif request.headers['HTTP_X_GITEA_SIGNATURE'] - token_from_signature(request.env['HTTP_X_GITEA_SIGNATURE']) + elsif request.headers['X_Gitea_Signature'] + token_from_signature(request.headers['X_Gitea_Signature']) else raise ActiveRecord::RecordNotFound, 'proveedor no soportado' end From a99e03ce15d13122f36e2aab976fd5229156300e Mon Sep 17 00:00:00 2001 From: f Date: Wed, 16 Aug 2023 16:23:39 -0300 Subject: [PATCH 401/475] feat: enviar los headers en el reporte --- app/controllers/api/v1/webhooks_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 1d1258fd..6be6c2dc 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -68,8 +68,9 @@ module Api # respuesta de error a plataformas def platforms_answer(exception) + ExceptionNotifier.notify_exception(exception, env: request.env, data: { headers: request.headers.to_h }) + head :forbidden - ExceptionNotifier.notify_exception(exception, env: request.env) end end end From 42e6a0b6eb5432773d2337ed33ac154defd2c042 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 16 Aug 2023 16:24:33 -0300 Subject: [PATCH 402/475] fix: typo --- app/controllers/api/v1/webhooks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 6be6c2dc..ab2fce6b 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -51,7 +51,7 @@ module Api # valida token a partir de firma de webhook # # @return [String, Boolean] - def token_from_signature(signature. prepend = '') + def token_from_signature(signature, prepend = '') payload = request.body.read site.roles.where(temporal: false, rol: 'usuarie').pluck(:token).find do |token| new_signature = prepend + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload) From b9083c492cd3e50971bbbca9a549b81c4781efe3 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 16 Aug 2023 16:26:39 -0300 Subject: [PATCH 403/475] fix: presencia --- app/controllers/api/v1/webhooks_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index ab2fce6b..23bfae22 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -34,13 +34,13 @@ module Api @token ||= begin # Gitlab - if request.headers['X-Gitlab-Token'] + if request.headers['X-Gitlab-Token'].present? request.headers['X-Gitlab-Token'] # Github - elsif request.headers['X-Hub-Signature-256'] + elsif request.headers['X-Hub-Signature-256'].present? token_from_signature(request.headers['X_Hub_Signature_256'], 'sha256=') # Gitea - elsif request.headers['X_Gitea_Signature'] + elsif request.headers['X_Gitea_Signature'].present? token_from_signature(request.headers['X_Gitea_Signature']) else raise ActiveRecord::RecordNotFound, 'proveedor no soportado' From a2678c3e81f7943368edf9a51e9de80354af603f Mon Sep 17 00:00:00 2001 From: f Date: Wed, 16 Aug 2023 16:35:36 -0300 Subject: [PATCH 404/475] fix: no ignorar excepciones como record not found --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 4cc1cb39..5e089ff9 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -142,7 +142,7 @@ Rails.application.configure do } config.action_mailer.default_options = { from: ENV.fetch('DEFAULT_FROM', "noreply@sutty.nl") } - config.middleware.use ExceptionNotification::Rack, gitlab: {}, ignore_exceptions: (['DeployJob::DeployAlreadyRunningException'] + ExceptionNotifier.ignored_exceptions) + config.middleware.use ExceptionNotification::Rack, gitlab: {}, 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' From ef8ed271d75dd1e4bdf079c11f8bcaf450af25ac Mon Sep 17 00:00:00 2001 From: f Date: Wed, 16 Aug 2023 16:46:11 -0300 Subject: [PATCH 405/475] fix: consistencia al llamar a headers --- app/controllers/api/v1/webhooks_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 23bfae22..95439cd4 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -38,10 +38,10 @@ module Api request.headers['X-Gitlab-Token'] # Github elsif request.headers['X-Hub-Signature-256'].present? - token_from_signature(request.headers['X_Hub_Signature_256'], 'sha256=') + token_from_signature(request.headers['X-Hub-Signature-256'], 'sha256=') # Gitea - elsif request.headers['X_Gitea_Signature'].present? - token_from_signature(request.headers['X_Gitea_Signature']) + elsif request.headers['X-Gitea-Signature'].present? + token_from_signature(request.headers['X-Gitea-Signature']) else raise ActiveRecord::RecordNotFound, 'proveedor no soportado' end From 4a7ac981e5029ce8c23fa0c54c5ba99268dcb3ee Mon Sep 17 00:00:00 2001 From: f Date: Wed, 16 Aug 2023 17:04:34 -0300 Subject: [PATCH 406/475] fix: no fallar si la firma es nil closes #14089 --- app/controllers/api/v1/webhooks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 95439cd4..1730034e 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -55,7 +55,7 @@ module Api payload = request.body.read site.roles.where(temporal: false, rol: 'usuarie').pluck(:token).find do |token| new_signature = prepend + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload) - ActiveSupport::SecurityUtils.secure_compare(new_signature, signature) + ActiveSupport::SecurityUtils.secure_compare(new_signature, signature.to_s) end.tap do |t| raise ActiveRecord::RecordNotFound, 'token no encontrado' if t.nil? end From 6bae3a68f167956a7799d1252833ab2f7b0e694a Mon Sep 17 00:00:00 2001 From: f Date: Wed, 16 Aug 2023 17:35:20 -0300 Subject: [PATCH 407/475] feat: enviar cambios luego de commitearlos --- app/services/post_service.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/services/post_service.rb b/app/services/post_service.rb index 7b31867d..601915f8 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -96,6 +96,8 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do remove: action == :destroyed, message: I18n.t("post_service.#{action}", title: post&.title&.value)) + + GitPushJob.perform_later(site) end # Solo permitir cambiar estos atributos de cada articulo From 5a004b1cad1734af695a37d92d4a271603b818f1 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 16 Aug 2023 17:35:33 -0300 Subject: [PATCH 408/475] =?UTF-8?q?feat:=20enviar=20configuraci=C3=B3n=20l?= =?UTF-8?q?uego=20de=20comitearla?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/site_service.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 2c29538c..fc82ae84 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -97,6 +97,8 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do file: site.config.path, message: I18n.t("site_service.#{action}", name: site.name)) + + GitPushJob.perform_later(site) end def add_role(temporal: true, rol: 'invitade') From dd75a16335bdc0c7b095424bab44e94deb6d7da3 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 23 Aug 2023 11:22:09 -0300 Subject: [PATCH 409/475] fix: faltaron archivos en el merge --- .gitattributes | 2 ++ .../serializers/exception_serializer.rb | 22 +++++++++++++++++++ .../20230328231029_create_que_tables.rb | 12 ++++++++++ 3 files changed, 36 insertions(+) create mode 100644 .gitattributes create mode 100644 app/lib/active_job/serializers/exception_serializer.rb create mode 100644 db/migrate/20230328231029_create_que_tables.rb diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..0ede410e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +public/assets/** filter=lfs diff=lfs merge=lfs -text +public/packs/** filter=lfs diff=lfs merge=lfs -text diff --git a/app/lib/active_job/serializers/exception_serializer.rb b/app/lib/active_job/serializers/exception_serializer.rb new file mode 100644 index 00000000..42b55835 --- /dev/null +++ b/app/lib/active_job/serializers/exception_serializer.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require 'json/add/exception' + +module ActiveJob + module Serializers + class ExceptionSerializer < ObjectSerializer # :nodoc: + def serialize(ex) + super('value' => { 'class' => ex.class.name, 'exception' => ex.as_json }) + end + + def deserialize(hash) + hash.dig('value', 'class').constantize.json_create(hash.dig('value', 'exception')) + end + + private + def klass + Exception + end + end + end +end diff --git a/db/migrate/20230328231029_create_que_tables.rb b/db/migrate/20230328231029_create_que_tables.rb new file mode 100644 index 00000000..1ed929f7 --- /dev/null +++ b/db/migrate/20230328231029_create_que_tables.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# Que +class CreateQueTables < ActiveRecord::Migration[6.1] + def up + Que.migrate! version: 7 + end + + def down + Que.migrate! version: 0 + end +end From 1be1977c343a6d6b6a9a379d9414872db9830f8b Mon Sep 17 00:00:00 2001 From: jazzari Date: Wed, 23 Aug 2023 14:13:25 -0300 Subject: [PATCH 410/475] fix: fix minima design's link to demostration site #14131 --- db/seeds/designs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/seeds/designs.yml b/db/seeds/designs.yml index a04c99c1..46f1cd0d 100644 --- a/db/seeds/designs.yml +++ b/db/seeds/designs.yml @@ -18,7 +18,7 @@ - name_en: 'Minima' name_es: 'Mínima' gem: 'sutty-minima' - url: 'https://0xacab.org/sutty/jekyll/minima' + url: 'https://minima.sutty.nl/' description_en: "Sutty Minima is based on [Minima](https://jekyll.github.io/minima/), a blog-focused theme for Jekyll." description_es: 'Sutty Mínima es una plantilla para blogs basada en [Mínima](https://jekyll.github.io/minima/).' license: 'https://0xacab.org/sutty/jekyll/minima/-/blob/master/LICENSE.txt' From c09dfc3b67fb19a80971aee6e1f36fa5bde0dbae Mon Sep 17 00:00:00 2001 From: f Date: Fri, 25 Aug 2023 10:11:36 -0300 Subject: [PATCH 411/475] ci: force ci to rebuild assets --- app/assets/stylesheets/application.scss | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 65a207fa..eb953c30 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -525,5 +525,3 @@ $bezier: cubic-bezier(0.75, 0, 0.25, 1); } } } - -// force ci From ef64dbc049c99b63acdbf918c3c37c4407839c5d Mon Sep 17 00:00:00 2001 From: f Date: Thu, 31 Aug 2023 10:48:54 -0300 Subject: [PATCH 412/475] ci: assets [skip ci] --- .../.sprockets-manifest-c6294bb290dcb7473076f4de99ce9c00.json | 3 +++ ...sprockets-manifest-c6294bb290dcb7473076f4de99ce9c00.json.br | 3 +++ ...771691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js | 3 +++ ...691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js.br | 3 +++ ...691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js.gz | 3 +++ ...b6c06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css | 3 +++ ...06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css.br | 3 +++ ...06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css.gz | 3 +++ ...e855d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg | 3 +++ ...5d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg.br | 3 +++ ...5d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg.gz | 3 +++ ...a1f2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css | 3 +++ ...2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css.br | 3 +++ ...2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css.gz | 3 +++ ...8656a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js | 3 +++ ...6a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js.br | 3 +++ ...6a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js.gz | 3 +++ ...853543a3542af03c7dde9963359b1c0b9b725220a7f193e1324ecd8.png | 3 +++ ...543a3542af03c7dde9963359b1c0b9b725220a7f193e1324ecd8.png.br | 3 +++ ...8a012c0011843ae337a8a20270c336948a8668df5cb89a8827299b.woff | 3 +++ ...12c0011843ae337a8a20270c336948a8668df5cb89a8827299b.woff.br | 3 +++ ...24235f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot | 3 +++ ...35f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot.br | 3 +++ ...35f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot.gz | 3 +++ ...9d7d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg | 3 +++ ...d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg.br | 3 +++ ...d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg.gz | 3 +++ ...aebd1c28b404eec442cea53642644b3a73f91c5a4ab46859af772.woff2 | 3 +++ ...d1c28b404eec442cea53642644b3a73f91c5a4ab46859af772.woff2.br | 3 +++ ...e16169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf | 3 +++ ...169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf.br | 3 +++ ...169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf.gz | 3 +++ ...dc47b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css | 3 +++ ...7b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css.br | 3 +++ ...7b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css.gz | 3 +++ ...287b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css | 3 +++ ...b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css.br | 3 +++ ...b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css.gz | 3 +++ ...9c00df26e81bc5a33bcf64350729f954b85f82d5e759fffec4e183a.png | 3 +++ ...0df26e81bc5a33bcf64350729f954b85f82d5e759fffec4e183a.png.br | 3 +++ ...54162eb71f127f50460dbc55d405027189ebe90b20729ef18d13d36.png | 3 +++ ...62eb71f127f50460dbc55d405027189ebe90b20729ef18d13d36.png.br | 3 +++ ...413b14db27db07285ade3951721e02244c31523284ab2d1ed53c3dc.png | 3 +++ ...b14db27db07285ade3951721e02244c31523284ab2d1ed53c3dc.png.br | 3 +++ ...0eae9497ea201f3ad57549af343ddc1d24ddc78b055627cf14e9d5d.png | 3 +++ ...e9497ea201f3ad57549af343ddc1d24ddc78b055627cf14e9d5d.png.br | 3 +++ ...66af0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js | 3 +++ ...f0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js.br | 3 +++ ...f0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js.gz | 3 +++ ...3c16cdcefe54920aa7d3994a0683317ca9a58d35cbc5ec65996398c.png | 3 +++ ...6cdcefe54920aa7d3994a0683317ca9a58d35cbc5ec65996398c.png.br | 3 +++ ...c4ba0e1f22a01cdf1ff7f120fa4d89a6cd0933d68f12951d19809b4.png | 3 +++ ...a0e1f22a01cdf1ff7f120fa4d89a6cd0933d68f12951d19809b4.png.br | 3 +++ ...a198f61f68a71ed8f9f9c701122c0c33b775d990edceae4aece567f.png | 3 +++ ...8f61f68a71ed8f9f9c701122c0c33b775d990edceae4aece567f.png.br | 3 +++ ...ea5684d70cc5b51fb1ae3186386fe9363bf3edaf01663ac641341.woff2 | 3 +++ ...684d70cc5b51fb1ae3186386fe9363bf3edaf01663ac641341.woff2.br | 3 +++ ...0de8d5709d5162dbf0dcb9ab8df71e55f63cfd986bdb68ee2ade0b.woff | 3 +++ ...8d5709d5162dbf0dcb9ab8df71e55f63cfd986bdb68ee2ade0b.woff.br | 3 +++ ...b86358489cb76fc34ec0683d57a1b2635c43acbae45be3349d976.woff2 | 3 +++ ...358489cb76fc34ec0683d57a1b2635c43acbae45be3349d976.woff2.br | 3 +++ ...6451cd2fb3803333f4de3e11033437aa0c8d3d06edcb19e4e38ecb.woff | 3 +++ ...1cd2fb3803333f4de3e11033437aa0c8d3d06edcb19e4e38ecb.woff.br | 3 +++ ...da83a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg | 3 +++ ...3a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg.br | 3 +++ ...3a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg.gz | 3 +++ ...70c82f2bf8fa2d68b3b32e5e2a1c0ed787dafa6ea1b98b52b96328f.png | 3 +++ ...82f2bf8fa2d68b3b32e5e2a1c0ed787dafa6ea1b98b52b96328f.png.br | 3 +++ public/packs/css/application-7d15ae94.css | 3 +++ public/packs/css/application-7d15ae94.css.br | 3 +++ public/packs/css/application-7d15ae94.css.br.br | 3 +++ public/packs/css/application-7d15ae94.css.gz | 3 +++ public/packs/js/application-fd20cd4c95f90c1a3ecd.js | 3 +++ .../packs/js/application-fd20cd4c95f90c1a3ecd.js.LICENSE.txt | 3 +++ .../js/application-fd20cd4c95f90c1a3ecd.js.LICENSE.txt.br | 3 +++ public/packs/js/application-fd20cd4c95f90c1a3ecd.js.br | 3 +++ public/packs/js/application-fd20cd4c95f90c1a3ecd.js.br.br | 3 +++ public/packs/js/application-fd20cd4c95f90c1a3ecd.js.gz | 3 +++ public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map | 3 +++ public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.br | 3 +++ public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.br.br | 3 +++ public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.gz | 3 +++ public/packs/manifest.json | 3 +++ public/packs/manifest.json.br | 3 +++ public/packs/manifest.json.br.br | 3 +++ public/packs/manifest.json.gz | 3 +++ public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff | 3 +++ public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff.br | 3 +++ public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2 | 3 +++ public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2.br | 3 +++ public/packs/media/fonts/forkawesome-webfont-86541105.svg | 3 +++ public/packs/media/fonts/forkawesome-webfont-86541105.svg.br | 3 +++ .../packs/media/fonts/forkawesome-webfont-86541105.svg.br.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 +++ .../packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br.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 +++ .../packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br.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-2x-8f2c4d11.png.br | 3 +++ public/packs/media/images/layers-416d9136.png | 3 +++ public/packs/media/images/layers-416d9136.png.br | 3 +++ public/packs/media/images/marker-icon-2b3e1faf.png | 3 +++ public/packs/media/images/marker-icon-2b3e1faf.png.br | 3 +++ public/packs/media/images/marker-icon-2x-680f69f3.png | 3 +++ public/packs/media/images/marker-icon-2x-680f69f3.png.br | 3 +++ public/packs/media/images/marker-shadow-a0c6cc14.png | 3 +++ public/packs/media/images/marker-shadow-a0c6cc14.png.br | 3 +++ 112 files changed, 336 insertions(+) create mode 100644 public/assets/.sprockets-manifest-c6294bb290dcb7473076f4de99ce9c00.json create mode 100644 public/assets/.sprockets-manifest-c6294bb290dcb7473076f4de99ce9c00.json.br create mode 100644 public/assets/activestorage-9f749d32771691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js create mode 100644 public/assets/activestorage-9f749d32771691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js.br create mode 100644 public/assets/activestorage-9f749d32771691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js.gz create mode 100644 public/assets/application-dc5234b33b6c06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css create mode 100644 public/assets/application-dc5234b33b6c06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css.br create mode 100644 public/assets/application-dc5234b33b6c06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css.gz create mode 100644 public/assets/arrows-alt-v-89a34626be855d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg create mode 100644 public/assets/arrows-alt-v-89a34626be855d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg.br create mode 100644 public/assets/arrows-alt-v-89a34626be855d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg.gz create mode 100644 public/assets/blazer/application-59c73da0ca1f2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css create mode 100644 public/assets/blazer/application-59c73da0ca1f2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css.br create mode 100644 public/assets/blazer/application-59c73da0ca1f2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css.gz create mode 100644 public/assets/blazer/application-f14294068656a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js create mode 100644 public/assets/blazer/application-f14294068656a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js.br create mode 100644 public/assets/blazer/application-f14294068656a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js.gz create mode 100644 public/assets/blazer/favicon-ccead91b8853543a3542af03c7dde9963359b1c0b9b725220a7f193e1324ecd8.png create mode 100644 public/assets/blazer/favicon-ccead91b8853543a3542af03c7dde9963359b1c0b9b725220a7f193e1324ecd8.png.br create mode 100644 public/assets/blazer/glyphicons-halflings-regular-0703369a358a012c0011843ae337a8a20270c336948a8668df5cb89a8827299b.woff create mode 100644 public/assets/blazer/glyphicons-halflings-regular-0703369a358a012c0011843ae337a8a20270c336948a8668df5cb89a8827299b.woff.br create mode 100644 public/assets/blazer/glyphicons-halflings-regular-0805fb1fe24235f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot create mode 100644 public/assets/blazer/glyphicons-halflings-regular-0805fb1fe24235f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot.br create mode 100644 public/assets/blazer/glyphicons-halflings-regular-0805fb1fe24235f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot.gz create mode 100644 public/assets/blazer/glyphicons-halflings-regular-22d0c88a49d7d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg create mode 100644 public/assets/blazer/glyphicons-halflings-regular-22d0c88a49d7d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg.br create mode 100644 public/assets/blazer/glyphicons-halflings-regular-22d0c88a49d7d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg.gz create mode 100644 public/assets/blazer/glyphicons-halflings-regular-403acfcf0cbaebd1c28b404eec442cea53642644b3a73f91c5a4ab46859af772.woff2 create mode 100644 public/assets/blazer/glyphicons-halflings-regular-403acfcf0cbaebd1c28b404eec442cea53642644b3a73f91c5a4ab46859af772.woff2.br create mode 100644 public/assets/blazer/glyphicons-halflings-regular-7c9caa5f4e16169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf create mode 100644 public/assets/blazer/glyphicons-halflings-regular-7c9caa5f4e16169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf.br create mode 100644 public/assets/blazer/glyphicons-halflings-regular-7c9caa5f4e16169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf.gz create mode 100644 public/assets/editor-6ceecb9d2dc47b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css create mode 100644 public/assets/editor-6ceecb9d2dc47b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css.br create mode 100644 public/assets/editor-6ceecb9d2dc47b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css.gz create mode 100644 public/assets/fonts-86ce817a6287b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css create mode 100644 public/assets/fonts-86ce817a6287b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css.br create mode 100644 public/assets/fonts-86ce817a6287b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css.gz create mode 100644 public/assets/icon_external_link-1af8262ac9c00df26e81bc5a33bcf64350729f954b85f82d5e759fffec4e183a.png create mode 100644 public/assets/icon_external_link-1af8262ac9c00df26e81bc5a33bcf64350729f954b85f82d5e759fffec4e183a.png.br create mode 100644 public/assets/layers-0e356f4d554162eb71f127f50460dbc55d405027189ebe90b20729ef18d13d36.png create mode 100644 public/assets/layers-0e356f4d554162eb71f127f50460dbc55d405027189ebe90b20729ef18d13d36.png.br create mode 100644 public/assets/layers-2x-ba8fa601e413b14db27db07285ade3951721e02244c31523284ab2d1ed53c3dc.png create mode 100644 public/assets/layers-2x-ba8fa601e413b14db27db07285ade3951721e02244c31523284ab2d1ed53c3dc.png.br create mode 100644 public/assets/logo-e11ab53230eae9497ea201f3ad57549af343ddc1d24ddc78b055627cf14e9d5d.png create mode 100644 public/assets/logo-e11ab53230eae9497ea201f3ad57549af343ddc1d24ddc78b055627cf14e9d5d.png.br create mode 100644 public/assets/manifest-dad05bf766af0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js create mode 100644 public/assets/manifest-dad05bf766af0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js.br create mode 100644 public/assets/manifest-dad05bf766af0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js.gz create mode 100644 public/assets/marker-icon-2x-091245b393c16cdcefe54920aa7d3994a0683317ca9a58d35cbc5ec65996398c.png create mode 100644 public/assets/marker-icon-2x-091245b393c16cdcefe54920aa7d3994a0683317ca9a58d35cbc5ec65996398c.png.br create mode 100644 public/assets/marker-icon-3d253116ec4ba0e1f22a01cdf1ff7f120fa4d89a6cd0933d68f12951d19809b4.png create mode 100644 public/assets/marker-icon-3d253116ec4ba0e1f22a01cdf1ff7f120fa4d89a6cd0933d68f12951d19809b4.png.br create mode 100644 public/assets/marker-shadow-a2d94406ba198f61f68a71ed8f9f9c701122c0c33b775d990edceae4aece567f.png create mode 100644 public/assets/marker-shadow-a2d94406ba198f61f68a71ed8f9f9c701122c0c33b775d990edceae4aece567f.png.br create mode 100644 public/assets/saira/v3/SairaBold-subset-0c1968b6a54ea5684d70cc5b51fb1ae3186386fe9363bf3edaf01663ac641341.woff2 create mode 100644 public/assets/saira/v3/SairaBold-subset-0c1968b6a54ea5684d70cc5b51fb1ae3186386fe9363bf3edaf01663ac641341.woff2.br create mode 100644 public/assets/saira/v3/SairaBold-subset.zopfli-2d3f8769110de8d5709d5162dbf0dcb9ab8df71e55f63cfd986bdb68ee2ade0b.woff create mode 100644 public/assets/saira/v3/SairaBold-subset.zopfli-2d3f8769110de8d5709d5162dbf0dcb9ab8df71e55f63cfd986bdb68ee2ade0b.woff.br create mode 100644 public/assets/saira/v3/SairaMedium-subset-6d53d976d73b86358489cb76fc34ec0683d57a1b2635c43acbae45be3349d976.woff2 create mode 100644 public/assets/saira/v3/SairaMedium-subset-6d53d976d73b86358489cb76fc34ec0683d57a1b2635c43acbae45be3349d976.woff2.br create mode 100644 public/assets/saira/v3/SairaMedium-subset.zopfli-47d24dd6cc6451cd2fb3803333f4de3e11033437aa0c8d3d06edcb19e4e38ecb.woff create mode 100644 public/assets/saira/v3/SairaMedium-subset.zopfli-47d24dd6cc6451cd2fb3803333f4de3e11033437aa0c8d3d06edcb19e4e38ecb.woff.br create mode 100644 public/assets/sutty-08b30df17da83a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg create mode 100644 public/assets/sutty-08b30df17da83a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg.br create mode 100644 public/assets/sutty-08b30df17da83a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg.gz create mode 100644 public/assets/sutty_cuadrada-547911cb970c82f2bf8fa2d68b3b32e5e2a1c0ed787dafa6ea1b98b52b96328f.png create mode 100644 public/assets/sutty_cuadrada-547911cb970c82f2bf8fa2d68b3b32e5e2a1c0ed787dafa6ea1b98b52b96328f.png.br create mode 100644 public/packs/css/application-7d15ae94.css create mode 100644 public/packs/css/application-7d15ae94.css.br create mode 100644 public/packs/css/application-7d15ae94.css.br.br create mode 100644 public/packs/css/application-7d15ae94.css.gz create mode 100644 public/packs/js/application-fd20cd4c95f90c1a3ecd.js create mode 100644 public/packs/js/application-fd20cd4c95f90c1a3ecd.js.LICENSE.txt create mode 100644 public/packs/js/application-fd20cd4c95f90c1a3ecd.js.LICENSE.txt.br create mode 100644 public/packs/js/application-fd20cd4c95f90c1a3ecd.js.br create mode 100644 public/packs/js/application-fd20cd4c95f90c1a3ecd.js.br.br create mode 100644 public/packs/js/application-fd20cd4c95f90c1a3ecd.js.gz create mode 100644 public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map create mode 100644 public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.br create mode 100644 public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.br.br create mode 100644 public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.gz create mode 100644 public/packs/manifest.json create mode 100644 public/packs/manifest.json.br create mode 100644 public/packs/manifest.json.br.br create mode 100644 public/packs/manifest.json.gz create mode 100644 public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff create mode 100644 public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff.br create mode 100644 public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2 create mode 100644 public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2.br create mode 100644 public/packs/media/fonts/forkawesome-webfont-86541105.svg create mode 100644 public/packs/media/fonts/forkawesome-webfont-86541105.svg.br create mode 100644 public/packs/media/fonts/forkawesome-webfont-86541105.svg.br.br create mode 100644 public/packs/media/fonts/forkawesome-webfont-86541105.svg.gz create mode 100644 public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot create mode 100644 public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br create mode 100644 public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br.br create mode 100644 public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.gz create mode 100644 public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf create mode 100644 public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br create mode 100644 public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br.br create mode 100644 public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.gz create mode 100644 public/packs/media/images/layers-2x-8f2c4d11.png create mode 100644 public/packs/media/images/layers-2x-8f2c4d11.png.br create mode 100644 public/packs/media/images/layers-416d9136.png create mode 100644 public/packs/media/images/layers-416d9136.png.br create mode 100644 public/packs/media/images/marker-icon-2b3e1faf.png create mode 100644 public/packs/media/images/marker-icon-2b3e1faf.png.br create mode 100644 public/packs/media/images/marker-icon-2x-680f69f3.png create mode 100644 public/packs/media/images/marker-icon-2x-680f69f3.png.br create mode 100644 public/packs/media/images/marker-shadow-a0c6cc14.png create mode 100644 public/packs/media/images/marker-shadow-a0c6cc14.png.br diff --git a/public/assets/.sprockets-manifest-c6294bb290dcb7473076f4de99ce9c00.json b/public/assets/.sprockets-manifest-c6294bb290dcb7473076f4de99ce9c00.json new file mode 100644 index 00000000..862103e6 --- /dev/null +++ b/public/assets/.sprockets-manifest-c6294bb290dcb7473076f4de99ce9c00.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:abb17ebe7d32c8d1bc90cc26c95cd99188a8ea066d8c975834b8299b7297f157 +size 11872 diff --git a/public/assets/.sprockets-manifest-c6294bb290dcb7473076f4de99ce9c00.json.br b/public/assets/.sprockets-manifest-c6294bb290dcb7473076f4de99ce9c00.json.br new file mode 100644 index 00000000..98bb90ad --- /dev/null +++ b/public/assets/.sprockets-manifest-c6294bb290dcb7473076f4de99ce9c00.json.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e0106b0b4c59585bab8c4f20fcf9026a22ffcd845ce281a3ff6879b905edfe8 +size 4003 diff --git a/public/assets/activestorage-9f749d32771691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js b/public/assets/activestorage-9f749d32771691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js new file mode 100644 index 00000000..cbde635a --- /dev/null +++ b/public/assets/activestorage-9f749d32771691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1aa76e929b6ee4e3bab1734223a46c0d22a1cf2425d2e028c3075528436171dc +size 33422 diff --git a/public/assets/activestorage-9f749d32771691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js.br b/public/assets/activestorage-9f749d32771691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js.br new file mode 100644 index 00000000..89860cb3 --- /dev/null +++ b/public/assets/activestorage-9f749d32771691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2a65b9d05b5f692ad4199c5aa612e13b165e68b4a1330ee7c60a414fd5a8cbf +size 6541 diff --git a/public/assets/activestorage-9f749d32771691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js.gz b/public/assets/activestorage-9f749d32771691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js.gz new file mode 100644 index 00000000..00389f1a --- /dev/null +++ b/public/assets/activestorage-9f749d32771691cb3104d21c1c9926e52c04c48d8730498df4aaa39b0adfb7ba.js.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6dcef6c2e458d817696a109d51b14564902cf9c50606b7f8adf522ea6d03bec +size 6899 diff --git a/public/assets/application-dc5234b33b6c06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css b/public/assets/application-dc5234b33b6c06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css new file mode 100644 index 00000000..f3f0e72f --- /dev/null +++ b/public/assets/application-dc5234b33b6c06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45b58cea6de408b3b9e666b149e9cb5aae3f3669d6bd3587def372af51e9ec9c +size 531463 diff --git a/public/assets/application-dc5234b33b6c06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css.br b/public/assets/application-dc5234b33b6c06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css.br new file mode 100644 index 00000000..cfb849ef --- /dev/null +++ b/public/assets/application-dc5234b33b6c06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:587c4692885409e7bf9eec2ae7a47eb1954b86f14d4e25a42403663d4d59b268 +size 35024 diff --git a/public/assets/application-dc5234b33b6c06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css.gz b/public/assets/application-dc5234b33b6c06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css.gz new file mode 100644 index 00000000..6d8cbce0 --- /dev/null +++ b/public/assets/application-dc5234b33b6c06db79ab79114f5b85952f35482ce5b97061ce9402b2a8a4cd19.css.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2997bf3c615d602a40238b3ab474034918f4837d88c7f55fec818fda8ea31f17 +size 42896 diff --git a/public/assets/arrows-alt-v-89a34626be855d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg b/public/assets/arrows-alt-v-89a34626be855d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg new file mode 100644 index 00000000..2a7f2458 --- /dev/null +++ b/public/assets/arrows-alt-v-89a34626be855d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92f2db633d3e9611dc07743d7267204c40de2f8d75b9fa7e0646b195541f2d53 +size 571 diff --git a/public/assets/arrows-alt-v-89a34626be855d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg.br b/public/assets/arrows-alt-v-89a34626be855d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg.br new file mode 100644 index 00000000..fe5ef2ad --- /dev/null +++ b/public/assets/arrows-alt-v-89a34626be855d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66f6cc7289f2ab65e5c05f470dc61b62d3b67dfc6b02111f7ac608da9f371273 +size 323 diff --git a/public/assets/arrows-alt-v-89a34626be855d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg.gz b/public/assets/arrows-alt-v-89a34626be855d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg.gz new file mode 100644 index 00000000..f5afff36 --- /dev/null +++ b/public/assets/arrows-alt-v-89a34626be855d3b1c3199cd75f62cf6327678eed1e126f74b7cbc6de3502606.svg.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f690800fb0f0e2ce7b86b2564f2b4521030854c3eb13ccad730911181b906a1e +size 359 diff --git a/public/assets/blazer/application-59c73da0ca1f2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css b/public/assets/blazer/application-59c73da0ca1f2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css new file mode 100644 index 00000000..d065b1d6 --- /dev/null +++ b/public/assets/blazer/application-59c73da0ca1f2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbc16a398c527ae16bd978e4c16f5803989f3025be59e35332a0547a57eae668 +size 161257 diff --git a/public/assets/blazer/application-59c73da0ca1f2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css.br b/public/assets/blazer/application-59c73da0ca1f2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css.br new file mode 100644 index 00000000..1c55ad41 --- /dev/null +++ b/public/assets/blazer/application-59c73da0ca1f2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:669ad50ad737f1d4f996854f4da308c78dee7766e6bbfde1df609fd72502f56b +size 22772 diff --git a/public/assets/blazer/application-59c73da0ca1f2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css.gz b/public/assets/blazer/application-59c73da0ca1f2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css.gz new file mode 100644 index 00000000..bb2ecb25 --- /dev/null +++ b/public/assets/blazer/application-59c73da0ca1f2fd8dd42765f0a172ae513546920ad9fa0718c15d9b10a4f18dd.css.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab6c28f79b9b9a72deb9c4d8247f2f481e0e7c769f063d63a195d31c1fc40c37 +size 25170 diff --git a/public/assets/blazer/application-f14294068656a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js b/public/assets/blazer/application-f14294068656a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js new file mode 100644 index 00000000..14b3990b --- /dev/null +++ b/public/assets/blazer/application-f14294068656a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32ff6af566ab140819899b0fea350b80fdf527efbe30aadb14cac437e2bc01fb +size 9 diff --git a/public/assets/blazer/application-f14294068656a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js.br b/public/assets/blazer/application-f14294068656a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js.br new file mode 100644 index 00000000..9e09ad94 --- /dev/null +++ b/public/assets/blazer/application-f14294068656a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b3fb497058b6fbc2560ef56b4e38cd96fa5537289c45fbbfe090f23c8b1161e +size 14 diff --git a/public/assets/blazer/application-f14294068656a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js.gz b/public/assets/blazer/application-f14294068656a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js.gz new file mode 100644 index 00000000..0a26fc68 --- /dev/null +++ b/public/assets/blazer/application-f14294068656a14630709493ca1bdd375b16209db5d3307d61c4927dd3eff3c5.js.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d8cd6192edf216bb14ad01dcf0d7a164e3c8e759376d51528907fe0bcde2b781 +size 29 diff --git a/public/assets/blazer/favicon-ccead91b8853543a3542af03c7dde9963359b1c0b9b725220a7f193e1324ecd8.png b/public/assets/blazer/favicon-ccead91b8853543a3542af03c7dde9963359b1c0b9b725220a7f193e1324ecd8.png new file mode 100644 index 00000000..f275a453 --- /dev/null +++ b/public/assets/blazer/favicon-ccead91b8853543a3542af03c7dde9963359b1c0b9b725220a7f193e1324ecd8.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:392743107d0d14fea5699cff1e80d209db7058ef660e643ff9c9f07e990ac084 +size 320 diff --git a/public/assets/blazer/favicon-ccead91b8853543a3542af03c7dde9963359b1c0b9b725220a7f193e1324ecd8.png.br b/public/assets/blazer/favicon-ccead91b8853543a3542af03c7dde9963359b1c0b9b725220a7f193e1324ecd8.png.br new file mode 100644 index 00000000..4290fce9 --- /dev/null +++ b/public/assets/blazer/favicon-ccead91b8853543a3542af03c7dde9963359b1c0b9b725220a7f193e1324ecd8.png.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42f1101a87e305093c8326571f6eba5e2f647183f15922b68b511f13e172908d +size 248 diff --git a/public/assets/blazer/glyphicons-halflings-regular-0703369a358a012c0011843ae337a8a20270c336948a8668df5cb89a8827299b.woff b/public/assets/blazer/glyphicons-halflings-regular-0703369a358a012c0011843ae337a8a20270c336948a8668df5cb89a8827299b.woff new file mode 100644 index 00000000..334f2da2 --- /dev/null +++ b/public/assets/blazer/glyphicons-halflings-regular-0703369a358a012c0011843ae337a8a20270c336948a8668df5cb89a8827299b.woff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a26394f7ede100ca118eff2eda08596275a9839b959c226e15439557a5a80742 +size 23424 diff --git a/public/assets/blazer/glyphicons-halflings-regular-0703369a358a012c0011843ae337a8a20270c336948a8668df5cb89a8827299b.woff.br b/public/assets/blazer/glyphicons-halflings-regular-0703369a358a012c0011843ae337a8a20270c336948a8668df5cb89a8827299b.woff.br new file mode 100644 index 00000000..5acfec3d --- /dev/null +++ b/public/assets/blazer/glyphicons-halflings-regular-0703369a358a012c0011843ae337a8a20270c336948a8668df5cb89a8827299b.woff.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ee84e264080ea5f4f7f23ae9c8aa8f138621b4a4dbbb86f3c839da28b0e5a56 +size 23116 diff --git a/public/assets/blazer/glyphicons-halflings-regular-0805fb1fe24235f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot b/public/assets/blazer/glyphicons-halflings-regular-0805fb1fe24235f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot new file mode 100644 index 00000000..42ea705f --- /dev/null +++ b/public/assets/blazer/glyphicons-halflings-regular-0805fb1fe24235f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13634da87d9e23f8c3ed9108ce1724d183a39ad072e73e1b3d8cbf646d2d0407 +size 20127 diff --git a/public/assets/blazer/glyphicons-halflings-regular-0805fb1fe24235f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot.br b/public/assets/blazer/glyphicons-halflings-regular-0805fb1fe24235f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot.br new file mode 100644 index 00000000..558ceb52 --- /dev/null +++ b/public/assets/blazer/glyphicons-halflings-regular-0805fb1fe24235f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c1a2ea6dc4d0790cede399727cf57dc55dd126e3886e756559cef13f897c6dd0 +size 20012 diff --git a/public/assets/blazer/glyphicons-halflings-regular-0805fb1fe24235f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot.gz b/public/assets/blazer/glyphicons-halflings-regular-0805fb1fe24235f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot.gz new file mode 100644 index 00000000..44d30965 --- /dev/null +++ b/public/assets/blazer/glyphicons-halflings-regular-0805fb1fe24235f70a639f67514990e4bfb6d2cfb00ca563ad4b553c240ddc33.eot.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:232dfba09dd29cfeff9e075a9ba30ed192f678b5946c1a1ec022e9887cc1dc8f +size 20056 diff --git a/public/assets/blazer/glyphicons-halflings-regular-22d0c88a49d7d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg b/public/assets/blazer/glyphicons-halflings-regular-22d0c88a49d7d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg new file mode 100644 index 00000000..781641cc --- /dev/null +++ b/public/assets/blazer/glyphicons-halflings-regular-22d0c88a49d7d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42f60659d265c1a3c30f9fa42abcbb56bd4a53af4d83d316d6dd7a36903c43e5 +size 108738 diff --git a/public/assets/blazer/glyphicons-halflings-regular-22d0c88a49d7d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg.br b/public/assets/blazer/glyphicons-halflings-regular-22d0c88a49d7d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg.br new file mode 100644 index 00000000..63ae3b6c --- /dev/null +++ b/public/assets/blazer/glyphicons-halflings-regular-22d0c88a49d7d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51506970c9012e0474056ff17ff204bf0f1782c547c6fb3dfb584e1572b1b1c5 +size 24800 diff --git a/public/assets/blazer/glyphicons-halflings-regular-22d0c88a49d7d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg.gz b/public/assets/blazer/glyphicons-halflings-regular-22d0c88a49d7d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg.gz new file mode 100644 index 00000000..49a5ccf2 --- /dev/null +++ b/public/assets/blazer/glyphicons-halflings-regular-22d0c88a49d7d0ebe45627143a601061a32a46a9b9afd2dc7f457436f5f15f6e.svg.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2879447637c85f780c62c9decfdc9b6847dfddc0c353ecf056a5563afd5d98c0 +size 26508 diff --git a/public/assets/blazer/glyphicons-halflings-regular-403acfcf0cbaebd1c28b404eec442cea53642644b3a73f91c5a4ab46859af772.woff2 b/public/assets/blazer/glyphicons-halflings-regular-403acfcf0cbaebd1c28b404eec442cea53642644b3a73f91c5a4ab46859af772.woff2 new file mode 100644 index 00000000..3336ba11 --- /dev/null +++ b/public/assets/blazer/glyphicons-halflings-regular-403acfcf0cbaebd1c28b404eec442cea53642644b3a73f91c5a4ab46859af772.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe185d11a49676890d47bb783312a0cda5a44c4039214094e7957b4c040ef11c +size 18028 diff --git a/public/assets/blazer/glyphicons-halflings-regular-403acfcf0cbaebd1c28b404eec442cea53642644b3a73f91c5a4ab46859af772.woff2.br b/public/assets/blazer/glyphicons-halflings-regular-403acfcf0cbaebd1c28b404eec442cea53642644b3a73f91c5a4ab46859af772.woff2.br new file mode 100644 index 00000000..2968e5d2 --- /dev/null +++ b/public/assets/blazer/glyphicons-halflings-regular-403acfcf0cbaebd1c28b404eec442cea53642644b3a73f91c5a4ab46859af772.woff2.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7b1a9608c41733d8a73d73c31348a3ab34df13dd8f69cf5dc6eb918a14f7bd4 +size 18016 diff --git a/public/assets/blazer/glyphicons-halflings-regular-7c9caa5f4e16169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf b/public/assets/blazer/glyphicons-halflings-regular-7c9caa5f4e16169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf new file mode 100644 index 00000000..233386da --- /dev/null +++ b/public/assets/blazer/glyphicons-halflings-regular-7c9caa5f4e16169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456 +size 45404 diff --git a/public/assets/blazer/glyphicons-halflings-regular-7c9caa5f4e16169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf.br b/public/assets/blazer/glyphicons-halflings-regular-7c9caa5f4e16169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf.br new file mode 100644 index 00000000..2f238f1e --- /dev/null +++ b/public/assets/blazer/glyphicons-halflings-regular-7c9caa5f4e16169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83d0181bfdb29d3744dbc122e63263657dcfa359fbd8a4f2cd915b2ee49d3fbe +size 22714 diff --git a/public/assets/blazer/glyphicons-halflings-regular-7c9caa5f4e16169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf.gz b/public/assets/blazer/glyphicons-halflings-regular-7c9caa5f4e16169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf.gz new file mode 100644 index 00000000..e77b3e37 --- /dev/null +++ b/public/assets/blazer/glyphicons-halflings-regular-7c9caa5f4e16169b0129fdf93c84e85ad14d6c107eb1b0ad60b542daf01ee1f0.ttf.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0668c774700aef315f25dcf8376be7aa88eec8b609b47f37c9ba53bbdb997ee +size 23360 diff --git a/public/assets/editor-6ceecb9d2dc47b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css b/public/assets/editor-6ceecb9d2dc47b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css new file mode 100644 index 00000000..377ab667 --- /dev/null +++ b/public/assets/editor-6ceecb9d2dc47b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0b95902009200f525c963c605b9ffa600ea673860dae9f43f33bc557257182b +size 3562 diff --git a/public/assets/editor-6ceecb9d2dc47b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css.br b/public/assets/editor-6ceecb9d2dc47b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css.br new file mode 100644 index 00000000..df162533 --- /dev/null +++ b/public/assets/editor-6ceecb9d2dc47b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9700c118f5e2df28e708aa79143d9135e0b7e67874ab3c976cd604d8a3beff9e +size 738 diff --git a/public/assets/editor-6ceecb9d2dc47b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css.gz b/public/assets/editor-6ceecb9d2dc47b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css.gz new file mode 100644 index 00000000..2b210f57 --- /dev/null +++ b/public/assets/editor-6ceecb9d2dc47b39b99575e60bc2c9eec573a495812d521ec5b82dedd4f55807.css.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0122fcc56f8dc98299e779bd5b3b2960c6d3e3535b0da3265765ca136268a8f +size 846 diff --git a/public/assets/fonts-86ce817a6287b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css b/public/assets/fonts-86ce817a6287b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css new file mode 100644 index 00000000..92436ec6 --- /dev/null +++ b/public/assets/fonts-86ce817a6287b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:053af9006ae009bec81ce6b0403cff779891708d6b446684fb7870ac5bacb462 +size 839 diff --git a/public/assets/fonts-86ce817a6287b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css.br b/public/assets/fonts-86ce817a6287b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css.br new file mode 100644 index 00000000..430e9dd8 --- /dev/null +++ b/public/assets/fonts-86ce817a6287b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5fb27aaf2a70e5353771f5b1a3deb39506c97438f74930dbde35137a3370735c +size 340 diff --git a/public/assets/fonts-86ce817a6287b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css.gz b/public/assets/fonts-86ce817a6287b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css.gz new file mode 100644 index 00000000..2e6771be --- /dev/null +++ b/public/assets/fonts-86ce817a6287b9ff301be232f102b66152dd83f264e13a531098d8dc8b1398da.css.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e005f190d04b1bccc984df0b54ea772eb13fd97c813075f4b2e9c39fab2cc35 +size 390 diff --git a/public/assets/icon_external_link-1af8262ac9c00df26e81bc5a33bcf64350729f954b85f82d5e759fffec4e183a.png b/public/assets/icon_external_link-1af8262ac9c00df26e81bc5a33bcf64350729f954b85f82d5e759fffec4e183a.png new file mode 100644 index 00000000..e882b8bc --- /dev/null +++ b/public/assets/icon_external_link-1af8262ac9c00df26e81bc5a33bcf64350729f954b85f82d5e759fffec4e183a.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a0acd631fd5704e940b9f486d3234aa9ab871881733f48d6edd3cb1f1a09ffc +size 144 diff --git a/public/assets/icon_external_link-1af8262ac9c00df26e81bc5a33bcf64350729f954b85f82d5e759fffec4e183a.png.br b/public/assets/icon_external_link-1af8262ac9c00df26e81bc5a33bcf64350729f954b85f82d5e759fffec4e183a.png.br new file mode 100644 index 00000000..ca08d316 --- /dev/null +++ b/public/assets/icon_external_link-1af8262ac9c00df26e81bc5a33bcf64350729f954b85f82d5e759fffec4e183a.png.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c50779d6d93ea71b10be4972af879e611353812b40f566d864f189218129cf9 +size 149 diff --git a/public/assets/layers-0e356f4d554162eb71f127f50460dbc55d405027189ebe90b20729ef18d13d36.png b/public/assets/layers-0e356f4d554162eb71f127f50460dbc55d405027189ebe90b20729ef18d13d36.png new file mode 100644 index 00000000..7b44754c --- /dev/null +++ b/public/assets/layers-0e356f4d554162eb71f127f50460dbc55d405027189ebe90b20729ef18d13d36.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1dbbe9d028e292f36fcba8f8b3a28d5e8932754fc2215b9ac69e4cdecf5107c6 +size 696 diff --git a/public/assets/layers-0e356f4d554162eb71f127f50460dbc55d405027189ebe90b20729ef18d13d36.png.br b/public/assets/layers-0e356f4d554162eb71f127f50460dbc55d405027189ebe90b20729ef18d13d36.png.br new file mode 100644 index 00000000..21812b3e --- /dev/null +++ b/public/assets/layers-0e356f4d554162eb71f127f50460dbc55d405027189ebe90b20729ef18d13d36.png.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e255d97d12f227f9d2fabd481fa56d89bf33b47a4d108b031e7b96ddc0fb0066 +size 701 diff --git a/public/assets/layers-2x-ba8fa601e413b14db27db07285ade3951721e02244c31523284ab2d1ed53c3dc.png b/public/assets/layers-2x-ba8fa601e413b14db27db07285ade3951721e02244c31523284ab2d1ed53c3dc.png new file mode 100644 index 00000000..d3cf7e52 --- /dev/null +++ b/public/assets/layers-2x-ba8fa601e413b14db27db07285ade3951721e02244c31523284ab2d1ed53c3dc.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:066daca850d8ffbef007af00b06eac0015728dee279c51f3cb6c716df7c42edf +size 1259 diff --git a/public/assets/layers-2x-ba8fa601e413b14db27db07285ade3951721e02244c31523284ab2d1ed53c3dc.png.br b/public/assets/layers-2x-ba8fa601e413b14db27db07285ade3951721e02244c31523284ab2d1ed53c3dc.png.br new file mode 100644 index 00000000..cda7f53d --- /dev/null +++ b/public/assets/layers-2x-ba8fa601e413b14db27db07285ade3951721e02244c31523284ab2d1ed53c3dc.png.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47119b2b0eb7d15fa47527efc1fa04713d80990ed6a7f2e2f58f91a8cddd1b03 +size 1264 diff --git a/public/assets/logo-e11ab53230eae9497ea201f3ad57549af343ddc1d24ddc78b055627cf14e9d5d.png b/public/assets/logo-e11ab53230eae9497ea201f3ad57549af343ddc1d24ddc78b055627cf14e9d5d.png new file mode 100644 index 00000000..be79dc74 --- /dev/null +++ b/public/assets/logo-e11ab53230eae9497ea201f3ad57549af343ddc1d24ddc78b055627cf14e9d5d.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:abab4950f459ebf3f475d376d6fd468e735cab2d86c712222fa586569a273a09 +size 2001 diff --git a/public/assets/logo-e11ab53230eae9497ea201f3ad57549af343ddc1d24ddc78b055627cf14e9d5d.png.br b/public/assets/logo-e11ab53230eae9497ea201f3ad57549af343ddc1d24ddc78b055627cf14e9d5d.png.br new file mode 100644 index 00000000..5fce7f8e --- /dev/null +++ b/public/assets/logo-e11ab53230eae9497ea201f3ad57549af343ddc1d24ddc78b055627cf14e9d5d.png.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:348d75dc528dbaff2a18adb6f4a4b66d4610e6dca2f99889b52e7f0c629a8be7 +size 2006 diff --git a/public/assets/manifest-dad05bf766af0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js b/public/assets/manifest-dad05bf766af0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js new file mode 100644 index 00000000..7a77a071 --- /dev/null +++ b/public/assets/manifest-dad05bf766af0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a3cf5192354f71615ac51034b3e97c20eda99643fcaf5bbe6d41ad59bd12167 +size 3 diff --git a/public/assets/manifest-dad05bf766af0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js.br b/public/assets/manifest-dad05bf766af0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js.br new file mode 100644 index 00000000..40a6d1ac --- /dev/null +++ b/public/assets/manifest-dad05bf766af0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad41782cd73052ce3e59ea9b261ffeeeebfbacaa90924c01c7c47f012674bb15 +size 8 diff --git a/public/assets/manifest-dad05bf766af0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js.gz b/public/assets/manifest-dad05bf766af0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js.gz new file mode 100644 index 00000000..884f1518 --- /dev/null +++ b/public/assets/manifest-dad05bf766af0fe3d79dd746db3c1361c0583026cdf35d6a2921bccaea835331.js.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19a332fca5af4a8c3ee68386360b5212428611709c8463c00631d65141b8f5bb +size 23 diff --git a/public/assets/marker-icon-2x-091245b393c16cdcefe54920aa7d3994a0683317ca9a58d35cbc5ec65996398c.png b/public/assets/marker-icon-2x-091245b393c16cdcefe54920aa7d3994a0683317ca9a58d35cbc5ec65996398c.png new file mode 100644 index 00000000..09e8445f --- /dev/null +++ b/public/assets/marker-icon-2x-091245b393c16cdcefe54920aa7d3994a0683317ca9a58d35cbc5ec65996398c.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00179c4c1ee830d3a108412ae0d294f55776cfeb085c60129a39aa6fc4ae2528 +size 2464 diff --git a/public/assets/marker-icon-2x-091245b393c16cdcefe54920aa7d3994a0683317ca9a58d35cbc5ec65996398c.png.br b/public/assets/marker-icon-2x-091245b393c16cdcefe54920aa7d3994a0683317ca9a58d35cbc5ec65996398c.png.br new file mode 100644 index 00000000..585d2e48 --- /dev/null +++ b/public/assets/marker-icon-2x-091245b393c16cdcefe54920aa7d3994a0683317ca9a58d35cbc5ec65996398c.png.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c4f6ce09c4c3a59cfac5c03a03de02b170d35cfefd7e1247a317dc772c889395 +size 2469 diff --git a/public/assets/marker-icon-3d253116ec4ba0e1f22a01cdf1ff7f120fa4d89a6cd0933d68f12951d19809b4.png b/public/assets/marker-icon-3d253116ec4ba0e1f22a01cdf1ff7f120fa4d89a6cd0933d68f12951d19809b4.png new file mode 100644 index 00000000..b1789c76 --- /dev/null +++ b/public/assets/marker-icon-3d253116ec4ba0e1f22a01cdf1ff7f120fa4d89a6cd0933d68f12951d19809b4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:574c3a5cca85f4114085b6841596d62f00d7c892c7b03f28cbfa301deb1dc437 +size 1466 diff --git a/public/assets/marker-icon-3d253116ec4ba0e1f22a01cdf1ff7f120fa4d89a6cd0933d68f12951d19809b4.png.br b/public/assets/marker-icon-3d253116ec4ba0e1f22a01cdf1ff7f120fa4d89a6cd0933d68f12951d19809b4.png.br new file mode 100644 index 00000000..62bba2a0 --- /dev/null +++ b/public/assets/marker-icon-3d253116ec4ba0e1f22a01cdf1ff7f120fa4d89a6cd0933d68f12951d19809b4.png.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d73a1e81d4d7b880342c1fa48caeb6cdb56cc941ad18000d932dfaec8ba1086 +size 1471 diff --git a/public/assets/marker-shadow-a2d94406ba198f61f68a71ed8f9f9c701122c0c33b775d990edceae4aece567f.png b/public/assets/marker-shadow-a2d94406ba198f61f68a71ed8f9f9c701122c0c33b775d990edceae4aece567f.png new file mode 100644 index 00000000..dc111216 --- /dev/null +++ b/public/assets/marker-shadow-a2d94406ba198f61f68a71ed8f9f9c701122c0c33b775d990edceae4aece567f.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:264f5c640339f042dd729062cfc04c17f8ea0f29882b538e3848ed8f10edb4da +size 618 diff --git a/public/assets/marker-shadow-a2d94406ba198f61f68a71ed8f9f9c701122c0c33b775d990edceae4aece567f.png.br b/public/assets/marker-shadow-a2d94406ba198f61f68a71ed8f9f9c701122c0c33b775d990edceae4aece567f.png.br new file mode 100644 index 00000000..940c4d9b --- /dev/null +++ b/public/assets/marker-shadow-a2d94406ba198f61f68a71ed8f9f9c701122c0c33b775d990edceae4aece567f.png.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8758eb0644225f0a3c8e03fb1dbe319f6427b4116a538084f18ba5a6dcd65eb2 +size 623 diff --git a/public/assets/saira/v3/SairaBold-subset-0c1968b6a54ea5684d70cc5b51fb1ae3186386fe9363bf3edaf01663ac641341.woff2 b/public/assets/saira/v3/SairaBold-subset-0c1968b6a54ea5684d70cc5b51fb1ae3186386fe9363bf3edaf01663ac641341.woff2 new file mode 100644 index 00000000..580c899c --- /dev/null +++ b/public/assets/saira/v3/SairaBold-subset-0c1968b6a54ea5684d70cc5b51fb1ae3186386fe9363bf3edaf01663ac641341.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ad13d7b01c301feecfb7f760791100710930be2d232fcdf97fb09a1301e4c3e +size 16264 diff --git a/public/assets/saira/v3/SairaBold-subset-0c1968b6a54ea5684d70cc5b51fb1ae3186386fe9363bf3edaf01663ac641341.woff2.br b/public/assets/saira/v3/SairaBold-subset-0c1968b6a54ea5684d70cc5b51fb1ae3186386fe9363bf3edaf01663ac641341.woff2.br new file mode 100644 index 00000000..ab0b6472 --- /dev/null +++ b/public/assets/saira/v3/SairaBold-subset-0c1968b6a54ea5684d70cc5b51fb1ae3186386fe9363bf3edaf01663ac641341.woff2.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a45bda0673da257af77f89c6d9151c908dd15dae3eeb536911be81383e58e42 +size 16260 diff --git a/public/assets/saira/v3/SairaBold-subset.zopfli-2d3f8769110de8d5709d5162dbf0dcb9ab8df71e55f63cfd986bdb68ee2ade0b.woff b/public/assets/saira/v3/SairaBold-subset.zopfli-2d3f8769110de8d5709d5162dbf0dcb9ab8df71e55f63cfd986bdb68ee2ade0b.woff new file mode 100644 index 00000000..94528fe4 --- /dev/null +++ b/public/assets/saira/v3/SairaBold-subset.zopfli-2d3f8769110de8d5709d5162dbf0dcb9ab8df71e55f63cfd986bdb68ee2ade0b.woff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd722d9eb3a725f4188615c514c5c0e6b1b82de55a00dca194efa84704257dd2 +size 20120 diff --git a/public/assets/saira/v3/SairaBold-subset.zopfli-2d3f8769110de8d5709d5162dbf0dcb9ab8df71e55f63cfd986bdb68ee2ade0b.woff.br b/public/assets/saira/v3/SairaBold-subset.zopfli-2d3f8769110de8d5709d5162dbf0dcb9ab8df71e55f63cfd986bdb68ee2ade0b.woff.br new file mode 100644 index 00000000..38204fe0 --- /dev/null +++ b/public/assets/saira/v3/SairaBold-subset.zopfli-2d3f8769110de8d5709d5162dbf0dcb9ab8df71e55f63cfd986bdb68ee2ade0b.woff.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d58d08fffad848dc745108c011fe0b71bdfa14d11d17d68d514205970726bd5 +size 20055 diff --git a/public/assets/saira/v3/SairaMedium-subset-6d53d976d73b86358489cb76fc34ec0683d57a1b2635c43acbae45be3349d976.woff2 b/public/assets/saira/v3/SairaMedium-subset-6d53d976d73b86358489cb76fc34ec0683d57a1b2635c43acbae45be3349d976.woff2 new file mode 100644 index 00000000..7127bebe --- /dev/null +++ b/public/assets/saira/v3/SairaMedium-subset-6d53d976d73b86358489cb76fc34ec0683d57a1b2635c43acbae45be3349d976.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ac4573ca9ed8e08a742d203171057acc3d8f5f49825d9351bd2a22c2d58e669 +size 16388 diff --git a/public/assets/saira/v3/SairaMedium-subset-6d53d976d73b86358489cb76fc34ec0683d57a1b2635c43acbae45be3349d976.woff2.br b/public/assets/saira/v3/SairaMedium-subset-6d53d976d73b86358489cb76fc34ec0683d57a1b2635c43acbae45be3349d976.woff2.br new file mode 100644 index 00000000..2d4a45ab --- /dev/null +++ b/public/assets/saira/v3/SairaMedium-subset-6d53d976d73b86358489cb76fc34ec0683d57a1b2635c43acbae45be3349d976.woff2.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92f6b5c4fd4dabbbedbc96519088b4896dbe07b393d06bbbb868d82a618d352a +size 16391 diff --git a/public/assets/saira/v3/SairaMedium-subset.zopfli-47d24dd6cc6451cd2fb3803333f4de3e11033437aa0c8d3d06edcb19e4e38ecb.woff b/public/assets/saira/v3/SairaMedium-subset.zopfli-47d24dd6cc6451cd2fb3803333f4de3e11033437aa0c8d3d06edcb19e4e38ecb.woff new file mode 100644 index 00000000..bb8a3825 --- /dev/null +++ b/public/assets/saira/v3/SairaMedium-subset.zopfli-47d24dd6cc6451cd2fb3803333f4de3e11033437aa0c8d3d06edcb19e4e38ecb.woff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4dec398a6c292da28349e76f94646d91d425cf4ddc7f91d749075f72209d0dab +size 20232 diff --git a/public/assets/saira/v3/SairaMedium-subset.zopfli-47d24dd6cc6451cd2fb3803333f4de3e11033437aa0c8d3d06edcb19e4e38ecb.woff.br b/public/assets/saira/v3/SairaMedium-subset.zopfli-47d24dd6cc6451cd2fb3803333f4de3e11033437aa0c8d3d06edcb19e4e38ecb.woff.br new file mode 100644 index 00000000..6da047e7 --- /dev/null +++ b/public/assets/saira/v3/SairaMedium-subset.zopfli-47d24dd6cc6451cd2fb3803333f4de3e11033437aa0c8d3d06edcb19e4e38ecb.woff.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2a22be46135bb21d4984271f8dd42e6762a35152fba61f93ce89edd6478df23 +size 20174 diff --git a/public/assets/sutty-08b30df17da83a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg b/public/assets/sutty-08b30df17da83a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg new file mode 100644 index 00000000..68fca50c --- /dev/null +++ b/public/assets/sutty-08b30df17da83a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb86744bcec2d691c94d431627e412113f3648eb02420f2af86de3e3884c5a6d +size 1956 diff --git a/public/assets/sutty-08b30df17da83a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg.br b/public/assets/sutty-08b30df17da83a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg.br new file mode 100644 index 00000000..bbf3b21e --- /dev/null +++ b/public/assets/sutty-08b30df17da83a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb20639b4ce178eedfc586c73f7086bef65ef70533c995afdc2eedb3d1fa76c4 +size 894 diff --git a/public/assets/sutty-08b30df17da83a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg.gz b/public/assets/sutty-08b30df17da83a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg.gz new file mode 100644 index 00000000..dffee65e --- /dev/null +++ b/public/assets/sutty-08b30df17da83a32911e3bb4fa0a2c967148a2f98020a63b6c171c17c94bf05d.svg.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19973f783284df5608ec79a4fa46dce362f5626112c218266f04329b01049c43 +size 943 diff --git a/public/assets/sutty_cuadrada-547911cb970c82f2bf8fa2d68b3b32e5e2a1c0ed787dafa6ea1b98b52b96328f.png b/public/assets/sutty_cuadrada-547911cb970c82f2bf8fa2d68b3b32e5e2a1c0ed787dafa6ea1b98b52b96328f.png new file mode 100644 index 00000000..1b018802 --- /dev/null +++ b/public/assets/sutty_cuadrada-547911cb970c82f2bf8fa2d68b3b32e5e2a1c0ed787dafa6ea1b98b52b96328f.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56aa311c3c5249e54d70f03b33fc681b593cd93e74b7af5d80316c5b7d1c6a76 +size 6868 diff --git a/public/assets/sutty_cuadrada-547911cb970c82f2bf8fa2d68b3b32e5e2a1c0ed787dafa6ea1b98b52b96328f.png.br b/public/assets/sutty_cuadrada-547911cb970c82f2bf8fa2d68b3b32e5e2a1c0ed787dafa6ea1b98b52b96328f.png.br new file mode 100644 index 00000000..727045b0 --- /dev/null +++ b/public/assets/sutty_cuadrada-547911cb970c82f2bf8fa2d68b3b32e5e2a1c0ed787dafa6ea1b98b52b96328f.png.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8af682a97967a339d63b8c22a24ab30065e9423e1775e6c6ccdf662e5081a4f9 +size 6530 diff --git a/public/packs/css/application-7d15ae94.css b/public/packs/css/application-7d15ae94.css new file mode 100644 index 00000000..544ddf74 --- /dev/null +++ b/public/packs/css/application-7d15ae94.css @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0179eec59d4881001e3d26ec0e25d8ca1257c6e4956d76f18cc97c3325a9625 +size 48029 diff --git a/public/packs/css/application-7d15ae94.css.br b/public/packs/css/application-7d15ae94.css.br new file mode 100644 index 00000000..c0e44938 --- /dev/null +++ b/public/packs/css/application-7d15ae94.css.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f9a030d083e92a55a9a9211539c894371f200778de283958a318c87a825cb4f +size 10934 diff --git a/public/packs/css/application-7d15ae94.css.br.br b/public/packs/css/application-7d15ae94.css.br.br new file mode 100644 index 00000000..bd3a0882 --- /dev/null +++ b/public/packs/css/application-7d15ae94.css.br.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c61a1f5c9ca9cfc7b2b314046b258a94f707535a34e0c3e7b621d9b7c2cd648 +size 10939 diff --git a/public/packs/css/application-7d15ae94.css.gz b/public/packs/css/application-7d15ae94.css.gz new file mode 100644 index 00000000..306dc931 --- /dev/null +++ b/public/packs/css/application-7d15ae94.css.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bfeb6b9af353618bdc475d6c921197da2b8a9ae7685a91772658d41883843c12 +size 12022 diff --git a/public/packs/js/application-fd20cd4c95f90c1a3ecd.js b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js new file mode 100644 index 00000000..b6dc46a3 --- /dev/null +++ b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0322257341b6d5bcbee0153eb5007363aefe26870b63744de6f1cdf6d1a7065e +size 1134731 diff --git a/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.LICENSE.txt b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.LICENSE.txt new file mode 100644 index 00000000..89f0cf4f --- /dev/null +++ b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.LICENSE.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a016dd85be9a400040f4440d2ce1a94524f6e885a3d0e1f2422b46c2397df38f +size 629 diff --git a/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.LICENSE.txt.br b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.LICENSE.txt.br new file mode 100644 index 00000000..3b0be40c --- /dev/null +++ b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.LICENSE.txt.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46eca40f00a3261e41a1e02d89697deb163a49a56237e72ae2643cb1c28b99c0 +size 307 diff --git a/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.br b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.br new file mode 100644 index 00000000..6ba2a97b --- /dev/null +++ b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b88ebe0dd46c4b22fea0ecccb721afc5b4a88ce4b55950bce19654c2d265f72e +size 302355 diff --git a/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.br.br b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.br.br new file mode 100644 index 00000000..93ce3091 --- /dev/null +++ b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.br.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ed407a10485f5157d5eb98bc11a158c2565bc417faedaa197bdfcea486ccdcd +size 302363 diff --git a/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.gz b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.gz new file mode 100644 index 00000000..a978f9f3 --- /dev/null +++ b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6ed777e669bf1e81dd7f43ff8d9c2d5d5b4c9d81c68a1fac7b7fdd3d7d578b30 +size 329294 diff --git a/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map new file mode 100644 index 00000000..ab3aa8ef --- /dev/null +++ b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02a1682a2421fd6f340241bbc6b07951aa583f2ef2b74f29fb16cf9aaf3956a0 +size 4658473 diff --git a/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.br b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.br new file mode 100644 index 00000000..ca0133f3 --- /dev/null +++ b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3ef78d7fb35e3c0547740d68249462805e7cf65eafd3b6f77b787e7746c1f14 +size 1099488 diff --git a/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.br.br b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.br.br new file mode 100644 index 00000000..dd2dcd4a --- /dev/null +++ b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.br.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cda688a8dbd865c4720c68f2af7c8e1130cd43a955c737da9f4f38296b2d6d56 +size 1099496 diff --git a/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.gz b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.gz new file mode 100644 index 00000000..38ab8f51 --- /dev/null +++ b/public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f18506f9e0cec6f8a84d2a640646b6bae20eeeea081aba5ba26324028ffae8c2 +size 1222748 diff --git a/public/packs/manifest.json b/public/packs/manifest.json new file mode 100644 index 00000000..f3fcbef3 --- /dev/null +++ b/public/packs/manifest.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:880db5bc10cd865a8cb1a2fc56d69bba8464ef28aa59c31913256c7062528289 +size 1426 diff --git a/public/packs/manifest.json.br b/public/packs/manifest.json.br new file mode 100644 index 00000000..82077c62 --- /dev/null +++ b/public/packs/manifest.json.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8cfa3712c659f01703314a2a9dd306a55d0f52a3456e20d43e080a5d716c8e45 +size 325 diff --git a/public/packs/manifest.json.br.br b/public/packs/manifest.json.br.br new file mode 100644 index 00000000..b8d746ce --- /dev/null +++ b/public/packs/manifest.json.br.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82c427cf2556c027323f463d5d735bc8dd3b2b22ac1d5eed3e7d77b3f1cc9178 +size 330 diff --git a/public/packs/manifest.json.gz b/public/packs/manifest.json.gz new file mode 100644 index 00000000..dd2dc7c2 --- /dev/null +++ b/public/packs/manifest.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9aee952354edb8ae47a200f1059beaf3ab588f0fef6e60dcd983de8808ed3351 +size 365 diff --git a/public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff b/public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff new file mode 100644 index 00000000..8925c5d3 --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53ab31062cf740aa76615d2c98aea80b177845d7ed95de45889b3824b0e1597c +size 115148 diff --git a/public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff.br b/public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff.br new file mode 100644 index 00000000..df2c95b5 --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90b60c42bcbd106f5658710acd84f60307a00f0de10b921eeb5627590b429858 +size 115153 diff --git a/public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2 b/public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2 new file mode 100644 index 00000000..52865bdb --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84422de97eb1cf27bcb9bca4f3fbb18f3ebc711647b09c68292f5f43c89d5064 +size 91624 diff --git a/public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2.br b/public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2.br new file mode 100644 index 00000000..1d640da9 --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a76b02ceece82f286d306ed0988f8c220066ecce509241a425245950e4e4c839 +size 91629 diff --git a/public/packs/media/fonts/forkawesome-webfont-86541105.svg b/public/packs/media/fonts/forkawesome-webfont-86541105.svg new file mode 100644 index 00000000..af45aadc --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-86541105.svg @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..bad26711 --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-86541105.svg.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f7aee80d4013bd5a42f4035b0dc08a2fc903dae87f04182d9a86db53b95c9add +size 143247 diff --git a/public/packs/media/fonts/forkawesome-webfont-86541105.svg.br.br b/public/packs/media/fonts/forkawesome-webfont-86541105.svg.br.br new file mode 100644 index 00000000..344bb103 --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-86541105.svg.br.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e03d221ca2c49b7099c550f8f33462365d285809e5a0b1e000c6c52e6982996a +size 143252 diff --git a/public/packs/media/fonts/forkawesome-webfont-86541105.svg.gz b/public/packs/media/fonts/forkawesome-webfont-86541105.svg.gz new file mode 100644 index 00000000..0676bab5 --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-86541105.svg.gz @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..37e93df5 --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..22d6e19f --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4283befabbc5c3bfec093dd89b65ad0063a3581e45bbfbaf9b40a4d178cd5e1 +size 110762 diff --git a/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br.br b/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br.br new file mode 100644 index 00000000..e6ebb6ac --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2adacd487b97dcd4da3bc37328482c809a0d910353990de13b228dd1aa4710a +size 110767 diff --git a/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.gz b/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.gz new file mode 100644 index 00000000..5bb32cdc --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.gz @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..e6380d0e --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..87ab54e0 --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e01bc03dc20b0d760488b20f4f5a408dddd0554fb8c23d7ace34ab1698c4c807 +size 110703 diff --git a/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br.br b/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br.br new file mode 100644 index 00000000..e633502b --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba3d7e97443577de6e23b5936de2e1a6f35d9e6335b069d8071e6269afc78246 +size 110708 diff --git a/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.gz b/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.gz new file mode 100644 index 00000000..44d9de5a --- /dev/null +++ b/public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.gz @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..d3cf7e52 --- /dev/null +++ b/public/packs/media/images/layers-2x-8f2c4d11.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:066daca850d8ffbef007af00b06eac0015728dee279c51f3cb6c716df7c42edf +size 1259 diff --git a/public/packs/media/images/layers-2x-8f2c4d11.png.br b/public/packs/media/images/layers-2x-8f2c4d11.png.br new file mode 100644 index 00000000..cda7f53d --- /dev/null +++ b/public/packs/media/images/layers-2x-8f2c4d11.png.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47119b2b0eb7d15fa47527efc1fa04713d80990ed6a7f2e2f58f91a8cddd1b03 +size 1264 diff --git a/public/packs/media/images/layers-416d9136.png b/public/packs/media/images/layers-416d9136.png new file mode 100644 index 00000000..7b44754c --- /dev/null +++ b/public/packs/media/images/layers-416d9136.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1dbbe9d028e292f36fcba8f8b3a28d5e8932754fc2215b9ac69e4cdecf5107c6 +size 696 diff --git a/public/packs/media/images/layers-416d9136.png.br b/public/packs/media/images/layers-416d9136.png.br new file mode 100644 index 00000000..21812b3e --- /dev/null +++ b/public/packs/media/images/layers-416d9136.png.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e255d97d12f227f9d2fabd481fa56d89bf33b47a4d108b031e7b96ddc0fb0066 +size 701 diff --git a/public/packs/media/images/marker-icon-2b3e1faf.png b/public/packs/media/images/marker-icon-2b3e1faf.png new file mode 100644 index 00000000..b1789c76 --- /dev/null +++ b/public/packs/media/images/marker-icon-2b3e1faf.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:574c3a5cca85f4114085b6841596d62f00d7c892c7b03f28cbfa301deb1dc437 +size 1466 diff --git a/public/packs/media/images/marker-icon-2b3e1faf.png.br b/public/packs/media/images/marker-icon-2b3e1faf.png.br new file mode 100644 index 00000000..62bba2a0 --- /dev/null +++ b/public/packs/media/images/marker-icon-2b3e1faf.png.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d73a1e81d4d7b880342c1fa48caeb6cdb56cc941ad18000d932dfaec8ba1086 +size 1471 diff --git a/public/packs/media/images/marker-icon-2x-680f69f3.png b/public/packs/media/images/marker-icon-2x-680f69f3.png new file mode 100644 index 00000000..09e8445f --- /dev/null +++ b/public/packs/media/images/marker-icon-2x-680f69f3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00179c4c1ee830d3a108412ae0d294f55776cfeb085c60129a39aa6fc4ae2528 +size 2464 diff --git a/public/packs/media/images/marker-icon-2x-680f69f3.png.br b/public/packs/media/images/marker-icon-2x-680f69f3.png.br new file mode 100644 index 00000000..585d2e48 --- /dev/null +++ b/public/packs/media/images/marker-icon-2x-680f69f3.png.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c4f6ce09c4c3a59cfac5c03a03de02b170d35cfefd7e1247a317dc772c889395 +size 2469 diff --git a/public/packs/media/images/marker-shadow-a0c6cc14.png b/public/packs/media/images/marker-shadow-a0c6cc14.png new file mode 100644 index 00000000..dc111216 --- /dev/null +++ b/public/packs/media/images/marker-shadow-a0c6cc14.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:264f5c640339f042dd729062cfc04c17f8ea0f29882b538e3848ed8f10edb4da +size 618 diff --git a/public/packs/media/images/marker-shadow-a0c6cc14.png.br b/public/packs/media/images/marker-shadow-a0c6cc14.png.br new file mode 100644 index 00000000..940c4d9b --- /dev/null +++ b/public/packs/media/images/marker-shadow-a0c6cc14.png.br @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8758eb0644225f0a3c8e03fb1dbe319f6427b4116a538084f18ba5a6dcd65eb2 +size 623 From c6c638fb60edf3d8f7a6eddbc7dab819b01e1d15 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 29 Aug 2023 17:43:19 -0300 Subject: [PATCH 413/475] feat: almacenar la llave privada --- app/models/site.rb | 1 + app/models/site/social_distributed_press.rb | 12 ++++++++++++ ...204127_add_private_key_pem_ciphertext_to_sites.rb | 9 +++++++++ 3 files changed, 22 insertions(+) create mode 100644 app/models/site/social_distributed_press.rb create mode 100644 db/migrate/20230829204127_add_private_key_pem_ciphertext_to_sites.rb diff --git a/app/models/site.rb b/app/models/site.rb index 24644b9c..9ec21561 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -10,6 +10,7 @@ class Site < ApplicationRecord include Site::DeployDependencies include Site::BuildStats include Site::LayoutOrdering + include Site::SocialDistributedPress include Tienda # Cifrar la llave privada que cifra y decifra campos ocultos. Sutty diff --git a/app/models/site/social_distributed_press.rb b/app/models/site/social_distributed_press.rb new file mode 100644 index 00000000..9d283103 --- /dev/null +++ b/app/models/site/social_distributed_press.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class Site + # Agrega soporte para Social Distributed Press en los sitios + module SocialDistributedPress + extend ActiveSupport::Concern + + included do + encrypts :private_key_pem + end + end +end diff --git a/db/migrate/20230829204127_add_private_key_pem_ciphertext_to_sites.rb b/db/migrate/20230829204127_add_private_key_pem_ciphertext_to_sites.rb new file mode 100644 index 00000000..9f26f21a --- /dev/null +++ b/db/migrate/20230829204127_add_private_key_pem_ciphertext_to_sites.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# Almacena las llaves privadas de cada sitio +class AddPrivateKeyPemCiphertextToSites < ActiveRecord::Migration[6.1] + # Agrega la columna cifrada + def change + add_column :sites, :private_key_pem_ciphertext, :text + end +end From 4de3352950f700bd303d2f5e472f5045a06c1810 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 29 Aug 2023 17:49:25 -0300 Subject: [PATCH 414/475] feat: generar la llave privada #14169 --- app/models/site/social_distributed_press.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/models/site/social_distributed_press.rb b/app/models/site/social_distributed_press.rb index 9d283103..5d469f03 100644 --- a/app/models/site/social_distributed_press.rb +++ b/app/models/site/social_distributed_press.rb @@ -7,6 +7,17 @@ class Site included do encrypts :private_key_pem + + before_save :generate_private_key_pem!, unless: :private_key_pem? + + private + + # Genera la llave privada y la almacena + # + # @return [nil] + def generate_private_key_pem! + self.private_key_pem ||= DistributedPress::V1::Social::Client.new(public_key_url: nil, key_size: 2048).private_key.export + end end end end From 8b0b0199f60ad67b733c781fbc3425d5f6546fba Mon Sep 17 00:00:00 2001 From: f Date: Tue, 29 Aug 2023 18:26:03 -0300 Subject: [PATCH 415/475] feat: correr un comando obteniendo la llave dentro de un archivo temporal --- app/models/deploy.rb | 15 +++++++++++++++ app/models/deploy_local.rb | 6 +++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/models/deploy.rb b/app/models/deploy.rb index a92708c0..77e5b8d8 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -109,6 +109,21 @@ class Deploy < ApplicationRecord private + # Escribe el contenido en un archivo temporal y ejecuta el bloque + # provisto con el archivo como parámetro + # + # @param :content [String] + def with_tempfile(content, &block) + Tempfile.create(SecureRandom.hex) do |file| + file.write content.to_s + file.rewind + file.close + + # @yieldparam :file [File] + yield file + end + end + # @param [String] # @return [String] def readable_cmd(cmd) diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 75ea8b1c..e66bb003 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -141,8 +141,12 @@ class DeployLocal < Deploy run %(bundle install --deployment --no-cache --path="#{gems_dir}" --clean --without test development), output: output end + # TODO: Esto significa que todos los sitios van a tener activity pub + # activado def jekyll_build(output: false) - run %(bundle exec jekyll build --trace --profile --destination "#{escaped_destination}"), output: output + with_tempfile(site.private_key_pem) do |file| + run %(bundle exec jekyll build --trace --profile --key #{file.path} --destination "#{escaped_destination}"), output: output + end end # no debería haber espacios ni caracteres especiales, pero por si From 9ac404ae06286e69e8981c5322c2a9256ff04f99 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 30 Aug 2023 10:47:08 -0300 Subject: [PATCH 416/475] feat: habilitar/deshabilitar activity pub --- .../_deploy_social_distributed_press.haml | 21 +++++++++++++++++++ config/locales/en.yml | 12 +++++++++++ config/locales/es.yml | 12 +++++++++++ 3 files changed, 45 insertions(+) create mode 100644 app/views/deploys/_deploy_social_distributed_press.haml diff --git a/app/views/deploys/_deploy_social_distributed_press.haml b/app/views/deploys/_deploy_social_distributed_press.haml new file mode 100644 index 00000000..5c73b262 --- /dev/null +++ b/app/views/deploys/_deploy_social_distributed_press.haml @@ -0,0 +1,21 @@ +-# Publicar a la web distribuida + +.row + .col + = deploy.hidden_field :id + = deploy.hidden_field :type + .custom-control.custom-switch + -# + El checkbox invierte la lógica de destrucción porque queremos + crear el deploy si está activado y destruirlo si está + desactivado. + = deploy.check_box :_destroy, + { checked: deploy.object.persisted?, class: 'custom-control-input' }, + '0', '1' + = deploy.label :_destroy, class: 'custom-control-label' do + %h3= t('.title') + = sanitize_markdown t('.help'), + tags: %w[p strong em a] + + +%hr/ diff --git a/config/locales/en.yml b/config/locales/en.yml index 5f97a8b9..0dad2e68 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -123,6 +123,10 @@ en: title: Distributed Web success: Success! error: Error + deploy_social_distributed_press: + title: Fediverse + success: Success! + error: Error deploy_reindex: title: Reindex success: Success! @@ -307,6 +311,14 @@ en: indefinitely. [Learn more](https://sutty.nl/learn-more-about-publish-to-dweb-functionality/) + deploy_social_distributed_press: + title: 'Publish on the Fediverse' + help: | + By using the ActivityPub protocol, people on the Fediverse + ([Mastodon](https://joinmastodon.org/servers), + [Pixelfed](https://pixelfed.social/site/about), and + [others](https://fediverse.party/)) can follow your site, + receive news and interact with them. stats: index: title: Statistics diff --git a/config/locales/es.yml b/config/locales/es.yml index 9e0b8945..d899b99c 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -123,6 +123,10 @@ es: title: Web distribuida success: ¡Éxito! error: Hubo un error + deploy_social_distributed_press: + title: Fediverso + success: ¡Éxito! + error: Hubo un error deploy_reindex: title: Reindexación success: ¡Éxito! @@ -312,6 +316,14 @@ es: copias de tu contenido indefinidamente. [Saber más](https://sutty.nl/saber-mas-sobre-publicar-a-la-web-distribuida/) + deploy_social_distributed_press: + title: 'Publicar al Fediverso' + help: | + Utilizando el protocolo ActivityPub, otras personas en el + Fediverso ([Mastodon](https://joinmastodon.org/servers), + [Pixelfed](https://pixelfed.social/site/about) y + [otros](https://fediverse.party/)) pueden seguir a tu sitio, + recibir novedades e interactuar con ellas. stats: index: title: Estadísticas From f019805314735c813847043fadf051961ad5837a Mon Sep 17 00:00:00 2001 From: f Date: Wed, 30 Aug 2023 10:47:27 -0300 Subject: [PATCH 417/475] =?UTF-8?q?fix:=20generar=20todos=20los=20deploys?= =?UTF-8?q?=20autom=C3=A1ticamente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/site.rb | 4 ---- app/services/site_service.rb | 5 ++--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/app/models/site.rb b/app/models/site.rb index 9ec21561..961831d5 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -19,10 +19,6 @@ class Site < ApplicationRecord # protege de acceso al panel de Sutty! encrypts :private_key - # TODO: Hacer que los diferentes tipos de deploy se auto registren - # @see app/services/site_service.rb - DEPLOYS = %i[local private www zip hidden_service distributed_press].freeze - validates :name, uniqueness: true, hostname: { allow_root_label: true } diff --git a/app/services/site_service.rb b/app/services/site_service.rb index b1df3d10..5bd89888 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -54,9 +54,8 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do # Genera los Deploy necesarios para el sitio a menos que ya los tenga. def build_deploys - Site::DEPLOYS.map { |deploy| "Deploy#{deploy.to_s.camelcase}" } - .each do |deploy| - next if site.deploys.find_by type: deploy + Deploy.subclasses.each do |deploy| + next if site.deploys.find_by type: deploy.name site.deploys.build type: deploy end From 4ade0944def7484ddcbee854c63ed184067b0f1c Mon Sep 17 00:00:00 2001 From: f Date: Wed, 30 Aug 2023 10:58:52 -0300 Subject: [PATCH 418/475] =?UTF-8?q?feat:=20los=20deploys=20pueden=20pasar?= =?UTF-8?q?=20opciones=20de=20compilaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy.rb | 5 ++++ app/models/deploy_local.rb | 16 ++++++++++--- app/models/deploy_social_distributed_press.rb | 24 +++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 app/models/deploy_social_distributed_press.rb diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 77e5b8d8..abf5591f 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -100,6 +100,11 @@ class Deploy < ApplicationRecord @local_env ||= {} end + # Devuelve opciones para jekyll build + # + # @return [String,nil] + def flags_for_build(**args); end + # Trae todas las dependencias # # @return [Array] diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index e66bb003..9228581f 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -141,11 +141,11 @@ class DeployLocal < Deploy run %(bundle install --deployment --no-cache --path="#{gems_dir}" --clean --without test development), output: output end - # TODO: Esto significa que todos los sitios van a tener activity pub - # activado def jekyll_build(output: false) with_tempfile(site.private_key_pem) do |file| - run %(bundle exec jekyll build --trace --profile --key #{file.path} --destination "#{escaped_destination}"), output: output + flags = extra_flags(private_key: file) + + run %(bundle exec jekyll build --trace --profile #{flags} --destination "#{escaped_destination}"), output: output end end @@ -173,4 +173,14 @@ class DeployLocal < Deploy end end end + + # Genera opciones extra desde los otros deploys + # + # @param :args [Hash] + # @return [String] + def extra_flags(**args) + non_local_deploys.map do |deploy| + deploy.flags_for_build(**args) + end.compact.join(' ') + end end diff --git a/app/models/deploy_social_distributed_press.rb b/app/models/deploy_social_distributed_press.rb new file mode 100644 index 00000000..47464ea9 --- /dev/null +++ b/app/models/deploy_social_distributed_press.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +require 'distributed_press/v1/social/client' + +# Publicar novedades al Fediverso +class DeploySocialDistributedPress < Deploy + # Solo luego de publicar remotamente + DEPENDENCIES = %i[deploy_distributed_press deploy_rsync deploy_full_rsync] + + # Envía las notificaciones + def deploy(output: false) + with_tempfile(site.private_key_pem) do |file| + run %(bundle exec jekyll notify --trace --key #{file.path} --destination "#{escaped_destination}"), output: output + end + end + + # Genera la opción de llave privada para jekyll build + # + # @params :args [Hash] + # @return [String] + def flags_for_build(**args) + "--key #{Shellwords.escape args[:private_key].path}" + end +end From 26f57a8467241e825b87fefcccdf76c4e9c3561d Mon Sep 17 00:00:00 2001 From: f Date: Wed, 30 Aug 2023 11:09:08 -0300 Subject: [PATCH 419/475] =?UTF-8?q?feat:=20m=C3=A9todos=20de=20deploy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy_social_distributed_press.rb | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/app/models/deploy_social_distributed_press.rb b/app/models/deploy_social_distributed_press.rb index 47464ea9..db555ab7 100644 --- a/app/models/deploy_social_distributed_press.rb +++ b/app/models/deploy_social_distributed_press.rb @@ -10,10 +10,41 @@ class DeploySocialDistributedPress < Deploy # Envía las notificaciones def deploy(output: false) with_tempfile(site.private_key_pem) do |file| - run %(bundle exec jekyll notify --trace --key #{file.path} --destination "#{escaped_destination}"), output: output + key = Shellwords.escape file.path + dest = Shellwords.escape destination + + run %(bundle exec jekyll notify --trace --key #{key} --destination "#{dest}"), output: output end end + # Igual que DeployLocal + # + # @return [String] + def destination + File.join(Rails.root, '_deploy', site.hostname) + end + + # Solo uno + # + # @return [Integer] + def limit + 1 + end + + # Espacio ocupado, pero no podemos calcularlo + # + # @return [Integer] + def size + 0 + end + + # El perfil de actor + # + # @return [String,nil] + def url + site.data.dig('activity_pub', 'actor') + end + # Genera la opción de llave privada para jekyll build # # @params :args [Hash] From 2a4073178a7b431e6f1ea1b7798fcfc1d7b8a10b Mon Sep 17 00:00:00 2001 From: f Date: Wed, 30 Aug 2023 11:13:49 -0300 Subject: [PATCH 420/475] fix: actualizar la gema --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index dd880219..5ccee727 100644 --- a/Gemfile +++ b/Gemfile @@ -39,7 +39,7 @@ gem 'commonmarker' gem 'devise' gem 'devise-i18n' gem 'devise_invitable' -gem 'distributed-press-api-client', '~> 0.2.3' +gem 'distributed-press-api-client', '~> 0.3.0rc0' gem 'njalla-api-client', '~> 0.2.0' gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n' gem 'exception_notification' diff --git a/Gemfile.lock b/Gemfile.lock index f71053d7..6c3dae96 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -153,7 +153,7 @@ GEM devise_invitable (2.0.8) actionmailer (>= 5.0) devise (>= 4.6) - distributed-press-api-client (0.2.4) + distributed-press-api-client (0.3.0rc0) addressable (~> 2.3, >= 2.3.0) climate_control dry-schema @@ -595,7 +595,7 @@ DEPENDENCIES devise devise-i18n devise_invitable - distributed-press-api-client (~> 0.2.3) + distributed-press-api-client (~> 0.3.0rc0) dotenv-rails down ed25519 From c9866a0eecfca61d5c3136ffa412045687728dc3 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 30 Aug 2023 15:33:48 -0300 Subject: [PATCH 421/475] =?UTF-8?q?fix:=20mover=20m=C3=A9todos=20a=20deplo?= =?UTF-8?q?y?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/deploy.rb | 36 ++++++++++++++++++++++++++++++++++++ app/models/deploy_local.rb | 36 ------------------------------------ 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/app/models/deploy.rb b/app/models/deploy.rb index abf5591f..c01a378f 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -55,6 +55,28 @@ class Deploy < ApplicationRecord @gems_dir ||= Rails.root.join('_storage', 'gems', site.name) end + # Un entorno que solo tiene lo que necesitamos + # + # @return [Hash] + def env + # XXX: This doesn't support Windows paths :B + paths = [File.dirname(`which bundle`), '/usr/local/bin', '/usr/bin', '/bin'] + + # Las variables de entorno extra no pueden superponerse al local. + extra_env.merge({ + 'HOME' => home_dir, + 'PATH' => paths.join(':'), + 'SPREE_API_KEY' => site.tienda_api_key, + 'SPREE_URL' => site.tienda_url, + 'AIRBRAKE_PROJECT_ID' => site.id.to_s, + 'AIRBRAKE_PROJECT_KEY' => site.airbrake_api_key, + 'JEKYLL_ENV' => Rails.env, + 'LANG' => ENV['LANG'], + 'YARN_CACHE_FOLDER' => yarn_cache_dir, + 'GEMS_SOURCE' => ENV['GEMS_SOURCE'] + }) + end + # Corre un comando, lo registra en la base de datos y devuelve el # estado. # @@ -142,4 +164,18 @@ class Deploy < ApplicationRecord def non_local_deploys @non_local_deploys ||= site.deploys.where.not(type: 'DeployLocal') end + + # Consigue todas las variables de entorno configuradas por otros + # deploys. + # + # @deprecated Solo tenía sentido para Distributed Press v0 + # @return [Hash] + def extra_env + @extra_env ||= + non_local_deploys.reduce({}) do |extra_env, deploy| + extra_env.tap do |e| + e.merge! deploy.local_env + end + end + end end diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 9228581f..edf85bf5 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -68,28 +68,6 @@ class DeployLocal < Deploy FileUtils.mkdir_p destination end - # Un entorno que solo tiene lo que necesitamos - # - # @return [Hash] - def env - # XXX: This doesn't support Windows paths :B - paths = [File.dirname(`which bundle`), '/usr/local/bin', '/usr/bin', '/bin'] - - # Las variables de entorno extra no pueden superponerse al local. - extra_env.merge({ - 'HOME' => home_dir, - 'PATH' => paths.join(':'), - 'SPREE_API_KEY' => site.tienda_api_key, - 'SPREE_URL' => site.tienda_url, - 'AIRBRAKE_PROJECT_ID' => site.id.to_s, - 'AIRBRAKE_PROJECT_KEY' => site.airbrake_api_key, - 'JEKYLL_ENV' => Rails.env, - 'LANG' => ENV['LANG'], - 'YARN_CACHE_FOLDER' => yarn_cache_dir, - 'GEMS_SOURCE' => ENV['GEMS_SOURCE'] - }) - end - def yarn_cache_dir Rails.root.join('_yarn_cache').to_s end @@ -160,20 +138,6 @@ class DeployLocal < Deploy FileUtils.rm_rf destination end - # Consigue todas las variables de entorno configuradas por otros - # deploys. - # - # @deprecated Solo tenía sentido para Distributed Press v0 - # @return [Hash] - def extra_env - @extra_env ||= - non_local_deploys.reduce({}) do |extra_env, deploy| - extra_env.tap do |e| - e.merge! deploy.local_env - end - end - end - # Genera opciones extra desde los otros deploys # # @param :args [Hash] From f337e4967b1ac422062b696a8fc705f9f49d9e34 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 30 Aug 2023 16:40:33 -0300 Subject: [PATCH 422/475] fix: recolectar variables de entorno --- app/models/deploy.rb | 17 ++--------------- app/models/deploy_local.rb | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/app/models/deploy.rb b/app/models/deploy.rb index c01a378f..55ec46f6 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -66,14 +66,8 @@ class Deploy < ApplicationRecord extra_env.merge({ 'HOME' => home_dir, 'PATH' => paths.join(':'), - 'SPREE_API_KEY' => site.tienda_api_key, - 'SPREE_URL' => site.tienda_url, - 'AIRBRAKE_PROJECT_ID' => site.id.to_s, - 'AIRBRAKE_PROJECT_KEY' => site.airbrake_api_key, 'JEKYLL_ENV' => Rails.env, 'LANG' => ENV['LANG'], - 'YARN_CACHE_FOLDER' => yarn_cache_dir, - 'GEMS_SOURCE' => ENV['GEMS_SOURCE'] }) end @@ -161,21 +155,14 @@ class Deploy < ApplicationRecord @deploy_local ||= site.deploys.find_by(type: 'DeployLocal') end - def non_local_deploys - @non_local_deploys ||= site.deploys.where.not(type: 'DeployLocal') - end - # Consigue todas las variables de entorno configuradas por otros # deploys. # - # @deprecated Solo tenía sentido para Distributed Press v0 # @return [Hash] def extra_env @extra_env ||= - non_local_deploys.reduce({}) do |extra_env, deploy| - extra_env.tap do |e| - e.merge! deploy.local_env - end + site.deployment_list.reduce({}) do |extra, deploy| + extra.merge deploy.local_env end end end diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index edf85bf5..0bb3958f 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -62,6 +62,20 @@ class DeployLocal < Deploy FileUtils.rm_rf(File.join(site.path, '.jekyll-cache')) end + # Opciones necesarias para la compilación del sitio + # + # @return [Hash] + def local_env + @local_env ||= { + 'SPREE_API_KEY' => site.tienda_api_key, + 'SPREE_URL' => site.tienda_url, + 'AIRBRAKE_PROJECT_ID' => site.id.to_s, + 'AIRBRAKE_PROJECT_KEY' => site.airbrake_api_key, + 'YARN_CACHE_FOLDER' => yarn_cache_dir, + 'GEMS_SOURCE' => ENV['GEMS_SOURCE'] + } + end + private def mkdir @@ -143,7 +157,7 @@ class DeployLocal < Deploy # @param :args [Hash] # @return [String] def extra_flags(**args) - non_local_deploys.map do |deploy| + site.deployment_list.map do |deploy| deploy.flags_for_build(**args) end.compact.join(' ') end From cd7c21792063c815adb4886540d6a64fe9c0ecf3 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 30 Aug 2023 17:17:04 -0300 Subject: [PATCH 423/475] fix: poder asignar valor por defecto a los campos boolean --- app/models/metadata_boolean.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/metadata_boolean.rb b/app/models/metadata_boolean.rb index 90c002a7..9932c6fd 100644 --- a/app/models/metadata_boolean.rb +++ b/app/models/metadata_boolean.rb @@ -4,8 +4,12 @@ # # Esto es increíblemente difícil de lograr que salga bien! class MetadataBoolean < MetadataTemplate + # El valor por defecto es una versión booleana de lo que diga (o no + # diga) el esquema + # + # @return [Boolean] def default_value - false + !!super end # Los checkboxes son especiales porque la especificación de HTML From d8e21c97e2efcc6ffbfdc294119545b58b538cd0 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 31 Aug 2023 14:41:34 -0300 Subject: [PATCH 424/475] fix: solo vincular urls que tienen protocolo --- app/controllers/build_stats_controller.rb | 7 ++++++- app/jobs/deploy_job.rb | 6 +++++- app/mailers/deploy_mailer.rb | 2 +- app/views/build_stats/index.haml | 2 +- app/views/deploy_mailer/deployed.html.haml | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/controllers/build_stats_controller.rb b/app/controllers/build_stats_controller.rb index 31a4c5d6..6961cf45 100644 --- a/app/controllers/build_stats_controller.rb +++ b/app/controllers/build_stats_controller.rb @@ -22,7 +22,12 @@ class BuildStatsController < ApplicationController @table = site.deployment_list.map do |deploy| type = deploy.class.name.underscore - urls = deploy.respond_to?(:urls) ? deploy.urls : [deploy.url].compact + urls = (deploy.respond_to?(:urls) ? deploy.urls : [deploy.url].compact).map do |url| + URI.parse(url) + rescue URI::Error + nil + end.compact + urls = [nil] if urls.empty? build_stat = deploy.build_stats.where(status: true).last seconds = build_stat&.seconds || 0 diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index a5cda360..6f486f29 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -51,7 +51,11 @@ class DeployJob < ApplicationJob status = d.deploy(output: @output) seconds = d.build_stats.last.try(:seconds) || 0 size = d.size - urls = d.respond_to?(:urls) ? d.urls : [d.url].compact + urls = (d.respond_to?(:urls) ? d.urls : [d.url].compact).map do |url| + URI.parse url + rescue URI::Error + nil + end.compact rescue StandardError => e status = false seconds ||= 0 diff --git a/app/mailers/deploy_mailer.rb b/app/mailers/deploy_mailer.rb index b7b464cb..37748b42 100644 --- a/app/mailers/deploy_mailer.rb +++ b/app/mailers/deploy_mailer.rb @@ -52,7 +52,7 @@ class DeployMailer < ApplicationMailer t << (row.map do |k, v| case k when :seconds then v[:human] - when :urls then url + when :urls then url.to_s else v end end) diff --git a/app/views/build_stats/index.haml b/app/views/build_stats/index.haml index 27c063f9..0b0e7755 100644 --- a/app/views/build_stats/index.haml +++ b/app/views/build_stats/index.haml @@ -14,7 +14,7 @@ - row[:urls].each do |url| %tr %th{ scope: 'row' }= row[:title] - %td= link_to_if url.present?, url, url, class: 'word-break-all' + %td= link_to_if (url.present? && uri.scheme.present?), url.to_s, url.to_s, class: 'word-break-all' %td %time{ datetime: row[:seconds][:machine] }= row[:seconds][:human] %td= row[:size] diff --git a/app/views/deploy_mailer/deployed.html.haml b/app/views/deploy_mailer/deployed.html.haml index f5afe5de..b3463db6 100644 --- a/app/views/deploy_mailer/deployed.html.haml +++ b/app/views/deploy_mailer/deployed.html.haml @@ -13,7 +13,7 @@ %tr %td= row[:title] %td= row[:status] - %td= link_to_if url.present?, url, url + %td= link_to_if (url.present? && uri.scheme.present?), url.to_s, url.to_s %td %time{ datetime: row[:seconds][:machine] }= row[:seconds][:human] %td= row[:size] From f076838be5137821ca2a2ca18f9e89c53047ea5f Mon Sep 17 00:00:00 2001 From: f Date: Thu, 31 Aug 2023 14:47:44 -0300 Subject: [PATCH 425/475] fixup! fix: solo vincular urls que tienen protocolo --- app/jobs/deploy_job.rb | 2 +- app/views/deploy_mailer/deployed.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index 6f486f29..00ae7585 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -70,7 +70,7 @@ class DeployJob < ApplicationJob status: status, seconds: seconds, size: size, - urls: urls + urls: urls.map(&:to_s) } end diff --git a/app/views/deploy_mailer/deployed.html.haml b/app/views/deploy_mailer/deployed.html.haml index b3463db6..762bf4db 100644 --- a/app/views/deploy_mailer/deployed.html.haml +++ b/app/views/deploy_mailer/deployed.html.haml @@ -13,7 +13,7 @@ %tr %td= row[:title] %td= row[:status] - %td= link_to_if (url.present? && uri.scheme.present?), url.to_s, url.to_s + %td= link_to_if (url.present? && url.scheme.present?), url.to_s, url.to_s %td %time{ datetime: row[:seconds][:machine] }= row[:seconds][:human] %td= row[:size] From a6195fbcccf80e47245429228f6631b9139aced4 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 31 Aug 2023 14:52:49 -0300 Subject: [PATCH 426/475] fix: simplificar --- app/controllers/build_stats_controller.rb | 2 +- app/jobs/deploy_job.rb | 2 +- app/models/deploy.rb | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/build_stats_controller.rb b/app/controllers/build_stats_controller.rb index 6961cf45..339f17f0 100644 --- a/app/controllers/build_stats_controller.rb +++ b/app/controllers/build_stats_controller.rb @@ -22,7 +22,7 @@ class BuildStatsController < ApplicationController @table = site.deployment_list.map do |deploy| type = deploy.class.name.underscore - urls = (deploy.respond_to?(:urls) ? deploy.urls : [deploy.url].compact).map do |url| + urls = deploy.urls.map do |url| URI.parse(url) rescue URI::Error nil diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index 00ae7585..0870b827 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -51,7 +51,7 @@ class DeployJob < ApplicationJob status = d.deploy(output: @output) seconds = d.build_stats.last.try(:seconds) || 0 size = d.size - urls = (d.respond_to?(:urls) ? d.urls : [d.url].compact).map do |url| + urls = d.urls.map do |url| URI.parse url rescue URI::Error nil diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 55ec46f6..811047f1 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -23,6 +23,11 @@ class Deploy < ApplicationRecord raise NotImplementedError end + # @return [Array] + def urls + [url].compact + end + def limit raise NotImplementedError end From 927f92d985e7b1af86424cb332e48f900d988a83 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 31 Aug 2023 14:56:00 -0300 Subject: [PATCH 427/475] fix: typo --- app/views/build_stats/index.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/build_stats/index.haml b/app/views/build_stats/index.haml index 0b0e7755..de04d84d 100644 --- a/app/views/build_stats/index.haml +++ b/app/views/build_stats/index.haml @@ -14,7 +14,7 @@ - row[:urls].each do |url| %tr %th{ scope: 'row' }= row[:title] - %td= link_to_if (url.present? && uri.scheme.present?), url.to_s, url.to_s, class: 'word-break-all' + %td= link_to_if (url.present? && url.scheme.present?), url.to_s, url.to_s, class: 'word-break-all' %td %time{ datetime: row[:seconds][:machine] }= row[:seconds][:human] %td= row[:size] From 3dedd84db78512e017706cd90610318c677879d4 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 31 Aug 2023 14:58:16 -0300 Subject: [PATCH 428/475] fix: enviar urls parseadas --- 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 0870b827..291991c7 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -70,7 +70,7 @@ class DeployJob < ApplicationJob status: status, seconds: seconds, size: size, - urls: urls.map(&:to_s) + urls: urls } end From 6aa0f7d6cf6a54f4f0cee94d27d3c8206a849c86 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 1 Sep 2023 20:11:46 -0300 Subject: [PATCH 429/475] =?UTF-8?q?feat:=20guardar=20la=20fecha=20de=20cre?= =?UTF-8?q?aci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/post.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/post.rb b/app/models/post.rb index 5cc1c5ea..6265a313 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -267,6 +267,7 @@ class Post # Y que no se procese liquid yaml['liquid'] = false yaml['usuaries'] = usuaries.map(&:id).uniq + yaml['created_at'] ||= Time.now yaml['last_modified_at'] = modified_at "#{yaml.to_yaml}---\n\n#{body}" From 10d958e50aed0f92dfae7140bde7650d371b1d22 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 4 Sep 2023 12:44:57 -0300 Subject: [PATCH 430/475] =?UTF-8?q?fix:=20compartir=20la=20misma=20fecha?= =?UTF-8?q?=20de=20creaci=C3=B3n=20y=20de=20actualizaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/post.rb b/app/models/post.rb index 6265a313..f31c33b6 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -267,7 +267,7 @@ class Post # Y que no se procese liquid yaml['liquid'] = false yaml['usuaries'] = usuaries.map(&:id).uniq - yaml['created_at'] ||= Time.now + yaml['created_at'] ||= modified_at yaml['last_modified_at'] = modified_at "#{yaml.to_yaml}---\n\n#{body}" From 7425428f44e4cafaceb988718a7a30317d4588ee Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 4 Sep 2023 16:30:20 -0300 Subject: [PATCH 431/475] feat: add magazine theme to seeds and fix description text #14128 --- db/seeds/designs.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/db/seeds/designs.yml b/db/seeds/designs.yml index a04c99c1..56655322 100644 --- a/db/seeds/designs.yml +++ b/db/seeds/designs.yml @@ -75,6 +75,14 @@ credits_en: 'This template was made in collaboration with Librenauta in 15 hours!' designer_url: 'https://copiona.com/donaunbit/' priority: '70' +- name_en: 'Magazine' + name_es: 'Revista' + gem: 'compost-jekyll-theme' + url: 'https://two.compost.digital/' + description_en: 'A theme to create multimedia publications, based in COMPOST magazine' + description_es: 'Plantilla para crear publicaciones multimedia, basada en COMPOST magazine' + license: 'https://0xacab.org/sutty/jekyll/compost-jekyll-theme/-/blob/no-masters/LICENSE.txt' + priority: '40' - name_en: 'Resource toolkit' name_es: 'Recursero' gem: 'recursero-jekyll-theme' From 8ae5dd597501d81d4e266bedbbf62edbe7778761 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 12 Sep 2023 14:49:17 -0300 Subject: [PATCH 432/475] fix: no compartir la misma instancia sutty/jekyll/jekyll-activitypub#42 --- app/models/post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/post.rb b/app/models/post.rb index f31c33b6..36a0b02e 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -267,7 +267,7 @@ class Post # Y que no se procese liquid yaml['liquid'] = false yaml['usuaries'] = usuaries.map(&:id).uniq - yaml['created_at'] ||= modified_at + yaml['created_at'] ||= modified_at.dup yaml['last_modified_at'] = modified_at "#{yaml.to_yaml}---\n\n#{body}" From 6b1eccade35aec862160950549123f59be7d1fe7 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 13 Sep 2023 17:52:21 -0300 Subject: [PATCH 433/475] =?UTF-8?q?feat:=20fecha=20de=20creaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/metadata_created_at.rb | 14 ++++++++++++++ app/models/post.rb | 8 ++++++-- app/views/posts/attribute_ro/_created_at.haml | 4 ++++ app/views/posts/attributes/_created_at.haml | 1 + config/locales/en.yml | 2 ++ config/locales/es.yml | 2 ++ 6 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 app/models/metadata_created_at.rb create mode 100644 app/views/posts/attribute_ro/_created_at.haml create mode 100644 app/views/posts/attributes/_created_at.haml diff --git a/app/models/metadata_created_at.rb b/app/models/metadata_created_at.rb new file mode 100644 index 00000000..2a7c07ed --- /dev/null +++ b/app/models/metadata_created_at.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# Fecha y hora de creación +class MetadataCreatedAt < MetadataTemplate + # Por defecto la hora actual + def default_value + Time.now + end + + # Nunca cambia + def value=(new_value) + value + end +end diff --git a/app/models/post.rb b/app/models/post.rb index 36a0b02e..8bd5dab3 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -12,7 +12,7 @@ class Post DEFAULT_ATTRIBUTES = %i[site document layout].freeze # Otros atributos que no vienen en los metadatos PRIVATE_ATTRIBUTES = %i[path slug attributes errors].freeze - PUBLIC_ATTRIBUTES = %i[lang date uuid].freeze + PUBLIC_ATTRIBUTES = %i[lang date uuid created_at].freeze ATTR_SUFFIXES = %w[? =].freeze attr_reader :attributes, :errors, :layout, :site, :document @@ -217,6 +217,11 @@ class Post post: self, required: true) end + # La fecha de creación inmodificable del post + def created_at + @metadata[:created_at] ||= MetadataCreatedAt.new(document: document, site: site, layout: layout, name: :created_at, type: :timestamp, post: self, required: true) + end + # Detecta si es un atributo válido o no, a partir de la tabla de la # plantilla def attribute?(mid) @@ -267,7 +272,6 @@ class Post # Y que no se procese liquid yaml['liquid'] = false yaml['usuaries'] = usuaries.map(&:id).uniq - yaml['created_at'] ||= modified_at.dup yaml['last_modified_at'] = modified_at "#{yaml.to_yaml}---\n\n#{body}" diff --git a/app/views/posts/attribute_ro/_created_at.haml b/app/views/posts/attribute_ro/_created_at.haml new file mode 100644 index 00000000..04f6d716 --- /dev/null +++ b/app/views/posts/attribute_ro/_created_at.haml @@ -0,0 +1,4 @@ +%tr{ id: attribute } + %th= post_label_t(attribute, post: post) + %td{ dir: dir, lang: locale } + %time{ datetime: metadata.value.xmlschema }= l metadata.value diff --git a/app/views/posts/attributes/_created_at.haml b/app/views/posts/attributes/_created_at.haml new file mode 100644 index 00000000..0aab9802 --- /dev/null +++ b/app/views/posts/attributes/_created_at.haml @@ -0,0 +1 @@ +-# nada diff --git a/config/locales/en.yml b/config/locales/en.yml index 0dad2e68..5c00701c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -524,6 +524,8 @@ en: feedback: 'This field cannot be empty!' uuid: label: 'Unique identifier' + created_at: + label: 'Created at' geo: uri: 'Open in app' osm: 'Open in web map' diff --git a/config/locales/es.yml b/config/locales/es.yml index d899b99c..0ff7e1c8 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -532,6 +532,8 @@ es: feedback: '¡Este campo no puede estar vacío!' uuid: label: 'Identificador único' + created_at: + label: 'Fecha de creación' geo: uri: 'Abrir en aplicación' osm: 'Abrir en mapa web' From 35e8a087163683c77de16fd398006d8b71c5bec8 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 13 Sep 2023 17:53:51 -0300 Subject: [PATCH 434/475] =?UTF-8?q?fixup!=20feat:=20fecha=20de=20creaci?= =?UTF-8?q?=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/post.rb b/app/models/post.rb index 8bd5dab3..73785cad 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -219,7 +219,7 @@ class Post # La fecha de creación inmodificable del post def created_at - @metadata[:created_at] ||= MetadataCreatedAt.new(document: document, site: site, layout: layout, name: :created_at, type: :timestamp, post: self, required: true) + @metadata[:created_at] ||= MetadataCreatedAt.new(document: document, site: site, layout: layout, name: :created_at, type: :created_at, post: self, required: true) end # Detecta si es un atributo válido o no, a partir de la tabla de la From d27717ed3b7a21413361e86030ef59f4c3b84b3c Mon Sep 17 00:00:00 2001 From: f Date: Wed, 13 Sep 2023 17:59:50 -0300 Subject: [PATCH 435/475] fix: agregar created_at al front matter --- app/models/post.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/post.rb b/app/models/post.rb index 73785cad..fab9ab06 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -272,6 +272,7 @@ class Post # Y que no se procese liquid yaml['liquid'] = false yaml['usuaries'] = usuaries.map(&:id).uniq + yaml['created_at'] = created_at.value yaml['last_modified_at'] = modified_at "#{yaml.to_yaml}---\n\n#{body}" From 99c919e5e6cfca0e6affcd138da52a0565b6fd32 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 13 Sep 2023 18:07:25 -0300 Subject: [PATCH 436/475] fix: retrocompatibilidad --- app/models/metadata_created_at.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/models/metadata_created_at.rb b/app/models/metadata_created_at.rb index 2a7c07ed..d31b3a1c 100644 --- a/app/models/metadata_created_at.rb +++ b/app/models/metadata_created_at.rb @@ -2,9 +2,14 @@ # Fecha y hora de creación class MetadataCreatedAt < MetadataTemplate - # Por defecto la hora actual + # Por defecto la hora actual, pero por retrocompatibilidad, queremos + # la fecha de publicación def default_value - Time.now + if post.date.value.to_date < Time.now.to_date + post.date.value + else + Time.now + end end # Nunca cambia From a2d84bfa96a375bd8c0ce79cda4a2ec20f0f5e9d Mon Sep 17 00:00:00 2001 From: f Date: Thu, 21 Sep 2023 12:25:23 -0300 Subject: [PATCH 437/475] fix: renombrar el remote correctamente --- app/models/site.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/site.rb b/app/models/site.rb index 0fddeff5..fa1d7b46 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -473,7 +473,10 @@ class Site < ApplicationRecord def clone_skel! return if jekyll? - Rugged::Repository.clone_at ENV['SKEL_SUTTY'], path, remote: 'upstream' + Rugged::Repository.clone_at ENV['SKEL_SUTTY'], path + + # Necesita un bloque + repository.rugged.remotes.rename('origin', 'upstream') {} end # Elimina el directorio del sitio From 69e1664084cd2b1cfb4fa71dfee745883f546c2d Mon Sep 17 00:00:00 2001 From: f Date: Thu, 21 Sep 2023 13:02:15 -0300 Subject: [PATCH 438/475] fix: renombrar todos los repositorios remotos --- ...921155401_site_rename_origin_to_upstream.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 db/migrate/20230921155401_site_rename_origin_to_upstream.rb diff --git a/db/migrate/20230921155401_site_rename_origin_to_upstream.rb b/db/migrate/20230921155401_site_rename_origin_to_upstream.rb new file mode 100644 index 00000000..c27d7747 --- /dev/null +++ b/db/migrate/20230921155401_site_rename_origin_to_upstream.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# Renombrar todos los repositorios que apunten a skel como su origin +class SiteRenameOriginToUpstream < ActiveRecord::Migration[6.1] + # Renombrar + def up + Site.find_each do |site| + next unless site.repository.origin&.url == ENV['SKEL_SUTTY'] + + site.repository.rugged.remotes.rename('origin', 'upstream') + rescue Rugged::Error => e + Rails.logger.warn "#{site.name}: #{e.message}" + end + end + + # No se puede deshacer + def down; end +end From e4dc6588f925756d9523b6d344668c099f17b382 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 21 Sep 2023 13:04:25 -0300 Subject: [PATCH 439/475] =?UTF-8?q?fix:=20informar=20qu=C3=A9=20est=C3=A1?= =?UTF-8?q?=20pasando?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20230921155401_site_rename_origin_to_upstream.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/db/migrate/20230921155401_site_rename_origin_to_upstream.rb b/db/migrate/20230921155401_site_rename_origin_to_upstream.rb index c27d7747..e32ca6fc 100644 --- a/db/migrate/20230921155401_site_rename_origin_to_upstream.rb +++ b/db/migrate/20230921155401_site_rename_origin_to_upstream.rb @@ -8,6 +8,7 @@ class SiteRenameOriginToUpstream < ActiveRecord::Migration[6.1] next unless site.repository.origin&.url == ENV['SKEL_SUTTY'] site.repository.rugged.remotes.rename('origin', 'upstream') + Rails.logger.info "#{site.name}: renamed origin to upstream" rescue Rugged::Error => e Rails.logger.warn "#{site.name}: #{e.message}" end From 7709b9f79803ccdda400526f5b2dfb9f49ad6cc8 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 21 Sep 2023 13:09:10 -0300 Subject: [PATCH 440/475] =?UTF-8?q?fix:=20capturar=20m=C3=A1s=20errores?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20230921155401_site_rename_origin_to_upstream.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20230921155401_site_rename_origin_to_upstream.rb b/db/migrate/20230921155401_site_rename_origin_to_upstream.rb index e32ca6fc..4ad53f1b 100644 --- a/db/migrate/20230921155401_site_rename_origin_to_upstream.rb +++ b/db/migrate/20230921155401_site_rename_origin_to_upstream.rb @@ -9,7 +9,7 @@ class SiteRenameOriginToUpstream < ActiveRecord::Migration[6.1] site.repository.rugged.remotes.rename('origin', 'upstream') Rails.logger.info "#{site.name}: renamed origin to upstream" - rescue Rugged::Error => e + rescue Rugged::Error, Rugged::OSError => e Rails.logger.warn "#{site.name}: #{e.message}" end end From b06b829357a607a9567d75fbf3bded07d7002a53 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 21 Sep 2023 13:10:26 -0300 Subject: [PATCH 441/475] fix: necesita un bloque --- db/migrate/20230921155401_site_rename_origin_to_upstream.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db/migrate/20230921155401_site_rename_origin_to_upstream.rb b/db/migrate/20230921155401_site_rename_origin_to_upstream.rb index 4ad53f1b..864f4c4a 100644 --- a/db/migrate/20230921155401_site_rename_origin_to_upstream.rb +++ b/db/migrate/20230921155401_site_rename_origin_to_upstream.rb @@ -7,8 +7,9 @@ class SiteRenameOriginToUpstream < ActiveRecord::Migration[6.1] Site.find_each do |site| next unless site.repository.origin&.url == ENV['SKEL_SUTTY'] - site.repository.rugged.remotes.rename('origin', 'upstream') - Rails.logger.info "#{site.name}: renamed origin to upstream" + site.repository.rugged.remotes.rename('origin', 'upstream') do |_| + Rails.logger.info "#{site.name}: renamed origin to upstream" + end rescue Rugged::Error, Rugged::OSError => e Rails.logger.warn "#{site.name}: #{e.message}" end From 4689d10e8dbfb612e03f4fb922d61010fb10f24c Mon Sep 17 00:00:00 2001 From: jazzari Date: Thu, 21 Sep 2023 16:22:45 -0300 Subject: [PATCH 442/475] feat: instalada gema device_detector #14334 --- Gemfile | 1 + config/initializers/device_detector.rb | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 config/initializers/device_detector.rb diff --git a/Gemfile b/Gemfile index dd880219..7e1beda9 100644 --- a/Gemfile +++ b/Gemfile @@ -78,6 +78,7 @@ gem 'validates_hostname' gem 'webpacker' gem 'yaml_db', git: 'https://0xacab.org/sutty/yaml_db.git' gem 'kaminari' +gem 'device_detector' # database gem 'hairtrigger' diff --git a/config/initializers/device_detector.rb b/config/initializers/device_detector.rb new file mode 100644 index 00000000..95500315 --- /dev/null +++ b/config/initializers/device_detector.rb @@ -0,0 +1,3 @@ +DeviceDetector.configure do |config| + config.max_cache_keys = 5_000 # to check if not too much + end \ No newline at end of file From 84f82cbb0fccde12f51cc69678ccdafe151b96b3 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 22 Sep 2023 12:21:55 -0300 Subject: [PATCH 443/475] fix: obtener el usuario del repositorio --- Gemfile | 1 + Gemfile.lock | 4 ++++ app/models/site/repository.rb | 16 +++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index dd880219..6edeac5a 100644 --- a/Gemfile +++ b/Gemfile @@ -70,6 +70,7 @@ gem 'redis-rails' gem 'rollups', git: 'https://github.com/fauno/rollup.git', branch: 'update' gem 'rubyzip' gem 'rugged' +gem 'git_clone_url' gem 'concurrent-ruby-ext' gem 'que' gem 'symbol-fstring', require: 'fstring/all' diff --git a/Gemfile.lock b/Gemfile.lock index f71053d7..9549a51d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -217,6 +217,8 @@ GEM activerecord (>= 4.0.0) get_process_mem (0.2.7) ffi (~> 1.0) + git_clone_url (2.0.0) + uri-ssh_git (>= 2.0) globalid (1.1.0) activesupport (>= 5.0) groupdate (6.2.1) @@ -553,6 +555,7 @@ GEM unf_ext unf_ext (0.0.8.2-x86_64-linux-musl) unicode-display_width (1.8.0) + uri-ssh_git (2.0.0) validates_hostname (1.0.13) activerecord (>= 3.0) activesupport (>= 3.0) @@ -606,6 +609,7 @@ DEPENDENCIES fast_jsonparser (~> 0.5.0) flamegraph friendly_id + git_clone_url hairtrigger haml-lint hamlit-rails diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index 74d874c1..d776efa4 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -173,7 +173,21 @@ class Site def credentials return unless File.exist? private_key - @credentials ||= Rugged::Credentials::SshKey.new username: 'git', publickey: public_key, privatekey: private_key + @credentials ||= + begin + username = parse_url(origin.url)&.user || 'git' + + Rugged::Credentials::SshKey.new username: username, publickey: public_key, privatekey: private_key + end + end + + # @param :url [String] + # @return [URI, nil] + def parse_url(url) + GitCloneUrl.parse(url) + rescue URI::Error => e + ExceptionNotifier.notify_exception(e, data: { site: site.name, url: url }) + nil end # @return [String] From 0c7a37a1d82e7035b05cfb4fb96614c36fd38369 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 22 Sep 2023 12:46:32 -0300 Subject: [PATCH 444/475] fix: mantener rugged 1.5.0.1 versiones posteriores se rompen con urls ssh:// https://github.com/libgit2/libgit2/issues/6496 --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 6edeac5a..ce776647 100644 --- a/Gemfile +++ b/Gemfile @@ -69,7 +69,7 @@ gem 'redis', '~> 4.0', require: %w[redis redis/connection/hiredis] gem 'redis-rails' gem 'rollups', git: 'https://github.com/fauno/rollup.git', branch: 'update' gem 'rubyzip' -gem 'rugged' +gem 'rugged', '1.5.0.1' gem 'git_clone_url' gem 'concurrent-ruby-ext' gem 'que' diff --git a/Gemfile.lock b/Gemfile.lock index 9549a51d..11561776 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -496,7 +496,7 @@ GEM ruby_parser (3.20.1) sexp_processor (~> 4.16) rubyzip (2.3.2) - rugged (1.6.3-x86_64-linux-musl) + rugged (1.5.0.1-x86_64-linux-musl) safe_yaml (1.0.6) safely_block (0.3.0) errbase (>= 0.1.1) @@ -654,7 +654,7 @@ DEPENDENCIES rollups! rubocop-rails rubyzip - rugged + rugged (= 1.5.0.1) safe_yaml safely_block (~> 0.3.0) sassc-rails From 52e22a53bfd3f8bed30a01820ca522304384b619 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 22 Sep 2023 12:47:18 -0300 Subject: [PATCH 445/475] fix: no sabemos el sitio --- app/models/site/repository.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index d776efa4..128a557a 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -186,7 +186,7 @@ class Site def parse_url(url) GitCloneUrl.parse(url) rescue URI::Error => e - ExceptionNotifier.notify_exception(e, data: { site: site.name, url: url }) + ExceptionNotifier.notify_exception(e, data: { path: path, url: url }) nil end From 7793c5f96d63bad20243b6eb3bb0d8bc79e92e6d Mon Sep 17 00:00:00 2001 From: f Date: Fri, 22 Sep 2023 13:03:28 -0300 Subject: [PATCH 446/475] =?UTF-8?q?fix:=20no=20enviar=20el=20env=20en=20la?= =?UTF-8?q?=20notificaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/webhooks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 1730034e..36e6a6d1 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -68,7 +68,7 @@ module Api # respuesta de error a plataformas def platforms_answer(exception) - ExceptionNotifier.notify_exception(exception, env: request.env, data: { headers: request.headers.to_h }) + ExceptionNotifier.notify_exception(exception, data: { headers: request.headers.to_h } head :forbidden end From c176a8a4b44b5b62ffe01fb7708c39abf4eecbd9 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 22 Sep 2023 13:19:21 -0300 Subject: [PATCH 447/475] feat: poder obtener el usuario de cualquier remoto --- app/models/site/repository.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index 128a557a..119a1495 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -173,12 +173,18 @@ class Site def credentials return unless File.exist? private_key - @credentials ||= - begin - username = parse_url(origin.url)&.user || 'git' + Rugged::Credentials::SshKey.new username: username_for(origin), publickey: public_key, privatekey: private_key + end - Rugged::Credentials::SshKey.new username: username, publickey: public_key, privatekey: private_key - end + # Obtiene el nombre de usuario para el repositorio remoto, por + # defecto git + # + # @param :remote [Rugged::Remote] + # @return [String] + def username_for(remote) + username = parse_url(remote.url)&.user if remote.respond_to? :url + + username || 'git' end # @param :url [String] From aeaf72c27036753b52087acac6c2fd523e923f78 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 22 Sep 2023 13:20:20 -0300 Subject: [PATCH 448/475] feat: poder pushear a cualquier remoto --- app/models/site/repository.rb | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index 119a1495..2eafb92e 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -158,22 +158,29 @@ class Site # Pushea cambios al repositorio remoto # + # @param :remote [Rugged::Remote] # @return [Boolean, nil] - def push - origin.push(rugged.head.canonical_name, credentials: credentials) - git_sh("git", "lfs", "push", "origin", default_branch) + def push(remote = origin) + remote.push(rugged.head.canonical_name, credentials: credentials_for(remote)) + git_sh('git', 'lfs', 'push', remote.name, default_branch) end private + # @deprecated + def credentials + @credentials ||= credentials_for(origin) + end + # Si Sutty tiene una llave privada de tipo ED25519, devuelve las # credenciales necesarias para trabajar con repositorios remotos. # + # @param :remote [Rugged::Remote] # @return [Nil, Rugged::Credentials::SshKey] - def credentials + def credentials_for(remote) return unless File.exist? private_key - Rugged::Credentials::SshKey.new username: username_for(origin), publickey: public_key, privatekey: private_key + Rugged::Credentials::SshKey.new username: username_for(remote), publickey: public_key, privatekey: private_key end # Obtiene el nombre de usuario para el repositorio remoto, por From 74e371eb36c6b9d4714e0cfba98851ec1a36a65c Mon Sep 17 00:00:00 2001 From: jazzari Date: Fri, 22 Sep 2023 13:51:36 -0300 Subject: [PATCH 449/475] feat: ignorar reportes de bots con device_detector #14334 --- app/controllers/api/v1/notices_controller.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/notices_controller.rb b/app/controllers/api/v1/notices_controller.rb index 436c78b5..c5b88e28 100644 --- a/app/controllers/api/v1/notices_controller.rb +++ b/app/controllers/api/v1/notices_controller.rb @@ -9,10 +9,11 @@ module Api # Generar un stacktrace en segundo plano y enviarlo por correo # solo si la API key es verificable. Del otro lado siempre # respondemos con lo mismo. - def create - if site&.airbrake_valid? airbrake_token + def create + if site&.airbrake_valid? airbrake_token && !detected_device.bot? BacktraceJob.perform_later site_id: params[:site_id], - params: airbrake_params.to_h + params: airbrake_params.to_h + end end render status: 201, json: { id: 1, url: '' } @@ -34,6 +35,11 @@ module Api def airbrake_token @airbrake_token ||= params[:key] end + + # @return [DeviceDetector] + def detected_device + @detected_device ||= DeviceDetector.new(request.headers) + end end end end From f19a9fa42fcbaa1d37344c852ba9f239448d1f2b Mon Sep 17 00:00:00 2001 From: f Date: Fri, 22 Sep 2023 14:31:53 -0300 Subject: [PATCH 450/475] style: usar .editorconfig sutty/jekyll/sutty-base-jekyll-theme#60 --- .editorconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..b0bc1626 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space +indent_size = 2 + +[Makefile] +indent_style = tab From 6866f827f6547655709405ad258783464bb72b06 Mon Sep 17 00:00:00 2001 From: jazzari Date: Fri, 22 Sep 2023 15:10:46 -0300 Subject: [PATCH 451/475] =?UTF-8?q?fix:=20error=20de=20sintaxis=20y=20par?= =?UTF-8?q?=C3=A1metros=20a=20device=5Fdetector=20#14334?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 18 ++++++++++-------- app/controllers/api/v1/notices_controller.rb | 5 ++--- config/initializers/device_detector.rb | 4 ++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f71053d7..5e6d09f9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -86,7 +86,7 @@ GEM minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.4) + addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) autoprefixer-rails (10.4.13.0) @@ -142,6 +142,7 @@ GEM rake (> 10, < 14) ruby-statistics (>= 2.1) thor (>= 0.19, < 2) + device_detector (1.1.1) devise (4.9.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -166,10 +167,10 @@ GEM railties (>= 3.2) down (5.4.1) addressable (~> 2.8) - dry-configurable (1.0.1) + dry-configurable (1.1.0) dry-core (~> 1.0, < 2) zeitwerk (~> 2.6) - dry-core (1.0.0) + dry-core (1.0.1) concurrent-ruby (~> 1.0) zeitwerk (~> 2.6) dry-inflector (1.0.0) @@ -178,7 +179,7 @@ GEM concurrent-ruby (~> 1.0) dry-core (~> 1.0, < 2) zeitwerk (~> 2.6) - dry-schema (1.13.1) + dry-schema (1.13.3) concurrent-ruby (~> 1.0) dry-configurable (~> 1.0, >= 1.0.1) dry-core (~> 1.0, < 2) @@ -344,7 +345,7 @@ GEM method_source (1.0.0) mini_histogram (0.3.1) mini_magick (4.12.0) - mini_mime (1.1.2) + mini_mime (1.1.5) mini_portile2 (2.8.2) minitest (5.18.0) mobility (1.2.9) @@ -461,7 +462,7 @@ GEM responders (3.1.0) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.2.5) + rexml (3.2.6) rgl (0.6.3) pairing_heap (>= 0.3.0) rexml (~> 3.2, >= 3.2.4) @@ -526,7 +527,7 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.6.3-x86_64-linux-musl) + sqlite3 (1.6.4-x86_64-linux-musl) mini_portile2 (~> 2.8.0) stackprof (0.2.25-x86_64-linux-musl) stream (0.5.5) @@ -575,7 +576,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.8) + zeitwerk (2.6.11) PLATFORMS x86_64-linux-musl @@ -592,6 +593,7 @@ DEPENDENCIES concurrent-ruby-ext database_cleaner derailed_benchmarks + device_detector devise devise-i18n devise_invitable diff --git a/app/controllers/api/v1/notices_controller.rb b/app/controllers/api/v1/notices_controller.rb index c5b88e28..3d74a48f 100644 --- a/app/controllers/api/v1/notices_controller.rb +++ b/app/controllers/api/v1/notices_controller.rb @@ -10,10 +10,9 @@ module Api # solo si la API key es verificable. Del otro lado siempre # respondemos con lo mismo. def create - if site&.airbrake_valid? airbrake_token && !detected_device.bot? + if (site&.airbrake_valid? airbrake_token) && !detected_device.bot? BacktraceJob.perform_later site_id: params[:site_id], params: airbrake_params.to_h - end end render status: 201, json: { id: 1, url: '' } @@ -38,7 +37,7 @@ module Api # @return [DeviceDetector] def detected_device - @detected_device ||= DeviceDetector.new(request.headers) + @detected_device ||= DeviceDetector.new(request.headers['User-Agent'], request.headers) end end end diff --git a/config/initializers/device_detector.rb b/config/initializers/device_detector.rb index 95500315..e6f6118a 100644 --- a/config/initializers/device_detector.rb +++ b/config/initializers/device_detector.rb @@ -1,3 +1,3 @@ DeviceDetector.configure do |config| - config.max_cache_keys = 5_000 # to check if not too much - end \ No newline at end of file + config.max_cache_keys = 5_000 # to check if not too much +end \ No newline at end of file From de59cd9f34b8e346df111643f11482df9647bd15 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 25 Sep 2023 14:08:37 -0300 Subject: [PATCH 452/475] fix: informar cuando la plantilla no tiene gema #14309 --- config/initializers/core_extensions.rb | 14 ++++++++++++++ config/locales/en.yml | 1 + config/locales/es.yml | 1 + 3 files changed, 16 insertions(+) diff --git a/config/initializers/core_extensions.rb b/config/initializers/core_extensions.rb index 1516a43a..837fbd18 100644 --- a/config/initializers/core_extensions.rb +++ b/config/initializers/core_extensions.rb @@ -91,6 +91,15 @@ module Jekyll spec.name == name end + unless spec + I18n.with_locale(locale) do + raise ArgumentError, I18n.t('activerecord.errors.models.site.attributes.design_id.missing_gem', theme: name) + rescue ArgumentError => e + ExceptionNotifier.notify_exception(e, data: { theme: name, site: site.path }) + raise + end + end + ruby_version = Gem::Version.new(RUBY_VERSION) ruby_version.canonical_segments[2] = 0 base_path = Rails.root.join('_storage', 'gems', File.basename(site.source), 'ruby', @@ -114,6 +123,11 @@ module Jekyll private def gemspec; end + + # @return [Symbol] + def locale + @locale ||= (site.config['locale'] || site.config['lang'] || I18n.locale).to_sym + end end # No necesitamos los archivos de la plantilla diff --git a/config/locales/en.yml b/config/locales/en.yml index 5f97a8b9..56b8c213 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -191,6 +191,7 @@ en: deploys: deploy_local_presence: 'We need to be build the site!' design_id: + missing_gem: "Site is configured to use %{theme} theme, but the corresponding gem is missing from Gemfile" layout_incompatible: error: "Design can't be changed because there are posts with incompatible layouts" help: "Your site has posts with layouts only compatible with the current design. If you change it, the site won't work as you expect. If you're trying out designs, you can delete posts in the following incompatible layouts:: %{layouts}." diff --git a/config/locales/es.yml b/config/locales/es.yml index 9e0b8945..b4fde8a3 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -191,6 +191,7 @@ es: deploys: deploy_local_presence: '¡Necesitamos poder generar el sitio!' design_id: + missing_gem: "El sitio usa la plantilla %{theme} pero la gema correspondiente no se encuentra en el Gemfile" layout_incompatible: error: 'No se puede cambiar la plantilla porque hay artículos con formatos incompatibles' help: 'En tu sitio hay artículos que solo son compatibles con el diseño actual, si cambias la plantilla el sitio no funcionará como esperas. Si estás probando plantillas, puedes eliminar los artículos en los formatos incompatibles: %{layouts}.' From 01e7436576c1060d38dd47a0ef0e4aca656c02f8 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 25 Sep 2023 14:10:34 -0300 Subject: [PATCH 453/475] fix: obtener el nombre del sitio --- config/initializers/core_extensions.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/core_extensions.rb b/config/initializers/core_extensions.rb index 837fbd18..2e9ed7e1 100644 --- a/config/initializers/core_extensions.rb +++ b/config/initializers/core_extensions.rb @@ -95,7 +95,7 @@ module Jekyll I18n.with_locale(locale) do raise ArgumentError, I18n.t('activerecord.errors.models.site.attributes.design_id.missing_gem', theme: name) rescue ArgumentError => e - ExceptionNotifier.notify_exception(e, data: { theme: name, site: site.path }) + ExceptionNotifier.notify_exception(e, data: { theme: name, site: File.basename(site.source) }) raise end end From bfd31d051fb002e303ddcd0f253b1e2a7aa50f49 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 25 Sep 2023 14:15:32 -0300 Subject: [PATCH 454/475] =?UTF-8?q?fix:=20lanzar=20una=20excepci=C3=B3n=20?= =?UTF-8?q?contundente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/initializers/core_extensions.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/initializers/core_extensions.rb b/config/initializers/core_extensions.rb index 2e9ed7e1..d6039e16 100644 --- a/config/initializers/core_extensions.rb +++ b/config/initializers/core_extensions.rb @@ -93,8 +93,8 @@ module Jekyll unless spec I18n.with_locale(locale) do - raise ArgumentError, I18n.t('activerecord.errors.models.site.attributes.design_id.missing_gem', theme: name) - rescue ArgumentError => e + raise Jekyll::Errors::InvalidThemeName, I18n.t('activerecord.errors.models.site.attributes.design_id.missing_gem', theme: name) + rescue Jekyll::Errors::InvalidThemeName => e ExceptionNotifier.notify_exception(e, data: { theme: name, site: File.basename(site.source) }) raise end From 5c43214e46a06f125459c89df9568c1986dd01ea Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 25 Sep 2023 14:32:28 -0300 Subject: [PATCH 455/475] fix: arreglados cambios en Gemfile.lock #14334 --- Gemfile.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5e6d09f9..a786e060 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -86,7 +86,7 @@ GEM minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.5) + addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) autoprefixer-rails (10.4.13.0) @@ -167,10 +167,10 @@ GEM railties (>= 3.2) down (5.4.1) addressable (~> 2.8) - dry-configurable (1.1.0) + dry-configurable (1.0.1) dry-core (~> 1.0, < 2) zeitwerk (~> 2.6) - dry-core (1.0.1) + dry-core (1.0.0) concurrent-ruby (~> 1.0) zeitwerk (~> 2.6) dry-inflector (1.0.0) @@ -179,7 +179,7 @@ GEM concurrent-ruby (~> 1.0) dry-core (~> 1.0, < 2) zeitwerk (~> 2.6) - dry-schema (1.13.3) + dry-schema (1.13.1) concurrent-ruby (~> 1.0) dry-configurable (~> 1.0, >= 1.0.1) dry-core (~> 1.0, < 2) @@ -345,7 +345,7 @@ GEM method_source (1.0.0) mini_histogram (0.3.1) mini_magick (4.12.0) - mini_mime (1.1.5) + mini_mime (1.1.2) mini_portile2 (2.8.2) minitest (5.18.0) mobility (1.2.9) @@ -462,7 +462,7 @@ GEM responders (3.1.0) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.2.6) + rexml (3.2.5) rgl (0.6.3) pairing_heap (>= 0.3.0) rexml (~> 3.2, >= 3.2.4) @@ -527,7 +527,7 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.6.4-x86_64-linux-musl) + sqlite3 (1.6.3-x86_64-linux-musl) mini_portile2 (~> 2.8.0) stackprof (0.2.25-x86_64-linux-musl) stream (0.5.5) @@ -576,7 +576,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.11) + zeitwerk (2.6.8) PLATFORMS x86_64-linux-musl From 59f8f8aabbab3ef93572dacae14e56ea724364c8 Mon Sep 17 00:00:00 2001 From: jazzari Date: Wed, 27 Sep 2023 14:29:28 -0300 Subject: [PATCH 456/475] fix: arreglado typo en breadcrumbs en en.yml #13864 --- config/locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 5f97a8b9..6b73205a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -685,7 +685,7 @@ en: new: 'Create' edit: 'Configure' posts: - new: 'New %{layout}' + new: 'Add %{layout}' edit: 'Editing' usuaries: index: 'Users' From 134d1105f62256b23d64ff4fb88582a880882ec9 Mon Sep 17 00:00:00 2001 From: jazzari Date: Wed, 27 Sep 2023 15:48:53 -0300 Subject: [PATCH 457/475] =?UTF-8?q?fix:=20agregada=20la=20fecha=20de=20cre?= =?UTF-8?q?acion=20del=20post=20para=20seleccionar=20posts=20por=20t=C3=AD?= =?UTF-8?q?tulo=20si=20est=C3=A1n=20duplicados=20#14179?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/metadata_related_posts.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/metadata_related_posts.rb b/app/models/metadata_related_posts.rb index 092f219a..f20ea85c 100644 --- a/app/models/metadata_related_posts.rb +++ b/app/models/metadata_related_posts.rb @@ -34,7 +34,7 @@ class MetadataRelatedPosts < MetadataArray end def title(post) - "#{post&.title&.value || post&.slug&.value} (#{post.layout.humanized_name})" + "#{post&.title&.value || post&.slug&.value} #{post&.date&.values.trftime('%F')} (#{post.layout.humanized_name})" end # Encuentra el filtro From 5e05ba7d7b4dcffbb05bf54a2276619ea4de366f Mon Sep 17 00:00:00 2001 From: jazzari Date: Wed, 27 Sep 2023 15:52:33 -0300 Subject: [PATCH 458/475] fix: fix typo #14179 --- app/models/metadata_related_posts.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/metadata_related_posts.rb b/app/models/metadata_related_posts.rb index f20ea85c..25eb3fd1 100644 --- a/app/models/metadata_related_posts.rb +++ b/app/models/metadata_related_posts.rb @@ -34,7 +34,7 @@ class MetadataRelatedPosts < MetadataArray end def title(post) - "#{post&.title&.value || post&.slug&.value} #{post&.date&.values.trftime('%F')} (#{post.layout.humanized_name})" + "#{post&.title&.value || post&.slug&.value} #{post&.date&.values.strftime('%F')} (#{post.layout.humanized_name})" end # Encuentra el filtro From 8376e663ced7c232d18e3575ce4b6d68abc4af89 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 27 Sep 2023 15:39:12 -0300 Subject: [PATCH 459/475] =?UTF-8?q?feat:=20almacenar=20el=20=C3=BAltimo=20?= =?UTF-8?q?commit=20indexado=20#13780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20230927153926_add_last_indexed_commit_to_sites.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 db/migrate/20230927153926_add_last_indexed_commit_to_sites.rb diff --git a/db/migrate/20230927153926_add_last_indexed_commit_to_sites.rb b/db/migrate/20230927153926_add_last_indexed_commit_to_sites.rb new file mode 100644 index 00000000..2d22cbd7 --- /dev/null +++ b/db/migrate/20230927153926_add_last_indexed_commit_to_sites.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# Almacenar el último commit indexado +class AddLastIndexedCommitToSites < ActiveRecord::Migration[6.1] + def change + add_column :sites, :last_indexed_commit, :string, null: true + end +end From f18d0213dfc4d769ce58fc8ad3d898fd8a65f508 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 27 Sep 2023 15:40:14 -0300 Subject: [PATCH 460/475] =?UTF-8?q?feat:=20guardar=20el=20=C3=BAltimo=20co?= =?UTF-8?q?mmit=20indexado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/site/index.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/site/index.rb b/app/models/site/index.rb index e11095e3..f728b48b 100644 --- a/app/models/site/index.rb +++ b/app/models/site/index.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true -# Indexa todos los artículos de un sitio -# -# TODO: Hacer opcional class Site + # Indexa todos los artículos de un sitio + # + # TODO: Hacer opcional module Index extend ActiveSupport::Concern @@ -15,6 +15,8 @@ class Site def index_posts! Site.transaction do docs.each(&:index!) + + update(last_indexed_commit: repository.head_commit.oid) end end end From 074cb49752fcbbacd8a3ab9424a4210b062ffbc4 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 27 Sep 2023 16:20:57 -0300 Subject: [PATCH 461/475] feat: reindexar cambios #13780 --- app/models/site/index.rb | 100 +++++++++++++++++++++++++++++++++++++++ config/locales/en.yml | 3 ++ config/locales/es.yml | 3 ++ 3 files changed, 106 insertions(+) diff --git a/app/models/site/index.rb b/app/models/site/index.rb index f728b48b..ed0932bb 100644 --- a/app/models/site/index.rb +++ b/app/models/site/index.rb @@ -12,6 +12,10 @@ class Site after_create :index_posts! has_many :indexed_posts, dependent: :destroy + MODIFIED_STATUSES = %i[added modified].freeze + DELETED_STATUSES = %i[deleted].freeze + LOCALE_FROM_PATH = /\A_/.freeze + def index_posts! Site.transaction do docs.each(&:index!) @@ -19,6 +23,102 @@ class Site update(last_indexed_commit: repository.head_commit.oid) end end + + # Encuentra los artículos modificados entre dos commits y los + # reindexa. + def reindex_changes! + return unless reindexable? + + Site.transaction do + remove_deleted_posts! + reindex_modified_posts! + + update(last_indexed_commit: repository.head_commit.oid) + end + end + + # No hacer nada si el repositorio no cambió o no hubo cambios + # necesarios + def reindexable? + return false if last_indexed_commit.blank? + return false if last_indexed_commit == repository.head_commit.oid + + !indexable_posts.empty? + end + + private + + # Trae el último commit indexado desde el repositorio + # + # @return [Rugged::Commit] + def indexed_commit + @indexed_commit ||= repository.rugged.lookup(last_indexed_commit) + end + + # Calcula la diferencia entre el último commit indexado y el + # actual + # + # XXX: Esto no tiene en cuenta modificaciones en la historia como + # cambio de ramas, reverts y etc, solo asume que se mueve hacia + # adelante en la misma rama o las dos ramas están relacionadas. + # + # @return [Rugged::Diff] + def diff_with_head + @diff_with_head ||= indexed_commit.diff(repository.head_commit) + end + + # Obtiene todos los archivos a reindexar + # + # @return [Array] + def indexable_posts + @indexable_posts ||= + diff_with_head.each_delta.select do |delta| + locales.any? do |locale| + delta.old_file[:path].start_with? "_#{locale}/" + end + end + end + + # Elimina los artículos eliminados o que cambiaron de ubicación + # del índice + def remove_deleted_posts! + indexable_posts.select do |delta| + DELETED_STATUSES.include? delta.status + end.each do |delta| + locale, path = locale_and_path_from(delta.old_file[:path]) + + indexed_posts.destroy_by(locale: locale, path: path).tap do |destroyed_posts| + next unless destroyed_posts.empty? + + Rails.logger.info I18n.t('indexed_posts.deleted', site: name, path: path, records: destroyed_posts.count) + end + end + end + + # Reindexa artículos que cambiaron de ubicación, se agregaron + # o fueron modificados + def reindex_modified_posts! + indexable_posts.select do |delta| + MODIFIED_STATUSES.include? delta.status + end.each do |delta| + locale, path = locale_and_path_from(delta.new_file[:path]) + + site.posts(lang: locale).find(path).index! + end + end + + # Obtiene el idioma y la ruta del post a partir de la ubicación en + # el disco + # + # @return [Array] + def locale_and_path_from(path) + locale, path = path.split(File::SEPARATOR, 2) + + [ + locale.sub(LOCALE_FROM_PATH, ''), + File.basename(path, '.*') + ] + end end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 5f97a8b9..f2c0d94c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -167,6 +167,7 @@ en: usuarie: User licencia: License design: Design + indexed_post: Indexed post attributes: usuarie: email: 'E-mail address' @@ -709,3 +710,5 @@ en: build_stats: index: title: "Publications" + indexed_posts: + deleted: "Deleted indexed post %{path} from %{site} (records: %{records})" diff --git a/config/locales/es.yml b/config/locales/es.yml index 9e0b8945..73de7b18 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -167,6 +167,7 @@ es: usuarie: Usuarie licencia: Licencia design: Diseño + indexed_post: Artículo indexado attributes: usuarie: email: 'Correo electrónico' @@ -717,3 +718,5 @@ es: build_stats: index: title: "Publicaciones" + indexed_posts: + deleted: "Eliminado artículo %{path} de %{site} (filas: %{records})" From 1e13985ef82c0dde7068db2bd0e027e8f8419434 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 27 Sep 2023 16:31:23 -0300 Subject: [PATCH 462/475] =?UTF-8?q?fix:=20asumir=20que=20todos=20los=20sit?= =?UTF-8?q?ios=20ya=20est=C3=A1n=20indexados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0230927153926_add_last_indexed_commit_to_sites.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/db/migrate/20230927153926_add_last_indexed_commit_to_sites.rb b/db/migrate/20230927153926_add_last_indexed_commit_to_sites.rb index 2d22cbd7..71e08f37 100644 --- a/db/migrate/20230927153926_add_last_indexed_commit_to_sites.rb +++ b/db/migrate/20230927153926_add_last_indexed_commit_to_sites.rb @@ -2,7 +2,17 @@ # Almacenar el último commit indexado class AddLastIndexedCommitToSites < ActiveRecord::Migration[6.1] - def change + def up add_column :sites, :last_indexed_commit, :string, null: true + + Site.find_each do |site| + site.update_columns(last_indexed_commit: site.repository.head_commit.oid) + rescue Rugged::Error, Rugged::OSError => e + puts "Falló #{site.name}, ignorando: #{e.message}" + end + end + + def down + remove_column :sites, :last_indexed_commit end end From 997114a89688bb735347f2c12966c24097662a5c Mon Sep 17 00:00:00 2001 From: f Date: Wed, 27 Sep 2023 16:38:19 -0300 Subject: [PATCH 463/475] fix: ya estamos en el contexto del sitio --- app/models/site/index.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/site/index.rb b/app/models/site/index.rb index ed0932bb..06c8821b 100644 --- a/app/models/site/index.rb +++ b/app/models/site/index.rb @@ -103,7 +103,7 @@ class Site end.each do |delta| locale, path = locale_and_path_from(delta.new_file[:path]) - site.posts(lang: locale).find(path).index! + posts(lang: locale).find(path).index! end end From 85e528e660b2482d6a3b71b39b0f57544135b749 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 27 Sep 2023 16:46:33 -0300 Subject: [PATCH 464/475] fix: solo hacer merge si hubo cambios para traer --- app/jobs/git_pull_job.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/jobs/git_pull_job.rb b/app/jobs/git_pull_job.rb index de263403..41a2ec2c 100644 --- a/app/jobs/git_pull_job.rb +++ b/app/jobs/git_pull_job.rb @@ -3,11 +3,12 @@ # Permite traer los cambios cada vez que se # hace un push al repositorio class GitPullJob < ApplicationJob - # @param :site [Site] - # @param :usuarie [Usuarie] - # @return [nil] - def perform(site, usuarie) - site.repository.fetch - site.repository.merge(usuarie) - end -end \ No newline at end of file + # @param :site [Site] + # @param :usuarie [Usuarie] + # @return [nil] + def perform(site, usuarie) + return unless site.repository.fetch.positive? + + site.repository.merge(usuarie) + end +end From b119cba7e10afcbb4a665c26b4e7ad4d61afff8f Mon Sep 17 00:00:00 2001 From: f Date: Wed, 27 Sep 2023 16:47:00 -0300 Subject: [PATCH 465/475] feat: reindexar los cambios luego de traerlos #13780 --- app/jobs/git_pull_job.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/jobs/git_pull_job.rb b/app/jobs/git_pull_job.rb index 41a2ec2c..203e5698 100644 --- a/app/jobs/git_pull_job.rb +++ b/app/jobs/git_pull_job.rb @@ -10,5 +10,6 @@ class GitPullJob < ApplicationJob return unless site.repository.fetch.positive? site.repository.merge(usuarie) + site.reindex_changes! end end From 0538b3bbfd832a03bf108fd069ba23f442894244 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 27 Sep 2023 16:54:38 -0300 Subject: [PATCH 466/475] fix: no fallar si no hay origin --- app/jobs/git_pull_job.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/jobs/git_pull_job.rb b/app/jobs/git_pull_job.rb index 203e5698..949a2cdd 100644 --- a/app/jobs/git_pull_job.rb +++ b/app/jobs/git_pull_job.rb @@ -7,6 +7,7 @@ class GitPullJob < ApplicationJob # @param :usuarie [Usuarie] # @return [nil] def perform(site, usuarie) + return unless site.repository.origin return unless site.repository.fetch.positive? site.repository.merge(usuarie) From cb2c1b0e7daeab32fdc3f01fca9f7158eaf6918e Mon Sep 17 00:00:00 2001 From: f Date: Fri, 29 Sep 2023 10:10:18 -0300 Subject: [PATCH 467/475] =?UTF-8?q?fix:=20usar=20la=20codificaci=C3=B3n=20?= =?UTF-8?q?correcta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit los archivos con tildes fallaban --- app/models/site/index.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/site/index.rb b/app/models/site/index.rb index 06c8821b..6f4714c6 100644 --- a/app/models/site/index.rb +++ b/app/models/site/index.rb @@ -108,11 +108,14 @@ class Site end # Obtiene el idioma y la ruta del post a partir de la ubicación en - # el disco + # el disco. + # + # Las rutas vienen en ASCII-9BIT desde Rugged, pero en realidad + # son UTF-8 # # @return [Array] def locale_and_path_from(path) - locale, path = path.split(File::SEPARATOR, 2) + locale, path = path.force_encoding('utf-8').split(File::SEPARATOR, 2) [ locale.sub(LOCALE_FROM_PATH, ''), From 86436aafd70ba21b385e40b5b07a4001552adf64 Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 2 Oct 2023 14:36:36 -0300 Subject: [PATCH 468/475] fix: typo en metadata_related_posts.rb #14179 --- app/models/metadata_related_posts.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/metadata_related_posts.rb b/app/models/metadata_related_posts.rb index 25eb3fd1..42d1381b 100644 --- a/app/models/metadata_related_posts.rb +++ b/app/models/metadata_related_posts.rb @@ -34,7 +34,7 @@ class MetadataRelatedPosts < MetadataArray end def title(post) - "#{post&.title&.value || post&.slug&.value} #{post&.date&.values.strftime('%F')} (#{post.layout.humanized_name})" + "#{post&.title&.value || post&.slug&.value} #{post&.date&.value.strftime('%F')} (#{post.layout.humanized_name})" end # Encuentra el filtro From 9709f419ca6756d21ba21bb41cad6fce0cb0bb08 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 17 Nov 2023 18:19:13 -0300 Subject: [PATCH 469/475] =?UTF-8?q?fix:=20notificar=20cuando=20falla=20la?= =?UTF-8?q?=20=C3=BAltima=20compilaci=C3=B3n=20#14555?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/deploy_job.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index 291991c7..adba1815 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -56,6 +56,10 @@ class DeployJob < ApplicationJob rescue URI::Error nil end.compact + + unless d == @site.deployment_list.last && !status + raise DeployException, 'Falló la compilación' + end rescue StandardError => e status = false seconds ||= 0 From c8e1d502324f427382e74dc97b7b227fccb7c493 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 17 Nov 2023 18:40:34 -0300 Subject: [PATCH 470/475] fix: reversed logic --- 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 adba1815..3044b59f 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -57,7 +57,7 @@ class DeployJob < ApplicationJob nil end.compact - unless d == @site.deployment_list.last && !status + if d == @site.deployment_list.last && !status raise DeployException, 'Falló la compilación' end rescue StandardError => e From aaf2ca8757e32cc4d0cd567105ecfd46abf18388 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 Nov 2023 18:41:49 -0300 Subject: [PATCH 471/475] fix: deshabilitar njalla #14696 --- Gemfile | 1 - Gemfile.lock | 4 -- app/models/deploy_distributed_press.rb | 60 +------------------------- 3 files changed, 2 insertions(+), 63 deletions(-) diff --git a/Gemfile b/Gemfile index 972560b4..bf9e875c 100644 --- a/Gemfile +++ b/Gemfile @@ -40,7 +40,6 @@ gem 'devise' gem 'devise-i18n' gem 'devise_invitable' gem 'distributed-press-api-client', '~> 0.3.0rc0' -gem 'njalla-api-client', '~> 0.2.0' gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n' gem 'exception_notification' gem 'fast_blank' diff --git a/Gemfile.lock b/Gemfile.lock index 39394a8c..3faad5e8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -366,9 +366,6 @@ GEM net-ssh (7.1.0) netaddr (2.0.6) nio4r (2.5.9-x86_64-linux-musl) - njalla-api-client (0.2.0) - dry-schema - httparty (~> 0.18) nokogiri (1.15.4-x86_64-linux-musl) mini_portile2 (~> 2.8.2) racc (~> 1.4) @@ -636,7 +633,6 @@ DEPENDENCIES mini_magick mobility net-ssh - njalla-api-client (~> 0.2.0) nokogiri pg pg_search diff --git a/app/models/deploy_distributed_press.rb b/app/models/deploy_distributed_press.rb index 2c892b55..da8fe209 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require 'distributed_press/v1/client/site' -require 'njalla/v1' # Soportar Distributed Press APIv1 # @@ -15,8 +14,8 @@ require 'njalla/v1' class DeployDistributedPress < Deploy store :values, accessors: %i[hostname remote_site_id remote_info], coder: JSON - before_create :create_remote_site!, :create_njalla_records! - before_destroy :delete_remote_site!, :delete_njalla_records! + before_create :create_remote_site! + before_destroy :delete_remote_site! DEPENDENCIES = %i[deploy_local] @@ -31,17 +30,12 @@ class DeployDistributedPress < Deploy time_start create_remote_site! if remote_site_id.blank? - create_njalla_records! save if remote_site_id.blank? raise DeployJob::DeployException, 'El sitio no se creó en Distributed Press' end - if create_njalla_records? && remote_info[:njalla].blank? - raise DeployJob::DeployException, 'No se pudieron crear los registros necesarios en Njalla' - end - site_client.tap do |c| stdout = Thread.new(publisher.logger_out) do |io| until io.eof? @@ -145,29 +139,6 @@ class DeployDistributedPress < Deploy nil end - # Crea los registros en Njalla - # - # XXX: Esto depende de nuestro DNS actual, cuando lo migremos hay - # que eliminarlo. - # - # @return [nil] - def create_njalla_records! - return unless create_njalla_records? - - self.remote_info ||= {} - self.remote_info[:njalla] ||= {} - self.remote_info[:njalla][:a] ||= njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h - self.remote_info[:njalla][:cname] ||= njalla.add_record(name: "www.#{site.name}", type: 'CNAME', content: "#{Site.domain}.").to_h - self.remote_info[:njalla][:ns] ||= njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h - - nil - rescue HTTParty::Error => e - ExceptionNotifier.notify_exception(e, data: { site: site.name }) - self.remote_info.delete :njalla - ensure - nil - end - # Registra lo que sucedió # # @param status [Bool] @@ -185,31 +156,4 @@ class DeployDistributedPress < Deploy ExceptionNotifier.notify_exception(e, data: { site: site.name }) nil end - - def delete_njalla_records! - return unless create_njalla_records? - - %w[a ns cname].each do |type| - next if (id = remote_info.dig('njalla', type, 'id')).blank? - - njalla.remove_record(id: id.to_i) - end - end - - # Actualizar registros en Njalla - # - # @return [Njalla::V1::Domain] - def njalla - @njalla ||= - begin - client = Njalla::V1::Client.new(token: Rails.application.credentials.njalla) - - Njalla::V1::Domain.new(domain: Site.domain, client: client) - end - end - - # Detecta si tenemos que crear registros en Njalla - def create_njalla_records? - !site.name.end_with?('.') - end end From 89063d50c02a3627da5b1e820764dabe9dfe5e7f Mon Sep 17 00:00:00 2001 From: f Date: Mon, 4 Dec 2023 17:50:53 -0300 Subject: [PATCH 472/475] fix: no cambiar el nombre de dominio #14746 --- app/models/site.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/site.rb b/app/models/site.rb index a8c5e376..c40dd6f9 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -501,8 +501,8 @@ class Site < ApplicationRecord config.theme = design.gem unless design.no_theme? config.description = description config.title = title - config.url = url(slash: false) - config.hostname = hostname + config.url ||= url(slash: false) + config.hostname ||= hostname config.locales = locales.map(&:to_s) end From 1a3c6a77ce931371eb18d7a0563790f3285cc386 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 19 Dec 2023 14:33:17 -0300 Subject: [PATCH 473/475] fix: correr psql dentro de hain --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5d6c066b..7b40d941 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ copy-table: ssh $(delegate) docker exec postgresql pg_dump -U sutty -d sutty -t $(table) | $(psql) psql: - $(psql) + $(hain) $(psql) rubocop: ## Yutea el código que está por ser commiteado git status --porcelain \ From c5cece436dc63f6340d6310d61ae4e8c26bc127a Mon Sep 17 00:00:00 2001 From: f Date: Tue, 19 Dec 2023 14:36:47 -0300 Subject: [PATCH 474/475] fix: usar la url de la base de datos en psql --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7b40d941..f295a3e0 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,7 @@ rake: ## Corre rake dentro del entorno de desarrollo (pasar argumentos con args= bundle: ## Corre bundle dentro del entorno de desarrollo (pasar argumentos con args=). $(hain) 'bundle $(args)' -psql := psql -h $(PG_HOST) -U $(PG_USER) -p $(PG_PORT) -d sutty +psql := psql $(DATABASE_URL) copy-table: test -n "$(table)" echo "truncate $(table) $(cascade);" | $(psql) From c007f3b0e3c0864aeb6360bde92e4c0bcb11cacf Mon Sep 17 00:00:00 2001 From: f Date: Tue, 19 Jul 2022 13:50:30 -0300 Subject: [PATCH 475/475] no actualizar al cargar el listado de sitios hace que todo tarde demasiado tiempo (cherry picked from commit 15454596f21fe2a0059e71d573a84fbc937a6a36) --- app/views/sites/index.haml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/views/sites/index.haml b/app/views/sites/index.haml index 56178775..b7231292 100644 --- a/app/views/sites/index.haml +++ b/app/views/sites/index.haml @@ -54,10 +54,4 @@ text: t('usuaries.index.title'), type: 'info', link: site_usuaries_path(site) - - if policy(site).pull? && site.repository.needs_pull? - = render 'layouts/btn_with_tooltip', - tooltip: t('help.sites.pull'), - text: t('.pull'), - type: 'info', - link: site_pull_path(site) = render 'sites/build', site: site