diff options
author | Starfall <us@starfall.systems> | 2022-04-26 10:41:24 -0500 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2022-04-26 10:41:24 -0500 |
commit | fd98fd86128a5cea302b8496b6c7d5464ec1958a (patch) | |
tree | f3e304a32bed75cb8ab6b1f38652192bff71c5f1 /lib | |
parent | 8da73d2e57284c765b232bfc6842a7ac0f0a702b (diff) | |
parent | a481af15a9b2a7829c2a849906aa4b475ccdbd98 (diff) |
Merge remote-tracking branch 'glitch/main'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/action_dispatch/cookie_jar_extensions.rb | 25 | ||||
-rw-r--r-- | lib/exceptions.rb | 1 | ||||
-rw-r--r-- | lib/mastodon/migration_helpers.rb | 5 | ||||
-rw-r--r-- | lib/mastodon/version.rb | 2 | ||||
-rw-r--r-- | lib/sanitize_ext/sanitize_config.rb | 4 |
5 files changed, 8 insertions, 29 deletions
diff --git a/lib/action_dispatch/cookie_jar_extensions.rb b/lib/action_dispatch/cookie_jar_extensions.rb deleted file mode 100644 index 1be9053ba..000000000 --- a/lib/action_dispatch/cookie_jar_extensions.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -module ActionDispatch - module CookieJarExtensions - private - - # Monkey-patch ActionDispatch to serve secure cookies to Tor Hidden Service - # users. Otherwise, ActionDispatch would drop the cookie over HTTP. - def write_cookie?(*) - request.host.end_with?('.onion') || super - end - end -end - -ActionDispatch::Cookies::CookieJar.prepend(ActionDispatch::CookieJarExtensions) - -module Rack - module SessionPersistedExtensions - def security_matches?(request, options) - request.host.end_with?('.onion') || super - end - end -end - -Rack::Session::Abstract::Persisted.prepend(Rack::SessionPersistedExtensions) diff --git a/lib/exceptions.rb b/lib/exceptions.rb index eb472abaa..0c677b660 100644 --- a/lib/exceptions.rb +++ b/lib/exceptions.rb @@ -10,6 +10,7 @@ module Mastodon class StreamValidationError < ValidationError; end class RaceConditionError < Error; end class RateLimitExceededError < Error; end + class SyntaxError < Error; end class UnexpectedResponseError < Error attr_reader :response diff --git a/lib/mastodon/migration_helpers.rb b/lib/mastodon/migration_helpers.rb index e920ff88f..2ab8150ec 100644 --- a/lib/mastodon/migration_helpers.rb +++ b/lib/mastodon/migration_helpers.rb @@ -812,7 +812,10 @@ module Mastodon # removing the old one def update_index(table_name, index_name, columns, **index_options) if index_name_exists?(table_name, "#{index_name}_new") && index_name_exists?(table_name, index_name) - remove_index table_name, "#{index_name}_new" + remove_index table_name, name: "#{index_name}_new" + elsif index_name_exists?(table_name, "#{index_name}_new") + # Very unlikely case where the script has been interrupted during/after removal but before renaming + rename_index table_name, "#{index_name}_new", index_name end begin diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index ba060a7da..4b4b4b262 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -13,7 +13,7 @@ module Mastodon end def patch - 0 + 1 end def flags diff --git a/lib/sanitize_ext/sanitize_config.rb b/lib/sanitize_ext/sanitize_config.rb index c02de967b..27e1eb92f 100644 --- a/lib/sanitize_ext/sanitize_config.rb +++ b/lib/sanitize_ext/sanitize_config.rb @@ -134,7 +134,7 @@ class Sanitize rel += ['nofollow', 'noopener', 'noreferrer'] unless TagManager.instance.local_url?(node['href']) if rel.empty? - node['rel']&.delete + node.remove_attribute('rel') else node['rel'] = rel.join(' ') end @@ -145,7 +145,7 @@ class Sanitize node = env[:node] if node['target'] != '_blank' && TagManager.instance.local_url?(node['href']) - node['target']&.delete + node.remove_attribute('target') else node['target'] = '_blank' end |