INTERACT FORUM

More => Old Versions => JRiver Media Center 22 for Windows => Topic started by: AndrewFG on July 28, 2016, 10:51:04 am

Title: Did you change something in MCWS in v22
Post by: AndrewFG on July 28, 2016, 10:51:04 am
I just converted my operational HTPC from v21 to v22 and I notice that some the MCWS commands (sleep PC, restart PC) don't work any more; I am using the exact same MCWS syntax as before (URLs saved as a shortcut). Did you change anything here?

Title: Re: Did you change something in MCWS in v22
Post by: JimH on July 28, 2016, 11:03:42 am
Do you have an example of a command you're using?
Title: Re: Did you change something in MCWS in v22
Post by: Hendrik on July 28, 2016, 11:14:59 am
Some commands enforce authentication now, mostly things that can mess with the system, like shutdown etc.
Title: Re: Did you change something in MCWS in v22
Post by: AndrewFG on July 28, 2016, 02:49:35 pm
Some commands enforce authentication now, mostly things that can mess with the system, like shutdown etc.

That would be it. But can you please explain how this authentication is supposed to be done?
Title: Re: Did you change something in MCWS in v22
Post by: mattkhan on July 28, 2016, 03:01:45 pm
That would be it. But can you please explain how this authentication is supposed to be done?
unless it's changed, it's like http://yabb.jriver.com/interact/index.php?topic=104271.0

either basic auth or a token
Title: Re: Did you change something in MCWS in v22
Post by: AndrewFG on July 28, 2016, 03:31:48 pm
I have the URL below in my (Safari) browser favorites; until now, opening this favorite was sufficient to send my MC HTPC to sleep; but now it doesn't work. So what do I need to add to this URL to make it work again?

http://192.168.1.103:52199/MCWS/v1/Control/MCC?Command=27001&Parameter=1

Title: Re: Did you change something in MCWS in v22
Post by: mattkhan on July 28, 2016, 03:49:25 pm
I've done it like this https://github.com/3ll3d00d/jrmc-utils/blob/master/functions.sh

Code: [Select]
# Obtains an authentication token if one does not exist already
function authenticate {
    ensure_jrmc_alive
    if [ -z "${MCWS_AUTH_TOKEN}" ]
    then
        export MCWS_AUTH_TOKEN="$(curl -s -u ${JRMC_USER}:${JRMC_PASS} http://${JRMC_HOST}:${JRMC_PORT}/MCWS/v1/Authenticate | xmllint --xpath '/Response[@Status="OK"]/Item[@Name="Token"]/text()' - 2>/dev/null)"
return $?
    else
return 0
    fi
}

which you use by appending
Code: [Select]
&Token=${MCWS_AUTH_TOKEN} to the request

if would be nice if there were a simpler way to get a token rather than having to parse XML

how to supply http basic auth details probably depends on how you are calling it, curl is something like curl -u me:password123 http://foo.com for example

Title: Re: Did you change something in MCWS in v22
Post by: AndrewFG on July 28, 2016, 04:03:40 pm
I am not using code to call this function. And I do not want to use code for it. I just navigate to the http URL (stored in the browser favorites folder) via the regular stock Safari browser on my iPad. On MC 21 it worked just fine. But MC 22 has broken it..
Title: Re: Did you change something in MCWS in v22
Post by: mattkhan on July 28, 2016, 04:23:01 pm
I am not using code to call this function. And I do not want to use code for it. I just navigate to the http URL (stored in the browser favorites folder) via the regular stock Safari browser on my iPad. On MC 21 it worked just fine. But MC 22 has broken it..
it should challenge you for a username and password then, some browsers let you do http://username:password@myjriverinstance/some/path but I don't know if safari is one of them
Title: Re: Did you change something in MCWS in v22
Post by: Hendrik on July 28, 2016, 04:40:30 pm
You probably need to enable Authentication in the Media Network settings for those commands to be accessible again, which then means all interaction needs authentication. We decided a command to shutdown your system is best only available with credentials.
Its the same way with any action that writes to the library - you need to turn on Authentication or they fail.
Title: Re: Did you change something in MCWS in v22
Post by: AndrewFG on July 29, 2016, 12:45:48 am
You probably need to enable Authentication in the Media Network settings for those commands to be accessible again, which then means all interaction needs authentication.

Ok I will try that.

But what do you mean by "all interaction needs authentication"? Will I now have problems using the remotes (JRemote or Gizmo) that I have on every tablet and phone in the house?

Title: Re: Did you change something in MCWS in v22
Post by: Hendrik on July 29, 2016, 01:34:13 am
But what do you mean by "all interaction needs authentication"? Will I now have problems using the remotes (JRemote or Gizmo) that I have on every tablet and phone in the house?


They'll need to be told the credentials as well.
Title: Re: Did you change something in MCWS in v22
Post by: AndrewFG on July 30, 2016, 10:08:23 am
Ok. I turned on credentials on the MC server options and it now works again.

Just for info: I notice that you also added the commands to Sleep, and ShutDown the MC server on your new "Panel" page; and these commands seem to work just fine without authentication. So you need to be consistent here I think..

Title: Re: Did you change something in MCWS in v22
Post by: Hendrik on July 30, 2016, 10:59:28 am
Just for info: I notice that you also added the commands to Sleep, and ShutDown the MC server on your new "Panel" page; and these commands seem to work just fine without authentication. So you need to be consistent here I think..

Panel doesn't do anything but call MCWS.
Title: Re: Did you change something in MCWS in v22
Post by: AndrewFG on July 30, 2016, 12:51:10 pm
Ok. Just for the avoidance of doubt: When I navigate to the hard wired MCWS link to shut down the PC, the browser pops up a password login screen the first time the link is used. And so I assumed that when I press the shutdown button in Panel, it would also pop up a login screen. But it didn't. Is that because the Panel shutdown button is the same URL as the hard wired MCWS link, and so the credentials had already been cached in the browser for that URL?

Title: Re: Did you change something in MCWS in v22
Post by: Hendrik on July 30, 2016, 01:11:40 pm
If you authorized once then your browser probably keeps sending it to any follow up requests.