* Gets the preferred `User-Agent` * @returns {string} `User-Agent` to be used
()
| 209 | * @returns {string} `User-Agent` to be used |
| 210 | */ |
| 211 | function getUserAgent () { |
| 212 | const defaultUserAgent = `Mozilla/5.0 (Node.js ${Number(process.version.match(/^v(\d+\.\d+)/)[1])}) MagicMirror/${global.version}`; |
| 213 | |
| 214 | if (typeof global.config === "undefined") { |
| 215 | return defaultUserAgent; |
| 216 | } |
| 217 | |
| 218 | switch (typeof global.config.userAgent) { |
| 219 | case "function": |
| 220 | return global.config.userAgent(); |
| 221 | case "string": |
| 222 | return global.config.userAgent; |
| 223 | default: |
| 224 | return defaultUserAgent; |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * Gets environment variables needed in the browser. |
no outgoing calls
no test coverage detected