Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Problem: volume via rest api doesnt work with multiroom
#11
(09-19-2024, 01:22 PM)LeGuiz Wrote: here

curl -G "http://moode.local/command/index.php" -d "cmd=set_volume+up+2"

Per the Setup Guide the command is -up or -dn
https://github.com/moode-player/docs/blo...set_volume

In any case I can repro that the curl command does not work and it appears that calling the index.php script in this way does not allow the PHP session to be opened which is required for a couple of the commands including set_volume.

Here's an example. The get_output_format command requires access to the PHP session but the cookie being sent by curl is not the correct session cookie. It should be ho7vk67sqrjua8sme0pqhsjgdq

Code:
pi@moode9:~ $ curl -G -S -s -I  --data-urlencode "cmd=get_output_format" http://trx/command/
HTTP/1.1 200 OK
Server: nginx/1.22.1
Date: Thu, 19 Sep 2024 15:08:54 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Set-Cookie: PHPSESSID=hi483a4ilmj3t39q8qa29op9ju; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#12
I'll push a fix for this later today alone with a command to install the updated index.php file.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#13
Try this updated file

Code:
sudo wget -q https://raw.githubusercontent.com/moode-player/moode/develop/www/command/index.php -O /var/www/command/index.php
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#14
thanks

I have try the updated index.php but same result no better.
Reply
#15
and this seems to be the cookie...

curl -G -S -s -I --data-urlencode "cmd=get_output_format" http://moode.local/trx/command/

HTTP/1.1 302 Found
Server: nginx/1.22.1
Date: Fri, 20 Sep 2024 13:19:04 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Set-Cookie: PHPSESSID=ho7vk67sqrjua8sme0pqhsjgdq; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Location: /images/default-album-cover.png
Reply
#16
This works perfectly on my end. Be sure to use -up

Code:
curl -G "http://trx.local/command/index.php" -d "cmd=set_volume+-up+2"

Verify its the new version of index.php

Code:
pi@moode9:~ $ cat /var/www/command/index.php | grep "function openSessionReadOnly()"
function openSessionReadOnly() {
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#17
super it works !!

Thanks a lot for your help and your utmost responsiveness and understanding.
Reply
#18
Ok, cool :-)
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#19
Sadly this problem keep coming back after latest updates.

Right now it does not work no more, when the curl command is send there is no error but neither the sound or the volume in webUI moves, when I click on webUI to adjust volume it will then catch up to where the curl command as bee sending...
Reply
#20
The commands work fine on my end

Code:
pi@moode9:~ $ curl -G "http://trx.local/command/index.php" -d "cmd=set_volume+-up+2"
{"volume":"17","muted":"no"}pi@moode9:~ $

pi@moode9:~ $ curl -G "http://trx.local/command/index.php" -d "cmd=set_volume+-dn+2"
{"volume":"15","muted":"no"}pi@moode9:~ $
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: