How can I start a node.js proxy server from Photoshop UXP

Hi,

How can I start a node.js proxy server programmatically without user activity from Photoshop before my UXP plugin starting.

Thx
Karoly

Short answer: You can’t (from within the UXP plugin).

Longer answer: There’s an API coming that will let you launch an application registered with a URI scheme or with a path. However, the user must consent to this, and Ps does not currently allow plugins to start without some degree of user interaction.

As such, right now, this is not possible without writing some sort of helper application that takes care of this step for you.

1 Like

Hi Kerri,

If I understood right, with the improved API will come some UI which allows the user to enable it. (Like windows install ask permission for administrator account).
Have you some information about roadmap?

Thank you for your quick answer.

/Karoly

@kerrishotts Is there a way to pass command line flags to an external application?

1 Like

This is something need as well.

No there is not. I asked UXP team for it. They want to add it but I have no idea when I could expect it.

@Jarda Thanks for the info. Would be hugely helpful to work with some CLI tools.

Hybrid plugin taken from Bolt would be your best bet right now. But it will have some general consequences related to C++ libraries. Hybrid execSync() and exec() Updates · Issue #8 · hyperbrew/bolt-uxp · GitHub

@justin2taylor

1 Like

I was recently having a similar discussion, trying to point out how this kind of glue is used in pipelines.

Depending on what one needs there is usually a way around. Yes, you can go all-out with a hybrid, but I am wary of suggesting that. The reason is that it actually gives too much access. We want users to fully aware of the access they are granting by installing a plugin. If so many UXP plugins end up as basic hybrid, then we risk users just expecting that as normal and click through the security warnings.

If you don’t need responses from a subprocess you could always uses a batch/shell script (with appropriate file system association).
https://developer.adobe.com/photoshop/uxp/2022/uxp-api/reference-js/Modules/uxp/shell/Shell/#openpathpath-developertext

1 Like

I agree it’s a very heavy hammer. But in my humble opinion a way around that would have been for UXP to provide the needed functionality as part of the Javascript API. For instance an ‘exec’ function (with status/output return) could have been provided with a similar fine-grained permission scheme as we have for file access etc. (I.e. you could grant permission to run a specific command and/or have that be listed in the manifest). Similarly it would have been nice to have a mechanism to read environment variables (again listing the ones needed in the manifest). I am convinced, that just those two functionalities would probably have covered most of the pipeline needs out there. :slight_smile:

Being able to run server on UXP side would greatly reduce this need as well.

2 Likes