mirror of
https://github.com/mastodon/mastodon.git
synced 2025-01-08 19:35:11 +01:00
Replace Oj
with plain JSON
across lib/
This commit is contained in:
parent
7dfd9d71ec
commit
1577b99c75
@ -140,13 +140,13 @@ module Mastodon::CLI
|
|||||||
Request.new(:get, "https://#{domain}/api/v1/instance").perform do |res|
|
Request.new(:get, "https://#{domain}/api/v1/instance").perform do |res|
|
||||||
next unless res.code == 200
|
next unless res.code == 200
|
||||||
|
|
||||||
stats[domain] = Oj.load(res.to_s)
|
stats[domain] = JSON.parse(res.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
Request.new(:get, "https://#{domain}/api/v1/instance/peers").perform do |res|
|
Request.new(:get, "https://#{domain}/api/v1/instance/peers").perform do |res|
|
||||||
next unless res.code == 200
|
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)
|
pool.post(peer, &work_unit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -154,7 +154,7 @@ module Mastodon::CLI
|
|||||||
Request.new(:get, "https://#{domain}/api/v1/instance/activity").perform do |res|
|
Request.new(:get, "https://#{domain}/api/v1/instance/activity").perform do |res|
|
||||||
next unless res.code == 200
|
next unless res.code == 200
|
||||||
|
|
||||||
stats[domain]['activity'] = Oj.load(res.to_s)
|
stats[domain]['activity'] = JSON.parse(res.to_s)
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
failed.increment
|
failed.increment
|
||||||
@ -214,7 +214,7 @@ module Mastodon::CLI
|
|||||||
|
|
||||||
def stats_to_json(stats)
|
def stats_to_json(stats)
|
||||||
stats.compact!
|
stats.compact!
|
||||||
say(Oj.dump(stats))
|
say(JSON.dump(stats))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -84,7 +84,7 @@ namespace :emojis do
|
|||||||
|
|
||||||
map = map.sort { |a, b| a[0].size <=> b[0].size }.to_h
|
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})"
|
puts "Wrote emojo to destination! (#{dest})"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ namespace :emojis do
|
|||||||
emojis_light = '👽⚾🐔☁️💨🕊️👀🍥👻🐐❕❔⛸️🌩️🔊🔇📃🌧️🐏🍚🍙🐓🐑💀☠️🌨️🔉🔈💬💭🏐🏳️⚪⬜◽◻️▫️🪽🪿'
|
emojis_light = '👽⚾🐔☁️💨🕊️👀🍥👻🐐❕❔⛸️🌩️🔊🔇📃🌧️🐏🍚🍙🐓🐑💀☠️🌨️🔉🔈💬💭🏐🏳️⚪⬜◽◻️▫️🪽🪿'
|
||||||
emojis_dark = '🎱🐜⚫🖤⬛◼️◾◼️✒️▪️💣🎳📷📸♣️🕶️✴️🔌💂♀️📽️🍳🦍💂🔪🕳️🕹️🕋🖊️🖋️💂♂️🎤🎓🎥🎼♠️🎩🦃📼📹🎮🐃🏴🐞🕺📱📲🚲🪮🐦⬛'
|
emojis_dark = '🎱🐜⚫🖤⬛◼️◾◼️✒️▪️💣🎳📷📸♣️🕶️✴️🔌💂♀️📽️🍳🦍💂🔪🕳️🕹️🕋🖊️🖋️💂♂️🎤🎓🎥🎼♠️🎩🦃📼📹🎮🐃🏴🐞🕺📱📲🚲🪮🐦⬛'
|
||||||
|
|
||||||
map = Oj.load(File.read(src))
|
map = JSON.parse(File.read(src))
|
||||||
|
|
||||||
emojis_light.each_grapheme_cluster do |emoji|
|
emojis_light.each_grapheme_cluster do |emoji|
|
||||||
gen_border map[emoji], 'black'
|
gen_border map[emoji], 'black'
|
||||||
|
@ -22,7 +22,7 @@ namespace :repo do
|
|||||||
|
|
||||||
while url.present?
|
while url.present?
|
||||||
response = HTTP.get(url)
|
response = HTTP.get(url)
|
||||||
contributors = Oj.load(response.body)
|
contributors = JSON.parse(response.body)
|
||||||
|
|
||||||
contributors.each do |c|
|
contributors.each do |c|
|
||||||
file << "* [#{c['login']}](#{c['html_url']})\n" if c['login']
|
file << "* [#{c['login']}](#{c['html_url']})\n" if c['login']
|
||||||
@ -68,7 +68,7 @@ namespace :repo do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
pull_request = Oj.load(response.to_s)
|
pull_request = JSON.parse(response.to_s)
|
||||||
pull_request['user']['login']
|
pull_request['user']['login']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user