Closed Nowaker closed 2 years ago
It appears to be an in-browser JavaScript error.
Uncaught SyntaxError: Unexpected token ':'
Seems related to the SIM card capacity logic. sms_tool
is doing fine:
# sms_tool -d /dev/ttyUSB2 status
Storage type: SM, used: 5, total: 5
XHR request to readsim
also works fine, regardless of whether I configure SIM card or memory storage area - but only when done independently of the UI:
% curl 'http://XXX/cgi-bin/luci/admin/modem/sms/readsim?XXX' \
-H 'Connection: keep-alive' \
-H 'User-Agent: XXX' \
-H 'DNT: 1' \
-H 'Accept: */*' \
-H 'Referer: http://XXX/cgi-bin/luci/admin/modem/sms/readsms' \
-H 'Accept-Language: en-US,en;q=0.9,pl;q=0.8' \
-H 'Cookie: sysauth=XXX' \
--compressed \
--insecure
{"all":"255","use":"0"}
% curl 'http://192.168.10.1/cgi-bin/luci/admin/modem/sms/readsim?XXX' \
-H 'Connection: keep-alive' \
-H 'User-Agent: XXX' \
-H 'DNT: 1' \
-H 'Accept: */*' \
-H 'Referer: http://XXX/cgi-bin/luci/admin/modem/sms/readsms' \
-H 'Accept-Language: en-US,en;q=0.9,pl;q=0.8' \
-H 'Cookie: sysauth=XXX' \
--compressed \
--insecure
{"all":"5","use":"5"}
It's worth noting that when memory storage is set up, the UI doesn't throw any in-browser exceptions, and the capacity is correctly shown as 0/255.
Okay, found the bug:
local statusb = luci.util.exec("sms_tool -s" .. smsmem .. " -d ".. devv .. " status")
local all = string.sub (statusb, -4)
The code assumes the number has 3 digits. Well. Mine has one. Smarter parsing of sms_tool status
is needed.
Fix:
local all = statusb:match('[^: ]+$')
sms_tool
sees the messages:luci-app-sms-tool config: