mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 20:16:22 +00:00
devolver todos los dominios
This commit is contained in:
parent
c9edc86be3
commit
d7f9f0c9b1
1 changed files with 23 additions and 5 deletions
|
@ -9,7 +9,7 @@ module Api
|
|||
|
||||
# Lista de nombres de dominios a emitir certificados
|
||||
def index
|
||||
render json: sites_names + alternative_names + api_names
|
||||
render json: sites_names + alternative_names + api_names + www_names
|
||||
end
|
||||
|
||||
# Sitios con hidden service de Tor
|
||||
|
@ -28,7 +28,7 @@ module Api
|
|||
site = Site.find_by(name: params[:name])
|
||||
|
||||
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,
|
||||
params: params
|
||||
service.add_onion
|
||||
|
@ -39,14 +39,22 @@ module Api
|
|||
|
||||
private
|
||||
|
||||
def canonicalize(name)
|
||||
name.end_with?('.') ? name[0..-2] : "#{name}.#{Site.domain}"
|
||||
end
|
||||
|
||||
# Nombres de los sitios
|
||||
def sites_names
|
||||
Site.all.order(:name).pluck(:name)
|
||||
Site.all.order(:name).pluck(:name).map do |name|
|
||||
canonicalize name
|
||||
end
|
||||
end
|
||||
|
||||
# Dominios alternativos
|
||||
def alternative_names
|
||||
DeployAlternativeDomain.all.map(&:hostname)
|
||||
(DeployAlternativeDomain.all.map(&:hostname) + DeployLocalizedDomain.all.map(&:hostname)).map do |name|
|
||||
canonicalize name
|
||||
end
|
||||
end
|
||||
|
||||
# Obtener todos los sitios con API habilitada, es decir formulario
|
||||
|
@ -56,7 +64,17 @@ module Api
|
|||
def api_names
|
||||
Site.where(contact: true)
|
||||
.or(Site.where(colaboracion_anonima: true))
|
||||
.select("'api.' || name as name").map(&:name)
|
||||
.select("'api.' || name as name").map(&:name).map do |name|
|
||||
canonicalize name
|
||||
end
|
||||
end
|
||||
|
||||
def www_names
|
||||
Site.where(contact: true)
|
||||
.or(Site.where(colaboracion_anonima: true))
|
||||
.select("'www.' || name as name").map(&:name).map do |name|
|
||||
canonicalize name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue