From 77e583c7cb6275fc1d3f6fc71efb104036056130 Mon Sep 17 00:00:00 2001 From: f Date: Sun, 8 Aug 2021 21:55:22 -0300 Subject: [PATCH] =?UTF-8?q?Simplificar=20emisi=C3=B3n=20y=20renovaci=C3=B3?= =?UTF-8?q?n=20de=20certificados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://0xacab.org/sutty/sutty/-/issues/123#note_299672 --- app/controllers/api/v1/sites_controller.rb | 26 +--------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/app/controllers/api/v1/sites_controller.rb b/app/controllers/api/v1/sites_controller.rb index 6613dce5..5537d078 100644 --- a/app/controllers/api/v1/sites_controller.rb +++ b/app/controllers/api/v1/sites_controller.rb @@ -9,7 +9,7 @@ module Api # Lista de nombres de dominios a emitir certificados def index - render json: sites_names + alternative_names + api_names + render json: Deploy.all.pluck(:hostname) end # Sitios con hidden service de Tor @@ -25,8 +25,6 @@ module Api # @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, @@ -36,28 +34,6 @@ module Api head :ok end - - private - - # Nombres de los sitios - def sites_names - Site.all.order(:name).pluck(:name) - end - - # Dominios alternativos - def alternative_names - DeployAlternativeDomain.all.map(&:hostname) - end - - # Obtener todos los sitios con API habilitada, es decir formulario - # de contacto y/o colaboración anónima. - # - # TODO: Optimizar - def api_names - Site.where(contact: true) - .or(Site.where(colaboracion_anonima: true)) - .select("'api.' || name as name").map(&:name) - end end end end