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