2020-04-28 12:48:03 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Handle requests originated by indexer bots of social networks
|
2016-07-28 17:44:58 +02:00
|
|
|
class SocialBotController < ActionController::Base
|
|
|
|
def share
|
|
|
|
case request.original_fullpath
|
2020-04-28 12:48:03 +02:00
|
|
|
when %r{(=%2F|/)projects(%2F|/)([\-0-9a-z_]+)}
|
|
|
|
@project = Project.friendly.find(Regexp.last_match(3).to_s)
|
|
|
|
render :project, status: :ok
|
|
|
|
when %r{(=%2F|/)events(%2F|/)([0-9]+)}
|
|
|
|
@event = Event.find(Regexp.last_match(3).to_s.to_i)
|
|
|
|
render :event, status: :ok
|
|
|
|
when %r{(=%2F|/)trainings(%2F|/)([\-0-9a-z_]+)}
|
|
|
|
@training = Training.friendly.find(Regexp.last_match(3).to_s)
|
2018-01-09 15:09:48 +01:00
|
|
|
render :training, status: :ok
|
2020-04-28 12:48:03 +02:00
|
|
|
else
|
2022-07-26 17:27:33 +02:00
|
|
|
Rails.logger.warn "unknown bot request : #{request.original_url}"
|
2016-07-28 17:44:58 +02:00
|
|
|
end
|
|
|
|
end
|
2020-12-02 14:28:41 +01:00
|
|
|
end
|