diff options
| -rwxr-xr-x | mirror-checker.lua | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/mirror-checker.lua b/mirror-checker.lua index 96cc099..9dd93bb 100755 --- a/mirror-checker.lua +++ b/mirror-checker.lua | |||
| @@ -335,22 +335,36 @@ local getMirrors = function () | |||
| 335 | local mirrors = {} | 335 | local mirrors = {} |
| 336 | local host = "" | 336 | local host = "" |
| 337 | local m = {} | 337 | local m = {} |
| 338 | local active = true | ||
| 338 | local URL = "https://" .. options.referenceSite.value .. "/mirror_list.txt" | 339 | local URL = "https://" .. options.referenceSite.value .. "/mirror_list.txt" |
| 339 | I("getting mirrors.") | 340 | I("getting mirrors.") |
| 340 | local p, c, h = http.request(URL) | 341 | local p, c, h = http.request(URL) |
| 341 | if nil == p then E(c .. " fetching " .. URL) else | 342 | if nil == p then E(c .. " fetching " .. URL) else |
| 342 | for l in p:gmatch("\n*([^\n]+)\n*") do | 343 | for l in p:gmatch("\n*([^\n]+)\n*") do |
| 343 | local t, d = l:match("(%a*):%s*(.*)") | 344 | local t, d = l:match("(%a*):%s*(.*)") |
| 345 | d = string.lower(d) | ||
| 344 | if "FQDN" == t then | 346 | if "FQDN" == t then |
| 345 | if "" ~= host then | 347 | if "" ~= host then |
| 346 | mirrors[host] = m | 348 | if active then mirrors[host] = m end |
| 347 | m = {} | 349 | m = {} |
| 350 | active = true | ||
| 348 | end | 351 | end |
| 349 | host = d | 352 | host = d |
| 353 | m[t] = d | ||
| 354 | elseif "Protocols" == t then | ||
| 355 | local prot = {} | ||
| 356 | for w in d:gmatch("(%w+)") do | ||
| 357 | prot[w] = true; | ||
| 358 | end | ||
| 359 | m[t] = prot | ||
| 360 | elseif "Active" == t and nil == d:find("yes", 1, true) then | ||
| 361 | W("Mirror " .. host .. " is not active - " .. d) | ||
| 362 | active = false | ||
| 363 | else | ||
| 364 | m[t] = d | ||
| 350 | end | 365 | end |
| 351 | m[t] = d | ||
| 352 | end | 366 | end |
| 353 | if "" ~= host then | 367 | if "" ~= host and active then |
| 354 | mirrors[host] = m | 368 | mirrors[host] = m |
| 355 | end | 369 | end |
| 356 | end | 370 | end |
