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