Replace Oj with plain JSON across lib/

This commit is contained in:
Matt Jankowski 2024-10-30 15:41:12 -04:00
parent 7dfd9d71ec
commit 1577b99c75
3 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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'

View File

@ -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