1
0
mirror of https://github.com/kepler155c/opus synced 2025-12-18 22:28:06 +00:00

format and installer branches

This commit is contained in:
kepler155c@gmail.com
2018-01-24 17:39:38 -05:00
parent 1eea0d7cd8
commit 5a32fe208e
80 changed files with 10742 additions and 10156 deletions

View File

@@ -8,42 +8,42 @@ local git = { }
function git.list(repository)
local t = Util.split(repository, '(.-)/')
local t = Util.split(repository, '(.-)/')
local user = t[1]
local repo = t[2]
local branch = t[3] or 'master'
local user = t[1]
local repo = t[2]
local branch = t[3] or 'master'
local dataUrl = string.format(TREE_URL, user, repo, branch)
local contents = Util.download(dataUrl)
local dataUrl = string.format(TREE_URL, user, repo, branch)
local contents = Util.download(dataUrl)
if not contents then
error('Invalid repository')
end
if not contents then
error('Invalid repository')
end
local data = json.decode(contents)
local data = json.decode(contents)
if data.message and data.message:find("API rate limit exceeded") then
error("Out of API calls, try again later")
end
if data.message and data.message:find("API rate limit exceeded") then
error("Out of API calls, try again later")
end
if data.message and data.message == "Not found" then
error("Invalid repository")
end
if data.message and data.message == "Not found" then
error("Invalid repository")
end
local list = { }
local list = { }
for _,v in pairs(data.tree) do
if v.type == "blob" then
v.path = v.path:gsub("%s","%%20")
list[v.path] = {
url = string.format(FILE_URL, user, repo, branch, v.path),
size = v.size,
}
end
end
for _,v in pairs(data.tree) do
if v.type == "blob" then
v.path = v.path:gsub("%s","%%20")
list[v.path] = {
url = string.format(FILE_URL, user, repo, branch, v.path),
size = v.size,
}
end
end
return list
return list
end
return git