5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2025-02-23 23:21:48 +00:00

feat: ignorar sitios de testing también

This commit is contained in:
f 2024-12-28 16:38:03 -03:00
parent b6a2e30d03
commit 529f4140ea
No known key found for this signature in database

View file

@ -5,6 +5,7 @@ module Api
# API para sitios
class SitesController < BaseController
SUBDOMAIN = ".#{Site.domain}"
TESTING_SUBDOMAIN = ".testing.#{Site.domain}"
PARTS = Site.domain.split('.').count
if Rails.env.production?
@ -18,6 +19,8 @@ module Api
canonicalize name
end.reject do |name|
subdomain? name
end.reject do |name|
testing? name
end.uniq
render json: all_names
@ -43,6 +46,14 @@ module Api
name.end_with?(SUBDOMAIN) && name.split('.').count == (PARTS + 1)
end
# Es un dominio de prueba
#
# @param name [String]
# @return [Bool]
def testing?(name)
name.end_with?(TESTING_SUBDOMAIN) && name.split('.').count == (PARTS + 2)
end
# Nombres de los sitios
#
# @param name [String]