mirror of
https://0xacab.org/sutty/sutty
synced 2025-03-14 21:08:18 +00:00
refactor: filtrar la lista completa
This commit is contained in:
parent
cfc016c1c6
commit
a0e6a985b2
1 changed files with 12 additions and 15 deletions
|
@ -14,7 +14,13 @@ 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.concat(alternative_names).concat(api_names).concat(www_names)
|
all_names = sites_names.concat(alternative_names).concat(api_names).concat(www_names).uniq.map do |name|
|
||||||
|
canonicalize name
|
||||||
|
end.reject do |name|
|
||||||
|
subdomain? name
|
||||||
|
end.uniq
|
||||||
|
|
||||||
|
render json: all_names
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -38,23 +44,18 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
# Nombres de los sitios
|
# Nombres de los sitios
|
||||||
|
#
|
||||||
|
# @param name [String]
|
||||||
|
# @return [Array<String>]
|
||||||
def sites_names
|
def sites_names
|
||||||
Site.all.order(:name).pluck(:name).map do |name|
|
Site.all.order(:name).pluck(:name)
|
||||||
canonicalize name
|
|
||||||
end.reject do |name|
|
|
||||||
subdomain? name
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Dominios alternativos
|
# Dominios alternativos
|
||||||
#
|
#
|
||||||
# @return [Array<String>]
|
# @return [Array<String>]
|
||||||
def alternative_names
|
def alternative_names
|
||||||
hostname_of(DeployAlternativeDomain.all).concat(hostname_of(DeployLocalizedDomain)).map do |name|
|
hostname_of(DeployAlternativeDomain.all).concat(hostname_of(DeployLocalizedDomain))
|
||||||
canonicalize name
|
|
||||||
end.reject do |name|
|
|
||||||
subdomain? name
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Obtener todos los sitios con API habilitada, es decir formulario
|
# Obtener todos los sitios con API habilitada, es decir formulario
|
||||||
|
@ -66,10 +67,6 @@ module Api
|
||||||
.or(Site.where(colaboracion_anonima: true))
|
.or(Site.where(colaboracion_anonima: true))
|
||||||
.pluck(:name).map do |name|
|
.pluck(:name).map do |name|
|
||||||
"api.#{name}"
|
"api.#{name}"
|
||||||
end.map do |name|
|
|
||||||
canonicalize name
|
|
||||||
end.reject do |name|
|
|
||||||
subdomain? name
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue