diff --git a/install.lua b/install.lua new file mode 100644 index 0000000..8fdee95 --- /dev/null +++ b/install.lua @@ -0,0 +1,18 @@ +fs.makeDir("/ccryptolib") -- Make folder structure + +function downloadDir(dir) + local data = textutils.unserialiseJSON(http.get("https://git.chrischro.me/api/v1/repos/ChrisChrome/ccryptolib/contents/" .. dir).readAll()) + for _,entry in ipairs(data) do + if entry.type == "file" then -- We're gonna download it + print("Downloading " .. entry.name) + local file = http.get(entry.download_url).readAll() + local newFile = fs.open("/" .. entry.path, "w") + newFile.write(file) + newFile.close() + elseif entry.type == "dir" then + downloadDir(entry.path) + end + end +end + +downloadDir("ccryptolib") \ No newline at end of file