mirror of
https://0xacab.org/sutty/sutty
synced 2025-02-23 11:21:50 +00:00
fix: no emitir certificados para subdominios directos
porque ya se hacen por wildcard
This commit is contained in:
parent
e0e01a5445
commit
a833eeb7eb
1 changed files with 11 additions and 3 deletions
|
@ -6,6 +6,8 @@ module Api
|
|||
class SitesController < BaseController
|
||||
http_basic_authenticate_with name: ENV['HTTP_BASIC_USER'],
|
||||
password: ENV['HTTP_BASIC_PASSWORD']
|
||||
SUBDOMAIN = ".#{Site.domain}"
|
||||
PARTS = Site.domain.split('.').count
|
||||
|
||||
# Lista de nombres de dominios a emitir certificados
|
||||
def index
|
||||
|
@ -24,13 +26,17 @@ module Api
|
|||
name.end_with?('.') ? name[0..-2] : "#{name}.#{Site.domain}"
|
||||
end
|
||||
|
||||
# Es un subdominio directo del dominio principal
|
||||
#
|
||||
# @param name [String]
|
||||
# @return [Bool]
|
||||
def subdomain?(name)
|
||||
@@subdomain ||= ".#{Site.domain}"
|
||||
|
||||
name.end_with? @subdomain
|
||||
name.end_with?(SUBDOMAIN) && name.split('.').count == (PARTS + 1)
|
||||
end
|
||||
|
||||
# Dominios alternativos
|
||||
#
|
||||
# @return [Array<String>]
|
||||
def alternative_names
|
||||
hostname_of(DeployAlternativeDomain.all).concat(hostname_of(DeployLocalizedDomain)).map do |name|
|
||||
canonicalize name
|
||||
|
@ -41,6 +47,8 @@ module Api
|
|||
|
||||
# Obtener todos los sitios con API habilitada, es decir formulario
|
||||
# de contacto y/o colaboración anónima.
|
||||
#
|
||||
# @return [Array<String>]
|
||||
def api_names
|
||||
Site.where(contact: true)
|
||||
.or(Site.where(colaboracion_anonima: true))
|
||||
|
|
Loading…
Reference in a new issue