fix(json): add multi-platform JSON library compatibility
- Add flexible JSON detection (cjson preferred, dkjson fallback) - Update main.lua and mail.lua with found_cjson detection - Update start.sh to check both JSON libraries - Enables furt to run on Arch Linux without manual patches - Maintains API compatibility with existing cjson usage Fixes #108
This commit is contained in:
parent
785283950f
commit
78e8dedf8e
3 changed files with 13 additions and 5 deletions
|
|
@ -59,10 +59,12 @@ $LUA_COMMAND -e "require('socket')" 2>/dev/null || {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
$LUA_COMMAND -e "require('cjson')" 2>/dev/null || {
|
# JSON library check (cjson preferred, dkjson fallback)
|
||||||
echo -e "${RED}Error: lua-cjson not found${NC}"
|
if ! ($LUA_COMMAND -e "require('cjson')" 2>/dev/null || $LUA_COMMAND -e "require('dkjson')" 2>/dev/null); then
|
||||||
|
echo -e "${RED}Error: No JSON library found${NC}"
|
||||||
|
echo "Install lua-cjson or lua-dkjson"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
cd "$PROJECT_DIR"
|
cd "$PROJECT_DIR"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
-- Dragons@Work Digital Sovereignty Project
|
-- Dragons@Work Digital Sovereignty Project
|
||||||
|
|
||||||
local socket = require("socket")
|
local socket = require("socket")
|
||||||
local cjson = require("cjson")
|
local found_cjson, cjson = pcall(require, 'cjson')
|
||||||
|
if not found_cjson then
|
||||||
|
cjson = require('dkjson')
|
||||||
|
end
|
||||||
|
|
||||||
-- Load modules
|
-- Load modules
|
||||||
local Auth = require("src.auth")
|
local Auth = require("src.auth")
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
-- API-Key determines mail configuration and recipient
|
-- API-Key determines mail configuration and recipient
|
||||||
-- Dragons@Work Digital Sovereignty Project
|
-- Dragons@Work Digital Sovereignty Project
|
||||||
|
|
||||||
local cjson = require("cjson")
|
local found_cjson, cjson = pcall(require, 'cjson')
|
||||||
|
if not found_cjson then
|
||||||
|
cjson = require('dkjson')
|
||||||
|
end
|
||||||
|
|
||||||
local MailRoute = {}
|
local MailRoute = {}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue