Simplificar emisión y renovación de certificados
https://0xacab.org/sutty/sutty/-/issues/123#note_299672
This commit is contained in:
parent
aebe48c784
commit
77e583c7cb
1 changed files with 1 additions and 25 deletions
|
@ -9,7 +9,7 @@ module Api
|
||||||
|
|
||||||
# Lista de nombres de dominios a emitir certificados
|
# Lista de nombres de dominios a emitir certificados
|
||||||
def index
|
def index
|
||||||
render json: sites_names + alternative_names + api_names
|
render json: Deploy.all.pluck(:hostname)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sitios con hidden service de Tor
|
# Sitios con hidden service de Tor
|
||||||
|
@ -25,8 +25,6 @@ module Api
|
||||||
# @params [String] name
|
# @params [String] name
|
||||||
# @params [String] onion
|
# @params [String] onion
|
||||||
def add_onion
|
def add_onion
|
||||||
site = Site.find_by(name: params[:name])
|
|
||||||
|
|
||||||
if site
|
if site
|
||||||
usuarie = GitAuthor.new email: "tor@#{Site.domain}", name: 'Tor'
|
usuarie = GitAuthor.new email: "tor@#{Site.domain}", name: 'Tor'
|
||||||
service = SiteService.new site: site, usuarie: usuarie,
|
service = SiteService.new site: site, usuarie: usuarie,
|
||||||
|
@ -36,28 +34,6 @@ module Api
|
||||||
|
|
||||||
head :ok
|
head :ok
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue