mirror of
https://github.com/gitlabhq/gitlabhq.git
synced 2025-07-25 16:00:50 +00:00
21 lines
460 B
Ruby
21 lines
460 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Constraints
|
|
class ActivityPubConstrainer
|
|
def matches?(request)
|
|
accept = header(request)
|
|
mime_types.any? { |m| accept.include?(m) }
|
|
end
|
|
|
|
private
|
|
|
|
def mime_types
|
|
['application/activity+json', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"']
|
|
end
|
|
|
|
def header(request)
|
|
request.headers['Accept'] || request.headers['Content-Type'] || ''
|
|
end
|
|
end
|
|
end
|