2019-03-31 11:38:06 -04:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
2023-06-20 07:30:35 -04:00
|
|
|
local dofile, io, ipairs, string, table
|
|
|
|
= dofile, io, ipairs, string, table
|
|
|
|
local io_open, io_popen, string_gsub, string_match, table_concat,
|
|
|
|
table_sort
|
|
|
|
= io.open, io.popen, string.gsub, string.match, table.concat,
|
|
|
|
table.sort
|
2019-03-31 11:38:06 -04:00
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
2021-02-27 20:10:01 -05:00
|
|
|
-- luacheck: push
|
|
|
|
-- luacheck: globals config readtext readbinary
|
|
|
|
|
|
|
|
readtext = readtext or function() end
|
|
|
|
readbinary = readbinary or function() end
|
|
|
|
|
2023-11-21 20:02:29 -05:00
|
|
|
local version = dofile("./version.lua")
|
|
|
|
|
2023-06-20 07:30:35 -04:00
|
|
|
local metadata = {
|
2019-03-31 11:38:06 -04:00
|
|
|
pkg = "szutilpack",
|
2023-11-21 20:02:29 -05:00
|
|
|
version = version,
|
2021-02-28 08:42:26 -05:00
|
|
|
type = "mod",
|
2021-12-26 14:33:01 -05:00
|
|
|
dev_state = "ACTIVELY_DEVELOPED",
|
2021-02-28 08:42:26 -05:00
|
|
|
title = "SzUtilPack",
|
2023-11-14 21:29:20 -05:00
|
|
|
short_description = "A collection of misc dependency-free utilities primarily for server hosts",
|
2021-02-28 08:42:26 -05:00
|
|
|
tags = {
|
2023-12-02 16:27:04 -05:00
|
|
|
"complex_installation",
|
2021-02-28 08:42:26 -05:00
|
|
|
"environment",
|
|
|
|
"library",
|
|
|
|
"world_tools",
|
|
|
|
"player_effects",
|
|
|
|
"server_tools",
|
|
|
|
"transport"
|
|
|
|
},
|
|
|
|
content_warnings = {},
|
|
|
|
license = "MIT",
|
|
|
|
media_license = "MIT",
|
|
|
|
repo = "https://gitlab.com/sztest/szutilpack",
|
|
|
|
maintainers = {"Warr1024"},
|
2024-07-27 13:23:09 -04:00
|
|
|
screenshots = {readbinary('.cdbscreen.webp')}
|
2019-03-31 11:38:06 -04:00
|
|
|
}
|
2021-02-27 20:10:01 -05:00
|
|
|
|
2023-06-20 07:30:35 -04:00
|
|
|
local function exist(file)
|
|
|
|
local f = io_open(file, "rb")
|
|
|
|
if f then f:close() end
|
|
|
|
return f ~= nil
|
|
|
|
end
|
|
|
|
|
|
|
|
local mods = {}
|
|
|
|
do
|
|
|
|
local f = io_popen("ls -A -1 .")
|
|
|
|
while true do
|
|
|
|
local l = f:read("*line")
|
|
|
|
if not l then break end
|
|
|
|
if exist(l .. "/mod.conf") then
|
|
|
|
mods[#mods + 1] = l
|
|
|
|
end
|
|
|
|
end
|
|
|
|
table_sort(mods)
|
|
|
|
end
|
|
|
|
|
|
|
|
local parts = {
|
|
|
|
readtext("README.md"),
|
|
|
|
"",
|
|
|
|
readtext(".cdb-readme-pre.md"),
|
|
|
|
""
|
|
|
|
}
|
|
|
|
|
2023-11-21 20:02:29 -05:00
|
|
|
local commitid = "master"
|
|
|
|
if string_match(version, "-") then
|
2023-11-21 20:08:16 -05:00
|
|
|
commitid = string_gsub(version, ".*-", "")
|
2023-11-21 20:02:29 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
local function getmodlink(name)
|
|
|
|
for _, fn in ipairs({"README.md", "README.txt", "README"}) do
|
|
|
|
if exist(name .. "/" .. fn) then
|
|
|
|
return "[" .. name .. "](https://gitlab.com/sztest/szutilpack/-/blob/"
|
|
|
|
.. commitid .. "/" .. name .. "/" .. fn .. ")"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return "**" .. name .. "**"
|
|
|
|
end
|
|
|
|
|
2023-06-20 07:30:35 -04:00
|
|
|
local function scanmods(reqsock)
|
|
|
|
for _, m in ipairs(mods) do
|
|
|
|
if reqsock == exist(m .. "/.requires-luasockets") then
|
|
|
|
local conf = readtext(m .. "/mod.conf")
|
|
|
|
local desc = string_match(conf, "description%s*=%s*(.-)\n")
|
2023-11-21 20:02:29 -05:00
|
|
|
parts[#parts + 1] = "- " .. getmodlink(m) .. ": " .. desc
|
2023-06-20 07:30:35 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
scanmods(false)
|
|
|
|
parts[#parts + 1] = ""
|
|
|
|
parts[#parts + 1] = readtext(".cdb-readme-sock.md")
|
|
|
|
parts[#parts + 1] = ""
|
|
|
|
scanmods(true)
|
|
|
|
parts[#parts + 1] = ""
|
|
|
|
parts[#parts + 1] = readtext(".cdb-readme-post.md")
|
|
|
|
|
|
|
|
metadata.long_description = string_gsub(table_concat(parts, "\n"), "\n\n+", "\n\n")
|
|
|
|
return metadata
|
|
|
|
|
2021-02-27 20:10:01 -05:00
|
|
|
-- luacheck: pop
|