mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 12:21:43 +00:00
centralizar la forma en que se obtienen los hostnames
relacionado con !50
This commit is contained in:
parent
47a74b5848
commit
298fd5bed1
2 changed files with 24 additions and 22 deletions
|
@ -26,7 +26,7 @@ class UriCollectionJob < PeriodicJob
|
||||||
name = 'host|uri'
|
name = 'host|uri'
|
||||||
beginning = beginning_of_interval
|
beginning = beginning_of_interval
|
||||||
|
|
||||||
hostnames.each do |host|
|
site.hostnames.each do |host|
|
||||||
break if stop?
|
break if stop?
|
||||||
|
|
||||||
uris.each do |uri|
|
uris.each do |uri|
|
||||||
|
@ -102,26 +102,6 @@ class UriCollectionJob < PeriodicJob
|
||||||
@destination ||= site.deploys.find_by(type: 'DeployLocal').destination
|
@destination ||= site.deploys.find_by(type: 'DeployLocal').destination
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: Cambiar al mergear origin-referer
|
|
||||||
#
|
|
||||||
# @return [Array]
|
|
||||||
def hostnames
|
|
||||||
@hostnames ||= site.deploys.map do |deploy|
|
|
||||||
case deploy
|
|
||||||
when DeployLocal
|
|
||||||
site.hostname
|
|
||||||
when DeployWww
|
|
||||||
deploy.fqdn
|
|
||||||
when DeployAlternativeDomain
|
|
||||||
deploy.hostname.dup.tap do |h|
|
|
||||||
h.replace(h.end_with?('.') ? h[0..-2] : "#{h}.#{Site.domain}")
|
|
||||||
end
|
|
||||||
when DeployHiddenService
|
|
||||||
deploy.onion
|
|
||||||
end
|
|
||||||
end.compact
|
|
||||||
end
|
|
||||||
|
|
||||||
# Recolecta todas las URIs menos imágenes
|
# Recolecta todas las URIs menos imágenes
|
||||||
#
|
#
|
||||||
# @return [Array]
|
# @return [Array]
|
||||||
|
|
|
@ -101,6 +101,26 @@ class Site < ApplicationRecord
|
||||||
"https://#{hostname}#{slash ? '/' : ''}"
|
"https://#{hostname}#{slash ? '/' : ''}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TODO: Cambiar al mergear origin-referer
|
||||||
|
#
|
||||||
|
# @return [Array]
|
||||||
|
def hostnames
|
||||||
|
@hostnames ||= deploys.map do |deploy|
|
||||||
|
case deploy
|
||||||
|
when DeployLocal
|
||||||
|
hostname
|
||||||
|
when DeployWww
|
||||||
|
deploy.fqdn
|
||||||
|
when DeployAlternativeDomain
|
||||||
|
deploy.hostname.dup.tap do |h|
|
||||||
|
h.replace(h.end_with?('.') ? h[0..-2] : "#{h}.#{Site.domain}")
|
||||||
|
end
|
||||||
|
when DeployHiddenService
|
||||||
|
deploy.onion
|
||||||
|
end
|
||||||
|
end.compact
|
||||||
|
end
|
||||||
|
|
||||||
# Obtiene los dominios alternativos
|
# Obtiene los dominios alternativos
|
||||||
#
|
#
|
||||||
# @return Array
|
# @return Array
|
||||||
|
@ -123,7 +143,9 @@ class Site < ApplicationRecord
|
||||||
#
|
#
|
||||||
# @return Array
|
# @return Array
|
||||||
def urls(slash: true)
|
def urls(slash: true)
|
||||||
alternative_urls(slash: slash) << url(slash: slash)
|
@urls ||= hostnames.map do |h|
|
||||||
|
"https://#{h}#{slash ? '/' : ''}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def invitade?(usuarie)
|
def invitade?(usuarie)
|
||||||
|
|
Loading…
Reference in a new issue