mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
21 lines
522 B
Ruby
21 lines
522 B
Ruby
module Api
|
|
module Internal
|
|
class ApplicationController < ActionController::API
|
|
include ActionController::HttpAuthentication::Token::ControllerMethods
|
|
|
|
before_action :authenticate!
|
|
|
|
private
|
|
|
|
def authenticate!
|
|
res = authenticate_with_http_token do |token, _|
|
|
ENV["INTERNAL_API_KEYS"]&.split(",")&.include?(token)
|
|
end
|
|
unless res
|
|
redirect_to "https://www.youtube.com/watch?v=dQw4w9WgXcQ", allow_other_host: true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|