Update dependencies

This commit is contained in:
Omar Roth 2020-07-16 18:15:17 -04:00
parent 1a07a52113
commit 44415c1c62
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2
2 changed files with 10 additions and 7 deletions

View File

@ -11,8 +11,8 @@ targets:
dependencies:
kemal:
github: kemalcr/kemal
version: ~> 0.26.1
branch: master
crystal: 0.34.0
crystal: 0.35.1
license: AGPLv3

View File

@ -42,13 +42,11 @@ spawn do
monitors += response["psp"]["monitors"].as_a
page += 1
if response["psp"]["perPage"].as_i * page > response["psp"]["totalMonitors"].as_i
break
end
break if response["psp"]["perPage"].as_i * page > response["psp"]["totalMonitors"].as_i
rescue ex
error_message = response.try &.as?(String).try &.["errorStats"]?
error_message ||= ex.message
puts "Exception pulling monitors: #{error_message}"
puts "Error pulling monitors: #{error_message}"
break
end
end
@ -56,6 +54,8 @@ spawn do
body = HTTP::Client.get(URI.parse("https://raw.githubusercontent.com/wiki/omarroth/invidious/Invidious-Instances.md")).body
headers = HTTP::Headers.new
instances = {} of String => Instance
body = body.split("### Blocked:")[0]
body.scan(/\[(?<host>[^ \]]+)\]\((?<uri>[^\)]+)\)( .(?<region>[\x{1f100}-\x{1f1ff}]{2}))?/mx).each do |md|
region = md["region"]?.try { |region| region.codepoints.map { |codepoint| (codepoint - 0x1f1a5).chr }.join("") }
@ -80,9 +80,12 @@ spawn do
end
monitor = monitors.try &.select { |monitor| monitor["name"].try &.as_s == host }[0]?
INSTANCES[host] = {flag: flag, region: region, stats: stats, type: type, uri: uri.to_s, monitor: monitor || INSTANCES[host]?.try &.[:monitor]?}
instances[host] = {flag: flag, region: region, stats: stats, type: type, uri: uri.to_s, monitor: monitor || instances[host]?.try &.[:monitor]?}
end
INSTANCES.clear
INSTANCES.merge! instances
sleep 5.minutes
Fiber.yield
end