5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-03 18:16:09 +00:00

Merge branch 'issue-13159' into rails
Some checks failed
ci/woodpecker/push/woodpecker/1 Pipeline was successful
ci/woodpecker/push/woodpecker/2 Pipeline failed

This commit is contained in:
f 2024-01-02 15:02:59 -03:00
commit 07f5e1c854
No known key found for this signature in database

View file

@ -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 + www_names render json: alternative_names + api_names + www_names
end end
private private
@ -18,17 +18,16 @@ module Api
name.end_with?('.') ? name[0..-2] : "#{name}.#{Site.domain}" name.end_with?('.') ? name[0..-2] : "#{name}.#{Site.domain}"
end end
# Nombres de los sitios def subdomain?(name)
def sites_names name.end_with? ".#{Site.domain}"
Site.all.order(:name).pluck(:name).map do |name|
canonicalize name
end
end end
# Dominios alternativos # Dominios alternativos
def alternative_names def alternative_names
(DeployAlternativeDomain.all.map(&:hostname) + DeployLocalizedDomain.all.map(&:hostname)).map do |name| (DeployAlternativeDomain.all.map(&:hostname) + DeployLocalizedDomain.all.map(&:hostname)).map do |name|
canonicalize name canonicalize name
end.reject do |name|
subdomain? name
end end
end end
@ -41,6 +40,8 @@ module Api
.or(Site.where(colaboracion_anonima: true)) .or(Site.where(colaboracion_anonima: true))
.select("'api.' || name as name").map(&:name).map do |name| .select("'api.' || name as name").map(&:name).map do |name|
canonicalize name canonicalize name
end.reject do |name|
subdomain? name
end end
end end