FlorianWendelborn / fritz-box

:package: Promise-based JavaScript FRITZ!Box API.
https://npmjs.com/package/fritz-box
MIT License
12 stars 5 forks source link

Compatibility issue: data.lua responds json instead of html now #27

Open No3x opened 4 years ago

No3x commented 4 years ago

Method: getGuestWLAN The method queries data.lua and the request works fine. On my FRITZ!OS-Version 07.12 data.lua responds with json but the current implementation assumes html. Therefore no valid data is extracted.

Example response - click to expand ```json { "data": { "timestamp": 153, "guestAccess": { "lPTxt": "", "psk": "MyPSKKKKK123123123", "isIpClient": false, "supportsRegulation": true, "notification": "0", "notificationEnabled": "0", "autoUpdate": "1", "showGuest": true, "mode": "1", "lPEnabled": "0", "lPRedirect": "0", "activeNexusClient": false, "hideRepAutoUpdate": true, "timeout": "30", "isMaster": true, "lPImg": "0", "timeoutNoForcedOff": "0", "lPReguire": "0", "defaultSsid": { "private": "FRITZ!Box Gastzugang", "public": "FRITZ! Hotspot" }, "guestGroupAccess": "1", "isolated": "1", "boxType": "box", "ssid": "FRITZ!Box MYName", "isEnabled": "0", "lPRedirectUrl": "", "wpsActive": true, "isTimeoutActive": "0" } }, "hide": { "ssoEmail": true, "shareUsb": true, "liveTv": true, "faxSet": true, "dectMoniEx": true, "rss": true, "mobile": true, "dectMail": true, "ssoSet": true, "liveImg": true }, "pid": "wGuest", "sid": "9eeef9918eb956f7" } ```

I checked if the same is true for data.lua with page homeNet but this API returns still HTML.

FlorianWendelborn commented 4 years ago

Don’t have much time to work on this project right now, but I’d gladly accept a pull request that implements this functionality

Thanks for reporting it in any case, the first step to solving this is to be aware of it. ;)

No3x commented 4 years ago

I fixed what I need in my fork for the newer FRITZ!OS-Version. To merge this one would need a setting/toggle/switch to choose the right parsing or try the other parsing if the first one fails. Furthermore my current implementation does support parsing of a subset of values only. But I don't have time/need to fix this properly. Thanks for making this lib public 👍

filly82 commented 4 years ago

would also appreciate a fix for the newer versions of FRITZ!OS