LWSP upgrade for Luanti 5.17.0
Luanti's recent release of version 5.17.0 added a feature that validates ContentDB package author using a simple regex, but Luanti WebServices Proxy overloads the author field with the backend server connection information, so I had to update LWSP to fix this.
The validations fit entirely in this block, in file builtin/mainmenu/content/contentdb.lua
for i = #packages, 1, -1 do local package = packages[i] if not (type(package.author) == "string" and type(package.name) == "string" and type(package.type) == "string" and type(package.release) == "number" and package.author:match("^[%w _%-.]+$") and package.name:match("^[a-z0-9_]+$")) then core.log("warning", "ContentDB: Dropping invalid package: " .. dump(package)) table.remove(packages, i) end end
So it's lua, thankfully, which is way easier for me to read than C++. An easy fix would be to adjust the client lua file to add a colon and tilde in the package author regex.
package.author:match("^[%w _%-.~:]+$") and
But seeing as how nobody else will adjust their client configs to allow that, so I adjusted lwsp to split author and host+proto with _AT_ rather than ~, and also replace a colon with _colon_. It's longer and a little less pretty, but it matches the vanilla client expectations. Not everyone who might use lwsp will use a stackrpms build of Luanti.
Comments