5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-17 00:36:22 +00:00

Simplificar emisión y renovación de certificados

https://0xacab.org/sutty/sutty/-/issues/123#note_299672
This commit is contained in:
f 2021-08-08 21:55:22 -03:00
parent aebe48c784
commit 77e583c7cb

View file

@ -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