Add frozen_string_literal to all files
and remove redundant freezes
This commit is contained in:
parent
68df3cf555
commit
1dfe57ea7e
253 changed files with 536 additions and 33 deletions
2
Gemfile
2
Gemfile
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
# Declare your gem's dependencies in diaspora_federation.gemspec.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
guard :rspec, cmd: "NO_COVERAGE=true bin/rspec" do
|
||||
require "guard/rspec/dsl"
|
||||
dsl = Guard::RSpec::Dsl.new(self)
|
||||
|
|
|
|||
2
Rakefile
2
Rakefile
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
begin
|
||||
require "bundler/setup"
|
||||
rescue LoadError
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
# Base controller for all DiasporaFederation controllers
|
||||
class ApplicationController < ActionController::Base
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_dependency "diaspora_federation/application_controller"
|
||||
|
||||
module DiasporaFederation
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_dependency "diaspora_federation/application_controller"
|
||||
|
||||
module DiasporaFederation
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_dependency "diaspora_federation/application_controller"
|
||||
|
||||
module DiasporaFederation
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_dependency "diaspora_federation/application_controller"
|
||||
|
||||
module DiasporaFederation
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Don't log received xml data.
|
||||
Rails.application.config.filter_parameters += %i[xml aes_key encrypted_magic_envelope]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# mime types for webfinger
|
||||
Mime::Type.register "application/jrd+json", :jrd
|
||||
Mime::Type.register "application/xrd+xml", :xrd
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
DiasporaFederation::Engine.routes.draw do
|
||||
controller :receive do
|
||||
post "receive/public" => :public, :as => "receive_public"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Spring.application_root = "./test/dummy"
|
||||
|
||||
root_path = Pathname.new(File.expand_path("."))
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
||||
|
||||
# Maintain your gem's version:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
||||
|
||||
# Maintain your gem's version:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
||||
|
||||
# Maintain your gem's version:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
||||
|
||||
# Maintain your gem's version:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "nokogiri"
|
||||
require "openssl"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
# Callbacks are used to communicate with the application. They are called to
|
||||
# fetch data and after data is received.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
# This module provides the namespace for the various classes implementing
|
||||
# WebFinger and other protocols used for metadata discovery on remote servers
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Discovery
|
||||
# This class contains the logic to fetch all data for the given diaspora* ID.
|
||||
|
|
@ -49,13 +51,10 @@ module DiasporaFederation
|
|||
raise "Failed to fetch #{url}: #{response.status}" unless response.success?
|
||||
response.body
|
||||
rescue => e # rubocop:disable Style/RescueStandardError
|
||||
unless http_fallback && url.start_with?("https://")
|
||||
raise DiscoveryError, "Failed to fetch #{url} for #{diaspora_id}: #{e.class}: #{e.message}"
|
||||
end
|
||||
raise DiscoveryError, "Failed to fetch #{url} for #{diaspora_id}: #{e.class}: #{e.message}" unless http_fallback
|
||||
|
||||
logger.warn "Retry with http: #{url} for #{diaspora_id}: #{e.class}: #{e.message}"
|
||||
url.sub!("https://", "http://")
|
||||
retry
|
||||
get(url.sub("https://", "http://"))
|
||||
end
|
||||
|
||||
def domain
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Discovery
|
||||
# Raised, if there is an error while discover a new person
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Discovery
|
||||
# This class provides the means of generating and parsing account data to and
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Discovery
|
||||
# Generates and parses Host Meta documents.
|
||||
|
|
@ -25,7 +27,7 @@ module DiasporaFederation
|
|||
end
|
||||
|
||||
# URL fragment to append to the base URL
|
||||
WEBFINGER_SUFFIX = "/.well-known/webfinger.xml?resource={uri}".freeze
|
||||
WEBFINGER_SUFFIX = "/.well-known/webfinger.xml?resource={uri}"
|
||||
|
||||
# Returns the WebFinger URL that was used to build this instance (either from
|
||||
# xml or by giving a base URL).
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Discovery
|
||||
# The WebFinger document used for diaspora* user discovery is based on an
|
||||
|
|
@ -69,23 +71,23 @@ module DiasporaFederation
|
|||
property :subscribe_url, :string, optional: true
|
||||
|
||||
# +hcard_url+ link relation
|
||||
REL_HCARD = "http://microformats.org/profile/hcard".freeze
|
||||
REL_HCARD = "http://microformats.org/profile/hcard"
|
||||
|
||||
# +seed_url+ link relation
|
||||
REL_SEED = "http://joindiaspora.com/seed_location".freeze
|
||||
REL_SEED = "http://joindiaspora.com/seed_location"
|
||||
|
||||
# +profile_url+ link relation.
|
||||
# @note This might just as well be an +Alias+ instead of a +Link+.
|
||||
REL_PROFILE = "http://webfinger.net/rel/profile-page".freeze
|
||||
REL_PROFILE = "http://webfinger.net/rel/profile-page"
|
||||
|
||||
# +atom_url+ link relation
|
||||
REL_ATOM = "http://schemas.google.com/g/2010#updates-from".freeze
|
||||
REL_ATOM = "http://schemas.google.com/g/2010#updates-from"
|
||||
|
||||
# +salmon_url+ link relation
|
||||
REL_SALMON = "salmon".freeze
|
||||
REL_SALMON = "salmon"
|
||||
|
||||
# +subscribe_url+ link relation
|
||||
REL_SUBSCRIBE = "http://ostatus.org/schema/1.0/subscribe".freeze
|
||||
REL_SUBSCRIBE = "http://ostatus.org/schema/1.0/subscribe"
|
||||
|
||||
# Additional WebFinger data
|
||||
# @return [Hash] additional elements
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Discovery
|
||||
# This class implements basic handling of XRD documents as far as it is
|
||||
|
|
@ -29,13 +31,13 @@ module DiasporaFederation
|
|||
# @see http://docs.oasis-open.org/xri/xrd/v1.0/xrd-1.0.html Extensible Resource Descriptor (XRD) Version 1.0
|
||||
class XrdDocument
|
||||
# xml namespace url
|
||||
XMLNS = "http://docs.oasis-open.org/ns/xri/xrd-1.0".freeze
|
||||
XMLNS = "http://docs.oasis-open.org/ns/xri/xrd-1.0"
|
||||
|
||||
# +Link+ element attributes
|
||||
LINK_ATTRS = %i[rel type href template].freeze
|
||||
|
||||
# format string for datetime (+Expires+ element)
|
||||
DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ".freeze
|
||||
DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
|
||||
|
||||
# The <Expires> element contains a time value which specifies the instant at
|
||||
# and after which the document has expired and SHOULD NOT be used.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
# diaspora* federation rails engine
|
||||
class Engine < ::Rails::Engine
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
# This namespace contains all the entities used to encapsulate data that is
|
||||
# passed around in the diaspora* network as part of the federation protocol.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity is sent when an account was deleted on a remote pod.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity is sent when a person changes their diaspora* ID (e.g. when a user migration
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
class AccountMigration < Entity
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a comment to some kind of post (e.g. status message).
|
||||
|
|
@ -5,7 +7,7 @@ module DiasporaFederation
|
|||
# @see Validators::CommentValidator
|
||||
class Comment < Entity
|
||||
# The {Comment} parent is a {Post}
|
||||
PARENT_TYPE = "Post".freeze
|
||||
PARENT_TYPE = "Post"
|
||||
|
||||
include Relayable
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a contact with another person. A user issues it
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a private conversation between users.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity is used to specify embed information about an URL that should be embedded.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents an event and it is federated as a part of a status message.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a participation in an event, i.e. it is issued when a user responds to en event.
|
||||
|
|
@ -5,7 +7,7 @@ module DiasporaFederation
|
|||
# @see Validators::EventParticipationValidator
|
||||
class EventParticipation < Entity
|
||||
# The {EventParticipation} parent is an {Event}
|
||||
PARENT_TYPE = "Event".freeze
|
||||
PARENT_TYPE = "Event"
|
||||
|
||||
include Relayable
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a like to some kind of post (e.g. status message).
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity is used to specify location data and used embedded in a status message.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a private message exchanged in private conversation.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# Participation is sent to subscribe a user on updates for some post.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity contains the base data of a person.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a photo and it is federated as a part of a status message.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a poll and it is federated as an optional part of a status message.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a poll answer and is federated as a part of the Poll entity.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a participation in poll, i.e. it is issued when a user votes for an answer in a poll.
|
||||
|
|
@ -5,7 +7,7 @@ module DiasporaFederation
|
|||
# @see Validators::PollParticipationValidator
|
||||
class PollParticipation < Entity
|
||||
# The {PollParticipation} parent is a {Poll}
|
||||
PARENT_TYPE = "Poll".freeze
|
||||
PARENT_TYPE = "Poll"
|
||||
|
||||
include Relayable
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This is a module that defines common properties for a post which
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity contains all the profile data of a person.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# Entity meta informations for a related entity (parent or target of
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This is a module that defines common properties for relayable entities
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a claim of deletion of a previously federated
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a sharing request for a user. A user issues it
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents the fact that a user reshared another user's post.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a claim of deletion of a previously federated entity.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# Signable is a module that encapsulates basic signature generation/verification flow for entities.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a claim of deletion of a previously federated
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Entities
|
||||
# This entity represents a status message sent by a user.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
# +Entity+ is the base class for all other objects used to encapsulate data
|
||||
# for federation messages in the diaspora* network.
|
||||
|
|
@ -41,7 +43,7 @@ module DiasporaFederation
|
|||
INVALID_XML_REGEX = /[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}]/
|
||||
|
||||
# Regex to validate and find entity names
|
||||
ENTITY_NAME_REGEX = "[a-z]*(?:_[a-z]*)*".freeze
|
||||
ENTITY_NAME_REGEX = "[a-z]*(?:_[a-z]*)*"
|
||||
|
||||
# Initializes the Entity with the given attribute hash and freezes the created
|
||||
# instance it returns.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
# This module contains the federation logic
|
||||
module Federation
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Federation
|
||||
# This module is for parsing and fetching linked entities.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Federation
|
||||
# This module is for fetching entities from other pods.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Federation
|
||||
# This module parses and receives entities.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Federation
|
||||
module Receiver
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Federation
|
||||
module Receiver
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Federation
|
||||
module Receiver
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Federation
|
||||
module Receiver
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Federation
|
||||
# Federation logic to send messages to other pods
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "typhoeus"
|
||||
|
||||
module DiasporaFederation
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "faraday"
|
||||
require "faraday_middleware/response/follow_redirects"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
# Logging module for the diaspora* federation
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
# This namespace contains parsers which are used to deserialize federation entities
|
||||
# objects from supported formats (XML, JSON) to objects of DiasporaFederation::Entity
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Parsers
|
||||
# +BaseParser+ is an abstract class which is used for defining parsers for different
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Parsers
|
||||
# This is a parser of JSON serialized object. JSON object format is defined by
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Parsers
|
||||
# This is a parser of JSON serialized object, that is normally used for parsing data of relayables.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Parsers
|
||||
# This is a parser of XML serialized object that is normally used for parsing data of relayables.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Parsers
|
||||
# This is a parser of XML serialized object.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
# Provides a simple DSL for specifying {Entity} properties during class
|
||||
# definition.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "diaspora_federation/engine"
|
||||
|
||||
require "diaspora_federation"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
# This module contains a diaspora*-specific implementation of parts of the
|
||||
# {http://www.salmon-protocol.org/ Salmon Protocol}.
|
||||
module Salmon
|
||||
# XML namespace url
|
||||
XMLNS = "https://joindiaspora.com/protocol".freeze
|
||||
XMLNS = "https://joindiaspora.com/protocol"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Salmon
|
||||
# Class for AES encryption and decryption
|
||||
class AES
|
||||
# OpenSSL aes cipher definition
|
||||
CIPHER = "AES-256-CBC".freeze
|
||||
CIPHER = "AES-256-CBC"
|
||||
|
||||
# Generates a random AES key and initialization vector
|
||||
# @return [Hash] { key: "...", iv: "..." }
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Salmon
|
||||
# This is a simple crypt-wrapper for {MagicEnvelope}.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "json"
|
||||
|
||||
module DiasporaFederation
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Salmon
|
||||
# Raised, if the element containing the Magic Envelope is missing from the XML
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Salmon
|
||||
# Represents a Magic Envelope for diaspora* federation messages
|
||||
|
|
@ -24,19 +26,19 @@ module DiasporaFederation
|
|||
include Logging
|
||||
|
||||
# Encoding used for the payload data
|
||||
ENCODING = "base64url".freeze
|
||||
ENCODING = "base64url"
|
||||
|
||||
# Algorithm used for signing the payload data
|
||||
ALGORITHM = "RSA-SHA256".freeze
|
||||
ALGORITHM = "RSA-SHA256"
|
||||
|
||||
# Mime type describing the payload data
|
||||
DATA_TYPE = "application/xml".freeze
|
||||
DATA_TYPE = "application/xml"
|
||||
|
||||
# Digest instance used for signing
|
||||
DIGEST = OpenSSL::Digest::SHA256.new
|
||||
|
||||
# XML namespace url
|
||||
XMLNS = "http://salmon-protocol.org/ns/magic-env".freeze
|
||||
XMLNS = "http://salmon-protocol.org/ns/magic-env"
|
||||
|
||||
# The payload entity of the magic envelope
|
||||
# @return [Entity] payload entity
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Salmon
|
||||
# +Slap+ provides class methods to create unencrypted Slap XML from payload
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Salmon
|
||||
# +XmlPayload+ provides methods to wrap a XML-serialized {Entity} inside a
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "pathname"
|
||||
require "json"
|
||||
|
||||
|
|
@ -5,7 +7,7 @@ module DiasporaFederation
|
|||
# A helper class to access the JSON schema.
|
||||
module Schemas
|
||||
# federation_entities schema uri
|
||||
FEDERATION_ENTITIES_URI = "https://diaspora.github.io/diaspora_federation/schemas/federation_entities.json".freeze
|
||||
FEDERATION_ENTITIES_URI = "https://diaspora.github.io/diaspora_federation/schemas/federation_entities.json"
|
||||
|
||||
# Parsed federation_entities schema
|
||||
def self.federation_entities
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "fabrication"
|
||||
|
||||
require "diaspora_federation"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Test
|
||||
# Generator to instantiate entities
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "uuid"
|
||||
require "securerandom"
|
||||
require "diaspora_federation/test"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "validation"
|
||||
require "validation/rule/regular_expression"
|
||||
require "validation/rule/length"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Validators
|
||||
# This validates a {Entities::AccountDeletion}.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Validators
|
||||
# This validates a {Entities::AccountMigration}.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Validators
|
||||
# This validates a {Entities::Comment}.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Validators
|
||||
# This validates a {Entities::Contact}.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Validators
|
||||
# This validates a {Entities::Conversation}.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Validators
|
||||
# This validates a {Entities::Embed}.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Validators
|
||||
# This validates a {Entities::EventParticipation}.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Validators
|
||||
# This validates a {Entities::Event}.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Validators
|
||||
# This validates a {Discovery::HCard}.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiasporaFederation
|
||||
module Validators
|
||||
# This validates a {Entities::Like}.
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue