mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-25 23:41:37 +01:00
Slightly reduce RAM usage (#7301)
* No need to re-require sidekiq plugins, they are required via Gemfile * Add derailed_benchmarks tool, no need to require TTY gems in Gemfile * Replace ruby-oembed with FetchOEmbedService Reduce startup by 45382 allocated objects * Remove preloaded JSON-LD in favour of caching HTTP responses Reduce boot RAM by about 6 MiB * Fix tests * Fix test suite by stubbing out JSON-LD contexts
This commit is contained in:
parent
71a7cea73f
commit
cb5b5cb5f7
76 changed files with 784 additions and 471 deletions
12
Gemfile
12
Gemfile
|
@ -54,7 +54,7 @@ gem 'httplog', '~> 1.0'
|
||||||
gem 'idn-ruby', require: 'idn'
|
gem 'idn-ruby', require: 'idn'
|
||||||
gem 'kaminari', '~> 1.1'
|
gem 'kaminari', '~> 1.1'
|
||||||
gem 'link_header', '~> 0.0'
|
gem 'link_header', '~> 0.0'
|
||||||
gem 'mime-types', '~> 3.1'
|
gem 'mime-types', '~> 3.1', require: 'mime/types/columnar'
|
||||||
gem 'nokogiri', '~> 1.8'
|
gem 'nokogiri', '~> 1.8'
|
||||||
gem 'nsa', '~> 0.2'
|
gem 'nsa', '~> 0.2'
|
||||||
gem 'oj', '~> 3.5'
|
gem 'oj', '~> 3.5'
|
||||||
|
@ -70,7 +70,6 @@ gem 'rails-settings-cached', '~> 0.6'
|
||||||
gem 'redis', '~> 4.0', require: ['redis', 'redis/connection/hiredis']
|
gem 'redis', '~> 4.0', require: ['redis', 'redis/connection/hiredis']
|
||||||
gem 'mario-redis-lock', '~> 1.2', require: 'redis_lock'
|
gem 'mario-redis-lock', '~> 1.2', require: 'redis_lock'
|
||||||
gem 'rqrcode', '~> 0.10'
|
gem 'rqrcode', '~> 0.10'
|
||||||
gem 'ruby-oembed', '~> 0.12', require: 'oembed'
|
|
||||||
gem 'ruby-progressbar', '~> 1.4'
|
gem 'ruby-progressbar', '~> 1.4'
|
||||||
gem 'sanitize', '~> 4.6'
|
gem 'sanitize', '~> 4.6'
|
||||||
gem 'sidekiq', '~> 5.1'
|
gem 'sidekiq', '~> 5.1'
|
||||||
|
@ -82,14 +81,14 @@ gem 'simple_form', '~> 4.0'
|
||||||
gem 'sprockets-rails', '~> 3.2', require: 'sprockets/railtie'
|
gem 'sprockets-rails', '~> 3.2', require: 'sprockets/railtie'
|
||||||
gem 'stoplight', '~> 2.1.3'
|
gem 'stoplight', '~> 2.1.3'
|
||||||
gem 'strong_migrations', '~> 0.2'
|
gem 'strong_migrations', '~> 0.2'
|
||||||
gem 'tty-command', '~> 0.8'
|
gem 'tty-command', '~> 0.8', require: false
|
||||||
gem 'tty-prompt', '~> 0.16'
|
gem 'tty-prompt', '~> 0.16', require: false
|
||||||
gem 'twitter-text', '~> 1.14'
|
gem 'twitter-text', '~> 1.14'
|
||||||
gem 'tzinfo-data', '~> 1.2018'
|
gem 'tzinfo-data', '~> 1.2018'
|
||||||
gem 'webpacker', '~> 3.4'
|
gem 'webpacker', '~> 3.4'
|
||||||
gem 'webpush'
|
gem 'webpush'
|
||||||
|
|
||||||
gem 'json-ld-preloaded', '~> 2.2'
|
gem 'json-ld', '~> 2.2'
|
||||||
gem 'rdf-normalize', '~> 0.3'
|
gem 'rdf-normalize', '~> 0.3'
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
|
@ -135,6 +134,9 @@ group :development do
|
||||||
gem 'capistrano-rails', '~> 1.3'
|
gem 'capistrano-rails', '~> 1.3'
|
||||||
gem 'capistrano-rbenv', '~> 2.1'
|
gem 'capistrano-rbenv', '~> 2.1'
|
||||||
gem 'capistrano-yarn', '~> 2.0'
|
gem 'capistrano-yarn', '~> 2.0'
|
||||||
|
|
||||||
|
gem 'derailed_benchmarks'
|
||||||
|
gem 'stackprof'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :production do
|
group :production do
|
||||||
|
|
22
Gemfile.lock
22
Gemfile.lock
|
@ -75,6 +75,7 @@ GEM
|
||||||
aws-sigv4 (~> 1.0)
|
aws-sigv4 (~> 1.0)
|
||||||
aws-sigv4 (1.0.2)
|
aws-sigv4 (1.0.2)
|
||||||
bcrypt (3.1.11)
|
bcrypt (3.1.11)
|
||||||
|
benchmark-ips (2.7.2)
|
||||||
better_errors (2.4.0)
|
better_errors (2.4.0)
|
||||||
coderay (>= 1.0.0)
|
coderay (>= 1.0.0)
|
||||||
erubi (>= 1.0.0)
|
erubi (>= 1.0.0)
|
||||||
|
@ -138,6 +139,14 @@ GEM
|
||||||
css_parser (1.6.0)
|
css_parser (1.6.0)
|
||||||
addressable
|
addressable
|
||||||
debug_inspector (0.0.3)
|
debug_inspector (0.0.3)
|
||||||
|
derailed_benchmarks (1.3.4)
|
||||||
|
benchmark-ips (~> 2)
|
||||||
|
get_process_mem (~> 0)
|
||||||
|
heapy (~> 0)
|
||||||
|
memory_profiler (~> 0)
|
||||||
|
rack (>= 1)
|
||||||
|
rake (> 10, < 13)
|
||||||
|
thor (~> 0.19)
|
||||||
devise (4.4.3)
|
devise (4.4.3)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
|
@ -206,6 +215,7 @@ GEM
|
||||||
fuubar (2.3.1)
|
fuubar (2.3.1)
|
||||||
rspec-core (~> 3.0)
|
rspec-core (~> 3.0)
|
||||||
ruby-progressbar (~> 1.4)
|
ruby-progressbar (~> 1.4)
|
||||||
|
get_process_mem (0.2.1)
|
||||||
globalid (0.4.1)
|
globalid (0.4.1)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
goldfinger (2.1.0)
|
goldfinger (2.1.0)
|
||||||
|
@ -226,6 +236,7 @@ GEM
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
hashdiff (0.3.7)
|
hashdiff (0.3.7)
|
||||||
hashie (3.5.7)
|
hashie (3.5.7)
|
||||||
|
heapy (0.1.3)
|
||||||
highline (1.7.10)
|
highline (1.7.10)
|
||||||
hiredis (0.6.1)
|
hiredis (0.6.1)
|
||||||
hitimes (1.2.6)
|
hitimes (1.2.6)
|
||||||
|
@ -264,10 +275,6 @@ GEM
|
||||||
json-ld (2.2.1)
|
json-ld (2.2.1)
|
||||||
multi_json (~> 1.12)
|
multi_json (~> 1.12)
|
||||||
rdf (>= 2.2.8, < 4.0)
|
rdf (>= 2.2.8, < 4.0)
|
||||||
json-ld-preloaded (2.2.3)
|
|
||||||
json-ld (>= 2.2, < 4.0)
|
|
||||||
multi_json (~> 1.12)
|
|
||||||
rdf (>= 2.2, < 4.0)
|
|
||||||
jsonapi-renderer (0.2.0)
|
jsonapi-renderer (0.2.0)
|
||||||
jwt (2.1.0)
|
jwt (2.1.0)
|
||||||
kaminari (1.1.1)
|
kaminari (1.1.1)
|
||||||
|
@ -502,7 +509,6 @@ GEM
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (~> 1.0, >= 1.0.1)
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
||||||
ruby-oembed (0.12.0)
|
|
||||||
ruby-progressbar (1.9.0)
|
ruby-progressbar (1.9.0)
|
||||||
ruby-saml (1.7.2)
|
ruby-saml (1.7.2)
|
||||||
nokogiri (>= 1.5.10)
|
nokogiri (>= 1.5.10)
|
||||||
|
@ -557,6 +563,7 @@ GEM
|
||||||
sshkit (1.16.0)
|
sshkit (1.16.0)
|
||||||
net-scp (>= 1.1.2)
|
net-scp (>= 1.1.2)
|
||||||
net-ssh (>= 2.8.0)
|
net-ssh (>= 2.8.0)
|
||||||
|
stackprof (0.2.11)
|
||||||
statsd-ruby (1.2.1)
|
statsd-ruby (1.2.1)
|
||||||
stoplight (2.1.3)
|
stoplight (2.1.3)
|
||||||
streamio-ffmpeg (3.0.2)
|
streamio-ffmpeg (3.0.2)
|
||||||
|
@ -645,6 +652,7 @@ DEPENDENCIES
|
||||||
chewy (~> 5.0)
|
chewy (~> 5.0)
|
||||||
cld3 (~> 3.2.0)
|
cld3 (~> 3.2.0)
|
||||||
climate_control (~> 0.2)
|
climate_control (~> 0.2)
|
||||||
|
derailed_benchmarks
|
||||||
devise (~> 4.4)
|
devise (~> 4.4)
|
||||||
devise-two-factor (~> 3.0)
|
devise-two-factor (~> 3.0)
|
||||||
devise_pam_authenticatable2 (~> 9.1)
|
devise_pam_authenticatable2 (~> 9.1)
|
||||||
|
@ -668,7 +676,7 @@ DEPENDENCIES
|
||||||
i18n-tasks (~> 0.9)
|
i18n-tasks (~> 0.9)
|
||||||
idn-ruby
|
idn-ruby
|
||||||
iso-639
|
iso-639
|
||||||
json-ld-preloaded (~> 2.2)
|
json-ld (~> 2.2)
|
||||||
kaminari (~> 1.1)
|
kaminari (~> 1.1)
|
||||||
letter_opener (~> 1.4)
|
letter_opener (~> 1.4)
|
||||||
letter_opener_web (~> 1.3)
|
letter_opener_web (~> 1.3)
|
||||||
|
@ -714,7 +722,6 @@ DEPENDENCIES
|
||||||
rspec-retry (~> 0.5)
|
rspec-retry (~> 0.5)
|
||||||
rspec-sidekiq (~> 3.0)
|
rspec-sidekiq (~> 3.0)
|
||||||
rubocop (~> 0.55)
|
rubocop (~> 0.55)
|
||||||
ruby-oembed (~> 0.12)
|
|
||||||
ruby-progressbar (~> 1.4)
|
ruby-progressbar (~> 1.4)
|
||||||
sanitize (~> 4.6)
|
sanitize (~> 4.6)
|
||||||
scss_lint (~> 0.57)
|
scss_lint (~> 0.57)
|
||||||
|
@ -726,6 +733,7 @@ DEPENDENCIES
|
||||||
simple_form (~> 4.0)
|
simple_form (~> 4.0)
|
||||||
simplecov (~> 0.16)
|
simplecov (~> 0.16)
|
||||||
sprockets-rails (~> 3.2)
|
sprockets-rails (~> 3.2)
|
||||||
|
stackprof
|
||||||
stoplight (~> 2.1.3)
|
stoplight (~> 2.1.3)
|
||||||
streamio-ffmpeg (~> 3.0)
|
streamio-ffmpeg (~> 3.0)
|
||||||
strong_migrations (~> 0.2)
|
strong_migrations (~> 0.2)
|
||||||
|
|
|
@ -9,9 +9,12 @@ class Api::Web::EmbedsController < Api::Web::BaseController
|
||||||
status = StatusFinder.new(params[:url]).status
|
status = StatusFinder.new(params[:url]).status
|
||||||
render json: status, serializer: OEmbedSerializer, width: 400
|
render json: status, serializer: OEmbedSerializer, width: 400
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
oembed = OEmbed::Providers.get(params[:url])
|
oembed = FetchOEmbedService.new.call(params[:url])
|
||||||
render json: Oj.dump(oembed.fields)
|
|
||||||
rescue OEmbed::NotFound
|
if oembed
|
||||||
|
render json: oembed
|
||||||
|
else
|
||||||
render json: {}, status: :not_found
|
render json: {}, status: :not_found
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'sidekiq-bulk'
|
|
||||||
|
|
||||||
class Settings::FollowerDomainsController < ApplicationController
|
class Settings::FollowerDomainsController < ApplicationController
|
||||||
layout 'admin'
|
layout 'admin'
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ module JsonLdHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def canonicalize(json)
|
def canonicalize(json)
|
||||||
graph = RDF::Graph.new << JSON::LD::API.toRdf(json)
|
graph = RDF::Graph.new << JSON::LD::API.toRdf(json, documentLoader: method(:load_jsonld_context))
|
||||||
graph.dump(:normalize)
|
graph.dump(:normalize)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -90,4 +90,19 @@ module JsonLdHelper
|
||||||
request.add_headers('Accept' => 'application/activity+json, application/ld+json')
|
request.add_headers('Accept' => 'application/activity+json, application/ld+json')
|
||||||
request
|
request
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def load_jsonld_context(url, _options = {}, &_block)
|
||||||
|
json = Rails.cache.fetch("jsonld:context:#{url}", expires_in: 30.days, raw: true) do
|
||||||
|
request = Request.new(:get, url)
|
||||||
|
request.add_headers('Accept' => 'application/ld+json')
|
||||||
|
|
||||||
|
request.perform do |res|
|
||||||
|
raise JSON::LD::JsonLdError::LoadingDocumentFailed unless res.code == 200 && res.mime_type == 'application/ld+json'
|
||||||
|
res.body_with_limit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
doc = JSON::LD::API::RemoteDocument.new(url, json)
|
||||||
|
block_given? ? yield(doc) : doc
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class ProviderDiscovery < OEmbed::ProviderDiscovery
|
|
||||||
class << self
|
|
||||||
def get(url, **options)
|
|
||||||
provider = discover_provider(url, options)
|
|
||||||
|
|
||||||
options.delete(:html)
|
|
||||||
|
|
||||||
provider.get(url, options)
|
|
||||||
end
|
|
||||||
|
|
||||||
def discover_provider(url, **options)
|
|
||||||
format = options[:format]
|
|
||||||
|
|
||||||
html = if options[:html]
|
|
||||||
Nokogiri::HTML(options[:html])
|
|
||||||
else
|
|
||||||
Request.new(:get, url).perform do |res|
|
|
||||||
raise OEmbed::NotFound, url if res.code != 200 || res.mime_type != 'text/html'
|
|
||||||
Nokogiri::HTML(res.body_with_limit)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if format.nil? || format == :json
|
|
||||||
provider_endpoint ||= html.at_xpath('//link[@type="application/json+oembed"]')&.attribute('href')&.value
|
|
||||||
format ||= :json if provider_endpoint
|
|
||||||
end
|
|
||||||
|
|
||||||
if format.nil? || format == :xml
|
|
||||||
provider_endpoint ||= html.at_xpath('//link[@type="text/xml+oembed"]')&.attribute('href')&.value
|
|
||||||
format ||= :xml if provider_endpoint
|
|
||||||
end
|
|
||||||
|
|
||||||
raise OEmbed::NotFound, url if provider_endpoint.nil?
|
|
||||||
begin
|
|
||||||
provider_endpoint = Addressable::URI.parse(provider_endpoint)
|
|
||||||
provider_endpoint.query = nil
|
|
||||||
provider_endpoint = provider_endpoint.to_s
|
|
||||||
rescue Addressable::URI::InvalidURIError
|
|
||||||
raise OEmbed::NotFound, url
|
|
||||||
end
|
|
||||||
|
|
||||||
OEmbed::Provider.new(provider_endpoint, format)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'sidekiq-bulk'
|
|
||||||
|
|
||||||
class FanOutOnWriteService < BaseService
|
class FanOutOnWriteService < BaseService
|
||||||
# Push a status into home and mentions feeds
|
# Push a status into home and mentions feeds
|
||||||
# @param [Status] status
|
# @param [Status] status
|
||||||
|
|
|
@ -85,42 +85,40 @@ class FetchLinkCardService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def attempt_oembed
|
def attempt_oembed
|
||||||
embed = OEmbed::Providers.get(@url, html: @html)
|
embed = FetchOEmbedService.new.call(@url, html: @html)
|
||||||
|
|
||||||
return false unless embed.respond_to?(:type)
|
return false if embed.nil?
|
||||||
|
|
||||||
@card.type = embed.type
|
@card.type = embed[:type]
|
||||||
@card.title = embed.respond_to?(:title) ? embed.title : ''
|
@card.title = embed[:title] || ''
|
||||||
@card.author_name = embed.respond_to?(:author_name) ? embed.author_name : ''
|
@card.author_name = embed[:author_name] || ''
|
||||||
@card.author_url = embed.respond_to?(:author_url) ? embed.author_url : ''
|
@card.author_url = embed[:author_url] || ''
|
||||||
@card.provider_name = embed.respond_to?(:provider_name) ? embed.provider_name : ''
|
@card.provider_name = embed[:provider_name] || ''
|
||||||
@card.provider_url = embed.respond_to?(:provider_url) ? embed.provider_url : ''
|
@card.provider_url = embed[:provider_url] || ''
|
||||||
@card.width = 0
|
@card.width = 0
|
||||||
@card.height = 0
|
@card.height = 0
|
||||||
|
|
||||||
case @card.type
|
case @card.type
|
||||||
when 'link'
|
when 'link'
|
||||||
@card.image_remote_url = embed.thumbnail_url if embed.respond_to?(:thumbnail_url)
|
@card.image_remote_url = embed[:thumbnail_url] if embed[:thumbnail_url].present?
|
||||||
when 'photo'
|
when 'photo'
|
||||||
return false unless embed.respond_to?(:url)
|
return false if embed[:url].blank?
|
||||||
|
|
||||||
@card.embed_url = embed.url
|
@card.embed_url = embed[:url]
|
||||||
@card.image_remote_url = embed.url
|
@card.image_remote_url = embed[:url]
|
||||||
@card.width = embed.width.presence || 0
|
@card.width = embed[:width].presence || 0
|
||||||
@card.height = embed.height.presence || 0
|
@card.height = embed[:height].presence || 0
|
||||||
when 'video'
|
when 'video'
|
||||||
@card.width = embed.width.presence || 0
|
@card.width = embed[:width].presence || 0
|
||||||
@card.height = embed.height.presence || 0
|
@card.height = embed[:height].presence || 0
|
||||||
@card.html = Formatter.instance.sanitize(embed.html, Sanitize::Config::MASTODON_OEMBED)
|
@card.html = Formatter.instance.sanitize(embed[:html], Sanitize::Config::MASTODON_OEMBED)
|
||||||
@card.image_remote_url = embed.thumbnail_url if embed.respond_to?(:thumbnail_url)
|
@card.image_remote_url = embed[:thumbnail_url] if embed[:thumbnail_url].present?
|
||||||
when 'rich'
|
when 'rich'
|
||||||
# Most providers rely on <script> tags, which is a no-no
|
# Most providers rely on <script> tags, which is a no-no
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@card.save_with_optional_image!
|
@card.save_with_optional_image!
|
||||||
rescue OEmbed::NotFound
|
|
||||||
false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def attempt_opengraph
|
def attempt_opengraph
|
||||||
|
|
71
app/services/fetch_oembed_service.rb
Normal file
71
app/services/fetch_oembed_service.rb
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class FetchOEmbedService
|
||||||
|
attr_reader :url, :options, :format, :endpoint_url
|
||||||
|
|
||||||
|
def call(url, options = {})
|
||||||
|
@url = url
|
||||||
|
@options = options
|
||||||
|
|
||||||
|
discover_endpoint!
|
||||||
|
fetch!
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def discover_endpoint!
|
||||||
|
return if html.nil?
|
||||||
|
|
||||||
|
@format = @options[:format]
|
||||||
|
page = Nokogiri::HTML(html)
|
||||||
|
|
||||||
|
if @format.nil? || @format == :json
|
||||||
|
@endpoint_url ||= page.at_xpath('//link[@type="application/json+oembed"]')&.attribute('href')&.value
|
||||||
|
@format ||= :json if @endpoint_url
|
||||||
|
end
|
||||||
|
|
||||||
|
if @format.nil? || @format == :xml
|
||||||
|
@endpoint_url ||= page.at_xpath('//link[@type="text/xml+oembed"]')&.attribute('href')&.value
|
||||||
|
@format ||= :xml if @endpoint_url
|
||||||
|
end
|
||||||
|
|
||||||
|
return if @endpoint_url.blank?
|
||||||
|
|
||||||
|
@endpoint_url = Addressable::URI.parse(@endpoint_url).to_s
|
||||||
|
rescue Addressable::URI::InvalidURIError
|
||||||
|
@endpoint_url = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def fetch!
|
||||||
|
return if @endpoint_url.blank?
|
||||||
|
|
||||||
|
body = Request.new(:get, @endpoint_url).perform do |res|
|
||||||
|
res.code != 200 ? nil : res.body_with_limit
|
||||||
|
end
|
||||||
|
|
||||||
|
validate(parse_for_format(body)) unless body.nil?
|
||||||
|
rescue Oj::ParseError, Ox::ParseError
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse_for_format(body)
|
||||||
|
case @format
|
||||||
|
when :json
|
||||||
|
Oj.load(body, mode: :strict)&.with_indifferent_access
|
||||||
|
when :xml
|
||||||
|
Ox.load(body, mode: :hash_no_attrs)&.with_indifferent_access&.dig(:oembed)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def validate(oembed)
|
||||||
|
oembed if oembed[:version] == '1.0' && oembed[:type].present?
|
||||||
|
end
|
||||||
|
|
||||||
|
def html
|
||||||
|
return @html if defined?(@html)
|
||||||
|
|
||||||
|
@html = @options[:html] || Request.new(:get, @url).perform do |res|
|
||||||
|
res.code != 200 || res.mime_type != 'text/html' ? nil : res.body_with_limit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,5 +1,4 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'sidekiq-scheduler'
|
|
||||||
|
|
||||||
class Scheduler::BackupCleanupScheduler
|
class Scheduler::BackupCleanupScheduler
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'sidekiq-scheduler'
|
|
||||||
|
|
||||||
class Scheduler::DoorkeeperCleanupScheduler
|
class Scheduler::DoorkeeperCleanupScheduler
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'sidekiq-scheduler'
|
|
||||||
|
|
||||||
class Scheduler::EmailScheduler
|
class Scheduler::EmailScheduler
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'sidekiq-scheduler'
|
|
||||||
|
|
||||||
class Scheduler::FeedCleanupScheduler
|
class Scheduler::FeedCleanupScheduler
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'sidekiq-scheduler'
|
|
||||||
|
|
||||||
class Scheduler::IpCleanupScheduler
|
class Scheduler::IpCleanupScheduler
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'sidekiq-scheduler'
|
|
||||||
|
|
||||||
class Scheduler::MediaCleanupScheduler
|
class Scheduler::MediaCleanupScheduler
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'sidekiq-scheduler'
|
|
||||||
|
|
||||||
class Scheduler::SubscriptionsCleanupScheduler
|
class Scheduler::SubscriptionsCleanupScheduler
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'sidekiq-scheduler'
|
|
||||||
require 'sidekiq-bulk'
|
|
||||||
|
|
||||||
class Scheduler::SubscriptionsScheduler
|
class Scheduler::SubscriptionsScheduler
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'sidekiq-scheduler'
|
|
||||||
|
|
||||||
class Scheduler::UserCleanupScheduler
|
class Scheduler::UserCleanupScheduler
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'sidekiq-bulk'
|
|
||||||
|
|
||||||
class SoftBlockDomainFollowersWorker
|
class SoftBlockDomainFollowersWorker
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require_relative '../../lib/json_ld/identity'
|
|
||||||
require_relative '../../lib/json_ld/security'
|
|
||||||
require_relative '../../lib/json_ld/activitystreams'
|
|
|
@ -1,4 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require_relative '../../app/lib/provider_discovery'
|
|
||||||
OEmbed::Providers.register_fallback(ProviderDiscovery)
|
|
|
@ -1,153 +0,0 @@
|
||||||
# -*- encoding: utf-8 -*-
|
|
||||||
# frozen_string_literal: true
|
|
||||||
# This file generated automatically from https://www.w3.org/ns/activitystreams
|
|
||||||
require 'json/ld'
|
|
||||||
class JSON::LD::Context
|
|
||||||
add_preloaded("https://www.w3.org/ns/activitystreams") do
|
|
||||||
new(vocab: "_:", processingMode: "json-ld-1.0", term_definitions: {
|
|
||||||
"Accept" => TermDefinition.new("Accept", id: "https://www.w3.org/ns/activitystreams#Accept", simple: true),
|
|
||||||
"Activity" => TermDefinition.new("Activity", id: "https://www.w3.org/ns/activitystreams#Activity", simple: true),
|
|
||||||
"Add" => TermDefinition.new("Add", id: "https://www.w3.org/ns/activitystreams#Add", simple: true),
|
|
||||||
"Announce" => TermDefinition.new("Announce", id: "https://www.w3.org/ns/activitystreams#Announce", simple: true),
|
|
||||||
"Application" => TermDefinition.new("Application", id: "https://www.w3.org/ns/activitystreams#Application", simple: true),
|
|
||||||
"Arrive" => TermDefinition.new("Arrive", id: "https://www.w3.org/ns/activitystreams#Arrive", simple: true),
|
|
||||||
"Article" => TermDefinition.new("Article", id: "https://www.w3.org/ns/activitystreams#Article", simple: true),
|
|
||||||
"Audio" => TermDefinition.new("Audio", id: "https://www.w3.org/ns/activitystreams#Audio", simple: true),
|
|
||||||
"Block" => TermDefinition.new("Block", id: "https://www.w3.org/ns/activitystreams#Block", simple: true),
|
|
||||||
"Collection" => TermDefinition.new("Collection", id: "https://www.w3.org/ns/activitystreams#Collection", simple: true),
|
|
||||||
"CollectionPage" => TermDefinition.new("CollectionPage", id: "https://www.w3.org/ns/activitystreams#CollectionPage", simple: true),
|
|
||||||
"Create" => TermDefinition.new("Create", id: "https://www.w3.org/ns/activitystreams#Create", simple: true),
|
|
||||||
"Delete" => TermDefinition.new("Delete", id: "https://www.w3.org/ns/activitystreams#Delete", simple: true),
|
|
||||||
"Dislike" => TermDefinition.new("Dislike", id: "https://www.w3.org/ns/activitystreams#Dislike", simple: true),
|
|
||||||
"Document" => TermDefinition.new("Document", id: "https://www.w3.org/ns/activitystreams#Document", simple: true),
|
|
||||||
"Event" => TermDefinition.new("Event", id: "https://www.w3.org/ns/activitystreams#Event", simple: true),
|
|
||||||
"Flag" => TermDefinition.new("Flag", id: "https://www.w3.org/ns/activitystreams#Flag", simple: true),
|
|
||||||
"Follow" => TermDefinition.new("Follow", id: "https://www.w3.org/ns/activitystreams#Follow", simple: true),
|
|
||||||
"Group" => TermDefinition.new("Group", id: "https://www.w3.org/ns/activitystreams#Group", simple: true),
|
|
||||||
"Ignore" => TermDefinition.new("Ignore", id: "https://www.w3.org/ns/activitystreams#Ignore", simple: true),
|
|
||||||
"Image" => TermDefinition.new("Image", id: "https://www.w3.org/ns/activitystreams#Image", simple: true),
|
|
||||||
"IntransitiveActivity" => TermDefinition.new("IntransitiveActivity", id: "https://www.w3.org/ns/activitystreams#IntransitiveActivity", simple: true),
|
|
||||||
"Invite" => TermDefinition.new("Invite", id: "https://www.w3.org/ns/activitystreams#Invite", simple: true),
|
|
||||||
"IsContact" => TermDefinition.new("IsContact", id: "https://www.w3.org/ns/activitystreams#IsContact", simple: true),
|
|
||||||
"IsFollowedBy" => TermDefinition.new("IsFollowedBy", id: "https://www.w3.org/ns/activitystreams#IsFollowedBy", simple: true),
|
|
||||||
"IsFollowing" => TermDefinition.new("IsFollowing", id: "https://www.w3.org/ns/activitystreams#IsFollowing", simple: true),
|
|
||||||
"IsMember" => TermDefinition.new("IsMember", id: "https://www.w3.org/ns/activitystreams#IsMember", simple: true),
|
|
||||||
"Join" => TermDefinition.new("Join", id: "https://www.w3.org/ns/activitystreams#Join", simple: true),
|
|
||||||
"Leave" => TermDefinition.new("Leave", id: "https://www.w3.org/ns/activitystreams#Leave", simple: true),
|
|
||||||
"Like" => TermDefinition.new("Like", id: "https://www.w3.org/ns/activitystreams#Like", simple: true),
|
|
||||||
"Link" => TermDefinition.new("Link", id: "https://www.w3.org/ns/activitystreams#Link", simple: true),
|
|
||||||
"Listen" => TermDefinition.new("Listen", id: "https://www.w3.org/ns/activitystreams#Listen", simple: true),
|
|
||||||
"Mention" => TermDefinition.new("Mention", id: "https://www.w3.org/ns/activitystreams#Mention", simple: true),
|
|
||||||
"Move" => TermDefinition.new("Move", id: "https://www.w3.org/ns/activitystreams#Move", simple: true),
|
|
||||||
"Note" => TermDefinition.new("Note", id: "https://www.w3.org/ns/activitystreams#Note", simple: true),
|
|
||||||
"Object" => TermDefinition.new("Object", id: "https://www.w3.org/ns/activitystreams#Object", simple: true),
|
|
||||||
"Offer" => TermDefinition.new("Offer", id: "https://www.w3.org/ns/activitystreams#Offer", simple: true),
|
|
||||||
"OrderedCollection" => TermDefinition.new("OrderedCollection", id: "https://www.w3.org/ns/activitystreams#OrderedCollection", simple: true),
|
|
||||||
"OrderedCollectionPage" => TermDefinition.new("OrderedCollectionPage", id: "https://www.w3.org/ns/activitystreams#OrderedCollectionPage", simple: true),
|
|
||||||
"Organization" => TermDefinition.new("Organization", id: "https://www.w3.org/ns/activitystreams#Organization", simple: true),
|
|
||||||
"Page" => TermDefinition.new("Page", id: "https://www.w3.org/ns/activitystreams#Page", simple: true),
|
|
||||||
"Person" => TermDefinition.new("Person", id: "https://www.w3.org/ns/activitystreams#Person", simple: true),
|
|
||||||
"Place" => TermDefinition.new("Place", id: "https://www.w3.org/ns/activitystreams#Place", simple: true),
|
|
||||||
"Profile" => TermDefinition.new("Profile", id: "https://www.w3.org/ns/activitystreams#Profile", simple: true),
|
|
||||||
"Question" => TermDefinition.new("Question", id: "https://www.w3.org/ns/activitystreams#Question", simple: true),
|
|
||||||
"Read" => TermDefinition.new("Read", id: "https://www.w3.org/ns/activitystreams#Read", simple: true),
|
|
||||||
"Reject" => TermDefinition.new("Reject", id: "https://www.w3.org/ns/activitystreams#Reject", simple: true),
|
|
||||||
"Relationship" => TermDefinition.new("Relationship", id: "https://www.w3.org/ns/activitystreams#Relationship", simple: true),
|
|
||||||
"Remove" => TermDefinition.new("Remove", id: "https://www.w3.org/ns/activitystreams#Remove", simple: true),
|
|
||||||
"Service" => TermDefinition.new("Service", id: "https://www.w3.org/ns/activitystreams#Service", simple: true),
|
|
||||||
"TentativeAccept" => TermDefinition.new("TentativeAccept", id: "https://www.w3.org/ns/activitystreams#TentativeAccept", simple: true),
|
|
||||||
"TentativeReject" => TermDefinition.new("TentativeReject", id: "https://www.w3.org/ns/activitystreams#TentativeReject", simple: true),
|
|
||||||
"Tombstone" => TermDefinition.new("Tombstone", id: "https://www.w3.org/ns/activitystreams#Tombstone", simple: true),
|
|
||||||
"Travel" => TermDefinition.new("Travel", id: "https://www.w3.org/ns/activitystreams#Travel", simple: true),
|
|
||||||
"Undo" => TermDefinition.new("Undo", id: "https://www.w3.org/ns/activitystreams#Undo", simple: true),
|
|
||||||
"Update" => TermDefinition.new("Update", id: "https://www.w3.org/ns/activitystreams#Update", simple: true),
|
|
||||||
"Video" => TermDefinition.new("Video", id: "https://www.w3.org/ns/activitystreams#Video", simple: true),
|
|
||||||
"View" => TermDefinition.new("View", id: "https://www.w3.org/ns/activitystreams#View", simple: true),
|
|
||||||
"accuracy" => TermDefinition.new("accuracy", id: "https://www.w3.org/ns/activitystreams#accuracy", type_mapping: "http://www.w3.org/2001/XMLSchema#float"),
|
|
||||||
"actor" => TermDefinition.new("actor", id: "https://www.w3.org/ns/activitystreams#actor", type_mapping: "@id"),
|
|
||||||
"altitude" => TermDefinition.new("altitude", id: "https://www.w3.org/ns/activitystreams#altitude", type_mapping: "http://www.w3.org/2001/XMLSchema#float"),
|
|
||||||
"anyOf" => TermDefinition.new("anyOf", id: "https://www.w3.org/ns/activitystreams#anyOf", type_mapping: "@id"),
|
|
||||||
"as" => TermDefinition.new("as", id: "https://www.w3.org/ns/activitystreams#", simple: true, prefix: true),
|
|
||||||
"attachment" => TermDefinition.new("attachment", id: "https://www.w3.org/ns/activitystreams#attachment", type_mapping: "@id"),
|
|
||||||
"attributedTo" => TermDefinition.new("attributedTo", id: "https://www.w3.org/ns/activitystreams#attributedTo", type_mapping: "@id"),
|
|
||||||
"audience" => TermDefinition.new("audience", id: "https://www.w3.org/ns/activitystreams#audience", type_mapping: "@id"),
|
|
||||||
"bcc" => TermDefinition.new("bcc", id: "https://www.w3.org/ns/activitystreams#bcc", type_mapping: "@id"),
|
|
||||||
"bto" => TermDefinition.new("bto", id: "https://www.w3.org/ns/activitystreams#bto", type_mapping: "@id"),
|
|
||||||
"cc" => TermDefinition.new("cc", id: "https://www.w3.org/ns/activitystreams#cc", type_mapping: "@id"),
|
|
||||||
"closed" => TermDefinition.new("closed", id: "https://www.w3.org/ns/activitystreams#closed", type_mapping: "http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
||||||
"content" => TermDefinition.new("content", id: "https://www.w3.org/ns/activitystreams#content", simple: true),
|
|
||||||
"contentMap" => TermDefinition.new("contentMap", id: "https://www.w3.org/ns/activitystreams#content", container_mapping: "@language"),
|
|
||||||
"context" => TermDefinition.new("context", id: "https://www.w3.org/ns/activitystreams#context", type_mapping: "@id"),
|
|
||||||
"current" => TermDefinition.new("current", id: "https://www.w3.org/ns/activitystreams#current", type_mapping: "@id"),
|
|
||||||
"deleted" => TermDefinition.new("deleted", id: "https://www.w3.org/ns/activitystreams#deleted", type_mapping: "http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
||||||
"describes" => TermDefinition.new("describes", id: "https://www.w3.org/ns/activitystreams#describes", type_mapping: "@id"),
|
|
||||||
"duration" => TermDefinition.new("duration", id: "https://www.w3.org/ns/activitystreams#duration", type_mapping: "http://www.w3.org/2001/XMLSchema#duration"),
|
|
||||||
"endTime" => TermDefinition.new("endTime", id: "https://www.w3.org/ns/activitystreams#endTime", type_mapping: "http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
||||||
"endpoints" => TermDefinition.new("endpoints", id: "https://www.w3.org/ns/activitystreams#endpoints", type_mapping: "@id"),
|
|
||||||
"first" => TermDefinition.new("first", id: "https://www.w3.org/ns/activitystreams#first", type_mapping: "@id"),
|
|
||||||
"followers" => TermDefinition.new("followers", id: "https://www.w3.org/ns/activitystreams#followers", type_mapping: "@id"),
|
|
||||||
"following" => TermDefinition.new("following", id: "https://www.w3.org/ns/activitystreams#following", type_mapping: "@id"),
|
|
||||||
"formerType" => TermDefinition.new("formerType", id: "https://www.w3.org/ns/activitystreams#formerType", type_mapping: "@id"),
|
|
||||||
"generator" => TermDefinition.new("generator", id: "https://www.w3.org/ns/activitystreams#generator", type_mapping: "@id"),
|
|
||||||
"height" => TermDefinition.new("height", id: "https://www.w3.org/ns/activitystreams#height", type_mapping: "http://www.w3.org/2001/XMLSchema#nonNegativeInteger"),
|
|
||||||
"href" => TermDefinition.new("href", id: "https://www.w3.org/ns/activitystreams#href", type_mapping: "@id"),
|
|
||||||
"hreflang" => TermDefinition.new("hreflang", id: "https://www.w3.org/ns/activitystreams#hreflang", simple: true),
|
|
||||||
"icon" => TermDefinition.new("icon", id: "https://www.w3.org/ns/activitystreams#icon", type_mapping: "@id"),
|
|
||||||
"id" => TermDefinition.new("id", id: "@id", simple: true),
|
|
||||||
"image" => TermDefinition.new("image", id: "https://www.w3.org/ns/activitystreams#image", type_mapping: "@id"),
|
|
||||||
"inReplyTo" => TermDefinition.new("inReplyTo", id: "https://www.w3.org/ns/activitystreams#inReplyTo", type_mapping: "@id"),
|
|
||||||
"inbox" => TermDefinition.new("inbox", id: "http://www.w3.org/ns/ldp#inbox", type_mapping: "@id"),
|
|
||||||
"instrument" => TermDefinition.new("instrument", id: "https://www.w3.org/ns/activitystreams#instrument", type_mapping: "@id"),
|
|
||||||
"items" => TermDefinition.new("items", id: "https://www.w3.org/ns/activitystreams#items", type_mapping: "@id"),
|
|
||||||
"last" => TermDefinition.new("last", id: "https://www.w3.org/ns/activitystreams#last", type_mapping: "@id"),
|
|
||||||
"latitude" => TermDefinition.new("latitude", id: "https://www.w3.org/ns/activitystreams#latitude", type_mapping: "http://www.w3.org/2001/XMLSchema#float"),
|
|
||||||
"ldp" => TermDefinition.new("ldp", id: "http://www.w3.org/ns/ldp#", simple: true, prefix: true),
|
|
||||||
"liked" => TermDefinition.new("liked", id: "https://www.w3.org/ns/activitystreams#liked", type_mapping: "@id"),
|
|
||||||
"location" => TermDefinition.new("location", id: "https://www.w3.org/ns/activitystreams#location", type_mapping: "@id"),
|
|
||||||
"longitude" => TermDefinition.new("longitude", id: "https://www.w3.org/ns/activitystreams#longitude", type_mapping: "http://www.w3.org/2001/XMLSchema#float"),
|
|
||||||
"mediaType" => TermDefinition.new("mediaType", id: "https://www.w3.org/ns/activitystreams#mediaType", simple: true),
|
|
||||||
"name" => TermDefinition.new("name", id: "https://www.w3.org/ns/activitystreams#name", simple: true),
|
|
||||||
"nameMap" => TermDefinition.new("nameMap", id: "https://www.w3.org/ns/activitystreams#name", container_mapping: "@language"),
|
|
||||||
"next" => TermDefinition.new("next", id: "https://www.w3.org/ns/activitystreams#next", type_mapping: "@id"),
|
|
||||||
"oauthAuthorizationEndpoint" => TermDefinition.new("oauthAuthorizationEndpoint", id: "https://www.w3.org/ns/activitystreams#oauthAuthorizationEndpoint", type_mapping: "@id"),
|
|
||||||
"oauthTokenEndpoint" => TermDefinition.new("oauthTokenEndpoint", id: "https://www.w3.org/ns/activitystreams#oauthTokenEndpoint", type_mapping: "@id"),
|
|
||||||
"object" => TermDefinition.new("object", id: "https://www.w3.org/ns/activitystreams#object", type_mapping: "@id"),
|
|
||||||
"oneOf" => TermDefinition.new("oneOf", id: "https://www.w3.org/ns/activitystreams#oneOf", type_mapping: "@id"),
|
|
||||||
"orderedItems" => TermDefinition.new("orderedItems", id: "https://www.w3.org/ns/activitystreams#items", type_mapping: "@id", container_mapping: "@list"),
|
|
||||||
"origin" => TermDefinition.new("origin", id: "https://www.w3.org/ns/activitystreams#origin", type_mapping: "@id"),
|
|
||||||
"outbox" => TermDefinition.new("outbox", id: "https://www.w3.org/ns/activitystreams#outbox", type_mapping: "@id"),
|
|
||||||
"partOf" => TermDefinition.new("partOf", id: "https://www.w3.org/ns/activitystreams#partOf", type_mapping: "@id"),
|
|
||||||
"preferredUsername" => TermDefinition.new("preferredUsername", id: "https://www.w3.org/ns/activitystreams#preferredUsername", simple: true),
|
|
||||||
"prev" => TermDefinition.new("prev", id: "https://www.w3.org/ns/activitystreams#prev", type_mapping: "@id"),
|
|
||||||
"preview" => TermDefinition.new("preview", id: "https://www.w3.org/ns/activitystreams#preview", type_mapping: "@id"),
|
|
||||||
"provideClientKey" => TermDefinition.new("provideClientKey", id: "https://www.w3.org/ns/activitystreams#provideClientKey", type_mapping: "@id"),
|
|
||||||
"proxyUrl" => TermDefinition.new("proxyUrl", id: "https://www.w3.org/ns/activitystreams#proxyUrl", type_mapping: "@id"),
|
|
||||||
"published" => TermDefinition.new("published", id: "https://www.w3.org/ns/activitystreams#published", type_mapping: "http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
||||||
"radius" => TermDefinition.new("radius", id: "https://www.w3.org/ns/activitystreams#radius", type_mapping: "http://www.w3.org/2001/XMLSchema#float"),
|
|
||||||
"rel" => TermDefinition.new("rel", id: "https://www.w3.org/ns/activitystreams#rel", simple: true),
|
|
||||||
"relationship" => TermDefinition.new("relationship", id: "https://www.w3.org/ns/activitystreams#relationship", type_mapping: "@id"),
|
|
||||||
"replies" => TermDefinition.new("replies", id: "https://www.w3.org/ns/activitystreams#replies", type_mapping: "@id"),
|
|
||||||
"result" => TermDefinition.new("result", id: "https://www.w3.org/ns/activitystreams#result", type_mapping: "@id"),
|
|
||||||
"sharedInbox" => TermDefinition.new("sharedInbox", id: "https://www.w3.org/ns/activitystreams#sharedInbox", type_mapping: "@id"),
|
|
||||||
"signClientKey" => TermDefinition.new("signClientKey", id: "https://www.w3.org/ns/activitystreams#signClientKey", type_mapping: "@id"),
|
|
||||||
"source" => TermDefinition.new("source", id: "https://www.w3.org/ns/activitystreams#source", simple: true),
|
|
||||||
"startIndex" => TermDefinition.new("startIndex", id: "https://www.w3.org/ns/activitystreams#startIndex", type_mapping: "http://www.w3.org/2001/XMLSchema#nonNegativeInteger"),
|
|
||||||
"startTime" => TermDefinition.new("startTime", id: "https://www.w3.org/ns/activitystreams#startTime", type_mapping: "http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
||||||
"streams" => TermDefinition.new("streams", id: "https://www.w3.org/ns/activitystreams#streams", type_mapping: "@id"),
|
|
||||||
"subject" => TermDefinition.new("subject", id: "https://www.w3.org/ns/activitystreams#subject", type_mapping: "@id"),
|
|
||||||
"summary" => TermDefinition.new("summary", id: "https://www.w3.org/ns/activitystreams#summary", simple: true),
|
|
||||||
"summaryMap" => TermDefinition.new("summaryMap", id: "https://www.w3.org/ns/activitystreams#summary", container_mapping: "@language"),
|
|
||||||
"tag" => TermDefinition.new("tag", id: "https://www.w3.org/ns/activitystreams#tag", type_mapping: "@id"),
|
|
||||||
"target" => TermDefinition.new("target", id: "https://www.w3.org/ns/activitystreams#target", type_mapping: "@id"),
|
|
||||||
"to" => TermDefinition.new("to", id: "https://www.w3.org/ns/activitystreams#to", type_mapping: "@id"),
|
|
||||||
"totalItems" => TermDefinition.new("totalItems", id: "https://www.w3.org/ns/activitystreams#totalItems", type_mapping: "http://www.w3.org/2001/XMLSchema#nonNegativeInteger"),
|
|
||||||
"type" => TermDefinition.new("type", id: "@type", simple: true),
|
|
||||||
"units" => TermDefinition.new("units", id: "https://www.w3.org/ns/activitystreams#units", simple: true),
|
|
||||||
"updated" => TermDefinition.new("updated", id: "https://www.w3.org/ns/activitystreams#updated", type_mapping: "http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
||||||
"uploadMedia" => TermDefinition.new("uploadMedia", id: "https://www.w3.org/ns/activitystreams#uploadMedia", type_mapping: "@id"),
|
|
||||||
"url" => TermDefinition.new("url", id: "https://www.w3.org/ns/activitystreams#url", type_mapping: "@id"),
|
|
||||||
"width" => TermDefinition.new("width", id: "https://www.w3.org/ns/activitystreams#width", type_mapping: "http://www.w3.org/2001/XMLSchema#nonNegativeInteger"),
|
|
||||||
"xsd" => TermDefinition.new("xsd", id: "http://www.w3.org/2001/XMLSchema#", simple: true, prefix: true)
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,86 +0,0 @@
|
||||||
# -*- encoding: utf-8 -*-
|
|
||||||
# frozen_string_literal: true
|
|
||||||
# This file generated automatically from https://w3id.org/identity/v1
|
|
||||||
require 'json/ld'
|
|
||||||
class JSON::LD::Context
|
|
||||||
add_preloaded("https://w3id.org/identity/v1") do
|
|
||||||
new(processingMode: "json-ld-1.0", term_definitions: {
|
|
||||||
"Credential" => TermDefinition.new("Credential", id: "https://w3id.org/credentials#Credential", simple: true),
|
|
||||||
"CryptographicKey" => TermDefinition.new("CryptographicKey", id: "https://w3id.org/security#Key", simple: true),
|
|
||||||
"CryptographicKeyCredential" => TermDefinition.new("CryptographicKeyCredential", id: "https://w3id.org/credentials#CryptographicKeyCredential", simple: true),
|
|
||||||
"EncryptedMessage" => TermDefinition.new("EncryptedMessage", id: "https://w3id.org/security#EncryptedMessage", simple: true),
|
|
||||||
"GraphSignature2012" => TermDefinition.new("GraphSignature2012", id: "https://w3id.org/security#GraphSignature2012", simple: true),
|
|
||||||
"Group" => TermDefinition.new("Group", id: "https://www.w3.org/ns/activitystreams#Group", simple: true),
|
|
||||||
"Identity" => TermDefinition.new("Identity", id: "https://w3id.org/identity#Identity", simple: true),
|
|
||||||
"LinkedDataSignature2015" => TermDefinition.new("LinkedDataSignature2015", id: "https://w3id.org/security#LinkedDataSignature2015", simple: true),
|
|
||||||
"Organization" => TermDefinition.new("Organization", id: "http://schema.org/Organization", simple: true),
|
|
||||||
"Person" => TermDefinition.new("Person", id: "http://schema.org/Person", simple: true),
|
|
||||||
"PostalAddress" => TermDefinition.new("PostalAddress", id: "http://schema.org/PostalAddress", simple: true),
|
|
||||||
"about" => TermDefinition.new("about", id: "http://schema.org/about", type_mapping: "@id"),
|
|
||||||
"accessControl" => TermDefinition.new("accessControl", id: "https://w3id.org/permissions#accessControl", type_mapping: "@id"),
|
|
||||||
"address" => TermDefinition.new("address", id: "http://schema.org/address", type_mapping: "@id"),
|
|
||||||
"addressCountry" => TermDefinition.new("addressCountry", id: "http://schema.org/addressCountry", simple: true),
|
|
||||||
"addressLocality" => TermDefinition.new("addressLocality", id: "http://schema.org/addressLocality", simple: true),
|
|
||||||
"addressRegion" => TermDefinition.new("addressRegion", id: "http://schema.org/addressRegion", simple: true),
|
|
||||||
"cipherAlgorithm" => TermDefinition.new("cipherAlgorithm", id: "https://w3id.org/security#cipherAlgorithm", simple: true),
|
|
||||||
"cipherData" => TermDefinition.new("cipherData", id: "https://w3id.org/security#cipherData", simple: true),
|
|
||||||
"cipherKey" => TermDefinition.new("cipherKey", id: "https://w3id.org/security#cipherKey", simple: true),
|
|
||||||
"claim" => TermDefinition.new("claim", id: "https://w3id.org/credentials#claim", type_mapping: "@id"),
|
|
||||||
"comment" => TermDefinition.new("comment", id: "http://www.w3.org/2000/01/rdf-schema#comment", simple: true),
|
|
||||||
"created" => TermDefinition.new("created", id: "http://purl.org/dc/terms/created", type_mapping: "http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
||||||
"creator" => TermDefinition.new("creator", id: "http://purl.org/dc/terms/creator", type_mapping: "@id"),
|
|
||||||
"cred" => TermDefinition.new("cred", id: "https://w3id.org/credentials#", simple: true, prefix: true),
|
|
||||||
"credential" => TermDefinition.new("credential", id: "https://w3id.org/credentials#credential", type_mapping: "@id"),
|
|
||||||
"dc" => TermDefinition.new("dc", id: "http://purl.org/dc/terms/", simple: true, prefix: true),
|
|
||||||
"description" => TermDefinition.new("description", id: "http://schema.org/description", simple: true),
|
|
||||||
"digestAlgorithm" => TermDefinition.new("digestAlgorithm", id: "https://w3id.org/security#digestAlgorithm", simple: true),
|
|
||||||
"digestValue" => TermDefinition.new("digestValue", id: "https://w3id.org/security#digestValue", simple: true),
|
|
||||||
"domain" => TermDefinition.new("domain", id: "https://w3id.org/security#domain", simple: true),
|
|
||||||
"email" => TermDefinition.new("email", id: "http://schema.org/email", simple: true),
|
|
||||||
"expires" => TermDefinition.new("expires", id: "https://w3id.org/security#expiration", type_mapping: "http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
||||||
"familyName" => TermDefinition.new("familyName", id: "http://schema.org/familyName", simple: true),
|
|
||||||
"givenName" => TermDefinition.new("givenName", id: "http://schema.org/givenName", simple: true),
|
|
||||||
"id" => TermDefinition.new("id", id: "@id", simple: true),
|
|
||||||
"identity" => TermDefinition.new("identity", id: "https://w3id.org/identity#", simple: true, prefix: true),
|
|
||||||
"identityService" => TermDefinition.new("identityService", id: "https://w3id.org/identity#identityService", type_mapping: "@id"),
|
|
||||||
"idp" => TermDefinition.new("idp", id: "https://w3id.org/identity#idp", type_mapping: "@id"),
|
|
||||||
"image" => TermDefinition.new("image", id: "http://schema.org/image", type_mapping: "@id"),
|
|
||||||
"initializationVector" => TermDefinition.new("initializationVector", id: "https://w3id.org/security#initializationVector", simple: true),
|
|
||||||
"issued" => TermDefinition.new("issued", id: "https://w3id.org/credentials#issued", type_mapping: "http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
||||||
"issuer" => TermDefinition.new("issuer", id: "https://w3id.org/credentials#issuer", type_mapping: "@id"),
|
|
||||||
"label" => TermDefinition.new("label", id: "http://www.w3.org/2000/01/rdf-schema#label", simple: true),
|
|
||||||
"member" => TermDefinition.new("member", id: "http://schema.org/member", type_mapping: "@id"),
|
|
||||||
"memberOf" => TermDefinition.new("memberOf", id: "http://schema.org/memberOf", type_mapping: "@id"),
|
|
||||||
"name" => TermDefinition.new("name", id: "http://schema.org/name", simple: true),
|
|
||||||
"nonce" => TermDefinition.new("nonce", id: "https://w3id.org/security#nonce", simple: true),
|
|
||||||
"normalizationAlgorithm" => TermDefinition.new("normalizationAlgorithm", id: "https://w3id.org/security#normalizationAlgorithm", simple: true),
|
|
||||||
"owner" => TermDefinition.new("owner", id: "https://w3id.org/security#owner", type_mapping: "@id"),
|
|
||||||
"password" => TermDefinition.new("password", id: "https://w3id.org/security#password", simple: true),
|
|
||||||
"paymentProcessor" => TermDefinition.new("paymentProcessor", id: "https://w3id.org/payswarm#processor", simple: true),
|
|
||||||
"perm" => TermDefinition.new("perm", id: "https://w3id.org/permissions#", simple: true, prefix: true),
|
|
||||||
"postalCode" => TermDefinition.new("postalCode", id: "http://schema.org/postalCode", simple: true),
|
|
||||||
"preferences" => TermDefinition.new("preferences", id: "https://w3id.org/payswarm#preferences", type_mapping: "@vocab"),
|
|
||||||
"privateKey" => TermDefinition.new("privateKey", id: "https://w3id.org/security#privateKey", type_mapping: "@id"),
|
|
||||||
"privateKeyPem" => TermDefinition.new("privateKeyPem", id: "https://w3id.org/security#privateKeyPem", simple: true),
|
|
||||||
"ps" => TermDefinition.new("ps", id: "https://w3id.org/payswarm#", simple: true, prefix: true),
|
|
||||||
"publicKey" => TermDefinition.new("publicKey", id: "https://w3id.org/security#publicKey", type_mapping: "@id"),
|
|
||||||
"publicKeyPem" => TermDefinition.new("publicKeyPem", id: "https://w3id.org/security#publicKeyPem", simple: true),
|
|
||||||
"publicKeyService" => TermDefinition.new("publicKeyService", id: "https://w3id.org/security#publicKeyService", type_mapping: "@id"),
|
|
||||||
"rdf" => TermDefinition.new("rdf", id: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", simple: true, prefix: true),
|
|
||||||
"rdfs" => TermDefinition.new("rdfs", id: "http://www.w3.org/2000/01/rdf-schema#", simple: true, prefix: true),
|
|
||||||
"recipient" => TermDefinition.new("recipient", id: "https://w3id.org/credentials#recipient", type_mapping: "@id"),
|
|
||||||
"revoked" => TermDefinition.new("revoked", id: "https://w3id.org/security#revoked", type_mapping: "http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
||||||
"schema" => TermDefinition.new("schema", id: "http://schema.org/", simple: true, prefix: true),
|
|
||||||
"sec" => TermDefinition.new("sec", id: "https://w3id.org/security#", simple: true, prefix: true),
|
|
||||||
"signature" => TermDefinition.new("signature", id: "https://w3id.org/security#signature", simple: true),
|
|
||||||
"signatureAlgorithm" => TermDefinition.new("signatureAlgorithm", id: "https://w3id.org/security#signatureAlgorithm", simple: true),
|
|
||||||
"signatureValue" => TermDefinition.new("signatureValue", id: "https://w3id.org/security#signatureValue", simple: true),
|
|
||||||
"streetAddress" => TermDefinition.new("streetAddress", id: "http://schema.org/streetAddress", simple: true),
|
|
||||||
"title" => TermDefinition.new("title", id: "http://purl.org/dc/terms/title", simple: true),
|
|
||||||
"type" => TermDefinition.new("type", id: "@type", simple: true),
|
|
||||||
"url" => TermDefinition.new("url", id: "http://schema.org/url", type_mapping: "@id"),
|
|
||||||
"writePermission" => TermDefinition.new("writePermission", id: "https://w3id.org/permissions#writePermission", type_mapping: "@id"),
|
|
||||||
"xsd" => TermDefinition.new("xsd", id: "http://www.w3.org/2001/XMLSchema#", simple: true, prefix: true)
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,50 +0,0 @@
|
||||||
# -*- encoding: utf-8 -*-
|
|
||||||
# frozen_string_literal: true
|
|
||||||
# This file generated automatically from https://w3id.org/security/v1
|
|
||||||
require 'json/ld'
|
|
||||||
class JSON::LD::Context
|
|
||||||
add_preloaded("https://w3id.org/security/v1") do
|
|
||||||
new(processingMode: "json-ld-1.0", term_definitions: {
|
|
||||||
"CryptographicKey" => TermDefinition.new("CryptographicKey", id: "https://w3id.org/security#Key", simple: true),
|
|
||||||
"EcdsaKoblitzSignature2016" => TermDefinition.new("EcdsaKoblitzSignature2016", id: "https://w3id.org/security#EcdsaKoblitzSignature2016", simple: true),
|
|
||||||
"EncryptedMessage" => TermDefinition.new("EncryptedMessage", id: "https://w3id.org/security#EncryptedMessage", simple: true),
|
|
||||||
"GraphSignature2012" => TermDefinition.new("GraphSignature2012", id: "https://w3id.org/security#GraphSignature2012", simple: true),
|
|
||||||
"LinkedDataSignature2015" => TermDefinition.new("LinkedDataSignature2015", id: "https://w3id.org/security#LinkedDataSignature2015", simple: true),
|
|
||||||
"LinkedDataSignature2016" => TermDefinition.new("LinkedDataSignature2016", id: "https://w3id.org/security#LinkedDataSignature2016", simple: true),
|
|
||||||
"authenticationTag" => TermDefinition.new("authenticationTag", id: "https://w3id.org/security#authenticationTag", simple: true),
|
|
||||||
"canonicalizationAlgorithm" => TermDefinition.new("canonicalizationAlgorithm", id: "https://w3id.org/security#canonicalizationAlgorithm", simple: true),
|
|
||||||
"cipherAlgorithm" => TermDefinition.new("cipherAlgorithm", id: "https://w3id.org/security#cipherAlgorithm", simple: true),
|
|
||||||
"cipherData" => TermDefinition.new("cipherData", id: "https://w3id.org/security#cipherData", simple: true),
|
|
||||||
"cipherKey" => TermDefinition.new("cipherKey", id: "https://w3id.org/security#cipherKey", simple: true),
|
|
||||||
"created" => TermDefinition.new("created", id: "http://purl.org/dc/terms/created", type_mapping: "http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
||||||
"creator" => TermDefinition.new("creator", id: "http://purl.org/dc/terms/creator", type_mapping: "@id"),
|
|
||||||
"dc" => TermDefinition.new("dc", id: "http://purl.org/dc/terms/", simple: true, prefix: true),
|
|
||||||
"digestAlgorithm" => TermDefinition.new("digestAlgorithm", id: "https://w3id.org/security#digestAlgorithm", simple: true),
|
|
||||||
"digestValue" => TermDefinition.new("digestValue", id: "https://w3id.org/security#digestValue", simple: true),
|
|
||||||
"domain" => TermDefinition.new("domain", id: "https://w3id.org/security#domain", simple: true),
|
|
||||||
"encryptionKey" => TermDefinition.new("encryptionKey", id: "https://w3id.org/security#encryptionKey", simple: true),
|
|
||||||
"expiration" => TermDefinition.new("expiration", id: "https://w3id.org/security#expiration", type_mapping: "http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
||||||
"expires" => TermDefinition.new("expires", id: "https://w3id.org/security#expiration", type_mapping: "http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
||||||
"id" => TermDefinition.new("id", id: "@id", simple: true),
|
|
||||||
"initializationVector" => TermDefinition.new("initializationVector", id: "https://w3id.org/security#initializationVector", simple: true),
|
|
||||||
"iterationCount" => TermDefinition.new("iterationCount", id: "https://w3id.org/security#iterationCount", simple: true),
|
|
||||||
"nonce" => TermDefinition.new("nonce", id: "https://w3id.org/security#nonce", simple: true),
|
|
||||||
"normalizationAlgorithm" => TermDefinition.new("normalizationAlgorithm", id: "https://w3id.org/security#normalizationAlgorithm", simple: true),
|
|
||||||
"owner" => TermDefinition.new("owner", id: "https://w3id.org/security#owner", type_mapping: "@id"),
|
|
||||||
"password" => TermDefinition.new("password", id: "https://w3id.org/security#password", simple: true),
|
|
||||||
"privateKey" => TermDefinition.new("privateKey", id: "https://w3id.org/security#privateKey", type_mapping: "@id"),
|
|
||||||
"privateKeyPem" => TermDefinition.new("privateKeyPem", id: "https://w3id.org/security#privateKeyPem", simple: true),
|
|
||||||
"publicKey" => TermDefinition.new("publicKey", id: "https://w3id.org/security#publicKey", type_mapping: "@id"),
|
|
||||||
"publicKeyPem" => TermDefinition.new("publicKeyPem", id: "https://w3id.org/security#publicKeyPem", simple: true),
|
|
||||||
"publicKeyService" => TermDefinition.new("publicKeyService", id: "https://w3id.org/security#publicKeyService", type_mapping: "@id"),
|
|
||||||
"revoked" => TermDefinition.new("revoked", id: "https://w3id.org/security#revoked", type_mapping: "http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
||||||
"salt" => TermDefinition.new("salt", id: "https://w3id.org/security#salt", simple: true),
|
|
||||||
"sec" => TermDefinition.new("sec", id: "https://w3id.org/security#", simple: true, prefix: true),
|
|
||||||
"signature" => TermDefinition.new("signature", id: "https://w3id.org/security#signature", simple: true),
|
|
||||||
"signatureAlgorithm" => TermDefinition.new("signatureAlgorithm", id: "https://w3id.org/security#signingAlgorithm", simple: true),
|
|
||||||
"signatureValue" => TermDefinition.new("signatureValue", id: "https://w3id.org/security#signatureValue", simple: true),
|
|
||||||
"type" => TermDefinition.new("type", id: "@type", simple: true),
|
|
||||||
"xsd" => TermDefinition.new("xsd", id: "http://www.w3.org/2001/XMLSchema#", simple: true, prefix: true)
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
require 'colorize'
|
require 'colorize'
|
||||||
|
require 'tty-command'
|
||||||
|
require 'tty-prompt'
|
||||||
|
|
||||||
namespace :mastodon do
|
namespace :mastodon do
|
||||||
desc 'Configure the instance for production use'
|
desc 'Configure the instance for production use'
|
||||||
|
|
391
spec/fixtures/requests/json-ld.activitystreams.txt
vendored
Normal file
391
spec/fixtures/requests/json-ld.activitystreams.txt
vendored
Normal file
|
@ -0,0 +1,391 @@
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Date: Tue, 01 May 2018 23:25:57 GMT
|
||||||
|
Content-Location: activitystreams.jsonld
|
||||||
|
Vary: negotiate,accept
|
||||||
|
TCN: choice
|
||||||
|
Last-Modified: Mon, 16 Apr 2018 00:28:23 GMT
|
||||||
|
ETag: "1eb0-569ec4caa97c0;d3-540ee27e0eec0"
|
||||||
|
Accept-Ranges: bytes
|
||||||
|
Content-Length: 7856
|
||||||
|
Cache-Control: max-age=21600
|
||||||
|
Expires: Wed, 02 May 2018 05:25:57 GMT
|
||||||
|
P3P: policyref="http://www.w3.org/2014/08/p3p.xml"
|
||||||
|
Access-Control-Allow-Origin: *
|
||||||
|
Content-Type: application/ld+json
|
||||||
|
Strict-Transport-Security: max-age=15552000; includeSubdomains; preload
|
||||||
|
Content-Security-Policy: upgrade-insecure-requests
|
||||||
|
|
||||||
|
{
|
||||||
|
"@context": {
|
||||||
|
"@vocab": "_:",
|
||||||
|
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
||||||
|
"as": "https://www.w3.org/ns/activitystreams#",
|
||||||
|
"ldp": "http://www.w3.org/ns/ldp#",
|
||||||
|
"id": "@id",
|
||||||
|
"type": "@type",
|
||||||
|
"Accept": "as:Accept",
|
||||||
|
"Activity": "as:Activity",
|
||||||
|
"IntransitiveActivity": "as:IntransitiveActivity",
|
||||||
|
"Add": "as:Add",
|
||||||
|
"Announce": "as:Announce",
|
||||||
|
"Application": "as:Application",
|
||||||
|
"Arrive": "as:Arrive",
|
||||||
|
"Article": "as:Article",
|
||||||
|
"Audio": "as:Audio",
|
||||||
|
"Block": "as:Block",
|
||||||
|
"Collection": "as:Collection",
|
||||||
|
"CollectionPage": "as:CollectionPage",
|
||||||
|
"Relationship": "as:Relationship",
|
||||||
|
"Create": "as:Create",
|
||||||
|
"Delete": "as:Delete",
|
||||||
|
"Dislike": "as:Dislike",
|
||||||
|
"Document": "as:Document",
|
||||||
|
"Event": "as:Event",
|
||||||
|
"Follow": "as:Follow",
|
||||||
|
"Flag": "as:Flag",
|
||||||
|
"Group": "as:Group",
|
||||||
|
"Ignore": "as:Ignore",
|
||||||
|
"Image": "as:Image",
|
||||||
|
"Invite": "as:Invite",
|
||||||
|
"Join": "as:Join",
|
||||||
|
"Leave": "as:Leave",
|
||||||
|
"Like": "as:Like",
|
||||||
|
"Link": "as:Link",
|
||||||
|
"Mention": "as:Mention",
|
||||||
|
"Note": "as:Note",
|
||||||
|
"Object": "as:Object",
|
||||||
|
"Offer": "as:Offer",
|
||||||
|
"OrderedCollection": "as:OrderedCollection",
|
||||||
|
"OrderedCollectionPage": "as:OrderedCollectionPage",
|
||||||
|
"Organization": "as:Organization",
|
||||||
|
"Page": "as:Page",
|
||||||
|
"Person": "as:Person",
|
||||||
|
"Place": "as:Place",
|
||||||
|
"Profile": "as:Profile",
|
||||||
|
"Question": "as:Question",
|
||||||
|
"Reject": "as:Reject",
|
||||||
|
"Remove": "as:Remove",
|
||||||
|
"Service": "as:Service",
|
||||||
|
"TentativeAccept": "as:TentativeAccept",
|
||||||
|
"TentativeReject": "as:TentativeReject",
|
||||||
|
"Tombstone": "as:Tombstone",
|
||||||
|
"Undo": "as:Undo",
|
||||||
|
"Update": "as:Update",
|
||||||
|
"Video": "as:Video",
|
||||||
|
"View": "as:View",
|
||||||
|
"Listen": "as:Listen",
|
||||||
|
"Read": "as:Read",
|
||||||
|
"Move": "as:Move",
|
||||||
|
"Travel": "as:Travel",
|
||||||
|
"IsFollowing": "as:IsFollowing",
|
||||||
|
"IsFollowedBy": "as:IsFollowedBy",
|
||||||
|
"IsContact": "as:IsContact",
|
||||||
|
"IsMember": "as:IsMember",
|
||||||
|
"subject": {
|
||||||
|
"@id": "as:subject",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"relationship": {
|
||||||
|
"@id": "as:relationship",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"actor": {
|
||||||
|
"@id": "as:actor",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"attributedTo": {
|
||||||
|
"@id": "as:attributedTo",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"attachment": {
|
||||||
|
"@id": "as:attachment",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"bcc": {
|
||||||
|
"@id": "as:bcc",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"bto": {
|
||||||
|
"@id": "as:bto",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"cc": {
|
||||||
|
"@id": "as:cc",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"context": {
|
||||||
|
"@id": "as:context",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"current": {
|
||||||
|
"@id": "as:current",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"first": {
|
||||||
|
"@id": "as:first",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"generator": {
|
||||||
|
"@id": "as:generator",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"icon": {
|
||||||
|
"@id": "as:icon",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"image": {
|
||||||
|
"@id": "as:image",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"inReplyTo": {
|
||||||
|
"@id": "as:inReplyTo",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
"@id": "as:items",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"instrument": {
|
||||||
|
"@id": "as:instrument",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"orderedItems": {
|
||||||
|
"@id": "as:items",
|
||||||
|
"@type": "@id",
|
||||||
|
"@container": "@list"
|
||||||
|
},
|
||||||
|
"last": {
|
||||||
|
"@id": "as:last",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"location": {
|
||||||
|
"@id": "as:location",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"next": {
|
||||||
|
"@id": "as:next",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"object": {
|
||||||
|
"@id": "as:object",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"oneOf": {
|
||||||
|
"@id": "as:oneOf",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"anyOf": {
|
||||||
|
"@id": "as:anyOf",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"closed": {
|
||||||
|
"@id": "as:closed",
|
||||||
|
"@type": "xsd:dateTime"
|
||||||
|
},
|
||||||
|
"origin": {
|
||||||
|
"@id": "as:origin",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"accuracy": {
|
||||||
|
"@id": "as:accuracy",
|
||||||
|
"@type": "xsd:float"
|
||||||
|
},
|
||||||
|
"prev": {
|
||||||
|
"@id": "as:prev",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"preview": {
|
||||||
|
"@id": "as:preview",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"replies": {
|
||||||
|
"@id": "as:replies",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"@id": "as:result",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"audience": {
|
||||||
|
"@id": "as:audience",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"partOf": {
|
||||||
|
"@id": "as:partOf",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"tag": {
|
||||||
|
"@id": "as:tag",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"@id": "as:target",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"to": {
|
||||||
|
"@id": "as:to",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"@id": "as:url",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"altitude": {
|
||||||
|
"@id": "as:altitude",
|
||||||
|
"@type": "xsd:float"
|
||||||
|
},
|
||||||
|
"content": "as:content",
|
||||||
|
"contentMap": {
|
||||||
|
"@id": "as:content",
|
||||||
|
"@container": "@language"
|
||||||
|
},
|
||||||
|
"name": "as:name",
|
||||||
|
"nameMap": {
|
||||||
|
"@id": "as:name",
|
||||||
|
"@container": "@language"
|
||||||
|
},
|
||||||
|
"duration": {
|
||||||
|
"@id": "as:duration",
|
||||||
|
"@type": "xsd:duration"
|
||||||
|
},
|
||||||
|
"endTime": {
|
||||||
|
"@id": "as:endTime",
|
||||||
|
"@type": "xsd:dateTime"
|
||||||
|
},
|
||||||
|
"height": {
|
||||||
|
"@id": "as:height",
|
||||||
|
"@type": "xsd:nonNegativeInteger"
|
||||||
|
},
|
||||||
|
"href": {
|
||||||
|
"@id": "as:href",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"hreflang": "as:hreflang",
|
||||||
|
"latitude": {
|
||||||
|
"@id": "as:latitude",
|
||||||
|
"@type": "xsd:float"
|
||||||
|
},
|
||||||
|
"longitude": {
|
||||||
|
"@id": "as:longitude",
|
||||||
|
"@type": "xsd:float"
|
||||||
|
},
|
||||||
|
"mediaType": "as:mediaType",
|
||||||
|
"published": {
|
||||||
|
"@id": "as:published",
|
||||||
|
"@type": "xsd:dateTime"
|
||||||
|
},
|
||||||
|
"radius": {
|
||||||
|
"@id": "as:radius",
|
||||||
|
"@type": "xsd:float"
|
||||||
|
},
|
||||||
|
"rel": "as:rel",
|
||||||
|
"startIndex": {
|
||||||
|
"@id": "as:startIndex",
|
||||||
|
"@type": "xsd:nonNegativeInteger"
|
||||||
|
},
|
||||||
|
"startTime": {
|
||||||
|
"@id": "as:startTime",
|
||||||
|
"@type": "xsd:dateTime"
|
||||||
|
},
|
||||||
|
"summary": "as:summary",
|
||||||
|
"summaryMap": {
|
||||||
|
"@id": "as:summary",
|
||||||
|
"@container": "@language"
|
||||||
|
},
|
||||||
|
"totalItems": {
|
||||||
|
"@id": "as:totalItems",
|
||||||
|
"@type": "xsd:nonNegativeInteger"
|
||||||
|
},
|
||||||
|
"units": "as:units",
|
||||||
|
"updated": {
|
||||||
|
"@id": "as:updated",
|
||||||
|
"@type": "xsd:dateTime"
|
||||||
|
},
|
||||||
|
"width": {
|
||||||
|
"@id": "as:width",
|
||||||
|
"@type": "xsd:nonNegativeInteger"
|
||||||
|
},
|
||||||
|
"describes": {
|
||||||
|
"@id": "as:describes",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"formerType": {
|
||||||
|
"@id": "as:formerType",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"deleted": {
|
||||||
|
"@id": "as:deleted",
|
||||||
|
"@type": "xsd:dateTime"
|
||||||
|
},
|
||||||
|
"inbox": {
|
||||||
|
"@id": "ldp:inbox",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"outbox": {
|
||||||
|
"@id": "as:outbox",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"following": {
|
||||||
|
"@id": "as:following",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"followers": {
|
||||||
|
"@id": "as:followers",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"streams": {
|
||||||
|
"@id": "as:streams",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"preferredUsername": "as:preferredUsername",
|
||||||
|
"endpoints": {
|
||||||
|
"@id": "as:endpoints",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"uploadMedia": {
|
||||||
|
"@id": "as:uploadMedia",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"proxyUrl": {
|
||||||
|
"@id": "as:proxyUrl",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"liked": {
|
||||||
|
"@id": "as:liked",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"oauthAuthorizationEndpoint": {
|
||||||
|
"@id": "as:oauthAuthorizationEndpoint",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"oauthTokenEndpoint": {
|
||||||
|
"@id": "as:oauthTokenEndpoint",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"provideClientKey": {
|
||||||
|
"@id": "as:provideClientKey",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"signClientKey": {
|
||||||
|
"@id": "as:signClientKey",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"sharedInbox": {
|
||||||
|
"@id": "as:sharedInbox",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"Public": {
|
||||||
|
"@id": "as:Public",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"source": "as:source",
|
||||||
|
"likes": {
|
||||||
|
"@id": "as:likes",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"shares": {
|
||||||
|
"@id": "as:shares",
|
||||||
|
"@type": "@id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
100
spec/fixtures/requests/json-ld.identity.txt
vendored
Normal file
100
spec/fixtures/requests/json-ld.identity.txt
vendored
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Accept-Ranges: bytes
|
||||||
|
Access-Control-Allow-Headers: DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Accept-Encoding
|
||||||
|
Access-Control-Allow-Origin: *
|
||||||
|
Content-Type: application/ld+json
|
||||||
|
Date: Tue, 01 May 2018 23:28:21 GMT
|
||||||
|
Etag: "e26-547a6fc75b04a-gzip"
|
||||||
|
Last-Modified: Fri, 03 Feb 2017 21:30:09 GMT
|
||||||
|
Server: Apache/2.4.7 (Ubuntu)
|
||||||
|
Vary: Accept-Encoding
|
||||||
|
Transfer-Encoding: chunked
|
||||||
|
|
||||||
|
{
|
||||||
|
"@context": {
|
||||||
|
"id": "@id",
|
||||||
|
"type": "@type",
|
||||||
|
|
||||||
|
"cred": "https://w3id.org/credentials#",
|
||||||
|
"dc": "http://purl.org/dc/terms/",
|
||||||
|
"identity": "https://w3id.org/identity#",
|
||||||
|
"perm": "https://w3id.org/permissions#",
|
||||||
|
"ps": "https://w3id.org/payswarm#",
|
||||||
|
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
||||||
|
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
|
||||||
|
"sec": "https://w3id.org/security#",
|
||||||
|
"schema": "http://schema.org/",
|
||||||
|
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
||||||
|
|
||||||
|
"Group": "https://www.w3.org/ns/activitystreams#Group",
|
||||||
|
|
||||||
|
"claim": {"@id": "cred:claim", "@type": "@id"},
|
||||||
|
"credential": {"@id": "cred:credential", "@type": "@id"},
|
||||||
|
"issued": {"@id": "cred:issued", "@type": "xsd:dateTime"},
|
||||||
|
"issuer": {"@id": "cred:issuer", "@type": "@id"},
|
||||||
|
"recipient": {"@id": "cred:recipient", "@type": "@id"},
|
||||||
|
"Credential": "cred:Credential",
|
||||||
|
"CryptographicKeyCredential": "cred:CryptographicKeyCredential",
|
||||||
|
|
||||||
|
"about": {"@id": "schema:about", "@type": "@id"},
|
||||||
|
"address": {"@id": "schema:address", "@type": "@id"},
|
||||||
|
"addressCountry": "schema:addressCountry",
|
||||||
|
"addressLocality": "schema:addressLocality",
|
||||||
|
"addressRegion": "schema:addressRegion",
|
||||||
|
"comment": "rdfs:comment",
|
||||||
|
"created": {"@id": "dc:created", "@type": "xsd:dateTime"},
|
||||||
|
"creator": {"@id": "dc:creator", "@type": "@id"},
|
||||||
|
"description": "schema:description",
|
||||||
|
"email": "schema:email",
|
||||||
|
"familyName": "schema:familyName",
|
||||||
|
"givenName": "schema:givenName",
|
||||||
|
"image": {"@id": "schema:image", "@type": "@id"},
|
||||||
|
"label": "rdfs:label",
|
||||||
|
"name": "schema:name",
|
||||||
|
"postalCode": "schema:postalCode",
|
||||||
|
"streetAddress": "schema:streetAddress",
|
||||||
|
"title": "dc:title",
|
||||||
|
"url": {"@id": "schema:url", "@type": "@id"},
|
||||||
|
"Person": "schema:Person",
|
||||||
|
"PostalAddress": "schema:PostalAddress",
|
||||||
|
"Organization": "schema:Organization",
|
||||||
|
|
||||||
|
"identityService": {"@id": "identity:identityService", "@type": "@id"},
|
||||||
|
"idp": {"@id": "identity:idp", "@type": "@id"},
|
||||||
|
"Identity": "identity:Identity",
|
||||||
|
|
||||||
|
"paymentProcessor": "ps:processor",
|
||||||
|
"preferences": {"@id": "ps:preferences", "@type": "@vocab"},
|
||||||
|
|
||||||
|
"cipherAlgorithm": "sec:cipherAlgorithm",
|
||||||
|
"cipherData": "sec:cipherData",
|
||||||
|
"cipherKey": "sec:cipherKey",
|
||||||
|
"digestAlgorithm": "sec:digestAlgorithm",
|
||||||
|
"digestValue": "sec:digestValue",
|
||||||
|
"domain": "sec:domain",
|
||||||
|
"expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
|
||||||
|
"initializationVector": "sec:initializationVector",
|
||||||
|
"member": {"@id": "schema:member", "@type": "@id"},
|
||||||
|
"memberOf": {"@id": "schema:memberOf", "@type": "@id"},
|
||||||
|
"nonce": "sec:nonce",
|
||||||
|
"normalizationAlgorithm": "sec:normalizationAlgorithm",
|
||||||
|
"owner": {"@id": "sec:owner", "@type": "@id"},
|
||||||
|
"password": "sec:password",
|
||||||
|
"privateKey": {"@id": "sec:privateKey", "@type": "@id"},
|
||||||
|
"privateKeyPem": "sec:privateKeyPem",
|
||||||
|
"publicKey": {"@id": "sec:publicKey", "@type": "@id"},
|
||||||
|
"publicKeyPem": "sec:publicKeyPem",
|
||||||
|
"publicKeyService": {"@id": "sec:publicKeyService", "@type": "@id"},
|
||||||
|
"revoked": {"@id": "sec:revoked", "@type": "xsd:dateTime"},
|
||||||
|
"signature": "sec:signature",
|
||||||
|
"signatureAlgorithm": "sec:signatureAlgorithm",
|
||||||
|
"signatureValue": "sec:signatureValue",
|
||||||
|
"CryptographicKey": "sec:Key",
|
||||||
|
"EncryptedMessage": "sec:EncryptedMessage",
|
||||||
|
"GraphSignature2012": "sec:GraphSignature2012",
|
||||||
|
"LinkedDataSignature2015": "sec:LinkedDataSignature2015",
|
||||||
|
|
||||||
|
"accessControl": {"@id": "perm:accessControl", "@type": "@id"},
|
||||||
|
"writePermission": {"@id": "perm:writePermission", "@type": "@id"}
|
||||||
|
}
|
||||||
|
}
|
61
spec/fixtures/requests/json-ld.security.txt
vendored
Normal file
61
spec/fixtures/requests/json-ld.security.txt
vendored
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Accept-Ranges: bytes
|
||||||
|
Access-Control-Allow-Headers: DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Accept-Encoding
|
||||||
|
Access-Control-Allow-Origin: *
|
||||||
|
Content-Type: application/ld+json
|
||||||
|
Date: Wed, 02 May 2018 16:25:32 GMT
|
||||||
|
Etag: "7e3-5651ec0f7c5ed-gzip"
|
||||||
|
Last-Modified: Tue, 13 Feb 2018 21:34:04 GMT
|
||||||
|
Server: Apache/2.4.7 (Ubuntu)
|
||||||
|
Vary: Accept-Encoding
|
||||||
|
Content-Length: 2019
|
||||||
|
|
||||||
|
{
|
||||||
|
"@context": {
|
||||||
|
"id": "@id",
|
||||||
|
"type": "@type",
|
||||||
|
|
||||||
|
"dc": "http://purl.org/dc/terms/",
|
||||||
|
"sec": "https://w3id.org/security#",
|
||||||
|
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
||||||
|
|
||||||
|
"EcdsaKoblitzSignature2016": "sec:EcdsaKoblitzSignature2016",
|
||||||
|
"Ed25519Signature2018": "sec:Ed25519Signature2018",
|
||||||
|
"EncryptedMessage": "sec:EncryptedMessage",
|
||||||
|
"GraphSignature2012": "sec:GraphSignature2012",
|
||||||
|
"LinkedDataSignature2015": "sec:LinkedDataSignature2015",
|
||||||
|
"LinkedDataSignature2016": "sec:LinkedDataSignature2016",
|
||||||
|
"CryptographicKey": "sec:Key",
|
||||||
|
|
||||||
|
"authenticationTag": "sec:authenticationTag",
|
||||||
|
"canonicalizationAlgorithm": "sec:canonicalizationAlgorithm",
|
||||||
|
"cipherAlgorithm": "sec:cipherAlgorithm",
|
||||||
|
"cipherData": "sec:cipherData",
|
||||||
|
"cipherKey": "sec:cipherKey",
|
||||||
|
"created": {"@id": "dc:created", "@type": "xsd:dateTime"},
|
||||||
|
"creator": {"@id": "dc:creator", "@type": "@id"},
|
||||||
|
"digestAlgorithm": "sec:digestAlgorithm",
|
||||||
|
"digestValue": "sec:digestValue",
|
||||||
|
"domain": "sec:domain",
|
||||||
|
"encryptionKey": "sec:encryptionKey",
|
||||||
|
"expiration": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
|
||||||
|
"expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
|
||||||
|
"initializationVector": "sec:initializationVector",
|
||||||
|
"iterationCount": "sec:iterationCount",
|
||||||
|
"nonce": "sec:nonce",
|
||||||
|
"normalizationAlgorithm": "sec:normalizationAlgorithm",
|
||||||
|
"owner": {"@id": "sec:owner", "@type": "@id"},
|
||||||
|
"password": "sec:password",
|
||||||
|
"privateKey": {"@id": "sec:privateKey", "@type": "@id"},
|
||||||
|
"privateKeyPem": "sec:privateKeyPem",
|
||||||
|
"publicKey": {"@id": "sec:publicKey", "@type": "@id"},
|
||||||
|
"publicKeyBase58": "sec:publicKeyBase58",
|
||||||
|
"publicKeyPem": "sec:publicKeyPem",
|
||||||
|
"publicKeyService": {"@id": "sec:publicKeyService", "@type": "@id"},
|
||||||
|
"revoked": {"@id": "sec:revoked", "@type": "xsd:dateTime"},
|
||||||
|
"salt": "sec:salt",
|
||||||
|
"signature": "sec:signature",
|
||||||
|
"signatureAlgorithm": "sec:signingAlgorithm",
|
||||||
|
"signatureValue": "sec:signatureValue"
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,10 @@ RSpec.describe ActivityPub::LinkedDataSignature do
|
||||||
|
|
||||||
subject { described_class.new(json) }
|
subject { described_class.new(json) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
stub_jsonld_contexts!
|
||||||
|
end
|
||||||
|
|
||||||
describe '#verify_account!' do
|
describe '#verify_account!' do
|
||||||
context 'when signature matches' do
|
context 'when signature matches' do
|
||||||
let(:raw_signature) do
|
let(:raw_signature) do
|
||||||
|
|
|
@ -50,6 +50,14 @@ RSpec.configure do |config|
|
||||||
Capybara.app_host = "http#{https ? 's' : ''}://#{ENV.fetch('LOCAL_DOMAIN')}"
|
Capybara.app_host = "http#{https ? 's' : ''}://#{ENV.fetch('LOCAL_DOMAIN')}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
config.before :each, type: :controller do
|
||||||
|
stub_jsonld_contexts!
|
||||||
|
end
|
||||||
|
|
||||||
|
config.before :each, type: :service do
|
||||||
|
stub_jsonld_contexts!
|
||||||
|
end
|
||||||
|
|
||||||
config.after :each do
|
config.after :each do
|
||||||
Rails.cache.clear
|
Rails.cache.clear
|
||||||
|
|
||||||
|
@ -69,3 +77,9 @@ end
|
||||||
def attachment_fixture(name)
|
def attachment_fixture(name)
|
||||||
File.open(File.join(Rails.root, 'spec', 'fixtures', 'files', name))
|
File.open(File.join(Rails.root, 'spec', 'fixtures', 'files', name))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def stub_jsonld_contexts!
|
||||||
|
stub_request(:get, 'https://www.w3.org/ns/activitystreams').to_return(request_fixture('json-ld.activitystreams.txt'))
|
||||||
|
stub_request(:get, 'https://w3id.org/identity/v1').to_return(request_fixture('json-ld.identity.txt'))
|
||||||
|
stub_request(:get, 'https://w3id.org/security/v1').to_return(request_fixture('json-ld.security.txt'))
|
||||||
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe AccountSearchService do
|
describe AccountSearchService, type: :service do
|
||||||
describe '.call' do
|
describe '.call' do
|
||||||
describe 'with a query to ignore' do
|
describe 'with a query to ignore' do
|
||||||
it 'returns empty array for missing query' do
|
it 'returns empty array for missing query' do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe ActivityPub::FetchRemoteAccountService do
|
RSpec.describe ActivityPub::FetchRemoteAccountService, type: :service do
|
||||||
subject { ActivityPub::FetchRemoteAccountService.new }
|
subject { ActivityPub::FetchRemoteAccountService.new }
|
||||||
|
|
||||||
let!(:actor) do
|
let!(:actor) do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe ActivityPub::FetchRemoteStatusService do
|
RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
||||||
include ActionView::Helpers::TextHelper
|
include ActionView::Helpers::TextHelper
|
||||||
|
|
||||||
let(:sender) { Fabricate(:account) }
|
let(:sender) { Fabricate(:account) }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe ActivityPub::ProcessAccountService do
|
RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
||||||
subject { described_class.new }
|
subject { described_class.new }
|
||||||
|
|
||||||
context 'property values' do
|
context 'property values' do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe ActivityPub::ProcessCollectionService do
|
RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
|
||||||
let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account') }
|
let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account') }
|
||||||
|
|
||||||
let(:payload) do
|
let(:payload) do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe AfterBlockService do
|
RSpec.describe AfterBlockService, type: :service do
|
||||||
subject do
|
subject do
|
||||||
-> { described_class.new.call(account, target_account) }
|
-> { described_class.new.call(account, target_account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe AuthorizeFollowService do
|
RSpec.describe AuthorizeFollowService, type: :service do
|
||||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||||
|
|
||||||
subject { AuthorizeFollowService.new }
|
subject { AuthorizeFollowService.new }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe BatchedRemoveStatusService do
|
RSpec.describe BatchedRemoveStatusService, type: :service do
|
||||||
subject { BatchedRemoveStatusService.new }
|
subject { BatchedRemoveStatusService.new }
|
||||||
|
|
||||||
let!(:alice) { Fabricate(:account) }
|
let!(:alice) { Fabricate(:account) }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe BlockDomainFromAccountService do
|
RSpec.describe BlockDomainFromAccountService, type: :service do
|
||||||
let!(:wolf) { Fabricate(:account, username: 'wolf', domain: 'evil.org') }
|
let!(:wolf) { Fabricate(:account, username: 'wolf', domain: 'evil.org') }
|
||||||
let!(:alice) { Fabricate(:account, username: 'alice') }
|
let!(:alice) { Fabricate(:account, username: 'alice') }
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe BlockDomainService do
|
RSpec.describe BlockDomainService, type: :service do
|
||||||
let(:bad_account) { Fabricate(:account, username: 'badguy666', domain: 'evil.org') }
|
let(:bad_account) { Fabricate(:account, username: 'badguy666', domain: 'evil.org') }
|
||||||
let(:bad_status1) { Fabricate(:status, account: bad_account, text: 'You suck') }
|
let(:bad_status1) { Fabricate(:status, account: bad_account, text: 'You suck') }
|
||||||
let(:bad_status2) { Fabricate(:status, account: bad_account, text: 'Hahaha') }
|
let(:bad_status2) { Fabricate(:status, account: bad_account, text: 'Hahaha') }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe BlockService do
|
RSpec.describe BlockService, type: :service do
|
||||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||||
|
|
||||||
subject { BlockService.new }
|
subject { BlockService.new }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe BootstrapTimelineService do
|
RSpec.describe BootstrapTimelineService, type: :service do
|
||||||
subject { described_class.new }
|
subject { described_class.new }
|
||||||
|
|
||||||
describe '#call' do
|
describe '#call' do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe FanOutOnWriteService do
|
RSpec.describe FanOutOnWriteService, type: :service do
|
||||||
let(:author) { Fabricate(:account, username: 'tom') }
|
let(:author) { Fabricate(:account, username: 'tom') }
|
||||||
let(:status) { Fabricate(:status, text: 'Hello @alice #test', account: author) }
|
let(:status) { Fabricate(:status, text: 'Hello @alice #test', account: author) }
|
||||||
let(:alice) { Fabricate(:user, account: Fabricate(:account, username: 'alice')).account }
|
let(:alice) { Fabricate(:user, account: Fabricate(:account, username: 'alice')).account }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe FavouriteService do
|
RSpec.describe FavouriteService, type: :service do
|
||||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||||
|
|
||||||
subject { FavouriteService.new }
|
subject { FavouriteService.new }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe FetchAtomService do
|
RSpec.describe FetchAtomService, type: :service do
|
||||||
describe '#call' do
|
describe '#call' do
|
||||||
let(:url) { 'http://example.com' }
|
let(:url) { 'http://example.com' }
|
||||||
subject { FetchAtomService.new.call(url) }
|
subject { FetchAtomService.new.call(url) }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe FetchLinkCardService do
|
RSpec.describe FetchLinkCardService, type: :service do
|
||||||
subject { FetchLinkCardService.new }
|
subject { FetchLinkCardService.new }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -2,7 +2,14 @@
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe ProviderDiscovery do
|
describe FetchOEmbedService, type: :service do
|
||||||
|
subject { described_class.new }
|
||||||
|
|
||||||
|
before do
|
||||||
|
stub_request(:get, "https://host.test/provider.json").to_return(status: 404)
|
||||||
|
stub_request(:get, "https://host.test/provider.xml").to_return(status: 404)
|
||||||
|
end
|
||||||
|
|
||||||
describe 'discover_provider' do
|
describe 'discover_provider' do
|
||||||
context 'when status code is 200 and MIME type is text/html' do
|
context 'when status code is 200 and MIME type is text/html' do
|
||||||
context 'Both of JSON and XML provider are discoverable' do
|
context 'Both of JSON and XML provider are discoverable' do
|
||||||
|
@ -15,15 +22,15 @@ describe ProviderDiscovery do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns new OEmbed::Provider for JSON provider if :format option is set to :json' do
|
it 'returns new OEmbed::Provider for JSON provider if :format option is set to :json' do
|
||||||
provider = ProviderDiscovery.discover_provider('https://host.test/oembed.html', format: :json)
|
subject.call('https://host.test/oembed.html', format: :json)
|
||||||
expect(provider.endpoint).to eq 'https://host.test/provider.json'
|
expect(subject.endpoint_url).to eq 'https://host.test/provider.json'
|
||||||
expect(provider.format).to eq :json
|
expect(subject.format).to eq :json
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns new OEmbed::Provider for XML provider if :format option is set to :xml' do
|
it 'returns new OEmbed::Provider for XML provider if :format option is set to :xml' do
|
||||||
provider = ProviderDiscovery.discover_provider('https://host.test/oembed.html', format: :xml)
|
subject.call('https://host.test/oembed.html', format: :xml)
|
||||||
expect(provider.endpoint).to eq 'https://host.test/provider.xml'
|
expect(subject.endpoint_url).to eq 'https://host.test/provider.xml'
|
||||||
expect(provider.format).to eq :xml
|
expect(subject.format).to eq :xml
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,9 +44,9 @@ describe ProviderDiscovery do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns new OEmbed::Provider for JSON provider' do
|
it 'returns new OEmbed::Provider for JSON provider' do
|
||||||
provider = ProviderDiscovery.discover_provider('https://host.test/oembed.html')
|
subject.call('https://host.test/oembed.html')
|
||||||
expect(provider.endpoint).to eq 'https://host.test/provider.json'
|
expect(subject.endpoint_url).to eq 'https://host.test/provider.json'
|
||||||
expect(provider.format).to eq :json
|
expect(subject.format).to eq :json
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -53,9 +60,9 @@ describe ProviderDiscovery do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns new OEmbed::Provider for XML provider' do
|
it 'returns new OEmbed::Provider for XML provider' do
|
||||||
provider = ProviderDiscovery.discover_provider('https://host.test/oembed.html')
|
subject.call('https://host.test/oembed.html')
|
||||||
expect(provider.endpoint).to eq 'https://host.test/provider.xml'
|
expect(subject.endpoint_url).to eq 'https://host.test/provider.xml'
|
||||||
expect(provider.format).to eq :xml
|
expect(subject.format).to eq :xml
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -68,8 +75,8 @@ describe ProviderDiscovery do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'raises OEmbed::NotFound' do
|
it 'returns nil' do
|
||||||
expect { ProviderDiscovery.discover_provider('https://host.test/oembed.html') }.to raise_error OEmbed::NotFound
|
expect(subject.call('https://host.test/oembed.html')).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -82,8 +89,8 @@ describe ProviderDiscovery do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'raises OEmbed::NotFound' do
|
it 'returns nil' do
|
||||||
expect { ProviderDiscovery.discover_provider('https://host.test/oembed.html') }.to raise_error OEmbed::NotFound
|
expect(subject.call('https://host.test/oembed.html')).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -97,8 +104,8 @@ describe ProviderDiscovery do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'raises OEmbed::NotFound' do
|
it 'returns nil' do
|
||||||
expect { ProviderDiscovery.discover_provider('https://host.test/oembed.html') }.to raise_error OEmbed::NotFound
|
expect(subject.call('https://host.test/oembed.html')).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -110,8 +117,8 @@ describe ProviderDiscovery do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'raises OEmbed::NotFound' do
|
it 'returns nil' do
|
||||||
expect { ProviderDiscovery.discover_provider('https://host.test/oembed.html') }.to raise_error OEmbed::NotFound
|
expect(subject.call('https://host.test/oembed.html')).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe FetchRemoteAccountService do
|
RSpec.describe FetchRemoteAccountService, type: :service do
|
||||||
let(:url) { 'https://example.com' }
|
let(:url) { 'https://example.com' }
|
||||||
let(:prefetched_body) { nil }
|
let(:prefetched_body) { nil }
|
||||||
let(:protocol) { :ostatus }
|
let(:protocol) { :ostatus }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe FetchRemoteStatusService do
|
RSpec.describe FetchRemoteStatusService, type: :service do
|
||||||
let(:account) { Fabricate(:account) }
|
let(:account) { Fabricate(:account) }
|
||||||
let(:prefetched_body) { nil }
|
let(:prefetched_body) { nil }
|
||||||
let(:valid_domain) { Rails.configuration.x.local_domain }
|
let(:valid_domain) { Rails.configuration.x.local_domain }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe FollowService do
|
RSpec.describe FollowService, type: :service do
|
||||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||||
|
|
||||||
subject { FollowService.new }
|
subject { FollowService.new }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe MuteService do
|
RSpec.describe MuteService, type: :service do
|
||||||
subject do
|
subject do
|
||||||
-> { described_class.new.call(account, target_account) }
|
-> { described_class.new.call(account, target_account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe NotifyService do
|
RSpec.describe NotifyService, type: :service do
|
||||||
subject do
|
subject do
|
||||||
-> { described_class.new.call(recipient, activity) }
|
-> { described_class.new.call(recipient, activity) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe PostStatusService do
|
RSpec.describe PostStatusService, type: :service do
|
||||||
subject { PostStatusService.new }
|
subject { PostStatusService.new }
|
||||||
|
|
||||||
it 'creates a new status' do
|
it 'creates a new status' do
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe PrecomputeFeedService do
|
RSpec.describe PrecomputeFeedService, type: :service do
|
||||||
subject { PrecomputeFeedService.new }
|
subject { PrecomputeFeedService.new }
|
||||||
|
|
||||||
describe 'call' do
|
describe 'call' do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe ProcessFeedService do
|
RSpec.describe ProcessFeedService, type: :service do
|
||||||
subject { ProcessFeedService.new }
|
subject { ProcessFeedService.new }
|
||||||
|
|
||||||
describe 'processing a feed' do
|
describe 'processing a feed' do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe ProcessInteractionService do
|
RSpec.describe ProcessInteractionService, type: :service do
|
||||||
let(:receiver) { Fabricate(:user, email: 'alice@example.com', account: Fabricate(:account, username: 'alice')).account }
|
let(:receiver) { Fabricate(:user, email: 'alice@example.com', account: Fabricate(:account, username: 'alice')).account }
|
||||||
let(:sender) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
|
let(:sender) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
|
||||||
let(:remote_sender) { Fabricate(:account, username: 'carol', domain: 'localdomain.com', uri: 'https://webdomain.com/users/carol') }
|
let(:remote_sender) { Fabricate(:account, username: 'carol', domain: 'localdomain.com', uri: 'https://webdomain.com/users/carol') }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe ProcessMentionsService do
|
RSpec.describe ProcessMentionsService, type: :service do
|
||||||
let(:account) { Fabricate(:account, username: 'alice') }
|
let(:account) { Fabricate(:account, username: 'alice') }
|
||||||
let(:status) { Fabricate(:status, account: account, text: "Hello @#{remote_user.acct}") }
|
let(:status) { Fabricate(:status, account: account, text: "Hello @#{remote_user.acct}") }
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe Pubsubhubbub::SubscribeService do
|
describe Pubsubhubbub::SubscribeService, type: :service do
|
||||||
describe '#call' do
|
describe '#call' do
|
||||||
subject { described_class.new }
|
subject { described_class.new }
|
||||||
let(:user_account) { Fabricate(:account) }
|
let(:user_account) { Fabricate(:account) }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe Pubsubhubbub::UnsubscribeService do
|
describe Pubsubhubbub::UnsubscribeService, type: :service do
|
||||||
describe '#call' do
|
describe '#call' do
|
||||||
subject { described_class.new }
|
subject { described_class.new }
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe ReblogService do
|
RSpec.describe ReblogService, type: :service do
|
||||||
let(:alice) { Fabricate(:account, username: 'alice') }
|
let(:alice) { Fabricate(:account, username: 'alice') }
|
||||||
|
|
||||||
context 'OStatus' do
|
context 'OStatus' do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe RejectFollowService do
|
RSpec.describe RejectFollowService, type: :service do
|
||||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||||
|
|
||||||
subject { RejectFollowService.new }
|
subject { RejectFollowService.new }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe RemoveStatusService do
|
RSpec.describe RemoveStatusService, type: :service do
|
||||||
subject { RemoveStatusService.new }
|
subject { RemoveStatusService.new }
|
||||||
|
|
||||||
let!(:alice) { Fabricate(:account) }
|
let!(:alice) { Fabricate(:account) }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe ReportService do
|
RSpec.describe ReportService, type: :service do
|
||||||
subject { described_class.new }
|
subject { described_class.new }
|
||||||
|
|
||||||
let(:source_account) { Fabricate(:account) }
|
let(:source_account) { Fabricate(:account) }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe ResolveAccountService do
|
RSpec.describe ResolveAccountService, type: :service do
|
||||||
subject { described_class.new }
|
subject { described_class.new }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe ResolveURLService do
|
describe ResolveURLService, type: :service do
|
||||||
subject { described_class.new }
|
subject { described_class.new }
|
||||||
|
|
||||||
describe '#call' do
|
describe '#call' do
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe SearchService do
|
describe SearchService, type: :service do
|
||||||
subject { described_class.new }
|
subject { described_class.new }
|
||||||
|
|
||||||
describe '#call' do
|
describe '#call' do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe SendInteractionService do
|
RSpec.describe SendInteractionService, type: :service do
|
||||||
subject { SendInteractionService.new }
|
subject { SendInteractionService.new }
|
||||||
|
|
||||||
it 'sends an XML envelope to the Salmon end point of remote user'
|
it 'sends an XML envelope to the Salmon end point of remote user'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe SubscribeService do
|
RSpec.describe SubscribeService, type: :service do
|
||||||
let(:account) { Fabricate(:account, username: 'bob', domain: 'example.com', hub_url: 'http://hub.example.com') }
|
let(:account) { Fabricate(:account, username: 'bob', domain: 'example.com', hub_url: 'http://hub.example.com') }
|
||||||
subject { SubscribeService.new }
|
subject { SubscribeService.new }
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe SuspendAccountService do
|
RSpec.describe SuspendAccountService, type: :service do
|
||||||
describe '#call' do
|
describe '#call' do
|
||||||
subject do
|
subject do
|
||||||
-> { described_class.new.call(account) }
|
-> { described_class.new.call(account) }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe UnblockDomainService do
|
describe UnblockDomainService, type: :service do
|
||||||
subject { described_class.new }
|
subject { described_class.new }
|
||||||
|
|
||||||
describe 'call' do
|
describe 'call' do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe UnblockService do
|
RSpec.describe UnblockService, type: :service do
|
||||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||||
|
|
||||||
subject { UnblockService.new }
|
subject { UnblockService.new }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe UnfollowService do
|
RSpec.describe UnfollowService, type: :service do
|
||||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||||
|
|
||||||
subject { UnfollowService.new }
|
subject { UnfollowService.new }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe UnmuteService do
|
RSpec.describe UnmuteService, type: :service do
|
||||||
subject { UnmuteService.new }
|
subject { UnmuteService.new }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe UnsubscribeService do
|
RSpec.describe UnsubscribeService, type: :service do
|
||||||
let(:account) { Fabricate(:account, username: 'bob', domain: 'example.com', hub_url: 'http://hub.example.com') }
|
let(:account) { Fabricate(:account, username: 'bob', domain: 'example.com', hub_url: 'http://hub.example.com') }
|
||||||
subject { UnsubscribeService.new }
|
subject { UnsubscribeService.new }
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe UpdateRemoteProfileService do
|
RSpec.describe UpdateRemoteProfileService, type: :service do
|
||||||
let(:xml) { File.read(File.join(Rails.root, 'spec', 'fixtures', 'push', 'feed.atom')) }
|
let(:xml) { File.read(File.join(Rails.root, 'spec', 'fixtures', 'push', 'feed.atom')) }
|
||||||
|
|
||||||
subject { UpdateRemoteProfileService.new }
|
subject { UpdateRemoteProfileService.new }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'rspec/retry'
|
#require 'rspec/retry'
|
||||||
require 'simplecov'
|
require 'simplecov'
|
||||||
|
|
||||||
GC.disable
|
GC.disable
|
||||||
|
@ -12,8 +12,8 @@ end
|
||||||
gc_counter = -1
|
gc_counter = -1
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.verbose_retry = true
|
#config.verbose_retry = true
|
||||||
config.display_try_failure_messages = true
|
#config.display_try_failure_messages = true
|
||||||
|
|
||||||
config.expect_with :rspec do |expectations|
|
config.expect_with :rspec do |expectations|
|
||||||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
||||||
|
@ -29,9 +29,9 @@ RSpec.configure do |config|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
config.around :each do |ex|
|
#config.around :each do |ex|
|
||||||
ex.run_with_retry retry: 3
|
# ex.run_with_retry retry: 3
|
||||||
end
|
#end
|
||||||
|
|
||||||
config.before :suite do
|
config.before :suite do
|
||||||
Chewy.strategy(:bypass)
|
Chewy.strategy(:bypass)
|
||||||
|
|
Loading…
Reference in a new issue