mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 18:16:21 +00:00
usar métodos del sitio
This commit is contained in:
parent
7c7ae2f750
commit
3a32422e26
1 changed files with 16 additions and 10 deletions
|
@ -103,23 +103,29 @@ class StatsController < ApplicationController
|
|||
|
||||
# TODO: Eliminar cuando mergeemos referer-origin
|
||||
def hostnames
|
||||
@hostnames ||= [@site.hostname, @site.alternative_hostnames].flatten
|
||||
@hostnames ||= site.hostnames
|
||||
end
|
||||
|
||||
# Normalizar las URLs
|
||||
#
|
||||
# @return [Array]
|
||||
def normalized_urls
|
||||
@normalized_urls ||= params.permit(:urls).try(:[],
|
||||
:urls)&.split("\n")&.map(&:strip)&.select(&:present?)&.select do |uri|
|
||||
uri.start_with? 'https://'
|
||||
end&.map do |u|
|
||||
# XXX: Eliminar
|
||||
# @see {https://0xacab.org/sutty/containers/nginx/-/merge_requests/1}
|
||||
next u unless u.end_with? '/'
|
||||
@normalized_urls ||=
|
||||
begin
|
||||
urls = params.permit(:urls).try(:[], :urls)&.split("\n")&.map(&:strip)&.select(&:present?)&.select do |uri|
|
||||
uri.start_with? 'https://'
|
||||
end
|
||||
|
||||
"#{u}index.html"
|
||||
end&.uniq || [@site.url, @site.urls].flatten.uniq
|
||||
urls ||= [site.url]
|
||||
|
||||
urls.map do |u|
|
||||
# XXX: Eliminar al deployear
|
||||
# @see {https://0xacab.org/sutty/containers/nginx/-/merge_requests/1}
|
||||
next u unless u.end_with? '/'
|
||||
|
||||
"#{u}index.html"
|
||||
end.uniq
|
||||
end
|
||||
end
|
||||
|
||||
def normalized_paths
|
||||
|
|
Loading…
Reference in a new issue