SilentNight Lua
SilentNight Lua
local json = {}
local escape_char_map = {
["\\"] = "\\",
["\""] = "\"",
["\b"] = "b",
["\f"] = "f",
["\n"] = "n",
["\r"] = "r",
["\t"] = "t",
}
local parse
return res
end
local literal_map = {
["true"] = true,
["false"] = false,
["null"] = nil,
}
return #str + 1
end
for i = 1, idx - 1 do
col_count = col_count + 1
if str:sub(i, i) == "\n" then
line_count = line_count + 1
col_count = 1
end
end
if n2 then
return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000)
else
return codepoint_to_utf8(n1)
end
end
if x < 32 then
decode_error(str, j, "control character in string")
if c == "u" then
local hex = str:match("^[dD][89aAbB]%x%x\\u%x%x%x%x", j + 1) or
str:match("^%x%x%x%x", j + 1) or decode_error(str, j - 1, "invalid unicode escape
in string")
res = string.format("%s%s", res, parse_unicode_escape(hex))
j = j + #hex
else
if not escape_chars[c] then
decode_error(str, j - 1, "invalid escape char '%s' in string",
c)
end
k = j + 1
j = j + 1
end
if not n then
decode_error(str, i, string.format('invalid number "%s"', tostring(s)))
end
return n, x
end
return literal_map[word], x
end
while 1 do
local x
i = next_char(str, i, space_chars, true)
x, i = parse(str, i)
res[n] = x
n = n + 1
i = next_char(str, i, space_chars, true)
local chr = str:sub(i, i)
i = i + 1
end
return res, i
end
key, i = parse(str, i)
i = next_char(str, i, space_chars, true)
return res, i
end
local char_func_map = {
['"'] = parse_string,
["0"] = parse_number,
["1"] = parse_number,
["2"] = parse_number,
["3"] = parse_number,
["4"] = parse_number,
["5"] = parse_number,
["6"] = parse_number,
["7"] = parse_number,
["8"] = parse_number,
["9"] = parse_number,
["-"] = parse_number,
["t"] = parse_literal,
["f"] = parse_literal,
["n"] = parse_literal,
["["] = parse_array,
["{"] = parse_object,
}
if f then
return f(str, idx)
end
function json.decode(str)
if type(str) ~= "string" then
error(string.format("expected argument of type string, got %s", type(str)))
end
return res
end
--#endregion
curl:Setopt(eCurlOption.CURLOPT_URL, commitsUrl)
curl:AddHeader("user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
OPR/105.0.0.0")
curl:Perform()
curl:Setopt(eCurlOption.CURLOPT_URL, url)
curl:AddHeader("user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36")
curl:Perform()
curl:Setopt(eCurlOption.CURLOPT_URL, url)
curl:AddHeader("user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
OPR/105.0.0.0")
curl:Perform()
local totalFiles = 0
local fileStructure = {}
ParseGithubDirectory(mainURL, rootPath)
downloadedFileCount = downloadedFileCount + 1
Logger.Log(eLogColor.GREEN, "Silent Night", ("Downloaded %d / %d
files"):format(downloadedFileCount, totalFiles))
end
end
end
return true
end
dofile(path)
end
Script.QueueJob(function()
if IsUpToDate() ~= false then
ExecuteMain()
return
end