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:
parent
b6a2e30d03
commit
529f4140ea
1 changed files with 11 additions and 0 deletions
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue