Replies: 5 comments 6 replies
-
While possible, I’m not sure about adding support for file handling… I don’t see the need because I think it’d be quite redundant. I would instead write a script that reads the HTML file, construct a JSON object, and send it to the JSON-RPC server. This gives both convenience and more flexibility, e.g. it’s easy to make it do more than just reading from a file. For example, my fleet of Jamulus servers have the same welcome message format. Instead of a file, I set up a central server that exposes an endpoint. Every 10 second, a script fetches I do not recommend manually editing HTML in JSON. I would recommend putting HTML in HTML files and have a script convert it for you. (Thanks for the tag @ann0see) |
Beta Was this translation helpful? Give feedback.
-
Currently whether the parameter is a file or directly contains the text is determined at server start up, not dynamically. Of course, the constructor could be changed to move the code into a method and call that with the argument, so the same method could be called with a value whilst the server is running. As far as I'm aware, the server UI can't enter a filename with the message content: the field is always used as the value directly. Making this change would change that behaviour, too (which is an improvement worth having, in my view). |
Beta Was this translation helpful? Give feedback.
-
@rdica - are you saying that your servers would have a pre-populated set of welcome messages accessible within the server’s filesystem and you’re looking for an RPC method to switch among them? Example: Ok, now load the welcome message from /path/to/file2 and use it… |
Beta Was this translation helpful? Give feedback.
-
Upon server startup, if the welcome message text passed via the command line is determined to be a valid filename, the file is read and its contents used as the message, but the name of the file is not preserved. I think there are two ways to address this: If the welcome message passed on the command line is determined to be a file, preserve that filespec so it could easily be reloaded in the future. Would require some logic and and additional class property. It would also require a new RPC call to "reload" a filespec that was already specified. Alternatively, and maybe better as it addresses multiple use cases (and how I believe @pljones interpreted this): Change the logic of SetWelcomeMessage itself to check if the welcome message being passed to it is a file that exists. This is basically what is done during server startup prior to setting the welcome. The added benefits would be that the existing RPC call (unmodified) could be used to: a) read any file as a welcome message, and b) switch between html messages and file-based messages. Further, (and I need to test this) you could now enter a filespec in the server UI welcome message textbox as well. So, @rdica, this would address your issue, but you would need to know the name of the file you want to reload via RPC. I believe there is an inherent security issue here (and with the code as it exists today) that passing a file as a welcome message (via the command line or ultimately via RPC) could expose sensitive information. Ex: -w /etc/passwd I'm sure this must have been raised in the past at some point. |
Beta Was this translation helpful? Give feedback.
-
It was a shot in the dark since a filepath is a string, but a test showed that using this method to change the welcome message ended literally showing
/path/to/file
as the welcome message instead of its contents, as the-w /path/to/file
cli arg does.While I'm aware I can paste a bunch of html code into the json object, that's unwieldly, especially for the more elaborate welcome messages I've seen out there. It'd be easier to point to a file.
Is it possible for this method to behave as
-w
option does, or if not, can a new method be added to the api to handle files as welcome message contents?Beta Was this translation helpful? Give feedback.
All reactions