-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #3253 - make User-Agent
configurable
#3255
base: develop
Are you sure you want to change the base?
Fixes #3253 - make User-Agent
configurable
#3255
Conversation
Thank you for this PR! First thing, the test fails are unrelated to your changes, we had problems with one unit test which are now fixed on I'm not sure if we need the new userAgent: `Mozilla/5.0 (Node.js ${Number(process.version.match(/^v(\d+\.\d+)/)[1])}) MagicMirror/${global.version}`, in this file and then use this property with But before refactoring this may @rejas can review and tell us what he prefers ... |
9c3e6e3
to
49c8353
Compare
In the beginning I thought about that as well, but it felt a little bit odd to have all those variables in a configuration string by default. Also I wasn't sure when those variables are available and in case someone wants to use other runtime variables in here, that might lead to issues - that's why I added the possibility to use it with a callback as well. I also thought about, wether it would make sense to add a parameter (e.g. the module name, url, ...) to the method, so that it could be possible to use different user agents based upon those parameters. Based on those thoughts i decided to wrap it in a utility method to allow easier, non-breaking, changes in the future. But if you prefer to consume the |
and I forgot something yesterday because So I'm fine with merging this. |
since when does config. not work? you have to pass it from browser side to node helper, |
may I'm wrong but AFAIK you can't get e.g. |
yes, but 'special' is tiny.. from my MMM-Config
|
so for using I'm fine with both solutions. |
and then in node_helper to use it, its payload.config.userAgent (or whatever variable payload is stored in) and you can get it ALL with this.config.global_config = config we have no cross module protection on the config data |
Adds a configuration option to overwrite the default
User-Agent
header that is send at least by the calendar and news module. Allows other modules to use the individual user agent as well.The configuration accepts either a string or a function:
or