5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 21:36:21 +00:00
panel/app/controllers/api/v1/sites_controller.rb
2019-09-06 20:41:03 -03:00

24 lines
488 B
Ruby

# frozen_string_literal: true
module Api
module V1
# API para sitios
class SitesController < BaseController
def index
render json: Site.all.order(:name).pluck(:name)
end
# Detecta si se puede generar un certificado
def allowed
name = params[:domain].gsub(/\.#{Site.domain}\Z/, '')
site = Site.find_by(name: name)
if site
head :ok
else
head :not_found
end
end
end
end
end