It works fine once I have enabled it in the Roon > Settings > Extensions dialog.
However, if I quit and restart Roon, it stops working. If I go back to the Roon > Settings > Extensions dialog again I can see it discovered as a new extension (with the same name). Viewing already enabled extensions shows the original still enabled. Enabling the new version makes it work again. So then I have two identical entries in the already enabled extensions box.
The same behaviour occurs if I close my laptop and re-open it.
So can anyone help me understand how Roon identifies discovered extensions as unique? Anything I can do to fix this?
When the user enables the extension in the settings page in Roon, Roon sends a random “token” string to the extension.
The extension saves the token string, and sends it to Roon the next time it is restarted.
If Roon sees a token it remembers being authorized it trusts that extension and doesn’t show the enable button.
My best guess is that the http-api extension isn’t saving the token value, or perhaps isn’t resending it correctly. I’m not sure how helpful that is exactly, just trying to get back into the habit of responding here when I can.
This problem is now resolved for me. In case anyone else has the same symptoms, here’s what I found / did.
I’m on a Mac. I’m running Roon core locally.
I had installed the roon-extension-http-api into /Users/me/roon/roon-extension-http-api/
After firing up node to run the extension, a file called config.json appeared in this directory, which (confusingly to me, at least) seems to be written by Roon itself, not by the extension. It contains the magic token.
Subsequently restarting the extension and/or Roon worked fine - the token persisted and the extension was remembered by Roon.
In order to launch the extension automatically on boot, I had created a Mac launch agent. This didn’t “remember” extension authorisations at first, because (it transpired) Roon couldn’t find the config.json file. Adding a WorkingDirectory key to the launch agent plist fixes the issue.
Now sending GET requests to localhost:3001 allows me to control Roon. I am using Alfred to bind hotkeys to curl requests for volume up, volume down and play/pause, which now work globally (ie, no matter what app has focus).
For reference, that file is written by the library we wrote for node.js code to interface with the Roon API. It’s technically part of the extension, in that it lives in the extension code, but it’s a couple layers away from what people normally think of as “an extension” that they might write or ship to someone.
I found the place where the token is transmitted from the roon core to the extension (roon.extension_reginfo.token).
Sorry, but I have no idea how to submit the token next time I start the plugin?
Help would be appreciated.
I found that I had to allow writing in the app’s directory.
If the “config.json” file can be written it will be used next time the extension is started. So authentication is no more an issue for me