From 0109568470cc50b43eae0ea9edbbc4837d8293df Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 13 Aug 2026 09:11:21 +0000 Subject: [PATCH] Update `mastodon:setup` task warning about trademark to match `masto` but ignore subdomains (#40143) --- lib/tasks/mastodon.rake | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index d080a85aa0d..99615e6b2e3 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -27,10 +27,16 @@ namespace :mastodon do q.messages[:valid?] = 'Invalid domain. If you intend to use unicode characters, enter punycode here' end - if env['LOCAL_DOMAIN'].include?('mastodon') || env['LOCAL_DOMAIN'].include?('mstdn') - prompt.warn 'The Mastodon name is a trademark and its use is restricted.' - prompt.warn 'You can read the trademark policy at https://joinmastodon.org/trademark' - next prompt.warn 'Nothing saved. Bye!' if prompt.no?('Continue anyway?') + begin + # This strips subdomains, only keeping one label + a public suffix + domain = Addressable::URI.new(host: env['LOCAL_DOMAIN']).domain + if domain.include?('masto') || domain.include?('mstdn') + prompt.warn 'The Mastodon name is a trademark and its use is restricted.' + prompt.warn 'You can read the trademark policy at https://joinmastodon.org/trademark' + next prompt.warn 'Nothing saved. Bye!' if prompt.no?('Continue anyway?') + end + rescue Addressable::URI::InvalidURIError + nil end prompt.say "\n"