about summary refs log tree commit diff
path: root/lib/mastodon
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mastodon')
-rw-r--r--lib/mastodon/domains_cli.rb5
-rw-r--r--lib/mastodon/snowflake.rb13
-rw-r--r--lib/mastodon/version.rb41
3 files changed, 44 insertions, 15 deletions
diff --git a/lib/mastodon/domains_cli.rb b/lib/mastodon/domains_cli.rb
index 5433ddd9d..8a507b44e 100644
--- a/lib/mastodon/domains_cli.rb
+++ b/lib/mastodon/domains_cli.rb
@@ -41,6 +41,11 @@ module Mastodon
         end
       end
 
+      say('Scheduling account defederation messages to be sent to target domains...')
+      DefederateDomainService.new.call(scope.pluck(:domain).uniq)
+      say('Done!', :green)
+
+      say('Deleting accounts from target domains...')
       processed, = parallelize_with_progress(scope) do |account|
         DeleteAccountService.new.call(account, reserve_username: false, skip_side_effects: true) unless options[:dry_run]
       end
diff --git a/lib/mastodon/snowflake.rb b/lib/mastodon/snowflake.rb
index 9e5bc7383..10ed51f0c 100644
--- a/lib/mastodon/snowflake.rb
+++ b/lib/mastodon/snowflake.rb
@@ -120,21 +120,10 @@ module Mastodon::Snowflake
 
         seq_name = data[:seq_prefix] + '_id_seq'
 
-        # If we were on Postgres 9.5+, we could do CREATE SEQUENCE IF
-        # NOT EXISTS, but we can't depend on that. Instead, catch the
-        # possible exception and ignore it.
         # Note that seq_name isn't a column name, but it's a
         # relation, like a column, and follows the same quoting rules
         # in Postgres.
-        connection.execute(<<~SQL)
-          DO $$
-            BEGIN
-              CREATE SEQUENCE #{connection.quote_column_name(seq_name)};
-            EXCEPTION WHEN duplicate_table THEN
-              -- Do nothing, we have the sequence already.
-            END
-          $$ LANGUAGE plpgsql;
-        SQL
+        connection.execute("CREATE SEQUENCE IF NOT EXISTS #{connection.quote_column_name(seq_name)};")
       end
     end
 
diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb
index 429bcb8a5..448518884 100644
--- a/lib/mastodon/version.rb
+++ b/lib/mastodon/version.rb
@@ -21,7 +21,7 @@ module Mastodon
     end
 
     def suffix
-      '+glitch'
+      '+glitch+monsterpit'
     end
 
     def to_a
@@ -33,11 +33,11 @@ module Mastodon
     end
 
     def repository
-      ENV.fetch('GITHUB_REPOSITORY', 'glitch-soc/mastodon')
+      ENV.fetch('GITHUB_REPOSITORY') { 'monsterpit/monsterpit-mastodon' }
     end
 
     def source_base_url
-      ENV.fetch('SOURCE_BASE_URL', "https://github.com/#{repository}")
+      ENV.fetch('SOURCE_BASE_URL') { "https://monsterware.dev/#{repository}" }
     end
 
     # specify git tag or commit hash here
@@ -56,5 +56,40 @@ module Mastodon
     def user_agent
       @user_agent ||= "#{HTTP::Request::USER_AGENT} (Mastodon/#{Version}; +http#{Rails.configuration.x.use_https ? 's' : ''}://#{Rails.configuration.x.web_domain}/)"
     end
+
+    def server_metadata_json
+      @server_metadata_json ||= [
+        {
+          '@context': { 'schema': 'http://schema.org/', name: 'schema:name', value: 'schema:value' },
+          type: 'PropertyValue',
+          name: 'version',
+          value: to_s,
+        },
+        {
+          '@context': { 'schema': 'http://schema.org/', name: 'schema:name', value: 'schema:value' },
+          type: 'PropertyValue',
+          name: 'monsterpit:extensions',
+          value: '2020.09.05.1',
+        },
+        {
+          '@context': { 'schema': 'http://schema.org/', name: 'schema:name', value: 'schema:value' },
+          type: 'PropertyValue',
+          name: 'comment:0',
+          value: "big tails can't fail",
+        },
+        {
+          '@context': { 'schema': 'http://schema.org/', name: 'schema:name', value: 'schema:value' },
+          type: 'PropertyValue',
+          name: 'comment:1',
+          value: 'trans rights!',
+        },
+        {
+          '@context': { 'schema': 'http://schema.org/', name: 'schema:name', value: 'schema:value' },
+          type: 'PropertyValue',
+          name: 'comment:2',
+          value: 'gently the kobolds',
+        },
+      ]
+    end
   end
 end