From 1577b99c7539dcb5e6c91c962278f48042655828 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 30 Oct 2024 15:41:12 -0400 Subject: [PATCH] Replace `Oj` with plain `JSON` across lib/ --- lib/mastodon/cli/domains.rb | 8 ++++---- lib/tasks/emojis.rake | 4 ++-- lib/tasks/repo.rake | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/mastodon/cli/domains.rb b/lib/mastodon/cli/domains.rb index c247463af5..20927dae6a 100644 --- a/lib/mastodon/cli/domains.rb +++ b/lib/mastodon/cli/domains.rb @@ -140,13 +140,13 @@ module Mastodon::CLI Request.new(:get, "https://#{domain}/api/v1/instance").perform do |res| next unless res.code == 200 - stats[domain] = Oj.load(res.to_s) + stats[domain] = JSON.parse(res.to_s) end Request.new(:get, "https://#{domain}/api/v1/instance/peers").perform do |res| next unless res.code == 200 - Oj.load(res.to_s).reject { |peer| stats.key?(peer) }.each do |peer| + JSON.parse(res.to_s).reject { |peer| stats.key?(peer) }.each do |peer| pool.post(peer, &work_unit) end end @@ -154,7 +154,7 @@ module Mastodon::CLI Request.new(:get, "https://#{domain}/api/v1/instance/activity").perform do |res| next unless res.code == 200 - stats[domain]['activity'] = Oj.load(res.to_s) + stats[domain]['activity'] = JSON.parse(res.to_s) end rescue failed.increment @@ -214,7 +214,7 @@ module Mastodon::CLI def stats_to_json(stats) stats.compact! - say(Oj.dump(stats)) + say(JSON.dump(stats)) end end end diff --git a/lib/tasks/emojis.rake b/lib/tasks/emojis.rake index fb18f21cf5..3bbda39a60 100644 --- a/lib/tasks/emojis.rake +++ b/lib/tasks/emojis.rake @@ -84,7 +84,7 @@ namespace :emojis do map = map.sort { |a, b| a[0].size <=> b[0].size }.to_h - File.write(dest, Oj.dump(map)) + File.write(dest, JSON.dump(map)) puts "Wrote emojo to destination! (#{dest})" end @@ -94,7 +94,7 @@ namespace :emojis do emojis_light = 'đŸ‘Ŋ⚾🐔☁ī¸đŸ’¨đŸ•Šī¸đŸ‘€đŸĨđŸ‘ģ🐐❕❔⛸ī¸đŸŒŠī¸đŸ”ŠđŸ”‡đŸ“ƒđŸŒ§ī¸đŸđŸšđŸ™đŸ“đŸ‘đŸ’€â˜ ī¸đŸŒ¨ī¸đŸ”‰đŸ”ˆđŸ’Ŧ💭🏐đŸŗī¸âšĒâŦœâ—Ŋâ—ģī¸â–Ģī¸đŸĒŊđŸĒŋ' emojis_dark = '🎱🐜âšĢ🖤âŦ›â—ŧī¸â—žâ—ŧī¸âœ’ī¸â–Ēī¸đŸ’ŖđŸŽŗ📷📸â™Ŗī¸đŸ•ļī¸âœ´ī¸đŸ”ŒđŸ’‚‍♀ī¸đŸ“Ŋī¸đŸŗđŸĻđŸ’‚đŸ”ĒđŸ•ŗī¸đŸ•šī¸đŸ•‹đŸ–Šī¸đŸ–‹ī¸đŸ’‚‍♂ī¸đŸŽ¤đŸŽ“đŸŽĨđŸŽŧ♠ī¸đŸŽŠđŸĻƒđŸ“ŧ📹🎮🐃🏴🐞đŸ•ē📱📲🚲đŸĒŽđŸĻ‍âŦ›' - map = Oj.load(File.read(src)) + map = JSON.parse(File.read(src)) emojis_light.each_grapheme_cluster do |emoji| gen_border map[emoji], 'black' diff --git a/lib/tasks/repo.rake b/lib/tasks/repo.rake index c8f977f651..d834b99055 100644 --- a/lib/tasks/repo.rake +++ b/lib/tasks/repo.rake @@ -22,7 +22,7 @@ namespace :repo do while url.present? response = HTTP.get(url) - contributors = Oj.load(response.body) + contributors = JSON.parse(response.body) contributors.each do |c| file << "* [#{c['login']}](#{c['html_url']})\n" if c['login'] @@ -68,7 +68,7 @@ namespace :repo do end end - pull_request = Oj.load(response.to_s) + pull_request = JSON.parse(response.to_s) pull_request['user']['login'] end