INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Did you change something in MCWS in v22  (Read 6951 times)

AndrewFG

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3392
Did you change something in MCWS in v22
« 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?

Logged
Author of Whitebear Digital Media Renderer Analyser - http://www.whitebear.ch/dmra.htm
Author of Whitebear - http://www.whitebear.ch/mediaserver.htm

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72550
  • Where did I put my teeth?
Re: Did you change something in MCWS in v22
« Reply #1 on: July 28, 2016, 11:03:42 am »

Do you have an example of a command you're using?
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10970
Re: Did you change something in MCWS in v22
« Reply #2 on: July 28, 2016, 11:14:59 am »

Some commands enforce authentication now, mostly things that can mess with the system, like shutdown etc.
Logged
~ nevcairiel
~ Author of LAV Filters

AndrewFG

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3392
Re: Did you change something in MCWS in v22
« Reply #3 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?
Logged
Author of Whitebear Digital Media Renderer Analyser - http://www.whitebear.ch/dmra.htm
Author of Whitebear - http://www.whitebear.ch/mediaserver.htm

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4277
Re: Did you change something in MCWS in v22
« Reply #4 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
Logged

AndrewFG

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3392
Re: Did you change something in MCWS in v22
« Reply #5 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

Logged
Author of Whitebear Digital Media Renderer Analyser - http://www.whitebear.ch/dmra.htm
Author of Whitebear - http://www.whitebear.ch/mediaserver.htm

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4277
Re: Did you change something in MCWS in v22
« Reply #6 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

Logged

AndrewFG

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3392
Re: Did you change something in MCWS in v22
« Reply #7 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..
Logged
Author of Whitebear Digital Media Renderer Analyser - http://www.whitebear.ch/dmra.htm
Author of Whitebear - http://www.whitebear.ch/mediaserver.htm

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4277
Re: Did you change something in MCWS in v22
« Reply #8 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
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10970
Re: Did you change something in MCWS in v22
« Reply #9 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.
Logged
~ nevcairiel
~ Author of LAV Filters

AndrewFG

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3392
Re: Did you change something in MCWS in v22
« Reply #10 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?

Logged
Author of Whitebear Digital Media Renderer Analyser - http://www.whitebear.ch/dmra.htm
Author of Whitebear - http://www.whitebear.ch/mediaserver.htm

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10970
Re: Did you change something in MCWS in v22
« Reply #11 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.
Logged
~ nevcairiel
~ Author of LAV Filters

AndrewFG

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3392
Re: Did you change something in MCWS in v22
« Reply #12 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..

Logged
Author of Whitebear Digital Media Renderer Analyser - http://www.whitebear.ch/dmra.htm
Author of Whitebear - http://www.whitebear.ch/mediaserver.htm

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10970
Re: Did you change something in MCWS in v22
« Reply #13 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.
Logged
~ nevcairiel
~ Author of LAV Filters

AndrewFG

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3392
Re: Did you change something in MCWS in v22
« Reply #14 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?

Logged
Author of Whitebear Digital Media Renderer Analyser - http://www.whitebear.ch/dmra.htm
Author of Whitebear - http://www.whitebear.ch/mediaserver.htm

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10970
Re: Did you change something in MCWS in v22
« Reply #15 on: July 30, 2016, 01:11:40 pm »

If you authorized once then your browser probably keeps sending it to any follow up requests.
Logged
~ nevcairiel
~ Author of LAV Filters
Pages: [1]   Go Up