70 lines
1.7 KiB
Lua
70 lines
1.7 KiB
Lua
|
local Escapes=require"html"
|
||
|
|
||
|
local cfg
|
||
|
|
||
|
local function ld()
|
||
|
cfg = loadfile("cfg.lua", "t")
|
||
|
|
||
|
if cfg then cfg = cfg() end
|
||
|
|
||
|
if not cfg then
|
||
|
error("Configuration file is missing.")
|
||
|
end
|
||
|
end
|
||
|
|
||
|
local function serialize(t)
|
||
|
if type(t) == "table" then
|
||
|
local r = {"{"}
|
||
|
|
||
|
for k, v in pairs(t) do
|
||
|
table.insert(r, "[" .. string.format("%q", k) .. "]=" .. serialize(v) .. ",")
|
||
|
end
|
||
|
|
||
|
table.insert(r, "}")
|
||
|
return table.concat(r)
|
||
|
else
|
||
|
return string.format("%q", t)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
local function sv()
|
||
|
local out = io.open("cfg.lua", "wb")
|
||
|
out:write"-- THIS FILE IS AUTO-GENERATED. USE THE WEB ADMIN MENU!!\nreturn "
|
||
|
out:write(serialize(cfg))
|
||
|
out:close()
|
||
|
|
||
|
out = io.open("static/tagcats.css", "wb")
|
||
|
for i=1,cfg.tc.n do
|
||
|
out:write("div.tag.tc" .. (i - 1) .. "::before{content:" .. Escapes.cssescape(cfg.tc[i].name:sub(1, 1)) .. ";}")
|
||
|
out:write("div.tag.tc" .. (i - 1) .. ":hover::before{content:" .. Escapes.cssescape(cfg.tc[i].name) .. ";}")
|
||
|
|
||
|
local r = cfg.tc[i].col >> 16
|
||
|
local g = (cfg.tc[i].col >> 8) & 0xFF
|
||
|
local b = cfg.tc[i].col & 0xFF
|
||
|
local off = 150
|
||
|
local darker = math.floor(math.min(b + off, 255)) | (math.floor(math.min(g + off, 255)) << 8) | (math.floor(math.min(r + off, 255)) << 16)
|
||
|
out:write("div.tag.tc" .. (i - 1) .. "{border-color:#" .. string.format("%06x", cfg.tc[i].col) .. ";background-color:#"..string.format("%06x",darker)..";}")
|
||
|
end
|
||
|
out:close()
|
||
|
end
|
||
|
|
||
|
ld()
|
||
|
sv()
|
||
|
|
||
|
return {
|
||
|
MEMBEXCL_ADMIN_INVITES = 1,
|
||
|
MEMBEXCL_MODS_INVITE = 2,
|
||
|
MEMBEXCL_MEMBERS_INVITE = 3,
|
||
|
MEMBEXCL_PUBLIC_WITHAPPROVAL = 4,
|
||
|
MEMBEXCL_PUBLIC_NOAPPROVAL = 5,
|
||
|
|
||
|
MAX_COMMENT_SIZE = 1024,
|
||
|
|
||
|
REPORT_STATUS_OPEN = 0,
|
||
|
REPORT_STATUS_CLOSED_WONTFIX = 1,
|
||
|
REPORT_STATUS_CLOSED_FIXED = 2,
|
||
|
|
||
|
cfg = cfg,
|
||
|
ld = ld,
|
||
|
sv = sv
|
||
|
}
|