From e889f29d17b616bb62e5f4ee94bcde68a6d07668 Mon Sep 17 00:00:00 2001 From: jazzari Date: Thu, 7 Dec 2023 15:37:46 +0100 Subject: [PATCH 01/39] fix: modificado metodo Reload en site.rb #14700 --- 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 a8c5e376..10a5e27b 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -396,7 +396,7 @@ class Site < ApplicationRecord def reload super - reload_jekyll! + site.self end def configuration From 61e20a3a133304615b9fdeb81be68f4c2d2aaeaa Mon Sep 17 00:00:00 2001 From: jazzari Date: Thu, 7 Dec 2023 16:05:20 +0100 Subject: [PATCH 02/39] fix: corregido metodo Reload en site.rb #14700 --- app/models/site.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/site.rb b/app/models/site.rb index 10a5e27b..507b51ec 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -395,8 +395,10 @@ class Site < ApplicationRecord end def reload - super - site.self + super.tap do |s| + reload_jekyll! + end + self end def configuration From c66a7660c10c551bba8c6981a201530feb853317 Mon Sep 17 00:00:00 2001 From: jazzari Date: Thu, 7 Dec 2023 17:24:04 +0100 Subject: [PATCH 03/39] fix: modificado metodo Gateways_urls para que devuelva solamente links en deploy_distributed_press.rb #14550 --- 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 da8fe209..bfa43441 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -87,7 +87,7 @@ class DeployDistributedPress < Deploy # @return [Array] def gateway_urls remote_info.dig(:distributed_press, :links)&.values&.map do |protocol| - [ protocol[:link], protocol[:gateway] ] + [ protocol[:link]] end&.flatten&.compact&.select do |link| link.include? '://' end || [] From ee7d1599e896f82accac69288edc6ff450a53c83 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 9 Jan 2024 18:27:02 -0300 Subject: [PATCH 04/39] fix: limitar el nombre del archivo #14946 --- app/models/metadata_path.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/models/metadata_path.rb b/app/models/metadata_path.rb index 95fc7dbb..17085e07 100644 --- a/app/models/metadata_path.rb +++ b/app/models/metadata_path.rb @@ -6,7 +6,7 @@ class MetadataPath < MetadataTemplate # # @return [String] def default_value - File.join(site.path, "_#{lang}", "#{date}-#{slug}#{ext}") + File.join(site.path, "_#{lang}", "#{limited_name}#{ext}") end # La ruta del archivo según Jekyll @@ -46,4 +46,12 @@ class MetadataPath < MetadataTemplate def date post.date.value.strftime('%F') end + + # Limita el nombre de archivo a 255 bytes, de forma que siempre + # podemos guardarlo + # + # @return [String] + def limited_name + "#{date}-#{slug}".mb_chars.limit(255 - ext.length) + end end From c2534578400e416d5560ed1344e58a87d1cc6092 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 10 Jan 2024 11:39:07 -0300 Subject: [PATCH 05/39] fix: env para desarrollo --- .env.development | 1 + 1 file changed, 1 insertion(+) create mode 100644 .env.development diff --git a/.env.development b/.env.development new file mode 100644 index 00000000..df2788b0 --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +HAINISH=../haini.sh/haini.sh From 3d86ad1fbefe69fcd25aefd86b4103632d3cc709 Mon Sep 17 00:00:00 2001 From: jazzari Date: Wed, 10 Jan 2024 15:36:02 -0300 Subject: [PATCH 06/39] fix: quitado espacio sobrante en array #14550 --- 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 bfa43441..c74a342f 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -87,7 +87,7 @@ class DeployDistributedPress < Deploy # @return [Array] def gateway_urls remote_info.dig(:distributed_press, :links)&.values&.map do |protocol| - [ protocol[:link]] + [protocol[:link]] end&.flatten&.compact&.select do |link| link.include? '://' end || [] From 5aef69cd940e05cadc365bed4af835cd7e82a78e Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 16:52:24 -0300 Subject: [PATCH 07/39] fix: eliminar los guiones bajos al principio del nombre de archivo #14953 porque jekyll los toma como archivos ocultos --- .../active_storage/direct_uploads_controller_decorator.rb | 2 +- app/lib/action_dispatch/http/uploaded_file_decorator.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/active_storage/direct_uploads_controller_decorator.rb b/app/controllers/active_storage/direct_uploads_controller_decorator.rb index c62dae2a..5ac58ecf 100644 --- a/app/controllers/active_storage/direct_uploads_controller_decorator.rb +++ b/app/controllers/active_storage/direct_uploads_controller_decorator.rb @@ -19,7 +19,7 @@ module ActiveStorage # stack. def blob_args params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, metadata: {}).to_h.symbolize_keys.tap do |ba| - ba[:filename] = ba[:filename].unicode_normalize + ba[:filename] = ba[:filename].unicode_normalize.sub(/\A_+/, '') end end end diff --git a/app/lib/action_dispatch/http/uploaded_file_decorator.rb b/app/lib/action_dispatch/http/uploaded_file_decorator.rb index 0bdebdc0..7b28a0db 100644 --- a/app/lib/action_dispatch/http/uploaded_file_decorator.rb +++ b/app/lib/action_dispatch/http/uploaded_file_decorator.rb @@ -11,7 +11,7 @@ module ActionDispatch # Devolver el nombre de archivo con caracteres unicode # normalizados def original_filename - @original_filename.unicode_normalize + @original_filename.unicode_normalize.sub(/\A_+/, '') end end end From 76644700d164060079c125148b6a7f62d50ca4ba Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:03:37 -0300 Subject: [PATCH 08/39] fix: traer la lista de archivos modificados --- bin/modified_files | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/modified_files b/bin/modified_files index 37bcabeb..d26e71f3 100755 --- a/bin/modified_files +++ b/bin/modified_files @@ -3,6 +3,6 @@ set -e test -n "${CI_MERGE_REQUEST_DIFF_BASE_SHA}" -git diff --name-status ${CI_MERGE_REQUEST_DIFF_BASE_SHA}...origin/rails \ +git diff --name-status ${CI_MERGE_REQUEST_DIFF_BASE_SHA} \ | grep -v "^D" \ | cut -f 2 From 9c97e0f87c3c618083444d75af4f5b8021d2a16c Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:08:05 -0300 Subject: [PATCH 09/39] =?UTF-8?q?ci:=20por=20qu=C3=A9=20faltan=20las=20gem?= =?UTF-8?q?as=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 38f480c9..39d7787f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -81,6 +81,7 @@ rubocop: before_script: - *apk-add - *disable-hainish + - ls -hal vendor/ruby script: - "./bin/modified_files | ./bin/with_extension rb | xargs -r go-task bundle -- exec rubocop" haml: From a78d02d84af8fb4bc9db2e23a7b18a2bb5ef2dee Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:10:55 -0300 Subject: [PATCH 10/39] =?UTF-8?q?fixup!=20ci:=20por=20qu=C3=A9=20faltan=20?= =?UTF-8?q?las=20gemas=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 39d7787f..aa3677f2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -81,6 +81,9 @@ rubocop: before_script: - *apk-add - *disable-hainish + - env + - ls -hal vendor + - ls -hal vendor - ls -hal vendor/ruby script: - "./bin/modified_files | ./bin/with_extension rb | xargs -r go-task bundle -- exec rubocop" From 1ede2af465114a80c776e116d40a537f851334f7 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:18:36 -0300 Subject: [PATCH 11/39] fix: instalar dependencias --- Taskfile.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Taskfile.yaml b/Taskfile.yaml index 8427db4a..c2d72472 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -24,11 +24,14 @@ tasks: deps: - "credentials" cmds: - - task: "bundle" + - "{{.HAINISH}} bundle config set --local path './vendor'" + - "{{.HAINISH}} bundle install" sources: - "Gemfile" generates: - "Gemfile.lock" + status: + - "test -d vendor/ruby" clean: desc: "Clean" cmds: From 24120bfd904101e42e722ef9dc456da03e129a81 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:18:58 -0300 Subject: [PATCH 12/39] =?UTF-8?q?fix:=20agregar=20configuraci=C3=B3n=20de?= =?UTF-8?q?=20bundler=20a=20la=20cach=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aa3677f2..0e38e7d6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,7 @@ .cache-ruby: &cache-ruby - paths: - "vendor/ruby" + - ".bundle" .cache-node: &cache-node - paths: - "node_modules" From 987e19f565e7e85ae68836ddb552a83d315e1e51 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:24:51 -0300 Subject: [PATCH 13/39] =?UTF-8?q?fixup!=20fixup!=20ci:=20por=20qu=C3=A9=20?= =?UTF-8?q?faltan=20las=20gemas=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0e38e7d6..e4cee087 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ .apk-add: &apk-add -- "apk add go-task diffutils" +- "apk add go-task diffutils gitlab_ci_log_section" .disable-hainish: &disable-hainish - "rm -f .env.development" .cache-ruby: &cache-ruby @@ -27,13 +27,18 @@ assets: - *cache-node - *cache-task before_script: + - "gitlab_ci_log_section --name git --header=\"Configuring git\"" - "git config --global user.email \"${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}\"" - "git config --global user.name \"${GIT_USER_NAME:-$GITLAB_USER_NAME}\"" - "git remote set-url --push origin \"https://${GITLAB_USERNAME}:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git\"" + - "gitlab_ci_log_section --name git --end" + - "gitlab_ci_log_section --name apk --header=\"Installing dependencies\"" - "apk add brotli" - *apk-add - *disable-hainish + - "gitlab_ci_log_section --name apk --end" script: + - "gitlab_ci_log_section --name assets --header=\"Building\"" - "go-task assets" after_script: - "git add public && git commit -m \"ci: assets [skip ci]\"" @@ -82,10 +87,6 @@ rubocop: before_script: - *apk-add - *disable-hainish - - env - - ls -hal vendor - - ls -hal vendor - - ls -hal vendor/ruby script: - "./bin/modified_files | ./bin/with_extension rb | xargs -r go-task bundle -- exec rubocop" haml: From 7f3d87b3177f3f87b3b4bc484be3ffec751b7edc Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:29:32 -0300 Subject: [PATCH 14/39] chore: rubocop --- .../active_storage/direct_uploads_controller_decorator.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/active_storage/direct_uploads_controller_decorator.rb b/app/controllers/active_storage/direct_uploads_controller_decorator.rb index 5ac58ecf..94070882 100644 --- a/app/controllers/active_storage/direct_uploads_controller_decorator.rb +++ b/app/controllers/active_storage/direct_uploads_controller_decorator.rb @@ -18,7 +18,8 @@ module ActiveStorage # para que puedan propagarse correctamente a través de todo el # stack. def blob_args - params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, metadata: {}).to_h.symbolize_keys.tap do |ba| + params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, + metadata: {}).to_h.symbolize_keys.tap do |ba| ba[:filename] = ba[:filename].unicode_normalize.sub(/\A_+/, '') end end From 1fbfd30017079bafaff19021b32d8587f95fa116 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:18:36 -0300 Subject: [PATCH 15/39] fix: instalar dependencias --- Taskfile.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Taskfile.yaml b/Taskfile.yaml index 8427db4a..c2d72472 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -24,11 +24,14 @@ tasks: deps: - "credentials" cmds: - - task: "bundle" + - "{{.HAINISH}} bundle config set --local path './vendor'" + - "{{.HAINISH}} bundle install" sources: - "Gemfile" generates: - "Gemfile.lock" + status: + - "test -d vendor/ruby" clean: desc: "Clean" cmds: From 7e43d8f3326bc91e87b224a4b2eea51058ef4694 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:18:58 -0300 Subject: [PATCH 16/39] =?UTF-8?q?fix:=20agregar=20configuraci=C3=B3n=20de?= =?UTF-8?q?=20bundler=20a=20la=20cach=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 38f480c9..fd67b54a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,7 @@ .cache-ruby: &cache-ruby - paths: - "vendor/ruby" + - ".bundle" .cache-node: &cache-node - paths: - "node_modules" From 6ec99072736dae32e8aef1f068e78e0ea2fbc254 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:29:32 -0300 Subject: [PATCH 17/39] chore: rubocop --- .../active_storage/direct_uploads_controller_decorator.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/active_storage/direct_uploads_controller_decorator.rb b/app/controllers/active_storage/direct_uploads_controller_decorator.rb index 5ac58ecf..94070882 100644 --- a/app/controllers/active_storage/direct_uploads_controller_decorator.rb +++ b/app/controllers/active_storage/direct_uploads_controller_decorator.rb @@ -18,7 +18,8 @@ module ActiveStorage # para que puedan propagarse correctamente a través de todo el # stack. def blob_args - params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, metadata: {}).to_h.symbolize_keys.tap do |ba| + params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, + metadata: {}).to_h.symbolize_keys.tap do |ba| ba[:filename] = ba[:filename].unicode_normalize.sub(/\A_+/, '') end end From 023b23915078fc461be95d90eb2c389311fd1126 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 22 Feb 2024 11:46:39 -0300 Subject: [PATCH 18/39] fix: no hay botones verdes --- app/views/devise/shared/_links.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/devise/shared/_links.haml b/app/views/devise/shared/_links.haml index b4b89175..5d5c0b67 100644 --- a/app/views/devise/shared/_links.haml +++ b/app/views/devise/shared/_links.haml @@ -4,12 +4,12 @@ - if controller_name != 'sessions' = link_to t('.sign_in'), new_session_path(resource_name, params: locale), - class: 'btn btn-lg btn-block btn-success' + class: 'btn btn-lg btn-block btn-secondary' %br/ - if devise_mapping.registerable? && controller_name != 'registrations' = link_to t('.sign_up'), new_registration_path(resource_name, params: locale), - class: 'btn btn-lg btn-block btn-success' + class: 'btn btn-lg btn-block btn-secondary' %br/ - if devise_mapping.recoverable? From 969d641a9194c86dfb68b6ac76398ecc46d7703e Mon Sep 17 00:00:00 2001 From: f Date: Thu, 22 Feb 2024 16:04:10 -0300 Subject: [PATCH 19/39] fix: touch --- 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 dd250e3d..7b93184f 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -578,7 +578,7 @@ class Site < ApplicationRecord if !gems_installed? || gemfile_updated? || gemfile_lock_updated? deploy_local.bundle touch - ::File.touch(gemfile_path) + FileUtils.touch(gemfile_path) end end From a7662d005cbe6e8236bad9eec1274897baaf3d91 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 22 Feb 2024 17:28:19 -0300 Subject: [PATCH 20/39] =?UTF-8?q?fix:=20copiar=20estilo=20de=20bot=C3=B3n?= =?UTF-8?q?=20desde=20el=20modo=20oscuro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/application.scss | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 7f62e658..b4a41f99 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -52,6 +52,25 @@ $sizes: ( --background: #{$black}; --color: #{$cyan}; } + + .btn-secondary { + background-color: $white; + color: $black; + border: none; + + &:hover { + color: $black; + background-color: $cyan; + } + + &:active { + background-color: $cyan; + } + + &:focus { + box-shadow: 0 0 0 0.2rem $cyan; + } + } } // TODO: Encontrar la forma de generar esto desde los locales de Rails From 6c3b2ab022b50bb15753d5acdd584f76239142d3 Mon Sep 17 00:00:00 2001 From: jazzari Date: Fri, 1 Mar 2024 12:19:51 -0300 Subject: [PATCH 21/39] fix: movido metodo lfs_cleanup en cleanup_service.rb a site::repository --- app/models/site/repository.rb | 5 +++++ app/services/cleanup_service.rb | 10 ++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index acbf6553..58baa5dd 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -235,5 +235,10 @@ class Site r&.success? end + + def lfs_cleanup + site.repository.git_sh("git", "lfs", "prune") + site.repository.git_sh("git", "lfs", "dedup") + end end end diff --git a/app/services/cleanup_service.rb b/app/services/cleanup_service.rb index 28f6f860..e53fbcb4 100644 --- a/app/services/cleanup_service.rb +++ b/app/services/cleanup_service.rb @@ -31,7 +31,7 @@ class CleanupService site.deploys.find_each(&:cleanup!) site.repository.gc - lfs_cleanup + site.repository.lfs_cleanup site.touch end end @@ -46,14 +46,8 @@ class CleanupService Rails.logger.info "Limpiando repositorio git de #{site.name}" site.repository.gc - lfs_cleanup + site.repository.lfs_cleanup site.touch end end - - private - def lfs_cleanup - site.repository.git_sh("git", "lfs", "prune") - site.repository.git_sh("git", "lfs", "dedup") - end end From 291c477aec286e4cbefca321604c91cdf428c65a Mon Sep 17 00:00:00 2001 From: jazzari Date: Fri, 1 Mar 2024 13:11:04 -0300 Subject: [PATCH 22/39] fix: corregido metodo lfs_cleanup --- 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 58baa5dd..687ced12 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -237,8 +237,8 @@ class Site end def lfs_cleanup - site.repository.git_sh("git", "lfs", "prune") - site.repository.git_sh("git", "lfs", "dedup") + git_sh("git", "lfs", "prune") + git_sh("git", "lfs", "dedup") end end end From 053ec5674fc5af393a0cceb0a4ca21f2d93c4f98 Mon Sep 17 00:00:00 2001 From: Sutty Date: Wed, 6 Mar 2024 15:30:50 +0000 Subject: [PATCH 23/39] =?UTF-8?q?fix:=20no=20cambiar=20el=20hostname=20si?= =?UTF-8?q?=20se=20lo=20asign=C3=B3=20manualmente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 48defa9058a5b8980ad89c7e53afffd63416ca83) --- 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 da8fe209..f80024e8 100644 --- a/app/models/deploy_distributed_press.rb +++ b/app/models/deploy_distributed_press.rb @@ -128,6 +128,8 @@ class DeployDistributedPress < Deploy # # @return [nil] def create_remote_site! + self.hostname ||= site.hostname + created_site = site_client.create(create_site) self.remote_site_id = created_site[:id] From 4081f62ad104706b37c21fc0c46a36ce8360f660 Mon Sep 17 00:00:00 2001 From: Sutty Date: Wed, 6 Mar 2024 15:31:40 +0000 Subject: [PATCH 24/39] =?UTF-8?q?fix:=20gitlab=20solo=20acepta=20200=20car?= =?UTF-8?q?acteres=20en=20el=20t=C3=ADtulo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 6ea20a4d55ed6b52bc7321e2f0f18e851c97aa45) --- 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 308adfc7..77e865a3 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -105,7 +105,7 @@ class GitlabNotifierJob < ApplicationJob def title @title ||= ''.dup.tap do |t| t << "[#{exception.class}] " unless javascript? - t << exception.message + t << exception.message[0..200] t << " [#{issue_data[:count]}]" end end From 453798dcc7b33cd32a27e358eef5b9cf0acf2434 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 7 Mar 2024 16:38:26 -0300 Subject: [PATCH 25/39] =?UTF-8?q?fix:=20el=20m=C3=A9todo=20es=20p=C3=BAbli?= =?UTF-8?q?co?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/site/repository.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index 687ced12..c7056eaa 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -169,6 +169,12 @@ class Site git_sh('git', 'lfs', 'push', remote.name, default_branch) end + # Hace limpieza de LFS + def lfs_cleanup + git_sh("git", "lfs", "prune") + git_sh("git", "lfs", "dedup") + end + private # @deprecated @@ -235,10 +241,5 @@ class Site r&.success? end - - def lfs_cleanup - git_sh("git", "lfs", "prune") - git_sh("git", "lfs", "dedup") - end end end From fb38600884faffea66a9ff832d854fec3eb5dc03 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 22 Mar 2024 18:34:24 -0300 Subject: [PATCH 26/39] =?UTF-8?q?feat:=20recargar=20autom=C3=A1ticamente?= =?UTF-8?q?=20el=20estado=20de=20publicaci=C3=B3n=20#13611?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/sites_controller.rb | 7 +++++ app/javascript/packs/application.js | 2 ++ app/views/sites/_status.haml | 41 ++++++++++++++++------------- app/views/sites/status.haml | 1 + config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- config/routes.rb | 2 ++ package.json | 3 ++- yarn.lock | 5 ++++ 9 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 app/views/sites/status.haml diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index bec42b39..49527cf7 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -15,6 +15,13 @@ class SitesController < ApplicationController fresh_when @sites end + # Genera la caja del estado para HTMX + def status + authorize site + + render('sites/status', layout: false) if stale? site + end + # No tenemos propiedades de un sitio aún, así que vamos al listado de # artículos def show diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 9cbc30bf..9ddc9753 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -33,3 +33,5 @@ import 'chartkick/chart.js' Rails.start() Turbolinks.start() ActiveStorage.start() + +window.htmx = require('htmx.org/dist/htmx') diff --git a/app/views/sites/_status.haml b/app/views/sites/_status.haml index 6a610e73..47bed657 100644 --- a/app/views/sites/_status.haml +++ b/app/views/sites/_status.haml @@ -1,21 +1,24 @@ -- link = nil -- if site.not_published_yet? - - message = t('.not_published_yet') -- elsif site.awaiting_publication? - - message = t('.awaiting_publication') -- elsif site.building? - - if site.average_publication_time_calculable? - - average_building_time = site.average_publication_time - - elsif !site.similar_sites? - - average_building_time = 60 +- cache site do + - link = nil + - if site.not_published_yet? + - message = t('.not_published_yet') + - elsif site.awaiting_publication? + - message = t('.awaiting_publication') + - elsif site.building? + - if site.average_publication_time_calculable? + - average_building_time = site.average_publication_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 - - average_building_time = site.average_publication_time_for_similar_sites + - message = t('.available') + - link = true - - 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_build_stats_path(site), class: 'alert-link' + -# TODO: Calcular cada cuanto sería óptimo recargar + %div{ 'hx-get': site_status_path(site), 'hx-trigger': 'every 10s', 'hx-swap': 'outerHTML' } + = render 'bootstrap/alert' do + = link_to_if link, message.html_safe, site_build_stats_path(site), class: 'alert-link' diff --git a/app/views/sites/status.haml b/app/views/sites/status.haml new file mode 100644 index 00000000..3d9793a5 --- /dev/null +++ b/app/views/sites/status.haml @@ -0,0 +1 @@ += render 'sites/status', site: @site diff --git a/config/locales/en.yml b/config/locales/en.yml index fc9d4894..720f784a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -389,7 +389,7 @@ en: static_file_migration: 'File migration' find_and_replace: 'Search and replace' status: - building: "Your site is building, refresh this page in ." + building: "Your site is building, it will be ready 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 find all the different ways to visit it." awaiting_publication: "There are unpublished changes. Click the button below and wait a moment to find them on your site." diff --git a/config/locales/es.yml b/config/locales/es.yml index 4bda4982..e7ff0864 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -394,7 +394,7 @@ es: static_file_migration: 'Migración de archivos' find_and_replace: 'Búsqueda y reemplazo' status: - building: "Tu sitio se está publicando, recargá esta página en ." + building: "Tu sitio se está publicando, estará listo en ." not_published_yet: "Tu sitio se está publicando por primera vez, por favor espera hasta un minuto..." available: "¡Tu sitio está disponible! Cliqueá aquí para encontrar todas las formas en que podés visitarlo." awaiting_publication: "Hay cambios sin publicar, cliqueá el botón debajo y espera un momento para encontrarlos en tu sitio." diff --git a/config/routes.rb b/config/routes.rb index 635be07a..557439e9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -37,6 +37,8 @@ Rails.application.routes.draw do get 'pull', to: 'sites#fetch' post 'pull', to: 'sites#merge' + get 'status', to: 'sites#status' + # Gestionar usuaries get 'usuaries/invite', to: 'usuaries#invite' post 'usuaries/invite', to: 'usuaries#send_invitations' diff --git a/package.json b/package.json index 7901ad41..871c9d9b 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "zepto": "^1.2.0" }, "devDependencies": { - "@types/rails__activestorage": "^6.0.0" + "@types/rails__activestorage": "^6.0.0", + "htmx.org": "^1.9.11" } } diff --git a/yarn.lock b/yarn.lock index 0c52b9d3..4619169e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4548,6 +4548,11 @@ html-entities@^1.3.1: resolved "https://registry.npmjs.org/html-entities/-/html-entities-1.4.0.tgz" integrity sha512-8nxjcBcd8wovbeKx7h3wTji4e6+rhaVuPNpMqwWgnHh+N9ToqsCs6XztWRBPQ+UtzsoMAdKZtUENoVzU/EMtZA== +htmx.org@^1.9.11: + version "1.9.11" + resolved "https://registry.yarnpkg.com/htmx.org/-/htmx.org-1.9.11.tgz#00192041ee682d6ca7146d0fbd901169ffe72d87" + integrity sha512-WlVuICn8dfNOOgYmdYzYG8zSnP3++AdHkMHooQAzGZObWpVXYathpz/I37ycF4zikR6YduzfCvEcxk20JkIUsw== + http-deceiver@^1.2.7: version "1.2.7" resolved "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz" From 736f0552f73e9a88a81552da1725b87dfeea33e4 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 22 Mar 2024 18:46:21 -0300 Subject: [PATCH 27/39] =?UTF-8?q?fix:=20poder=20importar=20htmx=20en=20pro?= =?UTF-8?q?ducci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/packs/application.js | 2 +- package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 9ddc9753..d8ff0dd1 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -34,4 +34,4 @@ Rails.start() Turbolinks.start() ActiveStorage.start() -window.htmx = require('htmx.org/dist/htmx') +window.htmx = require('htmx.org/dist/htmx.js') diff --git a/package.json b/package.json index 871c9d9b..870b8e9b 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "commonmark": "^0.29.0", "fork-awesome": "^1.1.7", "fork-ts-checker-webpack-plugin": "^6.1.0", + "htmx.org": "^1.9.11", "input-map": "git+https://0xacab.org/sutty/input-map.git", "input-tag": "git+https://0xacab.org/sutty/input-tag.git", "leaflet": "^1.7.1", @@ -34,7 +35,6 @@ "zepto": "^1.2.0" }, "devDependencies": { - "@types/rails__activestorage": "^6.0.0", - "htmx.org": "^1.9.11" + "@types/rails__activestorage": "^6.0.0" } } From 95231511b78243dede6c4cab52ab6116fb145a54 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 22 Mar 2024 18:54:18 -0300 Subject: [PATCH 28/39] fix: poder ver el estado --- app/policies/site_policy.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/policies/site_policy.rb b/app/policies/site_policy.rb index 2ca96256..d5465d6b 100644 --- a/app/policies/site_policy.rb +++ b/app/policies/site_policy.rb @@ -14,6 +14,10 @@ class SitePolicy true end + def status? + true + end + # Puede ver la versión privada del sitio? def private? edit? && site.deploys.find_by_type('DeployPrivate') From 629549c916d45ee79be189dbcfab536ed1396ba4 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 10 Apr 2024 11:49:30 -0300 Subject: [PATCH 29/39] =?UTF-8?q?fix:=20rehabilitar=20el=20bot=C3=B3n=20ta?= =?UTF-8?q?mbi=C3=A9n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/posts/index.haml | 2 -- app/views/sites/_status.haml | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 374f06ee..29f6471f 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -4,8 +4,6 @@ = render 'sites/status', site: @site - = render 'sites/build', site: @site, class: 'btn-block' - %h3= t('posts.new') %table.table.table-sm.mb-3 %tbody diff --git a/app/views/sites/_status.haml b/app/views/sites/_status.haml index 47bed657..d3da5c73 100644 --- a/app/views/sites/_status.haml +++ b/app/views/sites/_status.haml @@ -22,3 +22,5 @@ %div{ 'hx-get': site_status_path(site), 'hx-trigger': 'every 10s', 'hx-swap': 'outerHTML' } = render 'bootstrap/alert' do = link_to_if link, message.html_safe, site_build_stats_path(site), class: 'alert-link' + + = render 'sites/build', site: site, class: 'btn-block' From 7cca88b4f3ce0845cdbdfb55885b406b89199d1d Mon Sep 17 00:00:00 2001 From: f Date: Wed, 10 Apr 2024 12:15:30 -0300 Subject: [PATCH 30/39] =?UTF-8?q?fix:=20al=20salir=20de=20la=20p=C3=A1gina?= =?UTF-8?q?,=20cancelar=20todas=20las=20peticiones=20de=20htmx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #15880 closes #15881 closes #15883 closes #15884 closes #15893 closes #15894 closes #15973 closes #15974 closes #15975 closes #16003 closes #16004 --- app/javascript/etc/htmx_abort.js | 7 +++++++ app/javascript/etc/index.js | 1 + 2 files changed, 8 insertions(+) create mode 100644 app/javascript/etc/htmx_abort.js diff --git a/app/javascript/etc/htmx_abort.js b/app/javascript/etc/htmx_abort.js new file mode 100644 index 00000000..308d0315 --- /dev/null +++ b/app/javascript/etc/htmx_abort.js @@ -0,0 +1,7 @@ +// Cancela las peticiones pendientes de htmx para todos los elementos al +// cambiar de página. +document.addEventListener("turbolinks:click", () => { + for (const hx of document.querySelectorAll("[hx-get]")) { + window.htmx.trigger(hx, "htmx:abort"); + } +}); diff --git a/app/javascript/etc/index.js b/app/javascript/etc/index.js index d4b9f7a3..9ee6a95a 100644 --- a/app/javascript/etc/index.js +++ b/app/javascript/etc/index.js @@ -7,3 +7,4 @@ import './timezone' import './turbolinks-anchors' import './validation' import './new_editor' +import './htmx_abort' From 847af3374ce02fa352b7ce163ddebbb5d19da247 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 10 Apr 2024 13:26:22 -0300 Subject: [PATCH 31/39] =?UTF-8?q?fix:=20no=20multiplicar=20el=20bot=C3=B3n?= =?UTF-8?q?!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 d3da5c73..9ac27c15 100644 --- a/app/views/sites/_status.haml +++ b/app/views/sites/_status.haml @@ -23,4 +23,4 @@ = render 'bootstrap/alert' do = link_to_if link, message.html_safe, site_build_stats_path(site), class: 'alert-link' - = render 'sites/build', site: site, class: 'btn-block' + = render 'sites/build', site: site, class: 'btn-block' From 5e1def1028cb1946e2b2f232cc4aaa3bad9c189c Mon Sep 17 00:00:00 2001 From: f Date: Wed, 10 Apr 2024 13:32:37 -0300 Subject: [PATCH 32/39] =?UTF-8?q?feat:=20deshabilitar=20el=20bot=C3=B3n=20?= =?UTF-8?q?mientras=20est=C3=A1=20compilando=20tambi=C3=A9n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit para no lanzar más de una compilación por vez --- app/views/sites/_build.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/sites/_build.haml b/app/views/sites/_build.haml index b0961e31..c723a3ac 100644 --- a/app/views/sites/_build.haml +++ b/app/views/sites/_build.haml @@ -6,4 +6,4 @@ class: "btn btn-secondary #{local_assigns[:class]}", title: site.enqueued? ? t('help.sites.enqueued') : t('help.sites.enqueue'), data: { disable_with: t('sites.enqueued') }, - disabled: site.enqueued? + disabled: !site.waiting? From c80984888c7eb8d726c37882750c58e0ab454a0a Mon Sep 17 00:00:00 2001 From: f Date: Wed, 10 Apr 2024 15:16:09 -0300 Subject: [PATCH 33/39] =?UTF-8?q?feat:=20recordar=20la=20ubicaci=C3=B3n=20?= =?UTF-8?q?#15188?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2746ab10..617ce665 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -11,6 +11,7 @@ class ApplicationController < ActionController::Base before_action :configure_permitted_parameters, if: :devise_controller? before_action :notify_unconfirmed_email, unless: :devise_controller? around_action :set_locale + after_action :store_location! rescue_from Pundit::NilPolicyError, with: :page_not_found rescue_from ActionController::RoutingError, with: :page_not_found @@ -115,6 +116,16 @@ class ApplicationController < ActionController::Base def after_sign_in_path_for(resource) session[:locale] = nil - sites_path + super + end + + # Guardar la ubicación para que devise redirija a donde íbamos, a + # menos que estemos recibiendo información o intentando ingresar. + def store_location! + return if request.xhr? + return unless request.request_method_symbol == :GET + return if devise_controller? && !is_a?(Devise::RegistrationsController) && params[:action] != 'edit' + + session[:usuarie_return_to] = request.fullpath end end From 11660bc68829157b4c28235f3ad728d8001c879e Mon Sep 17 00:00:00 2001 From: f Date: Fri, 12 Apr 2024 10:01:53 -0300 Subject: [PATCH 34/39] fix: editor --- package.json | 2 +- yarn.lock | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 7901ad41..480f3d0b 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@rails/activestorage": "^6.1.3-1", "@rails/ujs": "^6.1.3-1", "@rails/webpacker": "5.4.4", - "@suttyweb/editor": "^0.1.25", + "@suttyweb/editor": "^0.1.26", "babel-loader": "^8.2.2", "chart.js": "^3.5.1", "chartkick": "^4.0.5", diff --git a/yarn.lock b/yarn.lock index 0c52b9d3..69cf4edf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1821,6 +1821,26 @@ resolved "https://registry.npmjs.org/@csstools/convert-colors/-/convert-colors-1.4.0.tgz" integrity sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw== +"@floating-ui/core@^1.0.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.6.0.tgz#fa41b87812a16bf123122bf945946bae3fdf7fc1" + integrity sha512-PcF++MykgmTj3CIyOQbKA/hDzOAiqI3mhuoN44WRCopIs1sgoDoU4oty4Jtqaj/y3oDU6fnVSm4QG0a3t5i0+g== + dependencies: + "@floating-ui/utils" "^0.2.1" + +"@floating-ui/dom@^1.5.1": + version "1.6.3" + resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.6.3.tgz#954e46c1dd3ad48e49db9ada7218b0985cee75ef" + integrity sha512-RnDthu3mzPlQ31Ss/BTwQ1zjzIhr3lk1gZB1OC56h/1vEtaXkESrOqL5fQVMfXpwGtRwX+YsZBdyHtJMQnkArw== + dependencies: + "@floating-ui/core" "^1.0.0" + "@floating-ui/utils" "^0.2.0" + +"@floating-ui/utils@^0.2.0", "@floating-ui/utils@^0.2.1": + version "0.2.1" + resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.1.tgz#16308cea045f0fc777b6ff20a9f25474dd8293d2" + integrity sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q== + "@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": version "0.3.3" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" @@ -1955,11 +1975,13 @@ resolved "https://registry.npmjs.org/@stimulus/webpack-helpers/-/webpack-helpers-1.1.1.tgz" integrity sha512-XOkqSw53N9072FLHvpLM25PIwy+ndkSSbnTtjKuyzsv8K5yfkFB2rv68jU1pzqYa9FZLcvZWP4yazC0V38dx9A== -"@suttyweb/editor@^0.1.25": - version "0.1.25" - resolved "https://registry.yarnpkg.com/@suttyweb/editor/-/editor-0.1.25.tgz#37b38560642a49b24383473543c28be943695f9f" - integrity sha512-fxOO9LpdntWzgNZch4cZB6QL0u+jEw0NqsNahKcGBbiJaS0GNGLRrT2LUd/Djc6O8HWkQguPLcquVT5eHq2h9g== +"@suttyweb/editor@^0.1.26": + version "0.1.26" + resolved "https://registry.yarnpkg.com/@suttyweb/editor/-/editor-0.1.26.tgz#ba59db20bd6faa7b43d44b764c0bc7b25f461e06" + integrity sha512-nT1DaQjaPBwVG4FofSF0AoiPzIZfAdW6oRX9KOegM99MicvyoBZyItmuGyxl6lv9hpDKa8DwR4W8Cd5ZAD6S7w== dependencies: + "@floating-ui/dom" "^1.5.1" + linkifyjs "^4.1.1" prosemirror-svelte-nodeview "^1.0.2" "@types/caseless@*": @@ -5190,6 +5212,11 @@ linkify-it@^2.0.0: dependencies: uc.micro "^1.0.1" +linkifyjs@^4.1.1: + version "4.1.3" + resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-4.1.3.tgz#0edbc346428a7390a23ea2e5939f76112c9ae07f" + integrity sha512-auMesunaJ8yfkHvK4gfg1K0SaKX/6Wn9g2Aac/NwX+l5VdmFZzo/hdPGxEOETj+ryRa4/fiOPjeeKURSAJx1sg== + loader-runner@^2.4.0: version "2.4.0" resolved "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz" From 14c5530b501edd114828d0ec0b8b0541da0b9ff1 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 22 Apr 2024 11:06:25 -0300 Subject: [PATCH 35/39] feat: editor 0.1.27 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 480f3d0b..2bff3159 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@rails/activestorage": "^6.1.3-1", "@rails/ujs": "^6.1.3-1", "@rails/webpacker": "5.4.4", - "@suttyweb/editor": "^0.1.26", + "@suttyweb/editor": "^0.1.27", "babel-loader": "^8.2.2", "chart.js": "^3.5.1", "chartkick": "^4.0.5", From 044b14c355c3d50a11dfdd935b31894dce1b7713 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 22 Apr 2024 11:15:09 -0300 Subject: [PATCH 36/39] fixup! feat: editor 0.1.27 --- yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 69cf4edf..7e1d597c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1975,10 +1975,10 @@ resolved "https://registry.npmjs.org/@stimulus/webpack-helpers/-/webpack-helpers-1.1.1.tgz" integrity sha512-XOkqSw53N9072FLHvpLM25PIwy+ndkSSbnTtjKuyzsv8K5yfkFB2rv68jU1pzqYa9FZLcvZWP4yazC0V38dx9A== -"@suttyweb/editor@^0.1.26": - version "0.1.26" - resolved "https://registry.yarnpkg.com/@suttyweb/editor/-/editor-0.1.26.tgz#ba59db20bd6faa7b43d44b764c0bc7b25f461e06" - integrity sha512-nT1DaQjaPBwVG4FofSF0AoiPzIZfAdW6oRX9KOegM99MicvyoBZyItmuGyxl6lv9hpDKa8DwR4W8Cd5ZAD6S7w== +"@suttyweb/editor@^0.1.27": + version "0.1.27" + resolved "https://registry.yarnpkg.com/@suttyweb/editor/-/editor-0.1.27.tgz#9415a0b767e72dbe4fbf42ce87e62fb8f5125c31" + integrity sha512-Ts9TZtGiRIaHm+ffVBRl+/nuVcANWZNtFsrGacoajgEsagaIyA1cq8qjiNpPoM5ne9vTba3cAaLP04V/uEIhBw== dependencies: "@floating-ui/dom" "^1.5.1" linkifyjs "^4.1.1" From 8de05ccce6d2d7e9cfc8e509350bc0d6d1675311 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 22 Apr 2024 14:54:40 -0300 Subject: [PATCH 37/39] fix: solo permitir los mismos tipos de archivo que jekyll closes #16117 --- app/lib/jekyll/readers/data_reader_decorator.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/lib/jekyll/readers/data_reader_decorator.rb b/app/lib/jekyll/readers/data_reader_decorator.rb index 9fed7ac7..2a2a8fc2 100644 --- a/app/lib/jekyll/readers/data_reader_decorator.rb +++ b/app/lib/jekyll/readers/data_reader_decorator.rb @@ -14,6 +14,8 @@ module Jekyll extend ActiveSupport::Concern included do + DATA_EXTENSIONS = %w[.yaml .yml .json .csv .tsv].freeze + def read_data_to(dir, data) return unless File.directory?(dir) && !@entry_filter.symlink?(dir) @@ -24,7 +26,7 @@ module Jekyll if File.directory?(path) read_data_to(path, data[sanitize_filename(entry)] = {}) - else + elsif DATA_EXTENSIONS.include?(File.extname(entry)) key = sanitize_filename(File.basename(entry, ".*")) data[key] = read_data_file(path) end From 5f0672bcaebd1d68d81738c9d74f4275eb6866b9 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 30 Apr 2024 17:44:33 -0300 Subject: [PATCH 38/39] =?UTF-8?q?feat:=20recargar=20el=20bot=C3=B3n=20de?= =?UTF-8?q?=20publicar=20por=20separado=20#16180?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/sites_controller.rb | 6 ++++++ app/policies/site_policy.rb | 4 ++++ app/views/posts/index.haml | 1 + app/views/sites/_build.haml | 17 +++++++++-------- app/views/sites/_status.haml | 4 +--- app/views/sites/build.haml | 1 + config/routes.rb | 1 + 7 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 app/views/sites/build.haml diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index 49527cf7..e911daac 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -22,6 +22,12 @@ class SitesController < ApplicationController render('sites/status', layout: false) if stale? site end + def button + authorize site + + render('sites/build', layout: false) + end + # No tenemos propiedades de un sitio aún, así que vamos al listado de # artículos def show diff --git a/app/policies/site_policy.rb b/app/policies/site_policy.rb index d5465d6b..ce56a2e7 100644 --- a/app/policies/site_policy.rb +++ b/app/policies/site_policy.rb @@ -61,6 +61,10 @@ class SitePolicy show? && usuarie? end + def button? + show? + end + def enqueue? build? end diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 29f6471f..3ea82309 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -3,6 +3,7 @@ = render 'sites/header', site: @site = render 'sites/status', site: @site + = render 'sites/build', site: @site, class: 'btn-block' %h3= t('posts.new') %table.table.table-sm.mb-3 diff --git a/app/views/sites/_build.haml b/app/views/sites/_build.haml index c723a3ac..8db4d370 100644 --- a/app/views/sites/_build.haml +++ b/app/views/sites/_build.haml @@ -1,9 +1,10 @@ - if policy(site).build? - = form_tag site_enqueue_path(site), - method: :post, - class: 'form-inline inline' do - = submit_tag site.enqueued? ? t('sites.enqueued') : t('sites.enqueue'), - class: "btn btn-secondary #{local_assigns[:class]}", - title: site.enqueued? ? t('help.sites.enqueued') : t('help.sites.enqueue'), - data: { disable_with: t('sites.enqueued') }, - disabled: !site.waiting? + %div{ 'hx-get': site_button_path(site, class: local_assigns[:class]), 'hx-trigger': 'every 10s', 'hx-swap': 'outerHTML' } + = form_tag site_enqueue_path(site), + method: :post, + class: 'form-inline inline' do + = submit_tag site.enqueued? ? t('sites.enqueued') : t('sites.enqueue'), + class: "btn btn-secondary #{local_assigns[:class]}", + title: site.enqueued? ? t('help.sites.enqueued') : t('help.sites.enqueue'), + data: { disable_with: t('sites.enqueued') }, + disabled: !site.waiting? diff --git a/app/views/sites/_status.haml b/app/views/sites/_status.haml index 9ac27c15..a3dfd4ad 100644 --- a/app/views/sites/_status.haml +++ b/app/views/sites/_status.haml @@ -18,9 +18,7 @@ - message = t('.available') - link = true - -# TODO: Calcular cada cuanto sería óptimo recargar + -# TODO: Calcular cada cuánto sería óptimo recargar %div{ 'hx-get': site_status_path(site), 'hx-trigger': 'every 10s', 'hx-swap': 'outerHTML' } = render 'bootstrap/alert' do = link_to_if link, message.html_safe, site_build_stats_path(site), class: 'alert-link' - - = render 'sites/build', site: site, class: 'btn-block' diff --git a/app/views/sites/build.haml b/app/views/sites/build.haml new file mode 100644 index 00000000..c2becec0 --- /dev/null +++ b/app/views/sites/build.haml @@ -0,0 +1 @@ += render 'sites/build', site: @site, class: params.permit(:class)[:class] diff --git a/config/routes.rb b/config/routes.rb index 557439e9..d97611fd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -38,6 +38,7 @@ Rails.application.routes.draw do post 'pull', to: 'sites#merge' get 'status', to: 'sites#status' + get 'button', to: 'sites#button' # Gestionar usuaries get 'usuaries/invite', to: 'usuaries#invite' From 79be9538bb8ccf9350e5e4cb71150e92440fdcb6 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 30 Apr 2024 17:45:33 -0300 Subject: [PATCH 39/39] fix: ignorar los errores de abort de htmx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit el problema es que cuando se envía un abort a htmx, se loguea un mensaje de todas formas. closes #15880 closes #15881 closes #15883 closes #15884 closes #15893 closes #15894 closes #15973 closes #15974 closes #15975 closes #16003 closes #16004 closes #16015 closes #16016 closes #16023 closes #16024 closes #16050 closes #16051 closes #16063 closes #16064 closes #16073 closes #16074 closes #16116 closes #16125 closes #16126 --- app/javascript/packs/application.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index d8ff0dd1..e10e2b5d 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -9,9 +9,16 @@ try { host: window.env.PANEL_URL }); + const ignoredErrors = ["htmx:afterRequest", "htmx:sendAbort"]; + console.originalError = console.error; console.error = (...e) => { - window.airbrake.notify(e.join(" ")); + const msg = e.join(" "); + + if (!ignoredErrors.some(x => msg.includes(x))) { + window.airbrake.notify(e.join(" ")); + } + return console.originalError(...e); }; } catch(e) {