AllStarLink / Allmon3

Allmon is the standard web-based montitoring and management for the AllStarLink application. Allmon3 is the next generation of the venerable Allmon2 that is rewritten for performance, scalability, and responsiveness.
GNU Affero General Public License v3.0
18 stars 11 forks source link

getAPIJSON error 400 Bad Request #237

Closed eliggett closed 3 months ago

eliggett commented 4 months ago

Description When clicking node links (left hand side), there's an invalid URL sent to the getAPIJSON function.

version Running Allmon3 release 1.3.1-2 on Raspberry Pi ASL3 image, built from source

Javascript console Text

XHRGET
https://10.0.0.90/allmon3/master/ui/custom/menu
[HTTP/1.1 400 Bad Request 5ms]

getAPIJSON error status 400 Bad Request functions.js:59:10
Some cookies are misusing the recommended “SameSite“ attribute 2

expected No error message

What happens because of this I have no idea if anything bad or unexpected happens due to the above, but it may be worth tracking it down. If this is a "if we have a custom thingy, then we use it" kind of function, maybe we can handle it better?

Thanks, otherwise working very nicely!

jxmx commented 4 months ago

I cannot reproduce this error either with a default install or with a complicated menu.ini. Can you give me more to go on?

eliggett commented 4 months ago

I don't have a menu.ini here. My only customization was to add my three nodes to allmon3.ini. I also set the CONFIG_HEADER_TITLE to "Great Link Radio Society" in web.ini. That's all, I've stopped myself from going farther :).

If you look in functions.js, you can see where "custom/menu" is requested.

I can reproduce this by clicking around in Allmon3 (or just clicking the nodes on the left side). Web browser is Firefox 128.0.3 on Linux Mint 21. You'll have to open the developer's console in Firefox open to see these errors when they happen.

eliggett commented 4 months ago

I think it's right here: https://github.com/AllStarLink/Allmon3/blob/e7735416a181055ec054775f01504a4fe2a94a48/web/js/functions.js#L186

Perhaps this is better left as-is. Without a configuration option to enable/disable this, the only way to tell if the custom menu is available is exactly what the code already does -- try and retrieve it, if the return is zero-length, move on.

Or this could be commented out and the people that run with custom menus can enable it?

jxmx commented 4 months ago

master/ui/custom/menu should be returning an empty JSON array not a HTTP 400 error. I"ll have to look into that.