From 47ea31847908e4b6d0a381130ada5662278d52be Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 9 Sep 2018 13:33:36 +0200 Subject: tootctl accounts [add|del|cull] (#8642) * CLI interface for creating/deleting local users - tootctl accounts add USERNAME - tootctl accounts del USERNAME * Add CLI interface for culling remote users that no longer exist - tootctl accounts cull --- lib/mastodon/accounts_cli.rb | 139 +++++++++++++++++++++++++++++++++++++++++++ lib/mastodon/cli_helper.rb | 1 + 2 files changed, 140 insertions(+) (limited to 'lib') diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/accounts_cli.rb index 83b69549d..d44cdfae9 100644 --- a/lib/mastodon/accounts_cli.rb +++ b/lib/mastodon/accounts_cli.rb @@ -43,6 +43,145 @@ module Mastodon end end + option :email, required: true + option :confirmed, type: :boolean + option :role, default: 'user' + option :reattach, type: :boolean + option :force, type: :boolean + desc 'add USERNAME', 'Create a new user' + long_desc <<-LONG_DESC + Create a new user account with a given USERNAME and an + e-mail address provided with --email. + + With the --confirmed option, the confirmation e-mail will + be skipped and the account will be active straight away. + + With the --role option one of "user", "admin" or "moderator" + can be supplied. Defaults to "user" + + With the --reattach option, the new user will be reattached + to a given existing username of an old account. If the old + account is still in use by someone else, you can supply + the --force option to delete the old record and reattach the + username to the new account anyway. + LONG_DESC + def add(username) + account = Account.new(username: username) + password = SecureRandom.hex + user = User.new(email: options[:email], password: password, admin: options[:role] == 'admin', moderator: options[:role] == 'moderator', confirmed_at: Time.now.utc) + + if options[:reattach] + account = Account.find_local(username) || Account.new(username: username) + + if account.user.present? && !options[:force] + say('The chosen username is currently in use', :red) + say('Use --force to reattach it anyway and delete the other user') + return + elsif account.user.present? + account.user.destroy! + end + end + + user.account = account + + if user.save + if options[:confirmed] + user.confirmed_at = nil + user.confirm! + end + + say('OK', :green) + say("New password: #{password}") + else + user.errors.to_h.each do |key, error| + say('Failure/Error: ', :red) + say(key) + say(' ' + error, :red) + end + end + end + + desc 'del USERNAME', 'Delete a user' + long_desc <<-LONG_DESC + Remove a user account with a given USERNAME. + LONG_DESC + def del(username) + account = Account.find_local(username) + + if account.nil? + say('No user with such username', :red) + return + end + + say("Deleting user with #{account.statuses_count}, this might take a while...") + SuspendAccountService.new.call(account, remove_user: true) + say('OK', :green) + end + + option :dry_run, type: :boolean + desc 'cull', 'Remove remote accounts that no longer exist' + long_desc <<-LONG_DESC + Query every single remote account in the database to determine + if it still exists on the origin server, and if it doesn't, + remove it from the database. + + Accounts that have had confirmed activity within the last week + are excluded from the checks. + + If 10 or more accounts from the same domain cannot be queried + due to a connection error (such as missing DNS records) then + the domain is considered dead, and all other accounts from it + are deleted without further querying. + + With the --dry-run option, no deletes will actually be carried + out. + LONG_DESC + def cull + domain_thresholds = Hash.new { |hash, key| hash[key] = 0 } + skip_threshold = 7.days.ago + culled = 0 + dead_servers = [] + dry_run = options[:dry_run] ? ' (DRY RUN)' : '' + + Account.remote.where(protocol: :activitypub).partitioned.find_each do |account| + next if account.updated_at >= skip_threshold || account.last_webfingered_at >= skip_threshold + + unless dead_servers.include?(account.domain) + begin + code = Request.new(:head, account.uri).perform(&:code) + rescue HTTP::ConnectionError + domain_thresholds[account.domain] += 1 + + if domain_thresholds[account.domain] >= 10 + dead_servers << account.domain + end + rescue StandardError + next + end + end + + if [404, 410].include?(code) || dead_servers.include?(account.domain) + unless options[:dry_run] + SuspendAccountService.new.call(account) + account.destroy + end + + culled += 1 + say('.', :green, false) + else + say('.', nil, false) + end + end + + say + say("Removed #{culled} accounts (#{dead_servers.size} dead servers)#{dry_run}", :green) + + unless dead_servers.empty? + say('R.I.P.:', :yellow) + dead_servers.each { |domain| say(' ' + domain) } + end + end + private def rotate_keys_for_account(account, delay = 0) diff --git a/lib/mastodon/cli_helper.rb b/lib/mastodon/cli_helper.rb index 8c4d9731c..2f807d08c 100644 --- a/lib/mastodon/cli_helper.rb +++ b/lib/mastodon/cli_helper.rb @@ -4,5 +4,6 @@ dev_null = Logger.new('/dev/null') Rails.logger = dev_null ActiveRecord::Base.logger = dev_null +ActiveJob::Base.logger = dev_null HttpLog.configuration.logger = dev_null Paperclip.options[:log] = false -- cgit From b0b484ba1854c61d3b0c71b770bbba849aefc011 Mon Sep 17 00:00:00 2001 From: nightpool Date: Sun, 9 Sep 2018 19:31:42 -0400 Subject: Add rake task for generating AUTHORS.md (#8661) * add rake task for generating AUTHORS.md * update AUTHORS.md * rubocop --- AUTHORS.md | 311 ++++++++++++++++++++++++++++++++++------------------ lib/tasks/repo.rake | 30 +++++ 2 files changed, 232 insertions(+), 109 deletions(-) create mode 100644 lib/tasks/repo.rake (limited to 'lib') diff --git a/AUTHORS.md b/AUTHORS.md index c4bbb6014..0377bb439 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -3,76 +3,85 @@ and provided thanks to the work of the following contributors: * [Gargron](https://github.com/Gargron) * [ykzts](https://github.com/ykzts) -* [mjankowski](https://github.com/mjankowski) * [akihikodaki](https://github.com/akihikodaki) +* [mjankowski](https://github.com/mjankowski) * [unarist](https://github.com/unarist) -* [yiskah](https://github.com/yiskah) +* [ThibG](https://github.com/ThibG) * [m4sk1n](https://github.com/m4sk1n) +* [yiskah](https://github.com/yiskah) * [nolanlawson](https://github.com/nolanlawson) * [sorin-davidoi](https://github.com/sorin-davidoi) * [abcang](https://github.com/abcang) -* [ThibG](https://github.com/ThibG) * [lynlynlynx](https://github.com/lynlynlynx) * [alpaca-tc](https://github.com/alpaca-tc) * [nclm](https://github.com/nclm) * [ineffyble](https://github.com/ineffyble) +* [renatolond](https://github.com/renatolond) * [jeroenpraat](https://github.com/jeroenpraat) * [blackle](https://github.com/blackle) * [Quent-in](https://github.com/Quent-in) * [JantsoP](https://github.com/JantsoP) * [nullkal](https://github.com/nullkal) * [yookoala](https://github.com/yookoala) +* [mayaeh](https://github.com/mayaeh) * [ysksn](https://github.com/ysksn) +* [shuheiktgw](https://github.com/shuheiktgw) * [ashfurrow](https://github.com/ashfurrow) -* [eramdam](https://github.com/eramdam) -* [mayaeh](https://github.com/mayaeh) * [zunda](https://github.com/zunda) -* [ticky](https://github.com/ticky) +* [eramdam](https://github.com/eramdam) +* [Kjwon15](https://github.com/Kjwon15) * [masarakki](https://github.com/masarakki) +* [ticky](https://github.com/ticky) +* [Quenty31](https://github.com/Quenty31) +* [danhunsaker](https://github.com/danhunsaker) +* [ThisIsMissEm](https://github.com/ThisIsMissEm) +* [hcmiya](https://github.com/hcmiya) +* [stephenburgess8](https://github.com/stephenburgess8) * [Wonderfall](https://github.com/Wonderfall) +* [takayamaki](https://github.com/takayamaki) * [matteoaquila](https://github.com/matteoaquila) * [rkarabut](https://github.com/rkarabut) -* [stephenburgess8](https://github.com/stephenburgess8) -* [Kjwon15](https://github.com/Kjwon15) * [Artoria2e5](https://github.com/Artoria2e5) * [yukimochi](https://github.com/yukimochi) * [marrus-sh](https://github.com/marrus-sh) * [krainboltgreene](https://github.com/krainboltgreene) -* [renatolond](https://github.com/renatolond) -* [BoFFire](https://github.com/BoFFire) -* [clworld](https://github.com/clworld) -* [danhunsaker](https://github.com/danhunsaker) * [patf](https://github.com/patf) -* [Quenty31](https://github.com/Quenty31) -* [MitarashiDango](https://github.com/MitarashiDango) * [Aldarone](https://github.com/Aldarone) +* [BoFFire](https://github.com/BoFFire) +* [clworld](https://github.com/clworld) +* [dracos](https://github.com/dracos) +* [SerCom_KC](sercom-kc@users.noreply.github.com) +* [Sylvhem](https://github.com/Sylvhem) +* [nightpool](https://github.com/nightpool) +* [MasterGroosha](https://github.com/MasterGroosha) * [JeanGauthier](https://github.com/JeanGauthier) * [kschaper](https://github.com/kschaper) -* [takayamaki](https://github.com/takayamaki) +* [mabkenar](https://github.com/mabkenar) +* [MitarashiDango](mitarashidango@users.noreply.github.com) +* [beatrix-bitrot](https://github.com/beatrix-bitrot) * [adbelle](https://github.com/adbelle) * [evanminto](https://github.com/evanminto) -* [mabkenar](https://github.com/mabkenar) * [MightyPork](https://github.com/MightyPork) -* [beatrix-bitrot](https://github.com/beatrix-bitrot) * [yhirano55](https://github.com/yhirano55) * [camponez](https://github.com/camponez) +* [MaciekBaron](https://github.com/MaciekBaron) +* [SerCom-KC](https://github.com/SerCom-KC) * [aschmitz](https://github.com/aschmitz) * [fpiesche](https://github.com/fpiesche) * [gandaro](https://github.com/gandaro) * [johnsudaar](https://github.com/johnsudaar) * [trebmuh](https://github.com/trebmuh) -* [Sylvhem](https://github.com/Sylvhem) +* [Rakib Hasan](rmhasan@gmail.com) * [lindwurm](https://github.com/lindwurm) +* [victorhck](victorhck@geeko.site) * [voidsatisfaction](https://github.com/voidsatisfaction) -* [neetshin](https://github.com/neetshin) * [valentin2105](https://github.com/valentin2105) +* [devkral](https://github.com/devkral) * [hikari-no-yume](https://github.com/hikari-no-yume) -* [Angristan](https://github.com/Angristan) +* [angristan](https://github.com/angristan) * [seefood](https://github.com/seefood) * [jackjennings](https://github.com/jackjennings) -* [hcmiya](https://github.com/hcmiya) -* [nightpool](https://github.com/nightpool) -* [salvadorpla](https://github.com/salvadorpla) +* [spla](spla@mastodont.cat) * [expenses](https://github.com/expenses) * [walf443](https://github.com/walf443) * [JoelQ](https://github.com/JoelQ) @@ -85,65 +94,75 @@ and provided thanks to the work of the following contributors: * [victorhck](https://github.com/victorhck) * [puckipedia](https://github.com/puckipedia) * [contraexemplo](https://github.com/contraexemplo) +* [hugogameiro](https://github.com/hugogameiro) * [kazu9su](https://github.com/kazu9su) * [Komic](https://github.com/Komic) * [diomed](https://github.com/diomed) +* [ariasuni](https://github.com/ariasuni) +* [Neetshin](neetshin@neetsh.in) * [rainyday](https://github.com/rainyday) +* [ProgVal](https://github.com/ProgVal) +* [yuntan](https://github.com/yuntan) +* [goofy-bz](goofy@babelzilla.org) * [kadiix](https://github.com/kadiix) * [kodacs](https://github.com/kodacs) -* [ProgVal](https://github.com/ProgVal) +* [fvh-P](https://github.com/fvh-P) +* [rtucker](https://github.com/rtucker) +* [KScl](https://github.com/KScl) * [sterdev](https://github.com/sterdev) * [TheKinrar](https://github.com/TheKinrar) * [AA4ch1](https://github.com/AA4ch1) * [alexgleason](https://github.com/alexgleason) * [cpytel](https://github.com/cpytel) * [northerner](https://github.com/northerner) +* [fhemberger](https://github.com/fhemberger) * [hnrysmth](https://github.com/hnrysmth) -* [hugogameiro](https://github.com/hugogameiro) +* [d6rkaiz](https://github.com/d6rkaiz) +* [JMendyk](https://github.com/JMendyk) * [JohnD28](https://github.com/JohnD28) * [znz](https://github.com/znz) * [Naouak](https://github.com/Naouak) -* [rtucker](https://github.com/rtucker) * [reneklacan](https://github.com/reneklacan) -* [KScl](https://github.com/KScl) -* [SerCom-KC](https://github.com/SerCom-KC) +* [ekiru](https://github.com/ekiru) * [tcitworld](https://github.com/tcitworld) * [geta6](https://github.com/geta6) -* [goofy-bz](https://github.com/goofy-bz) * [happycoloredbanana](https://github.com/happycoloredbanana) * [leopku](https://github.com/leopku) * [SansPseudoFix](https://github.com/SansPseudoFix) * [tomfhowe](https://github.com/tomfhowe) * [noraworld](https://github.com/noraworld) -* [fvh-P](https://github.com/fvh-P) * [178inaba](https://github.com/178inaba) -* [devkral](https://github.com/devkral) * [alyssais](https://github.com/alyssais) * [kodnaplakal](https://github.com/kodnaplakal) * [stalker314314](https://github.com/stalker314314) * [huertanix](https://github.com/huertanix) * [genesixx](https://github.com/genesixx) -* [fhemberger](https://github.com/fhemberger) * [halkeye](https://github.com/halkeye) +* [hinaloe](https://github.com/hinaloe) * [treby](https://github.com/treby) -* [d6rkaiz](https://github.com/d6rkaiz) * [jpdevries](https://github.com/jpdevries) -* [rndm-stranger](https://github.com/rndm-stranger) +* [00x9d](https://github.com/00x9d) +* [Kurtis Rainbolt-Greene](me@kurtisrainboltgreene.name) * [saper](https://github.com/saper) * [nevillepark](https://github.com/nevillepark) * [ornithocoder](https://github.com/ornithocoder) * [pierreozoux](https://github.com/pierreozoux) -* [ramlmn](https://github.com/ramlmn) +* [Ram Lmn](ramlmn@users.noreply.github.com) * [harukasan](https://github.com/harukasan) * [stamak](https://github.com/stamak) +* [theboss](https://github.com/theboss) +* [Technowix](technowix@users.noreply.github.com) * [Eychics](https://github.com/Eychics) -* [thor-the-norseman](https://github.com/thor-the-norseman) +* [Thor Harald Johansen](thj@thj.no) * [0x70b1a5](https://github.com/0x70b1a5) * [gled-rs](https://github.com/gled-rs) * [R0ckweb](https://github.com/R0ckweb) +* [caasi](https://github.com/caasi) * [esetomo](https://github.com/esetomo) * [foxiehkins](https://github.com/foxiehkins) -* [sdukhovni](https://github.com/sdukhovni) +* [hoodie](hoodiekitten@outlook.com) +* [luzi82](https://github.com/luzi82) +* [duxovni](https://github.com/duxovni) * [unsmell](https://github.com/unsmell) * [chriswmartin](https://github.com/chriswmartin) * [vahnj](https://github.com/vahnj) @@ -152,6 +171,7 @@ and provided thanks to the work of the following contributors: * [redtachyons](https://github.com/redtachyons) * [thurloat](https://github.com/thurloat) * [aaribaud](https://github.com/aaribaud) +* [Andrew](andrewlchronister@gmail.com) * [estuans](https://github.com/estuans) * [dissolve](https://github.com/dissolve) * [PurpleBooth](https://github.com/PurpleBooth) @@ -165,7 +185,6 @@ and provided thanks to the work of the following contributors: * [farlistener](https://github.com/farlistener) * [DavidLibeau](https://github.com/DavidLibeau) * [SirCmpwn](https://github.com/SirCmpwn) -* [MasterGroosha](https://github.com/MasterGroosha) * [Fjoerfoks](https://github.com/Fjoerfoks) * [fmauNeko](https://github.com/fmauNeko) * [gloaec](https://github.com/gloaec) @@ -175,26 +194,37 @@ and provided thanks to the work of the following contributors: * [h-izumi](https://github.com/h-izumi) * [ErikXXon](https://github.com/ErikXXon) * [ian-kelling](https://github.com/ian-kelling) +* [immae](https://github.com/immae) +* [Reverite](https://github.com/Reverite) * [foozmeat](https://github.com/foozmeat) * [jasonrhodes](https://github.com/jasonrhodes) -* [asm](https://github.com/asm) +* [Jason Snell](jason@newrelic.com) * [jviide](https://github.com/jviide) * [crakaC](https://github.com/crakaC) * [tkbky](https://github.com/tkbky) +* [Kaylee](kaylee@codethat.sucks) * [Kazhnuz](https://github.com/Kazhnuz) +* [connyduck](https://github.com/connyduck) +* [Lindsey Bieda](lindseyb@users.noreply.github.com) +* [Lorenz Diener](halcyon@icosahedron.website) * [alimony](https://github.com/alimony) * [mig5](https://github.com/mig5) * [ndarville](https://github.com/ndarville) * [Abzol](https://github.com/Abzol) +* [pwoolcoc](https://github.com/pwoolcoc) * [xPaw](https://github.com/xPaw) +* [petzah](https://github.com/petzah) +* [ignisf](https://github.com/ignisf) * [raymestalez](https://github.com/raymestalez) +* [u1-liquid](https://github.com/u1-liquid) * [sim6](https://github.com/sim6) -* [ekiru](https://github.com/ekiru) -* [Technowix](https://github.com/Technowix) +* [stemid](https://github.com/stemid) * [ThomasLeister](https://github.com/ThomasLeister) * [mcat-ee](https://github.com/mcat-ee) * [tototoshi](https://github.com/tototoshi) +* [TrashMacNugget](https://github.com/TrashMacNugget) * [VirtuBox](https://github.com/VirtuBox) +* [Vladyslav](vaden@tuta.io) * [kaniini](https://github.com/kaniini) * [vayan](https://github.com/vayan) * [yannicka](https://github.com/yannicka) @@ -202,12 +232,16 @@ and provided thanks to the work of the following contributors: * [zacanger](https://github.com/zacanger) * [amazedkoumei](https://github.com/amazedkoumei) * [anon5r](https://github.com/anon5r) +* [bsky](me@imbsky.net) +* [chr-1x](https://github.com/chr-1x) * [codl](https://github.com/codl) +* [cpsdqs](https://github.com/cpsdqs) * [barzamin](https://github.com/barzamin) * [fhalna](https://github.com/fhalna) * [haoyayoi](https://github.com/haoyayoi) * [ik11235](https://github.com/ik11235) * [kawax](https://github.com/kawax) +* [kedamaDQ](https://github.com/kedamaDQ) * [007lva](https://github.com/007lva) * [matsurai25](https://github.com/matsurai25) * [mecab](https://github.com/mecab) @@ -215,32 +249,41 @@ and provided thanks to the work of the following contributors: * [oliverkeeble](https://github.com/oliverkeeble) * [pinfort](https://github.com/pinfort) * [rbaumert](https://github.com/rbaumert) +* [trwnh](https://github.com/trwnh) * [usagi-f](https://github.com/usagi-f) * [vidarlee](https://github.com/vidarlee) * [vjackson725](https://github.com/vjackson725) * [wxcafe](https://github.com/wxcafe) * [rinsuki](https://github.com/rinsuki) +* [新都心(Neet Shin)](nucx@dio-vox.com) * [cygnan](https://github.com/cygnan) * [Awea](https://github.com/Awea) * [halcy](https://github.com/halcy) -* [bounshi](https://github.com/bounshi) +* [naaaaaaaaaaaf](https://github.com/naaaaaaaaaaaf) +* [NecroTechno](https://github.com/NecroTechno) * [8398a7](https://github.com/8398a7) * [857b](https://github.com/857b) +* [insom](https://github.com/insom) +* [Aditoo17](https://github.com/Aditoo17) * [unascribed](https://github.com/unascribed) * [Aguay-val](https://github.com/Aguay-val) * [knu](https://github.com/knu) +* [h3poteto](https://github.com/h3poteto) +* [unleashed](https://github.com/unleashed) * [alxrcs](https://github.com/alxrcs) * [console-cowboy](https://github.com/console-cowboy) * [pointlessone](https://github.com/pointlessone) * [a2](https://github.com/a2) * [0xa](https://github.com/0xa) +* [palindromordnilap](https://github.com/palindromordnilap) * [virtualpain](https://github.com/virtualpain) * [sapphirus](https://github.com/sapphirus) * [amandavisconti](https://github.com/amandavisconti) * [ameliavoncat](https://github.com/ameliavoncat) * [ilpianista](https://github.com/ilpianista) -* [andydrop](https://github.com/andydrop) +* [Andreas Drop](andy@remline.de) * [schas002](https://github.com/schas002) +* [abackstrom](https://github.com/abackstrom) * [jumbosushi](https://github.com/jumbosushi) * [ayumin](https://github.com/ayumin) * [BaptisteGelez](https://github.com/BaptisteGelez) @@ -251,6 +294,7 @@ and provided thanks to the work of the following contributors: * [brycied00d](https://github.com/brycied00d) * [carlosjs23](https://github.com/carlosjs23) * [cgxxx](https://github.com/cgxxx) +* [kibitan](https://github.com/kibitan) * [chrisheninger](https://github.com/chrisheninger) * [chris-martin](https://github.com/chris-martin) * [DoubleMalt](https://github.com/DoubleMalt) @@ -259,21 +303,30 @@ and provided thanks to the work of the following contributors: * [chriswk](https://github.com/chriswk) * [csu](https://github.com/csu) * [kklleemm](https://github.com/kklleemm) +* [dachinat](https://github.com/dachinat) * [monsterpit-daggertooth](https://github.com/monsterpit-daggertooth) * [watilde](https://github.com/watilde) * [daprice](https://github.com/daprice) * [dar5hak](https://github.com/dar5hak) * [kant](https://github.com/kant) +* [maxolasersquad](https://github.com/maxolasersquad) * [singingwolfboy](https://github.com/singingwolfboy) * [davidcelis](https://github.com/davidcelis) +* [davefp](https://github.com/davefp) * [yipdw](https://github.com/yipdw) * [debanshuk](https://github.com/debanshuk) +* [Derek Lewis](derekcecillewis@gmail.com) * [dblandin](https://github.com/dblandin) -* [aranaur](https://github.com/aranaur) +* [Drew Gates](aranaur@users.noreply.github.com) +* [dtschust](https://github.com/dtschust) +* [Dryusdan](https://github.com/Dryusdan) +* [eai04191](https://github.com/eai04191) * [d3vgru](https://github.com/d3vgru) * [Elizafox](https://github.com/Elizafox) * [ericblade](https://github.com/ericblade) * [mikoim](https://github.com/mikoim) +* [espenronnevik](https://github.com/espenronnevik) +* [Finariel](https://github.com/Finariel) * [siuying](https://github.com/siuying) * [hattori6789](https://github.com/hattori6789) * [algernon](https://github.com/algernon) @@ -283,21 +336,23 @@ and provided thanks to the work of the following contributors: * [Fiaxhs](https://github.com/Fiaxhs) * [reedcourty](https://github.com/reedcourty) * [anneau](https://github.com/anneau) +* [Harmon758](https://github.com/Harmon758) * [HellPie](https://github.com/HellPie) * [Habu-Kagumba](https://github.com/Habu-Kagumba) -* [hinaloe](https://github.com/hinaloe) * [suzukaze](https://github.com/suzukaze) * [Hiromi-Kai](https://github.com/Hiromi-Kai) +* [hishamhm](https://github.com/hishamhm) * [musashino205](https://github.com/musashino205) * [iwaim](https://github.com/iwaim) * [valrus](https://github.com/valrus) * [IMcD23](https://github.com/IMcD23) * [yi0713](https://github.com/yi0713) -* [immae](https://github.com/immae) * [iblech](https://github.com/iblech) +* [usbsnowcrash](https://github.com/usbsnowcrash) * [jack-michaud](https://github.com/jack-michaud) * [Floppy](https://github.com/Floppy) * [loomchild](https://github.com/loomchild) +* [jenkr55](https://github.com/jenkr55) * [docjkl](https://github.com/docjkl) * [TrollDecker](https://github.com/TrollDecker) * [jmontane](https://github.com/jmontane) @@ -311,24 +366,29 @@ and provided thanks to the work of the following contributors: * [j0k3r](https://github.com/j0k3r) * [KEINOS](https://github.com/KEINOS) * [futoase](https://github.com/futoase) -* [abjectio](https://github.com/abjectio) +* [Pneumaticat](https://github.com/Pneumaticat) +* [Kit Redgrave](qwertyitis@gmail.com) +* [Knut Erik](abjectio@users.noreply.github.com) * [mkody](https://github.com/mkody) -* [connyduck](https://github.com/connyduck) * [k0ta0uchi](https://github.com/k0ta0uchi) * [KrzysiekJ](https://github.com/KrzysiekJ) * [leowzukw](https://github.com/leowzukw) * [lmorchard](https://github.com/lmorchard) +* [Tak](https://github.com/Tak) * [cacheflow](https://github.com/cacheflow) * [ldidry](https://github.com/ldidry) * [jemus42](https://github.com/jemus42) * [lfuelling](https://github.com/lfuelling) * [Grabacr07](https://github.com/Grabacr07) * [mistermantas](https://github.com/mistermantas) +* [mareklach](https://github.com/mareklach) * [wirehack7](https://github.com/wirehack7) +* [martymcguire](https://github.com/martymcguire) * [marvinkopf](https://github.com/marvinkopf) * [otsune](https://github.com/otsune) -* [m-blc](https://github.com/m-blc) +* [Mathias B](10813340+mathias-b@users.noreply.github.com) * [matt-auckland](https://github.com/matt-auckland) +* [matthiasbeyer](https://github.com/matthiasbeyer) * [mattjmattj](https://github.com/mattjmattj) * [mtparet](https://github.com/mtparet) * [maximeborges](https://github.com/maximeborges) @@ -336,7 +396,7 @@ and provided thanks to the work of the following contributors: * [michaeljdeeb](https://github.com/michaeljdeeb) * [Themimitoof](https://github.com/Themimitoof) * [cyweo](https://github.com/cyweo) -* [M1dgard](https://github.com/M1dgard) +* [Midgard](m1dgard@users.noreply.github.com) * [mike-burns](https://github.com/mike-burns) * [verymilan](https://github.com/verymilan) * [milmazz](https://github.com/milmazz) @@ -344,29 +404,38 @@ and provided thanks to the work of the following contributors: * [mitchhentges](https://github.com/mitchhentges) * [moritzheiber](https://github.com/moritzheiber) * [mouse-reeve](https://github.com/mouse-reeve) +* [Mozinet-fr](https://github.com/Mozinet-fr) * [lae](https://github.com/lae) * [Nanamachi](https://github.com/Nanamachi) +* [orinthe](https://github.com/orinthe) +* [Dar13](https://github.com/Dar13) * [ngerakines](https://github.com/ngerakines) * [vonneudeck](https://github.com/vonneudeck) * [Ninetailed](https://github.com/Ninetailed) * [k24](https://github.com/k24) -* [noiob](https://github.com/noiob) +* [Noiob](noiob@users.noreply.github.com) * [kwaio](https://github.com/kwaio) * [norayr](https://github.com/norayr) * [joyeusenoelle](https://github.com/joyeusenoelle) * [OlivierNicole](https://github.com/OlivierNicole) +* [noppa](https://github.com/noppa) * [Otakan951](https://github.com/Otakan951) * [fahy](https://github.com/fahy) +* [PatrickRWells](https://github.com/PatrickRWells) * [Pangoraw](https://github.com/Pangoraw) -* [pwoolcoc](https://github.com/pwoolcoc) * [peterkeen](https://github.com/peterkeen) -* [petzah](https://github.com/petzah) -* [ignisf](https://github.com/ignisf) +* [pgate](https://github.com/pgate) +* [qguv](https://github.com/qguv) +* [remram44](https://github.com/remram44) +* [retokromer](https://github.com/retokromer) * [rfwatson](https://github.com/rfwatson) * [rfreebern](https://github.com/rfreebern) +* [Ryan Wade](ryan.wade@protonmail.com) * [sylph01](https://github.com/sylph01) +* [S-H-GAMELINKS](https://github.com/S-H-GAMELINKS) * [staticsafe](https://github.com/staticsafe) * [snwh](https://github.com/snwh) +* [sts10](https://github.com/sts10) * [skoji](https://github.com/skoji) * [ScienJus](https://github.com/ScienJus) * [larkinscott](https://github.com/larkinscott) @@ -378,73 +447,97 @@ and provided thanks to the work of the following contributors: * [ernix](https://github.com/ernix) * [rosylilly](https://github.com/rosylilly) * [shouko](https://github.com/shouko) +* [Sina Mashek](sina@mashek.xyz) * [sossii](https://github.com/sossii) +* [SpankyWorks](https://github.com/SpankyWorks) * [StefOfficiel](https://github.com/StefOfficiel) * [svetlik](https://github.com/svetlik) * [dereckson](https://github.com/dereckson) -* [theboss](https://github.com/theboss) +* [phaedryx](https://github.com/phaedryx) * [takp](https://github.com/takp) * [tkusano](https://github.com/tkusano) +* [TakesxiSximada](https://github.com/TakesxiSximada) * [TheInventrix](https://github.com/TheInventrix) * [shug0](https://github.com/shug0) * [Fortyseven](https://github.com/Fortyseven) * [tobypinder](https://github.com/tobypinder) * [tomosm](https://github.com/tomosm) * [TomoyaShibata](https://github.com/TomoyaShibata) -* [TrashMacNugget](https://github.com/TrashMacNugget) * [treyssatvincent](https://github.com/treyssatvincent) -* [optikfluffel](https://github.com/optikfluffel) -* [vmincev](https://github.com/vmincev) -* [waldyrious](https://github.com/waldyrious) -* [tahnok](https://github.com/tahnok) -* [YDrogen](https://github.com/YDrogen) -* [YOSHIOKAEiichiro](https://github.com/YOSHIOKAEiichiro) -* [S-YOU](https://github.com/S-YOU) -* [YaQ00](https://github.com/YaQ00) -* [yanakend](https://github.com/yanakend) -* [orzFly](https://github.com/orzFly) -* [chansuke](https://github.com/chansuke) -* [yuntan](https://github.com/yuntan) -* [LogicalDash](https://github.com/LogicalDash) -* [ZiiX](https://github.com/ZiiX) -* [benklop](https://github.com/benklop) -* [caasi](https://github.com/caasi) -* [caesarologia](https://github.com/caesarologia) -* [chrolis](https://github.com/chrolis) -* [cormojs](https://github.com/cormojs) -* [cpsdqs](https://github.com/cpsdqs) -* [d0p1s4m4](https://github.com/d0p1s4m4) -* [evilny0](https://github.com/evilny0) -* [febrezo](https://github.com/febrezo) -* [fsubal](https://github.com/fsubal) -* [dikky1218](https://github.com/dikky1218) -* [gentarok](https://github.com/gentarok) -* [hakoai](https://github.com/hakoai) -* [chaosbunker](https://github.com/chaosbunker) -* [isati](https://github.com/isati) -* [jkap](https://github.com/jkap) -* [jirayudech](https://github.com/jirayudech) -* [jukper](https://github.com/jukper) -* [karlyeurl](https://github.com/karlyeurl) -* [kedamaDQ](https://github.com/kedamaDQ) -* [kuro5hin](https://github.com/kuro5hin) -* [maxypy](https://github.com/maxypy) -* [marcus-herrmann](https://github.com/marcus-herrmann) -* [mshrtkch](https://github.com/mshrtkch) -* [muan](https://github.com/muan) -* [rch850](https://github.com/rch850) -* [roikale](https://github.com/roikale) -* [rysiekpl](https://github.com/rysiekpl) -* [saturday06](https://github.com/saturday06) -* [scriptjunkie](https://github.com/scriptjunkie) -* [seekr](https://github.com/seekr) -* [syui](https://github.com/syui) -* [tackeyy](https://github.com/tackeyy) -* [tmyt](https://github.com/tmyt) -* [utam0k](https://github.com/utam0k) -* [vpzomtrrfrt](https://github.com/vpzomtrrfrt) -* [walfie](https://github.com/walfie) -* [y-temp4](https://github.com/y-temp4) -* [ymmtmdk](https://github.com/ymmtmdk) +* [Udo Kramer](optik@fluffel.io) +* [Una](una@unascribed.com) +* [Ushitora Anqou](ushitora_anqou@yahoo.co.jp) +* [Valentin Lorentz](progval+git@progval.net) +* [Vladimir Mincev](vladimir@canicinteractive.com) +* [Waldir Pimenta](waldyrious@gmail.com) +* [Wesley Ellis](tahnok@gmail.com) +* [Wiktor](wiktor@metacode.biz) +* [Wonderfall](wonderfall@schrodinger.io) +* [YDrogen](ydrogen45@gmail.com) +* [YMHuang](ymhuang@fmbase.tw) +* [YOSHIOKA Eiichiro](yoshioka.eiichiro@gmail.com) +* [YOU](stackexchange.you@gmail.com) +* [YaQ](i_k_o_m_a_7@yahoo.co.jp) +* [Yanaken](yanakend@gmail.com) +* [Yann Klis](yann.klis@gmail.com) +* [Yeechan Lu](wz.bluesnow@gmail.com) +* [Yusuke Abe](moonset20@gmail.com) +* [Zachary Spector](logicaldash@gmail.com) +* [ZiiX](ziix@users.noreply.github.com) +* [asria-jp](is@alicematic.com) +* [ava](vladooku@users.noreply.github.com) +* [benklop](benklop@gmail.com) +* [bsky](git@imbsky.net) +* [caesarologia](lopesgemelli.1@gmail.com) +* [chrolis](chrolis@users.noreply.github.com) +* [cormo](cormorant2+github@gmail.com) +* [d0p1](dopi-sama@hush.com) +* [evilny0](evilny0@moomoocamp.net) +* [febrezo](felixbrezo@gmail.com) +* [fsubal](fsubal@users.noreply.github.com) +* [fusshi-](dikky1218@users.noreply.github.com) +* [gentaro](gentaroooo@gmail.com) +* [hakoai](hk--76@qa2.so-net.ne.jp) +* [haosbvnker](github@chaosbunker.com) +* [isati](phil@juchnowi.cz) +* [jenn kaplan](me@jkap.io) +* [jirayudech](jirayudech@gmail.com) +* [jukper](jukkaperanto@gmail.com) +* [jumoru](jumoru@mailbox.org) +* [karlyeurl](karl.yeurl@gmail.com) +* [kedama](32974885+kedamadq@users.noreply.github.com) +* [kuro5hin](rusty@kuro5hin.org) +* [maxypy](maxime@mpigou.fr) +* [mhe](mail@marcus-herrmann.com) +* [mimikun](dzdzble_effort_311@outlook.jp) +* [mshrtkch](mshrtkch@users.noreply.github.com) +* [muan](muan@github.com) +* [neetshin](neetshin@neetsh.in) +* [rch850](rich850@gmail.com) +* [roikale](roikale@users.noreply.github.com) +* [rysiekpl](rysiek@hackerspace.pl) +* [saturday06](dyob@lunaport.net) +* [scriptjunkie](scriptjunkie@scriptjunkie.us) +* [seekr](mario.drs@gmail.com) +* [sundevour](31990469+sundevour@users.noreply.github.com) +* [syui](syui@users.noreply.github.com) +* [tackeyy](mailto.takita.yusuke@gmail.com) +* [tateisu](tateisu@gmail.com) +* [tmyt](shigure@refy.net) +* [utam0k](k0ma@utam0k.jp) +* [vpzomtrrfrt](vpzomtrrfrt@gmail.com) +* [walfie](walfington@gmail.com) +* [y-temp4](y.temp4@gmail.com) +* [ymmtmdk](ymmtmdk@gmail.com) +* [yoshipc](yoooo@yoshipc.net) +* [Özcan Zafer AYAN](ozcanzaferayan@gmail.com) +* [ばん](detteiu0321@gmail.com) +* [みたらしだんご](mitarashidango@users.noreply.github.com) +* [りんすき](6533808+rinsuki@users.noreply.github.com) +* [ヨイツの賢狼ホロ | 3rd style](horo@yoitsu.moe) +* [猫吸血鬼ディフリス / 猫ロキP](deflis@gmail.com) +* [艮 鮟鱇](ushitora_anqou@yahoo.co.jp) +* [西小倉宏信](nishiko@mindia.jp) +* [雨宮美羽](k737566@gmail.com) This document is provided for informational purposes only. Since it is only updated once per release, the version you are looking at may be currently out of date. To see the full list of contributors, consider looking at the [git history](https://github.com/tootsuite/mastodon/graphs/contributors) instead. diff --git a/lib/tasks/repo.rake b/lib/tasks/repo.rake new file mode 100644 index 000000000..216e37ef2 --- /dev/null +++ b/lib/tasks/repo.rake @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +namespace :repo do + desc 'Generate the authors.md file' + task :authors do + file = File.open('AUTHORS.md', 'w') + file << <<~HEADER + Mastodon is available on [GitHub](https://github.com/tootsuite/mastodon) + and provided thanks to the work of the following contributors: + + HEADER + + url = 'https://api.github.com/repos/tootsuite/mastodon/contributors?anon=1' + HttpLog.config.compact_log = true + while url.present? + response = HTTP.get(url) + contributors = Oj.load(response.body) + contributors.each do |c| + file << "* [#{c['login']}](#{c['html_url']})\n" if c['login'] + file << "* [#{c['name']}](#{c['email']})\n" if c['name'] + end + url = LinkHeader.parse(response.headers['Link']).find_link(%w(rel next))&.href + end + + file << <<~FOOTER + + This document is provided for informational purposes only. Since it is only updated once per release, the version you are looking at may be currently out of date. To see the full list of contributors, consider looking at the [git history](https://github.com/tootsuite/mastodon/graphs/contributors) instead. + FOOTER + end +end -- cgit From 25dd523887dd32261ff201eab05f12ed46f6f6ba Mon Sep 17 00:00:00 2001 From: rinsuki <428rinsuki+git@gmail.com> Date: Mon, 10 Sep 2018 09:01:03 +0900 Subject: using mailto scheme in AUTHORS.md (#8663) --- AUTHORS.md | 210 ++++++++++++++++++++++++++-------------------------- lib/tasks/repo.rake | 2 +- 2 files changed, 106 insertions(+), 106 deletions(-) (limited to 'lib') diff --git a/AUTHORS.md b/AUTHORS.md index 0377bb439..abcc24384 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -50,14 +50,14 @@ and provided thanks to the work of the following contributors: * [BoFFire](https://github.com/BoFFire) * [clworld](https://github.com/clworld) * [dracos](https://github.com/dracos) -* [SerCom_KC](sercom-kc@users.noreply.github.com) +* [SerCom_KC](mailto:sercom-kc@users.noreply.github.com) * [Sylvhem](https://github.com/Sylvhem) * [nightpool](https://github.com/nightpool) * [MasterGroosha](https://github.com/MasterGroosha) * [JeanGauthier](https://github.com/JeanGauthier) * [kschaper](https://github.com/kschaper) * [mabkenar](https://github.com/mabkenar) -* [MitarashiDango](mitarashidango@users.noreply.github.com) +* [MitarashiDango](mailto:mitarashidango@users.noreply.github.com) * [beatrix-bitrot](https://github.com/beatrix-bitrot) * [adbelle](https://github.com/adbelle) * [evanminto](https://github.com/evanminto) @@ -71,9 +71,9 @@ and provided thanks to the work of the following contributors: * [gandaro](https://github.com/gandaro) * [johnsudaar](https://github.com/johnsudaar) * [trebmuh](https://github.com/trebmuh) -* [Rakib Hasan](rmhasan@gmail.com) +* [Rakib Hasan](mailto:rmhasan@gmail.com) * [lindwurm](https://github.com/lindwurm) -* [victorhck](victorhck@geeko.site) +* [victorhck](mailto:victorhck@geeko.site) * [voidsatisfaction](https://github.com/voidsatisfaction) * [valentin2105](https://github.com/valentin2105) * [devkral](https://github.com/devkral) @@ -81,7 +81,7 @@ and provided thanks to the work of the following contributors: * [angristan](https://github.com/angristan) * [seefood](https://github.com/seefood) * [jackjennings](https://github.com/jackjennings) -* [spla](spla@mastodont.cat) +* [spla](mailto:spla@mastodont.cat) * [expenses](https://github.com/expenses) * [walf443](https://github.com/walf443) * [JoelQ](https://github.com/JoelQ) @@ -99,11 +99,11 @@ and provided thanks to the work of the following contributors: * [Komic](https://github.com/Komic) * [diomed](https://github.com/diomed) * [ariasuni](https://github.com/ariasuni) -* [Neetshin](neetshin@neetsh.in) +* [Neetshin](mailto:neetshin@neetsh.in) * [rainyday](https://github.com/rainyday) * [ProgVal](https://github.com/ProgVal) * [yuntan](https://github.com/yuntan) -* [goofy-bz](goofy@babelzilla.org) +* [goofy-bz](mailto:goofy@babelzilla.org) * [kadiix](https://github.com/kadiix) * [kodacs](https://github.com/kodacs) * [fvh-P](https://github.com/fvh-P) @@ -142,25 +142,25 @@ and provided thanks to the work of the following contributors: * [treby](https://github.com/treby) * [jpdevries](https://github.com/jpdevries) * [00x9d](https://github.com/00x9d) -* [Kurtis Rainbolt-Greene](me@kurtisrainboltgreene.name) +* [Kurtis Rainbolt-Greene](mailto:me@kurtisrainboltgreene.name) * [saper](https://github.com/saper) * [nevillepark](https://github.com/nevillepark) * [ornithocoder](https://github.com/ornithocoder) * [pierreozoux](https://github.com/pierreozoux) -* [Ram Lmn](ramlmn@users.noreply.github.com) +* [Ram Lmn](mailto:ramlmn@users.noreply.github.com) * [harukasan](https://github.com/harukasan) * [stamak](https://github.com/stamak) * [theboss](https://github.com/theboss) -* [Technowix](technowix@users.noreply.github.com) +* [Technowix](mailto:technowix@users.noreply.github.com) * [Eychics](https://github.com/Eychics) -* [Thor Harald Johansen](thj@thj.no) +* [Thor Harald Johansen](mailto:thj@thj.no) * [0x70b1a5](https://github.com/0x70b1a5) * [gled-rs](https://github.com/gled-rs) * [R0ckweb](https://github.com/R0ckweb) * [caasi](https://github.com/caasi) * [esetomo](https://github.com/esetomo) * [foxiehkins](https://github.com/foxiehkins) -* [hoodie](hoodiekitten@outlook.com) +* [hoodie](mailto:hoodiekitten@outlook.com) * [luzi82](https://github.com/luzi82) * [duxovni](https://github.com/duxovni) * [unsmell](https://github.com/unsmell) @@ -171,7 +171,7 @@ and provided thanks to the work of the following contributors: * [redtachyons](https://github.com/redtachyons) * [thurloat](https://github.com/thurloat) * [aaribaud](https://github.com/aaribaud) -* [Andrew](andrewlchronister@gmail.com) +* [Andrew](mailto:andrewlchronister@gmail.com) * [estuans](https://github.com/estuans) * [dissolve](https://github.com/dissolve) * [PurpleBooth](https://github.com/PurpleBooth) @@ -198,15 +198,15 @@ and provided thanks to the work of the following contributors: * [Reverite](https://github.com/Reverite) * [foozmeat](https://github.com/foozmeat) * [jasonrhodes](https://github.com/jasonrhodes) -* [Jason Snell](jason@newrelic.com) +* [Jason Snell](mailto:jason@newrelic.com) * [jviide](https://github.com/jviide) * [crakaC](https://github.com/crakaC) * [tkbky](https://github.com/tkbky) -* [Kaylee](kaylee@codethat.sucks) +* [Kaylee](mailto:kaylee@codethat.sucks) * [Kazhnuz](https://github.com/Kazhnuz) * [connyduck](https://github.com/connyduck) -* [Lindsey Bieda](lindseyb@users.noreply.github.com) -* [Lorenz Diener](halcyon@icosahedron.website) +* [Lindsey Bieda](mailto:lindseyb@users.noreply.github.com) +* [Lorenz Diener](mailto:halcyon@icosahedron.website) * [alimony](https://github.com/alimony) * [mig5](https://github.com/mig5) * [ndarville](https://github.com/ndarville) @@ -224,7 +224,7 @@ and provided thanks to the work of the following contributors: * [tototoshi](https://github.com/tototoshi) * [TrashMacNugget](https://github.com/TrashMacNugget) * [VirtuBox](https://github.com/VirtuBox) -* [Vladyslav](vaden@tuta.io) +* [Vladyslav](mailto:vaden@tuta.io) * [kaniini](https://github.com/kaniini) * [vayan](https://github.com/vayan) * [yannicka](https://github.com/yannicka) @@ -232,7 +232,7 @@ and provided thanks to the work of the following contributors: * [zacanger](https://github.com/zacanger) * [amazedkoumei](https://github.com/amazedkoumei) * [anon5r](https://github.com/anon5r) -* [bsky](me@imbsky.net) +* [bsky](mailto:me@imbsky.net) * [chr-1x](https://github.com/chr-1x) * [codl](https://github.com/codl) * [cpsdqs](https://github.com/cpsdqs) @@ -255,7 +255,7 @@ and provided thanks to the work of the following contributors: * [vjackson725](https://github.com/vjackson725) * [wxcafe](https://github.com/wxcafe) * [rinsuki](https://github.com/rinsuki) -* [新都心(Neet Shin)](nucx@dio-vox.com) +* [新都心(Neet Shin)](mailto:nucx@dio-vox.com) * [cygnan](https://github.com/cygnan) * [Awea](https://github.com/Awea) * [halcy](https://github.com/halcy) @@ -281,7 +281,7 @@ and provided thanks to the work of the following contributors: * [amandavisconti](https://github.com/amandavisconti) * [ameliavoncat](https://github.com/ameliavoncat) * [ilpianista](https://github.com/ilpianista) -* [Andreas Drop](andy@remline.de) +* [Andreas Drop](mailto:andy@remline.de) * [schas002](https://github.com/schas002) * [abackstrom](https://github.com/abackstrom) * [jumbosushi](https://github.com/jumbosushi) @@ -315,9 +315,9 @@ and provided thanks to the work of the following contributors: * [davefp](https://github.com/davefp) * [yipdw](https://github.com/yipdw) * [debanshuk](https://github.com/debanshuk) -* [Derek Lewis](derekcecillewis@gmail.com) +* [Derek Lewis](mailto:derekcecillewis@gmail.com) * [dblandin](https://github.com/dblandin) -* [Drew Gates](aranaur@users.noreply.github.com) +* [Drew Gates](mailto:aranaur@users.noreply.github.com) * [dtschust](https://github.com/dtschust) * [Dryusdan](https://github.com/Dryusdan) * [eai04191](https://github.com/eai04191) @@ -367,8 +367,8 @@ and provided thanks to the work of the following contributors: * [KEINOS](https://github.com/KEINOS) * [futoase](https://github.com/futoase) * [Pneumaticat](https://github.com/Pneumaticat) -* [Kit Redgrave](qwertyitis@gmail.com) -* [Knut Erik](abjectio@users.noreply.github.com) +* [Kit Redgrave](mailto:qwertyitis@gmail.com) +* [Knut Erik](mailto:abjectio@users.noreply.github.com) * [mkody](https://github.com/mkody) * [k0ta0uchi](https://github.com/k0ta0uchi) * [KrzysiekJ](https://github.com/KrzysiekJ) @@ -386,7 +386,7 @@ and provided thanks to the work of the following contributors: * [martymcguire](https://github.com/martymcguire) * [marvinkopf](https://github.com/marvinkopf) * [otsune](https://github.com/otsune) -* [Mathias B](10813340+mathias-b@users.noreply.github.com) +* [Mathias B](mailto:10813340+mathias-b@users.noreply.github.com) * [matt-auckland](https://github.com/matt-auckland) * [matthiasbeyer](https://github.com/matthiasbeyer) * [mattjmattj](https://github.com/mattjmattj) @@ -396,7 +396,7 @@ and provided thanks to the work of the following contributors: * [michaeljdeeb](https://github.com/michaeljdeeb) * [Themimitoof](https://github.com/Themimitoof) * [cyweo](https://github.com/cyweo) -* [Midgard](m1dgard@users.noreply.github.com) +* [Midgard](mailto:m1dgard@users.noreply.github.com) * [mike-burns](https://github.com/mike-burns) * [verymilan](https://github.com/verymilan) * [milmazz](https://github.com/milmazz) @@ -413,7 +413,7 @@ and provided thanks to the work of the following contributors: * [vonneudeck](https://github.com/vonneudeck) * [Ninetailed](https://github.com/Ninetailed) * [k24](https://github.com/k24) -* [Noiob](noiob@users.noreply.github.com) +* [Noiob](mailto:noiob@users.noreply.github.com) * [kwaio](https://github.com/kwaio) * [norayr](https://github.com/norayr) * [joyeusenoelle](https://github.com/joyeusenoelle) @@ -430,7 +430,7 @@ and provided thanks to the work of the following contributors: * [retokromer](https://github.com/retokromer) * [rfwatson](https://github.com/rfwatson) * [rfreebern](https://github.com/rfreebern) -* [Ryan Wade](ryan.wade@protonmail.com) +* [Ryan Wade](mailto:ryan.wade@protonmail.com) * [sylph01](https://github.com/sylph01) * [S-H-GAMELINKS](https://github.com/S-H-GAMELINKS) * [staticsafe](https://github.com/staticsafe) @@ -447,7 +447,7 @@ and provided thanks to the work of the following contributors: * [ernix](https://github.com/ernix) * [rosylilly](https://github.com/rosylilly) * [shouko](https://github.com/shouko) -* [Sina Mashek](sina@mashek.xyz) +* [Sina Mashek](mailto:sina@mashek.xyz) * [sossii](https://github.com/sossii) * [SpankyWorks](https://github.com/SpankyWorks) * [StefOfficiel](https://github.com/StefOfficiel) @@ -464,80 +464,80 @@ and provided thanks to the work of the following contributors: * [tomosm](https://github.com/tomosm) * [TomoyaShibata](https://github.com/TomoyaShibata) * [treyssatvincent](https://github.com/treyssatvincent) -* [Udo Kramer](optik@fluffel.io) -* [Una](una@unascribed.com) -* [Ushitora Anqou](ushitora_anqou@yahoo.co.jp) -* [Valentin Lorentz](progval+git@progval.net) -* [Vladimir Mincev](vladimir@canicinteractive.com) -* [Waldir Pimenta](waldyrious@gmail.com) -* [Wesley Ellis](tahnok@gmail.com) -* [Wiktor](wiktor@metacode.biz) -* [Wonderfall](wonderfall@schrodinger.io) -* [YDrogen](ydrogen45@gmail.com) -* [YMHuang](ymhuang@fmbase.tw) -* [YOSHIOKA Eiichiro](yoshioka.eiichiro@gmail.com) -* [YOU](stackexchange.you@gmail.com) -* [YaQ](i_k_o_m_a_7@yahoo.co.jp) -* [Yanaken](yanakend@gmail.com) -* [Yann Klis](yann.klis@gmail.com) -* [Yeechan Lu](wz.bluesnow@gmail.com) -* [Yusuke Abe](moonset20@gmail.com) -* [Zachary Spector](logicaldash@gmail.com) -* [ZiiX](ziix@users.noreply.github.com) -* [asria-jp](is@alicematic.com) -* [ava](vladooku@users.noreply.github.com) -* [benklop](benklop@gmail.com) -* [bsky](git@imbsky.net) -* [caesarologia](lopesgemelli.1@gmail.com) -* [chrolis](chrolis@users.noreply.github.com) -* [cormo](cormorant2+github@gmail.com) -* [d0p1](dopi-sama@hush.com) -* [evilny0](evilny0@moomoocamp.net) -* [febrezo](felixbrezo@gmail.com) -* [fsubal](fsubal@users.noreply.github.com) -* [fusshi-](dikky1218@users.noreply.github.com) -* [gentaro](gentaroooo@gmail.com) -* [hakoai](hk--76@qa2.so-net.ne.jp) -* [haosbvnker](github@chaosbunker.com) -* [isati](phil@juchnowi.cz) -* [jenn kaplan](me@jkap.io) -* [jirayudech](jirayudech@gmail.com) -* [jukper](jukkaperanto@gmail.com) -* [jumoru](jumoru@mailbox.org) -* [karlyeurl](karl.yeurl@gmail.com) -* [kedama](32974885+kedamadq@users.noreply.github.com) -* [kuro5hin](rusty@kuro5hin.org) -* [maxypy](maxime@mpigou.fr) -* [mhe](mail@marcus-herrmann.com) -* [mimikun](dzdzble_effort_311@outlook.jp) -* [mshrtkch](mshrtkch@users.noreply.github.com) -* [muan](muan@github.com) -* [neetshin](neetshin@neetsh.in) -* [rch850](rich850@gmail.com) -* [roikale](roikale@users.noreply.github.com) -* [rysiekpl](rysiek@hackerspace.pl) -* [saturday06](dyob@lunaport.net) -* [scriptjunkie](scriptjunkie@scriptjunkie.us) -* [seekr](mario.drs@gmail.com) -* [sundevour](31990469+sundevour@users.noreply.github.com) -* [syui](syui@users.noreply.github.com) -* [tackeyy](mailto.takita.yusuke@gmail.com) -* [tateisu](tateisu@gmail.com) -* [tmyt](shigure@refy.net) -* [utam0k](k0ma@utam0k.jp) -* [vpzomtrrfrt](vpzomtrrfrt@gmail.com) -* [walfie](walfington@gmail.com) -* [y-temp4](y.temp4@gmail.com) -* [ymmtmdk](ymmtmdk@gmail.com) -* [yoshipc](yoooo@yoshipc.net) -* [Özcan Zafer AYAN](ozcanzaferayan@gmail.com) -* [ばん](detteiu0321@gmail.com) -* [みたらしだんご](mitarashidango@users.noreply.github.com) -* [りんすき](6533808+rinsuki@users.noreply.github.com) -* [ヨイツの賢狼ホロ | 3rd style](horo@yoitsu.moe) -* [猫吸血鬼ディフリス / 猫ロキP](deflis@gmail.com) -* [艮 鮟鱇](ushitora_anqou@yahoo.co.jp) -* [西小倉宏信](nishiko@mindia.jp) -* [雨宮美羽](k737566@gmail.com) +* [Udo Kramer](mailto:optik@fluffel.io) +* [Una](mailto:una@unascribed.com) +* [Ushitora Anqou](mailto:ushitora_anqou@yahoo.co.jp) +* [Valentin Lorentz](mailto:progval+git@progval.net) +* [Vladimir Mincev](mailto:vladimir@canicinteractive.com) +* [Waldir Pimenta](mailto:waldyrious@gmail.com) +* [Wesley Ellis](mailto:tahnok@gmail.com) +* [Wiktor](mailto:wiktor@metacode.biz) +* [Wonderfall](mailto:wonderfall@schrodinger.io) +* [YDrogen](mailto:ydrogen45@gmail.com) +* [YMHuang](mailto:ymhuang@fmbase.tw) +* [YOSHIOKA Eiichiro](mailto:yoshioka.eiichiro@gmail.com) +* [YOU](mailto:stackexchange.you@gmail.com) +* [YaQ](mailto:i_k_o_m_a_7@yahoo.co.jp) +* [Yanaken](mailto:yanakend@gmail.com) +* [Yann Klis](mailto:yann.klis@gmail.com) +* [Yeechan Lu](mailto:wz.bluesnow@gmail.com) +* [Yusuke Abe](mailto:moonset20@gmail.com) +* [Zachary Spector](mailto:logicaldash@gmail.com) +* [ZiiX](mailto:ziix@users.noreply.github.com) +* [asria-jp](mailto:is@alicematic.com) +* [ava](mailto:vladooku@users.noreply.github.com) +* [benklop](mailto:benklop@gmail.com) +* [bsky](mailto:git@imbsky.net) +* [caesarologia](mailto:lopesgemelli.1@gmail.com) +* [chrolis](mailto:chrolis@users.noreply.github.com) +* [cormo](mailto:cormorant2+github@gmail.com) +* [d0p1](mailto:dopi-sama@hush.com) +* [evilny0](mailto:evilny0@moomoocamp.net) +* [febrezo](mailto:felixbrezo@gmail.com) +* [fsubal](mailto:fsubal@users.noreply.github.com) +* [fusshi-](mailto:dikky1218@users.noreply.github.com) +* [gentaro](mailto:gentaroooo@gmail.com) +* [hakoai](mailto:hk--76@qa2.so-net.ne.jp) +* [haosbvnker](mailto:github@chaosbunker.com) +* [isati](mailto:phil@juchnowi.cz) +* [jenn kaplan](mailto:me@jkap.io) +* [jirayudech](mailto:jirayudech@gmail.com) +* [jukper](mailto:jukkaperanto@gmail.com) +* [jumoru](mailto:jumoru@mailbox.org) +* [karlyeurl](mailto:karl.yeurl@gmail.com) +* [kedama](mailto:32974885+kedamadq@users.noreply.github.com) +* [kuro5hin](mailto:rusty@kuro5hin.org) +* [maxypy](mailto:maxime@mpigou.fr) +* [mhe](mailto:mail@marcus-herrmann.com) +* [mimikun](mailto:dzdzble_effort_311@outlook.jp) +* [mshrtkch](mailto:mshrtkch@users.noreply.github.com) +* [muan](mailto:muan@github.com) +* [neetshin](mailto:neetshin@neetsh.in) +* [rch850](mailto:rich850@gmail.com) +* [roikale](mailto:roikale@users.noreply.github.com) +* [rysiekpl](mailto:rysiek@hackerspace.pl) +* [saturday06](mailto:dyob@lunaport.net) +* [scriptjunkie](mailto:scriptjunkie@scriptjunkie.us) +* [seekr](mailto:mario.drs@gmail.com) +* [sundevour](mailto:31990469+sundevour@users.noreply.github.com) +* [syui](mailto:syui@users.noreply.github.com) +* [tackeyy](mailto:mailto.takita.yusuke@gmail.com) +* [tateisu](mailto:tateisu@gmail.com) +* [tmyt](mailto:shigure@refy.net) +* [utam0k](mailto:k0ma@utam0k.jp) +* [vpzomtrrfrt](mailto:vpzomtrrfrt@gmail.com) +* [walfie](mailto:walfington@gmail.com) +* [y-temp4](mailto:y.temp4@gmail.com) +* [ymmtmdk](mailto:ymmtmdk@gmail.com) +* [yoshipc](mailto:yoooo@yoshipc.net) +* [Özcan Zafer AYAN](mailto:ozcanzaferayan@gmail.com) +* [ばん](mailto:detteiu0321@gmail.com) +* [みたらしだんご](mailto:mitarashidango@users.noreply.github.com) +* [りんすき](mailto:6533808+rinsuki@users.noreply.github.com) +* [ヨイツの賢狼ホロ | 3rd style](mailto:horo@yoitsu.moe) +* [猫吸血鬼ディフリス / 猫ロキP](mailto:deflis@gmail.com) +* [艮 鮟鱇](mailto:ushitora_anqou@yahoo.co.jp) +* [西小倉宏信](mailto:nishiko@mindia.jp) +* [雨宮美羽](mailto:k737566@gmail.com) This document is provided for informational purposes only. Since it is only updated once per release, the version you are looking at may be currently out of date. To see the full list of contributors, consider looking at the [git history](https://github.com/tootsuite/mastodon/graphs/contributors) instead. diff --git a/lib/tasks/repo.rake b/lib/tasks/repo.rake index 216e37ef2..367859e94 100644 --- a/lib/tasks/repo.rake +++ b/lib/tasks/repo.rake @@ -17,7 +17,7 @@ namespace :repo do contributors = Oj.load(response.body) contributors.each do |c| file << "* [#{c['login']}](#{c['html_url']})\n" if c['login'] - file << "* [#{c['name']}](#{c['email']})\n" if c['name'] + file << "* [#{c['name']}](mailto:#{c['email']})\n" if c['name'] end url = LinkHeader.parse(response.headers['Link']).find_link(%w(rel next))&.href end -- cgit From 40dd19be37852d4442a924c2a74bcbbfbf57e054 Mon Sep 17 00:00:00 2001 From: luzpaz Date: Thu, 13 Sep 2018 18:53:09 -0400 Subject: Misc. typos (#8694) Found via `codespell -q 3 --skip="./app/javascript/mastodon/locales,./config/locales"` --- app/controllers/auth/sessions_controller.rb | 2 +- app/javascript/mastodon/features/compose/util/url_regex.js | 2 +- app/javascript/mastodon/features/ui/util/react_router_helpers.js | 2 +- app/models/status.rb | 2 +- config/environments/test.rb | 2 +- config/initializers/simple_form.rb | 2 +- config/initializers/twitter_regex.rb | 2 +- docker-compose.yml | 6 +++--- lib/mastodon/migration_helpers.rb | 2 +- spec/controllers/concerns/localized_spec.rb | 2 +- spec/controllers/emojis_controller_spec.rb | 4 ++-- spec/controllers/stream_entries_controller_spec.rb | 2 +- spec/models/account_spec.rb | 2 +- spec/models/subscription_spec.rb | 2 +- spec/services/process_feed_service_spec.rb | 2 +- 15 files changed, 18 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/app/controllers/auth/sessions_controller.rb b/app/controllers/auth/sessions_controller.rb index bc980009e..901e82331 100644 --- a/app/controllers/auth/sessions_controller.rb +++ b/app/controllers/auth/sessions_controller.rb @@ -128,7 +128,7 @@ class Auth::SessionsController < Devise::SessionsController def clear_site_data return if continue_after? - # Should be '"*"' but that doen't work in Chrome (neither does '"executionContexts"') + # Should be '"*"' but that doesn't work in Chrome (neither does '"executionContexts"') # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data response.headers['Clear-Site-Data'] = '"cache", "cookies", "storage"' end diff --git a/app/javascript/mastodon/features/compose/util/url_regex.js b/app/javascript/mastodon/features/compose/util/url_regex.js index d5e39e0d5..7f1e17620 100644 --- a/app/javascript/mastodon/features/compose/util/url_regex.js +++ b/app/javascript/mastodon/features/compose/util/url_regex.js @@ -170,7 +170,7 @@ export const urlRegex = (function() { ')' + '\\)', 'i'); - // Valid end-of-path chracters (so /foo. does not gobble the period). + // Valid end-of-path characters (so /foo. does not gobble the period). // 1. Allow =&# for empty URL parameters and other URL-join artifacts regexen.validUrlPathEndingChars = regexSupplant(/[^#{spaces_group}\(\)\?!\*';:=\,\.\$%\[\]#{pd}~&\|@]|(?:#{validUrlBalancedParens})/i); // Allow @ in a url, but only in the middle. Catch things like http://example.com/@user/ diff --git a/app/javascript/mastodon/features/ui/util/react_router_helpers.js b/app/javascript/mastodon/features/ui/util/react_router_helpers.js index 32dfe320b..d452b871f 100644 --- a/app/javascript/mastodon/features/ui/util/react_router_helpers.js +++ b/app/javascript/mastodon/features/ui/util/react_router_helpers.js @@ -26,7 +26,7 @@ WrappedSwitch.propTypes = { children: PropTypes.node, }; -// Small Wraper to extract the params from the route and pass +// Small Wrapper to extract the params from the route and pass // them to the rendered component, together with the content to // be rendered inside (the children) export class WrappedRoute extends React.Component { diff --git a/app/models/status.rb b/app/models/status.rb index 35655bff2..f2b5cc6ce 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -241,7 +241,7 @@ class Status < ApplicationRecord def as_direct_timeline(account, limit = 20, max_id = nil, since_id = nil, cache_ids = false) # direct timeline is mix of direct message from_me and to_me. - # 2 querys are executed with pagination. + # 2 queries are executed with pagination. # constant expression using arel_table is required for partial index # _from_me part does not require any timeline filters diff --git a/config/environments/test.rb b/config/environments/test.rb index 1c1891561..a35cadcfa 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -23,7 +23,7 @@ Rails.application.configure do config.consider_all_requests_local = true config.action_controller.perform_caching = false - # The default store, file_store is shared by processses parallely executed + # The default store, file_store is shared by processes parallelly executed # and should not be used. config.cache_store = :memory_store diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index 5983918cd..e413cdb44 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -116,7 +116,7 @@ SimpleForm.setup do |config| # You can define the class to use on all labels. Default is nil. # config.label_class = nil - # You can define the default class to be used on forms. Can be overriden + # You can define the default class to be used on forms. Can be overridden # with `html: { :class }`. Defaulting to none. # config.default_form_class = nil diff --git a/config/initializers/twitter_regex.rb b/config/initializers/twitter_regex.rb index c227f92d3..76b23f416 100644 --- a/config/initializers/twitter_regex.rb +++ b/config/initializers/twitter_regex.rb @@ -28,7 +28,7 @@ module Twitter )/iox REGEXEN[:valid_url] = %r{ ( # $1 total match - (#{REGEXEN[:valid_url_preceding_chars]}) # $2 Preceeding chracter + (#{REGEXEN[:valid_url_preceding_chars]}) # $2 Preceding character ( # $3 URL ((https?|dat|dweb|ipfs|ipns|ssb|gopher):\/\/)? # $4 Protocol (optional) (#{REGEXEN[:valid_domain]}) # $5 Domain(s) diff --git a/docker-compose.yml b/docker-compose.yml index 070a95384..064d5a260 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: image: postgres:9.6-alpine networks: - internal_network -### Uncomment to enable DB persistance +### Uncomment to enable DB persistence # volumes: # - ./postgres:/var/lib/postgresql/data @@ -15,7 +15,7 @@ services: image: redis:4.0-alpine networks: - internal_network -### Uncomment to enable REDIS persistance +### Uncomment to enable REDIS persistence # volumes: # - ./redis:/data @@ -26,7 +26,7 @@ services: # - "ES_JAVA_OPTS=-Xms512m -Xmx512m" # networks: # - internal_network -#### Uncomment to enable ES persistance +#### Uncomment to enable ES persistence ## volumes: ## - ./elasticsearch:/usr/share/elasticsearch/data diff --git a/lib/mastodon/migration_helpers.rb b/lib/mastodon/migration_helpers.rb index e154b5a2c..5c135685f 100644 --- a/lib/mastodon/migration_helpers.rb +++ b/lib/mastodon/migration_helpers.rb @@ -835,7 +835,7 @@ module Mastodon columns(table).find { |column| column.name == name } end - # This will replace the first occurance of a string in a column with + # This will replace the first occurrence of a string in a column with # the replacement # On postgresql we can use `regexp_replace` for that. # On mysql we find the location of the pattern, and overwrite it diff --git a/spec/controllers/concerns/localized_spec.rb b/spec/controllers/concerns/localized_spec.rb index 8c80b7d2a..76c3de118 100644 --- a/spec/controllers/concerns/localized_spec.rb +++ b/spec/controllers/concerns/localized_spec.rb @@ -28,7 +28,7 @@ describe ApplicationController, type: :controller do expect(I18n.locale).to eq :fa end - it 'sets available and compatible langauge if none of available languages are preferred' do + it 'sets available and compatible language if none of available languages are preferred' do request.headers['Accept-Language'] = 'fa-IR' get 'success' expect(I18n.locale).to eq :fa diff --git a/spec/controllers/emojis_controller_spec.rb b/spec/controllers/emojis_controller_spec.rb index 68bae256d..fbbd11f64 100644 --- a/spec/controllers/emojis_controller_spec.rb +++ b/spec/controllers/emojis_controller_spec.rb @@ -6,11 +6,11 @@ describe EmojisController do let(:emoji) { Fabricate(:custom_emoji) } describe 'GET #show' do - subject(:responce) { get :show, params: { id: emoji.id, format: :json } } + subject(:response) { get :show, params: { id: emoji.id, format: :json } } subject(:body) { JSON.parse(response.body, symbolize_names: true) } it 'returns the right response' do - expect(responce).to have_http_status 200 + expect(response).to have_http_status 200 expect(body[:name]).to eq ':coolcat:' end end diff --git a/spec/controllers/stream_entries_controller_spec.rb b/spec/controllers/stream_entries_controller_spec.rb index 534bc393d..eb7fdf9d7 100644 --- a/spec/controllers/stream_entries_controller_spec.rb +++ b/spec/controllers/stream_entries_controller_spec.rb @@ -4,7 +4,7 @@ RSpec.describe StreamEntriesController, type: :controller do render_views shared_examples 'before_action' do |route| - context 'when account is not suspended anbd stream_entry is available' do + context 'when account is not suspended and stream_entry is available' do it 'assigns instance variables' do status = Fabricate(:status) diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index ec01026db..ae19251ae 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -559,7 +559,7 @@ RSpec.describe Account, type: :model do end context 'when is local' do - it 'is invalid if the username is not unique in case-insensitive comparsion among local accounts' do + it 'is invalid if the username is not unique in case-insensitive comparison among local accounts' do account_1 = Fabricate(:account, username: 'the_doctor') account_2 = Fabricate.build(:account, username: 'the_Doctor') account_2.valid? diff --git a/spec/models/subscription_spec.rb b/spec/models/subscription_spec.rb index 84096e6ae..b83979d13 100644 --- a/spec/models/subscription_spec.rb +++ b/spec/models/subscription_spec.rb @@ -18,7 +18,7 @@ RSpec.describe Subscription, type: :model do end describe 'lease_seconds' do - it 'returns the time remaing until expiration' do + it 'returns the time remaining until expiration' do datetime = 1.day.from_now subscription = Subscription.new(expires_at: datetime) travel_to(datetime - 12.hours) do diff --git a/spec/services/process_feed_service_spec.rb b/spec/services/process_feed_service_spec.rb index d8b065063..1f26660ed 100644 --- a/spec/services/process_feed_service_spec.rb +++ b/spec/services/process_feed_service_spec.rb @@ -166,7 +166,7 @@ XML expect(created_statuses.first.reblog.text).to eq 'Overwatch rocks' end - it 'ignores reblogs if it failed to retreive reblogged statuses' do + it 'ignores reblogs if it failed to retrieve reblogged statuses' do stub_request(:get, 'https://overwatch.com/users/tracer/updates/1').to_return(status: 404) actor = Fabricate(:account, username: 'tracer', domain: 'overwatch.com') -- cgit From 6a3f9b7e53e4cef0b5406676d56e904a02716ee6 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 14 Sep 2018 17:42:22 +0200 Subject: Move more tasks to tootctl (#8675) * Move more tasks to tootctl - tootctl feeds build - tootctl feeds clear - tootctl accounts refresh Clean up exit codes and help messages * Move user modifying to tootctl * Improve user modification through CLI, rename commands add -> create mod -> modify del -> delete To remove ambiguity * Fix code style issues * Fix not being able to unset admin/mod role --- .rubocop.yml | 5 + lib/cli.rb | 5 + lib/mastodon/accounts_cli.rb | 114 ++++++++++++- lib/mastodon/emoji_cli.rb | 4 - lib/mastodon/feeds_cli.rb | 81 ++++++++++ lib/mastodon/media_cli.rb | 13 +- lib/tasks/mastodon.rake | 370 ------------------------------------------- 7 files changed, 205 insertions(+), 387 deletions(-) create mode 100644 lib/mastodon/feeds_cli.rb (limited to 'lib') diff --git a/.rubocop.yml b/.rubocop.yml index 4ba5903bd..59e8a757a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -77,6 +77,11 @@ Rails/SkipsModelValidations: Rails/HttpStatus: Enabled: false +Rails/Exit: + Exclude: + - 'lib/mastodon/*' + - 'lib/cli' + Style/ClassAndModuleChildren: Enabled: false diff --git a/lib/cli.rb b/lib/cli.rb index 60bff4147..14a91c2db 100644 --- a/lib/cli.rb +++ b/lib/cli.rb @@ -4,6 +4,8 @@ require 'thor' require_relative 'mastodon/media_cli' require_relative 'mastodon/emoji_cli' require_relative 'mastodon/accounts_cli' +require_relative 'mastodon/feeds_cli' + module Mastodon class CLI < Thor desc 'media SUBCOMMAND ...ARGS', 'Manage media files' @@ -14,5 +16,8 @@ module Mastodon desc 'accounts SUBCOMMAND ...ARGS', 'Manage accounts' subcommand 'accounts', Mastodon::AccountsCLI + + desc 'feeds SUBCOMMAND ...ARGS', 'Manage feeds' + subcommand 'feeds', Mastodon::FeedsCLI end end diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/accounts_cli.rb index d44cdfae9..65c1b395a 100644 --- a/lib/mastodon/accounts_cli.rb +++ b/lib/mastodon/accounts_cli.rb @@ -40,6 +40,7 @@ module Mastodon say('OK', :green) else say('No account(s) given', :red) + exit(1) end end @@ -48,7 +49,7 @@ module Mastodon option :role, default: 'user' option :reattach, type: :boolean option :force, type: :boolean - desc 'add USERNAME', 'Create a new user' + desc 'create USERNAME', 'Create a new user' long_desc <<-LONG_DESC Create a new user account with a given USERNAME and an e-mail address provided with --email. @@ -65,7 +66,7 @@ module Mastodon the --force option to delete the old record and reattach the username to the new account anyway. LONG_DESC - def add(username) + def create(username) account = Account.new(username: username) password = SecureRandom.hex user = User.new(email: options[:email], password: password, admin: options[:role] == 'admin', moderator: options[:role] == 'moderator', confirmed_at: Time.now.utc) @@ -98,19 +99,75 @@ module Mastodon say(key) say(' ' + error, :red) end + + exit(1) end end - desc 'del USERNAME', 'Delete a user' + option :role + option :email + option :confirm, type: :boolean + option :enable, type: :boolean + option :disable, type: :boolean + option :disable_2fa, type: :boolean + desc 'modify USERNAME', 'Modify a user' + long_desc <<-LONG_DESC + Modify a user account. + + With the --role option, update the user's role to one of "user", + "moderator" or "admin". + + With the --email option, update the user's e-mail address. With + the --confirm option, mark the user's e-mail as confirmed. + + With the --disable option, lock the user out of their account. The + --enable option is the opposite. + + With the --disable-2fa option, the two-factor authentication + requirement for the user can be removed. + LONG_DESC + def modify(username) + user = Account.find_local(username)&.user + + if user.nil? + say('No user with such username', :red) + exit(1) + end + + if options[:role] + user.admin = options[:role] == 'admin' + user.moderator = options[:role] == 'moderator' + end + + user.email = options[:email] if options[:email] + user.disabled = false if options[:enable] + user.disabled = true if options[:disable] + user.otp_required_for_login = false if options[:disable_2fa] + user.confirm if options[:confirm] + + if user.save + say('OK', :green) + else + user.errors.to_h.each do |key, error| + say('Failure/Error: ', :red) + say(key) + say(' ' + error, :red) + end + + exit(1) + end + end + + desc 'delete USERNAME', 'Delete a user' long_desc <<-LONG_DESC Remove a user account with a given USERNAME. LONG_DESC - def del(username) + def delete(username) account = Account.find_local(username) if account.nil? say('No user with such username', :red) - return + exit(1) end say("Deleting user with #{account.statuses_count}, this might take a while...") @@ -182,9 +239,56 @@ module Mastodon end end + option :all, type: :boolean + option :domain + desc 'refresh [USERNAME]', 'Fetch remote user data and files' + long_desc <<-LONG_DESC + Fetch remote user data and files for one or multiple accounts. + + With the --all option, all remote accounts will be processed. + Through the --domain option, this can be narrowed down to a + specific domain only. Otherwise, a single remote account must + be specified with USERNAME. + + All processing is done in the background through Sidekiq. + LONG_DESC + def refresh(username = nil) + if options[:domain] || options[:all] + queued = 0 + scope = Account.remote + scope = scope.where(domain: options[:domain]) if options[:domain] + + scope.select(:id).reorder(nil).find_in_batches do |accounts| + Maintenance::RedownloadAccountMediaWorker.push_bulk(accounts.map(&:id)) + queued += accounts.size + end + + say("Scheduled refreshment of #{queued} accounts", :green, true) + elsif username.present? + username, domain = username.split('@') + account = Account.find_remote(username, domain) + + if account.nil? + say('No such account', :red) + exit(1) + end + + Maintenance::RedownloadAccountMediaWorker.perform_async(account.id) + say('OK', :green) + else + say('No account(s) given', :red) + exit(1) + end + end + private def rotate_keys_for_account(account, delay = 0) + if account.nil? + say('No such account', :red) + exit(1) + end + old_key = account.private_key new_key = OpenSSL::PKey::RSA.new(2048).to_pem account.update(private_key: new_key) diff --git a/lib/mastodon/emoji_cli.rb b/lib/mastodon/emoji_cli.rb index 0a773c771..5bc51d034 100644 --- a/lib/mastodon/emoji_cli.rb +++ b/lib/mastodon/emoji_cli.rb @@ -5,8 +5,6 @@ require_relative '../../config/boot' require_relative '../../config/environment' require_relative 'cli_helper' -# rubocop:disable Rails/Output - module Mastodon class EmojiCLI < Thor option :prefix @@ -77,5 +75,3 @@ module Mastodon end end end - -# rubocop:enable Rails/Output diff --git a/lib/mastodon/feeds_cli.rb b/lib/mastodon/feeds_cli.rb new file mode 100644 index 000000000..c3fca723e --- /dev/null +++ b/lib/mastodon/feeds_cli.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +require_relative '../../config/boot' +require_relative '../../config/environment' +require_relative 'cli_helper' + +module Mastodon + class FeedsCLI < Thor + option :all, type: :boolean, default: false + option :background, type: :boolean, default: false + option :dry_run, type: :boolean, default: false + option :verbose, type: :boolean, default: false + desc 'build [USERNAME]', 'Build home and list feeds for one or all users' + long_desc <<-LONG_DESC + Build home and list feeds that are stored in Redis from the database. + + With the --all option, all active users will be processed. + Otherwise, a single user specified by USERNAME. + + With the --background option, regeneration will be queued into Sidekiq, + and the command will exit as soon as possible. + + With the --dry-run option, no work will be done. + + With the --verbose option, when accounts are processed sequentially in the + foreground, the IDs of the accounts will be printed. + LONG_DESC + def build(username = nil) + dry_run = options[:dry_run] ? '(DRY RUN)' : '' + + if options[:all] || username.nil? + processed = 0 + queued = 0 + + User.active.select(:id, :account_id).reorder(nil).find_in_batches do |users| + if options[:background] + RegenerationWorker.push_bulk(users.map(&:account_id)) unless options[:dry_run] + queued += users.size + else + users.each do |user| + RegenerationWorker.new.perform(user.account_id) unless options[:dry_run] + options[:verbose] ? say(user.account_id) : say('.', :green, false) + processed += 1 + end + end + end + + if options[:background] + say("Scheduled feed regeneration for #{queued} accounts #{dry_run}", :green, true) + else + say + say("Regenerated feeds for #{processed} accounts #{dry_run}", :green, true) + end + elsif username.present? + account = Account.find_local(username) + + if options[:background] + RegenerationWorker.perform_async(account.id) unless options[:dry_run] + else + RegenerationWorker.new.perform(account.id) unless options[:dry_run] + end + + say("OK #{dry_run}", :green, true) + else + say('No account(s) given', :red) + exit(1) + end + end + + desc 'clear', 'Remove all home and list feeds from Redis' + def clear + keys = Redis.current.keys('feed:*') + + Redis.current.pipelined do + keys.each { |key| Redis.current.del(key) } + end + + say('OK', :green) + end + end +end diff --git a/lib/mastodon/media_cli.rb b/lib/mastodon/media_cli.rb index 12ebdb774..8aa9f7903 100644 --- a/lib/mastodon/media_cli.rb +++ b/lib/mastodon/media_cli.rb @@ -4,8 +4,6 @@ require_relative '../../config/boot' require_relative '../../config/environment' require_relative 'cli_helper' -# rubocop:disable Rails/Output - module Mastodon class MediaCLI < Thor option :days, type: :numeric, default: 7 @@ -25,9 +23,10 @@ module Mastodon it may impact other operations of the Mastodon server, and it may overload the underlying file storage. - With the --verbose option, output deleting file ID to console (only when --background false). + With the --dry-run option, no work will be done. - With the --dry-run option, output the number of files to delete without deleting. + With the --verbose option, when media attachments are processed sequentially in the + foreground, the IDs of the media attachments will be printed. DESC def remove time_ago = options[:days].days.ago @@ -53,12 +52,10 @@ module Mastodon say if options[:background] - say("Scheduled the deletion of #{queued} media attachments #{dry_run}.", :green) + say("Scheduled the deletion of #{queued} media attachments #{dry_run}", :green, true) else - say("Removed #{processed} media attachments #{dry_run}.", :green) + say("Removed #{processed} media attachments #{dry_run}", :green, true) end end end end - -# rubocop:enable Rails/Output diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index 649a22a0b..ec8800819 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -390,139 +390,6 @@ namespace :mastodon do end end - desc 'Turn a user into an admin, identified by the USERNAME environment variable' - task make_admin: :environment do - include RoutingHelper - - account_username = ENV.fetch('USERNAME') - user = User.joins(:account).where(accounts: { username: account_username }) - - if user.present? - user.update(admin: true) - puts "Congrats! #{account_username} is now an admin. \\o/\nNavigate to #{edit_admin_settings_url} to get started" - else - puts "User could not be found; please make sure an account with the `#{account_username}` username exists." - end - end - - desc 'Turn a user into a moderator, identified by the USERNAME environment variable' - task make_mod: :environment do - account_username = ENV.fetch('USERNAME') - user = User.joins(:account).where(accounts: { username: account_username }) - - if user.present? - user.update(moderator: true) - puts "Congrats! #{account_username} is now a moderator \\o/" - else - puts "User could not be found; please make sure an account with the `#{account_username}` username exists." - end - end - - desc 'Remove admin and moderator privileges from user identified by the USERNAME environment variable' - task revoke_staff: :environment do - account_username = ENV.fetch('USERNAME') - user = User.joins(:account).where(accounts: { username: account_username }) - - if user.present? - user.update(moderator: false, admin: false) - puts "#{account_username} is no longer admin or moderator." - else - puts "User could not be found; please make sure an account with the `#{account_username}` username exists." - end - end - - desc 'Manually confirms a user with associated user email address stored in USER_EMAIL environment variable.' - task confirm_email: :environment do - email = ENV.fetch('USER_EMAIL') - user = User.find_by(email: email) - - if user - user.update(confirmed_at: Time.now.utc) - puts "#{email} confirmed" - else - abort "#{email} not found" - end - end - - desc 'Add a user by providing their email, username and initial password.' \ - 'The user will receive a confirmation email, then they must reset their password before logging in.' - task add_user: :environment do - disable_log_stdout! - - prompt = TTY::Prompt.new - - begin - email = prompt.ask('E-mail:', required: true) do |q| - q.modify :strip - end - - username = prompt.ask('Username:', required: true) do |q| - q.modify :strip - end - - role = prompt.select('Role:', %w(user moderator admin)) - - if prompt.yes?('Proceed to create the user?') - user = User.new(email: email, password: SecureRandom.hex, admin: role == 'admin', moderator: role == 'moderator', account_attributes: { username: username }) - - if user.save - prompt.ok 'User created and confirmation mail sent to the user\'s email address.' - prompt.ok "Here is the random password generated for the user: #{user.password}" - else - prompt.warn 'User was not created because of the following errors:' - - user.errors.each do |key, val| - prompt.error "#{key}: #{val}" - end - end - else - prompt.ok 'Aborting. Bye!' - end - rescue TTY::Reader::InputInterrupt - prompt.ok 'Aborting. Bye!' - end - end - - namespace :media do - desc 'Remove media attachments attributed to silenced accounts' - task remove_silenced: :environment do - nb_media_attachments = 0 - MediaAttachment.where(account: Account.silenced).select(:id).reorder(nil).find_in_batches do |media_attachments| - nb_media_attachments += media_attachments.length - Maintenance::DestroyMediaWorker.push_bulk(media_attachments.map(&:id)) - end - puts "Scheduled the deletion of #{nb_media_attachments} media attachments" - end - - desc 'Remove cached remote media attachments that are older than NUM_DAYS. By default 7 (week)' - task remove_remote: :environment do - puts 'Please use `./bin/tootctl media remove --help` directly'.colorize(:yellow) - require_relative '../mastodon/media_cli' - cli = Mastodon::MediaCLI.new([], days: (ENV['NUM_DAYS'] || 7).to_i) - cli.invoke(:remove) - end - - desc 'Set unknown attachment type for remote-only attachments' - task set_unknown: :environment do - puts 'Setting unknown attachment type for remote-only attachments...' - MediaAttachment.where(file_file_name: nil).where.not(type: :unknown).in_batches.update_all(type: :unknown) - puts 'Done!' - end - - desc 'Redownload avatars/headers of remote users. Optionally limit to a particular domain with DOMAIN' - task redownload_avatars: :environment do - accounts = Account.remote - accounts = accounts.where(domain: ENV['DOMAIN']) if ENV['DOMAIN'].present? - nb_accounts = 0 - - accounts.select(:id).reorder(nil).find_in_batches do |accounts_batch| - nb_accounts += accounts_batch.length - Maintenance::RedownloadAccountMediaWorker.push_bulk(accounts_batch.map(&:id)) - end - puts "Scheduled the download of avatars/headers for #{nb_accounts} remote users" - end - end - namespace :push do desc 'Unsubscribes from PuSH updates of feeds nobody follows locally' task clear: :environment do @@ -530,28 +397,6 @@ namespace :mastodon do end end - namespace :feeds do - desc 'Clear all timelines without regenerating them' - task clear_all: :environment do - Redis.current.keys('feed:*').each { |key| Redis.current.del(key) } - end - - desc 'Generates home timelines for users who logged in in the past two weeks' - task build: :environment do - User.active.select(:id, :account_id).reorder(nil).find_in_batches do |users| - RegenerationWorker.push_bulk(users.map(&:account_id)) - end - end - end - - namespace :users do - desc 'List e-mails of all admin users' - task admins: :environment do - puts 'Admin user emails:' - puts User.admins.map(&:email).join("\n") - end - end - namespace :settings do desc 'Open registrations on this instance' task open_registrations: :environment do @@ -572,221 +417,6 @@ namespace :mastodon do puts "VAPID_PUBLIC_KEY=#{vapid_key.public_key}" end end - - namespace :maintenance do - desc 'Update counter caches' - task update_counter_caches: :environment do - puts 'Updating counter caches for accounts...' - - Account.unscoped.where.not(protocol: :activitypub).select('id').find_in_batches do |batch| - Account.where(id: batch.map(&:id)).update_all('statuses_count = (select count(*) from statuses where account_id = accounts.id), followers_count = (select count(*) from follows where target_account_id = accounts.id), following_count = (select count(*) from follows where account_id = accounts.id)') - end - - puts 'Updating counter caches for statuses...' - - Status.unscoped.select('id').find_in_batches do |batch| - Status.where(id: batch.map(&:id)).update_all('favourites_count = (select count(*) from favourites where favourites.status_id = statuses.id), reblogs_count = (select count(*) from statuses as reblogs where reblogs.reblog_of_id = statuses.id)') - end - - puts 'Done!' - end - - desc 'Generate static versions of GIF avatars/headers' - task add_static_avatars: :environment do - puts 'Generating static avatars/headers for GIF ones...' - - Account.unscoped.where(avatar_content_type: 'image/gif').or(Account.unscoped.where(header_content_type: 'image/gif')).find_each do |account| - begin - account.avatar.reprocess! if account.avatar_content_type == 'image/gif' && !account.avatar.exists?(:static) - account.header.reprocess! if account.header_content_type == 'image/gif' && !account.header.exists?(:static) - rescue StandardError => e - Rails.logger.error "Error while generating static avatars/headers for account #{account.id}: #{e}" - next - end - end - - puts 'Done!' - end - - desc 'Ensure referencial integrity' - task prepare_for_foreign_keys: :environment do - # All the deletes: - ActiveRecord::Base.connection.execute('DELETE FROM statuses USING statuses s LEFT JOIN accounts a ON a.id = s.account_id WHERE statuses.id = s.id AND a.id IS NULL') - - if ActiveRecord::Base.connection.table_exists? :account_domain_blocks - ActiveRecord::Base.connection.execute('DELETE FROM account_domain_blocks USING account_domain_blocks adb LEFT JOIN accounts a ON a.id = adb.account_id WHERE account_domain_blocks.id = adb.id AND a.id IS NULL') - end - - if ActiveRecord::Base.connection.table_exists? :conversation_mutes - ActiveRecord::Base.connection.execute('DELETE FROM conversation_mutes USING conversation_mutes cm LEFT JOIN accounts a ON a.id = cm.account_id WHERE conversation_mutes.id = cm.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM conversation_mutes USING conversation_mutes cm LEFT JOIN conversations c ON c.id = cm.conversation_id WHERE conversation_mutes.id = cm.id AND c.id IS NULL') - end - - ActiveRecord::Base.connection.execute('DELETE FROM favourites USING favourites f LEFT JOIN accounts a ON a.id = f.account_id WHERE favourites.id = f.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM favourites USING favourites f LEFT JOIN statuses s ON s.id = f.status_id WHERE favourites.id = f.id AND s.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM blocks USING blocks b LEFT JOIN accounts a ON a.id = b.account_id WHERE blocks.id = b.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM blocks USING blocks b LEFT JOIN accounts a ON a.id = b.target_account_id WHERE blocks.id = b.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM follow_requests USING follow_requests fr LEFT JOIN accounts a ON a.id = fr.account_id WHERE follow_requests.id = fr.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM follow_requests USING follow_requests fr LEFT JOIN accounts a ON a.id = fr.target_account_id WHERE follow_requests.id = fr.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM follows USING follows f LEFT JOIN accounts a ON a.id = f.account_id WHERE follows.id = f.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM follows USING follows f LEFT JOIN accounts a ON a.id = f.target_account_id WHERE follows.id = f.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM mutes USING mutes m LEFT JOIN accounts a ON a.id = m.account_id WHERE mutes.id = m.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM mutes USING mutes m LEFT JOIN accounts a ON a.id = m.target_account_id WHERE mutes.id = m.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM imports USING imports i LEFT JOIN accounts a ON a.id = i.account_id WHERE imports.id = i.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM mentions USING mentions m LEFT JOIN accounts a ON a.id = m.account_id WHERE mentions.id = m.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM mentions USING mentions m LEFT JOIN statuses s ON s.id = m.status_id WHERE mentions.id = m.id AND s.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM notifications USING notifications n LEFT JOIN accounts a ON a.id = n.account_id WHERE notifications.id = n.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM notifications USING notifications n LEFT JOIN accounts a ON a.id = n.from_account_id WHERE notifications.id = n.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM preview_cards USING preview_cards pc LEFT JOIN statuses s ON s.id = pc.status_id WHERE preview_cards.id = pc.id AND s.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM reports USING reports r LEFT JOIN accounts a ON a.id = r.account_id WHERE reports.id = r.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM reports USING reports r LEFT JOIN accounts a ON a.id = r.target_account_id WHERE reports.id = r.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM statuses_tags USING statuses_tags st LEFT JOIN statuses s ON s.id = st.status_id WHERE statuses_tags.tag_id = st.tag_id AND statuses_tags.status_id = st.status_id AND s.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM statuses_tags USING statuses_tags st LEFT JOIN tags t ON t.id = st.tag_id WHERE statuses_tags.tag_id = st.tag_id AND statuses_tags.status_id = st.status_id AND t.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM stream_entries USING stream_entries se LEFT JOIN accounts a ON a.id = se.account_id WHERE stream_entries.id = se.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM subscriptions USING subscriptions s LEFT JOIN accounts a ON a.id = s.account_id WHERE subscriptions.id = s.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM users USING users u LEFT JOIN accounts a ON a.id = u.account_id WHERE users.id = u.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM web_settings USING web_settings ws LEFT JOIN users u ON u.id = ws.user_id WHERE web_settings.id = ws.id AND u.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM oauth_access_grants USING oauth_access_grants oag LEFT JOIN users u ON u.id = oag.resource_owner_id WHERE oauth_access_grants.id = oag.id AND oag.resource_owner_id IS NOT NULL AND u.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM oauth_access_grants USING oauth_access_grants oag LEFT JOIN oauth_applications a ON a.id = oag.application_id WHERE oauth_access_grants.id = oag.id AND oag.application_id IS NOT NULL AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM oauth_access_tokens USING oauth_access_tokens oat LEFT JOIN users u ON u.id = oat.resource_owner_id WHERE oauth_access_tokens.id = oat.id AND oat.resource_owner_id IS NOT NULL AND u.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM oauth_access_tokens USING oauth_access_tokens oat LEFT JOIN oauth_applications a ON a.id = oat.application_id WHERE oauth_access_tokens.id = oat.id AND oat.application_id IS NOT NULL AND a.id IS NULL') - - # All the nullifies: - ActiveRecord::Base.connection.execute('UPDATE statuses SET in_reply_to_id = NULL FROM statuses s LEFT JOIN statuses rs ON rs.id = s.in_reply_to_id WHERE statuses.id = s.id AND s.in_reply_to_id IS NOT NULL AND rs.id IS NULL') - ActiveRecord::Base.connection.execute('UPDATE statuses SET in_reply_to_account_id = NULL FROM statuses s LEFT JOIN accounts a ON a.id = s.in_reply_to_account_id WHERE statuses.id = s.id AND s.in_reply_to_account_id IS NOT NULL AND a.id IS NULL') - ActiveRecord::Base.connection.execute('UPDATE media_attachments SET status_id = NULL FROM media_attachments ma LEFT JOIN statuses s ON s.id = ma.status_id WHERE media_attachments.id = ma.id AND ma.status_id IS NOT NULL AND s.id IS NULL') - ActiveRecord::Base.connection.execute('UPDATE media_attachments SET account_id = NULL FROM media_attachments ma LEFT JOIN accounts a ON a.id = ma.account_id WHERE media_attachments.id = ma.id AND ma.account_id IS NOT NULL AND a.id IS NULL') - ActiveRecord::Base.connection.execute('UPDATE reports SET action_taken_by_account_id = NULL FROM reports r LEFT JOIN accounts a ON a.id = r.action_taken_by_account_id WHERE reports.id = r.id AND r.action_taken_by_account_id IS NOT NULL AND a.id IS NULL') - end - - desc 'Remove deprecated preview cards' - task remove_deprecated_preview_cards: :environment do - next unless ActiveRecord::Base.connection.table_exists? 'deprecated_preview_cards' - - class DeprecatedPreviewCard < ActiveRecord::Base - self.inheritance_column = false - - path = '/preview_cards/:attachment/:id_partition/:style/:filename' - if ENV['S3_ENABLED'] != 'true' - path = (ENV['PAPERCLIP_ROOT_PATH'] || ':rails_root/public/system') + path - end - - has_attached_file :image, styles: { original: '280x120>' }, convert_options: { all: '-quality 80 -strip' }, path: path - end - - puts 'Delete records and associated files from deprecated preview cards? [y/N]: ' - confirm = STDIN.gets.chomp - - if confirm.casecmp('y').zero? - DeprecatedPreviewCard.in_batches.destroy_all - - puts 'Drop deprecated preview cards table? [y/N]: ' - confirm = STDIN.gets.chomp - - if confirm.casecmp('y').zero? - ActiveRecord::Migration.drop_table :deprecated_preview_cards - end - end - end - - desc 'Migrate photo preview cards made before 2.1' - task migrate_photo_preview_cards: :environment do - status_ids = Status.joins(:preview_cards) - .where(preview_cards: { embed_url: '', type: :photo }) - .reorder(nil) - .group(:id) - .pluck(:id) - - PreviewCard.where(embed_url: '', type: :photo).delete_all - LinkCrawlWorker.push_bulk status_ids - end - - desc 'Find case-insensitive username duplicates of local users' - task find_duplicate_usernames: :environment do - include RoutingHelper - - disable_log_stdout! - - duplicate_masters = Account.find_by_sql('SELECT * FROM accounts WHERE id IN (SELECT min(id) FROM accounts WHERE domain IS NULL GROUP BY lower(username) HAVING count(*) > 1)') - pastel = Pastel.new - - duplicate_masters.each do |account| - puts pastel.yellow('First of their name: ') + pastel.bold(account.username) + " (#{admin_account_url(account.id)})" - - Account.where('lower(username) = ?', account.username.downcase).where.not(id: account.id).each do |duplicate| - puts ' ' + pastel.red('Duplicate: ') + admin_account_url(duplicate.id) - end - end - end - - desc 'Remove all home feed regeneration markers' - task remove_regeneration_markers: :environment do - keys = Redis.current.keys('account:*:regeneration') - - Redis.current.pipelined do - keys.each { |key| Redis.current.del(key) } - end - end - - desc 'Check every known remote account and delete those that no longer exist in origin' - task purge_removed_accounts: :environment do - prepare_for_options! - - options = {} - - OptionParser.new do |opts| - opts.banner = 'Usage: rails mastodon:maintenance:purge_removed_accounts [options]' - - opts.on('-f', '--force', 'Remove all encountered accounts without asking for confirmation') do - options[:force] = true - end - - opts.on('-h', '--help', 'Display this message') do - puts opts - exit - end - end.parse! - - disable_log_stdout! - - total = Account.remote.where(protocol: :activitypub).count - progress_bar = ProgressBar.create(total: total, format: '%c/%C |%w>%i| %e') - - Account.remote.where(protocol: :activitypub).partitioned.find_each do |account| - progress_bar.increment - - begin - code = Request.new(:head, account.uri).perform(&:code) - rescue StandardError - # This could happen due to network timeout, DNS timeout, wrong SSL cert, etc, - # which should probably not lead to perceiving the account as deleted, so - # just skip till next time - next - end - - if [404, 410].include?(code) - if options[:force] - SuspendAccountService.new.call(account) - account.destroy - else - progress_bar.pause - progress_bar.clear - print "\nIt seems like #{account.acct} no longer exists. Purge the account from the database? [Y/n]: ".colorize(:yellow) - confirm = STDIN.gets.chomp - puts '' - progress_bar.resume - - if confirm.casecmp('n').zero? - next - else - SuspendAccountService.new.call(account) - account.destroy - end - end - end - end - end - end end def disable_log_stdout! -- cgit From 9b32898e3c9e9284baa0792d0d7ee5723c860c4f Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 17 Sep 2018 20:24:46 +0200 Subject: Unconditionally re-encode locally-uploaded images to strip metadata (#8714) This strips metadata on file upload by re-encoding the files, at the cost of possible slight image quality decrease and processing resources. --- lib/paperclip/lazy_thumbnail.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/paperclip/lazy_thumbnail.rb b/lib/paperclip/lazy_thumbnail.rb index ea675a5bf..542c17fb2 100644 --- a/lib/paperclip/lazy_thumbnail.rb +++ b/lib/paperclip/lazy_thumbnail.rb @@ -20,7 +20,7 @@ module Paperclip private def needs_convert? - needs_different_geometry? || needs_different_format? + needs_different_geometry? || needs_different_format? || needs_metadata_stripping? end def needs_different_geometry? @@ -31,5 +31,9 @@ module Paperclip def needs_different_format? @format.present? && @current_format != @format end + + def needs_metadata_stripping? + @attachment.instance.respond_to?(:local?) && @attachment.instance.local? + end end end -- cgit From 382cdd7f959480d59fee5646be320d6076cb18d8 Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 17 Sep 2018 20:24:46 +0200 Subject: Unconditionally re-encode locally-uploaded images to strip metadata This strips metadata on file upload by re-encoding the files, at the cost of possible slight image quality decrease and processing resources. --- lib/paperclip/lazy_thumbnail.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/paperclip/lazy_thumbnail.rb b/lib/paperclip/lazy_thumbnail.rb index ea675a5bf..542c17fb2 100644 --- a/lib/paperclip/lazy_thumbnail.rb +++ b/lib/paperclip/lazy_thumbnail.rb @@ -20,7 +20,7 @@ module Paperclip private def needs_convert? - needs_different_geometry? || needs_different_format? + needs_different_geometry? || needs_different_format? || needs_metadata_stripping? end def needs_different_geometry? @@ -31,5 +31,9 @@ module Paperclip def needs_different_format? @format.present? && @current_format != @format end + + def needs_metadata_stripping? + @attachment.instance.respond_to?(:local?) && @attachment.instance.local? + end end end -- cgit From 3b05eb800245ef5785a5ac1d018b86d324b48c45 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Wed, 5 Sep 2018 11:25:57 +0200 Subject: Add -glitch suffix to version string Fixes #715 --- lib/mastodon/version.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index 0442a156d..fc7fa5aca 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -28,8 +28,12 @@ module Mastodon [major, minor, patch, pre].compact end + def suffix + '+glitch' + end + def to_s - [to_a.join('.'), flags].join + [to_a.join('.'), flags, suffix].join end def repository -- cgit