|
|
@ -39,26 +39,26 @@ printUsage = -> |
|
|
|
|
|
|
|
-- Make an internet http/s request for data |
|
|
|
getContent = (url) -> |
|
|
|
sContent = "" |
|
|
|
content = "" |
|
|
|
result, response = pcall(internet.request, url) |
|
|
|
|
|
|
|
if not result |
|
|
|
return nil |
|
|
|
|
|
|
|
for chunk in response |
|
|
|
sContent = sContent .. chunk |
|
|
|
content = content .. chunk |
|
|
|
|
|
|
|
return sContent |
|
|
|
return content |
|
|
|
|
|
|
|
-- Request repository information |
|
|
|
getRepos = -> |
|
|
|
success, sRepos = pcall(getContent, repoLocationConfig) |
|
|
|
getRepositories = -> |
|
|
|
success, raw_repositories = pcall(getContent, repoLocationConfig) |
|
|
|
|
|
|
|
if not success |
|
|
|
io.stderr\write("Could not connect to the Internet. Please ensure you have an Internet connection.") |
|
|
|
return -1 |
|
|
|
|
|
|
|
return serial.unserialize(sRepos) |
|
|
|
return serial.unserialize(raw_repositories) |
|
|
|
|
|
|
|
-- Get Packages for src |
|
|
|
getPackages = (src) -> |
|
|
@ -136,7 +136,7 @@ listPackages = (filter) -> |
|
|
|
packageTable = {} |
|
|
|
print("Receiving Package list...") |
|
|
|
if not options.i |
|
|
|
success, repositories = pcall(getRepos) |
|
|
|
success, repositories = pcall(getRepositories) |
|
|
|
|
|
|
|
if not success or repositories == -1 |
|
|
|
io.stderr\write("Unable to connect to the Internet.\n") |
|
|
@ -205,7 +205,7 @@ printPackages = (packages) -> |
|
|
|
xCur, yCur = term.getCursor() |
|
|
|
|
|
|
|
getInformation = (requestedPackage) -> |
|
|
|
success, repositories = pcall(getRepos) |
|
|
|
success, repositories = pcall(getRepositories) |
|
|
|
|
|
|
|
if not success or repositories == -1 |
|
|
|
io.stderr\write("Unable to connect to the Internet.\n") |
|
|
|